diff nworker_c.rhope @ 136:fc3815b7462f

Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
author Mike Pavone <pavone@retrodev.com>
date Sun, 14 Nov 2010 23:07:55 -0500
parents 18a4403fe576
children a68e6828d896
line wrap: on
line diff
--- a/nworker_c.rhope	Sun Nov 14 03:09:49 2010 -0500
+++ b/nworker_c.rhope	Sun Nov 14 23:07:55 2010 -0500
@@ -1449,22 +1449,37 @@
 	Blueprints
 	Workers
 	Worker Refs
+	Numtypes
 }
 
 NProgram[:out]
 {
-	out <- [[[Build[NProgram()]]Blueprints <<[Dictionary[]]]Workers <<[Dictionary[]]]Worker Refs <<[Dictionary[]]
+	out <- [[[[Build[NProgram()]
+		]Blueprints <<[Dictionary[]]
+		]Workers <<[Dictionary[]]
+		]Worker Refs <<[Dictionary[]]
+		]Numtypes << [("Int8","Int16","Int32","Int64","UInt8","UInt16","UInt32","UInt64")]
+}
+
+Supported Number Types@NProgram[program:out]
+{
+	out <- [program]Numtypes >>
 }
 
 Bind Worker@NProgram[prog,name,worker:out]
 {	
 	after bind <- [prog]Workers << [ [[prog]Workers >>]Set[name, [worker]Name <<[name]] ]
 	parts <- [name]Split["@"]
-	[parts]Index[1]
+	bpname <- [parts]Index[1]
 	{
-		orig bp <- [[after bind]Blueprints >>]Index[~] {}
-		{ orig bp <- NBlueprint[] }
-		out <- [after bind]Blueprints <<[ [[after bind]Blueprints >>]Set[~, [orig bp]Add Method[[parts]Index[0]] ] ]
+		If[[~]=[""]]
+		{
+			out <- Val[after bind]
+		}{
+			orig bp <- [[after bind]Blueprints >>]Index[bpname] {}
+			{ orig bp <- NBlueprint[] }
+			out <- [after bind]Blueprints <<[ [[after bind]Blueprints >>]Set[bpname, [orig bp]Add Method[[parts]Index[0]] ] ]
+		}
 	}{
 		out <- Val[after bind]
 	}
@@ -1529,7 +1544,12 @@
 	parts <- [name]Split["@"]
 	[parts]Index[1]
 	{
-		out <- [after reg]Register Method@NProgram[[parts]Index[0], convention, inputs, outputs]
+		If[[~]=[""]]
+		{
+			out <- [after reg]Register Worker[[parts]Index[0], convention, inputs, outputs]
+		}{
+			out <- [after reg]Register Method@NProgram[[parts]Index[0], convention, inputs, outputs]
+		}
 	}{
 		out <- Val[after reg]
 	}