git @ Cat's Eye Technologies SixtyPical / d24e9fa
I can no longer see a reason to require that it is a power of two. Chris Pressey 3 years ago
3 changed file(s) with 7 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
2424
2525 There are also three *type constructors*:
2626
27 * T table[N] (N is a power of 2, 1 ≤ N ≤ 256; each entry holds a value
27 * T table[N] (N entries, 1 ≤ N ≤ 256; each entry holds a value
2828 of type T, where T is `byte`, `word`, or `vector`)
2929 * buffer[N] (N entries; each entry is a byte; 1 ≤ N ≤ 65536)
3030 * vector T (address of a value of type T; T must be a routine type)
145145
146146 if self.scanner.consume('table'):
147147 size = self.defn_size()
148 if size not in (1, 2, 4, 8, 16, 32, 64, 129, 256):
148 if size <= 0 or size > 256:
149149 raise SyntaxError("Table size must be a power of two, 0 < size <= 256")
150150 type_ = TableType(type_, size)
151151
152152 | }
153153 = ok
154154
155 The number of entries in a table must be a power of two
156 which is greater than 0 and less than or equal to 256.
155 The number of entries in a table must be
156 greater than 0 and less than or equal to 256.
157157
158158 | word table[512] many
159159 |
167167 | }
168168 ? SyntaxError
169169
170 | word table[48] many
170 | word table[0] many
171171 |
172172 | routine main
173173 | inputs many
179179 | }
180180 ? SyntaxError
181181
182 | word table[0] many
182 | word table[48] many
183183 |
184184 | routine main
185185 | inputs many
189189 | ld x, 0
190190 | copy 9999, many + x
191191 | }
192 ? SyntaxError
192 = ok
193193
194194 Typedefs of different types.
195195