changeset 127:50406500334d

Port availability of type names at runtime to compiled compiler
author Mike Pavone <pavone@retrodev.com>
date Fri, 05 Nov 2010 02:40:51 +0000
parents e556416e9c91
children 5eedee9063dc
files cbackend_c.rhope
diffstat 1 files changed, 14 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/cbackend_c.rhope	Thu Oct 28 21:07:03 2010 -0400
+++ b/cbackend_c.rhope	Fri Nov 05 02:40:51 2010 +0000
@@ -389,6 +389,11 @@
 	}
 }
 
+Defined?@C Type Registry[reg,name:yep,nope]
+{
+	yep,nope <- [[reg]Definitions >>]Index[name]
+}
+
 Blueprint C Function
 {
 	Name
@@ -1468,6 +1473,13 @@
 		]Append[")\n\n"]
 }
 
+Init Type Names[text,typeid,name,reg:out]
+{
+	[reg]Defined?[name]
+	{ out <- [text]Append[ [[[["\tregistered_types["]Append[typeid]]Append["]->name = "]]Append[Const Construct C[name, reg]]]Append[";\n"] ] }
+	{ out <- text }
+}
+
 Text@C Program[program:out]
 {
 	p <- [program]Escape Pattern >>
@@ -1486,7 +1498,7 @@
 #include \"worker.h\"
 #include \"bool.h\"
 #include <sys/time.h>\n\n"
-	out <- [[[[[[[[[[[[[[[[[headers
+	out <- [[[[[[[[[[[[[[[[[[headers
 		]Append[[program]Dispatch[all methods]]
 		]Append[[[program]Type Registry >>]Type Defs]
 		]Append[Fold[_Consts C Program[?,?,?,p], 
@@ -1609,6 +1621,7 @@
 		]Append[ [[program]Type Registry >>]Type Inits[[program]Method Registry >>, [program]Field Registry >>] ]
 		]Append[Fold[_Set Consts C Program[?, ?, ?, [program]Type Registry >>], "", constants]]
 		]Append[Fold[_Set Late Consts C[?, ?, ?, [program]Type Registry >>], "", constants]]
+		]Append[Fold[Init Type Names[?, ?, ?, [program]Type Registry >>], "", [[program]Type Registry >>]Lookup >>]]
 		]Append["
 	rhope(FUNC_List, inout, 0, 1);
 	for (idx = 0; idx < argc; ++idx)