# HG changeset patch # User Mike Pavone # Date 1288924851 0 # Node ID 50406500334d469ad1873ff43932461fa6e8297c # Parent e556416e9c91ecb03d84fc887b8ebd8e17e8dbae Port availability of type names at runtime to compiled compiler diff -r e556416e9c91 -r 50406500334d cbackend_c.rhope --- 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 \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)