Mercurial > repos > rhope
annotate nworker_c.rhope @ 114:25a205094f9b
More performance optimizations
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Wed, 13 Oct 2010 01:15:04 +0000 |
parents | 2f6f0867fd68 |
children | 04148770c229 |
rev | line source |
---|---|
102
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1 Import cbackend_c.rhope |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
2 Import number_c.rhope |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
3 Import boolean.rhope |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
4 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
5 Blueprint Condition Set |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
6 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
7 Variables |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
8 Subsets |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
9 Condition Type |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
10 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
11 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
12 AndSet[:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
13 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
14 out <- [[[Build[Condition Set()]]Variables <<[Dictionary[]]]Subsets <<[Dictionary[]]]Condition Type <<["And"] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
15 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
16 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
17 OrSet[:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
18 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
19 out <- [[[Build[Condition Set()]]Variables <<[Dictionary[]]]Subsets <<[Dictionary[]]]Condition Type <<["Or"] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
20 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
21 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
22 To String@Condition Set[set:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
23 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
24 out <- [[[[[set]Condition Type >> |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
25 ]Append["Set:\n\tVariables:\n\t\t"] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
26 ]Append[ Join[Keys[[set]Variables >>], "\n\t\t"] ] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
27 ]Append["\n\tSubsets:\n\t\t"] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
28 ]Append[ Join[Keys[[set]Subsets >>], "\n\t\t"] ] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
29 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
30 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
31 Add Condition@Condition Set[set,cond:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
32 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
33 If[[Blueprint Of[cond]] = [Condition Set()]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
34 { |
114
25a205094f9b
More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents:
102
diff
changeset
|
35 If[[[set]Condition Type >>]=[[cond]Condition Type >>]] |
25a205094f9b
More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents:
102
diff
changeset
|
36 { |
25a205094f9b
More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents:
102
diff
changeset
|
37 out <- [[set]Variables <<[ Combine[[set]Variables >>, [cond]Variables >>] ] |
25a205094f9b
More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents:
102
diff
changeset
|
38 ]Subsets <<[ Combine[[set]Subsets >>, [cond]Subsets >>] ] |
25a205094f9b
More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents:
102
diff
changeset
|
39 }{ |
25a205094f9b
More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents:
102
diff
changeset
|
40 [cond]Empty? |
25a205094f9b
More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents:
102
diff
changeset
|
41 { |
25a205094f9b
More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents:
102
diff
changeset
|
42 out <- [set]Subsets <<[ [[set]Subsets>>]Set[[cond]To String, cond] ] |
25a205094f9b
More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents:
102
diff
changeset
|
43 }{ |
25a205094f9b
More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents:
102
diff
changeset
|
44 out <- set |
25a205094f9b
More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents:
102
diff
changeset
|
45 } |
25a205094f9b
More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents:
102
diff
changeset
|
46 } |
102
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
47 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
48 out <- [set]Variables <<[ [[set]Variables >>]Set[cond, Yes] ] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
49 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
50 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
51 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
52 =@Condition Set[set1,set2:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
53 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
54 ,out <- If[[[set1]Condition Type >>] = [[set2]Condition Type >>]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
55 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
56 ,out <- If[[[set1]Variables >>] = [[set2]Variables >>]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
57 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
58 out,out <- If[[[set1]Subsets >>] = [[set2]Subsets >>]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
59 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
60 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
61 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
62 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
63 _For Backend Var[current,junk,variable,type:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
64 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
65 If[[type]=["And"]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
66 { cond <- Val[AndCond[?]] } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
67 { cond <- Val[OrCond[?]] } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
68 out <- [cond]Call[current, variable] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
69 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
70 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
71 _For Backend Subset[current,subset,type:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
72 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
73 [subset]For Backend |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
74 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
75 If[[type]=["And"]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
76 { cond <- Val[AndCond[?]] } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
77 { cond <- Val[OrCond[?]] } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
78 out <- out <- [cond]Call[current, ~] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
79 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
80 out <- current |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
81 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
82 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
83 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
84 Empty?@Condition Set[set:not empty,empty] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
85 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
86 [[set]Variables >>]First |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
87 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
88 not empty <- Yes |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
89 }{ |
114
25a205094f9b
More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents:
102
diff
changeset
|
90 ,empty <- [[set]Subsets >>]First |
102
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
91 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
92 not empty <- Yes |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
93 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
94 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
95 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
96 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
97 For Backend@Condition Set[set:out,none] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
98 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
99 firstvar <- [[set]Variables >>]First |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
100 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
101 [[set]Variables >>]Next[~] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
102 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
103 vars <- _Fold[[set]Variables >>, ~, firstvar, _For Backend Var[?, ?, ?, [set]Condition Type >>]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
104 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
105 vars <- Val[firstvar] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
106 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
107 out <- Fold[_For Backend Subset[?, ?, [set]Condition Type >>], vars, [set]Subsets >>] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
108 }{ |
114
25a205094f9b
More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents:
102
diff
changeset
|
109 [[set]Subsets >>]First |
102
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
110 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
111 firstsub <- [[[set]Subsets >>]Index[~]]For Backend |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
112 [[set]Subsets >>]Next[~] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
113 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
114 out <- _Fold[[set]Subsets >>, ~, firstsub, _For Backend Subset[?, ?, [set]Condition Type >>]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
115 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
116 out <- Val[firstsub] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
117 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
118 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
119 none <- Yes |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
120 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
121 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
122 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
123 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
124 List of Lists[num:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
125 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
126 out <- Fold[Append[?, ()],(), Range[0,num]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
127 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
128 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
129 Blueprint Worker Ref |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
130 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
131 Name |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
132 Convention |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
133 Inputs |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
134 Min Inputs |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
135 Outputs |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
136 Min Outputs |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
137 Is Method? |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
138 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
139 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
140 Worker Ref[name,convention,inputs,outputs,ismethod?:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
141 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
142 out <- [[[[[[[Build[Worker Ref()]]Name <<[name]]Convention <<[convention]]Inputs <<[inputs]]Outputs <<[outputs]]Is Method? <<[ismethod?]]Min Inputs <<[inputs]]Min Outputs <<[outputs] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
143 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
144 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
145 String@Worker Ref[ref:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
146 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
147 out <- [[[[[[[["Worker Ref[" |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
148 ]Append[[ref]Name >>] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
149 ]Append[", "] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
150 ]Append[[ref]Convention >>] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
151 ]Append[", "] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
152 ]Append[String[[ref]Inputs >>]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
153 ]Append[", "] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
154 ]Append[String[[ref]Outputs >>]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
155 ]Append["]"] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
156 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
157 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
158 Blueprint Node Ref |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
159 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
160 Index |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
161 IO Num |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
162 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
163 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
164 Node Ref[index,ionum:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
165 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
166 out <- [[Build[Node Ref()]]Index <<[index]]IO Num <<[ionum] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
167 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
168 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
169 =@Node Ref[left,right:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
170 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
171 ,out <- If[[[left]Index >>] = [[right]Index >>]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
172 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
173 out <- [[left]IO Num>>] = [[right]IO Num >>] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
174 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
175 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
176 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
177 Blueprint NWorker Node |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
178 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
179 Type |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
180 Data |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
181 Inputs |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
182 Min Inputs |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
183 Input Types |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
184 Outputs |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
185 Min Outputs |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
186 Output Types |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
187 Wires From |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
188 Wires To |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
189 Conditions |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
190 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
191 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
192 Wire To@NWorker Node[node,from,output,pre input:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
193 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
194 existing cons <- [[node]Wires To >>]Index[input] {} |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
195 { existing cons <- () } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
196 input <- [pre input]+[1] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
197 out <- [node]Wires To <<[ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
198 [[node]Wires To >>]Set[input, |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
199 [existing cons]Append[Node Ref[from,output]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
200 ] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
201 ] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
202 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
203 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
204 Wire From@NWorker Node[node,to,input,output:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
205 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
206 existing cons <- [[node]Wires From >>]Index[output] {} |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
207 { exist cons <- () } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
208 out <- [node]Wires From <<[ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
209 [[node]Wires From >>]Set[output, |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
210 [existing cons]Append[Node Ref[to,input]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
211 ] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
212 ] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
213 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
214 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
215 _Has Input Types@NWorker Node[node,input num:does,does not] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
216 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
217 does <- If[[input num] > [[node]Inputs >>]] {} |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
218 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
219 ,does not <- [[node]Input Types >>]Index[input num] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
220 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
221 count <- [~]Index[1] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
222 ,does not <- If[[count] = [[[[node]Wires To >>]Index[input num]]Length]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
223 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
224 does,does not <- [node]_Has Input Types[[input num]+[1]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
225 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
226 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
227 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
228 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
229 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
230 Has Input Types?@NWorker Node[node:does,does not] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
231 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
232 If[[[node]Inputs >>] > [0]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
233 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
234 does,does not <- _Has Input Types[node,0] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
235 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
236 does <- Yes |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
237 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
238 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
239 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
240 _Dependency[dlist,ref:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
241 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
242 [dlist]Find[=[ref, ?]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
243 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
244 out <- dlist |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
245 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
246 out <- [dlist]Append[ref] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
247 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
248 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
249 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
250 Dependencies@NWorker Node[node:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
251 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
252 out <- Fold[Fold[_Dependency[?], ?], (), [node]Wires To >>] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
253 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
254 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
255 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
256 NWorker Node[type,data,inputs,outputs:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
257 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
258 out <- [[[[[[[[[[[Build[NWorker Node()] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
259 ]Type <<[type] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
260 ]Data <<[data] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
261 ]Inputs <<[inputs] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
262 ]Min Inputs <<[inputs] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
263 ]Outputs <<[outputs] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
264 ]Min Outputs <<[outputs] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
265 ]Wires From <<[List of Lists[outputs]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
266 ]Wires To <<[List of Lists[[inputs]+[1]]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
267 ]Conditions <<[AndSet[]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
268 ]Input Types <<[()] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
269 ]Output Types <<[()] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
270 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
271 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
272 Blueprint NWorker |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
273 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
274 Convention |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
275 Nodes |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
276 Inputs |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
277 Input Types |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
278 Outputs |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
279 Output Types |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
280 Uses |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
281 NodeResults |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
282 Free Temps |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
283 Name |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
284 Builtin? |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
285 Library |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
286 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
287 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
288 NWorker[convention:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
289 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
290 out <- [[[[[[[[[Build[NWorker()]]Convention <<[convention]]Nodes <<[()]]Inputs <<[()]]Outputs <<[()]]Input Types <<[()]]Output Types <<[()]]Name <<["Anonymous"]]Builtin? <<[No]]Library << [""] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
291 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
292 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
293 String@NWorker[worker:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
294 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
295 out <- ["NWorker"]Append[[worker]Name >>] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
296 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
297 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
298 Add Node@NWorker[worker,type,data,inputs,outputs:out,node index] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
299 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
300 out <- [worker]Nodes <<[[[worker]Nodes >>]Append[NWorker Node[type,data,inputs,outputs]]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
301 node index <- [[worker]Nodes >>]Length |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
302 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
303 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
304 Add Full Node@NWorker[worker,type,data,inputs,min inputs,outputs,min outputs:out,node index] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
305 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
306 out <- [worker]Nodes <<[[[worker]Nodes >>]Append[ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
307 [[[NWorker Node[type,data,inputs,outputs] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
308 ]Min Inputs <<[min inputs] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
309 ]Min Outputs <<[min outputs] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
310 ]Wires To <<[List of Lists[[min inputs]+[1]]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
311 ]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
312 node index <- [[worker]Nodes >>]Length |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
313 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
314 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
315 Propagate Type[nodelist,dest,prog,worker,type:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
316 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
317 node <- [nodelist]Index[[dest]Index >>] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
318 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
319 [[node]Input Types >>]Index[[dest]IO Num >>] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
320 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
321 existing type <- [~]Index[0] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
322 new count <- [[~]Index[1]]+[1] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
323 If[[[existing type]Name >>] = [[type]Name >>]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
324 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
325 If[[[existing type]Variant >>] = [[type]Variant >>]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
326 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
327 If[[[existing type]Params >>] = [[type]Params >>]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
328 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
329 new type <- Val[existing type] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
330 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
331 new variant <- [existing type]Variant >> |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
332 new params <- () |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
333 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
334 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
335 new variant <- "Boxed" |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
336 If[[[existing type]Params >>] = [[type]Params >>]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
337 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
338 new params <- [existing type]Params >> |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
339 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
340 new params <- () |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
341 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
342 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
343 new type <- [[existing type]Set Variant[new variant]]Params <<[new params] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
344 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
345 new type <- Type Instance["Any Type"] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
346 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
347 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
348 new type <- Val[type] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
349 new count <- 1 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
350 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
351 new node <- [node]Input Types <<[ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
352 [ [node]Input Types >> ]Set[ [dest]IO Num >>, [[()]Append[new type]]Append[new count] ] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
353 ] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
354 out <- Infer Types Node[[nodelist]Set[[dest]Index >>, new node], new node, [dest]Index >>, prog, worker] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
355 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
356 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
357 Propagate Types[nodelist,dests,output num,prog,worker,source node:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
358 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
359 out <- Fold[Propagate Type[?, ?, prog, worker, [[source node]Output Types >>]Index[output num]], nodelist, dests] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
360 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
361 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
362 Infer Types Node[nodelist,node,index,prog,worker:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
363 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
364 If[[[node]Type >>] = ["const"]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
365 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
366 const type <- Blueprint Of[[node]Data >>] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
367 [(Int8(),UInt8(),Int16(),UInt16(),Int32(),UInt32(),Int64(),UInt64(), |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
368 Type Instance(),Worker Literal(),List(),List Leaf(),String(),String Slice(),String Cat())]Find[=[const type, ?]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
369 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
370 outtype <- [("Int8","UInt8","Int16","UInt16","Int32","UInt32","Int64","UInt64", |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
371 "Blueprint","Worker","List","List","String","String","String")]Index[~] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
372 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
373 outtype <- "Any Type" |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
374 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
375 nextnode <- [node]Output Types <<[ [()]Append[Type Instance[outtype]] ] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
376 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
377 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
378 If[[[node]Type >>] = ["input"]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
379 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
380 nextnode <- [node]Output Types <<[ [()]Append[ [[worker]Input Types >>]Index[[node]Data >>] ] ] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
381 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
382 If[[[node]Type >>] = ["output"]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
383 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
384 out <- nodelist |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
385 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
386 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
387 [node]Has Input Types? |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
388 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
389 If[[[node]Type >>] = ["setfield"]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
390 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
391 nextnode <- [node]Output Types <<[ [()]Append[ [[[node]Input Types >>]Index[0]]Index[0] ] ] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
392 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
393 If[[[node]Type >>] = ["getfield"]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
394 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
395 type <- [[[node]Input Types >>]Index[0]]Index[0] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
396 If[[[type]Name >>] = ["Any Type"]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
397 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
398 outtype <- Val[type] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
399 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
400 outtype <- [prog]Find Field[[node]Data >>, type] {} |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
401 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
402 //TODO: Return errors rather than printing them |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
403 Print[ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
404 [[[[["Type " |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
405 ]Append[[type]Name >>] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
406 ]Append[" does not have a field named "] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
407 ]Append[[node]Data >>] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
408 ]Append[" in worker "] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
409 ]Append[worker name]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
410 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
411 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
412 nextnode <- [node]Output Types <<[ [()]Append[outtype] ] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
413 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
414 worker name <- [[node]Data >>]Name >> |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
415 [prog]Is Method?[worker name] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
416 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
417 first arg type <- [[[node]Input Types >>]Index[0]]Index[0] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
418 If[[[first arg type]Name >>] = ["Any Type"]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
419 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
420 outtypes <- Fold[Append[?, Type Instance["Any Type"]], (), Range[0, [node]Inputs >>]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
421 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
422 worker def <- [prog]Find Method[worker name, first arg type] {} |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
423 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
424 //TODO: Return errors instead of printing them |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
425 Print[ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
426 [[[[["Type " |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
427 ]Append[[first arg type]Name >>] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
428 ]Append[" does not support method "] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
429 ]Append[worker name] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
430 ]Append[" in worker "] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
431 ]Append[ [worker]Name >> ]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
432 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
433 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
434 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
435 worker def <- [prog]Find Worker Def[worker name] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
436 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
437 outtypes <- [worker def]Output Types >> |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
438 nextnode <- [node]Output Types <<[ outtypes ] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
439 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
440 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
441 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
442 out <- nodelist |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
443 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
444 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
445 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
446 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
447 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
448 Val[nextnode] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
449 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
450 nextlist <- [nodelist]Set[index, nextnode] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
451 out <- Fold[Propagate Types[?, ?, ?, prog, worker, nextnode], nodelist, [nextnode]Wires From >>] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
452 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
453 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
454 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
455 Infer Types@NWorker[worker,prog:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
456 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
457 out <- [worker]Nodes <<[Fold[Infer Types Node[?, ?, ?, prog, worker], [worker]Nodes >>, [worker]Nodes >>]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
458 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
459 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
460 Add Worker Call@NWorker[worker,tocall:out,node index] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
461 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
462 out, node index <- [worker]Add Full Node["call",tocall,[tocall]Inputs >>, [tocall]Min Inputs >>,[tocall]Outputs >>, [tocall]Min Outputs >>] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
463 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
464 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
465 Add Constant@NWorker[worker,constant:out,node index] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
466 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
467 out, node index <- [worker]Add Node["const",constant,0,1] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
468 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
469 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
470 Add Input@NWorker[worker,name,number:out,node index] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
471 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
472 out,node index <- [worker]Add Typed Input[name,number,Type Instance["Any Type"]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
473 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
474 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
475 Add Typed Input@NWorker[worker,name,number,type:out,node index] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
476 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
477 ,node index <- [worker]Add Node["input",number,0,1] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
478 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
479 out <- [[~]Inputs <<[[[~]Inputs >>]Set[number,name]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
480 ]Input Types <<[[[~]Input Types >>]Set[number,type]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
481 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
482 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
483 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
484 Add Output@NWorker[worker,name,number:out,node index] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
485 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
486 out,node index <- [worker]Add Typed Output[name,number,Type Instance["Any Type"]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
487 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
488 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
489 Add Typed Output@NWorker[worker,name,number,type:out,node index] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
490 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
491 ,node index <- [worker]Add Node["output",number,1,0] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
492 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
493 out <- [[~]Outputs <<[[[~]Outputs >>]Set[number,name]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
494 ]Output Types <<[[[~]Output Types >>]Set[number,type]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
495 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
496 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
497 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
498 Add Object Get@NWorker[worker,fieldname:out,node index] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
499 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
500 out, node index <- [worker]Add Node["getfield",fieldname,1,1] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
501 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
502 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
503 Add Object Set@NWorker[worker,fieldname:out,node index] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
504 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
505 out, node index <- [worker]Add Node["setfield",fieldname,2,1] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
506 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
507 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
508 Add Global Get@NWorker[worker,store,var:out,node index] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
509 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
510 out, node index <- [worker]Add Node["getglobal",[[()]Append[store]]Append[var],0,1] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
511 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
512 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
513 Add Global Set@NWorker[worker,store,var:out,node index] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
514 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
515 out, node index <- [worker]Add Node["setglobal",[[()]Append[store]]Append[var],1,1] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
516 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
517 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
518 Add Wire@NWorker[worker,from,output,to,input:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
519 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
520 fromw <- [[[worker]Nodes >>]Index[from]]Wire From[to,input,output] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
521 tow <- [[[worker]Nodes >>]Index[to]]Wire To[from,output,input] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
522 nodes <- [[[worker]Nodes >>]Set[from, fromw]]Set[to, tow] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
523 out <- [worker]Nodes <<[nodes] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
524 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
525 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
526 Uses@NWorker[worker,uses:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
527 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
528 out <- [worker]Uses <<[uses] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
529 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
530 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
531 _No Dependencies[list,node,index:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
532 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
533 [[node]Wires To>>]Index[1] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
534 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
535 out <- Val[list] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
536 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
537 [[[node]Wires To>>]Index[0]]First |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
538 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
539 out <- Val[list] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
540 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
541 out <- [list]Append[index] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
542 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
543 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
544 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
545 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
546 No Dependencies@NWorker[worker:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
547 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
548 out <- Fold[_No Dependencies[?], (), [worker]Nodes >>] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
549 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
550 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
551 _Collect Dests[candidates,wire:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
552 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
553 out <- [candidates]Set[[wire]Index >>, Yes] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
554 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
555 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
556 Collect Dests@NWorker[worker,candidates,node index:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
557 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
558 out <- Fold[Fold[_Collect Dests[?], ?], candidates, [[[worker]Nodes >>]Index[node index]]Wires From >>] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
559 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
560 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
561 Check Dependency@NWorker[worker,nodes,wires,wire index:met?] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
562 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
563 ref <- [wires]Index[wire index] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
564 [nodes]Find[=[[ref]Index >>, ?]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
565 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
566 [wires]Next[wire index] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
567 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
568 met? <- [worker]Check Dependency[nodes,wires,~] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
569 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
570 met? <- Yes |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
571 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
572 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
573 met? <- No |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
574 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
575 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
576 _Check Dependencies@NWorker[worker,nodes,inputs,input index:met?] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
577 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
578 wires <- [inputs]Index[input index] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
579 [wires]First |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
580 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
581 current met? <- [worker]Check Dependency[nodes, wires, ~] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
582 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
583 current met? <- Yes |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
584 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
585 If[current met?] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
586 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
587 [inputs]Next[input index] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
588 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
589 met? <- [worker]_Check Dependencies[nodes,inputs,~] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
590 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
591 met? <- Yes |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
592 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
593 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
594 met? <- No |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
595 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
596 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
597 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
598 Check Dependencies@NWorker[worker,nodes,candidate:met?] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
599 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
600 inputs <- [[[worker]Nodes >>]Index[candidate]]Wires To >> |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
601 [inputs]First |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
602 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
603 met? <- [worker]_Check Dependencies[nodes, inputs, ~] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
604 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
605 met? <- Yes |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
606 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
607 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
608 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
609 Dependants@NWorker[worker,direct nodes,nodes:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
610 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
611 candidates <- Keys[Fold[Collect Dests[worker, ?], (), direct nodes]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
612 out <- Filter[candidates, Check Dependencies[worker, nodes, ?]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
613 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
614 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
615 _Dependency Groups@NWorker[worker,last,all,grouped:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
616 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
617 current <- [worker]Dependants[last,all] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
618 [current]First |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
619 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
620 out <- [worker]_Dependency Groups[current, [all]Concatenate[current], [grouped]Append[current]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
621 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
622 out <- grouped |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
623 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
624 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
625 Dependency Groups@NWorker[worker:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
626 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
627 no deps <- [worker]No Dependencies |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
628 out <- [worker]_Dependency Groups[no deps, no deps, [()]Append[no deps]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
629 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
630 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
631 Const Name[val,node index,worker name:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
632 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
633 valtype <- Blueprint Of[val] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
634 If[[valtype] = [Type Instance()]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
635 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
636 //TODO: Support parametric types |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
637 datstring <- [val]Name >> |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
638 typename <- "Blueprint" |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
639 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
640 [(Int8(),UInt8(),Int16(),UInt16(),Int32(),UInt32(),Int64(),UInt64())]Find[=[valtype,?]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
641 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
642 size <- [("8","16","32","64")]Index[[~]/[2]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
643 typename <- [("Int8","UInt8","Int16","UInt16","Int32","UInt32","Int64","UInt64")]Index[~] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
644 If[[~]Mod[2]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
645 { s <- "UI" } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
646 { s <- "I" } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
647 datstring <- [[String[val]]Append[s]]Append[size] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
648 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
649 If[[valtype] = [Worker Literal()]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
650 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
651 typename <- "Worker" |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
652 If[[[[val]Args >>]Length] > [0]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
653 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
654 datstring <- [[["Arg "]Append[String[node index]]]Append[" "]]Append[worker name] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
655 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
656 datstring <- [val]Name >> |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
657 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
658 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
659 [(List(),List Leaf())]Find[=[valtype,?]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
660 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
661 typename <- "List" |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
662 If[[[val]Length] > [0]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
663 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
664 datstring <- [[["Arg "]Append[String[node index]]]Append[" "]]Append[worker name] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
665 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
666 datstring <- "Empty" |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
667 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
668 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
669 [(String(),String Cat(),String Slice())]Find[=[valtype, ?]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
670 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
671 typename <- "String" |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
672 datstring <- val |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
673 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
674 typename <- "Unknown" |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
675 datstring <- String[val] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
676 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
677 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
678 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
679 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
680 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
681 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
682 out <- [[typename]Append["_"]]Append[datstring] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
683 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
684 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
685 Format Input@NWorker[worker,noderef:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
686 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
687 node <- [[worker]Nodes >>]Index[[noderef]Index >>] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
688 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
689 [("call","getfield","setfield")]Find[=[[node]Type >>, ?]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
690 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
691 maybe addref <- Result Var Name[[noderef]IO Num >>, [noderef]Index >>] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
692 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
693 conditions <- [node]Conditions >> |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
694 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
695 If[[[node]Type >>] = ["input"]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
696 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
697 input name <- [[worker]Inputs >>]Index[ [node]Data >> ] |
114
25a205094f9b
More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents:
102
diff
changeset
|
698 [conditions]Empty? |
102
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
699 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
700 out <- AddRef[Result Var Name[[noderef]IO Num >>, [noderef]Index >>]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
701 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
702 out <- AddRef[input name] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
703 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
704 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
705 If[[[node]Type >>] = ["const"]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
706 { |
114
25a205094f9b
More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents:
102
diff
changeset
|
707 [conditions]Empty? |
102
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
708 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
709 out <- AddRef[Result Var Name[[noderef]IO Num >>, [noderef]Index >>]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
710 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
711 out <- Constant[Const Name[[node]Data >>, [noderef]Index >>, [worker]Name >>]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
712 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
713 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
714 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
715 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
716 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
717 Val[maybe addref] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
718 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
719 If[[Length[[[node]Wires From >>]Index[[noderef]IO Num >>]]] > [1]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
720 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
721 out <- AddRef[maybe addref] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
722 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
723 out <- Val[maybe addref] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
724 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
725 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
726 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
727 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
728 Collect Input@NWorker[worker,nodeinput:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
729 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
730 inputchoices <- Map[nodeinput, Format Input[worker, ?]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
731 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
732 [inputchoices]First |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
733 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
734 first <- [inputchoices]Index[~] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
735 [inputchoices]Next[~] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
736 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
737 out <- _Fold[inputchoices, ~, first, OrValue[?]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
738 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
739 out <- Val[first] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
740 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
741 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
742 out <- "Missing" |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
743 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
744 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
745 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
746 Collect Inputs@NWorker[worker,node:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
747 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
748 out <- Map[Tail[[node]Wires To>>, 1], Collect Input[worker, ?]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
749 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
750 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
751 Collect Input Condition@NWorker[worker,set,noderef:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
752 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
753 node <- [[worker]Nodes >>]Index[ [noderef]Index >> ] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
754 If[[[node]Outputs >>] > [1]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
755 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
756 out <- [set]Add Condition[ Result Var Name[[noderef]IO Num >>, [noderef]Index >>] ] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
757 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
758 out <- [set]Add Condition[[node]Conditions >>] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
759 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
760 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
761 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
762 Collect Condition@NWorker[worker,set,nodeinput:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
763 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
764 out <- [set]Add Condition[Fold[Collect Input Condition[worker, ?], OrSet[], nodeinput]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
765 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
766 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
767 Collect Conditions@NWorker[worker,node:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
768 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
769 out <- Fold[Collect Condition[worker, ?], AndSet[], [node]Wires To>>] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
770 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
771 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
772 Save Result[func,num,node index:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
773 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
774 out <- [func]Move[Result[num], Result Var Name[num, node index]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
775 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
776 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
777 Save Maybe Result[func,num,node index:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
778 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
779 out <- [func]Move[Check Result[num], Result Var Name[num, node index]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
780 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
781 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
782 Max Used Output[node,cur:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
783 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
784 If[[cur] < [0]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
785 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
786 out <- cur |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
787 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
788 [[[node]Wires From >>]Index[cur]]Index[0] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
789 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
790 out <- cur |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
791 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
792 out <- Max Used Output[node, [cur]-[1]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
793 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
794 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
795 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
796 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
797 Compile Call Node[node,program,func,inputs,node index:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
798 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
799 If[[[node]Type >>] = ["getfield"]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
800 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
801 with call <- [func]Get Field Call[[node]Data >>, [inputs]Index[0]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
802 save outs <- [node]Outputs >> |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
803 out <- Val[after save] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
804 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
805 If[[[node]Type >>] = ["setfield"]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
806 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
807 with call <- [func]Set Field Call[[node]Data >>, [inputs]Index[0], [inputs]Index[1]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
808 save outs <- [node]Outputs >> |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
809 out <- Val[after save] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
810 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
811 [program]Method?[[[node]Data >>]Name >>] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
812 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
813 with call <- [func]Method Call[[[node]Data >>]Name >>, inputs] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
814 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
815 with call <- [func]Call[[[node]Data >>]Name >>, inputs] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
816 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
817 first unused <- [Max Used Output[node, [[node]Outputs >>]-[1]]]+[1] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
818 If[[first unused] > [[node]Min Outputs >>]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
819 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
820 save outs <- [node]Min Outputs >> |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
821 after maybe <- Fold[Save Maybe Result[?, ?, node index], after save, Range[save outs, first unused]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
822 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
823 save outs <- Val[first unused] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
824 after maybe <- Val[after save] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
825 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
826 If[[first unused] < [[node]Outputs >>]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
827 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
828 out <- [after maybe]Discard Outputs[first unused] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
829 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
830 out <- Val[after maybe] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
831 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
832 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
833 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
834 after save <- Fold[Save Result[?, ?, node index], with call, Range[0, save outs]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
835 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
836 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
837 Compile Node@NWorker[worker,program,func,nodes,current:out,out worker] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
838 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
839 node index <- [nodes]Index[current] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
840 node <- [[worker]Nodes >>]Index[node index] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
841 conditions <- [node]Conditions >> |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
842 [("call","getfield","setfield")]Find[=[[node]Type >>, ?]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
843 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
844 inputs <- [worker]Collect Inputs[node] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
845 [conditions]For Backend |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
846 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
847 stream <- [func]Instruction Stream |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
848 nfunc <- [func]Do If[~, nstream] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
849 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
850 stream <- Val[func] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
851 nfunc <- Val[nstream] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
852 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
853 nstream <- Compile Call Node[node, program, stream, inputs, node index] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
854 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
855 If[[[node]Type >>] = ["output"]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
856 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
857 inputs <- [worker]Collect Inputs[node] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
858 [conditions]For Backend |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
859 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
860 stream <- [func]Instruction Stream |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
861 nfunc <- [func]Do If[~, nstream] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
862 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
863 stream <- Val[func] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
864 nfunc <- Val[nstream] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
865 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
866 nstream <- [stream]Move[[inputs]Index[0], [[worker]Outputs >>]Index[ [node]Data >> ] ] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
867 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
868 If[[[node]Type >>] = ["const"]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
869 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
870 constname <- Const Name[[node]Data >>, node index, [worker]Name >>] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
871 withconst <- [func]Register Constant[constname, [node]Data >>] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
872 [conditions]For Backend |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
873 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
874 stream <- [[withconst]Instruction Stream |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
875 ]Move[Constant[constname], Result Var Name[0, node index]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
876 nfunc <- [withconst]Do If[~, stream] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
877 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
878 nfunc <- Val[withconst] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
879 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
880 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
881 [conditions]For Backend |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
882 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
883 input name <- [[worker]Inputs >>]Index[ [node]Data >> ] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
884 stream <- [[func]Instruction Stream |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
885 ]Move[input name, Result Var Name[0, node index]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
886 nfunc <- [func]Do If[~, stream] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
887 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
888 nfunc <- Val[func] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
889 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
890 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
891 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
892 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
893 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
894 [nodes]Next[current] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
895 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
896 out,out worker <- [worker]Compile Node[program,nfunc,nodes,~] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
897 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
898 out <- Val[nfunc] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
899 out worker <- Val[worker] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
900 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
901 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
902 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
903 Save Node Conditions@NWorker[worker,node index:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
904 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
905 node <- [[worker]Nodes >>]Index[node index] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
906 conditions <- [worker]Collect Conditions[node] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
907 out <- [worker]Nodes <<[ [[worker]Nodes >>]Set[node index, [node]Conditions <<[conditions]] ] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
908 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
909 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
910 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
911 Save Group Conditions@NWorker[worker, groups,current:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
912 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
913 nodes <- [groups]Index[current] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
914 nworker <- Fold[Save Node Conditions[?], worker, nodes] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
915 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
916 [groups]Next[current] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
917 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
918 out <- [nworker]Save Group Conditions[groups,~] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
919 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
920 out <- Val[nworker] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
921 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
922 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
923 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
924 Compile Group@NWorker[worker,program,func,groups,current:out,out worker] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
925 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
926 nodes <- [groups]Index[current] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
927 [nodes]First |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
928 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
929 nfunc,nworker <- [worker]Compile Node[program,func,nodes,~] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
930 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
931 nfunc <- Val[func] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
932 nworker <- Val[worker] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
933 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
934 [groups]Next[current] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
935 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
936 out,out worker <- [nworker]Compile Group[program,nfunc,groups,~] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
937 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
938 out <- Val[nfunc] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
939 out worker <- Val[nworker] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
940 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
941 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
942 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
943 Release Var@NWorker[worker,func,name:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
944 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
945 //__result_index_ionum |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
946 parts <- [name]Split["_"] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
947 index <- Int32[ [parts]Index[3] ] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
948 io num <- Int32[ [parts]Index[4] ] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
949 node <- [[worker]Nodes >>]Index[index] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
950 dests <- [[node]Wires From >>]Index[io num] {} |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
951 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
952 If[[[dests]Length] = [1]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
953 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
954 dest index <- [[dests]Index[0]]Index >> |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
955 dest node <- [[worker]Nodes >>]Index[dest index] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
956 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
957 [[dest node]Conditions >>]For Backend |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
958 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
959 out <- [func]Do If[AndCond[NotCond[~], name], [[func]Instruction Stream]Release[name]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
960 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
961 out <- func |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
962 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
963 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
964 do if <- If[[[node]Outputs >>] > [1]] {} |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
965 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
966 do if <- [[node]Conditions >>]Empty? {} |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
967 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
968 out <- [func]Release[name] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
969 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
970 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
971 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
972 Val[do if] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
973 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
974 stream <- [[func]Instruction Stream]Release[name] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
975 out <- [func]Do If[name, stream] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
976 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
977 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
978 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
979 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
980 Result Var Name[io num, index:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
981 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
982 out <- [[["__result_"]Append[String[index]]]Append["_"]]Append[String[io num]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
983 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
984 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
985 Result Var[vars,io num,index:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
986 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
987 out <- [vars]Append[Result Var Name[io num, index]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
988 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
989 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
990 Node Result Vars[vars,node,index:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
991 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
992 [("call","getfield","setfield")]Find[=[[node]Type >>, ?]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
993 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
994 If[[[node]Type >>]=["call"]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
995 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
996 save outs <- [Max Used Output[node, [[node]Outputs >>]-[1]]]+[1] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
997 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
998 save outs <- [node]Outputs >> |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
999 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1000 out <- Fold[Result Var[?, ?, index], vars, Range[0, save outs]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1001 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1002 out <- vars |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1003 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1004 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1005 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1006 Result Vars@NWorker[worker:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1007 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1008 out <- Fold[Node Result Vars[?], (), [worker]Nodes >>] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1009 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1010 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1011 _No Release[vars,node,index,worker:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1012 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1013 [("const","input")]Find[=[[node]Type >>, ?]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1014 { |
114
25a205094f9b
More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents:
102
diff
changeset
|
1015 [[node]Conditions >>]Empty? |
102
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1016 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1017 out <- Result Var[vars, 0, index] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1018 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1019 out <- vars |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1020 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1021 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1022 out <- vars |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1023 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1024 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1025 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1026 No Release Results@NWorker[worker:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1027 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1028 out <- Fold[_No Release[?, ?, ?, worker], (), [worker]Nodes >>] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1029 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1030 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1031 Make Basic Type[type:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1032 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1033 out <- [Type Instance[[type]Name >>]]Params <<[ [type]Params >> ] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1034 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1035 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1036 FInputs[ifunc, input type, index, inputs:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1037 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1038 func <- [ifunc]Set Input Type[Make Basic Type[input type], index] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1039 name <- [inputs]Index[index] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1040 If[[[input type]Variant >>] = ["Naked"]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1041 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1042 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1043 naked <- [" naked"]Append[name] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1044 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1045 out <- [[[func]Allocate Var[naked, input type] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1046 ]Unbox[name, naked] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1047 ]Release[name] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1048 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1049 If[[input type]Mutable? >>] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1050 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1051 name <- [inputs]Index[index] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1052 copied <- [func]Copy[name, name] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1053 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1054 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1055 copied <- Val[func] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1056 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1057 If[[[input type]Variant >>] = ["Raw Pointer"]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1058 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1059 raw <- [" raw"]Append[name] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1060 If[[[input type]Name >>]=["Array"]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1061 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1062 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1063 out <- [[copied]Allocate Var[raw, input type] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1064 ]Array Raw Pointer[name, raw] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1065 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1066 out <- [[copied]Allocate Var[raw, input type] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1067 ]Get Raw Pointer[name, raw] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1068 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1069 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1070 out <- Val[copied] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1071 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1072 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1073 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1074 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1075 FParams[input:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1076 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1077 iname <- [input]Index[0] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1078 type <- [input]Index[1] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1079 If[[[type]Variant >>] = ["Naked"]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1080 { out <- [" naked"]Append[iname] } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1081 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1082 If[[[type]Variant >>] = ["Raw Pointer"]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1083 { out <- [" raw"]Append[iname] } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1084 { out <- Val[iname] } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1085 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1086 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1087 _Return Param[outputs, inputs, input types, index:out,none] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1088 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1089 output <- [outputs]Index[index] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1090 [inputs]Find[=[output, ?]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1091 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1092 If[[[input types]Index[~]]Mutable? >>] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1093 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1094 ,none <- [outputs]Next[index] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1095 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1096 out,none <- _Return Param[outputs, inputs, input types, ~] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1097 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1098 } { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1099 out <- index |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1100 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1101 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1102 out <- index |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1103 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1104 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1105 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1106 Return Param[outputs, inputs, input types:out,none] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1107 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1108 ,none <- [outputs]First |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1109 { out,none <- _Return Param[outputs, inputs, input types, ~] } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1110 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1111 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1112 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1113 Save Foreign Result[func, output, index, output types, inputs, input types:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1114 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1115 type <- [output types]Index[index] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1116 If[[[type]Variant >>] = ["Naked"]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1117 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1118 out <- [func]Box[[" naked"]Append[output], output, type] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1119 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1120 [inputs]Find[=[output, ?]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1121 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1122 If[[[input types]Index[~]]Mutable? >>] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1123 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1124 out <- [func]Move[output, Output[output]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1125 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1126 out <- func |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1127 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1128 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1129 out <- func |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1130 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1131 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1132 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1133 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1134 Compile Foreign Stub[worker,program,name:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1135 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1136 ifunc <- [[program]Create Function[name, [worker]Inputs >>, [worker]Outputs >>, "rhope"] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1137 ]Output Types <<[Map[[worker]Output Types >>, Make Basic Type[?]]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1138 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1139 rp num <- Return Param[[worker]Outputs >>, [worker]Inputs >>, [worker]Input Types >>] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1140 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1141 rbase <- [[worker]Outputs >>]Index[rp num] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1142 If[[[[[worker]Output Types >>]Index[rp num]]Variant >>] = ["Naked"]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1143 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1144 rparam <- [" naked"]Append[rbase] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1145 rfunc <- [ifunc]Allocate Var[rparam, [[worker]Output Types >>]Index[rp num]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1146 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1147 rparam <- Val[rbase] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1148 rfunc <- Val[ifunc] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1149 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1150 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1151 rparam <- "" |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1152 rfunc <- Val[ifunc] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1153 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1154 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1155 Fold[FInputs[?, ?, ?, [worker]Inputs >>], rfunc, [worker]Input Types >>] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1156 { [~]Call Foreign[name, [worker]Convention >>, Map[Zip[[worker]Inputs >>, [worker]Input Types >>], FParams[?]], rparam] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1157 { Fold[Save Foreign Result[?, ?, ?, [worker]Output Types >>, [worker]Inputs >>, [worker]Input Types >>], ~, [worker]Outputs >>] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1158 { out <- [program]Store Function[~] }}} |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1159 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1160 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1161 Compile Worker@NWorker[worker,program,name:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1162 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1163 If[[worker]Builtin? >>] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1164 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1165 out <- program |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1166 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1167 If[[[worker]Library >>] = [""]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1168 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1169 ifunc <- Fold[Set Output Type[?], Fold[Set Input Type[?], [program]Create Function[name,[worker]Inputs >>, [worker]Outputs >>, [worker]Convention >>], [worker]Input Types >>], [worker]Output Types >>] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1170 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1171 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1172 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1173 groups <- [worker]Dependency Groups |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1174 [groups]First |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1175 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1176 with conds <- [worker]Save Group Conditions[groups, ~] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1177 final func <- [with conds]Compile Group[program,func,groups, ~] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1178 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1179 final func <- Val[func] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1180 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1181 res vars <- [worker]Result Vars |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1182 init vars <- Concatenate[res vars, [with conds]No Release Results] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1183 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1184 func <- Fold[Set Null[?], Fold[Set Null[?], Fold[Allocate Var[?, ?, "Any Type"], ifunc, init vars], init vars], [worker]Outputs >>] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1185 out <- [program]Store Function[Fold[Release[?], Fold[Release Var[with conds, ?], final func, res vars], [worker]Inputs >>]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1186 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1187 out <- Compile Foreign Stub[worker,[program]Link[[worker]Convention >>, [worker]Library >> ],name] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1188 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1189 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1190 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1191 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1192 Blueprint NBlueprint |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1193 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1194 Fields |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1195 Methods |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1196 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1197 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1198 String@NBlueprint[nbp:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1199 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1200 out <- [[[["NBlueprint: Fields(" |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1201 ]Append[Join[Map[[nbp]Fields >>, [?]Index[0]], ", "]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1202 ]Append["), Methods("] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1203 ]Append[Join[Keys[[nbp]Methods >>], ", "]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1204 ]Append[")"] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1205 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1206 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1207 NBlueprint[:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1208 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1209 out <- [[Build[NBlueprint()]]Fields <<[()]]Methods <<[Dictionary[]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1210 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1211 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1212 Add Field@NBlueprint[bp,name,type:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1213 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1214 out <- [bp]Fields <<[ [[bp]Fields >>]Append[ [[()]Append[name]]Append[type] ] ] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1215 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1216 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1217 Add Method@NBlueprint[bp,name:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1218 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1219 out <- [bp]Methods <<[ [[bp]Methods >>]Set[name, Yes] ] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1220 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1221 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1222 Understands Method@NBlueprint[bp,name:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1223 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1224 out <- [[bp]Methods >>]Index[name] {} |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1225 { out <- No } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1226 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1227 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1228 Get Field Type@NBlueprint[bp,name:out,notfound] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1229 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1230 ,notfound <- [[bp]Fields >>]Index[name] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1231 { out <- [~]Index[1] } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1232 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1233 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1234 _Compile Blueprint Fields[type,field:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1235 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1236 name <- [field]Index[0] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1237 ftype <- [field]Index[1] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1238 out <- [type]Add Field[name,ftype] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1239 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1240 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1241 _Compile Blueprint Methods[type,junk,name:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1242 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1243 If[[[name]=["Call"]] And [[[type]Name >>] = ["Worker"]]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1244 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1245 out <- type |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1246 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1247 out <- [type]Add Method[name] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1248 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1249 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1250 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1251 Make Init[func,field:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1252 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1253 name <- [field]Index[0] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1254 variant <- [[field]Index[1]]Variant >> |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1255 If[[variant] = ["Boxed"]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1256 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1257 out <- [func]Set Field Null["obj", name] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1258 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1259 out <- func |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1260 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1261 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1262 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1263 Make Copy[func,field:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1264 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1265 name <- [field]Index[0] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1266 variant <- [[field]Index[1]]Variant >> |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1267 If[[variant] = ["Boxed"]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1268 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1269 got <- [func]Read Field["obj", name] {} |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1270 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1271 stream <- [[got]Instruction Stream |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1272 ]AddRef No Dest[~] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1273 out <- [got]Do If[~, stream] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1274 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1275 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1276 out <- func |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1277 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1278 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1279 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1280 Make Cleanup[func,field:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1281 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1282 name <- [field]Index[0] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1283 variant <- [[field]Index[1]]Variant >> |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1284 If[[variant] = ["Boxed"]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1285 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1286 got <- [func]Read Field["obj", name] {} |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1287 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1288 stream <- [[got]Instruction Stream |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1289 ]Release[~] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1290 out <- [got]Do If[~, stream] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1291 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1292 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1293 out <- func |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1294 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1295 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1296 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1297 Make Special@NBlueprint[bp,backend,func name,bp name,pop worker:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1298 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1299 func <- [[backend]Create Function[func name,("obj"),(),"cdecl"] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1300 ]Set Input Type[Type Instance[bp name], 0] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1301 out <- [backend]Store Function[Fold[pop worker, func, [bp]Fields >>]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1302 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1303 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1304 Getters Setters[backend,field,type name:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1305 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1306 //TODO: Throw an exception or something if we read a field that is empty |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1307 name <- [field]Index[0] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1308 type <- [field]Index[1] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1309 mytype <- Type Instance[type name] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1310 start getter,getref <- [[[[backend]Create Function[ [[[name]Append[" >>"]]Append["@"]]Append[type name], ("obj"), ("out"), "rhope"] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1311 ]Set Input Type[mytype, 0] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1312 ]Set Output Type[[type]Set Variant["Boxed"], 0] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1313 ]Read Field["obj", name] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1314 If[[[type]Variant >>] = ["Boxed"]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1315 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1316 getter <- [[start getter]Do AddRef[getref, "out"]]Release["obj"] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1317 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1318 getter <- [[start getter]Box[getref, "out", type]]Release["obj"] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1319 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1320 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1321 begin setter <- [[[[[backend]Create Function[ [[[name]Append[" <<"]]Append["@"]]Append[type name], ("obj","newval"), ("out"), "rhope"] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1322 ]Set Input Type[mytype, 0] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1323 ]Set Input Type[[type]Set Variant["Boxed"], 1] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1324 ]Set Output Type[mytype, 0] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1325 ]Copy["obj"] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1326 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1327 If[[[type]Variant >>] = ["Boxed"]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1328 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1329 ,origref <- [begin setter]Read Field["obj", name] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1330 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1331 stream <- [[~]Instruction Stream |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1332 ]Release[origref] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1333 ,setref <- [[~]Do If[origref, stream] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1334 ]Write Field["obj", name] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1335 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1336 setter <- [[~]Move["newval", setref] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1337 ]Move["obj", "out"] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1338 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1339 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1340 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1341 ,setref <- [begin setter]Write Field["obj", name] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1342 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1343 setter <- [[[~]Unbox["newval", setref] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1344 ]Release["newval"] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1345 ]Move["obj", "out"] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1346 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1347 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1348 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1349 out <- [[backend]Store Function[getter]]Store Function[setter] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1350 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1351 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1352 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1353 Compile Blueprint@NBlueprint[bp,backend,name:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1354 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1355 //Rhope identifiers can't start with spaces, so we can use identifiers that start with spaces for special functions |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1356 init name <- [" init "]Append[name] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1357 copy name <- [" copy "]Append[name] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1358 cleanup name <- [" cleanup "]Append[name] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1359 type <- [[[Fold[_Compile Blueprint Methods[?], Fold[_Compile Blueprint Fields[?], [backend]Create Type[name], [bp]Fields >>], [bp]Methods >>] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1360 ]Init <<[init name] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1361 ]Copy <<[copy name] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1362 ]Cleanup <<[cleanup name] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1363 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1364 out <- [backend]Register Type[type] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1365 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1366 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1367 Compile Special@NBlueprint[bp,backend,name:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1368 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1369 init name <- [" init "]Append[name] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1370 copy name <- [" copy "]Append[name] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1371 cleanup name <- [" cleanup "]Append[name] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1372 got specials <- [bp]Make Special[ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1373 [bp]Make Special[ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1374 [bp]Make Special[backend, init name, name, Make Init[?]], |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1375 copy name, name, Make Copy[?]], |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1376 cleanup name, name, Make Cleanup[?]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1377 out <- Fold[Getters Setters[?, ?, name], got specials, [bp]Fields >>] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1378 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1379 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1380 Blueprint NProgram |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1381 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1382 Blueprints |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1383 Workers |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1384 Worker Refs |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1385 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1386 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1387 NProgram[:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1388 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1389 out <- [[[Build[NProgram()]]Blueprints <<[Dictionary[]]]Workers <<[Dictionary[]]]Worker Refs <<[Dictionary[]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1390 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1391 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1392 Bind Worker@NProgram[prog,name,worker:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1393 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1394 after bind <- [prog]Workers << [ [[prog]Workers >>]Set[name, [worker]Name <<[name]] ] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1395 parts <- [name]Split["@"] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1396 [parts]Index[1] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1397 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1398 orig bp <- [[after bind]Blueprints >>]Index[~] {} |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1399 { orig bp <- NBlueprint[] } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1400 out <- [after bind]Blueprints <<[ [[after bind]Blueprints >>]Set[~, [orig bp]Add Method[[parts]Index[0]] ] ] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1401 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1402 out <- Val[after bind] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1403 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1404 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1405 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1406 Bind Blueprint@NProgram[prog,name,blueprint:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1407 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1408 out <- [prog]Blueprints << [ [[prog]Blueprints >>]Set[name, blueprint] ] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1409 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1410 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1411 _Compile Program BP[backend, blueprint, name:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1412 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1413 out <- [blueprint]Compile Blueprint[backend, name] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1414 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1415 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1416 _Compile Program BP Special[backend, blueprint, name:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1417 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1418 out <- [blueprint]Compile Special[backend, name] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1419 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1420 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1421 _Compile Program[backend, worker, name:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1422 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1423 out <- [worker]Compile Worker[backend, name] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1424 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1425 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1426 Compile Program@NProgram[prog, backend:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1427 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1428 backend with bps <- Generate Boolean Methods[Generate Number Methods[Fold[_Compile Program BP Special[?], Fold[_Compile Program BP[?], backend, [prog]Blueprints >>], [prog]Blueprints >>]]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1429 workers with infer <- Map[[prog]Workers >>, Infer Types[?, prog]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1430 out <- Fold[_Compile Program[?], backend with bps, workers with infer] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1431 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1432 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1433 Register Method@NProgram[prog, name, convention, inputs, outputs: out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1434 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1435 [[prog]Worker Refs >>]Index[name] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1436 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1437 ref <- [[[[~]Inputs <<[ Max[[~]Inputs >>, inputs] ] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1438 ]Min Inputs <<[ Min[[~]Min Inputs >>, inputs] ] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1439 ]Outputs <<[ Max[[~]Outputs >>, outputs] ] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1440 ]Min Outputs <<[ Min[[~]Min Outputs >>, outputs] ] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1441 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1442 ref <- Worker Ref[name, convention, inputs, outputs, Yes] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1443 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1444 out <- [prog]Worker Refs <<[ [[prog]Worker Refs >>]Set[name, ref]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1445 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1446 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1447 Register Worker@NProgram[prog, name, convention, inputs, outputs: out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1448 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1449 [[prog]Worker Refs >>]Index[name] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1450 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1451 ref <- [[[[~]Inputs <<[ Max[[~]Inputs >>, inputs] ] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1452 ]Min Inputs <<[ Min[[~]Min Inputs >>, inputs] ] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1453 ]Outputs <<[ Max[[~]Outputs >>, outputs] ] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1454 ]Min Outputs <<[ Min[[~]Min Outputs >>, outputs] ] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1455 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1456 ref <- Worker Ref[name, convention, inputs, outputs, No] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1457 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1458 after reg <- [prog]Worker Refs <<[ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1459 [ [prog]Worker Refs >> ]Set[name, ref] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1460 ] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1461 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1462 parts <- [name]Split["@"] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1463 [parts]Index[1] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1464 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1465 out <- [after reg]Register Method@NProgram[[parts]Index[0], convention, inputs, outputs] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1466 }{ |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1467 out <- Val[after reg] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1468 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1469 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1470 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1471 Register Builtins@NProgram[prog:out] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1472 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1473 registered <- [[[[[[[[prog]Register Worker["Print", "rhope", 1, 1] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1474 ]Register Worker["If@Boolean", "rhope", 1, 2] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1475 ]Register Worker["Build", "rhope", 1, 1] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1476 ]Register Worker["Blueprint Of", "rhope", 1, 1] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1477 ]Register Worker["Call@Worker", "rhope", 1, 2] //We're using 2 because we need to assume that the outputs are conditional |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1478 ]Register Worker["ID", "rhope", 1, 1] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1479 ]Register Worker["Blueprint From ID", "rhope", 1, 2] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1480 ]Register Number Methods |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1481 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1482 out <- [[[[[[[registered]Bind Worker["If@Boolean", |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1483 [[[[[NWorker["rhope"] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1484 ]Inputs <<[("condition")] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1485 ]Input Types <<[ [()]Append[Type Instance["Boolean"]] ] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1486 ]Outputs <<[("isyes","isno")] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1487 ]Output Types <<[ [[()]Append[Type Instance["Boolean"]]]Append[Type Instance["Boolean"]] ] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1488 ]Builtin? <<[Yes]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1489 ]Bind Worker["Print", |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1490 [[[[[NWorker["rhope"] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1491 ]Inputs <<[("value")] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1492 ]Input Types <<[ [()]Append[Type Instance["Any Type"]] ] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1493 ]Outputs <<[("out")] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1494 ]Output Types <<[ [()]Append[Type Instance["Int32"]] ] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1495 ]Builtin? <<[Yes]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1496 ]Bind Worker["Build", |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1497 [[[[[NWorker["rhope"] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1498 ]Inputs <<[("type")] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1499 ]Input Types <<[ [()]Append[Type Instance["Blueprint"]] ] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1500 ]Outputs <<[("out")] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1501 ]Output Types <<[ [()]Append[Type Instance["Any Type"]] ] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1502 ]Builtin? <<[Yes]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1503 ]Bind Worker["Blueprint Of", |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1504 [[[[[NWorker["rhope"] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1505 ]Inputs <<[("object")] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1506 ]Input Types <<[ [()]Append[Type Instance["Any Type"]]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1507 ]Outputs <<[("type")] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1508 ]Output Types <<[ [()]Append[Type Instance["Blueprint"]]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1509 ]Builtin? <<[Yes]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1510 ]Bind Worker["Call@Worker", |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1511 [[[[[NWorker["rhope"] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1512 ]Inputs <<[("worker")] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1513 ]Input Types <<[ [()]Append[Type Instance["Worker"]] ] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1514 ]Outputs <<[("ret1","ret2")] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1515 ]Output Types <<[ [[()]Append[Type Instance["Any Type"]]]Append[Type Instance["Any Type"]] ] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1516 ]Builtin? << [Yes]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1517 ]Bind Worker["ID", |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1518 [[[[[NWorker["rhope"] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1519 ]Inputs <<[("bp")] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1520 ]Input Types <<[ [()]Append[Type Instance["Blueprint"]]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1521 ]Outputs <<[("id")] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1522 ]Output Types <<[ [()]Append[Type Instance["UInt32"]]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1523 ]Builtin? << [Yes]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1524 ]Bind Worker["Blueprint From ID", |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1525 [[[[[NWorker["rhope"] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1526 ]Inputs <<[("id")] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1527 ]Input Types <<[ [()]Append[Type Instance["UInt32"]]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1528 ]Outputs <<[("bp","none")] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1529 ]Output Types <<[ [[()]Append[Type Instance["Blueprint"]]]Append[Type Instance["Any Type"]]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1530 ]Builtin? << [Yes]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1531 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1532 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1533 Find Worker@NProgram[prog, name:out,notfound] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1534 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1535 out,notfound <- [[prog]Worker Refs >>]Index[name] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1536 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1537 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1538 Find Worker Def@NProgram[prog,name:out,notfound] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1539 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1540 out,notfound <- [[prog]Workers >>]Index[name] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1541 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1542 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1543 Find Method@NProgram[prog, name, type:out,notfound] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1544 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1545 bp,notfound <- [[prog]Blueprints >>]Index[[type]Name >>] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1546 ,notfound <- If[[bp]Understands Method[name]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1547 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1548 out <- [[prog]Workers >>]Index[[[name]Append["@"]]Append[[type]Name >>]] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1549 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1550 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1551 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1552 Find Field@NProgram[prog, name, type:fieldtype,notfound] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1553 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1554 bp,notfound <- [[prog]Blueprints >>]Index[[type]Name >>] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1555 fieldtype,notfound <- [bp]Get Field Type[name] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1556 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1557 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1558 Implicit Conversion@NProgram[prog, fromtype, totype:func,notfound] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1559 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1560 notfound <- No |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1561 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1562 |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1563 Is Method?@NProgram[prog,name:is,is not] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1564 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1565 ,is not <- [[prog]Worker Refs>>]Index[name] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1566 { |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1567 is,is not <- If[[~]Is Method? >>] |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1568 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1569 } |
2f6f0867fd68
Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1570 |