# HG changeset patch # User Mike Pavone # Date 1294388240 18000 # Node ID d1e206ff75f977cd7ea367bf5f110b3793319575 # Parent 0e06f29aa83dd6a311c7682dd88549b2a9d303da Fix some bugs involving calling a worker object diff -r 0e06f29aa83d -r d1e206ff75f9 cbackend_c.rhope --- a/cbackend_c.rhope Thu Dec 23 16:16:31 2010 -0500 +++ b/cbackend_c.rhope Fri Jan 07 03:17:20 2011 -0500 @@ -848,12 +848,13 @@ { to call <- [args]Index[0] last numparams <- [func]Last NumParams >> - out <- [[[[[[func]Add Raw Line[[["if (get_blueprint("]Append[Make Op[Strip Addref[to call], func]]]Append[")->type_id == TYPE_WORKER) {"]] + out <- [[[[[[[func]Add Raw Line[[["if (get_blueprint("]Append[Make Op[Strip Addref[to call], func]]]Append[")->type_id == TYPE_WORKER) {"]] ]Val Call[to call, Tail[args,1]] ]Add Raw Line["} else {"] ]Last NumParams <<[last numparams] ]Func Base["Call",args, "Call"] ]Add Raw Line["}"] + ]Last NumParams <<[[Length[args]]-[1]] }{ out <- [func]Func Base[Escape Rhope Name[name,[func]Escape Pattern >>],args, "Call"] } diff -r 0e06f29aa83d -r d1e206ff75f9 nworker_c.rhope --- a/nworker_c.rhope Thu Dec 23 16:16:31 2010 -0500 +++ b/nworker_c.rhope Fri Jan 07 03:17:20 2011 -0500 @@ -213,7 +213,7 @@ Wire From@NWorker Node[node,to,input,output:out] { existing cons <- [[node]Wires From >>]Index[output] {} - { exist cons <- () } + { existing cons <- () } out <- [node]Wires From <<[ [[node]Wires From >>]Set[output, [existing cons]Append[Node Ref[to,input]] @@ -1602,11 +1602,12 @@ Register Builtins@NProgram[prog:out] { - registered <- [[[[[[[[[[prog]Register Worker["Print", "rhope", 1, 1] + registered <- [[[[[[[[[[[prog]Register Worker["Print", "rhope", 1, 1] ]Register Worker["If@Boolean", "rhope", 1, 2] ]Register Worker["Build", "rhope", 1, 1] ]Register Worker["Blueprint Of", "rhope", 1, 1] - ]Register Worker["Call@Worker", "rhope", 1, 2] //We're using 2 because we need to assume that the outputs are conditional + ]Register Worker["Call", "rhope", 1, 1]//This will ensure that min outputs is 1 + ]Register Worker["Call@Worker", "rhope", 1, 10]//10 is a quick workaround for the lack of proper varargs ]Register Worker["ID", "rhope", 1, 1] ]Register Worker["Blueprint From ID", "rhope", 1, 2] ]Register Worker["Pause", "rhope", 1, 1] @@ -1645,7 +1646,7 @@ [[[[[NWorker["rhope"] ]Inputs <<[("worker")] ]Input Types <<[ [()]Append[Type Instance["Worker"]] ] - ]Outputs <<[("ret1","ret2")] + ]Outputs <<[("ret1","ret2","ret3","ret4","ret5","ret6","ret7","ret8","ret9","ret10")] ]Output Types <<[ [[()]Append[Type Instance["Any Type"]]]Append[Type Instance["Any Type"]] ] ]Builtin? << [Yes]] ]Bind Worker["ID", diff -r 0e06f29aa83d -r d1e206ff75f9 runtime/func.h --- a/runtime/func.h Thu Dec 23 16:16:31 2010 -0500 +++ b/runtime/func.h Fri Jan 07 03:17:20 2011 -0500 @@ -234,11 +234,13 @@ free_stack(ct, cdata);\ cdata = alloc_cdata(ct, temp_cdata, numparams + ((t_Worker *)func)->payload.Count);\ }\ - vcparam_offset = 0; + vcparam_offset = 0;\ + last_vcparam = -1; #define VCPrepCall(func,numparams) \ cdata = alloc_cdata(ct, cdata, numparams + ((t_Worker *)func)->payload.Count);\ - vcparam_offset = 0; + vcparam_offset = 0;\ + last_vcparam = -1; #define VCSetParam(func,num,value) \ while((num+vcparam_offset) < ((t_Worker *)func)->payload.Size && ((object **)(((t_Worker *)func)+1))[num+vcparam_offset])\