substrate-lang 0.9.3 → 0.9.4
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/binary.cdd2ffb408dd@0+0.wasm +0 -0
- package/build/compiler/checker.2b0ea87ed311@0+0.wasm +0 -0
- package/build/compiler/compile.da85f9bc4478@0+0.wasm +0 -0
- package/build/compiler/{core.fc3dab9d1846@0+0.wasm → core.0410ffbdc488@0+0.wasm} +0 -0
- package/build/compiler/expander.80707e1666d6@0+0.wasm +0 -0
- package/build/compiler/{fs.563034be70c3@0+0.wasm → fs.5017b627cbd2@0+0.wasm} +0 -0
- package/build/compiler/{leb128.748b1c37277a@0+0.wasm → leb128.ba77430f659f@0+0.wasm} +0 -0
- package/build/compiler/{link.11b643d35670@0+0.wasm → link.be6e641afa93@0+0.wasm} +0 -0
- package/build/compiler/{macros.4083601c00db@0+0.wasm → macros.b695763c0ca3@0+0.wasm} +0 -0
- package/build/compiler/{main.ed62cce43000@0+0.wasm → main.cbbdf42e34c2@0+0.wasm} +0 -0
- package/build/compiler/{ops.b361e858d8e1@0+0.wasm → ops.324f0a665fab@0+0.wasm} +0 -0
- package/build/compiler/{path.dcc4712bcc7b@0+0.wasm → path.1b5fd988b6f3@0+0.wasm} +0 -0
- package/build/compiler/program +21 -21
- package/build/compiler/prune.29dde307bdee@0+0.wasm +0 -0
- package/build/compiler/{reader.b535e61f99f4@0+0.wasm → reader.d256e69e09e2@0+0.wasm} +0 -0
- package/build/compiler/{roots.6d2942578055@0+0.wasm → roots.e366210c01d6@0+0.wasm} +0 -0
- package/build/compiler/{running.d73f7826cb74@0+0.wasm → running.b99787c2d180@0+0.wasm} +0 -0
- package/build/compiler/serialize.a12536bbbe9a@0+0.wasm +0 -0
- package/build/compiler/{sha256.5fc9d60f8bb2@0+0.wasm → sha256.f6c742932dde@0+0.wasm} +0 -0
- package/build/compiler/{substrate.4c780d6dd6d4@0+0.wasm → substrate.728c690187f2@0+0.wasm} +0 -0
- package/build/compiler/syntax.fadc832db29f@0+0.wasm +0 -0
- package/build/compiler/{writer.806bc85aa684@0+0.wasm → writer.550227768eb9@0+0.wasm} +0 -0
- package/build/sub/{base64.8fba03e1be0a@0+0.wasm → base64.454b045156d2@0+0.wasm} +0 -0
- package/build/sub/build.115aeefc15e8@0+0.wasm +0 -0
- package/build/sub/{chromium.e4db7d29897c@0+0.wasm → chromium.fc0bfea0fbe6@0+0.wasm} +0 -0
- package/build/sub/{common.91ddee6b7a67@0+0.wasm → common.997c21b0b8cf@0+0.wasm} +0 -0
- package/build/sub/deflate.3138a38325a1@0+0.wasm +0 -0
- package/build/sub/{doc.0b48bbac404b@0+0.wasm → doc.e3f9a998cd91@0+0.wasm} +0 -0
- package/build/sub/{doc.566f9861828e@0+0.wasm → doc.f18ad14060e9@0+0.wasm} +0 -0
- package/build/sub/env.861d55fff974@0+0.wasm +0 -0
- package/build/sub/events.2c981f6f1ec7@0+0.wasm +0 -0
- package/build/sub/{fetch.5d2f427c995e@0+0.wasm → fetch.b0ce8f8b3da8@0+0.wasm} +0 -0
- package/build/sub/fetch.d62aa5fc9623@0+0.wasm +0 -0
- package/build/sub/{files.30e55182c5df@0+0.wasm → files.1706cc0941c0@0+0.wasm} +0 -0
- package/build/sub/{fs.563034be70c3@0+0.wasm → fs.5017b627cbd2@0+0.wasm} +0 -0
- package/build/sub/{git.48aefa1644be@0+0.wasm → git.1c5791236e35@0+0.wasm} +0 -0
- package/build/sub/{grants.5bf25700d47c@0+0.wasm → grants.cd99dff2854e@0+0.wasm} +0 -0
- package/build/sub/{gzip.69588e97c35a@0+0.wasm → gzip.9ebea150f218@0+0.wasm} +0 -0
- package/build/sub/hash.ba8330dad9ff@0+0.wasm +0 -0
- package/build/sub/{html.20baa1dc7ca6@0+0.wasm → html.0b0362932a75@0+0.wasm} +0 -0
- package/build/sub/{html.c1671a102b4d@0+0.wasm → html.3b3c8d7d9971@0+0.wasm} +0 -0
- package/build/sub/{inflate.8899e0933792@0+0.wasm → inflate.3cfa17586072@0+0.wasm} +0 -0
- package/build/sub/{json.f15a29d99d8d@0+0.wasm → json.af2e0ae20084@0+0.wasm} +0 -0
- package/build/sub/manifest.6e014ac19e5d@0+0.wasm +0 -0
- package/build/sub/map.e582eae03ec2@0+0.wasm +0 -0
- package/build/sub/{pack.55992e8cc09c@0+0.wasm → pack.4295e4f5bdbd@0+0.wasm} +0 -0
- package/build/sub/{path.dcc4712bcc7b@0+0.wasm → path.1b5fd988b6f3@0+0.wasm} +0 -0
- package/build/sub/path.de22f6659534@0+0.wasm +0 -0
- package/build/sub/process.ca10ac0b8a62@0+0.wasm +0 -0
- package/build/sub/program +48 -48
- package/build/sub/read.279fafcda508@0+0.wasm +0 -0
- package/build/sub/{reader.b535e61f99f4@0+0.wasm → reader.d256e69e09e2@0+0.wasm} +0 -0
- package/build/sub/{root.9b713ec588c1@0+0.wasm → root.02141d04d568@0+0.wasm} +0 -0
- package/build/sub/{roots.6d2942578055@0+0.wasm → roots.e366210c01d6@0+0.wasm} +0 -0
- package/build/sub/{sha256.5fc9d60f8bb2@0+0.wasm → sha256.f6c742932dde@0+0.wasm} +0 -0
- package/build/sub/{sha512.b988b9dc6114@0+0.wasm → sha512.9fee24e95460@0+0.wasm} +0 -0
- package/build/sub/site.76aa8286c257@0+0.wasm +0 -0
- package/build/sub/{site.7c6d8c7747af@0+0.wasm → site.e6e415bc3170@0+0.wasm} +0 -0
- package/build/sub/{store.d4e845ff24ac@0+0.wasm → store.c48db3345968@0+0.wasm} +0 -0
- package/build/sub/{stream.4c07247477f7@0+0.wasm → stream.27fd2fe858e1@0+0.wasm} +0 -0
- package/build/sub/{sub.b57e17b6876b@0+0.wasm → sub.c0fb7310de12@0+0.wasm} +0 -0
- package/build/sub/{substrate.4c780d6dd6d4@0+0.wasm → substrate.728c690187f2@0+0.wasm} +0 -0
- package/build/sub/{syntax.9857f6784d63@0+0.wasm → syntax.fadc832db29f@0+0.wasm} +0 -0
- package/build/sub/tar.692c0e8827cd@0+0.wasm +0 -0
- package/build/sub/{test.0d9c079bb309@0+0.wasm → test.1fd2ff8123bf@0+0.wasm} +0 -0
- package/build/sub/{text.4ab70ac35b5a@0+0.wasm → text.8ff142d72fd7@0+0.wasm} +0 -0
- package/build/sub/{timer.3809bb17a7a1@0+0.wasm → timer.d3454726b3bf@0+0.wasm} +0 -0
- package/build/sub/{upgrade.18a5aa0dae89@0+0.wasm → upgrade.2a9219e6a45d@0+0.wasm} +0 -0
- package/build/sub/{utf8.524c475ecd40@0+0.wasm → utf8.e82afeb9e953@0+0.wasm} +0 -0
- package/build/sub/worker.ea1e11f8f5e2@0+0.wasm +0 -0
- package/build/sub/writer.550227768eb9@0+0.wasm +0 -0
- package/package.json +1 -1
- package/std/archive/tar.sub +14 -21
- package/std/compress/deflate.sub +10 -12
- package/std/encoding/json.sub +44 -65
- package/std/encoding/wire.sub +6 -8
- package/std/http/checks.sub +3 -3
- package/std/http/conditional.sub +2 -4
- package/std/http/cookie.sub +5 -7
- package/std/http/form.sub +7 -10
- package/std/http/http.sub +17 -24
- package/std/http/multipart.sub +5 -5
- package/std/http/route.sub +9 -9
- package/std/http/server.sub +7 -12
- package/std/http/session.sub +1 -4
- package/std/http/sse-client.sub +9 -14
- package/std/http/url.sub +10 -10
- package/std/http/websocket.sub +2 -5
- package/std/meta/type-info.sub +10 -10
- package/std/package/hash.sub +1 -1
- package/std/package/manifest.sub +14 -15
- package/std/package/map.sub +4 -8
- package/std/package/path.sub +1 -4
- package/std/package/read.sub +3 -8
- package/std/package/site.sub +5 -5
- package/std/test/compare.sub +9 -10
- package/std/test/page.sub +1 -1
- package/std/test/run.sub +1 -1
- package/std/test/test.sub +24 -17
- package/substrate/VERSION +1 -1
- package/substrate/compiler/binary.sub +5 -14
- package/substrate/compiler/checker.sub +204 -19
- package/substrate/compiler/compile.sub +8 -8
- package/substrate/compiler/expander.sub +21 -29
- package/substrate/compiler/link.sub +2 -2
- package/substrate/compiler/ops.sub +1 -1
- package/substrate/compiler/prune.sub +12 -17
- package/substrate/compiler/roots.sub +3 -2
- package/substrate/compiler/serialize.sub +1 -1
- package/substrate/compiler/substrate.sub +8 -13
- package/substrate/compiler/syntax.sub +8 -21
- package/substrate/host/fs.sub +8 -11
- package/substrate/host/grants.sub +25 -26
- package/substrate/host/node/process.sub +5 -6
- package/build/compiler/binary.3823f89ce414@0+0.wasm +0 -0
- package/build/compiler/checker.592d37dcbec9@0+0.wasm +0 -0
- package/build/compiler/compile.86a2b03b0c9b@0+0.wasm +0 -0
- package/build/compiler/expander.689d326e5a1b@0+0.wasm +0 -0
- package/build/compiler/prune.d4a3f9834095@0+0.wasm +0 -0
- package/build/compiler/serialize.b2196de75bc8@0+0.wasm +0 -0
- package/build/compiler/syntax.9857f6784d63@0+0.wasm +0 -0
- package/build/sub/build.84ac996eda63@0+0.wasm +0 -0
- package/build/sub/deflate.fc8075e3aed1@0+0.wasm +0 -0
- package/build/sub/env.f051f8166526@0+0.wasm +0 -0
- package/build/sub/events.f952172735e0@0+0.wasm +0 -0
- package/build/sub/fetch.097f1cc9502d@0+0.wasm +0 -0
- package/build/sub/hash.3f0d118da63f@0+0.wasm +0 -0
- package/build/sub/manifest.cf7471880377@0+0.wasm +0 -0
- package/build/sub/map.dc516eec27ff@0+0.wasm +0 -0
- package/build/sub/path.b7a8e1cf3aaa@0+0.wasm +0 -0
- package/build/sub/process.aea2c88cb7a0@0+0.wasm +0 -0
- package/build/sub/read.cd1e693f4fb4@0+0.wasm +0 -0
- package/build/sub/site.81548474c323@0+0.wasm +0 -0
- package/build/sub/tar.e482cf873cfc@0+0.wasm +0 -0
- package/build/sub/worker.f1190de21b21@0+0.wasm +0 -0
- package/build/sub/writer.806bc85aa684@0+0.wasm +0 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/build/compiler/program
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
substrate.
|
|
2
|
-
writer.
|
|
3
|
-
syntax.
|
|
4
|
-
path.
|
|
5
|
-
fs.
|
|
6
|
-
reader.
|
|
7
|
-
roots.
|
|
8
|
-
running.
|
|
9
|
-
core.
|
|
10
|
-
ops.
|
|
11
|
-
checker.
|
|
12
|
-
leb128.
|
|
13
|
-
binary.
|
|
14
|
-
serialize.
|
|
15
|
-
compile.
|
|
16
|
-
sha256.
|
|
17
|
-
link.
|
|
18
|
-
macros.
|
|
19
|
-
expander.
|
|
20
|
-
prune.
|
|
21
|
-
main.
|
|
1
|
+
substrate.728c690187f2@0+0
|
|
2
|
+
writer.550227768eb9@0+0
|
|
3
|
+
syntax.fadc832db29f@0+0
|
|
4
|
+
path.1b5fd988b6f3@0+0
|
|
5
|
+
fs.5017b627cbd2@0+0
|
|
6
|
+
reader.d256e69e09e2@0+0
|
|
7
|
+
roots.e366210c01d6@0+0
|
|
8
|
+
running.b99787c2d180@0+0
|
|
9
|
+
core.0410ffbdc488@0+0
|
|
10
|
+
ops.324f0a665fab@0+0
|
|
11
|
+
checker.2b0ea87ed311@0+0
|
|
12
|
+
leb128.ba77430f659f@0+0
|
|
13
|
+
binary.cdd2ffb408dd@0+0
|
|
14
|
+
serialize.a12536bbbe9a@0+0
|
|
15
|
+
compile.da85f9bc4478@0+0
|
|
16
|
+
sha256.f6c742932dde@0+0
|
|
17
|
+
link.be6e641afa93@0+0
|
|
18
|
+
macros.b695763c0ca3@0+0
|
|
19
|
+
expander.80707e1666d6@0+0
|
|
20
|
+
prune.29dde307bdee@0+0
|
|
21
|
+
main.cbbdf42e34c2@0+0
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/build/sub/program
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
substrate.
|
|
2
|
-
process.
|
|
3
|
-
path.
|
|
4
|
-
path.
|
|
5
|
-
fs.
|
|
6
|
-
common.
|
|
7
|
-
grants.
|
|
8
|
-
writer.
|
|
9
|
-
syntax.
|
|
10
|
-
reader.
|
|
11
|
-
roots.
|
|
12
|
-
read.
|
|
13
|
-
manifest.
|
|
14
|
-
git.
|
|
15
|
-
files.
|
|
16
|
-
sha256.
|
|
17
|
-
hash.
|
|
18
|
-
store.
|
|
19
|
-
map.
|
|
20
|
-
env.
|
|
21
|
-
events.
|
|
22
|
-
build.
|
|
23
|
-
pack.
|
|
24
|
-
site.
|
|
25
|
-
site.
|
|
26
|
-
fetch.
|
|
27
|
-
stream.
|
|
28
|
-
worker.
|
|
29
|
-
deflate.
|
|
30
|
-
inflate.
|
|
31
|
-
gzip.
|
|
32
|
-
tar.
|
|
33
|
-
fetch.
|
|
34
|
-
doc.
|
|
35
|
-
html.
|
|
36
|
-
html.
|
|
37
|
-
text.
|
|
38
|
-
root.
|
|
39
|
-
doc.
|
|
40
|
-
timer.
|
|
41
|
-
chromium.
|
|
42
|
-
test.
|
|
43
|
-
utf8.
|
|
44
|
-
json.
|
|
45
|
-
sha512.
|
|
46
|
-
base64.
|
|
47
|
-
upgrade.
|
|
48
|
-
sub.
|
|
1
|
+
substrate.728c690187f2@0+0
|
|
2
|
+
process.ca10ac0b8a62@0+0
|
|
3
|
+
path.1b5fd988b6f3@0+0
|
|
4
|
+
path.de22f6659534@0+0
|
|
5
|
+
fs.5017b627cbd2@0+0
|
|
6
|
+
common.997c21b0b8cf@0+0
|
|
7
|
+
grants.cd99dff2854e@0+0
|
|
8
|
+
writer.550227768eb9@0+0
|
|
9
|
+
syntax.fadc832db29f@0+0
|
|
10
|
+
reader.d256e69e09e2@0+0
|
|
11
|
+
roots.e366210c01d6@0+0
|
|
12
|
+
read.279fafcda508@0+0
|
|
13
|
+
manifest.6e014ac19e5d@0+0
|
|
14
|
+
git.1c5791236e35@0+0
|
|
15
|
+
files.1706cc0941c0@0+0
|
|
16
|
+
sha256.f6c742932dde@0+0
|
|
17
|
+
hash.ba8330dad9ff@0+0
|
|
18
|
+
store.c48db3345968@0+0
|
|
19
|
+
map.e582eae03ec2@0+0
|
|
20
|
+
env.861d55fff974@0+0
|
|
21
|
+
events.2c981f6f1ec7@0+0
|
|
22
|
+
build.115aeefc15e8@0+0
|
|
23
|
+
pack.4295e4f5bdbd@0+0
|
|
24
|
+
site.e6e415bc3170@0+0
|
|
25
|
+
site.76aa8286c257@0+0
|
|
26
|
+
fetch.d62aa5fc9623@0+0
|
|
27
|
+
stream.27fd2fe858e1@0+0
|
|
28
|
+
worker.ea1e11f8f5e2@0+0
|
|
29
|
+
deflate.3138a38325a1@0+0
|
|
30
|
+
inflate.3cfa17586072@0+0
|
|
31
|
+
gzip.9ebea150f218@0+0
|
|
32
|
+
tar.692c0e8827cd@0+0
|
|
33
|
+
fetch.b0ce8f8b3da8@0+0
|
|
34
|
+
doc.f18ad14060e9@0+0
|
|
35
|
+
html.3b3c8d7d9971@0+0
|
|
36
|
+
html.0b0362932a75@0+0
|
|
37
|
+
text.8ff142d72fd7@0+0
|
|
38
|
+
root.02141d04d568@0+0
|
|
39
|
+
doc.e3f9a998cd91@0+0
|
|
40
|
+
timer.d3454726b3bf@0+0
|
|
41
|
+
chromium.fc0bfea0fbe6@0+0
|
|
42
|
+
test.1fd2ff8123bf@0+0
|
|
43
|
+
utf8.e82afeb9e953@0+0
|
|
44
|
+
json.af2e0ae20084@0+0
|
|
45
|
+
sha512.9fee24e95460@0+0
|
|
46
|
+
base64.454b045156d2@0+0
|
|
47
|
+
upgrade.2a9219e6a45d@0+0
|
|
48
|
+
sub.c0fb7310de12@0+0
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
package/std/archive/tar.sub
CHANGED
|
@@ -2,13 +2,11 @@
|
|
|
2
2
|
;; names. tar-next! gives each entry in turn: a file with its bytes, a directory, or another kind, with its path.
|
|
3
3
|
(require-unqualified host/fs)
|
|
4
4
|
|
|
5
|
-
(provide tar-reader tar-entry tar-reader-init! tar-next! tar-file tar-directory tar-other tar-unpack!)
|
|
5
|
+
(provide tar-reader tar-entry tar-reader-init! tar-next! tar-kind tar-file tar-directory tar-other tar-unpack!)
|
|
6
6
|
|
|
7
|
-
(
|
|
8
|
-
(const tar-directory i32 2)
|
|
9
|
-
(const tar-other i32 3)
|
|
7
|
+
(enum tar-kind [tar-file 1] tar-directory tar-other)
|
|
10
8
|
|
|
11
|
-
(struct tar-entry [kind
|
|
9
|
+
(struct tar-entry [kind tar-kind] [path string] [bytes (slice u8)])
|
|
12
10
|
(struct tar-reader [data (slice u8)] [at u32])
|
|
13
11
|
|
|
14
12
|
(define (tar-reader-init! [r (ptr tar-reader)] [data (slice u8)])
|
|
@@ -36,7 +34,7 @@
|
|
|
36
34
|
(cond [(== type #\x)
|
|
37
35
|
(unless (pax! a body (& long) (& sized) (& given-size)) (return (bad! err "a pax header is not key=value records")))]
|
|
38
36
|
[(or (== type #\g) (== type #\K)) (begin)]
|
|
39
|
-
[(== type #\L) (set! long (
|
|
37
|
+
[(== type #\L) (set! long (cast string (copy a (until-zero body))))]
|
|
40
38
|
[else
|
|
41
39
|
(set! (-> e kind) (cond [(or (== type #\0) (== type 0) (== type #\7)) tar-file]
|
|
42
40
|
[(== type #\5) tar-directory]
|
|
@@ -91,11 +89,11 @@
|
|
|
91
89
|
(and (> (-> p length) (-> top length)) (== (slice p 0 (-> top length)) top) (== (@ p (-> top length)) #\/)))
|
|
92
90
|
|
|
93
91
|
(define (under [a (ptr arena)] [dir string] [p string]) -> string
|
|
94
|
-
(let ([out (
|
|
95
|
-
(memcpy out (-> dir bytes) (-> dir length))
|
|
92
|
+
(let ([out (new a u8 (+ (-> dir length) 1 (-> p length)))])
|
|
93
|
+
(memcpy (-> out items) (-> dir bytes) (-> dir length))
|
|
96
94
|
(set! (@ out (-> dir length)) #\/)
|
|
97
|
-
(memcpy (+ out (-> dir length) 1) (-> p bytes) (-> p length))
|
|
98
|
-
(cast string
|
|
95
|
+
(memcpy (+ (-> out items) (-> dir length) 1) (-> p bytes) (-> p length))
|
|
96
|
+
(cast string out)))
|
|
99
97
|
|
|
100
98
|
(define (up-to-last-slash [p string]) -> string
|
|
101
99
|
(let ([i (-> p length)])
|
|
@@ -154,7 +152,7 @@
|
|
|
154
152
|
(while (and (< eq (- end 1)) (!= (@ body eq) #\=)) (+= eq 1))
|
|
155
153
|
(when (>= eq (- end 1)) (return #f))
|
|
156
154
|
(let ([key (cast string (slice body (+ i 1) eq))] [value (cast string (slice body (+ eq 1) (- end 1)))])
|
|
157
|
-
(cond [(== key "path") (set! (@ path) (
|
|
155
|
+
(cond [(== key "path") (set! (@ path) (copy a value))]
|
|
158
156
|
[(== key "size")
|
|
159
157
|
(unless (decimal value size) (return #f))
|
|
160
158
|
(set! (@ sized) #t)]))
|
|
@@ -164,19 +162,14 @@
|
|
|
164
162
|
(define (header-path [a (ptr arena)] [h (slice u8)]) -> string
|
|
165
163
|
(let ([name (until-zero (slice h 0 100))] [prefix (until-zero (slice h 345 500))])
|
|
166
164
|
(if (and (== (cast string (slice h 257 263)) "ustar\x00;") (> (-> prefix length) 0))
|
|
167
|
-
(let ([out (
|
|
168
|
-
(memcpy out (-> prefix items) (-> prefix length))
|
|
165
|
+
(let ([out (new a u8 (+ (-> prefix length) 1 (-> name length)))])
|
|
166
|
+
(memcpy (-> out items) (-> prefix items) (-> prefix length))
|
|
169
167
|
(set! (@ out (-> prefix length)) #\/)
|
|
170
|
-
(memcpy (+ out (-> prefix length) 1) (-> name items) (-> name length))
|
|
171
|
-
(cast string
|
|
172
|
-
(
|
|
168
|
+
(memcpy (+ (-> out items) (-> prefix length) 1) (-> name items) (-> name length))
|
|
169
|
+
(cast string out))
|
|
170
|
+
(cast string (copy a name)))))
|
|
173
171
|
|
|
174
172
|
(define (until-zero [s (slice u8)]) -> (slice u8)
|
|
175
173
|
(let ([i u32 0])
|
|
176
174
|
(while (and (< i (-> s length)) (!= (@ s i) 0)) (+= i 1))
|
|
177
175
|
(slice s 0 i)))
|
|
178
|
-
|
|
179
|
-
(define (copied [a (ptr arena)] [s (slice u8)]) -> string
|
|
180
|
-
(let ([out (cast (ptr u8) (arena-alloc a (-> s length)))])
|
|
181
|
-
(memcpy out (-> s items) (-> s length))
|
|
182
|
-
(cast string (slice out (-> s length)))))
|
package/std/compress/deflate.sub
CHANGED
|
@@ -3,12 +3,10 @@
|
|
|
3
3
|
;; whichever is shortest. deflate! adds in's compressed form to out: deflate-none may hold some back, deflate-sync sends
|
|
4
4
|
;; everything and ends at a whole byte, deflate-finish ends the stream. deflater-reset! starts another stream, and
|
|
5
5
|
;; deflate-alone! compresses bytes as if nothing came before, ending as a sync, so one deflater serves many streams.
|
|
6
|
-
(provide deflater deflater-init! deflater-free! deflater-reset! deflate! deflate-alone! deflate-
|
|
7
|
-
deflate-finish)
|
|
6
|
+
(provide deflater deflater-init! deflater-free! deflater-reset! deflate! deflate-alone! deflate-flush deflate-none
|
|
7
|
+
deflate-sync deflate-finish)
|
|
8
8
|
|
|
9
|
-
(
|
|
10
|
-
(const deflate-sync i32 1)
|
|
11
|
-
(const deflate-finish i32 2)
|
|
9
|
+
(enum deflate-flush deflate-none deflate-sync deflate-finish)
|
|
12
10
|
|
|
13
11
|
(const wsize u32 32768)
|
|
14
12
|
(const wmask u32 32767)
|
|
@@ -155,10 +153,10 @@
|
|
|
155
153
|
(set! (-> d lazy) (@ settings (+ (* l 4) 1)))
|
|
156
154
|
(set! (-> d nice) (@ settings (+ (* l 4) 2)))
|
|
157
155
|
(set! (-> d chain) (@ settings (+ (* l 4) 3))))
|
|
158
|
-
(set! (-> d window) (
|
|
159
|
-
(set! (-> d head) (
|
|
160
|
-
(set! (-> d prev) (
|
|
161
|
-
(set! (-> d syms) (
|
|
156
|
+
(set! (-> d window) (malloc (+ (* 2 wsize) 272)))
|
|
157
|
+
(set! (-> d head) (-> (new 0 u16 hash-size) items))
|
|
158
|
+
(set! (-> d prev) (-> (new 0 u16 wsize) items))
|
|
159
|
+
(set! (-> d syms) (malloc (* (+ most-symbols 1) (sizeof u32))))
|
|
162
160
|
(set! (-> d strstart) 1)
|
|
163
161
|
(deflater-reset! d))
|
|
164
162
|
|
|
@@ -432,7 +430,7 @@
|
|
|
432
430
|
;; ---- matching ----
|
|
433
431
|
|
|
434
432
|
;; greedy! takes a match wherever it finds one, and returns #t when it waits for more of the stream.
|
|
435
|
-
(define (greedy! [d (ptr deflater)] [out (ptr buffer)] [in (slice u8)] [at (ptr u32)] [flush
|
|
433
|
+
(define (greedy! [d (ptr deflater)] [out (ptr buffer)] [in (slice u8)] [at (ptr u32)] [flush deflate-flush]) -> bool
|
|
436
434
|
(while #t
|
|
437
435
|
(when (< (-> d lookahead) min-lookahead)
|
|
438
436
|
(fill! d in at)
|
|
@@ -459,7 +457,7 @@
|
|
|
459
457
|
#f)
|
|
460
458
|
|
|
461
459
|
;; lazy! takes a match only when the next position has none longer.
|
|
462
|
-
(define (lazy! [d (ptr deflater)] [out (ptr buffer)] [in (slice u8)] [at (ptr u32)] [flush
|
|
460
|
+
(define (lazy! [d (ptr deflater)] [out (ptr buffer)] [in (slice u8)] [at (ptr u32)] [flush deflate-flush]) -> bool
|
|
463
461
|
(while #t
|
|
464
462
|
(when (< (-> d lookahead) min-lookahead)
|
|
465
463
|
(fill! d in at)
|
|
@@ -497,7 +495,7 @@
|
|
|
497
495
|
(set! (-> d available) #f))
|
|
498
496
|
#f)
|
|
499
497
|
|
|
500
|
-
(define (deflate! [d (ptr deflater)] [out (ptr buffer)] [in (slice u8)] [flush
|
|
498
|
+
(define (deflate! [d (ptr deflater)] [out (ptr buffer)] [in (slice u8)] [flush deflate-flush])
|
|
501
499
|
(let ([at u32 0])
|
|
502
500
|
(when (if (>= (-> d level) 4) (lazy! d out in (& at) flush) (greedy! d out in (& at) flush)) (return))
|
|
503
501
|
(cond [(== flush deflate-finish)
|