annotate array.rhope @ 189:d0e3a13c1bd9 default tip

Remove old calculator example
author Mike Pavone <pavone@retrodev.com>
date Fri, 07 Oct 2011 00:24:04 -0700
parents d2b941f82d74
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
2 Blueprint Array
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
3 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
4 Eltype(Blueprint)
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
5 Length(Int32,Naked)
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
6 Storage(Int32,Naked)
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
7 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
8
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
9 Blueprint Boxed Array
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 Length(Int32,Naked)
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
12 Storage(Int32,Naked)
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
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
15 Blueprint Empty Array
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 }
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 Foreign C:runtime
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 _internal_array_copyout[array(Array), index(Int32,Naked), dest(Any Type,Boxed,Mutable):dest]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
22 _internal_array_copyin[array(Array,Boxed,Mutable), index(Int32,Naked), val:array]
105
43cc42df26cc Various compiler improvements
Mike Pavone <pavone@retrodev.com>
parents: 102
diff changeset
23 _internal_array_copychunk[source(Array), sindex(Int32,Naked), dest(Array,Boxed,Mutable), dindex(Int32,Naked), len(Int32,Naked):dest]
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
24 _internal_array_getboxed[array(Boxed Array), index(Int32,Naked):out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
25 _internal_array_setboxed[array(Boxed Array,Boxed,Mutable), index(Int32,Naked), val:array]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
26 _internal_array_allocboxed[size(Int32,Naked):out(Boxed Array)]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
27 _internal_array_allocboxedcopy[source(Boxed Array),size(Int32,Naked):out(Boxed Array)]
168
d2b941f82d74 Fix type of list constants in inference pass and return type of some Array related workers
Mike Pavone <pavone@retrodev.com>
parents: 144
diff changeset
28 _internal_array_allocnaked[size(Int32,Naked),type(Blueprint):out]
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
29 _internal_array_allocnakedcopy[source(Array),size(Int32,Naked):out(Array)]
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
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
32 Array[:out(Empty Array)]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
33 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
34 out <- Build[Empty Array()]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
35 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
36
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
37 First@Empty Array[array:out,empty]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
38 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
39 empty <- array
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
40 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
41
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
42 First@Array[array:out(Int32),empty]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
43 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
44 ,empty <- If[[array]Length >>]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
45 { out <- 0 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
46 }
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 First@Boxed Array[array:out(Int32),empty]
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 ,empty <- If[[array]Length >>]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
51 { out <- 0 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
52 }
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 Next@Empty Array[array:out,empty]
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 empty <- array
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
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
59 Next@Array[array,current:out(Int32),empty]
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 next <- [current]+[1]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
62 ,empty <- If[[next] < [[array]Length >>]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
63 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
64 out <- Val[next]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
65 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
66 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
67
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
68 Next@Boxed Array[array,current:out(Int32),empty]
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 next <- [current]+[1]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
71 ,empty <- If[[next] < [[array]Length >>]]
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 out <- Val[next]
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 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
76
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
77 Last@Empty Array[array:out,empty]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
78 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
79 empty <- array
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
80 }
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 Last@Array[array:out(Int32),empty]
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 <- If[[array]Length >>]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
85 { out <- [[array]Length >>] - [1] }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
86 }
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 Last@Boxed Array[array:out(Int32),empty]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
89 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
90 ,empty <- If[[array]Length >>]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
91 { out <- [[array]Length >>] - [1] }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
92 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
93
168
d2b941f82d74 Fix type of list constants in inference pass and return type of some Array related workers
Mike Pavone <pavone@retrodev.com>
parents: 144
diff changeset
94 Append@Empty Array[array,newval:out]
102
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 out <- [array]Set[0, newval]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
97 }
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 Append@Array[array,newval:out]
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 out <- [array]Set[[array]Length >>, newval]
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
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
104 Append@Boxed Array[array,newval:out(Boxed Array)]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
105 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
106 out <- [array]Set[[array]Length >>, newval]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
107 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
108
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
109 Index@Empty Array[array:out,notfound]
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 notfound <- array
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
112 }
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 Index@Array[array,index(Int32):out,notfound]
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 ,notfound <- If[[index] >= [0]]
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 ,notfound <- If[[index] < [[array]Length >>]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
119 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
120 out <- _internal_array_copyout[array, index, Build[[array]Eltype >>]]
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
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
125 Index@Boxed Array[array,index(Int32):out,notfound]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
126 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
127 ,notfound <- If[[index] >= [0]]
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 ,notfound <- If[[index] < [[array]Length >>]]
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 out <- _internal_array_getboxed[array, index]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
132 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
133 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
134 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
135
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
136 _Copy to Boxed[source,dest,current:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
137 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
138 ndest <- _internal_array_setboxed[dest, current, [source]Index[current]]
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 [source]Next[current]
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 <- _Copy to Boxed[source, ndest, ~]
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 out <- Val[ndest]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
145 }
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
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
148 _Copy Naked[source,dest,current:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
149 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
150 ndest <- _internal_array_copyin[dest, current, [source]Index[current]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
151
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
152 [source]Next[current]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
153 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
154 out <- _Copy Naked[source, ndest, ~]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
155 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
156 out <- Val[ndest]
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 }
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 Set@Array[array,index(Int32),val:out,invalid]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
161 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
162 invalid <- If[[index]<[0]] {}
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 len <- [array]Length >>
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
165 If[[index]>[len]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
166 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
167 out <- [[array]Set[[index]-[1],val]]Set[index, val]
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 If[[Blueprint Of[val]]=[[array]Eltype >>]]
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 If[[index]<[[array]Storage >>]]
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 <- [_internal_array_copyin[array, index, val]]Length <<[Max[len, [index]+[1]]]
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 //Does this make sense given the copies we may have to make?
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
176 If[[index] < [4]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
177 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
178 new storage <- [index]+[index]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
179 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
180 new storage <- [index]+[[index]RShift[1]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
181 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
182 out <- [_internal_array_copyin[_internal_array_allocnakedcopy[array, new storage], index, val]]Length <<[[index]+[1]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
183 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
184 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
185 out <-[[_Copy to Boxed[array, _internal_array_allocboxed[[array]Storage >>], [array]First]]Length <<[[array]Length >>]]Set[index, val]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
186 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
187 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
188 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
189 }
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 Set@Boxed Array[array,index(Int32),val:out(Boxed Array),invalid]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
192 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
193 invalid <- If[[index]<[0]] {}
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
194 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
195 len <- [array]Length >>
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
196 If[[index]>[len]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
197 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
198 out <- [[array]Set[[index]-[1],val]]Set[index, val]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
199 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
200 If[[index]<[[array]Storage >>]]
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 out <- [_internal_array_setboxed[array, index, val]]Length <<[Max[len, [index]+[1]]]
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 //Does this make sense given the copies we may have to make?
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
205 If[[index] < [4]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
206 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
207 new storage <- [index]+[index]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
208 }{
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
209 new storage <- [index]+[[index]RShift[1]]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
210 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
211 out <- [_internal_array_setboxed[_internal_array_allocboxedcopy[array, new storage], index, val]]Length <<[[index]+[1]]
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 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
216
168
d2b941f82d74 Fix type of list constants in inference pass and return type of some Array related workers
Mike Pavone <pavone@retrodev.com>
parents: 144
diff changeset
217 Set@Empty Array[array,index(Int32),val:out,invalid]
102
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 invalid <- If[[index]<[0]] {}
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 out <- [_internal_array_allocnaked[1, Blueprint Of[val]]]Set[index, val]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
222 }
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
144
65ebd1ce2611 Add Read method to TCP connection
Mike Pavone <pavone@retrodev.com>
parents: 105
diff changeset
225 Slice@Array[array,slicepoint:left,right]
65ebd1ce2611 Add Read method to TCP connection
Mike Pavone <pavone@retrodev.com>
parents: 105
diff changeset
226 {
65ebd1ce2611 Add Read method to TCP connection
Mike Pavone <pavone@retrodev.com>
parents: 105
diff changeset
227 If[[slicepoint]<=[0]]
65ebd1ce2611 Add Read method to TCP connection
Mike Pavone <pavone@retrodev.com>
parents: 105
diff changeset
228 {
65ebd1ce2611 Add Read method to TCP connection
Mike Pavone <pavone@retrodev.com>
parents: 105
diff changeset
229 left <- Array[]
65ebd1ce2611 Add Read method to TCP connection
Mike Pavone <pavone@retrodev.com>
parents: 105
diff changeset
230 right <- array
65ebd1ce2611 Add Read method to TCP connection
Mike Pavone <pavone@retrodev.com>
parents: 105
diff changeset
231 }{
65ebd1ce2611 Add Read method to TCP connection
Mike Pavone <pavone@retrodev.com>
parents: 105
diff changeset
232 arrlen <- [array]Length >>
65ebd1ce2611 Add Read method to TCP connection
Mike Pavone <pavone@retrodev.com>
parents: 105
diff changeset
233 If[[slicepoint]>=[arrlen]]
65ebd1ce2611 Add Read method to TCP connection
Mike Pavone <pavone@retrodev.com>
parents: 105
diff changeset
234 {
65ebd1ce2611 Add Read method to TCP connection
Mike Pavone <pavone@retrodev.com>
parents: 105
diff changeset
235 left <- array
65ebd1ce2611 Add Read method to TCP connection
Mike Pavone <pavone@retrodev.com>
parents: 105
diff changeset
236 right <- Array[]
65ebd1ce2611 Add Read method to TCP connection
Mike Pavone <pavone@retrodev.com>
parents: 105
diff changeset
237 }{
65ebd1ce2611 Add Read method to TCP connection
Mike Pavone <pavone@retrodev.com>
parents: 105
diff changeset
238 left <- [_internal_array_copychunk[array, 0, _internal_array_allocnaked[slicepoint,[array]Eltype >>], 0, slicepoint]]Length <<[slicepoint]
65ebd1ce2611 Add Read method to TCP connection
Mike Pavone <pavone@retrodev.com>
parents: 105
diff changeset
239 rightlen <- [arrlen]-[slicepoint]
65ebd1ce2611 Add Read method to TCP connection
Mike Pavone <pavone@retrodev.com>
parents: 105
diff changeset
240 right <- [_internal_array_copychunk[array, slicepoint, _internal_array_allocnaked[rightlen,[array]Eltype >>], 0, rightlen]]Length <<[rightlen]
65ebd1ce2611 Add Read method to TCP connection
Mike Pavone <pavone@retrodev.com>
parents: 105
diff changeset
241 }
65ebd1ce2611 Add Read method to TCP connection
Mike Pavone <pavone@retrodev.com>
parents: 105
diff changeset
242 }
65ebd1ce2611 Add Read method to TCP connection
Mike Pavone <pavone@retrodev.com>
parents: 105
diff changeset
243 }
65ebd1ce2611 Add Read method to TCP connection
Mike Pavone <pavone@retrodev.com>
parents: 105
diff changeset
244
65ebd1ce2611 Add Read method to TCP connection
Mike Pavone <pavone@retrodev.com>
parents: 105
diff changeset
245 Slice@Empty Array[array,slicepoint:left,right]
65ebd1ce2611 Add Read method to TCP connection
Mike Pavone <pavone@retrodev.com>
parents: 105
diff changeset
246 {
65ebd1ce2611 Add Read method to TCP connection
Mike Pavone <pavone@retrodev.com>
parents: 105
diff changeset
247 left <- array
65ebd1ce2611 Add Read method to TCP connection
Mike Pavone <pavone@retrodev.com>
parents: 105
diff changeset
248 right <- array
65ebd1ce2611 Add Read method to TCP connection
Mike Pavone <pavone@retrodev.com>
parents: 105
diff changeset
249 }
65ebd1ce2611 Add Read method to TCP connection
Mike Pavone <pavone@retrodev.com>
parents: 105
diff changeset
250
102
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
251 Length@Empty Array[arr:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
252 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
253 out <- 0
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 Length@Array[arr: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 <- [arr]Length >>
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
259 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
260
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
261 Length@Boxed Array[arr:out]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
262 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
263 out <- [arr]Length >>
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
264 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
265
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
266 Call@Array[arr,index(Int32):out,not found]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
267 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
268 out,not found <- [arr]Index[index]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
269 }
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 Call@Boxed Array[arr,index(Int32):out,not found]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
272 {
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
273 out,not found <- [arr]Index[index]
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
274 }
2f6f0867fd68 Added files I forgot to add in a previous commit
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
275