Mercurial > repos > rhope
comparison 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 |
comparison
equal
deleted
inserted
replaced
140:c14698c512f1 | 141:f2cb85c53ced |
---|---|
467 } | 467 } |
468 } | 468 } |
469 | 469 |
470 Infer Types@NWorker[worker,prog:out] | 470 Infer Types@NWorker[worker,prog:out] |
471 { | 471 { |
472 Print[["Infer Types: "]Append[[worker]Name >>]] | |
472 out <- [worker]Nodes <<[Fold[Infer Types Node[?, ?, ?, prog, worker], [worker]Nodes >>, [worker]Nodes >>]] | 473 out <- [worker]Nodes <<[Fold[Infer Types Node[?, ?, ?, prog, worker], [worker]Nodes >>, [worker]Nodes >>]] |
473 } | 474 } |
474 | 475 |
475 Add Worker Call@NWorker[worker,tocall:out,node index] | 476 Add Worker Call@NWorker[worker,tocall:out,node index] |
476 { | 477 { |
1599 } | 1600 } |
1600 } | 1601 } |
1601 | 1602 |
1602 Register Builtins@NProgram[prog:out] | 1603 Register Builtins@NProgram[prog:out] |
1603 { | 1604 { |
1604 registered <- [[[[[[[[[[[prog]Register Worker["Print", "rhope", 1, 1] | 1605 registered <- [[[[[[[[[[prog]Register Worker["Print", "rhope", 1, 1] |
1605 ]Register Worker["If@Boolean", "rhope", 1, 2] | 1606 ]Register Worker["If@Boolean", "rhope", 1, 2] |
1606 ]Register Worker["Build", "rhope", 1, 1] | 1607 ]Register Worker["Build", "rhope", 1, 1] |
1607 ]Register Worker["Blueprint Of", "rhope", 1, 1] | 1608 ]Register Worker["Blueprint Of", "rhope", 1, 1] |
1608 ]Register Worker["Call@Worker", "rhope", 1, 2] //We're using 2 because we need to assume that the outputs are conditional | 1609 ]Register Worker["Call@Worker", "rhope", 1, 2] //We're using 2 because we need to assume that the outputs are conditional |
1609 ]Register Worker["ID", "rhope", 1, 1] | 1610 ]Register Worker["ID", "rhope", 1, 1] |
1610 ]Register Worker["Blueprint From ID", "rhope", 1, 2] | 1611 ]Register Worker["Blueprint From ID", "rhope", 1, 2] |
1611 ]Register Worker["Pause", "rhope", 1, 1] | 1612 ]Register Worker["Pause", "rhope", 1, 1] |
1612 ]Register Worker["Resume", "rhope", 2, 2] | 1613 ]Register Worker["Resume", "rhope", 2, 2] |
1613 ]Register Worker["Call Async", "rhope", 1, 1] | |
1614 ]Register Number Methods | 1614 ]Register Number Methods |
1615 | 1615 |
1616 out <- [[[[[[[registered]Bind Worker["If@Boolean", | 1616 out <- [[[[[[[[[registered]Bind Worker["If@Boolean", |
1617 [[[[[NWorker["rhope"] | 1617 [[[[[NWorker["rhope"] |
1618 ]Inputs <<[("condition")] | 1618 ]Inputs <<[("condition")] |
1619 ]Input Types <<[ [()]Append[Type Instance["Boolean"]] ] | 1619 ]Input Types <<[ [()]Append[Type Instance["Boolean"]] ] |
1620 ]Outputs <<[("isyes","isno")] | 1620 ]Outputs <<[("isyes","isno")] |
1621 ]Output Types <<[ [[()]Append[Type Instance["Boolean"]]]Append[Type Instance["Boolean"]] ] | 1621 ]Output Types <<[ [[()]Append[Type Instance["Boolean"]]]Append[Type Instance["Boolean"]] ] |
1660 ]Inputs <<[("id")] | 1660 ]Inputs <<[("id")] |
1661 ]Input Types <<[ [()]Append[Type Instance["UInt32"]]] | 1661 ]Input Types <<[ [()]Append[Type Instance["UInt32"]]] |
1662 ]Outputs <<[("bp","none")] | 1662 ]Outputs <<[("bp","none")] |
1663 ]Output Types <<[ [[()]Append[Type Instance["Blueprint"]]]Append[Type Instance["Any Type"]]] | 1663 ]Output Types <<[ [[()]Append[Type Instance["Blueprint"]]]Append[Type Instance["Any Type"]]] |
1664 ]Builtin? << [Yes]] | 1664 ]Builtin? << [Yes]] |
1665 ]Bind Worker["Pause", | |
1666 [[[[[NWorker["rhope"] | |
1667 ]Inputs <<[("tocall")] | |
1668 ]Input Types <<[ [()]Append[Type Instance["Worker"]]] | |
1669 ]Outputs <<[("resumeval")] | |
1670 ]Output Types <<[ [()]Append[Type Instance["Any Type"]] ] | |
1671 ]Builtin? <<[Yes]] | |
1672 ]Bind Worker["Resume", | |
1673 [[[[[NWorker["rhope"] | |
1674 ]Inputs <<[("toresume","resumeval")] | |
1675 ]Input Types <<[ [[()]Append[Type Instance["Contest"]]]Append[Type Instance["Any Type"]] ] | |
1676 ]Outputs <<[("success","cantresume")] | |
1677 ]Output Types <<[ [[()]Append[Type Instance["Any Type"]]]Append[Type Instance["Any Type"]] ] | |
1678 ]Builtin? <<[Yes]] | |
1665 } | 1679 } |
1666 | 1680 |
1667 Find Worker@NProgram[prog, name:out,notfound] | 1681 Find Worker@NProgram[prog, name:out,notfound] |
1668 { | 1682 { |
1669 out,notfound <- [[prog]Worker Refs >>]Index[name] | 1683 out,notfound <- [[prog]Worker Refs >>]Index[name] |