Mercurial > repos > rhope
diff cbackend.rhope @ 92:e73a93fb5de1
Beginning of port of compiler to itself, some bugfixes and a refcount optimization
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Mon, 02 Aug 2010 00:58:55 -0400 |
parents | bcdc326b3d6e |
children | 5a08705f7610 |
line wrap: on
line diff
--- a/cbackend.rhope Sat Jul 31 17:17:23 2010 -0400 +++ b/cbackend.rhope Mon Aug 02 00:58:55 2010 -0400 @@ -765,9 +765,11 @@ If[[name]=["Call"]] { to call <- [args]Index[0] - out <- [[[[[func]Add Raw Line[[["if (get_blueprint("]Append[Make Op[Strip Addref[to call], func]]]Append[")->type_id == TYPE_WORKER) {"]] + last numparams <- [func]Last NumParams >> + out <- [[[[[[func]Add Raw Line[[["if (get_blueprint("]Append[Make Op[Strip Addref[to call], func]]]Append[")->type_id == TYPE_WORKER) {"]] ]Val Call[to call, Tail[args,1]] ]Add Raw Line["} else {"] + ]Last NumParams <<[last numparams] ]Func Base["Call",args, "Call"] ]Add Raw Line["}"] }{ @@ -1210,7 +1212,7 @@ }{ If[[valtype] = ["String"]] { - out <- [["make_String(\""]Append[ [[[value]Replace["\\", "\\\\"]]Replace["\n", "\\n"]]Replace["\"", "\\\""] ]]Append["\")"] + out <- [["make_String(\""]Append[ [[[[value]Replace["\\", "\\\\"]]Replace["\n", "\\n"]]Replace["\r", "\\r"]]Replace["\"", "\\\""] ]]Append["\")"] }{ If[[valtype]=["Worker Literal"]] { @@ -1280,7 +1282,7 @@ { If[[valtype]=["List"]] { - out <- [Fold[["_Set List Els"]Set Input[3, type reg], "\trhope(FUNC_List, inout, 0, 1);\n", value] + out <- [Fold[["_Set List Els"]Set Input[3, type reg], [text]Append["\trhope(FUNC_List, inout, 0, 1);\n"], value] ]Append[[["\t_const_"]Append[Escape Rhope Name[name]]]Append[" = inout[0];\n"]] }{ Const Construct C[value,type reg]