# HG changeset patch # User Mike Pavone # Date 1243474957 14400 # Node ID b715532225c087e9dfb5ceefbe324ef3980d00c5 # Parent 90c20dc3f4e58d9c216ea53ce88edb3034154ebe Differentiate between method and normal calls in dataflow graph compiler diff -r 90c20dc3f4e5 -r b715532225c0 cbackend.rhope --- a/cbackend.rhope Wed May 27 21:29:15 2009 +0000 +++ b/cbackend.rhope Wed May 27 21:42:37 2009 -0400 @@ -52,9 +52,9 @@ } } -Method ID@C Method Registry[reg,method:out] +Method ID@C Method Registry[reg,method:out,notfound] { - out <- [[reg]Lookup >>]Index[method] + out,notfound <- [[reg]Lookup >>]Index[method] } Blueprint C Function @@ -322,6 +322,11 @@ out <- [program]Functions <<[ [[program]Functions >>]Set[ [func]Name >>, func] ] } +Method?@C Program[program,funcname:is,isnot] +{ + is,isnot <- [[program]Method Registry >>]Method ID[funcname] +} + _Defs C Program[text,func:out] { Print["start _Defs"] diff -r 90c20dc3f4e5 -r b715532225c0 nworker.rhope --- a/nworker.rhope Wed May 27 21:29:15 2009 +0000 +++ b/nworker.rhope Wed May 27 21:42:37 2009 -0400 @@ -1,4 +1,5 @@ Import extendlib.rhope +Import cbackend.rhope Set@Range[range,index,val:out] { @@ -249,16 +250,22 @@ Compile Node@NWorker[worker,program,func,nodes,current:out] { + Print[[node]Type >>] node <- [[worker]Nodes >>]Index[[nodes]Index[current]] - If[[[node]Type >>] = [""]] + If[[[node]Type >>] = ["call"]] { - nfunc <- [func]Call[[[node]Data >>]Name >>, ()] + [program]Method?[[[node]Data >>]Name >>] + { + nfunc <- [func]Method Call[[[node]Data >>]Name >>, ()] + }{ + nfunc <- [func]Call[[[node]Data >>]Name >>, ()] + } }{ nfunc <- Val[func] } [nodes]Next[current] { - out <- [worker]Compile Node[program,func,nodes,~] + out <- [worker]Compile Node[program,nfunc,nodes,~] }{ out <- Val[nfunc] } @@ -275,7 +282,7 @@ } [groups]Next[current] { - out <- [worker]Compile Group[program,func,groups,~] + out <- [worker]Compile Group[program,nfunc,groups,~] }{ out <- Val[nfunc] } @@ -291,7 +298,7 @@ }{ final func <- Val[func] } - out <- [program]Store Function[func] + out <- [program]Store Function[final func] } Test[:out] @@ -312,3 +319,13 @@ ]Add Wire[call*,0,outref,0] }}}}}} } + +Test Compile[:out] +{ + out <- [Test[]]Compile Worker[C Program[] "Test"] +} + +Main[] +{ + Pretty Print[Test Compile[], ""] +}