Mercurial > repos > rhope
diff kernel.rhope @ 136:fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 14 Nov 2010 23:07:55 -0500 |
parents | 8aedae4f4ddd |
children | f2cb85c53ced |
line wrap: on
line diff
--- a/kernel.rhope Sun Nov 14 03:09:49 2010 -0500 +++ b/kernel.rhope Sun Nov 14 23:07:55 2010 -0500 @@ -1,3 +1,4 @@ +Import kernelbase.rhope Import array.rhope Import string.rhope Import list.rhope @@ -6,11 +7,6 @@ Import dict.rhope Import range.rhope -Val[in:out] -{ - out <- in -} - Blueprint Boolean { Val(Int32,Naked) @@ -39,27 +35,12 @@ yes,no <- If[[num]!=[0i64]] } -Blueprint Int32 -{ - Num(Int32,Naked) -} - -If@Int32[num:yes,no] -{ - yes,no <- If[[num]!=[0i32]] -} - Foreign C:libc { write[filedes(Int32,Naked),buf(Array,Raw Pointer),nbyte(Int64,Naked):written(Int32,Naked)] read[filedes(Int32,Naked),buf(Array,Raw Pointer,Mutable),nbyte(Int64,Naked):read(Int64,Naked),buf] } -Trunc UInt8@UInt8[in:out] -{ - out <- in -} - __String Int[n,buf,ten:out] { If[[n] < [ten]] @@ -168,16 +149,6 @@ yes,no <- If[[num]!=[0u64]] } -Blueprint UInt32 -{ - Num(UInt32,Naked) -} - -If@UInt32[num:yes,no] -{ - yes,no <- If[[num]!=[0u32]] -} - Blueprint UInt16 { Num(UInt16,Naked) @@ -188,16 +159,6 @@ yes,no <- If[[num]!=[0u16]] } -Blueprint UInt8 -{ - Num(UInt8,Naked) -} - -If@UInt8[num:yes,no] -{ - yes,no <- If[[num]!=[0u8]] -} - Abs@Int64[num:out] { If[[num]<[0i64]] @@ -205,13 +166,6 @@ { out <- num } } -Abs@Int32[num:out] -{ - If[[num]<[0i32]] - { out <- [0i32]-[num] } - { out <- num } -} - Abs@Int16[num:out] { If[[num]<[0i16]] @@ -226,11 +180,6 @@ { out <- num } } -Mod[a,b:out] -{ - out <- [a]-[[[a]/[b]]*[b]] -} - Foreign C:runtime { _internal_blueprint_eq[left(Blueprint),right(Blueprint):out(Int32,Naked)] @@ -299,42 +248,6 @@ out <- [_internal_blueprint_eq[left,right]]!=[0] } -And[left,right:out] -{ - ,out <- If[left] - { - out,out <- If[right] - } -} - -Or[left,right:out] -{ - out <- If[left] {} - { - out <- right - } -} - -Min[a,b:out] -{ - If[[a]<[b]] - { - out <- a - }{ - out <- b - } -} - -Max[a,b:out] -{ - If[[a]>[b]] - { - out <- a - }{ - out <- b - } -} - _Keys[list,val,key:out] { out <- [list]Append[key]