diff nworker_c.rhope @ 141:f2cb85c53ced

Fix Pause/Resume and rewrite Call Async in Rhope rather than C
author Mike Pavone <pavone@retrodev.com>
date Sat, 20 Nov 2010 17:48:22 -0500
parents c14698c512f1
children 7bbdc034e347
line wrap: on
line diff
--- a/nworker_c.rhope	Sat Nov 20 20:03:25 2010 +0000
+++ b/nworker_c.rhope	Sat Nov 20 17:48:22 2010 -0500
@@ -469,6 +469,7 @@
 
 Infer Types@NWorker[worker,prog:out]
 {
+	Print[["Infer Types: "]Append[[worker]Name >>]]
 	out <- [worker]Nodes <<[Fold[Infer Types Node[?, ?, ?, prog, worker], [worker]Nodes >>, [worker]Nodes >>]]
 }
 
@@ -1601,7 +1602,7 @@
 
 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]
@@ -1610,10 +1611,9 @@
 	]Register Worker["Blueprint From ID", "rhope", 1, 2]
 	]Register Worker["Pause", "rhope", 1, 1]
 	]Register Worker["Resume", "rhope", 2, 2]
-	]Register Worker["Call Async", "rhope", 1, 1]
 	]Register Number Methods
 	
-	out <- [[[[[[[registered]Bind Worker["If@Boolean",
+	out <- [[[[[[[[[registered]Bind Worker["If@Boolean",
 		[[[[[NWorker["rhope"]
 		]Inputs <<[("condition")]
 		]Input Types <<[ [()]Append[Type Instance["Boolean"]] ]
@@ -1662,6 +1662,20 @@
 		]Outputs <<[("bp","none")]
 		]Output Types <<[ [[()]Append[Type Instance["Blueprint"]]]Append[Type Instance["Any Type"]]]
 		]Builtin? << [Yes]]
+	]Bind Worker["Pause",
+		[[[[[NWorker["rhope"]
+		]Inputs <<[("tocall")]
+		]Input Types <<[ [()]Append[Type Instance["Worker"]]]
+		]Outputs <<[("resumeval")]
+		]Output Types <<[ [()]Append[Type Instance["Any Type"]] ]
+		]Builtin? <<[Yes]]
+	]Bind Worker["Resume",
+		[[[[[NWorker["rhope"]
+		]Inputs <<[("toresume","resumeval")]
+		]Input Types <<[ [[()]Append[Type Instance["Contest"]]]Append[Type Instance["Any Type"]] ]
+		]Outputs <<[("success","cantresume")]
+		]Output Types <<[ [[()]Append[Type Instance["Any Type"]]]Append[Type Instance["Any Type"]] ]
+		]Builtin? <<[Yes]]
 }
 
 Find Worker@NProgram[prog, name:out,notfound]