diff nworker.rhope @ 20:b715532225c0

Differentiate between method and normal calls in dataflow graph compiler
author Mike Pavone <pavone@retrodev.com>
date Wed, 27 May 2009 21:42:37 -0400
parents 90c20dc3f4e5
children e9272f7ebd26
line wrap: on
line diff
--- 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[], ""]
+}