diff cbackend.rhope @ 99:e09c2d1d6d5b

Got dataflow graph code working in compiler (nworker_c.rhope)
author Mike Pavone <pavone@retrodev.com>
date Fri, 06 Aug 2010 01:42:37 -0400
parents 5a08705f7610
children f51c4c17457c
line wrap: on
line diff
--- a/cbackend.rhope	Tue Aug 03 23:51:39 2010 -0400
+++ b/cbackend.rhope	Fri Aug 06 01:42:37 2010 -0400
@@ -333,14 +333,14 @@
 			]Set["Boolean", "TYPE_BOOLEAN"]		//9
 			]Set["Float32", "TYPE_FLOAT32"]		//10
 			]Set["Float64", "TYPE_FLOAT64"]		//11
-			]Set["Real Number", "TYPE_FLOAT64"]	//12
-			]Set["Blueprint", "TYPE_BLUEPRINT"]	//13
-			]Set["Array", "TYPE_ARRAY"]			//14
-			]Set["Boxed Array", "TYPE_BOXEDARRAY"]//15
-			]Set["Worker", "TYPE_WORKER"]		//16
-			]Set["Method Missing Exception", "TYPE_METHODMISSINGEXCEPTION"]	//17
-			]Set["Field Missing Exception", "TYPE_FIELDMISSINGEXCEPTION"]	//18
-			]Set["Wrong Type Exception", "TYPE_WRONGTYPEEXCEPTION"]]		//19
+			]Set["Real Number", "TYPE_FLOAT64"]	
+			]Set["Blueprint", "TYPE_BLUEPRINT"]	//12
+			]Set["Array", "TYPE_ARRAY"]			//13
+			]Set["Boxed Array", "TYPE_BOXEDARRAY"]//14
+			]Set["Worker", "TYPE_WORKER"]		//15
+			]Set["Method Missing Exception", "TYPE_METHODMISSINGEXCEPTION"]	//16
+			]Set["Field Missing Exception", "TYPE_FIELDMISSINGEXCEPTION"]	//17
+			]Set["Wrong Type Exception", "TYPE_WRONGTYPEEXCEPTION"]]		//18
 		]Definitions << [Dictionary[]]
 		]Next ID <<[0]
 }
@@ -1175,6 +1175,15 @@
 	out <- [text]Append[ [["object * _const_"]Append[Escape Rhope Name[name]]]Append[";\n"] ]
 }
 
+_List Literal El[text,val,index,type reg:out]
+{
+	out <- [[[[text
+		]Append[", "]
+		]Append[index]
+		]Append[", "]
+		]Append[Const Construct C[val, type reg]]
+}
+
 Const Construct C[value,type reg:out]
 {
 	valtype <- Type Of[value]
@@ -1230,7 +1239,12 @@
 									]Append[Fold[["+"]Set Input[0, 1], 0, [value]Args >>]]
 									]Append[")"]
 						}{
-							out <- "UnhandledLiteralType"
+							If[[valtype]=["List"]]
+							{
+								out <- [Fold[["_List Literal El"]Set Input[3, type reg], ["make_List("]Append[[value]Length], value]]Append[")"]
+							}{
+								out <- "UnhandledLiteralType"
+							}
 						}
 					}
 				}
@@ -1273,6 +1287,7 @@
 			[[";\n\tinout[2] = "
 			]Append[Const Construct C[el, type reg]]
 			]Append[";\n"]
+
 		]]]Append["\trhope(FUNC_Set, inout, 3, 3);\n"]
 }