Skip to content

Commit

Permalink
Merge pull request #441 from splattael/crystal-lang
Browse files Browse the repository at this point in the history
Add support for crystal language
  • Loading branch information
dblessing authored Jul 23, 2018
2 parents c5f4288 + bb03a04 commit d445dc5
Show file tree
Hide file tree
Showing 4 changed files with 541 additions and 0 deletions.
45 changes: 45 additions & 0 deletions lib/rouge/demos/crystal
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
lib LibC
WNOHANG = 0x00000001

@[ReturnsTwice]
fun fork : PidT
fun getpgid(pid : PidT) : PidT
fun kill(pid : PidT, signal : Int) : Int
fun getpid : PidT
fun getppid : PidT
fun exit(status : Int) : NoReturn

ifdef x86_64
alias ClockT = UInt64
else
alias ClockT = UInt32
end

SC_CLK_TCK = 3

struct Tms
utime : ClockT
stime : ClockT
cutime : ClockT
cstime : ClockT
end

fun times(buffer : Tms*) : ClockT
fun sysconf(name : Int) : Long
end

class Process
def self.exit(status = 0)
LibC.exit(status)
end

def self.pid
LibC.getpid
end

def self.getpgid(pid : Int32)
ret = LibC.getpgid(pid)
raise Errno.new(ret) if ret < 0
ret
end
end
Loading

0 comments on commit d445dc5

Please sign in to comment.