annotate modules/array.tp @ 245:3590ecca6bc9

Fix handling of unescaped tabs in string literals in new parser
author Mike Pavone <pavone@retrodev.com>
date Mon, 06 Jan 2014 01:03:18 -0800
parents abde5d2918cf
children fd9005253861
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
84
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1 #{
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
2 llProperty: size withType: uint32_t
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
3 llProperty: storage withType: uint32_t
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
4 llProperty: data withType: ((object ptr) ptr)
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
5 llMessage: get withVars: {
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
6 index <- obj_int32 ptr
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
7 } andCode: :index {
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
8 if: (index num) >= 0 && (index num) < size {
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
9 (self data) get: (index num)
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
10 } else: {
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
11 false
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
12 }
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
13 }
144
547153211389 Fix fold:with foldr:with and map in the array module
Mike Pavone <pavone@retrodev.com>
parents: 84
diff changeset
14
84
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
15 llMessage: set withVars: {
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
16 index <- obj_int32 ptr
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
17 value <- object ptr
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
18 } andCode: :index value {
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
19 if: (index num) >= 0 && (index num) < size {
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
20 data set: (index num) value
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
21 }
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
22 self
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
23 }
144
547153211389 Fix fold:with foldr:with and map in the array module
Mike Pavone <pavone@retrodev.com>
parents: 84
diff changeset
24
84
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
25 llMessage: foreach withVars: {
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
26 clos <- lambda ptr
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
27 i <- uint32_t
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
28 index <- obj_int32 ptr
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
29 } andCode: :clos {
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
30 i <- 0
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
31 while: { i < size } do: {
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
32 index <- make_object: (addr_of: obj_int32_meta) NULL 0
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
33 index num!: i
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
34 ccall: clos 2 index (data get: i)
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
35 i <- i + 1
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
36 }
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
37 self
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
38 }
144
547153211389 Fix fold:with foldr:with and map in the array module
Mike Pavone <pavone@retrodev.com>
parents: 84
diff changeset
39
84
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
40 llMessage: append withVars: {
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
41 value <- object ptr
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
42 tmp <- (object ptr) ptr
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
43 } andCode: :value {
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
44 if: storage = size {
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
45 storage <- storage * 2
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
46 tmp <- GC_REALLOC: data storage * (sizeof: (object ptr))
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
47 if: (not: tmp) {
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
48 fputs: "Failed to increase array size\n" stderr
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
49 exit: 1
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
50 }
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
51 data <- tmp
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
52 }
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
53 data set: size value
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
54 size <- size + 1
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
55 self
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
56 }
144
547153211389 Fix fold:with foldr:with and map in the array module
Mike Pavone <pavone@retrodev.com>
parents: 84
diff changeset
57
84
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
58 llMessage: length withVars: {
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
59 intret <- obj_int32 ptr
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
60 } andCode: {
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
61 intret <- make_object: (addr_of: obj_int32_meta) NULL 0
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
62 intret num!: size
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
63 intret
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
64 }
144
547153211389 Fix fold:with foldr:with and map in the array module
Mike Pavone <pavone@retrodev.com>
parents: 84
diff changeset
65
84
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
66 fold:with <- :acc :fun {
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
67 foreach: self :idx el {
144
547153211389 Fix fold:with foldr:with and map in the array module
Mike Pavone <pavone@retrodev.com>
parents: 84
diff changeset
68 acc <- fun: acc el
84
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
69 }
144
547153211389 Fix fold:with foldr:with and map in the array module
Mike Pavone <pavone@retrodev.com>
parents: 84
diff changeset
70 acc
84
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
71 }
144
547153211389 Fix fold:with foldr:with and map in the array module
Mike Pavone <pavone@retrodev.com>
parents: 84
diff changeset
72
84
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
73 foldr:with <- :acc :fun {
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
74 idx <- length - 1
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
75 while: {idx >= 0} do: {
144
547153211389 Fix fold:with foldr:with and map in the array module
Mike Pavone <pavone@retrodev.com>
parents: 84
diff changeset
76 acc <- fun: acc (get: idx)
84
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
77 }
144
547153211389 Fix fold:with foldr:with and map in the array module
Mike Pavone <pavone@retrodev.com>
parents: 84
diff changeset
78 acc
84
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
79 }
144
547153211389 Fix fold:with foldr:with and map in the array module
Mike Pavone <pavone@retrodev.com>
parents: 84
diff changeset
80
84
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
81 map <- :fun {
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
82 new <- #[]
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
83 foreach: self :idx el {
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
84 new append: (fun: el)
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
85 }
144
547153211389 Fix fold:with foldr:with and map in the array module
Mike Pavone <pavone@retrodev.com>
parents: 84
diff changeset
86 new
84
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
87 }
144
547153211389 Fix fold:with foldr:with and map in the array module
Mike Pavone <pavone@retrodev.com>
parents: 84
diff changeset
88
84
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
89 find:withDefault <- :pred :default{
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
90 idx <- 0
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
91 l <- length
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
92 ret <- default
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
93 while: {idx < l} do: {
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
94 v <- get: idx
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
95 if: (pred: v) {
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
96 ret <- #{
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
97 key <- idx
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
98 value <- v
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
99 }
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
100 idx <- l
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
101 }
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
102 }
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
103 ret
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
104 }
184
ca249978ae96 Add join method to array
Mike Pavone <pavone@retrodev.com>
parents: 144
diff changeset
105
ca249978ae96 Add join method to array
Mike Pavone <pavone@retrodev.com>
parents: 144
diff changeset
106 join <- :sep {
ca249978ae96 Add join method to array
Mike Pavone <pavone@retrodev.com>
parents: 144
diff changeset
107 if: length > 0 {
186
35d2cc193d99 Add string conversion inside array join so callers don't need to worry about doing string conversions themselves
Mike Pavone <pavone@retrodev.com>
parents: 184
diff changeset
108 str <- string: (get: 0)
184
ca249978ae96 Add join method to array
Mike Pavone <pavone@retrodev.com>
parents: 144
diff changeset
109 idx <- 1
ca249978ae96 Add join method to array
Mike Pavone <pavone@retrodev.com>
parents: 144
diff changeset
110 l <- length
ca249978ae96 Add join method to array
Mike Pavone <pavone@retrodev.com>
parents: 144
diff changeset
111 while: { idx < l } do: {
ca249978ae96 Add join method to array
Mike Pavone <pavone@retrodev.com>
parents: 144
diff changeset
112 str <- str . sep . (get: idx)
191
abde5d2918cf Fix infinite loop in array join
Mike Pavone <pavone@retrodev.com>
parents: 186
diff changeset
113 idx <- idx + 1
184
ca249978ae96 Add join method to array
Mike Pavone <pavone@retrodev.com>
parents: 144
diff changeset
114 }
ca249978ae96 Add join method to array
Mike Pavone <pavone@retrodev.com>
parents: 144
diff changeset
115 str
ca249978ae96 Add join method to array
Mike Pavone <pavone@retrodev.com>
parents: 144
diff changeset
116 } else: {
ca249978ae96 Add join method to array
Mike Pavone <pavone@retrodev.com>
parents: 144
diff changeset
117 ""
ca249978ae96 Add join method to array
Mike Pavone <pavone@retrodev.com>
parents: 144
diff changeset
118 }
ca249978ae96 Add join method to array
Mike Pavone <pavone@retrodev.com>
parents: 144
diff changeset
119 }
84
9811040704ac Add support for llMessage:withVars:andCode and llProperty:withType for specifying low level code without having to stick C inside the compiler. Redo array built-in type to use this feature.
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
120 }