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.
- package/README.md +1 -1
- package/build/compiler/binary.2d43b43d1600@0+0.wasm +0 -0
- package/build/compiler/checker.4dd4556dd421@0+0.wasm +0 -0
- package/build/compiler/compile.5d8f6407af2a@0+0.wasm +0 -0
- package/build/compiler/{core.fc3dab9d1846@0+0.wasm → core.f2defb75e00b@0+0.wasm} +0 -0
- package/build/compiler/expander.967ce443d379@0+0.wasm +0 -0
- package/build/compiler/fs.01b8aab4a9a8@0+0.wasm +0 -0
- package/build/compiler/{leb128.748b1c37277a@0+0.wasm → leb128.15d814b7b4f2@0+0.wasm} +0 -0
- package/build/compiler/{link.11b643d35670@0+0.wasm → link.b826ea7c8f17@0+0.wasm} +0 -0
- package/build/compiler/{macros.4083601c00db@0+0.wasm → macros.b269e0c42784@0+0.wasm} +0 -0
- package/build/compiler/{main.ed62cce43000@0+0.wasm → main.4fc52f204d54@0+0.wasm} +0 -0
- package/build/compiler/{ops.b361e858d8e1@0+0.wasm → ops.515b5e05f646@0+0.wasm} +0 -0
- package/build/compiler/{path.dcc4712bcc7b@0+0.wasm → path.5a6286472cd4@0+0.wasm} +0 -0
- package/build/compiler/program +21 -21
- package/build/compiler/prune.406215c3e4f8@0+0.wasm +0 -0
- package/build/compiler/reader.694b03770bf0@0+0.wasm +0 -0
- package/build/compiler/roots.cefd10e93684@0+0.wasm +0 -0
- package/build/compiler/{running.d73f7826cb74@0+0.wasm → running.0d25dbaec018@0+0.wasm} +0 -0
- package/build/compiler/serialize.b0d82f3d63d2@0+0.wasm +0 -0
- package/build/compiler/{sha256.5fc9d60f8bb2@0+0.wasm → sha256.a6c32b04d799@0+0.wasm} +0 -0
- package/build/compiler/substrate.5ee5d0b4d3e7@0+0.wasm +0 -0
- package/build/compiler/syntax.32f3e40b61c7@0+0.wasm +0 -0
- package/build/compiler/{writer.806bc85aa684@0+0.wasm → writer.00b7802cbe39@0+0.wasm} +0 -0
- package/build/sub/{base64.8fba03e1be0a@0+0.wasm → base64.a26bdcf60a2d@0+0.wasm} +0 -0
- package/build/sub/build.459c5b9412bd@0+0.wasm +0 -0
- package/build/sub/chromium.3d5818f2707d@0+0.wasm +0 -0
- package/build/sub/common.1edc613607a0@0+0.wasm +0 -0
- package/build/sub/deflate.23f7c4679260@0+0.wasm +0 -0
- package/build/sub/doc.0775df5de6fe@0+0.wasm +0 -0
- package/build/sub/{doc.566f9861828e@0+0.wasm → doc.ef9965d5d402@0+0.wasm} +0 -0
- package/build/sub/env.e5451da6e747@0+0.wasm +0 -0
- package/build/sub/events.bf5473ebf220@0+0.wasm +0 -0
- package/build/sub/fetch.7790d4943758@0+0.wasm +0 -0
- package/build/sub/fetch.96b2d10f025e@0+0.wasm +0 -0
- package/build/sub/files.ad0469fdf6fa@0+0.wasm +0 -0
- package/build/sub/fs.01b8aab4a9a8@0+0.wasm +0 -0
- package/build/sub/git.dc4c0e757ebe@0+0.wasm +0 -0
- package/build/sub/grants.c54776c0d7e3@0+0.wasm +0 -0
- package/build/sub/gzip.16e372eda1cf@0+0.wasm +0 -0
- package/build/sub/hash.660682e4f491@0+0.wasm +0 -0
- package/build/sub/{html.20baa1dc7ca6@0+0.wasm → html.a23126eb949a@0+0.wasm} +0 -0
- package/build/sub/{html.c1671a102b4d@0+0.wasm → html.e9ed37f34977@0+0.wasm} +0 -0
- package/build/sub/{inflate.8899e0933792@0+0.wasm → inflate.59bb61f14001@0+0.wasm} +0 -0
- package/build/sub/json.55590d2f518a@0+0.wasm +0 -0
- package/build/sub/manifest.ef317480deb0@0+0.wasm +0 -0
- package/build/sub/map.f455cca6a42a@0+0.wasm +0 -0
- package/build/sub/pack.e02836264f6a@0+0.wasm +0 -0
- package/build/sub/{path.dcc4712bcc7b@0+0.wasm → path.5a6286472cd4@0+0.wasm} +0 -0
- package/build/sub/path.6891ffea73ca@0+0.wasm +0 -0
- package/build/sub/process.7106571fa723@0+0.wasm +0 -0
- package/build/sub/program +48 -48
- package/build/sub/read.0b93933d62a2@0+0.wasm +0 -0
- package/build/sub/{reader.b535e61f99f4@0+0.wasm → reader.694b03770bf0@0+0.wasm} +0 -0
- package/build/sub/{root.9b713ec588c1@0+0.wasm → root.f10a4906f460@0+0.wasm} +0 -0
- package/build/sub/{roots.6d2942578055@0+0.wasm → roots.cefd10e93684@0+0.wasm} +0 -0
- package/build/sub/{sha256.5fc9d60f8bb2@0+0.wasm → sha256.a6c32b04d799@0+0.wasm} +0 -0
- package/build/sub/{sha512.b988b9dc6114@0+0.wasm → sha512.c24a792d7891@0+0.wasm} +0 -0
- package/build/sub/site.1732b58ec0e8@0+0.wasm +0 -0
- package/build/sub/site.ae3913b0b0f4@0+0.wasm +0 -0
- package/build/sub/store.a24d7a25daa6@0+0.wasm +0 -0
- package/build/sub/stream.126e3bd5d626@0+0.wasm +0 -0
- package/build/sub/sub.2e3092140706@0+0.wasm +0 -0
- package/build/sub/substrate.5ee5d0b4d3e7@0+0.wasm +0 -0
- package/build/sub/{syntax.9857f6784d63@0+0.wasm → syntax.32f3e40b61c7@0+0.wasm} +0 -0
- package/build/sub/tar.2a633861e654@0+0.wasm +0 -0
- package/build/sub/test.9bd59c73f65e@0+0.wasm +0 -0
- package/build/sub/{text.4ab70ac35b5a@0+0.wasm → text.1bc90482bd43@0+0.wasm} +0 -0
- package/build/sub/{timer.3809bb17a7a1@0+0.wasm → timer.f35eb62ae446@0+0.wasm} +0 -0
- package/build/sub/upgrade.39ee449b00d5@0+0.wasm +0 -0
- package/build/sub/{utf8.524c475ecd40@0+0.wasm → utf8.e7216bd054e1@0+0.wasm} +0 -0
- package/build/sub/worker.762a9d642af0@0+0.wasm +0 -0
- package/build/sub/writer.00b7802cbe39@0+0.wasm +0 -0
- package/package.json +1 -1
- package/std/archive/tar.sub +44 -44
- package/std/browser/chromium.sub +5 -4
- package/std/browser/devtools.sub +24 -19
- package/std/compress/deflate.sub +10 -12
- package/std/compress/gzip.sub +18 -16
- package/std/compress/inflate.sub +7 -4
- package/std/crypto/password.sub +3 -3
- package/std/doc/doc.sub +2 -2
- package/std/encoding/json.sub +64 -73
- package/std/encoding/wire.sub +15 -15
- 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 +9 -12
- package/std/http/http.sub +17 -24
- package/std/http/multipart.sub +13 -15
- package/std/http/route.sub +18 -13
- package/std/http/server.sub +21 -23
- package/std/http/session.sub +3 -6
- package/std/http/sse-client.sub +9 -14
- package/std/http/static.sub +5 -5
- package/std/http/url.sub +10 -10
- package/std/http/websocket.sub +2 -5
- package/std/meta/derive.sub +0 -2
- package/std/meta/method.sub +41 -0
- package/std/meta/type-info.sub +30 -37
- package/std/package/files.sub +24 -25
- package/std/package/git.sub +26 -33
- package/std/package/hash.sub +9 -9
- package/std/package/manifest.sub +81 -57
- package/std/package/map.sub +5 -9
- package/std/package/pack.sub +13 -13
- package/std/package/path.sub +1 -4
- package/std/package/read.sub +10 -14
- package/std/package/site.sub +11 -11
- package/std/package/store.sub +16 -12
- package/std/package.sub +6 -6
- package/std/test/browser.sub +9 -8
- package/std/test/build.sub +2 -2
- package/std/test/compare.sub +9 -10
- package/std/test/page.sub +32 -27
- package/std/test/run.sub +9 -8
- package/std/test/test.sub +36 -30
- package/std/vector/vector.sub +75 -0
- package/substrate/VERSION +1 -1
- package/substrate/compiler/binary.sub +5 -14
- package/substrate/compiler/checker.sub +235 -222
- package/substrate/compiler/compile.sub +11 -11
- package/substrate/compiler/expander.sub +52 -78
- package/substrate/compiler/link.sub +2 -2
- package/substrate/compiler/main.sub +9 -9
- package/substrate/compiler/ops.sub +1 -1
- package/substrate/compiler/prune.sub +12 -17
- package/substrate/compiler/reader.sub +4 -4
- package/substrate/compiler/roots.sub +11 -10
- package/substrate/compiler/running.sub +1 -1
- package/substrate/compiler/serialize.sub +57 -50
- package/substrate/compiler/substrate.sub +60 -23
- package/substrate/compiler/syntax.sub +8 -21
- package/substrate/host/errors.mjs +3 -2
- package/substrate/host/events.sub +3 -16
- package/substrate/host/fs.mjs +5 -4
- package/substrate/host/fs.sub +142 -112
- package/substrate/host/grants.mjs +1 -1
- package/substrate/host/grants.sub +33 -33
- package/substrate/host/modules/fake.mjs +1 -1
- package/substrate/host/modules/websocket.mjs +4 -4
- package/substrate/host/modules/websocket.sub +8 -6
- package/substrate/host/node/env.mjs +12 -6
- package/substrate/host/node/env.sub +21 -16
- package/substrate/host/node/fs.mjs +1 -1
- package/substrate/host/node/net.mjs +2 -2
- package/substrate/host/node/net.sub +13 -6
- package/substrate/host/node/process.mjs +4 -4
- package/substrate/host/node/process.sub +28 -28
- package/substrate/host/node/signal.mjs +3 -2
- package/substrate/host/node/signal.sub +9 -6
- package/substrate/host/node/watch.mjs +1 -1
- package/substrate/host/node/watch.sub +11 -9
- package/substrate/host/stream.sub +2 -0
- package/substrate/host/subhost-core.mjs +9 -1
- package/substrate/host/web/clipboard.mjs +2 -2
- package/substrate/host/web/clipboard.sub +10 -3
- package/substrate/host/web/files.mjs +2 -2
- package/substrate/host/web/files.sub +6 -2
- package/substrate/host/web/fs.mjs +3 -3
- package/substrate/host/web/location.mjs +3 -1
- package/substrate/host/web/location.sub +8 -4
- package/substrate/host/worker-side.mjs +3 -1
- package/substrate/host/worker.mjs +6 -5
- package/substrate/host/worker.sub +10 -10
- 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/fs.563034be70c3@0+0.wasm +0 -0
- package/build/compiler/prune.d4a3f9834095@0+0.wasm +0 -0
- package/build/compiler/reader.b535e61f99f4@0+0.wasm +0 -0
- package/build/compiler/roots.6d2942578055@0+0.wasm +0 -0
- package/build/compiler/serialize.b2196de75bc8@0+0.wasm +0 -0
- package/build/compiler/substrate.4c780d6dd6d4@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/chromium.e4db7d29897c@0+0.wasm +0 -0
- package/build/sub/common.91ddee6b7a67@0+0.wasm +0 -0
- package/build/sub/deflate.fc8075e3aed1@0+0.wasm +0 -0
- package/build/sub/doc.0b48bbac404b@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/fetch.5d2f427c995e@0+0.wasm +0 -0
- package/build/sub/files.30e55182c5df@0+0.wasm +0 -0
- package/build/sub/fs.563034be70c3@0+0.wasm +0 -0
- package/build/sub/git.48aefa1644be@0+0.wasm +0 -0
- package/build/sub/grants.5bf25700d47c@0+0.wasm +0 -0
- package/build/sub/gzip.69588e97c35a@0+0.wasm +0 -0
- package/build/sub/hash.3f0d118da63f@0+0.wasm +0 -0
- package/build/sub/json.f15a29d99d8d@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/pack.55992e8cc09c@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.7c6d8c7747af@0+0.wasm +0 -0
- package/build/sub/site.81548474c323@0+0.wasm +0 -0
- package/build/sub/store.d4e845ff24ac@0+0.wasm +0 -0
- package/build/sub/stream.4c07247477f7@0+0.wasm +0 -0
- package/build/sub/sub.b57e17b6876b@0+0.wasm +0 -0
- package/build/sub/substrate.4c780d6dd6d4@0+0.wasm +0 -0
- package/build/sub/tar.e482cf873cfc@0+0.wasm +0 -0
- package/build/sub/test.0d9c079bb309@0+0.wasm +0 -0
- package/build/sub/upgrade.18a5aa0dae89@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
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# substrate-lang
|
|
2
2
|
|
|
3
3
|
Substrate is a Lisp for writing WebAssembly. It has C-like semantics
|
|
4
|
-
(modernized with
|
|
4
|
+
(modernized with variants and bounds-checked slices), combined with
|
|
5
5
|
Racket-style hygienic macros and module hooks for defining new languages and
|
|
6
6
|
DSLs. Its compiler is small (~11k LOC, <600 KiB of Wasm), very fast,
|
|
7
7
|
self-hosted, and runs in the browser.
|
|
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.5ee5d0b4d3e7@0+0
|
|
2
|
+
writer.00b7802cbe39@0+0
|
|
3
|
+
syntax.32f3e40b61c7@0+0
|
|
4
|
+
path.5a6286472cd4@0+0
|
|
5
|
+
fs.01b8aab4a9a8@0+0
|
|
6
|
+
reader.694b03770bf0@0+0
|
|
7
|
+
roots.cefd10e93684@0+0
|
|
8
|
+
running.0d25dbaec018@0+0
|
|
9
|
+
core.f2defb75e00b@0+0
|
|
10
|
+
ops.515b5e05f646@0+0
|
|
11
|
+
checker.4dd4556dd421@0+0
|
|
12
|
+
leb128.15d814b7b4f2@0+0
|
|
13
|
+
binary.2d43b43d1600@0+0
|
|
14
|
+
serialize.b0d82f3d63d2@0+0
|
|
15
|
+
compile.5d8f6407af2a@0+0
|
|
16
|
+
sha256.a6c32b04d799@0+0
|
|
17
|
+
link.b826ea7c8f17@0+0
|
|
18
|
+
macros.b269e0c42784@0+0
|
|
19
|
+
expander.967ce443d379@0+0
|
|
20
|
+
prune.406215c3e4f8@0+0
|
|
21
|
+
main.4fc52f204d54@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.5ee5d0b4d3e7@0+0
|
|
2
|
+
process.7106571fa723@0+0
|
|
3
|
+
path.5a6286472cd4@0+0
|
|
4
|
+
path.6891ffea73ca@0+0
|
|
5
|
+
fs.01b8aab4a9a8@0+0
|
|
6
|
+
common.1edc613607a0@0+0
|
|
7
|
+
grants.c54776c0d7e3@0+0
|
|
8
|
+
writer.00b7802cbe39@0+0
|
|
9
|
+
syntax.32f3e40b61c7@0+0
|
|
10
|
+
reader.694b03770bf0@0+0
|
|
11
|
+
roots.cefd10e93684@0+0
|
|
12
|
+
read.0b93933d62a2@0+0
|
|
13
|
+
manifest.ef317480deb0@0+0
|
|
14
|
+
git.dc4c0e757ebe@0+0
|
|
15
|
+
files.ad0469fdf6fa@0+0
|
|
16
|
+
sha256.a6c32b04d799@0+0
|
|
17
|
+
hash.660682e4f491@0+0
|
|
18
|
+
store.a24d7a25daa6@0+0
|
|
19
|
+
map.f455cca6a42a@0+0
|
|
20
|
+
env.e5451da6e747@0+0
|
|
21
|
+
events.bf5473ebf220@0+0
|
|
22
|
+
build.459c5b9412bd@0+0
|
|
23
|
+
pack.e02836264f6a@0+0
|
|
24
|
+
site.ae3913b0b0f4@0+0
|
|
25
|
+
site.1732b58ec0e8@0+0
|
|
26
|
+
fetch.7790d4943758@0+0
|
|
27
|
+
stream.126e3bd5d626@0+0
|
|
28
|
+
worker.762a9d642af0@0+0
|
|
29
|
+
deflate.23f7c4679260@0+0
|
|
30
|
+
inflate.59bb61f14001@0+0
|
|
31
|
+
gzip.16e372eda1cf@0+0
|
|
32
|
+
tar.2a633861e654@0+0
|
|
33
|
+
fetch.96b2d10f025e@0+0
|
|
34
|
+
doc.ef9965d5d402@0+0
|
|
35
|
+
html.e9ed37f34977@0+0
|
|
36
|
+
html.a23126eb949a@0+0
|
|
37
|
+
text.1bc90482bd43@0+0
|
|
38
|
+
root.f10a4906f460@0+0
|
|
39
|
+
doc.0775df5de6fe@0+0
|
|
40
|
+
timer.f35eb62ae446@0+0
|
|
41
|
+
chromium.3d5818f2707d@0+0
|
|
42
|
+
test.9bd59c73f65e@0+0
|
|
43
|
+
utf8.e7216bd054e1@0+0
|
|
44
|
+
json.55590d2f518a@0+0
|
|
45
|
+
sha512.c24a792d7891@0+0
|
|
46
|
+
base64.a26bdcf60a2d@0+0
|
|
47
|
+
upgrade.39ee449b00d5@0+0
|
|
48
|
+
sub.2e3092140706@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)])
|
|
@@ -16,15 +14,17 @@
|
|
|
16
14
|
(set! (-> r at) 0))
|
|
17
15
|
|
|
18
16
|
;; An entry's path is in a or the data, and a file's bytes are in the data.
|
|
19
|
-
(define (tar-next! [a (ptr arena)] [r (ptr tar-reader)] [e (ptr tar-entry)] [err (ptr buffer)])
|
|
17
|
+
(define (tar-next! [a (ptr arena)] [r (ptr tar-reader)] [e (ptr tar-entry)] [found (ptr bool)] [err (ptr buffer)])
|
|
18
|
+
-> bool
|
|
20
19
|
(let ([long string] [sized #f] [given-size u64 0])
|
|
20
|
+
(set! (@ found) #f)
|
|
21
21
|
(while #t
|
|
22
22
|
(let* ([data (-> r data)] [at (-> r at)] [left (- (-> data length) at)] [h (slice u8)] [size u64 0] [type u8 0]
|
|
23
23
|
[body (slice u8)] [next u64 0])
|
|
24
|
-
(when (== left 0) (return
|
|
24
|
+
(when (== left 0) (return #t))
|
|
25
25
|
(when (< left 512) (return (bad! err "the archive is cut short")))
|
|
26
26
|
(set! h (slice data at (+ at 512)))
|
|
27
|
-
(when (zeros? h) (return
|
|
27
|
+
(when (zeros? h) (return #t))
|
|
28
28
|
(unless (summed? h) (return (bad! err "a header's checksum is wrong")))
|
|
29
29
|
(unless (octal h 124 12 (& size)) (return (bad! err "a header's size is not a number")))
|
|
30
30
|
(when sized (set! size given-size))
|
|
@@ -36,45 +36,50 @@
|
|
|
36
36
|
(cond [(== type #\x)
|
|
37
37
|
(unless (pax! a body (& long) (& sized) (& given-size)) (return (bad! err "a pax header is not key=value records")))]
|
|
38
38
|
[(or (== type #\g) (== type #\K)) (begin)]
|
|
39
|
-
[(== type #\L) (set! long (
|
|
39
|
+
[(== type #\L) (set! long (cast string (copy a (until-zero body))))]
|
|
40
40
|
[else
|
|
41
41
|
(set! (-> e kind) (cond [(or (== type #\0) (== type 0) (== type #\7)) tar-file]
|
|
42
42
|
[(== type #\5) tar-directory]
|
|
43
43
|
[else tar-other]))
|
|
44
44
|
(set! (-> e path) (if (> (-> long length) 0) long (header-path a h)))
|
|
45
45
|
(set! (-> e bytes) (if (== (-> e kind) tar-file) body (slice body 0 0)))
|
|
46
|
-
(
|
|
46
|
+
(set! (@ found) #t)
|
|
47
|
+
(return #t)])))))
|
|
47
48
|
|
|
48
|
-
|
|
49
|
-
(
|
|
50
|
-
(let ([r tar-reader] [e tar-entry] [got i32 1] [top ""] [one #t] [why string])
|
|
49
|
+
(define (tar-unpack! [a (ptr arena)] [data (slice u8)] [dir string] [err (ptr buffer)]) -> bool
|
|
50
|
+
(let ([r tar-reader] [e tar-entry] [found #t] [top ""] [one #t] [why error] [reason (make-buffer)])
|
|
51
51
|
(tar-reader-init! (& r) data)
|
|
52
|
-
(while
|
|
53
|
-
(
|
|
54
|
-
|
|
52
|
+
(while found
|
|
53
|
+
(unless (tar-next! a (& r) (& e) (& found) (& reason))
|
|
54
|
+
(buffer-add-string! err "not a tar archive: ")
|
|
55
|
+
(buffer-add! err (buffer-bytes (& reason)))
|
|
56
|
+
(buffer-free! (& reason))
|
|
57
|
+
(return #f))
|
|
58
|
+
(when (and found (!= (-> e kind) tar-other))
|
|
55
59
|
(let ([p (cleaned (-> e path))])
|
|
56
60
|
(when (> (-> p length) 0)
|
|
57
61
|
(when (== (-> top length) 0) (set! top (first-part p)))
|
|
58
62
|
(unless (or (and (== p top) (== (-> e kind) tar-directory)) (inside-top? p top)) (set! one #f))))))
|
|
59
|
-
(
|
|
63
|
+
(buffer-free! (& reason))
|
|
60
64
|
(tar-reader-init! (& r) data)
|
|
61
|
-
(set!
|
|
62
|
-
(while
|
|
63
|
-
(
|
|
64
|
-
(when (and
|
|
65
|
+
(set! found #t)
|
|
66
|
+
(while found
|
|
67
|
+
(tar-next! a (& r) (& e) (& found) err)
|
|
68
|
+
(when (and found (!= (-> e kind) tar-other))
|
|
65
69
|
(let ([p (cleaned (-> e path))])
|
|
66
70
|
(when (and one (> (-> top length) 0)) (set! p (if (== p top) "" (slice p (+ (-> top length) 1)))))
|
|
67
71
|
(when (> (-> p length) 0)
|
|
68
72
|
(let ([full (under a dir p)])
|
|
69
|
-
(when (or (and (== (-> e kind) tar-directory) (
|
|
73
|
+
(when (or (and (== (-> e kind) tar-directory) (not (fs-make-dir full (& why))))
|
|
70
74
|
(and (== (-> e kind) tar-file)
|
|
71
|
-
(
|
|
72
|
-
|
|
75
|
+
(not (and (fs-make-dir (up-to-last-slash full) (& why))
|
|
76
|
+
(fs-write-file full (-> e bytes) (& why))))))
|
|
73
77
|
(buffer-add-string! err p)
|
|
74
78
|
(buffer-add-string! err ": ")
|
|
75
|
-
(buffer-add-string! err why)
|
|
76
|
-
(
|
|
77
|
-
|
|
79
|
+
(buffer-add-string! err (error-text (& why)))
|
|
80
|
+
(error-free! (& why))
|
|
81
|
+
(return #f)))))))
|
|
82
|
+
#t))
|
|
78
83
|
|
|
79
84
|
(define (cleaned [p string]) -> string
|
|
80
85
|
(let ([s p])
|
|
@@ -91,20 +96,20 @@
|
|
|
91
96
|
(and (> (-> p length) (-> top length)) (== (slice p 0 (-> top length)) top) (== (@ p (-> top length)) #\/)))
|
|
92
97
|
|
|
93
98
|
(define (under [a (ptr arena)] [dir string] [p string]) -> string
|
|
94
|
-
(let ([out (
|
|
95
|
-
(memcpy out (-> dir bytes) (-> dir length))
|
|
99
|
+
(let ([out (new a u8 (+ (-> dir length) 1 (-> p length)))])
|
|
100
|
+
(memcpy (-> out items) (-> dir bytes) (-> dir length))
|
|
96
101
|
(set! (@ out (-> dir length)) #\/)
|
|
97
|
-
(memcpy (+ out (-> dir length) 1) (-> p bytes) (-> p length))
|
|
98
|
-
(cast string
|
|
102
|
+
(memcpy (+ (-> out items) (-> dir length) 1) (-> p bytes) (-> p length))
|
|
103
|
+
(cast string out)))
|
|
99
104
|
|
|
100
105
|
(define (up-to-last-slash [p string]) -> string
|
|
101
106
|
(let ([i (-> p length)])
|
|
102
107
|
(while (and (> i 0) (!= (@ p (- i 1)) #\/)) (-= i 1))
|
|
103
108
|
(if (<= i 1) "/" (slice p 0 (- i 1)))))
|
|
104
109
|
|
|
105
|
-
(define (bad! [err (ptr buffer)] [why string]) ->
|
|
110
|
+
(define (bad! [err (ptr buffer)] [why string]) -> bool
|
|
106
111
|
(buffer-add-string! err why)
|
|
107
|
-
|
|
112
|
+
#f)
|
|
108
113
|
|
|
109
114
|
(define (zeros? [h (slice u8)]) -> bool
|
|
110
115
|
(for ([i u32 0]) (< i (-> h length)) (+= i 1) (when (!= (@ h i) 0) (return #f)))
|
|
@@ -154,7 +159,7 @@
|
|
|
154
159
|
(while (and (< eq (- end 1)) (!= (@ body eq) #\=)) (+= eq 1))
|
|
155
160
|
(when (>= eq (- end 1)) (return #f))
|
|
156
161
|
(let ([key (cast string (slice body (+ i 1) eq))] [value (cast string (slice body (+ eq 1) (- end 1)))])
|
|
157
|
-
(cond [(== key "path") (set! (@ path) (
|
|
162
|
+
(cond [(== key "path") (set! (@ path) (copy a value))]
|
|
158
163
|
[(== key "size")
|
|
159
164
|
(unless (decimal value size) (return #f))
|
|
160
165
|
(set! (@ sized) #t)]))
|
|
@@ -164,19 +169,14 @@
|
|
|
164
169
|
(define (header-path [a (ptr arena)] [h (slice u8)]) -> string
|
|
165
170
|
(let ([name (until-zero (slice h 0 100))] [prefix (until-zero (slice h 345 500))])
|
|
166
171
|
(if (and (== (cast string (slice h 257 263)) "ustar\x00;") (> (-> prefix length) 0))
|
|
167
|
-
(let ([out (
|
|
168
|
-
(memcpy out (-> prefix items) (-> prefix length))
|
|
172
|
+
(let ([out (new a u8 (+ (-> prefix length) 1 (-> name length)))])
|
|
173
|
+
(memcpy (-> out items) (-> prefix items) (-> prefix length))
|
|
169
174
|
(set! (@ out (-> prefix length)) #\/)
|
|
170
|
-
(memcpy (+ out (-> prefix length) 1) (-> name items) (-> name length))
|
|
171
|
-
(cast string
|
|
172
|
-
(
|
|
175
|
+
(memcpy (+ (-> out items) (-> prefix length) 1) (-> name items) (-> name length))
|
|
176
|
+
(cast string out))
|
|
177
|
+
(cast string (copy a name)))))
|
|
173
178
|
|
|
174
179
|
(define (until-zero [s (slice u8)]) -> (slice u8)
|
|
175
180
|
(let ([i u32 0])
|
|
176
181
|
(while (and (< i (-> s length)) (!= (@ s i) 0)) (+= i 1))
|
|
177
182
|
(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/browser/chromium.sub
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
[stopped (fn ((ptr chromium)))])
|
|
17
17
|
|
|
18
18
|
(define (chromium-start [c (ptr chromium)] [file string] [profile string] [args (slice string)] [ms f64]
|
|
19
|
-
[started (fn ((ptr chromium)))] [err (ptr
|
|
19
|
+
[started (fn ((ptr chromium)))] [err (ptr error)]) -> bool
|
|
20
20
|
(let ([argv (make-buffer)] [o process-options] [profile-flag (make-buffer)]
|
|
21
21
|
[fixed (slice (array-of string "--headless=new" "--remote-debugging-port=0" "--no-first-run"
|
|
22
22
|
"--no-default-browser-check" "--no-sandbox" "--mute-audio"
|
|
@@ -41,9 +41,10 @@
|
|
|
41
41
|
(process-options-init! (& o))
|
|
42
42
|
(set! (-> o stdin) process-ignore)
|
|
43
43
|
(set! (-> o stdout) process-ignore)
|
|
44
|
-
(
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
(let ([spawned (process-spawn file (strings-in (& argv)) (& o) (cast (ptr void) (& (-> c head))) (& (-> c id))
|
|
45
|
+
err)])
|
|
46
|
+
(buffer-free! (& argv))
|
|
47
|
+
(unless spawned (return #f)))
|
|
47
48
|
(set! (-> c running) #t)
|
|
48
49
|
(stream-tag! (process-stderr (-> c id)) (cast (ptr void) (& (-> c head))))
|
|
49
50
|
(stream-read! (process-stderr (-> c id)) (slice (-> c chunk)))
|