diff cbackend_c.rhope @ 120:cd25171e1bb2

Use List for Subsets instead of a Dictionary for performance reasons. Fix issue with List literals. Compiled compiler is now self-hosting.
author Mike Pavone <pavone@retrodev.com>
date Thu, 21 Oct 2010 23:55:15 -0400
parents b3f56e1d54a0
children 4e4ecbca0b5d
line wrap: on
line diff
--- a/cbackend_c.rhope	Mon Oct 18 00:50:18 2010 -0400
+++ b/cbackend_c.rhope	Thu Oct 21 23:55:15 2010 -0400
@@ -633,6 +633,7 @@
 }
 
 
+
 Set Field Null@C Function[func,var,field:out]
 {
 	out <- [func]Add Statement[ [[func]Field Result[var,field]]Append[" = NULL"] ]
@@ -1233,7 +1234,7 @@
 
 				[(String(),String Slice(),String Cat())]Find[=[valtype,?]]
 				{
-					out <- [["make_String(\""]Append[ [[[value]Replace["\\", "\\\\"]]Replace["\n", "\\n"]]Replace["\"", "\\\""] ]]Append["\")"]
+					out <- [["make_String(\""]Append[ [[[[value]Replace["\\", "\\\\"]]Replace["\n", "\\n"]]Replace["\"", "\\\""]]Replace["\r", "\\r"] ]]Append["\")"]
 				}{
 					If[[valtype]=[Worker Literal()]]
 					{
@@ -1281,6 +1282,7 @@
 	valtype <- Blueprint Of[value]
 	[(String(),String Cat(),String Slice(),Worker Literal(),List(),List Leaf())]Find[=[valtype,?]]
 	{
+		Print[[name]Append[" is not of an early constant type"]]
 		out <- text
 	}{
 		Const Construct C[value,type reg]
@@ -1307,7 +1309,7 @@
 	{
 		If[[~]>[3]]
 		{
-			out <- [Fold[_Set List Els[?, ?, ?, type reg], "\trhope(FUNC_List, inout, 0, 1);\n", value]
+			out <- [Fold[_Set List Els[?, ?, ?, type reg], [text]Append["\trhope(FUNC_List, inout, 0, 1);\n"], value]
 				]Append[[["\t_const_"]Append[Escape Rhope Name[name,[type reg]Escape Pattern >>]]]Append[" = inout[0];\n"]]
 		}{
 			Const Construct C[value,type reg]