substrate-lang 0.10.0 → 0.10.2
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.
- package/build/compiler/{checker.4dd4556dd421@0+0.wasm → checker.1d67e1d4e91a@0+0.wasm} +0 -0
- package/build/compiler/{expander.967ce443d379@0+0.wasm → expander.34110a31a949@0+0.wasm} +0 -0
- package/build/compiler/{main.4fc52f204d54@0+0.wasm → main.ca9b5089c24d@0+0.wasm} +0 -0
- package/build/compiler/program +4 -4
- package/build/compiler/{roots.cefd10e93684@0+0.wasm → roots.2f1ad1a79459@0+0.wasm} +0 -0
- package/build/sub/{build.459c5b9412bd@0+0.wasm → build.eef7dfa467ec@0+0.wasm} +0 -0
- package/build/sub/{common.1edc613607a0@0+0.wasm → common.7617940db2dc@0+0.wasm} +0 -0
- package/build/sub/deflate.23f7c4679260@0+0.wasm +0 -0
- package/build/sub/{doc.0775df5de6fe@0+0.wasm → doc.92d6d82d99c1@0+0.wasm} +0 -0
- package/build/sub/{doc.ef9965d5d402@0+0.wasm → doc.dab689b811ca@0+0.wasm} +0 -0
- package/build/sub/{fetch.96b2d10f025e@0+0.wasm → fetch.3367ff4f88c0@0+0.wasm} +0 -0
- package/build/sub/{files.ad0469fdf6fa@0+0.wasm → files.5ae9d3cebeca@0+0.wasm} +0 -0
- package/build/sub/gzip.16e372eda1cf@0+0.wasm +0 -0
- package/build/sub/{hash.660682e4f491@0+0.wasm → hash.c57c141b4862@0+0.wasm} +0 -0
- package/build/sub/{html.a23126eb949a@0+0.wasm → html.803f73c35c4a@0+0.wasm} +0 -0
- package/build/sub/{manifest.ef317480deb0@0+0.wasm → manifest.da52a88c7af7@0+0.wasm} +0 -0
- package/build/sub/{map.f455cca6a42a@0+0.wasm → map.5c8084999550@0+0.wasm} +0 -0
- package/build/sub/program +22 -22
- package/build/sub/{root.f10a4906f460@0+0.wasm → root.78253db36643@0+0.wasm} +0 -0
- package/build/sub/{roots.cefd10e93684@0+0.wasm → roots.2f1ad1a79459@0+0.wasm} +0 -0
- package/build/sub/sha256.a6c32b04d799@0+0.wasm +0 -0
- package/build/sub/site.47fd989be8fb@0+0.wasm +0 -0
- package/build/sub/site.c908b1f6db12@0+0.wasm +0 -0
- package/build/sub/{store.a24d7a25daa6@0+0.wasm → store.048c77bb124d@0+0.wasm} +0 -0
- package/build/sub/sub.a618f89f2ec8@0+0.wasm +0 -0
- package/build/sub/{test.9bd59c73f65e@0+0.wasm → test.b529bf52ba3e@0+0.wasm} +0 -0
- package/build/sub/{text.1bc90482bd43@0+0.wasm → text.b214933a4984@0+0.wasm} +0 -0
- package/build/sub/{upgrade.39ee449b00d5@0+0.wasm → upgrade.7ec5651ed2e9@0+0.wasm} +0 -0
- package/package.json +1 -1
- package/std/http/server.sub +7 -7
- package/std/http/static.sub +66 -30
- package/std/package/manifest.sub +9 -4
- package/std/package/site.sub +209 -15
- package/std/package.sub +4 -3
- package/std/test/browser.sub +20 -14
- package/std/test/build.sub +8 -6
- package/std/test/page/agent.mjs +8 -2
- package/std/web/canvas.sub +4 -4
- package/std/web/dom.sub +45 -11
- package/std/web/gpu-commands.sub +439 -0
- package/std/web/gpu.sub +17 -424
- package/std/web/patches.sub +53 -18
- package/substrate/VERSION +1 -1
- package/substrate/compiler/expander.sub +2 -3
- package/substrate/compiler/roots.sub +12 -5
- package/substrate/host/grants.mjs +3 -3
- package/substrate/host/node/net.mjs +17 -2
- package/substrate/host/node/worker.mjs +3 -1
- package/substrate/host/subhost.mjs +4 -1
- package/substrate/host/web/audio.mjs +18 -10
- package/substrate/host/web/audio.sub +9 -3
- package/substrate/host/web/dom.mjs +167 -66
- package/substrate/host/web/dom.sub +9 -27
- package/substrate/host/web/fs.mjs +3 -3
- package/substrate/host/web/gpu.mjs +65 -27
- package/substrate/host/web/gpu.sub +18 -4
- package/substrate/host/web/location.mjs +15 -1
- package/substrate/host/web/location.sub +11 -3
- package/substrate/host/web/start.mjs +11 -7
- package/substrate/host/web/subhost-web.mjs +54 -33
- package/substrate/host/web/worker-script.mjs +4 -4
- package/substrate/host/web/worker.mjs +4 -4
- package/substrate/host/worker.mjs +1 -1
- package/build/sub/site.1732b58ec0e8@0+0.wasm +0 -0
- package/build/sub/site.ae3913b0b0f4@0+0.wasm +0 -0
- package/build/sub/sub.2e3092140706@0+0.wasm +0 -0
package/std/package.sub
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(package std
|
|
2
|
-
(version "0.10.
|
|
3
|
-
(substrate "0.10.
|
|
2
|
+
(version "0.10.2")
|
|
3
|
+
(substrate "0.10.2")
|
|
4
4
|
(exports archive/tar browser/chromium browser/devtools compress/deflate compress/gzip compress/inflate crypto/hmac
|
|
5
5
|
crypto/password crypto/sha1
|
|
6
6
|
crypto/sha256 crypto/sha512 doc/doc doc/html doc/root doc/text encoding/base64 encoding/json encoding/utf8
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
http/route http/server http/session http/sse http/sse-client http/static http/test http/token http/url
|
|
9
9
|
http/websocket log/log meta/derive meta/equal meta/method meta/type-info package/files package/hash
|
|
10
10
|
package/manifest package/map package/pack package/path package/read package/site package/store test/browser
|
|
11
|
-
test/build test/run test/session test/test vector/vector web/canvas web/dom web/gpu web/
|
|
11
|
+
test/build test/run test/session test/test vector/vector web/canvas web/dom web/gpu web/gpu-commands
|
|
12
|
+
web/patches)
|
|
12
13
|
(tests "tests/archive/*.sub" "tests/compress/*.sub" "tests/crypto/*.sub" "tests/encoding/*.sub" "tests/http/*.sub"
|
|
13
14
|
"tests/log/*.sub" "tests/meta/*.sub" "tests/test/*.sub" "tests/vector/*.sub"))
|
package/std/test/browser.sub
CHANGED
|
@@ -105,13 +105,13 @@
|
|
|
105
105
|
|
|
106
106
|
(define (%browser-step! [s string]) (page-step! s))
|
|
107
107
|
|
|
108
|
-
(define (browser-opened [spec string] [html string] [url string] [args (slice string)] [server (fn ())]
|
|
109
|
-
-> browser
|
|
108
|
+
(define (browser-opened [spec string] [html string] [release bool] [url string] [args (slice string)] [server (fn ())]
|
|
109
|
+
[message string]) -> browser
|
|
110
110
|
(let ([address string])
|
|
111
111
|
(unless (env-get "SUBSTRATE_DEVTOOLS" (& address) 0)
|
|
112
112
|
(throw test-failed (lines-joined message "a test that opens a browser needs (browser) in the tests clause of its package's package.sub")))
|
|
113
113
|
(when (== (-> address length) 0) (throw test-skipped "need Chromium"))
|
|
114
|
-
(let ([dir (site-built spec html message)] [why error] [p (ptr page) 0])
|
|
114
|
+
(let ([dir (site-built spec html release message)] [why error] [p (ptr page) 0])
|
|
115
115
|
(unless (page-open dir (with-args url args) address server (& p) (& why))
|
|
116
116
|
(throw test-failed (lines-joined message (error-text (& why)))))
|
|
117
117
|
(browser #:page p))))
|
|
@@ -126,28 +126,31 @@
|
|
|
126
126
|
(url-add-form-value! (& b) (@ args i)))
|
|
127
127
|
(buffer-string (& b))))
|
|
128
128
|
|
|
129
|
-
(struct built [spec string] [html string] [dir string])
|
|
129
|
+
(struct built [spec string] [html string] [release bool] [dir string])
|
|
130
130
|
|
|
131
131
|
(define made buffer)
|
|
132
132
|
|
|
133
133
|
;; Builds spec's site in the test's scratch directory, once per test.
|
|
134
|
-
(define (site-built [spec string] [html string] [message string]) -> string
|
|
134
|
+
(define (site-built [spec string] [html string] [release bool] [message string]) -> string
|
|
135
135
|
(let* ([all (cast (ptr built) (-> made bytes))] [n (/ (-> made length) (sizeof built))]
|
|
136
136
|
[base (base-of spec)] [name (if (ends? base ".sub") (slice base 0 (- (-> base length) 4)) base)]
|
|
137
137
|
[dir (joined-path (joined-path (scratch-directory) "sites") name)] [info fs-info] [err (make-buffer)]
|
|
138
138
|
[b built])
|
|
139
139
|
(for ([i u32 0]) (< i n) (+= i 1)
|
|
140
140
|
(let ([m (& (@ all i))])
|
|
141
|
-
(when (and (== (-> m spec) spec) (== (-> m html) html)) (return (-> m dir)))
|
|
141
|
+
(when (and (== (-> m spec) spec) (== (-> m html) html) (== (-> m release) release)) (return (-> m dir)))
|
|
142
142
|
(when (== (-> m dir) dir) (set! dir (numbered dir n)))))
|
|
143
143
|
(let ([p (planned spec name message)])
|
|
144
144
|
(when (> (-> html length) 0) (set! (-> p html) html))
|
|
145
|
+
(build-ready!)
|
|
145
146
|
(unless (site-write! (& p) dir (toolchain) (& err))
|
|
146
147
|
(throw test-failed (lines-joined message (buffer-string (& err)))))
|
|
147
148
|
(unless (and (fs-stat (-> p program) (& info) 0) (== (-> info kind) fs-directory))
|
|
148
|
-
(unless (program-write! (-> p program) (joined-path dir "program") (& err))
|
|
149
|
-
(throw test-failed (lines-joined message (buffer-string (& err))))))
|
|
150
|
-
|
|
149
|
+
(unless (program-write! (-> p program) (joined-path dir "program") release (& err))
|
|
150
|
+
(throw test-failed (lines-joined message (buffer-string (& err))))))
|
|
151
|
+
(when (and release (not (site-release! dir (& err))))
|
|
152
|
+
(throw test-failed (lines-joined message (buffer-string (& err))))))
|
|
153
|
+
(set! b (built #:spec spec #:html html #:release release #:dir dir))
|
|
151
154
|
(buffer-add! (& made) (slice (cast (ptr u8) (& b)) (sizeof built)))
|
|
152
155
|
dir))
|
|
153
156
|
|
|
@@ -367,18 +370,21 @@
|
|
|
367
370
|
(define (with-browser-form [s datum]) -> datum
|
|
368
371
|
(syntax-match s
|
|
369
372
|
[(_ ((? identifier? b) (? text? file) options ...) body ...)
|
|
370
|
-
(let ([html (literal '"")] [url (literal '"")] [args (no-fields)] [server #'(cast (fn ()) 0)]
|
|
373
|
+
(let ([html (literal '"")] [release #'#f] [url (literal '"")] [args (no-fields)] [server #'(cast (fn ()) 0)]
|
|
374
|
+
[l options])
|
|
371
375
|
(while (pair? l)
|
|
372
376
|
(unless (and (keyword? (syntax-e (car l))) (pair? (cdr l)))
|
|
373
377
|
(raise-syntax-error 'with-browser "expected a keyword and its value" (car l)))
|
|
374
378
|
(let ([k (keyword->string (syntax-e (car l)))] [v (cadr l)])
|
|
375
379
|
(cond [(and (== k "html") (text? v)) (set! html (path-of s v))]
|
|
380
|
+
[(== k "release") (set! release v)]
|
|
376
381
|
[(and (== k "url") (text? v)) (set! url v)]
|
|
377
382
|
[(== k "args") (set! args (arguments v))]
|
|
378
383
|
[(== k "server") (set! server v)]
|
|
379
|
-
[else (raise-syntax-error 'with-browser "the options are #:html \"file\", #:url \"url\", #:args and #:server function" (car l))]))
|
|
384
|
+
[else (raise-syntax-error 'with-browser "the options are #:html \"file\", #:release #t, #:url \"url\", #:args and #:server function" (car l))]))
|
|
380
385
|
(set! l (cddr l)))
|
|
381
|
-
#`(let ([#,b (browser-opened #,(if (named? (syntax-e file)) file (path-of s file)) #,html #,url #,args
|
|
386
|
+
#`(let ([#,b (browser-opened #,(if (named? (syntax-e file)) file (path-of s file)) #,html #,release #,url #,args
|
|
387
|
+
#,server
|
|
382
388
|
#,(literal (format "~a:~a: (with-browser (~s ~s) ...)"
|
|
383
389
|
`(,(syntax-source s) ,(syntax-line s) ,(syntax->datum b)
|
|
384
390
|
,(syntax-e file)))))])
|
|
@@ -386,8 +392,8 @@
|
|
|
386
392
|
[catch-all (browser-closed! #,b) (rethrow)])
|
|
387
393
|
(%browser-step! "")
|
|
388
394
|
(browser-closed! #,b)))]
|
|
389
|
-
[_ (raise-syntax-error 'with-browser "expected (with-browser (name \"site or program.sub\" [#:html \"index.html\"] [#:
|
|
390
|
-
[#:server function]) body ...)" s)]))
|
|
395
|
+
[_ (raise-syntax-error 'with-browser "expected (with-browser (name \"site or program.sub\" [#:html \"index.html\"] [#:release #t] [#:url \"url\"]
|
|
396
|
+
[#:args (\"argument\" ...)] [#:server function]) body ...)" s)]))
|
|
391
397
|
|
|
392
398
|
;; The program's arguments from #:args: either a list of strings, or an expression that gives a slice of strings.
|
|
393
399
|
(define (arguments [v datum]) -> datum
|
package/std/test/build.sub
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
;; Building programs during a test: expect-compile-error, and program-write!, which with-browser uses to build sites.
|
|
2
|
+
;; build-ready! gives the compiler the test program's toolchain, module map and cache, once.
|
|
2
3
|
(require-unqualified compiler/macros)
|
|
3
4
|
(require-unqualified compiler/expander)
|
|
4
5
|
(require-unqualified compiler/roots)
|
|
@@ -9,12 +10,12 @@
|
|
|
9
10
|
(require-unqualified "test.sub")
|
|
10
11
|
(require-unqualified "compare.sub")
|
|
11
12
|
|
|
12
|
-
(provide expect-compile-error program-write!)
|
|
13
|
+
(provide expect-compile-error program-write! build-ready!)
|
|
13
14
|
|
|
14
15
|
(define ready bool #f)
|
|
15
16
|
(define directory string)
|
|
16
17
|
|
|
17
|
-
(define (ready!)
|
|
18
|
+
(define (build-ready!)
|
|
18
19
|
(unless ready
|
|
19
20
|
(set! ready #t)
|
|
20
21
|
(let ([why error] [toolchain string] [map-file string] [cache string])
|
|
@@ -29,19 +30,20 @@
|
|
|
29
30
|
|
|
30
31
|
;; Builds the program at path into out, both relative to the package's directory, with the test program's module map
|
|
31
32
|
;; and cache. Returns #f with the compile error in err if it does not compile.
|
|
32
|
-
(define (program-write! [path string] [out string] [err (ptr buffer)]) -> bool
|
|
33
|
-
(ready!)
|
|
33
|
+
(define (program-write! [path string] [out string] [strip bool] [err (ptr buffer)]) -> bool
|
|
34
|
+
(build-ready!)
|
|
34
35
|
(let ([full (resolved-path directory path)] [to (resolved-path directory out)])
|
|
35
36
|
(set-display-directory! (string->datum (parent-of full)))
|
|
36
37
|
(fs-remove to #t 0)
|
|
37
|
-
(try (begin (write-program! 0 (string->datum full) (string->datum to)
|
|
38
|
+
(try (begin (write-program! 0 (string->datum full) (string->datum to) strip) #t)
|
|
38
39
|
[catch compile-error (message blamed loc)
|
|
39
40
|
(write-error err message blamed loc)
|
|
40
41
|
#f])))
|
|
41
42
|
|
|
42
43
|
(define (compile-error-check [path string] [text string] [message string])
|
|
43
44
|
(let ([err (make-buffer)])
|
|
44
|
-
(when (program-write! path (joined-path (joined-path (scratch-directory) "programs") (program-name path))
|
|
45
|
+
(when (program-write! path (joined-path (joined-path (scratch-directory) "programs") (program-name path)) #f
|
|
46
|
+
(& err))
|
|
45
47
|
(failure! message "the file compiled"))
|
|
46
48
|
(unless (contains? (buffer-string (& err)) text) (failure! message (text-of "its compile error is\n" (buffer-string (& err)))))
|
|
47
49
|
(buffer-free! (& err))))
|
package/std/test/page/agent.mjs
CHANGED
|
@@ -74,8 +74,14 @@ const same = (a, b) => a.length === b.length && a.every((x, i) => x === b[i]);
|
|
|
74
74
|
// nameOf names drawn images and sounds by the path of the site's asset with the same bytes.
|
|
75
75
|
async function nameOf(bytes, otherwise) {
|
|
76
76
|
if (!assets) {
|
|
77
|
-
const
|
|
78
|
-
|
|
77
|
+
const start = document.querySelector('script[src$="host/web/start.mjs"]');
|
|
78
|
+
const list = start ? new URL('../../assets.list', start.src) : new URL('/assets.list', location.href);
|
|
79
|
+
const lines = (await (await fetch(list)).text()).split('\n').filter((l) => l !== '');
|
|
80
|
+
assets = await Promise.all(lines.map(async (line) => {
|
|
81
|
+
const [path, url = path] = line.split('\t');
|
|
82
|
+
const from = new URL(url.split('/').map(encodeURIComponent).join('/'), location.href);
|
|
83
|
+
return [`/${path}`, new Uint8Array(await (await fetch(from)).arrayBuffer())];
|
|
84
|
+
}));
|
|
79
85
|
}
|
|
80
86
|
const found = assets.find(([, b]) => same(b, bytes));
|
|
81
87
|
return found ? found[0] : otherwise;
|
package/std/web/canvas.sub
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
;; Drawing on a <canvas> element: rectangles, paths, circles, text, images and transforms. The calls write into the
|
|
2
|
-
;;
|
|
2
|
+
;; patches (patches.sub) between canvas-begin! and canvas-end!, and a call made outside them draws nothing.
|
|
3
3
|
(require-unqualified std/web/patches)
|
|
4
4
|
|
|
5
5
|
(provide canvas-begin! canvas-end! canvas-drawing?
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
(define begun u32 0)
|
|
16
16
|
|
|
17
17
|
(define (canvas-begin! [node u32])
|
|
18
|
-
(words! (slice (array-of u32
|
|
18
|
+
(words! (slice (array-of u32 11 node 0)))
|
|
19
19
|
(set! drawing (-> (dom-patches) length))
|
|
20
20
|
(set! begun (dom-flushes)))
|
|
21
21
|
|
|
@@ -90,12 +90,12 @@
|
|
|
90
90
|
|
|
91
91
|
(define next-image u32 1)
|
|
92
92
|
|
|
93
|
-
(define (canvas-load-image! [path string]) -> u32
|
|
93
|
+
(define (canvas-load-image! [path string] [tag (ptr void)]) -> u32
|
|
94
94
|
(if (canvas-drawing?)
|
|
95
95
|
0
|
|
96
96
|
(let ([id next-image])
|
|
97
97
|
(+= next-image 1)
|
|
98
|
-
(dom-image! id path)
|
|
98
|
+
(dom-image! id path tag)
|
|
99
99
|
id)))
|
|
100
100
|
|
|
101
101
|
(define (canvas-draw-sprite! [image u32] [cell-width f64] [cell-height f64] [frame u32] [x f64] [y f64] [flip bool])
|
package/std/web/dom.sub
CHANGED
|
@@ -1,9 +1,25 @@
|
|
|
1
|
-
;; The
|
|
2
|
-
;;
|
|
1
|
+
;; The document: the host module "dom" and the patches that patches.sub writes. dom-flush! sends the patches. A read
|
|
2
|
+
;; takes a name that walks from a node, or from the current event, through the document's objects: a property's name, or
|
|
3
|
+
;; names joined by dots. It gives a number, with true as 1, or text. The text lasts until the patches are sent. dom-is
|
|
4
|
+
;; and dom-event-is also take a node, and say whether the name leads to it. (dom-is node dom-document "activeElement")
|
|
5
|
+
;; says whether the node has the focus. dom-event-call calls a method of the current event.
|
|
3
6
|
(require-unqualified host-dom host/web/dom)
|
|
4
7
|
(require-unqualified patches "patches.sub")
|
|
5
8
|
|
|
6
|
-
(provide (all-from-out host-dom) (all-from-out patches) dom-flush! dom-event-
|
|
9
|
+
(provide (all-from-out host-dom) (all-from-out patches) dom-flush! dom-element dom-event-number dom-event-text
|
|
10
|
+
dom-event-call dom-event-is dom-read-number dom-read-text dom-is)
|
|
11
|
+
|
|
12
|
+
(import event-number "dom" "event_number" (i32 i32 -> f64))
|
|
13
|
+
(import event-text "dom" "event_text" (i32 i32 i32 -> i32))
|
|
14
|
+
(import event-call "dom" "event_call" (i32 i32 ->))
|
|
15
|
+
(import event-is "dom" "event_is" (i32 i32 i32 -> i32))
|
|
16
|
+
(import read-number "dom" "read_number" (i32 i32 i32 -> f64))
|
|
17
|
+
(import read-text "dom" "read_text" (i32 i32 i32 i32 -> i32))
|
|
18
|
+
(import is "dom" "is" (i32 i32 i32 i32 -> i32))
|
|
19
|
+
|
|
20
|
+
(define (dom-element [id string]) -> u32
|
|
21
|
+
(let ([n (dom-new-node!)])
|
|
22
|
+
(if (== (dom-bind-element (cast i32 (-> id bytes)) (cast i32 (-> id length)) (cast i32 n)) 0) 0 n)))
|
|
7
23
|
|
|
8
24
|
(define (dom-flush!)
|
|
9
25
|
(let* ([b (dom-patches)] [n (-> b length)])
|
|
@@ -12,12 +28,30 @@
|
|
|
12
28
|
(dom-apply (cast i32 (-> b bytes)) n))
|
|
13
29
|
(dom-discard!)))
|
|
14
30
|
|
|
15
|
-
|
|
16
|
-
(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
(
|
|
20
|
-
|
|
21
|
-
|
|
31
|
+
(define (kept-text [p (ptr u8)] [n u32]) -> string
|
|
32
|
+
(let ([copy (cast (ptr u8) (dom-frame-alloc n))])
|
|
33
|
+
(memcpy copy p n)
|
|
34
|
+
(free p)
|
|
35
|
+
(cast string (slice copy n))))
|
|
36
|
+
|
|
37
|
+
(define (dom-event-number [path string]) -> f64 (event-number (cast i32 (-> path bytes)) (cast i32 (-> path length))))
|
|
38
|
+
|
|
39
|
+
(define (dom-event-text [path string]) -> string
|
|
40
|
+
(let* ([n u32 0] [p (event-text (cast i32 (-> path bytes)) (cast i32 (-> path length)) (cast i32 (& n)))])
|
|
41
|
+
(kept-text (cast (ptr u8) p) n)))
|
|
42
|
+
|
|
43
|
+
(define (dom-event-call [method string]) (event-call (cast i32 (-> method bytes)) (cast i32 (-> method length))))
|
|
44
|
+
|
|
45
|
+
(define (dom-read-number [node u32] [path string]) -> f64
|
|
46
|
+
(read-number (cast i32 node) (cast i32 (-> path bytes)) (cast i32 (-> path length))))
|
|
47
|
+
|
|
48
|
+
(define (dom-read-text [node u32] [path string]) -> string
|
|
49
|
+
(let* ([n u32 0]
|
|
50
|
+
[p (read-text (cast i32 node) (cast i32 (-> path bytes)) (cast i32 (-> path length)) (cast i32 (& n)))])
|
|
51
|
+
(kept-text (cast (ptr u8) p) n)))
|
|
52
|
+
|
|
53
|
+
(define (dom-event-is [node u32] [path string]) -> bool
|
|
54
|
+
(!= (event-is (cast i32 node) (cast i32 (-> path bytes)) (cast i32 (-> path length))) 0))
|
|
22
55
|
|
|
23
|
-
(define (dom-
|
|
56
|
+
(define (dom-is [node u32] [from u32] [path string]) -> bool
|
|
57
|
+
(!= (is (cast i32 node) (cast i32 from) (cast i32 (-> path bytes)) (cast i32 (-> path length))) 0))
|