From 670c3f7e1d053f8e4466b9b48c238329395848dd Mon Sep 17 00:00:00 2001 From: Stefan Karpinski Date: Sat, 15 May 2010 01:45:45 -0400 Subject: [PATCH] libc.j: sleep and fork. --- libc.j | 4 ++++ prim.j | 1 + start.j | 1 + 3 files changed, 6 insertions(+) create mode 100644 libc.j diff --git a/libc.j b/libc.j new file mode 100644 index 0000000000000..daa2016bcf785 --- /dev/null +++ b/libc.j @@ -0,0 +1,4 @@ +libc = dlopen("libc") + +sleep(s::Scalar) = ccall(dlsym(libc,"usleep"), Uint32, (Uint32,), uint32(round(s*1e6))) +fork() = ccall(dlsym(libc,"fork"), Int32, ()) diff --git a/prim.j b/prim.j index 0acf0b0f68a4c..422af39dbed64 100644 --- a/prim.j +++ b/prim.j @@ -1,6 +1,7 @@ typealias Nullable{T} Union(T,()) typealias Index Int32 typealias Size Int32 +typealias String Array{Uint8,1} (<:)(T::Type, S::Type) = subtype(T,S) (:>)(T::Type, S::Type) = subtype(S,T) diff --git a/start.j b/start.j index 069fdce4c433d..e6e1a93820dbd 100644 --- a/start.j +++ b/start.j @@ -12,3 +12,4 @@ load("dequeue.j") #load("tree.j") load("array.j") load("mathfunctions.j") +load("libc.j")