# HG changeset patch # User Mike Pavone # Date 1286848429 14400 # Node ID 7ca80654c9bb7de6b5d273889249294d36031779 # Parent fd23ab2c1a739a63d47c193195fd89b030f7be2c# Parent 336da6ce8174c5bc50bee64517586ea6dfeb8f2b Merge Escape Rhope Name performance hack back in diff -r fd23ab2c1a73 -r 7ca80654c9bb backendutils_c.rhope --- a/backendutils_c.rhope Mon Oct 11 21:53:27 2010 -0400 +++ b/backendutils_c.rhope Mon Oct 11 21:53:49 2010 -0400 @@ -1,9 +1,7 @@ -Escape Rhope Name[name:out] +Escape Rhope Name[name,p:out] { - escaped <- [name]Replace[ - ("_", "@", " ", ":", "?", "+", "-", "*", "/", "<", ">", "(", ")", "!", "=", "'", - "\"", "\t", ",", ".", "\n", "{", "}", "[", "]", "#", "\\", "\r", ";", "&", "|", "%", "^", "`", "~"), + escaped <- [name]Replace[p, ("UN_","AT_","SP_","CN_","QN_","PL_","MN_","TM_","DV_","LT_","GT_","LP_","RP_","NT_","EQ_","PR_", "DP_","TB_","CM_","PD_","NL_","LC_","RC_", "LS_", "RS_", "HS_", "BS_", "CR_", "SC_", "AM_", "PI_", "PC_", "CT_", "BT_", "TD_")] diff -r fd23ab2c1a73 -r 7ca80654c9bb cbackend_c.rhope --- a/cbackend_c.rhope Mon Oct 11 21:53:27 2010 -0400 +++ b/cbackend_c.rhope Mon Oct 11 21:53:49 2010 -0400 @@ -114,7 +114,7 @@ out <- Fold[_Register Field C[?], field reg, [ctype]Fields >>] } -Rhope Type to C[type:out,array] +Rhope Type to C[type,p:out,array] { If[[Blueprint Of[type]]=[Type Instance()]] { @@ -205,30 +205,30 @@ { escaped <- Val[typename] }{ - escaped <- Escape Rhope Name[typename] + escaped <- Escape Rhope Name[typename,p] } out <- [[prefix]Append[escaped]]Append[postfix] } -_Type Def C Type[text,field:out] +_Type Def C Type[text,field,p:out] { name <- [field]Index[0] - ,postfix <- Rhope Type to C[[field]Index[1]] + ,postfix <- Rhope Type to C[[field]Index[1],p] { type <- ["\n\t"]Append[~] } - out <- [[[[text]Append[type]]Append[" "]]Append[[Escape Rhope Name[name]]Append[postfix]]]Append[";"] + out <- [[[[text]Append[type]]Append[" "]]Append[[Escape Rhope Name[name,p]]Append[postfix]]]Append[";"] } -Type Def@C Type[ctype:out] +Type Def@C Type[ctype,p:out] { If[[[[ctype]Fields >>]Length] = [1]] { - out <- [[[[_Type Def C Type["typedef struct {\n\tobject _SP_header;\n\t", [[ctype]Fields >>]Index[0]]]Append["\n} t_"]]Append[Escape Rhope Name[[ctype]Name >>]]]Append[";"] + out <- [[[[_Type Def C Type["typedef struct {\n\tobject _SP_header;\n\t", [[ctype]Fields >>]Index[0], p]]Append["\n} t_"]]Append[Escape Rhope Name[[ctype]Name >>,p]]]Append[";"] ]Append[ [[[["typedef " - ]Append[Rhope Type to C[ [[[ctype]Fields >>]Index[0]]Index[1] ]] + ]Append[Rhope Type to C[ [[[ctype]Fields >>]Index[0]]Index[1],p ]] ]Append[" nt_"] - ]Append[Escape Rhope Name[[ctype]Name >>]] + ]Append[Escape Rhope Name[[ctype]Name >>,p]] ]Append[";"] ] }{ //HACK!!! @@ -239,24 +239,24 @@ [("Array","Boxed Array","Worker")]Find[=[[ctype]Name >>,?]] { oend <- "\nMObject(" } { oend <- "\nObject(" } - out <- [Fold[_Type Def C Type[?], "OBegin", [ctype]Fields >>]]Append[ [[oend]Append[Escape Rhope Name[[ctype]Name >>]]]Append[")"] ] + out <- [Fold[_Type Def C Type[?,?,p], "OBegin", [ctype]Fields >>]]Append[ [[oend]Append[Escape Rhope Name[[ctype]Name >>,p]]]Append[")"] ] } } } -_Type Init C[type name,method reg,text,method:out] +_Type Init C[type name,method reg,text,method,p:out] { - out <- [[text]Append[[["\n\tadd_method(bp, "]Append[ [method reg]Method ID[method] ]]Append[ [[", MethodName("]Append[Escape Rhope Name[method]]]Append[[","]Append[Escape Rhope Name[type name]]]]]]Append["));"] + out <- [[text]Append[[["\n\tadd_method(bp, "]Append[ [method reg]Method ID[method] ]]Append[ [[", MethodName("]Append[Escape Rhope Name[method,p]]]Append[[","]Append[Escape Rhope Name[type name,p]]]]]]Append["));"] } -_Type Init C Field[type name,field reg,text,field:out] +_Type Init C Field[type name,field reg,text,field,p:out] { fname <- [field]Index[0] - out <- [[[[text]Append[[["\n\tadd_getter(bp, "]Append[ String[[field reg]Field ID[fname]] ]]Append[ [[", MethodName("]Append[Escape Rhope Name[[fname]Append[" >>"]]]]Append[[","]Append[Escape Rhope Name[type name]]]]]]Append["));"] - ]Append[[["\n\tadd_setter(bp, "]Append[ String[[field reg]Field ID[fname]] ]]Append[ [[", MethodName("]Append[Escape Rhope Name[[fname]Append[" <<"]]]]Append[[","]Append[Escape Rhope Name[type name]]]]]]Append["));"] + out <- [[[[text]Append[[["\n\tadd_getter(bp, "]Append[ String[[field reg]Field ID[fname]] ]]Append[ [[", MethodName("]Append[Escape Rhope Name[[fname]Append[" >>"],p]]]Append[[","]Append[Escape Rhope Name[type name,p]]]]]]Append["));"] + ]Append[[["\n\tadd_setter(bp, "]Append[ String[[field reg]Field ID[fname]] ]]Append[ [[", MethodName("]Append[Escape Rhope Name[[fname]Append[" <<"],p]]]Append[[","]Append[Escape Rhope Name[type name,p]]]]]]Append["));"] } -Type Init@C Type[ctype,id,method reg,field reg:out] +Type Init@C Type[ctype,id,method reg,field reg,p:out] { [("Array","Boxed Array", "Worker")]Find[=[[ctype]Name >>, ?]] { size <- "-1" } @@ -276,7 +276,7 @@ { If[[[ctype]Name >>]=["Boolean"]] { typename <- "int32_t" } - { typename <- ["nt_"]Append[Escape Rhope Name[[ctype]Name >>]] } + { typename <- ["nt_"]Append[Escape Rhope Name[[ctype]Name >>,p]] } } } } @@ -289,11 +289,11 @@ ]Append[ [", (special_func)"]Append[ [ - [[[[Escape Rhope Name[[ctype]Init >>] + [[[[Escape Rhope Name[[ctype]Init >>,p] ]Append[", (special_func)"] - ]Append[Escape Rhope Name[[ctype]Copy >> ]] + ]Append[Escape Rhope Name[[ctype]Copy >> ,p]] ]Append[", (special_func)"] - ]Append[Escape Rhope Name[[ctype]Cleanup >>]] + ]Append[Escape Rhope Name[[ctype]Cleanup >>,p]] ]Append[");"]]] ] out <- Val[start]//Fold[[["_Type Init C Field"]Set Input[0, [ctype]Name >>]]Set Input[1, field reg], Fold[[["_Type Init C"]Set Input[0, [ctype]Name >>]]Set Input[1, method reg], start, [ctype]Methods >>], [ctype]Fields >>] } @@ -303,11 +303,12 @@ Lookup Definitions Next ID + Escape Pattern } -C Type Registry[:out] +C Type Registry[p:out] { - out <- [[[Build[C Type Registry()]]Lookup << [ + out <- [[[[Build[C Type Registry()]]Lookup << [ [[[[[[[[[[[[[[[[[[[Dictionary[] ]Set["UInt8", "TYPE_UINT8"] //1 ]Set["UInt16", "TYPE_UINT16"] //2 @@ -330,21 +331,22 @@ ]Set["Wrong Type Exception", "TYPE_WRONGTYPEEXCEPTION"]] //19 ]Definitions << [Dictionary[]] ]Next ID <<[0] + ]Escape Pattern <<[p] } -_Type Defs C[text,def:out] +_Type Defs C[text,def,p:out] { - out <- [[text]Append[[def]Type Def]]Append["\n\n"] + out <- [[text]Append[[def]Type Def[p]]]Append["\n\n"] } Type Defs@C Type Registry[reg:out] { - out <- Fold[_Type Defs C[?], "", [reg]Definitions >>] + out <- Fold[_Type Defs C[?,?,[reg]Escape Pattern >>], "", [reg]Definitions >>] } _Type Inits C[reg,method reg,field reg,text,def,name:out] { - out <- [[text]Append[ [def]Type Init[[reg]Type ID[name], method reg, field reg] ]]Append["\n\n"] + out <- [[text]Append[ [def]Type Init[[reg]Type ID[name], method reg, field reg,[reg]Escape Pattern >>] ]]Append["\n\n"] } Type Inits@C Type Registry[reg,method reg,field reg:out] @@ -403,16 +405,17 @@ Output Types Resume Index Last NumParams + Escape Pattern } -C Function[name,inputs,outputs,convention:out] +C Function[name,inputs,outputs,convention,p:out] { - out <- C Function With Registry[name,inputs,outputs,convention, C Method Registry[], C Field Registry[], C Type Registry[]] + out <- C Function With Registry[name,inputs,outputs,convention, C Method Registry[], C Field Registry[], C Type Registry[p],p] } -C Function With Registry[name,inputs,outputs,convention,registry,field reg,type reg:out] +C Function With Registry[name,inputs,outputs,convention,registry,field reg,type reg,p:out] { - out <- [[[[[[[[[[[[[[Build[C Function()] + out <- [[[[[[[[[[[[[[[Build[C Function()] ]Name <<[name] ]Inputs <<[inputs] ]Outputs <<[outputs] @@ -427,6 +430,7 @@ ]Output Types <<[ Fold[Append[?, "Any Type"], (), outputs] ] ]Resume Index <<[1] ]Last NumParams <<[-1] + ]Escape Pattern <<[p] } Set Input Type@C Function[func,type,input num:out] @@ -561,7 +565,7 @@ Lookup Constant@C Function[func,const,doaddref:out] { - var <- ["_const_"]Append[Escape Rhope Name[const]] + var <- ["_const_"]Append[Escape Rhope Name[const,[func]Escape Pattern >>]] If[doaddref] { out <- [["add_ref("]Append[var]]Append[")"] @@ -600,7 +604,7 @@ { rvar <- Val[as op] }{ - rvar <- [[[["(("]Append[ Rhope Type to C[type] ]]Append[")("]]Append[as op]]Append["))"] + rvar <- [[[["(("]Append[ Rhope Type to C[type,[func]Escape Pattern >>] ]]Append[")("]]Append[as op]]Append["))"] } }{ rvar <- Val[as op] @@ -613,7 +617,7 @@ //TODO: Generate some kind of error/exception in this case access <- "->" } - out <- [[rvar]Append[access]]Append[Escape Rhope Name[field]] + out <- [[rvar]Append[access]]Append[Escape Rhope Name[field,[func]Escape Pattern >>]] } Read Field@C Function[func,var,field:out,result op] @@ -736,14 +740,14 @@ ]Append[", "] ]Append[String[[func]Resume Index >>]] ]Append[", "] - ]Append[Escape Rhope Name[[func]Name >>]] + ]Append[Escape Rhope Name[[func]Name >>,[func]Escape Pattern >>]] ]Append[")"]] ]Add Raw Line["DISPATCH"] ]Add Raw Line[ [[[["ValCallPostlude(" ]Append[String[[func]Resume Index >>]] ]Append[", "] - ]Append[Escape Rhope Name[[func]Name >>]] + ]Append[Escape Rhope Name[[func]Name >>,[func]Escape Pattern >>]] ]Append[")"]] ]Resume Index <<[ [[func]Resume Index >>]+[1] ] } @@ -766,7 +770,7 @@ ]Func Base["Call",args, "Call"] ]Add Raw Line["}"] }{ - out <- [func]Func Base[Escape Rhope Name[name],args, "Call"] + out <- [func]Func Base[Escape Rhope Name[name,[func]Escape Pattern >>],args, "Call"] } } } @@ -800,7 +804,7 @@ ]Append[", "] ]Append[String[[func]Resume Index >>]] ]Append[", "] - ]Append[Escape Rhope Name[[func]Name >>]] + ]Append[Escape Rhope Name[[func]Name >>,[func]Escape Pattern >>]] ]Append[")"]] ]Resume Index <<[ [[func]Resume Index >>]+[1] ] } @@ -823,12 +827,12 @@ Get Field Call@C Function[func,field,source:out] { - out <- [func]Func Base[Escape Rhope Name[[field]Append[" >>"]], [()]Append[source], "Call"] + out <- [func]Func Base[Escape Rhope Name[[field]Append[" >>"],[func]Escape Pattern >>], [()]Append[source], "Call"] } Set Field Call@C Function[func,field,object,value:out] { - out <- [func]Func Base[Escape Rhope Name[[field]Append[" <<"]], [[()]Append[object]]Append[value], "Call"] + out <- [func]Func Base[Escape Rhope Name[[field]Append[" <<"],[func]Escape Pattern >>], [[()]Append[object]]Append[value], "Call"] } Tail Method Call@C Function[func,method,args:out] @@ -838,7 +842,7 @@ Tail Call@C Function[func,name,args:out] { - out <- [func]Func Base[Escape Rhope Name[name],args, "TCall"] + out <- [func]Func Base[Escape Rhope Name[name,[func]Escape Pattern >>],args, "TCall"] } Resolve@C Function[func,op:out] @@ -849,10 +853,10 @@ { out <- [["my_cdata->params["]Append[String[~]]]Append[" ]"] }{ - out <- [[["lv_"]Append[Escape Rhope Name[[func]Name >>]]]Append["->"]]Append[Escape Rhope Name[op]] + out <- [[["lv_"]Append[Escape Rhope Name[[func]Name >>,[func]Escape Pattern >>]]]Append["->"]]Append[Escape Rhope Name[op,[func]Escape Pattern >>]] } }{ - out <- Escape Rhope Name[op] + out <- Escape Rhope Name[op,[func]Escape Pattern >>] } } @@ -860,9 +864,9 @@ { If[[[func]Convention >>] = ["rhope"]] { - out <- [[["lv_"]Append[Escape Rhope Name[[func]Name >>]]]Append["->"]]Append[Escape Rhope Name[name]] + out <- [[["lv_"]Append[Escape Rhope Name[[func]Name >>,[func]Escape Pattern >>]]]Append["->"]]Append[Escape Rhope Name[name,[func]Escape Pattern >>]] }{ - out <- Escape Rhope Name[name] + out <- Escape Rhope Name[name,[func]Escape Pattern >>] } } @@ -924,7 +928,7 @@ _Set Outputs C[string,inputname,inputnum,func:out] { - out <- [string]Append[[[ [ ["\tRet("]Append[String[inputnum]] ]Append[ [[", lv_"]Append[Escape Rhope Name[[func]Name >>]]]Append["->"]]]Append[Escape Rhope Name[inputname]]]Append[")\n"]] + out <- [string]Append[[[ [ ["\tRet("]Append[String[inputnum]] ]Append[ [[", lv_"]Append[Escape Rhope Name[[func]Name >>,[func]Escape Pattern >>]]]Append["->"]]]Append[Escape Rhope Name[inputname,[func]Escape Pattern >>]]]Append[")\n"]] } Set Outputs@C Function[func:out] @@ -935,7 +939,7 @@ }{ [[func]Outputs >>]Index[0] { - out <- [["\treturn "]Append[Escape Rhope Name[~]]]Append[";\n"] + out <- [["\treturn "]Append[Escape Rhope Name[~,[func]Escape Pattern >>]]]Append[";\n"] }{ out <- "" } @@ -943,13 +947,13 @@ } _Output Defs C[string,varname,index,func:out] { - out <- [[[string]Append[ ["\t"]Append[Rhope Type to C[[[func]Output Types >>]Index[index]]] ]]Append[[" "]Append[Escape Rhope Name[varname]]]]Append[";\n"] + out <- [[[string]Append[ ["\t"]Append[Rhope Type to C[[[func]Output Types >>]Index[index],[func]Escape Pattern >>]] ]]Append[[" "]Append[Escape Rhope Name[varname,[func]Escape Pattern >>]]]]Append[";\n"] } -_Var Defs C[string,type,varname:out] +_Var Defs C[string,type,varname,p:out] { Print[["Variable: "]Append[varname]] { - out <- [[[string]Append[ ["\t"]Append[Rhope Type to C[type]] ]]Append[[" "]Append[Escape Rhope Name[varname]]]]Append[";\n"] + out <- [[[string]Append[ ["\t"]Append[Rhope Type to C[type,p]] ]]Append[[" "]Append[Escape Rhope Name[varname,p]]]]Append[";\n"] { Print["Produced Output"]} } } @@ -961,7 +965,7 @@ { If[ [[[func]Convention >>] = ["rhope"]] And [[ [[[func]Variables >>]Length]+[[[func]Outputs >>]Length] ] > [0]] ] { - localtype <- [[[Fold[_Output Defs C[?, ?, ?, func], Fold[_Var Defs C[?],"typedef struct {\n", [func]Variables >>], [func]Outputs >>]]Append["} lt_"]]Append[Escape Rhope Name[[func]Name >>]]]Append[";\n"] + localtype <- [[[Fold[_Output Defs C[?, ?, ?, func], Fold[_Var Defs C[?,?,?,[func]Escape Pattern >>],"typedef struct {\n", [func]Variables >>], [func]Outputs >>]]Append["} lt_"]]Append[Escape Rhope Name[[func]Name >>,[func]Escape Pattern >>]]]Append[";\n"] }{ localtype <- "" } @@ -972,12 +976,12 @@ [parts]Index[1] { proto <- [[[["MethodDef(" - ]Append[Escape Rhope Name[[parts]Index[0]]] + ]Append[Escape Rhope Name[[parts]Index[0],[func]Escape Pattern >>]] ]Append[", "] - ]Append[Escape Rhope Name[~]] + ]Append[Escape Rhope Name[~,[func]Escape Pattern >>]] ]Append[")\n"] }{ - proto <- [["FuncDef("]Append[Escape Rhope Name[[func]Name >>]]]Append[")\n"] + proto <- [["FuncDef("]Append[Escape Rhope Name[[func]Name >>,[func]Escape Pattern >>]]]Append[")\n"] } */ out <- Val[localtype] }{ @@ -986,23 +990,23 @@ } } -_Proto Input[list,input,index,types:out] +_Proto Input[list,input,index,types,p:out] { - out <- [list]Append[ [[Rhope Type to C[[types]Index[index]]]Append[" "]]Append[Escape Rhope Name[input]] ] + out <- [list]Append[ [[Rhope Type to C[[types]Index[index],p]]Append[" "]]Append[Escape Rhope Name[input,p]] ] } Naked Proto@C Function[func:out] { [[func]Output Types >>]Index[0] { - outtype <- [Rhope Type to C[~]]Append[" "] + outtype <- [Rhope Type to C[~,[func]Escape Pattern >>]]Append[" "] }{ outtype <- "void " } out <- [[[[outtype - ]Append[ Escape Rhope Name[[func]Name >>]] + ]Append[ Escape Rhope Name[[func]Name >>,[func]Escape Pattern >>]] ]Append["("] - ]Append[ [Fold[_Proto Input[?, ?, ?, [func]Input Types >>], (), [func]Inputs >>]]Join[", "] ] + ]Append[ [Fold[_Proto Input[?, ?, ?, [func]Input Types >>,[func]Escape Pattern >>], (), [func]Inputs >>]]Join[", "] ] ]Append[")"] } @@ -1040,16 +1044,16 @@ before <- [[func]Name >>]Partition["@"] {} {} { type <- "MethodImpl" - cname <- [[[[Escape Rhope Name[before] + cname <- [[[[Escape Rhope Name[before,[func]Escape Pattern >>] ]Append[", "] - ]Append[Escape Rhope Name[~]] + ]Append[Escape Rhope Name[~,[func]Escape Pattern >>]] ]Append[", "] ]Append[ [[func]Type Registry >>]Type ID[~] ] }{ type <- "Func" cname <- Val[fname] } - fname <- Escape Rhope Name[[func]Name >>] + fname <- Escape Rhope Name[[func]Name >>,[func]Escape Pattern >>] param check <- Fold[Check Param Type C[?, ?, ?, func], "", [func]Input Types >>] If[ [ [[[func]Variables >>]Length]+[[[func]Outputs >>]Length] ] = [0] ] { @@ -1099,11 +1103,14 @@ Field Registry Type Registry Libraries + Escape Pattern } C Program[:out] { - out <- [[[[[Build[C Program()]]Functions <<[Dictionary[]]]Method Registry <<[C Method Registry[]]]Type Registry <<[C Type Registry[]]]Field Registry <<[C Field Registry[]]]Libraries <<[Dictionary[]] + p <- Pattern[("_", "@", " ", ":", "?", "+", "-", "*", "/", "<", ">", "(", ")", "!", "=", "'", + "\"", "\t", ",", ".", "\n", "{", "}", "[", "]", "#", "\\", "\r", ";", "&", "|", "%", "^", "`", "~")] + out <- [[[[[[Build[C Program()]]Functions <<[Dictionary[]]]Method Registry <<[C Method Registry[]]]Type Registry <<[C Type Registry[p]]]Field Registry <<[C Field Registry[]]]Libraries <<[Dictionary[]]]Escape Pattern <<[p] } Link@C Program[program,language,library:out] @@ -1132,7 +1139,7 @@ Create Function@C Program[program,name,inputs,outputs,convention:out] { - out <- C Function With Registry[name,inputs,outputs,convention, [program]Method Registry >>, [program]Field Registry >>, [program]Type Registry >>] + out <- C Function With Registry[name,inputs,outputs,convention, [program]Method Registry >>, [program]Field Registry >>, [program]Type Registry >>, [program]Escape Pattern >>] } Store Function@C Program[program,func:out] @@ -1166,9 +1173,9 @@ out <- Combine[[func]Constants >>, consts] } -_Consts C Program[text,value,name:out] +_Consts C Program[text,value,name,p:out] { - out <- [text]Append[ [["object * _const_"]Append[Escape Rhope Name[name]]]Append[";\n"] ] + out <- [text]Append[ [["object * _const_"]Append[Escape Rhope Name[name,p]]]Append[";\n"] ] } Const Construct C[value,type reg:out] @@ -1217,7 +1224,7 @@ { size <- String[[~]+[1]] } { size <- "0" } out <- [[[[[["make_Worker(FUNC_" - ]Append[Escape Rhope Name[[value]Name >>]] + ]Append[Escape Rhope Name[[value]Name >>,[type reg]Escape Pattern >>]] ]Append[", "] ]Append[size] ]Append[", "] @@ -1253,7 +1260,7 @@ out <- text }{ Const Construct C[value,type reg] - { out <- [text]Append[ [[[["\t_const_"]Append[Escape Rhope Name[name]]]Append[" = "]]Append[~]]Append[";\n"] ] } + { out <- [text]Append[ [[[["\t_const_"]Append[Escape Rhope Name[name,[type reg]Escape Pattern >>]]]Append[" = "]]Append[~]]Append[";\n"] ] } } } @@ -1277,14 +1284,14 @@ If[[~]>[3]] { out <- [Fold[_Set List Els[?, ?, ?, type reg], "\trhope(FUNC_List, inout, 0, 1);\n", value] - ]Append[[["\t_const_"]Append[Escape Rhope Name[name]]]Append[" = inout[0];\n"]] + ]Append[[["\t_const_"]Append[Escape Rhope Name[name,[type reg]Escape Pattern >>]]]Append[" = inout[0];\n"]] }{ Const Construct C[value,type reg] - { init <- [text]Append[ [[[["\t_const_"]Append[Escape Rhope Name[name]]]Append[" = "]]Append[~]]Append[";\n"] ] } + { init <- [text]Append[ [[[["\t_const_"]Append[Escape Rhope Name[name,[type reg]Escape Pattern >>]]]Append[" = "]]Append[~]]Append[";\n"] ] } If[[valtype]=[Worker Literal()]] { - out <- Fold[_Set Worker Params C[?, ?, ?, type reg, Escape Rhope Name[name]], init, [value]Args >>] + out <- Fold[_Set Worker Params C[?, ?, ?, type reg, Escape Rhope Name[name,[type reg]Escape Pattern >>]], init, [value]Args >>] }{ out <- Val[init] } @@ -1308,7 +1315,7 @@ { If[[[func]Convention >>] = ["rhope"]] { - name <- Escape Rhope Name[raw name] + name <- Escape Rhope Name[raw name,[func]Escape Pattern >>] out <- [[text]Append[ [["\tDispatchEntry("]Append[name]]Append[")\\\n"] ] ]Append[Fold[_Dispatch Switch Sub[?, ?, name], "", Range[1, [func]Resume Index >>]]] }{ @@ -1316,9 +1323,9 @@ } } -_Dispatch Switch Methods[text,id,raw name:out] +_Dispatch Switch Methods[p,text,id,raw name:out] { - name <- Escape Rhope Name[raw name] + name <- Escape Rhope Name[raw name,p] out <- [text]Append[ [["\tDispatchEntry("]Append[name]]Append[")\\\n"] ] } @@ -1336,7 +1343,7 @@ { If[[[func]Convention >>] = ["rhope"]] { - name <- Escape Rhope Name[raw name] + name <- Escape Rhope Name[raw name,[func]Escape Pattern >>] out <- [[text]Append[ [["\tFUNC_"]Append[name]]Append[",\n"] ] ]Append[Fold[_Dispatch Enum Sub[?, ?, name], "", Range[1, [func]Resume Index >>]]] }{ @@ -1344,21 +1351,21 @@ } } -_Dispatch Enum Methods[text,types,name:out] +_Dispatch Enum Methods[p,text,types,name:out] { - out <- [text]Append[ [["\tFUNC_"]Append[Escape Rhope Name[name]]]Append[",\n"] ] + out <- [text]Append[ [["\tFUNC_"]Append[Escape Rhope Name[name,p]]]Append[",\n"] ] } Dispatch@C Program[program,all methods:out] { out <- [[[[["typedef enum {\n" ]Append[Fold[_Dispatch Enum[?], - [Fold[_Dispatch Enum Methods[?], "", all methods]]Append["\tFUNC_Build,\n\tFUNC_BlueprintSP_Of,\n\tFUNC_ID,\n\tFUNC_BlueprintSP_FromSP_ID,\n"], + [Fold[_Dispatch Enum Methods[[program]Escape Pattern >>,?], "", all methods]]Append["\tFUNC_Build,\n\tFUNC_BlueprintSP_Of,\n\tFUNC_ID,\n\tFUNC_BlueprintSP_FromSP_ID,\n"], [program]Functions >>]] ]Append["\tEND\n} funcids;\n\n"] ]Append["#define DispatchEntries \\\n"] ]Append[Fold[_Dispatch Switch[?], - [Fold[_Dispatch Switch Methods[?], "", all methods]]Append["\tDispatchEntry(Build)\\\n\tDispatchEntry(BlueprintSP_Of)\\\n\tDispatchEntry(ID)\\\n\tDispatchEntry(BlueprintSP_FromSP_ID)\\\n"], + [Fold[_Dispatch Switch Methods[[program]Escape Pattern >>,?], "", all methods]]Append["\tDispatchEntry(Build)\\\n\tDispatchEntry(BlueprintSP_Of)\\\n\tDispatchEntry(ID)\\\n\tDispatchEntry(BlueprintSP_FromSP_ID)\\\n"], [program]Functions >>]] ]Append["\tEndEntry\n\n"] } @@ -1381,7 +1388,7 @@ { out <- text }{ - out <- [text]Append[[["\tFuncDef("]Append[Escape Rhope Name[[func]Name >>]]]Append[")\n"]] + out <- [text]Append[[["\tFuncDef("]Append[Escape Rhope Name[[func]Name >>,[func]Escape Pattern >>]]]Append[")\n"]] } } @@ -1413,19 +1420,20 @@ _Method Dispatch[text, type, method, reg: out] { - out <- [[[[[[[text]Append["\tMethodDispatch("]]Append[ [reg]Type ID[type] ]]Append[","]]Append[Escape Rhope Name[method]]]Append[","]]Append[Escape Rhope Name[type]]]Append[")\n"] + out <- [[[[[[[text]Append["\tMethodDispatch("]]Append[ [reg]Type ID[type] ]]Append[","]]Append[Escape Rhope Name[method,[reg]Escape Pattern >>]]]Append[","]]Append[Escape Rhope Name[type,[reg]Escape Pattern >>]]]Append[")\n"] } Method Dispatch[text, types, method, reg: out] { - out <- [[[Fold[_Method Dispatch[?, ?, method, reg], [[[text]Append["Method("]]Append[ Escape Rhope Name[method] ]]Append[")\n"], types] + out <- [[[Fold[_Method Dispatch[?, ?, method, reg], [[[text]Append["Method("]]Append[ Escape Rhope Name[method,[reg]Escape Pattern >>] ]]Append[")\n"], types] ]Append["EndMethod("] - ]Append[Escape Rhope Name[method]] + ]Append[Escape Rhope Name[method,[reg]Escape Pattern >>]] ]Append[")\n\n"] } Text@C Program[program:out] { + p <- [program]Escape Pattern >> type defs <- [[program]Type Registry >>]Definitions >> constants <- Fold[Combine Consts[?], Dictionary[], [program]Functions >>] all methods <- Fold[Field to Types[?], Fold[Method to Types[?], Dictionary[], type defs], type defs] @@ -1443,7 +1451,7 @@ out <- [[[[[[[[[[[[[[[headers ]Append[[program]Dispatch[all methods]] ]Append[[[program]Type Registry >>]Type Defs] - ]Append[Fold[_Consts C Program[?], + ]Append[Fold[_Consts C Program[?,?,?,p], Fold[_Defs C Program[?], "", [program]Functions >>], constants]] ]Append[Fold[_Text C Program[?, ?, [program]Type Registry >>], "", Filter[[program]Functions >>, Not Native[?]]]]