Mercurial > repos > rhope
diff testc.rhope @ 184:c6ba9fe45910
Strip _c from filenames of current compiler
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Wed, 27 Jul 2011 21:28:43 -0700 |
parents | testc_c.rhope@5a08705f7610 |
children |
line wrap: on
line diff
--- a/testc.rhope Wed Jul 27 21:14:23 2011 -0700 +++ b/testc.rhope Wed Jul 27 21:28:43 2011 -0700 @@ -1,12 +1,41 @@ Import cbackend.rhope +Import number.rhope +Import boolean.rhope + +//Dummy versions of nworker methods so the code in number_c.rhope will compile +Register Worker[prog,name,convention,inputs,outputs:out] +{ + out <- prog +} + +Bind Worker[prog,name,worker:out] +{ + out <- prog +} + +Blueprint NWorker +{ + Inputs + Input Types + Outputs + Output Types + Builtin? +} + +NWorker[convention:out] +{ + out <- convention +} Main[] { - prog <- C Program[] - base <- [[[[[[[prog]Create Function["Fib",("n"),("out"),""] - ]Allocate Var["work1", "Any Type"] - ]Allocate Var["work2", "Any Type"] - ]Null["out"] + prog <- [[C Program[]]Generate Number Methods]Generate Boolean Methods + base <- [[[[[[[[[prog]Create Function["Fib",("n"),("out"),"rhope"] + ]Allocate Var["work1", Type Instance["Any Type"]] + ]Allocate Var["work2", Type Instance["Any Type"]] + ]Register Constant["const_1", 1] + ]Register Constant["const_2", 2] + ]Set Null["out"] ]Method Call["<", [[()]Append[AddRef["n"]]]Append[AddRef[Constant["const_2"]]]] ]Move[Result[0], "work1"] ]Method Call["If", [()]Append["work1"]] @@ -17,11 +46,9 @@ ]Move[AddRef[Constant["const_1"]], "out"] {Print["stream1 done"]} - stream3 <- [[[base]Instruction Stream - ]Release["n"] - ]Tail Method Call["+", ("work1","work2")] + - stream2 <- [[[[[[[[[[[base]Instruction Stream + [[[[[[[[[[base]Instruction Stream ]Release[Result[0]] ]Method Call["-", [[()]Append[AddRef["n"]]]Append[AddRef[Constant["const_1"]]]] ]Move[Result[0], "work1"] @@ -31,8 +58,14 @@ ]Move[Result[0], "work1"] ]Call["Fib", ("work2")] ]Move[Result[0], "work2"] - ]Do If[NotCond["out"], stream3] - {Print["stream2 done"]} + { + stream3 <- [[[~]Instruction Stream + ]Release["n"] + ]Method Call["+", ("work1","work2")] + stream2 <- [~]Do If[NotCond["out"], stream3] + {Print["stream2 done"]} + } + func <- [[[base ]Do If[Result[0], stream1] @@ -40,7 +73,15 @@ ]Release["n"] {Print["func done"] } - Print[[[prog]Store Function[func]]Text] - + main <- [[[[prog]Create Function["Main", (), ("out"), "rhope"] + ]Register Constant["const_30", 30] + ]Call["Fib", [()]Append[Constant["const_30"]]] + ]Move[Result[0], "out"] + + text <- [[[prog]Store Function[func] + ]Store Function[main] + ]Text + Print[[text]Length] + { Print[text] } }