substrate-lang 0.9.3 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (208) hide show
  1. package/README.md +1 -1
  2. package/build/compiler/binary.2d43b43d1600@0+0.wasm +0 -0
  3. package/build/compiler/checker.4dd4556dd421@0+0.wasm +0 -0
  4. package/build/compiler/compile.5d8f6407af2a@0+0.wasm +0 -0
  5. package/build/compiler/{core.fc3dab9d1846@0+0.wasm → core.f2defb75e00b@0+0.wasm} +0 -0
  6. package/build/compiler/expander.967ce443d379@0+0.wasm +0 -0
  7. package/build/compiler/fs.01b8aab4a9a8@0+0.wasm +0 -0
  8. package/build/compiler/{leb128.748b1c37277a@0+0.wasm → leb128.15d814b7b4f2@0+0.wasm} +0 -0
  9. package/build/compiler/{link.11b643d35670@0+0.wasm → link.b826ea7c8f17@0+0.wasm} +0 -0
  10. package/build/compiler/{macros.4083601c00db@0+0.wasm → macros.b269e0c42784@0+0.wasm} +0 -0
  11. package/build/compiler/{main.ed62cce43000@0+0.wasm → main.4fc52f204d54@0+0.wasm} +0 -0
  12. package/build/compiler/{ops.b361e858d8e1@0+0.wasm → ops.515b5e05f646@0+0.wasm} +0 -0
  13. package/build/compiler/{path.dcc4712bcc7b@0+0.wasm → path.5a6286472cd4@0+0.wasm} +0 -0
  14. package/build/compiler/program +21 -21
  15. package/build/compiler/prune.406215c3e4f8@0+0.wasm +0 -0
  16. package/build/compiler/reader.694b03770bf0@0+0.wasm +0 -0
  17. package/build/compiler/roots.cefd10e93684@0+0.wasm +0 -0
  18. package/build/compiler/{running.d73f7826cb74@0+0.wasm → running.0d25dbaec018@0+0.wasm} +0 -0
  19. package/build/compiler/serialize.b0d82f3d63d2@0+0.wasm +0 -0
  20. package/build/compiler/{sha256.5fc9d60f8bb2@0+0.wasm → sha256.a6c32b04d799@0+0.wasm} +0 -0
  21. package/build/compiler/substrate.5ee5d0b4d3e7@0+0.wasm +0 -0
  22. package/build/compiler/syntax.32f3e40b61c7@0+0.wasm +0 -0
  23. package/build/compiler/{writer.806bc85aa684@0+0.wasm → writer.00b7802cbe39@0+0.wasm} +0 -0
  24. package/build/sub/{base64.8fba03e1be0a@0+0.wasm → base64.a26bdcf60a2d@0+0.wasm} +0 -0
  25. package/build/sub/build.459c5b9412bd@0+0.wasm +0 -0
  26. package/build/sub/chromium.3d5818f2707d@0+0.wasm +0 -0
  27. package/build/sub/common.1edc613607a0@0+0.wasm +0 -0
  28. package/build/sub/deflate.23f7c4679260@0+0.wasm +0 -0
  29. package/build/sub/doc.0775df5de6fe@0+0.wasm +0 -0
  30. package/build/sub/{doc.566f9861828e@0+0.wasm → doc.ef9965d5d402@0+0.wasm} +0 -0
  31. package/build/sub/env.e5451da6e747@0+0.wasm +0 -0
  32. package/build/sub/events.bf5473ebf220@0+0.wasm +0 -0
  33. package/build/sub/fetch.7790d4943758@0+0.wasm +0 -0
  34. package/build/sub/fetch.96b2d10f025e@0+0.wasm +0 -0
  35. package/build/sub/files.ad0469fdf6fa@0+0.wasm +0 -0
  36. package/build/sub/fs.01b8aab4a9a8@0+0.wasm +0 -0
  37. package/build/sub/git.dc4c0e757ebe@0+0.wasm +0 -0
  38. package/build/sub/grants.c54776c0d7e3@0+0.wasm +0 -0
  39. package/build/sub/gzip.16e372eda1cf@0+0.wasm +0 -0
  40. package/build/sub/hash.660682e4f491@0+0.wasm +0 -0
  41. package/build/sub/{html.20baa1dc7ca6@0+0.wasm → html.a23126eb949a@0+0.wasm} +0 -0
  42. package/build/sub/{html.c1671a102b4d@0+0.wasm → html.e9ed37f34977@0+0.wasm} +0 -0
  43. package/build/sub/{inflate.8899e0933792@0+0.wasm → inflate.59bb61f14001@0+0.wasm} +0 -0
  44. package/build/sub/json.55590d2f518a@0+0.wasm +0 -0
  45. package/build/sub/manifest.ef317480deb0@0+0.wasm +0 -0
  46. package/build/sub/map.f455cca6a42a@0+0.wasm +0 -0
  47. package/build/sub/pack.e02836264f6a@0+0.wasm +0 -0
  48. package/build/sub/{path.dcc4712bcc7b@0+0.wasm → path.5a6286472cd4@0+0.wasm} +0 -0
  49. package/build/sub/path.6891ffea73ca@0+0.wasm +0 -0
  50. package/build/sub/process.7106571fa723@0+0.wasm +0 -0
  51. package/build/sub/program +48 -48
  52. package/build/sub/read.0b93933d62a2@0+0.wasm +0 -0
  53. package/build/sub/{reader.b535e61f99f4@0+0.wasm → reader.694b03770bf0@0+0.wasm} +0 -0
  54. package/build/sub/{root.9b713ec588c1@0+0.wasm → root.f10a4906f460@0+0.wasm} +0 -0
  55. package/build/sub/{roots.6d2942578055@0+0.wasm → roots.cefd10e93684@0+0.wasm} +0 -0
  56. package/build/sub/{sha256.5fc9d60f8bb2@0+0.wasm → sha256.a6c32b04d799@0+0.wasm} +0 -0
  57. package/build/sub/{sha512.b988b9dc6114@0+0.wasm → sha512.c24a792d7891@0+0.wasm} +0 -0
  58. package/build/sub/site.1732b58ec0e8@0+0.wasm +0 -0
  59. package/build/sub/site.ae3913b0b0f4@0+0.wasm +0 -0
  60. package/build/sub/store.a24d7a25daa6@0+0.wasm +0 -0
  61. package/build/sub/stream.126e3bd5d626@0+0.wasm +0 -0
  62. package/build/sub/sub.2e3092140706@0+0.wasm +0 -0
  63. package/build/sub/substrate.5ee5d0b4d3e7@0+0.wasm +0 -0
  64. package/build/sub/{syntax.9857f6784d63@0+0.wasm → syntax.32f3e40b61c7@0+0.wasm} +0 -0
  65. package/build/sub/tar.2a633861e654@0+0.wasm +0 -0
  66. package/build/sub/test.9bd59c73f65e@0+0.wasm +0 -0
  67. package/build/sub/{text.4ab70ac35b5a@0+0.wasm → text.1bc90482bd43@0+0.wasm} +0 -0
  68. package/build/sub/{timer.3809bb17a7a1@0+0.wasm → timer.f35eb62ae446@0+0.wasm} +0 -0
  69. package/build/sub/upgrade.39ee449b00d5@0+0.wasm +0 -0
  70. package/build/sub/{utf8.524c475ecd40@0+0.wasm → utf8.e7216bd054e1@0+0.wasm} +0 -0
  71. package/build/sub/worker.762a9d642af0@0+0.wasm +0 -0
  72. package/build/sub/writer.00b7802cbe39@0+0.wasm +0 -0
  73. package/package.json +1 -1
  74. package/std/archive/tar.sub +44 -44
  75. package/std/browser/chromium.sub +5 -4
  76. package/std/browser/devtools.sub +24 -19
  77. package/std/compress/deflate.sub +10 -12
  78. package/std/compress/gzip.sub +18 -16
  79. package/std/compress/inflate.sub +7 -4
  80. package/std/crypto/password.sub +3 -3
  81. package/std/doc/doc.sub +2 -2
  82. package/std/encoding/json.sub +64 -73
  83. package/std/encoding/wire.sub +15 -15
  84. package/std/http/checks.sub +3 -3
  85. package/std/http/conditional.sub +2 -4
  86. package/std/http/cookie.sub +5 -7
  87. package/std/http/form.sub +9 -12
  88. package/std/http/http.sub +17 -24
  89. package/std/http/multipart.sub +13 -15
  90. package/std/http/route.sub +18 -13
  91. package/std/http/server.sub +21 -23
  92. package/std/http/session.sub +3 -6
  93. package/std/http/sse-client.sub +9 -14
  94. package/std/http/static.sub +5 -5
  95. package/std/http/url.sub +10 -10
  96. package/std/http/websocket.sub +2 -5
  97. package/std/meta/derive.sub +0 -2
  98. package/std/meta/method.sub +41 -0
  99. package/std/meta/type-info.sub +30 -37
  100. package/std/package/files.sub +24 -25
  101. package/std/package/git.sub +26 -33
  102. package/std/package/hash.sub +9 -9
  103. package/std/package/manifest.sub +81 -57
  104. package/std/package/map.sub +5 -9
  105. package/std/package/pack.sub +13 -13
  106. package/std/package/path.sub +1 -4
  107. package/std/package/read.sub +10 -14
  108. package/std/package/site.sub +11 -11
  109. package/std/package/store.sub +16 -12
  110. package/std/package.sub +6 -6
  111. package/std/test/browser.sub +9 -8
  112. package/std/test/build.sub +2 -2
  113. package/std/test/compare.sub +9 -10
  114. package/std/test/page.sub +32 -27
  115. package/std/test/run.sub +9 -8
  116. package/std/test/test.sub +36 -30
  117. package/std/vector/vector.sub +75 -0
  118. package/substrate/VERSION +1 -1
  119. package/substrate/compiler/binary.sub +5 -14
  120. package/substrate/compiler/checker.sub +235 -222
  121. package/substrate/compiler/compile.sub +11 -11
  122. package/substrate/compiler/expander.sub +52 -78
  123. package/substrate/compiler/link.sub +2 -2
  124. package/substrate/compiler/main.sub +9 -9
  125. package/substrate/compiler/ops.sub +1 -1
  126. package/substrate/compiler/prune.sub +12 -17
  127. package/substrate/compiler/reader.sub +4 -4
  128. package/substrate/compiler/roots.sub +11 -10
  129. package/substrate/compiler/running.sub +1 -1
  130. package/substrate/compiler/serialize.sub +57 -50
  131. package/substrate/compiler/substrate.sub +60 -23
  132. package/substrate/compiler/syntax.sub +8 -21
  133. package/substrate/host/errors.mjs +3 -2
  134. package/substrate/host/events.sub +3 -16
  135. package/substrate/host/fs.mjs +5 -4
  136. package/substrate/host/fs.sub +142 -112
  137. package/substrate/host/grants.mjs +1 -1
  138. package/substrate/host/grants.sub +33 -33
  139. package/substrate/host/modules/fake.mjs +1 -1
  140. package/substrate/host/modules/websocket.mjs +4 -4
  141. package/substrate/host/modules/websocket.sub +8 -6
  142. package/substrate/host/node/env.mjs +12 -6
  143. package/substrate/host/node/env.sub +21 -16
  144. package/substrate/host/node/fs.mjs +1 -1
  145. package/substrate/host/node/net.mjs +2 -2
  146. package/substrate/host/node/net.sub +13 -6
  147. package/substrate/host/node/process.mjs +4 -4
  148. package/substrate/host/node/process.sub +28 -28
  149. package/substrate/host/node/signal.mjs +3 -2
  150. package/substrate/host/node/signal.sub +9 -6
  151. package/substrate/host/node/watch.mjs +1 -1
  152. package/substrate/host/node/watch.sub +11 -9
  153. package/substrate/host/stream.sub +2 -0
  154. package/substrate/host/subhost-core.mjs +9 -1
  155. package/substrate/host/web/clipboard.mjs +2 -2
  156. package/substrate/host/web/clipboard.sub +10 -3
  157. package/substrate/host/web/files.mjs +2 -2
  158. package/substrate/host/web/files.sub +6 -2
  159. package/substrate/host/web/fs.mjs +3 -3
  160. package/substrate/host/web/location.mjs +3 -1
  161. package/substrate/host/web/location.sub +8 -4
  162. package/substrate/host/worker-side.mjs +3 -1
  163. package/substrate/host/worker.mjs +6 -5
  164. package/substrate/host/worker.sub +10 -10
  165. package/build/compiler/binary.3823f89ce414@0+0.wasm +0 -0
  166. package/build/compiler/checker.592d37dcbec9@0+0.wasm +0 -0
  167. package/build/compiler/compile.86a2b03b0c9b@0+0.wasm +0 -0
  168. package/build/compiler/expander.689d326e5a1b@0+0.wasm +0 -0
  169. package/build/compiler/fs.563034be70c3@0+0.wasm +0 -0
  170. package/build/compiler/prune.d4a3f9834095@0+0.wasm +0 -0
  171. package/build/compiler/reader.b535e61f99f4@0+0.wasm +0 -0
  172. package/build/compiler/roots.6d2942578055@0+0.wasm +0 -0
  173. package/build/compiler/serialize.b2196de75bc8@0+0.wasm +0 -0
  174. package/build/compiler/substrate.4c780d6dd6d4@0+0.wasm +0 -0
  175. package/build/compiler/syntax.9857f6784d63@0+0.wasm +0 -0
  176. package/build/sub/build.84ac996eda63@0+0.wasm +0 -0
  177. package/build/sub/chromium.e4db7d29897c@0+0.wasm +0 -0
  178. package/build/sub/common.91ddee6b7a67@0+0.wasm +0 -0
  179. package/build/sub/deflate.fc8075e3aed1@0+0.wasm +0 -0
  180. package/build/sub/doc.0b48bbac404b@0+0.wasm +0 -0
  181. package/build/sub/env.f051f8166526@0+0.wasm +0 -0
  182. package/build/sub/events.f952172735e0@0+0.wasm +0 -0
  183. package/build/sub/fetch.097f1cc9502d@0+0.wasm +0 -0
  184. package/build/sub/fetch.5d2f427c995e@0+0.wasm +0 -0
  185. package/build/sub/files.30e55182c5df@0+0.wasm +0 -0
  186. package/build/sub/fs.563034be70c3@0+0.wasm +0 -0
  187. package/build/sub/git.48aefa1644be@0+0.wasm +0 -0
  188. package/build/sub/grants.5bf25700d47c@0+0.wasm +0 -0
  189. package/build/sub/gzip.69588e97c35a@0+0.wasm +0 -0
  190. package/build/sub/hash.3f0d118da63f@0+0.wasm +0 -0
  191. package/build/sub/json.f15a29d99d8d@0+0.wasm +0 -0
  192. package/build/sub/manifest.cf7471880377@0+0.wasm +0 -0
  193. package/build/sub/map.dc516eec27ff@0+0.wasm +0 -0
  194. package/build/sub/pack.55992e8cc09c@0+0.wasm +0 -0
  195. package/build/sub/path.b7a8e1cf3aaa@0+0.wasm +0 -0
  196. package/build/sub/process.aea2c88cb7a0@0+0.wasm +0 -0
  197. package/build/sub/read.cd1e693f4fb4@0+0.wasm +0 -0
  198. package/build/sub/site.7c6d8c7747af@0+0.wasm +0 -0
  199. package/build/sub/site.81548474c323@0+0.wasm +0 -0
  200. package/build/sub/store.d4e845ff24ac@0+0.wasm +0 -0
  201. package/build/sub/stream.4c07247477f7@0+0.wasm +0 -0
  202. package/build/sub/sub.b57e17b6876b@0+0.wasm +0 -0
  203. package/build/sub/substrate.4c780d6dd6d4@0+0.wasm +0 -0
  204. package/build/sub/tar.e482cf873cfc@0+0.wasm +0 -0
  205. package/build/sub/test.0d9c079bb309@0+0.wasm +0 -0
  206. package/build/sub/upgrade.18a5aa0dae89@0+0.wasm +0 -0
  207. package/build/sub/worker.f1190de21b21@0+0.wasm +0 -0
  208. package/build/sub/writer.806bc85aa684@0+0.wasm +0 -0
@@ -23,8 +23,7 @@
23
23
  (begin
24
24
  (for ([i u32 0]) (< i n) (+= i 1) (diff-line! b 1 (@ xs i)))
25
25
  (for ([j u32 0]) (< j m) (+= j 1) (diff-line! b 2 (@ ys j))))
26
- (let ([t (cast (ptr u32) (calloc (* (+ n 1) (+ m 1)) 4))] [w (+ m 1)]
27
- [kinds (cast (ptr u8) (malloc (+ n m)))] [texts (cast (ptr string) (malloc (* (+ n m) (sizeof string))))]
26
+ (let ([t (new 0 u32 (* (+ n 1) (+ m 1)))] [w (+ m 1)] [kinds (new 0 u8 (+ n m))] [texts (new 0 string (+ n m))]
28
27
  [k u32 0] [i u32 0] [j u32 0] [skipped #f])
29
28
  (for ([a u32 n]) (> a 0) (-= a 1)
30
29
  (for ([c u32 m]) (> c 0) (-= c 1)
@@ -55,13 +54,13 @@
55
54
  (set! skipped #f)
56
55
  (diff-line! b (@ kinds p) (@ texts p)))
57
56
  (set! skipped #t)))
58
- (free (cast (ptr u8) t))
59
- (free kinds)
60
- (free (cast (ptr u8) texts))))
61
- (free (cast (ptr u8) (-> xs items)))
62
- (free (cast (ptr u8) (-> ys items)))))
57
+ (free (-> t items))
58
+ (free (-> kinds items))
59
+ (free (-> texts items))))
60
+ (free (-> xs items))
61
+ (free (-> ys items))))
63
62
 
64
- (define (changed-near? [kinds (ptr u8)] [k u32] [p u32]) -> bool
63
+ (define (changed-near? [kinds (slice u8)] [k u32] [p u32]) -> bool
65
64
  (for ([q u32 (if (> p 2) (- p 2) 0)]) (and (< q k) (<= q (+ p 2))) (+= q 1)
66
65
  (when (!= (@ kinds q) 0) (return #t)))
67
66
  #f)
@@ -75,11 +74,11 @@
75
74
  (let ([n u32 0] [start u32 0] [k u32 0])
76
75
  (for ([i u32 0]) (< i (-> text length)) (+= i 1) (when (== (@ text i) 10) (+= n 1)))
77
76
  (when (and (> (-> text length) 0) (!= (@ text (- (-> text length) 1)) 10)) (+= n 1))
78
- (let ([out (cast (ptr string) (malloc (* (+ n 1) (sizeof string))))])
77
+ (let ([out (new 0 string (+ n 1))])
79
78
  (for ([i u32 0]) (<= i (-> text length)) (+= i 1)
80
79
  (when (or (== i (-> text length)) (== (@ text i) 10))
81
80
  (when (or (< start i) (< i (-> text length)))
82
81
  (set! (@ out k) (slice text start i))
83
82
  (+= k 1))
84
83
  (set! start (+ i 1))))
85
- (slice out k))))
84
+ (slice out 0 k))))
package/std/test/page.sub CHANGED
@@ -62,12 +62,14 @@
62
62
 
63
63
  ;; ---- opening and closing ----
64
64
 
65
- (define (page-open [dir string] [url string] [address string] [server (fn ())] [err (ptr string)]) -> (ptr page)
66
- (let ([b (ptr page) 0])
67
- (try (set! b (opened! dir url address server))
68
- [catch page-failed (why) (set! (@ err) why)])
65
+ (define (page-open [dir string] [url string] [address string] [server (fn ())] [b (ptr (ptr page))] [err (ptr error)])
66
+ -> bool
67
+ (let ([ok #t])
68
+ (set! (@ b) 0)
69
+ (try (set! (@ b) (opened! dir url address server))
70
+ [catch page-failed (why) (set! ok (error-fail! err error-other why))])
69
71
  (arena-free (& work))
70
- b))
72
+ ok))
71
73
 
72
74
  (define (page-close [b (ptr page)])
73
75
  (closed! b)
@@ -75,10 +77,10 @@
75
77
 
76
78
  (define (opened! [dir string] [url string] [address string] [server (fn ())]) -> (ptr page)
77
79
  (unless connected
78
- (let ([why string])
79
- (unless (devtools-connect (& connection) address heard 0 (& why)) (throw page-failed why))
80
+ (let ([why error])
81
+ (unless (devtools-connect (& connection) address heard 0 (& why)) (throw page-failed (error-text (& why))))
80
82
  (set! connected #t)))
81
- (let ([b (cast (ptr page) (calloc 1 (sizeof page)))])
83
+ (let ([b (new 0 page)])
82
84
  (+= opened 1)
83
85
  (set! (-> b site) (kept (absolute dir)))
84
86
  (buffer-add-u32! (& pages) (cast u32 b))
@@ -134,7 +136,7 @@
134
136
  (loaded! b "Page.navigate" (params-text (& p)))))
135
137
 
136
138
  (define (closed! [b (ptr page)])
137
- (let ([all (opened-pages)] [r (ptr json-value) 0] [why string] [p (params-of)])
139
+ (let ([all (opened-pages)] [r (ptr json-value) 0] [p (params-of)])
138
140
  (for ([i u32 0]) (< i (-> all length)) (+= i 1)
139
141
  (when (== (@ all i) (cast u32 b))
140
142
  (memcpy (cast (ptr u8) (+ (-> all items) i)) (cast (ptr u8) (+ (-> all items) (+ i 1))) (* (- (-> all length) (+ i 1)) 4))
@@ -142,7 +144,7 @@
142
144
  (break)))
143
145
  (when (and connected (> (-> b context length) 0))
144
146
  (param-string! (& p) "browserContextId" (-> b context))
145
- (devtools-call (& connection) (& work) "Target.disposeBrowserContext" (params-text (& p)) "" (& r) (& why)))
147
+ (devtools-call (& connection) (& work) "Target.disposeBrowserContext" (params-text (& p)) "" (& r) 0))
146
148
  (when (> (-> b downloads-dir length) 0) (fs-remove (-> b downloads-dir) #t 0))
147
149
  (unless (== (-> b server) 0) (worker-stop (-> b server)))
148
150
  (when (and connected (== (-> pages length) 0))
@@ -158,12 +160,13 @@
158
160
  ;; Starts the server on a worker with the site's directory as its argument, and gives the first line it prints, its
159
161
  ;; address, with index.html after it.
160
162
  (define (served-from! [b (ptr page)] [server (fn ())]) -> string
161
- (let ([o worker-options] [why string] [line (make-buffer)] [said (make-buffer)] [until (+ (clock-monotonic) 60000.0)])
163
+ (let ([o worker-options] [why error] [line (make-buffer)] [said (make-buffer)] [until (+ (clock-monotonic) 60000.0)])
162
164
  (worker-options-init! (& o))
163
165
  (set! (-> o output) #t)
164
166
  (set! (-> server-head handle) unheard)
165
- (set! (-> b server) (worker-start server (cast (slice u8) (-> b site)) (& o) (cast (ptr void) (& server-head)) (& why)))
166
- (when (== (-> b server) 0) (throw page-failed why))
167
+ (unless (worker-start server (cast (slice u8) (-> b site)) (& o) (cast (ptr void) (& server-head)) (& (-> b server))
168
+ (& why))
169
+ (throw page-failed (error-text (& why))))
167
170
  (while #t
168
171
  (let ([left (- until (clock-monotonic))] [value i32 0] [bytes (slice u8)] [kind i32 0] [ended string ""])
169
172
  (when (<= left 0.0) (throw page-failed "the server did not print its address within 60 s"))
@@ -365,9 +368,9 @@
365
368
 
366
369
  (define (page-choose-files! [b (ptr page)] [paths (slice string)])
367
370
  (guarded b
368
- (let ([out (make-buffer)] [info fs-info] [why string])
371
+ (let ([out (make-buffer)] [info fs-info] [why error])
369
372
  (for ([i u32 0]) (< i (-> paths length)) (+= i 1)
370
- (when (< (fs-stat (@ paths i) (& info) (& why)) 0) (throw page-failed why))
373
+ (unless (fs-stat (@ paths i) (& info) (& why)) (throw page-failed (error-text (& why))))
371
374
  (pushed-text! (& out) (native-path (absolute (@ paths i)))))
372
375
  (set! (-> b chosen) (strings-in (& out)))
373
376
  (set! (-> b choosing) #t))))
@@ -563,8 +566,8 @@
563
566
  (try (evaluated b "window.ready = false") [catch page-failed (why) (begin)])
564
567
  (set! (-> b thrown) #f)
565
568
  (set! (-> b errors length) 0)
566
- (let ([error (text-at (page-call b method parameters) "errorText")])
567
- (when (> (-> error length) 0) (throw page-failed (cat "the browser cannot open the page: " error))))
569
+ (let ([refusal (text-at (page-call b method parameters) "errorText")])
570
+ (when (> (-> refusal length) 0) (throw page-failed (cat "the browser cannot open the page: " refusal))))
568
571
  (started! b))
569
572
 
570
573
  ;; Asks the agent in the page to carry out the request, and gives its answer.
@@ -621,10 +624,10 @@
621
624
  (while #t
622
625
  (let ([all (cast (ptr download) (-> b downloads bytes))] [n (/ (-> b downloads length) (sizeof download))])
623
626
  (for ([i u32 0]) (< i n) (+= i 1)
624
- (let ([d (+ all i)] [bytes (slice u8)] [why string])
627
+ (let ([d (+ all i)] [bytes (slice u8)] [why error])
625
628
  (when (and (== (-> d name) name) (== (-> d state) "completed"))
626
- (when (< (fs-read-file (joined-path (-> b downloads-dir) (-> d guid)) (& bytes) (& why)) 0)
627
- (throw page-failed why))
629
+ (unless (fs-read-file (joined-path (-> b downloads-dir) (-> d guid)) (& bytes) (& why))
630
+ (throw page-failed (error-text (& why))))
628
631
  (return bytes)))))
629
632
  (when (>= (clock-monotonic) until) (throw page-failed (cat (cat "no file named " (quoted name)) " was downloaded")))
630
633
  (devtools-pump (& connection) 20.0))
@@ -689,7 +692,7 @@
689
692
  [(== from origin)
690
693
  (let* ([file (if (== path "/") "/index.html" path)] [bytes (slice u8)]
691
694
  [full (resolved-path (-> b site) (slice file 1 (-> file length)))])
692
- (if (and (within? full (-> b site)) (>= (fs-read-file full (& bytes) 0) 0))
695
+ (if (and (within? full (-> b site)) (fs-read-file full (& bytes) 0))
693
696
  (fulfilled! session request 200 (type-of file) bytes #f)
694
697
  (fulfilled! session request 404 "text/plain" (cast (slice u8) "not found") #f)))]
695
698
  [(and (> (-> b server-host length) 0) (== (host-of from) (-> b server-host)))
@@ -722,7 +725,7 @@
722
725
 
723
726
  ;; A file picker that opened gives the files the test chose, or else is cancelled.
724
727
  (define (chose! [b (ptr page)] [node f64])
725
- (let ([q (params-of)] [a (make-arena)] [r (ptr json-value) 0] [why string])
728
+ (let ([q (params-of)] [a (make-arena)] [r (ptr json-value) 0] [why error])
726
729
  (param-number! (& q) "backendNodeId" node)
727
730
  (if (-> b choosing)
728
731
  (let ([files (make-buffer)])
@@ -734,21 +737,23 @@
734
737
  (buffer-add-byte! (& files) #\])
735
738
  (param-raw! (& q) "files" (buffer-string (& files)))
736
739
  (unless (devtools-call (& connection) (& a) "DOM.setFileInputFiles" (params-text (& q)) (-> b session) (& r) (& why))
737
- (pushed-text! (& (-> b lines)) (cat "files: " why))))
740
+ (pushed-text! (& (-> b lines)) (cat "files: " (error-text (& why))))))
738
741
  (if (devtools-call (& connection) (& a) "DOM.resolveNode" (params-text (& q)) (-> b session) (& r) (& why))
739
742
  (let ([p (params-of)])
740
743
  (param-string! (& p) "objectId" (text-at (json-get r "object") "objectId"))
741
744
  (param-string! (& p) "functionDeclaration" "function () { this.dispatchEvent(new Event('cancel')); }")
742
745
  (unless (devtools-call (& connection) (& a) "Runtime.callFunctionOn" (params-text (& p)) (-> b session) (& r) (& why))
743
- (pushed-text! (& (-> b lines)) (cat "files: " why))))
744
- (pushed-text! (& (-> b lines)) (cat "files: " why))))
746
+ (pushed-text! (& (-> b lines)) (cat "files: " (error-text (& why))))))
747
+ (pushed-text! (& (-> b lines)) (cat "files: " (error-text (& why))))))
748
+ (error-free! (& why))
745
749
  (arena-free (& a))))
746
750
 
747
751
  ;; ---- helpers ----
748
752
 
749
753
  (define (call [method string] [parameters string] [session string]) -> (ptr json-value)
750
- (let ([r (ptr json-value) 0] [why string])
751
- (unless (devtools-call (& connection) (& work) method parameters session (& r) (& why)) (throw page-failed why))
754
+ (let ([r (ptr json-value) 0] [why error])
755
+ (unless (devtools-call (& connection) (& work) method parameters session (& r) (& why))
756
+ (throw page-failed (error-text (& why))))
752
757
  r))
753
758
 
754
759
  (define (page-call [b (ptr page)] [method string] [parameters string]) -> (ptr json-value)
package/std/test/run.sub CHANGED
@@ -21,24 +21,25 @@
21
21
  ;; ---- running ----
22
22
 
23
23
  (define (program-in [dir string] [program string] [env (slice string)] [args (slice string)] [input (slice u8)]) -> ran
24
- (let ([o process-options] [r ran] [bytes (slice u8)] [why string])
24
+ (let ([o process-options] [r ran] [bytes (slice u8)] [why error])
25
25
  (process-options-init! (& o))
26
26
  (set! (-> o dir) dir)
27
27
  (set! (-> o env) env)
28
- (set! (-> r code) (process-run program args (& o) input 60000 (& bytes) (& why)))
29
- (when (< (-> r code) 0) (throw test-failed (joined (joined program ": ") why)))
28
+ (unless (process-run program args (& o) input 60000 (& bytes) (& (-> r code)) (& why))
29
+ (throw test-failed (joined (joined program ": ") (error-text (& why)))))
30
30
  (set! (-> r output) (cast string bytes))
31
31
  r))
32
32
 
33
33
  (define (granted [clauses (slice (slice string))]) -> grants
34
- (let ([g (make-grants)] [why string])
34
+ (let ([g (make-grants)] [why error])
35
35
  (for ([i u32 0]) (< i (-> clauses length)) (+= i 1)
36
36
  (let ([c (@ clauses i)])
37
- (unless (grants-add! (& g) (@ c 0) (slice c 1 (-> c length)) (& why)) (throw test-failed why))))
37
+ (unless (grants-add! (& g) (@ c 0) (slice c 1 (-> c length)) (& why))
38
+ (throw test-failed (error-text (& why))))))
38
39
  g))
39
40
 
40
41
  (define (host-in [dir string] [env (slice string)] [g (ptr grants)] [args (slice string)] [input (slice u8)]) -> ran
41
- (program-in dir (joined-path (root) "substrate/host/subhost.mjs") env
42
+ (program-in dir (toolchain-host) env
42
43
  (grants-arguments g (@ args 0) (slice args 1 (-> args length))) input))
43
44
 
44
45
  (define (sub-in [dir string] [clauses (slice (slice string))] [env (slice string)] [args (slice string)]
@@ -72,8 +73,8 @@
72
73
  [compare (compare-output! (-> r output) expected message)]))
73
74
 
74
75
  (define (expected-text [path string]) -> string
75
- (let ([bytes (slice u8)] [why string])
76
- (when (< (fs-read-file path (& bytes) (& why)) 0) (throw test-failed (joined (joined path ": ") why)))
76
+ (let ([bytes (slice u8)] [why error])
77
+ (unless (fs-read-file path (& bytes) (& why)) (throw test-failed (joined (joined path ": ") (error-text (& why)))))
77
78
  (cast string bytes)))
78
79
 
79
80
  (define (sub-run-in [dir string] [name string] [grants (slice string)]) -> ran
package/std/test/test.sub CHANGED
@@ -2,6 +2,9 @@
2
2
  ;; program, with the grants that substrate test gives every test plus those in its #:grants; #:grants can ask only for
3
3
  ;; what substrate test itself was given. A test ends once nothing it started is still pending, and #:output and
4
4
  ;; #:output-file check everything it printed.
5
+ ;;
6
+ ;; In #:grants, (toolchain) lets a test run the toolchain, as the helpers in run.sub do. That amounts to every grant,
7
+ ;; because the toolchain can be started with any grants.
5
8
  (require-unqualified host/fs)
6
9
  (require-unqualified host/events)
7
10
  (require-unqualified host/modules/clock)
@@ -11,20 +14,16 @@
11
14
  (require-unqualified host/node/env)
12
15
  (require-unqualified "compare.sub")
13
16
 
14
- (provide run-tests expect-output expect-output-file test-path scratch-directory
17
+ (provide run-tests expect-output expect-output-file test-path scratch-directory toolchain-host
15
18
  compare-output! compare-output-file!)
16
19
 
17
20
  ;; ---- the runner ----
18
21
 
19
22
  (struct entry [module string] [name string] [line u32] [skip string] [traps string]
20
23
  [grants (slice (slice string))] [output string] [output-file string] [run (fn ())]
21
- [outcome u32] [why string] [report buffer])
24
+ [outcome outcome] [why string] [report buffer])
22
25
 
23
- (const waiting u32 0)
24
- (const unrun u32 1)
25
- (const passing u32 2)
26
- (const failing u32 3)
27
- (const skipping u32 4)
26
+ (enum outcome waiting unrun passing failing skipping)
28
27
 
29
28
  (define entries (ptr entry) 0)
30
29
  (define entry-count u32 0)
@@ -53,12 +52,9 @@
53
52
  ;; Copies the clauses to the heap, since most tests start after main has returned.
54
53
  (define (kept-clauses [clauses (slice (slice string))]) -> (slice (slice string))
55
54
  (when (== (-> clauses length) 0) (return clauses))
56
- (let ([out (cast (ptr (slice string)) (malloc (* (-> clauses length) (sizeof (slice string)))))])
57
- (for ([i u32 0]) (< i (-> clauses length)) (+= i 1)
58
- (let* ([c (@ clauses i)] [items (cast (ptr string) (malloc (* (-> c length) (sizeof string))))])
59
- (for ([j u32 0]) (< j (-> c length)) (+= j 1) (set! (@ items j) (@ c j)))
60
- (set! (@ out i) (slice items (-> c length)))))
61
- (slice out (-> clauses length))))
55
+ (let ([out (new 0 (slice string) (-> clauses length))])
56
+ (for ([i u32 0]) (< i (-> clauses length)) (+= i 1) (set! (@ out i) (copy 0 (@ clauses i))))
57
+ out))
62
58
 
63
59
  (define system string "")
64
60
 
@@ -102,12 +98,12 @@
102
98
  (when (and (digits-integer (option "-t") 10 #f (& n)) (> n 0)) (set! at-once (cast u32 n)))
103
99
  (when (digits-integer (option "--timeout-ms") 10 #f (& n)) (set! time-limit n)))
104
100
  (for ([i u32 0]) (< i (-> arguments length)) (+= i 1)
105
- (let ([a (@ arguments i)] [why string])
101
+ (let ([a (@ arguments i)])
106
102
  (cond [(== a "-v") (set! verbose #t)]
107
103
  [(== a "--ignored") (set! ignored-only #t)]
108
104
  [(== a "--nocapture") (set! capturing #f)]
109
105
  [(and (== a "--grant") (< (+ i 2) (-> arguments length)))
110
- (grants-add! (& needs) (@ arguments (+ i 1)) (slice (& (@ arguments (+ i 2))) 1) (& why))
106
+ (grants-add! (& needs) (@ arguments (+ i 1)) (slice (& (@ arguments (+ i 2))) 1) 0)
111
107
  (+= i 2)]))))
112
108
 
113
109
  (define (valued? [a string]) -> bool (or (== a "--name") (== a "-t") (== a "--timeout-ms")))
@@ -129,6 +125,13 @@
129
125
  ;; The test's own scratch directory, which is empty when the test starts.
130
126
  (define (scratch-directory) -> string (setting "SUBSTRATE_SCRATCH"))
131
127
 
128
+ ;; The toolchain's host, which (toolchain) in #:grants lets a test run.
129
+ (define (toolchain-host) -> string
130
+ (let ([b (make-buffer)])
131
+ (buffer-add-string! (& b) (setting "SUBSTRATE_TOOLCHAIN"))
132
+ (buffer-add-string! (& b) "/host/subhost.mjs")
133
+ (buffer-string (& b))))
134
+
132
135
  (define (selected? [e (ptr entry)]) -> bool
133
136
  (let ([any #f] [i u32 0])
134
137
  (while (< i (-> arguments length))
@@ -164,7 +167,7 @@
164
167
  (set! run-scratch (setting "SUBSTRATE_SCRATCH"))
165
168
  (set! started (clock-monotonic))
166
169
  (let ([n (if capturing at-once 1)])
167
- (set! slots (cast (ptr slot) (calloc n (sizeof slot))))
170
+ (set! slots (-> (new 0 slot n) items))
168
171
  (for ([i u32 0]) (< i n) (+= i 1) (slot-go! (& (@ slots i)))))
169
172
  (reported!))
170
173
 
@@ -202,9 +205,9 @@
202
205
  ;; Returns #t if the test is now running in slot s, or #f if it could not start.
203
206
  (define (started! [s (ptr slot)] [e (ptr entry)]) -> bool
204
207
  (set! (-> s captured length) 0)
205
- (let ([o worker-options] [why string] [scratch (scratch-of e)])
206
- (when (< (fs-make-dir scratch (& why)) 0)
207
- (failed! e why "")
208
+ (let ([o worker-options] [why error] [scratch (scratch-of e)])
209
+ (unless (fs-make-dir scratch (& why))
210
+ (failed! e (error-text (& why)) "")
208
211
  (return #f))
209
212
  (env-set "SUBSTRATE_SCRATCH" scratch 0)
210
213
  (worker-options-init! (& o))
@@ -216,17 +219,20 @@
216
219
  (grants-allow! (& (-> o grants)) grant-read scratch)
217
220
  (grants-allow! (& (-> o grants)) grant-write scratch)
218
221
  (for ([i u32 0]) (< i (-> e grants length)) (+= i 1)
219
- (let ([c (@ (-> e grants) i)] [items (make-buffer)])
220
- (for ([j u32 1]) (< j (-> c length)) (+= j 1) (pushed! (& items) (scratch-placed (@ c j) scratch)))
221
- (unless (grants-add! (& (-> o grants)) (@ c 0) (strings-in (& items)) (& why))
222
- (failed! e why "")
222
+ (let ([c (@ (-> e grants) i)] [items (make-buffer)] [kind (@ (@ (-> e grants) i) 0)])
223
+ (if (and (== kind "toolchain") (== (-> c length) 1))
224
+ (begin
225
+ (set! kind "run")
226
+ (pushed! (& items) (toolchain-host)))
227
+ (for ([j u32 1]) (< j (-> c length)) (+= j 1) (pushed! (& items) (scratch-placed (@ c j) scratch))))
228
+ (unless (grants-add! (& (-> o grants)) kind (strings-in (& items)) (& why))
229
+ (failed! e (error-text (& why)) "")
223
230
  (return #f))))
224
231
  (set! (-> s entry) e)
225
232
  (set! (-> s head handle) heard)
226
- (set! (-> s worker) (worker-start (-> e run) (slice (cast (ptr u8) 0) 0) (& o) (cast (ptr void) (& (-> s head)))
227
- (& why)))
228
- (when (== (-> s worker) 0)
229
- (failed! e (beyond why) "")
233
+ (unless (worker-start (-> e run) (slice (cast (ptr u8) 0) 0) (& o) (cast (ptr void) (& (-> s head)))
234
+ (& (-> s worker)) (& why))
235
+ (failed! e (beyond (error-text (& why))) "")
230
236
  (return #f))
231
237
  (when (> time-limit 0)
232
238
  (set! (-> s clock handle) out-of-time)
@@ -419,12 +425,12 @@
419
425
  (output-differs! got expected message)))
420
426
 
421
427
  (define (compare-output-file! [got string] [module string] [file string] [message string])
422
- (let ([why string] [bytes (slice u8)] [path (test-path module file)])
423
- (when (< (fs-read-file path (& bytes) (& why)) 0)
428
+ (let ([why error] [bytes (slice u8)] [path (test-path module file)])
429
+ (unless (fs-read-file path (& bytes) (& why))
424
430
  (let ([b (make-buffer)])
425
431
  (buffer-add-string! (& b) message)
426
432
  (buffer-add-byte! (& b) 10)
427
- (buffer-add-string! (& b) why)
433
+ (buffer-add-string! (& b) (error-text (& why)))
428
434
  (throw test-failed (buffer-string (& b)))))
429
435
  (unless (== (trimmed got) (trimmed (cast string bytes))) (output-differs! got (cast string bytes) message))
430
436
  (free (-> bytes items))))
@@ -0,0 +1,75 @@
1
+ ;; Vectors: growable arrays of one type, on the heap. (define-vector name type) declares the type name, whose zero value
2
+ ;; is an empty vector, and its functions name-count, name-items, name-at, name-at-unchecked, name-add!, name-push!,
3
+ ;; name-pop!, name-clear!, name-reserve! and name-free!. vector-count, vector-at and the others call the function of
4
+ ;; their first argument's type, and vector-each runs its body for each item. Growing may move the items, so a pointer
5
+ ;; to an item lasts until the vector next grows.
6
+ (require-unqualified std/meta/method)
7
+
8
+ (provide define-vector vector-count vector-items vector-at vector-at-unchecked vector-add! vector-push! vector-pop!
9
+ vector-clear! vector-reserve! vector-free! vector-each)
10
+
11
+ (begin-for-syntax
12
+ (require-unqualified compiler/macros)
13
+ (require-unqualified std/meta/type-info)
14
+
15
+ (define (define-vector-form [s datum]) -> datum
16
+ (syntax-match s
17
+ [(_ (? identifier? name) t)
18
+ (let ([count (method-name name '-count)] [items (method-name name '-items)] [at (method-name name '-at)]
19
+ [at-unchecked (method-name name '-at-unchecked)] [add (method-name name '-add!)]
20
+ [push (method-name name '-push!)] [pop (method-name name '-pop!)] [clear (method-name name '-clear!)]
21
+ [reserve (method-name name '-reserve!)] [free! (method-name name '-free!)])
22
+ #`(begin
23
+ (struct #,name [items (ptr #,t)] [count u32] [room u32])
24
+ (define (#,count [v (ptr #,name)]) -> u32 (-> v count))
25
+ (define (#,items [v (ptr #,name)]) -> (slice #,t) (slice (-> v items) (-> v count)))
26
+ (define (#,at [v (ptr #,name)] [i u32]) -> (ptr #,t) (& (@ (slice (-> v items) (-> v count)) i)))
27
+ (define (#,at-unchecked [v (ptr #,name)] [i u32]) -> (ptr #,t) (+ (-> v items) i))
28
+ (define (#,reserve [v (ptr #,name)] [n u32])
29
+ (when (> n (-> v room))
30
+ (let ([room u64 (if (== (-> v room) 0) 4 (cast u64 (-> v room)))])
31
+ (while (< room (cast u64 n)) (set! room (* room 2)))
32
+ (let ([bytes (* room (cast u64 (sizeof #,t)))])
33
+ (set! (-> v items)
34
+ (cast (ptr #,t) (realloc (-> v items) (if (< bytes 2147483584) (cast u32 bytes) 2147483584))))
35
+ (set! (-> v room) (cast u32 room))))))
36
+ (define (#,push [v (ptr #,name)] [x #,t])
37
+ (when (== (-> v count) (-> v room)) (#,reserve v (+ (-> v count) 1)))
38
+ (set! (@ (+ (-> v items) (-> v count))) x)
39
+ (+= (-> v count) 1))
40
+ (define (#,add [v (ptr #,name)]) -> (ptr #,t)
41
+ (when (== (-> v count) (-> v room)) (#,reserve v (+ (-> v count) 1)))
42
+ (let ([p (+ (-> v items) (-> v count))])
43
+ (memset p 0 (sizeof #,t))
44
+ (+= (-> v count) 1)
45
+ p))
46
+ (define (#,pop [v (ptr #,name)]) -> #,t
47
+ (when (== (-> v count) 0) (host-trap "vector-pop!: the vector is empty"))
48
+ (-= (-> v count) 1)
49
+ (@ (+ (-> v items) (-> v count))))
50
+ (define (#,clear [v (ptr #,name)]) (set! (-> v count) 0))
51
+ (define (#,free! [v (ptr #,name)])
52
+ (free (-> v items))
53
+ (set! (-> v items) 0)
54
+ (set! (-> v count) 0)
55
+ (set! (-> v room) 0))))]
56
+ [_ (raise-syntax-error 'define-vector "expected (define-vector name type)" s)]))
57
+
58
+ (define (vector-each-form [s datum]) -> datum
59
+ (syntax-match s
60
+ [(_ (((? identifier? x) v)) body0 body ...)
61
+ #`(let ([the-vector #,v])
62
+ (for ([i u32 0]) (< i (vector-count the-vector)) (+= i 1)
63
+ (let ([#,x (vector-at-unchecked the-vector i)]) #,body0 #,@body)))]
64
+ [(_ (((? identifier? x) (? identifier? i) v)) body0 body ...)
65
+ #`(let ([the-vector #,v])
66
+ (for ([#,i u32 0]) (< #,i (vector-count the-vector)) (+= #,i 1)
67
+ (let ([#,x (vector-at-unchecked the-vector #,i)]) #,body0 #,@body)))]
68
+ [_ (raise-syntax-error
69
+ 'vector-each "expected (vector-each ([item vector]) body ...) or (vector-each ([item index vector]) body ...)" s)])))
70
+
71
+ (define-syntax define-vector define-vector-form)
72
+ (define-syntax vector-each vector-each-form)
73
+ (define-methods [vector-count -count] [vector-items -items] [vector-at -at] [vector-at-unchecked -at-unchecked]
74
+ [vector-add! -add!] [vector-push! -push!] [vector-pop! -pop!] [vector-clear! -clear!]
75
+ [vector-reserve! -reserve!] [vector-free! -free!])
package/substrate/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.3
1
+ 0.10.0
@@ -70,7 +70,7 @@
70
70
  [current (ptr srcloc)] [start (ptr srcloc)] [started bool] [else-pending bool])
71
71
 
72
72
  (define (new-asm) -> (ptr asm)
73
- (let ([a (cast (ptr asm) (arena-alloc (current-arena) (sizeof asm)))])
73
+ (let ([a (new (current-arena) asm)])
74
74
  (set! (-> a out) (make-buffer))
75
75
  (set! (-> a relocs) 0)
76
76
  (set! (-> a locations) 0)
@@ -86,7 +86,7 @@
86
86
  (struct cell-record [self datum] [value datum])
87
87
 
88
88
  (define (cell [v datum]) -> datum
89
- (let ([c (cast (ptr cell-record) (arena-alloc (current-arena) (sizeof cell-record)))])
89
+ (let ([c (new (current-arena) cell-record)])
90
90
  (set! (-> c self) (make-record-in (current-arena) cell-kind c))
91
91
  (set! (-> c value) v)
92
92
  (-> c self)))
@@ -96,23 +96,14 @@
96
96
  (define (set-cell-value! [c datum] [v datum]) (set! (-> (cast (ptr cell-record) (record-pointer c)) value) v))
97
97
 
98
98
  (define (reloc! [a (ptr asm)] [kind datum] [key datum])
99
- (let ([r (cast (ptr reloc) (arena-alloc (current-arena) (sizeof reloc)))])
100
- (set! (-> r offset) (asm-size a))
101
- (set! (-> r kind) kind)
102
- (set! (-> r key) key)
103
- (set! (-> r next) (-> a relocs))
104
- (set! (-> a relocs) r)))
99
+ (set! (-> a relocs) (new (current-arena) (reloc #:offset (asm-size a) #:kind kind #:key key #:next (-> a relocs)))))
105
100
 
106
101
  ;; ---- source locations ----
107
102
 
108
103
  (define code-locations (ptr code-location) 0)
109
104
 
110
105
  (define (new-location [offset u32] [loc (ptr srcloc)] [next (ptr code-location)]) -> (ptr code-location)
111
- (let ([l (cast (ptr code-location) (arena-alloc (current-arena) (sizeof code-location)))])
112
- (set! (-> l offset) offset)
113
- (set! (-> l loc) loc)
114
- (set! (-> l next) next)
115
- l))
106
+ (new (current-arena) (code-location #:offset offset #:loc loc #:next next)))
116
107
 
117
108
  (define (same-location? [a (ptr srcloc)] [b (ptr srcloc)]) -> bool
118
109
  (or (== a b)
@@ -283,7 +274,7 @@
283
274
 
284
275
  (define (link-body [a (ptr asm)] [b (ptr asm)] [resolve (closure (datum datum) -> datum)]) -> datum
285
276
  (let ([q (make-buffer)] [notes (ptr code-location) 0]
286
- [l (cast (ptr linked) (arena-alloc (current-arena) (sizeof linked)))])
277
+ [l (new (current-arena) linked)])
287
278
  (set! notes (link-segment! (& q) a resolve notes))
288
279
  (when (!= b 0)
289
280
  (when (-> b started) (set! notes (new-location (-> q length) (-> b start) notes)))