nish 0.27.2 → 0.29.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 +7 -6
- package/docs/AI.md +118 -26
- package/docs/INSTALL.md +16 -8
- package/llms.txt +4 -2
- package/package.json +5 -6
- package/runtime/core/host.d.ts +2 -1
- package/runtime/core/host.mjs +4 -0
- package/runtime/core.d.ts +47 -0
- package/runtime/core.mjs +67 -0
- package/runtime/nish.d.ts +176 -0
- package/runtime/nish.h +120 -6
- package/runtime/nish.mjs +24 -4
- package/runtime/runtime-checksum.c +270 -0
- package/runtime/runtime-net.c +386 -5
- package/runtime/runtime-os.c +59 -8
- package/runtime/runtime-parallel.c +81 -5
- package/runtime/runtime-sandbox.c +479 -0
- package/runtime/runtime-sha256.c +239 -0
- package/runtime/runtime-shm.c +541 -0
- package/runtime/runtime.c +827 -791
- package/scripts/build.sh +79 -28
- package/scripts/changelog-gen.mjs +71 -18
- package/scripts/fuzz.sh +4 -0
- package/scripts/gen-pow10-table.py +80 -0
- package/scripts/gen-regex-unicode.mjs +822 -0
- package/scripts/gen-union-scale.mjs +294 -0
- package/scripts/size-report.sh +2 -2
- package/std/README.md +25 -13
- package/std/collections.ts +5 -5
- package/std/compress/checksum.ts +88 -75
- package/std/compress/deflate.ts +224 -0
- package/std/compress/gzip.ts +52 -0
- package/std/crypto/bcrypt.ts +816 -280
- package/std/crypto/hmac.ts +305 -2
- package/std/crypto/jwt.ts +1661 -0
- package/std/json-equal.ts +335 -0
- package/std/json-format.ts +1070 -0
- package/std/json-number.ts +428 -0
- package/std/json-pointer.ts +245 -0
- package/std/json-typed.ts +34 -0
- package/std/json-value.ts +510 -17
- package/std/json.ts +35 -6
- package/std/net/handler.ts +1348 -0
- package/std/net/http-client.ts +97 -16
- package/std/net/http-compress.ts +301 -16
- package/std/net/http1-client.ts +104 -19
- package/std/net/http1-server.ts +127 -24
- package/std/net/http1.ts +24 -4
- package/std/net/outbound.ts +409 -0
- package/std/net/postgres.ts +405 -0
- package/std/net/prefork.ts +344 -20
- package/std/net/websocket.ts +295 -14
- package/std/regex.ts +613 -52
- package/std/secret.ts +1 -1
- package/std/sync/ring.ts +587 -0
- package/std/sync/shm.ts +284 -0
- package/std/term-io.ts +35 -8
- package/std/term-rate.ts +13 -1
- package/std/threads.ts +35 -3
- package/std/yaml-json.ts +841 -0
- package/scripts/gen-pow5-tables.py +0 -50
- /package/runtime/{LICENSE-ryu → LICENSE-zmij} +0 -0
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
"""Regenerate the two power-of-five tables `runtime/runtime.c` uses for Ryu.
|
|
3
|
-
|
|
4
|
-
python3 scripts/gen-pow5-tables.py
|
|
5
|
-
|
|
6
|
-
Prints the C to stdout; paste it over the `NISH_POW5_INV_SPLIT` and
|
|
7
|
-
`NISH_POW5_SPLIT` definitions. The point of having this in the tree is that
|
|
8
|
-
the ~10 KB of constants in the runtime are *derived*, with exact integer
|
|
9
|
-
arithmetic, rather than transcribed from somewhere -- so a reader can check
|
|
10
|
-
them rather than trust them. See docs/wp15-performance.md section 7a.
|
|
11
|
-
|
|
12
|
-
The code that reads the tables is adapted from Ryu (ryu/d2s.c and
|
|
13
|
-
ryu/common.h, Copyright 2018 Ulf Adams) under the Boost Software License,
|
|
14
|
-
Version 1.0; runtime/LICENSE-ryu has the text and THIRD_PARTY_NOTICES.md the
|
|
15
|
-
entry.
|
|
16
|
-
"""
|
|
17
|
-
INV_BITCOUNT = 125
|
|
18
|
-
BITCOUNT = 125
|
|
19
|
-
M = (1 << 64) - 1
|
|
20
|
-
|
|
21
|
-
def pow5bits(i):
|
|
22
|
-
return (5 ** i).bit_length()
|
|
23
|
-
|
|
24
|
-
inv = []
|
|
25
|
-
for i in range(292):
|
|
26
|
-
p = 5 ** i
|
|
27
|
-
j = p.bit_length() - 1 + INV_BITCOUNT
|
|
28
|
-
v = (1 << j) // p + 1
|
|
29
|
-
assert v >> 128 == 0, i
|
|
30
|
-
inv.append((v & M, v >> 64))
|
|
31
|
-
|
|
32
|
-
spl = []
|
|
33
|
-
for i in range(326):
|
|
34
|
-
p = 5 ** i
|
|
35
|
-
j = p.bit_length() - BITCOUNT
|
|
36
|
-
v = p << -j if j < 0 else p >> j
|
|
37
|
-
assert v >> 128 == 0, i
|
|
38
|
-
spl.append((v & M, v >> 64))
|
|
39
|
-
|
|
40
|
-
def emit(name, rows):
|
|
41
|
-
out = [f"static const uint64_t {name}[{len(rows)}][2] = {{"]
|
|
42
|
-
for lo, hi in rows:
|
|
43
|
-
out.append(f" {{ {lo}u, {hi}u }},")
|
|
44
|
-
out.append("};")
|
|
45
|
-
return "\n".join(out)
|
|
46
|
-
|
|
47
|
-
print("/* Generated by scripts/gen-pow5-tables.py; do not hand-edit. */")
|
|
48
|
-
print(emit("NISH_POW5_INV_SPLIT", inv))
|
|
49
|
-
print()
|
|
50
|
-
print(emit("NISH_POW5_SPLIT", spl))
|
|
File without changes
|