comparison nworker.rhope @ 83:27bb051d631c

Initial implementation of Dictionary
author Mike Pavone <pavone@retrodev.com>
date Tue, 27 Jul 2010 23:33:31 -0400
parents 2e2e55fc12f9
children 3c4325e6298f
comparison
equal deleted inserted replaced
82:2e2e55fc12f9 83:27bb051d631c
804 after save <- Fold[["Save Result"]Set Input[2, node index], with call, Range[0, save outs]] 804 after save <- Fold[["Save Result"]Set Input[2, node index], with call, Range[0, save outs]]
805 } 805 }
806 806
807 Compile Node@NWorker[worker,program,func,nodes,current:out,out worker] 807 Compile Node@NWorker[worker,program,func,nodes,current:out,out worker]
808 { 808 {
809 Print[[[["Compile node: "]Append[[node]Type >>]]Append[", "]]Append[node index]]
810 node index <- [nodes]Index[current] 809 node index <- [nodes]Index[current]
811 node <- [[worker]Nodes >>]Index[node index] 810 node <- [[worker]Nodes >>]Index[node index]
812 conditions <- [node]Conditions >> 811 conditions <- [node]Conditions >>
813 [("call","getfield","setfield")]Find[[node]Type >>] 812 [("call","getfield","setfield")]Find[[node]Type >>]
814 { 813 {
985 out <- Fold["Node Result Vars", (), [worker]Nodes >>] 984 out <- Fold["Node Result Vars", (), [worker]Nodes >>]
986 } 985 }
987 986
988 _No Release[vars,node,index,worker:out] 987 _No Release[vars,node,index,worker:out]
989 { 988 {
990 Print[["_No Release"]Append[[node]Type >>]]
991 [("const","input")]Find[[node]Type >>] 989 [("const","input")]Find[[node]Type >>]
992 { 990 {
993 [[node]Conditions >>]For Backend 991 [[node]Conditions >>]For Backend
994 { 992 {
995 Print[["Const or input with conditions: "]Append[index]]
996 out <- Result Var[vars, 0, index] 993 out <- Result Var[vars, 0, index]
997 }{ 994 }{
998 Print[["Const or input with no conditions: "]Append[index]]
999 out <- vars 995 out <- vars
1000 } 996 }
1001 }{ 997 }{
1002 Print[["Other node type: "]Append[index]]
1003 out <- vars 998 out <- vars
1004 } 999 }
1005 } 1000 }
1006 1001
1007 No Release Results@NWorker[worker:out] 1002 No Release Results@NWorker[worker:out]
1138 { Fold[[[["Save Foreign Result"]Set Input[3, [worker]Output Types >>]]Set Input[4, [worker]Inputs >>]]Set Input[5, [worker]Input Types >>], ~, [worker]Outputs >>] 1133 { Fold[[[["Save Foreign Result"]Set Input[3, [worker]Output Types >>]]Set Input[4, [worker]Inputs >>]]Set Input[5, [worker]Input Types >>], ~, [worker]Outputs >>]
1139 { out <- [program]Store Function[~] }}} 1134 { out <- [program]Store Function[~] }}}
1140 } 1135 }
1141 1136
1142 Compile Worker@NWorker[worker,program,name:out] 1137 Compile Worker@NWorker[worker,program,name:out]
1143 { 1138 {
1144 Print[["Compile Worker: "]Append[[worker]Name >>]]
1145 If[[worker]Builtin? >>] 1139 If[[worker]Builtin? >>]
1146 { 1140 {
1147 out <- program 1141 out <- program
1148 }{ 1142 }{
1149 If[[[worker]Library >>] = [""]] 1143 If[[[worker]Library >>] = [""]]
1455 } 1449 }
1456 } 1450 }
1457 1451
1458 Register Builtins@NProgram[prog:out] 1452 Register Builtins@NProgram[prog:out]
1459 { 1453 {
1460 registered <- [[[[[[prog]Register Worker["Print", "rhope", 1, 1] 1454 registered <- [[[[[[[prog]Register Worker["Print", "rhope", 1, 1]
1461 ]Register Worker["If@Boolean", "rhope", 1, 2] 1455 ]Register Worker["If@Boolean", "rhope", 1, 2]
1462 ]Register Worker["Build", "rhope", 1, 1] 1456 ]Register Worker["Build", "rhope", 1, 1]
1463 ]Register Worker["Blueprint Of", "rhope", 1, 1] 1457 ]Register Worker["Blueprint Of", "rhope", 1, 1]
1464 ]Register Worker["Call@Worker", "rhope", 1, 2] //We're using 2 because we need to assume that the outputs are conditional 1458 ]Register Worker["Call@Worker", "rhope", 1, 2] //We're using 2 because we need to assume that the outputs are conditional
1459 ]Register Worker["ID", "rhope", 1, 1]
1465 ]Register Number Methods 1460 ]Register Number Methods
1466 1461
1467 out <- [[[[[registered]Bind Worker["If@Boolean", 1462 out <- [[[[[[registered]Bind Worker["If@Boolean",
1468 [[[[[NWorker["rhope"] 1463 [[[[[NWorker["rhope"]
1469 ]Inputs <<[("condition")] 1464 ]Inputs <<[("condition")]
1470 ]Input Types <<[ [()]Append[Type Instance["Boolean"]] ] 1465 ]Input Types <<[ [()]Append[Type Instance["Boolean"]] ]
1471 ]Outputs <<[("isyes","isno")] 1466 ]Outputs <<[("isyes","isno")]
1472 ]Output Types <<[ [[()]Append[Type Instance["Boolean"]]]Append[Type Instance["Boolean"]] ] 1467 ]Output Types <<[ [[()]Append[Type Instance["Boolean"]]]Append[Type Instance["Boolean"]] ]
1497 ]Inputs <<[("worker")] 1492 ]Inputs <<[("worker")]
1498 ]Input Types <<[ [()]Append[Type Instance["Worker"]] ] 1493 ]Input Types <<[ [()]Append[Type Instance["Worker"]] ]
1499 ]Outputs <<[("ret1","ret2")] 1494 ]Outputs <<[("ret1","ret2")]
1500 ]Output Types <<[ [[()]Append[Type Instance["Any Type"]]]Append[Type Instance["Any Type"]] ] 1495 ]Output Types <<[ [[()]Append[Type Instance["Any Type"]]]Append[Type Instance["Any Type"]] ]
1501 ]Builtin? << [Yes]] 1496 ]Builtin? << [Yes]]
1497 ]Bind Worker["ID",
1498 [[[[[NWorker["rhope"]
1499 ]Inputs <<[("bp")]
1500 ]Input Types <<[ [()]Append[Type Instance["Blueprint"]]]
1501 ]Outputs <<[("id")]
1502 ]Output Types <<[ [()]Append[Type Instance["UInt32"]]]
1503 ]Builtin? << [Yes]]
1502 } 1504 }
1503 1505
1504 Find Worker@NProgram[prog, name:out,notfound] 1506 Find Worker@NProgram[prog, name:out,notfound]
1505 { 1507 {
1506 out,notfound <- [[prog]Worker Refs >>]Index[name] 1508 out,notfound <- [[prog]Worker Refs >>]Index[name]