visaljs 0.0.0-stage → 0.0.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/LICENSE +21 -0
- package/README.md +45 -2
- package/cli.js +8084 -0
- package/node/include/js_node.h +46 -0
- package/node/prelude/async_hooks.js +88 -0
- package/node/prelude/buffer.js +31 -0
- package/node/prelude/crypto.js +114 -0
- package/node/prelude/events.js +227 -0
- package/node/prelude/fs.js +79 -0
- package/node/prelude/http.js +536 -0
- package/node/prelude/http2.js +30 -0
- package/node/prelude/internal/crypto/asym.js +333 -0
- package/node/prelude/internal/crypto/cipher.js +205 -0
- package/node/prelude/internal/crypto/hash.js +137 -0
- package/node/prelude/internal/crypto/kdf.js +182 -0
- package/node/prelude/internal/crypto/keys.js +603 -0
- package/node/prelude/internal/crypto/random.js +118 -0
- package/node/prelude/internal/crypto/util.js +76 -0
- package/node/prelude/internal/errors.js +88 -0
- package/node/prelude/internal/querystring.js +105 -0
- package/node/prelude/module.js +53 -0
- package/node/prelude/net.js +51 -0
- package/node/prelude/os.js +129 -0
- package/node/prelude/path.js +257 -0
- package/node/prelude/process.js +21 -0
- package/node/prelude/querystring.js +469 -0
- package/node/prelude/stream.js +1327 -0
- package/node/prelude/stream_promises.js +7 -0
- package/node/prelude/stream_web.js +6 -0
- package/node/prelude/string_decoder.js +236 -0
- package/node/prelude/tty.js +18 -0
- package/node/prelude/url.js +1156 -0
- package/node/prelude/util.js +64 -0
- package/node/prelude/zlib.js +81 -0
- package/node/src/host_fs.c +126 -0
- package/node/src/host_http.c +486 -0
- package/node/src/host_os.c +505 -0
- package/node/src/host_sys.c +78 -0
- package/node/third_party/libuv/LICENSE +19 -0
- package/node/third_party/libuv/include/uv/aix.h +32 -0
- package/node/third_party/libuv/include/uv/bsd.h +34 -0
- package/node/third_party/libuv/include/uv/darwin.h +61 -0
- package/node/third_party/libuv/include/uv/errno.h +483 -0
- package/node/third_party/libuv/include/uv/linux.h +34 -0
- package/node/third_party/libuv/include/uv/os390.h +33 -0
- package/node/third_party/libuv/include/uv/posix.h +31 -0
- package/node/third_party/libuv/include/uv/sunos.h +44 -0
- package/node/third_party/libuv/include/uv/threadpool.h +37 -0
- package/node/third_party/libuv/include/uv/tree.h +521 -0
- package/node/third_party/libuv/include/uv/unix.h +512 -0
- package/node/third_party/libuv/include/uv/version.h +43 -0
- package/node/third_party/libuv/include/uv/win.h +698 -0
- package/node/third_party/libuv/include/uv.h +1990 -0
- package/node/third_party/libuv/src/fs-poll.c +290 -0
- package/node/third_party/libuv/src/heap-inl.h +245 -0
- package/node/third_party/libuv/src/idna.c +560 -0
- package/node/third_party/libuv/src/idna.h +31 -0
- package/node/third_party/libuv/src/inet.c +298 -0
- package/node/third_party/libuv/src/queue.h +90 -0
- package/node/third_party/libuv/src/random.c +123 -0
- package/node/third_party/libuv/src/strscpy.c +38 -0
- package/node/third_party/libuv/src/strscpy.h +39 -0
- package/node/third_party/libuv/src/strtok.c +52 -0
- package/node/third_party/libuv/src/strtok.h +27 -0
- package/node/third_party/libuv/src/thread-common.c +175 -0
- package/node/third_party/libuv/src/threadpool.c +419 -0
- package/node/third_party/libuv/src/timer.c +200 -0
- package/node/third_party/libuv/src/unix/async.c +418 -0
- package/node/third_party/libuv/src/unix/bsd-ifaddrs.c +164 -0
- package/node/third_party/libuv/src/unix/core.c +2104 -0
- package/node/third_party/libuv/src/unix/darwin-proctitle.c +176 -0
- package/node/third_party/libuv/src/unix/darwin-stub.h +97 -0
- package/node/third_party/libuv/src/unix/darwin-syscalls.h +17 -0
- package/node/third_party/libuv/src/unix/darwin.c +237 -0
- package/node/third_party/libuv/src/unix/dl.c +80 -0
- package/node/third_party/libuv/src/unix/fs.c +2303 -0
- package/node/third_party/libuv/src/unix/fsevents.c +906 -0
- package/node/third_party/libuv/src/unix/getaddrinfo.c +252 -0
- package/node/third_party/libuv/src/unix/getnameinfo.c +121 -0
- package/node/third_party/libuv/src/unix/internal.h +530 -0
- package/node/third_party/libuv/src/unix/kqueue.c +667 -0
- package/node/third_party/libuv/src/unix/linux.c +2761 -0
- package/node/third_party/libuv/src/unix/loop-watcher.c +68 -0
- package/node/third_party/libuv/src/unix/loop.c +240 -0
- package/node/third_party/libuv/src/unix/pipe.c +555 -0
- package/node/third_party/libuv/src/unix/poll.c +159 -0
- package/node/third_party/libuv/src/unix/process.c +1123 -0
- package/node/third_party/libuv/src/unix/procfs-exepath.c +45 -0
- package/node/third_party/libuv/src/unix/proctitle.c +157 -0
- package/node/third_party/libuv/src/unix/random-devurandom.c +93 -0
- package/node/third_party/libuv/src/unix/random-getentropy.c +57 -0
- package/node/third_party/libuv/src/unix/random-getrandom.c +86 -0
- package/node/third_party/libuv/src/unix/random-sysctl-linux.c +99 -0
- package/node/third_party/libuv/src/unix/signal.c +581 -0
- package/node/third_party/libuv/src/unix/stream.c +1567 -0
- package/node/third_party/libuv/src/unix/tcp.c +673 -0
- package/node/third_party/libuv/src/unix/thread.c +975 -0
- package/node/third_party/libuv/src/unix/tty.c +510 -0
- package/node/third_party/libuv/src/unix/udp.c +1434 -0
- package/node/third_party/libuv/src/uv-common.c +1051 -0
- package/node/third_party/libuv/src/uv-common.h +474 -0
- package/node/third_party/libuv/src/uv-data-getter-setters.c +119 -0
- package/node/third_party/libuv/src/version.c +45 -0
- package/node/third_party/llhttp/LICENSE +22 -0
- package/node/third_party/llhttp/api.c +509 -0
- package/node/third_party/llhttp/http.c +170 -0
- package/node/third_party/llhttp/llhttp.c +10099 -0
- package/node/third_party/llhttp/llhttp.h +907 -0
- package/package.json +25 -4
- package/runtime/include/js_atoms.gen.h +68 -0
- package/runtime/include/js_atoms.h +54 -0
- package/runtime/include/js_bigint.h +93 -0
- package/runtime/include/js_buffer.h +79 -0
- package/runtime/include/js_builtins.h +168 -0
- package/runtime/include/js_console.h +58 -0
- package/runtime/include/js_convert.h +22 -0
- package/runtime/include/js_core.def +188 -0
- package/runtime/include/js_crypto.h +58 -0
- package/runtime/include/js_error.h +37 -0
- package/runtime/include/js_exception.h +65 -0
- package/runtime/include/js_function.h +167 -0
- package/runtime/include/js_gc.h +195 -0
- package/runtime/include/js_generator.h +96 -0
- package/runtime/include/js_host.h +19 -0
- package/runtime/include/js_jobs.h +84 -0
- package/runtime/include/js_module.h +16 -0
- package/runtime/include/js_object.h +384 -0
- package/runtime/include/js_ops.h +111 -0
- package/runtime/include/js_promise.h +45 -0
- package/runtime/include/js_regexp.h +25 -0
- package/runtime/include/js_runtime.h +30 -0
- package/runtime/include/js_symbol.h +62 -0
- package/runtime/include/js_web.h +110 -0
- package/runtime/include/jscell.h +48 -0
- package/runtime/include/jscontext.h +240 -0
- package/runtime/include/jsnum.h +42 -0
- package/runtime/include/jsstring.h +161 -0
- package/runtime/include/jsvalue.h +142 -0
- package/runtime/src/arguments.c +115 -0
- package/runtime/src/array.c +1145 -0
- package/runtime/src/arraybuffer.c +608 -0
- package/runtime/src/async_iter.c +479 -0
- package/runtime/src/atoms.c +157 -0
- package/runtime/src/base64.c +107 -0
- package/runtime/src/bigint.c +1189 -0
- package/runtime/src/blob.c +371 -0
- package/runtime/src/buffer.c +1357 -0
- package/runtime/src/builtin_table.c +100 -0
- package/runtime/src/builtins.c +987 -0
- package/runtime/src/builtins_util.h +53 -0
- package/runtime/src/collections.c +912 -0
- package/runtime/src/components.c +28 -0
- package/runtime/src/console.c +637 -0
- package/runtime/src/convert.c +82 -0
- package/runtime/src/core_all.c +21 -0
- package/runtime/src/crypto.c +116 -0
- package/runtime/src/crypto_asym.c +644 -0
- package/runtime/src/crypto_cipher.c +671 -0
- package/runtime/src/crypto_hash.c +260 -0
- package/runtime/src/crypto_host.c +414 -0
- package/runtime/src/crypto_internal.h +304 -0
- package/runtime/src/crypto_kdf.c +143 -0
- package/runtime/src/crypto_key.c +171 -0
- package/runtime/src/crypto_pkey.c +794 -0
- package/runtime/src/crypto_subtle.c +1675 -0
- package/runtime/src/date.c +940 -0
- package/runtime/src/domexception.c +169 -0
- package/runtime/src/elements.c +312 -0
- package/runtime/src/elements.h +45 -0
- package/runtime/src/encoding.c +485 -0
- package/runtime/src/error.c +297 -0
- package/runtime/src/events.c +793 -0
- package/runtime/src/exception.c +56 -0
- package/runtime/src/fetch.c +772 -0
- package/runtime/src/function.c +530 -0
- package/runtime/src/gc.c +803 -0
- package/runtime/src/generator.c +218 -0
- package/runtime/src/global.c +119 -0
- package/runtime/src/headers.c +557 -0
- package/runtime/src/inspect.c +1792 -0
- package/runtime/src/internal.h +80 -0
- package/runtime/src/iterate.c +94 -0
- package/runtime/src/iterator.c +409 -0
- package/runtime/src/jobs.c +337 -0
- package/runtime/src/jsnum.c +353 -0
- package/runtime/src/json.c +1028 -0
- package/runtime/src/math.c +243 -0
- package/runtime/src/module.c +336 -0
- package/runtime/src/number.c +176 -0
- package/runtime/src/object.c +1265 -0
- package/runtime/src/ops.c +322 -0
- package/runtime/src/os.c +196 -0
- package/runtime/src/os.h +29 -0
- package/runtime/src/process.c +432 -0
- package/runtime/src/promise.c +721 -0
- package/runtime/src/proxy.c +570 -0
- package/runtime/src/reflect.c +194 -0
- package/runtime/src/regexp.c +1141 -0
- package/runtime/src/regexp_anchor.h +34 -0
- package/runtime/src/regexp_message.h +32 -0
- package/runtime/src/shape.c +294 -0
- package/runtime/src/shape.h +46 -0
- package/runtime/src/streams.c +1046 -0
- package/runtime/src/streams.h +47 -0
- package/runtime/src/string.c +364 -0
- package/runtime/src/string_builtins.c +837 -0
- package/runtime/src/symbol.c +143 -0
- package/runtime/src/test_host.c +59 -0
- package/runtime/src/typedarray.c +1330 -0
- package/runtime/src/tznames.gen.h +712 -0
- package/runtime/src/uri.c +169 -0
- package/runtime/src/url.c +2116 -0
- package/runtime/src/weak.c +486 -0
- package/runtime/src/web.c +214 -0
- package/runtime/src/wrapper.c +59 -0
- package/runtime/src/writable.c +1486 -0
- package/runtime/third_party/ada-idna/LICENSE-MIT +18 -0
- package/runtime/third_party/ada-idna/README.md +27 -0
- package/runtime/third_party/ada-idna/convert.mjs +83 -0
- package/runtime/third_party/ada-idna/idna.c +416 -0
- package/runtime/third_party/ada-idna/idna.h +15 -0
- package/runtime/third_party/ada-idna/idna_tables.h +2657 -0
- package/runtime/third_party/bearssl/LICENSE.txt +21 -0
- package/runtime/third_party/bearssl/README.txt +136 -0
- package/runtime/third_party/bearssl/VERSION +1 -0
- package/runtime/third_party/bearssl/inc/bearssl.h +183 -0
- package/runtime/third_party/bearssl/inc/bearssl_aead.h +1059 -0
- package/runtime/third_party/bearssl/inc/bearssl_block.h +2618 -0
- package/runtime/third_party/bearssl/inc/bearssl_ec.h +967 -0
- package/runtime/third_party/bearssl/inc/bearssl_hash.h +1346 -0
- package/runtime/third_party/bearssl/inc/bearssl_hmac.h +241 -0
- package/runtime/third_party/bearssl/inc/bearssl_kdf.h +284 -0
- package/runtime/third_party/bearssl/inc/bearssl_pem.h +294 -0
- package/runtime/third_party/bearssl/inc/bearssl_prf.h +150 -0
- package/runtime/third_party/bearssl/inc/bearssl_rand.h +397 -0
- package/runtime/third_party/bearssl/inc/bearssl_rsa.h +1655 -0
- package/runtime/third_party/bearssl/inc/bearssl_ssl.h +4296 -0
- package/runtime/third_party/bearssl/inc/bearssl_x509.h +1474 -0
- package/runtime/third_party/bearssl/src/aead/ccm.c +346 -0
- package/runtime/third_party/bearssl/src/aead/eax.c +525 -0
- package/runtime/third_party/bearssl/src/aead/gcm.c +318 -0
- package/runtime/third_party/bearssl/src/codec/ccopy.c +44 -0
- package/runtime/third_party/bearssl/src/codec/dec16be.c +38 -0
- package/runtime/third_party/bearssl/src/codec/dec16le.c +38 -0
- package/runtime/third_party/bearssl/src/codec/dec32be.c +38 -0
- package/runtime/third_party/bearssl/src/codec/dec32le.c +38 -0
- package/runtime/third_party/bearssl/src/codec/dec64be.c +38 -0
- package/runtime/third_party/bearssl/src/codec/dec64le.c +38 -0
- package/runtime/third_party/bearssl/src/codec/enc16be.c +38 -0
- package/runtime/third_party/bearssl/src/codec/enc16le.c +38 -0
- package/runtime/third_party/bearssl/src/codec/enc32be.c +38 -0
- package/runtime/third_party/bearssl/src/codec/enc32le.c +38 -0
- package/runtime/third_party/bearssl/src/codec/enc64be.c +38 -0
- package/runtime/third_party/bearssl/src/codec/enc64le.c +38 -0
- package/runtime/third_party/bearssl/src/codec/pemdec.c +526 -0
- package/runtime/third_party/bearssl/src/codec/pemdec.t0 +314 -0
- package/runtime/third_party/bearssl/src/codec/pemenc.c +173 -0
- package/runtime/third_party/bearssl/src/config.h +247 -0
- package/runtime/third_party/bearssl/src/ec/ec_all_m15.c +121 -0
- package/runtime/third_party/bearssl/src/ec/ec_all_m31.c +171 -0
- package/runtime/third_party/bearssl/src/ec/ec_c25519_i15.c +398 -0
- package/runtime/third_party/bearssl/src/ec/ec_c25519_i31.c +390 -0
- package/runtime/third_party/bearssl/src/ec/ec_c25519_m15.c +1478 -0
- package/runtime/third_party/bearssl/src/ec/ec_c25519_m31.c +800 -0
- package/runtime/third_party/bearssl/src/ec/ec_c25519_m62.c +605 -0
- package/runtime/third_party/bearssl/src/ec/ec_c25519_m64.c +831 -0
- package/runtime/third_party/bearssl/src/ec/ec_curve25519.c +46 -0
- package/runtime/third_party/bearssl/src/ec/ec_default.c +36 -0
- package/runtime/third_party/bearssl/src/ec/ec_keygen.c +86 -0
- package/runtime/third_party/bearssl/src/ec/ec_p256_m15.c +2124 -0
- package/runtime/third_party/bearssl/src/ec/ec_p256_m31.c +1469 -0
- package/runtime/third_party/bearssl/src/ec/ec_p256_m62.c +1765 -0
- package/runtime/third_party/bearssl/src/ec/ec_p256_m64.c +1781 -0
- package/runtime/third_party/bearssl/src/ec/ec_prime_i15.c +824 -0
- package/runtime/third_party/bearssl/src/ec/ec_prime_i31.c +826 -0
- package/runtime/third_party/bearssl/src/ec/ec_pubkey.c +85 -0
- package/runtime/third_party/bearssl/src/ec/ec_secp256r1.c +51 -0
- package/runtime/third_party/bearssl/src/ec/ec_secp384r1.c +57 -0
- package/runtime/third_party/bearssl/src/ec/ec_secp521r1.c +64 -0
- package/runtime/third_party/bearssl/src/ec/ecdsa_atr.c +134 -0
- package/runtime/third_party/bearssl/src/ec/ecdsa_default_sign_asn1.c +36 -0
- package/runtime/third_party/bearssl/src/ec/ecdsa_default_sign_raw.c +36 -0
- package/runtime/third_party/bearssl/src/ec/ecdsa_default_vrfy_asn1.c +36 -0
- package/runtime/third_party/bearssl/src/ec/ecdsa_default_vrfy_raw.c +36 -0
- package/runtime/third_party/bearssl/src/ec/ecdsa_i15_bits.c +47 -0
- package/runtime/third_party/bearssl/src/ec/ecdsa_i15_sign_asn1.c +45 -0
- package/runtime/third_party/bearssl/src/ec/ecdsa_i15_sign_raw.c +174 -0
- package/runtime/third_party/bearssl/src/ec/ecdsa_i15_vrfy_asn1.c +48 -0
- package/runtime/third_party/bearssl/src/ec/ecdsa_i15_vrfy_raw.c +166 -0
- package/runtime/third_party/bearssl/src/ec/ecdsa_i31_bits.c +47 -0
- package/runtime/third_party/bearssl/src/ec/ecdsa_i31_sign_asn1.c +45 -0
- package/runtime/third_party/bearssl/src/ec/ecdsa_i31_sign_raw.c +173 -0
- package/runtime/third_party/bearssl/src/ec/ecdsa_i31_vrfy_asn1.c +48 -0
- package/runtime/third_party/bearssl/src/ec/ecdsa_i31_vrfy_raw.c +165 -0
- package/runtime/third_party/bearssl/src/ec/ecdsa_rta.c +121 -0
- package/runtime/third_party/bearssl/src/hash/dig_oid.c +84 -0
- package/runtime/third_party/bearssl/src/hash/dig_size.c +50 -0
- package/runtime/third_party/bearssl/src/hash/ghash_ctmul.c +345 -0
- package/runtime/third_party/bearssl/src/hash/ghash_ctmul32.c +251 -0
- package/runtime/third_party/bearssl/src/hash/ghash_ctmul64.c +154 -0
- package/runtime/third_party/bearssl/src/hash/ghash_pclmul.c +389 -0
- package/runtime/third_party/bearssl/src/hash/ghash_pwr8.c +411 -0
- package/runtime/third_party/bearssl/src/hash/md5.c +208 -0
- package/runtime/third_party/bearssl/src/hash/md5sha1.c +141 -0
- package/runtime/third_party/bearssl/src/hash/mgf1.c +56 -0
- package/runtime/third_party/bearssl/src/hash/multihash.c +166 -0
- package/runtime/third_party/bearssl/src/hash/sha1.c +191 -0
- package/runtime/third_party/bearssl/src/hash/sha2big.c +285 -0
- package/runtime/third_party/bearssl/src/hash/sha2small.c +341 -0
- package/runtime/third_party/bearssl/src/inner.h +2577 -0
- package/runtime/third_party/bearssl/src/int/i15_add.c +46 -0
- package/runtime/third_party/bearssl/src/int/i15_bitlen.c +44 -0
- package/runtime/third_party/bearssl/src/int/i15_decmod.c +124 -0
- package/runtime/third_party/bearssl/src/int/i15_decode.c +56 -0
- package/runtime/third_party/bearssl/src/int/i15_decred.c +100 -0
- package/runtime/third_party/bearssl/src/int/i15_encode.c +56 -0
- package/runtime/third_party/bearssl/src/int/i15_fmont.c +59 -0
- package/runtime/third_party/bearssl/src/int/i15_iszero.c +39 -0
- package/runtime/third_party/bearssl/src/int/i15_moddiv.c +465 -0
- package/runtime/third_party/bearssl/src/int/i15_modpow.c +50 -0
- package/runtime/third_party/bearssl/src/int/i15_modpow2.c +160 -0
- package/runtime/third_party/bearssl/src/int/i15_montmul.c +184 -0
- package/runtime/third_party/bearssl/src/int/i15_mulacc.c +61 -0
- package/runtime/third_party/bearssl/src/int/i15_muladd.c +173 -0
- package/runtime/third_party/bearssl/src/int/i15_ninv15.c +38 -0
- package/runtime/third_party/bearssl/src/int/i15_reduce.c +66 -0
- package/runtime/third_party/bearssl/src/int/i15_rshift.c +47 -0
- package/runtime/third_party/bearssl/src/int/i15_sub.c +46 -0
- package/runtime/third_party/bearssl/src/int/i15_tmont.c +36 -0
- package/runtime/third_party/bearssl/src/int/i31_add.c +46 -0
- package/runtime/third_party/bearssl/src/int/i31_bitlen.c +44 -0
- package/runtime/third_party/bearssl/src/int/i31_decmod.c +124 -0
- package/runtime/third_party/bearssl/src/int/i31_decode.c +57 -0
- package/runtime/third_party/bearssl/src/int/i31_decred.c +103 -0
- package/runtime/third_party/bearssl/src/int/i31_encode.c +79 -0
- package/runtime/third_party/bearssl/src/int/i31_fmont.c +60 -0
- package/runtime/third_party/bearssl/src/int/i31_iszero.c +39 -0
- package/runtime/third_party/bearssl/src/int/i31_moddiv.c +488 -0
- package/runtime/third_party/bearssl/src/int/i31_modpow.c +65 -0
- package/runtime/third_party/bearssl/src/int/i31_modpow2.c +160 -0
- package/runtime/third_party/bearssl/src/int/i31_montmul.c +127 -0
- package/runtime/third_party/bearssl/src/int/i31_mulacc.c +74 -0
- package/runtime/third_party/bearssl/src/int/i31_muladd.c +157 -0
- package/runtime/third_party/bearssl/src/int/i31_ninv31.c +39 -0
- package/runtime/third_party/bearssl/src/int/i31_reduce.c +66 -0
- package/runtime/third_party/bearssl/src/int/i31_rshift.c +47 -0
- package/runtime/third_party/bearssl/src/int/i31_sub.c +46 -0
- package/runtime/third_party/bearssl/src/int/i31_tmont.c +36 -0
- package/runtime/third_party/bearssl/src/int/i32_add.c +51 -0
- package/runtime/third_party/bearssl/src/int/i32_bitlen.c +44 -0
- package/runtime/third_party/bearssl/src/int/i32_decmod.c +77 -0
- package/runtime/third_party/bearssl/src/int/i32_decode.c +63 -0
- package/runtime/third_party/bearssl/src/int/i32_decred.c +107 -0
- package/runtime/third_party/bearssl/src/int/i32_div32.c +56 -0
- package/runtime/third_party/bearssl/src/int/i32_encode.c +72 -0
- package/runtime/third_party/bearssl/src/int/i32_fmont.c +60 -0
- package/runtime/third_party/bearssl/src/int/i32_iszero.c +39 -0
- package/runtime/third_party/bearssl/src/int/i32_modpow.c +65 -0
- package/runtime/third_party/bearssl/src/int/i32_montmul.c +69 -0
- package/runtime/third_party/bearssl/src/int/i32_mulacc.c +56 -0
- package/runtime/third_party/bearssl/src/int/i32_muladd.c +138 -0
- package/runtime/third_party/bearssl/src/int/i32_ninv32.c +39 -0
- package/runtime/third_party/bearssl/src/int/i32_reduce.c +66 -0
- package/runtime/third_party/bearssl/src/int/i32_sub.c +51 -0
- package/runtime/third_party/bearssl/src/int/i32_tmont.c +36 -0
- package/runtime/third_party/bearssl/src/int/i62_modpow2.c +493 -0
- package/runtime/third_party/bearssl/src/kdf/hkdf.c +107 -0
- package/runtime/third_party/bearssl/src/kdf/shake.c +590 -0
- package/runtime/third_party/bearssl/src/mac/hmac.c +122 -0
- package/runtime/third_party/bearssl/src/mac/hmac_ct.c +193 -0
- package/runtime/third_party/bearssl/src/rand/aesctr_drbg.c +206 -0
- package/runtime/third_party/bearssl/src/rand/hmac_drbg.c +157 -0
- package/runtime/third_party/bearssl/src/rand/sysrng.c +252 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_default_keygen.c +38 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_default_modulus.c +36 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_default_oaep_decrypt.c +38 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_default_oaep_encrypt.c +38 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_default_pkcs1_sign.c +38 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_default_pkcs1_vrfy.c +38 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_default_priv.c +38 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_default_privexp.c +36 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_default_pss_sign.c +38 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_default_pss_vrfy.c +38 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_default_pub.c +38 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_default_pubexp.c +36 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i15_keygen.c +583 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i15_modulus.c +99 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i15_oaep_decrypt.c +41 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i15_oaep_encrypt.c +44 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i15_pkcs1_sign.c +37 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i15_pkcs1_vrfy.c +43 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i15_priv.c +209 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i15_privexp.c +320 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i15_pss_sign.c +40 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i15_pss_vrfy.c +44 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i15_pub.c +113 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i15_pubexp.c +152 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i31_keygen.c +37 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i31_keygen_inner.c +608 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i31_modulus.c +99 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i31_oaep_decrypt.c +41 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i31_oaep_encrypt.c +44 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i31_pkcs1_sign.c +37 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i31_pkcs1_vrfy.c +43 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i31_priv.c +203 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i31_privexp.c +318 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i31_pss_sign.c +40 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i31_pss_vrfy.c +44 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i31_pub.c +106 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i31_pubexp.c +152 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i32_oaep_decrypt.c +41 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i32_oaep_encrypt.c +44 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i32_pkcs1_sign.c +37 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i32_pkcs1_vrfy.c +43 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i32_priv.c +160 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i32_pss_sign.c +40 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i32_pss_vrfy.c +44 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i32_pub.c +77 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i62_keygen.c +57 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i62_oaep_decrypt.c +61 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i62_oaep_encrypt.c +64 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i62_pkcs1_sign.c +57 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i62_pkcs1_vrfy.c +63 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i62_priv.c +223 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i62_pss_sign.c +60 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i62_pss_vrfy.c +64 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i62_pub.c +125 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_oaep_pad.c +112 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_oaep_unpad.c +145 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_pkcs1_sig_pad.c +100 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_pkcs1_sig_unpad.c +121 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_pss_sig_pad.c +106 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_pss_sig_unpad.c +121 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_ssl_decrypt.c +52 -0
- package/runtime/third_party/bearssl/src/settings.c +306 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_big_cbcdec.c +69 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_big_cbcenc.c +67 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_big_ctr.c +84 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_big_ctrcbc.c +142 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_big_dec.c +254 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_big_enc.c +157 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_common.c +112 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_ct.c +328 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_ct64.c +398 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_ct64_cbcdec.c +104 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_ct64_cbcenc.c +81 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_ct64_ctr.c +114 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_ct64_ctrcbc.c +433 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_ct64_dec.c +159 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_ct64_enc.c +115 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_ct_cbcdec.c +111 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_ct_cbcenc.c +91 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_ct_ctr.c +116 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_ct_ctrcbc.c +422 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_ct_dec.c +170 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_ct_enc.c +112 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_pwr8.c +445 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_pwr8_cbcdec.c +670 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_pwr8_cbcenc.c +417 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_pwr8_ctr.c +717 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_pwr8_ctrcbc.c +946 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_small_cbcdec.c +69 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_small_cbcenc.c +67 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_small_ctr.c +84 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_small_ctrcbc.c +142 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_small_dec.c +176 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_small_enc.c +129 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_x86ni.c +240 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_x86ni_cbcdec.c +223 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_x86ni_cbcenc.c +122 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_x86ni_ctr.c +211 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_x86ni_ctrcbc.c +596 -0
- package/runtime/third_party/bearssl/src/symcipher/chacha20_ct.c +106 -0
- package/runtime/third_party/bearssl/src/symcipher/chacha20_sse2.c +237 -0
- package/runtime/third_party/bearssl/src/symcipher/des_ct.c +411 -0
- package/runtime/third_party/bearssl/src/symcipher/des_ct_cbcdec.c +87 -0
- package/runtime/third_party/bearssl/src/symcipher/des_ct_cbcenc.c +69 -0
- package/runtime/third_party/bearssl/src/symcipher/des_support.c +166 -0
- package/runtime/third_party/bearssl/src/symcipher/des_tab.c +310 -0
- package/runtime/third_party/bearssl/src/symcipher/des_tab_cbcdec.c +85 -0
- package/runtime/third_party/bearssl/src/symcipher/des_tab_cbcenc.c +67 -0
- package/runtime/third_party/bearssl/src/symcipher/poly1305_ctmul.c +260 -0
- package/runtime/third_party/bearssl/src/symcipher/poly1305_ctmul32.c +297 -0
- package/runtime/third_party/bearssl/src/symcipher/poly1305_ctmulq.c +475 -0
- package/runtime/third_party/bearssl/src/symcipher/poly1305_i15.c +221 -0
- package/runtime/third_party/bearssl/src/x509/asn1.t0 +757 -0
- package/runtime/third_party/bearssl/src/x509/asn1enc.c +93 -0
- package/runtime/third_party/bearssl/src/x509/encode_ec_pk8der.c +110 -0
- package/runtime/third_party/bearssl/src/x509/encode_ec_rawder.c +161 -0
- package/runtime/third_party/bearssl/src/x509/encode_rsa_pk8der.c +97 -0
- package/runtime/third_party/bearssl/src/x509/encode_rsa_rawder.c +96 -0
- package/runtime/third_party/bearssl/src/x509/skey_decoder.c +653 -0
- package/runtime/third_party/bearssl/src/x509/skey_decoder.t0 +376 -0
- package/runtime/third_party/bearssl/src/x509/x509_decoder.c +776 -0
- package/runtime/third_party/bearssl/src/x509/x509_decoder.t0 +324 -0
- package/runtime/third_party/bearssl/src/x509/x509_knownkey.c +105 -0
- package/runtime/third_party/bearssl/src/x509/x509_minimal.c +1722 -0
- package/runtime/third_party/bearssl/src/x509/x509_minimal.t0 +1526 -0
- package/runtime/third_party/bearssl/src/x509/x509_minimal_full.c +59 -0
- package/runtime/third_party/quickjs-dtoa/LICENSE +22 -0
- package/runtime/third_party/quickjs-dtoa/README.md +23 -0
- package/runtime/third_party/quickjs-dtoa/dtoa.c +1640 -0
- package/runtime/third_party/quickjs-dtoa/dtoa.h +83 -0
- package/runtime/third_party/quickjs-dtoa/dtoa_compat.h +89 -0
- package/runtime/third_party/quickjs-regexp/LICENSE +22 -0
- package/runtime/third_party/quickjs-regexp/README.md +22 -0
- package/runtime/third_party/quickjs-regexp/cutils.c +641 -0
- package/runtime/third_party/quickjs-regexp/cutils.h +457 -0
- package/runtime/third_party/quickjs-regexp/libregexp-opcode.h +73 -0
- package/runtime/third_party/quickjs-regexp/libregexp.c +3448 -0
- package/runtime/third_party/quickjs-regexp/libregexp.h +65 -0
- package/runtime/third_party/quickjs-regexp/libunicode-table.h +5206 -0
- package/runtime/third_party/quickjs-regexp/libunicode.c +2124 -0
- package/runtime/third_party/quickjs-regexp/libunicode.h +196 -0
- package/runtime/third_party/v8-ieee754/LICENSE +61 -0
- package/runtime/third_party/v8-ieee754/README.md +22 -0
- package/runtime/third_party/v8-ieee754/convert.py +84 -0
- package/runtime/third_party/v8-ieee754/ieee754.c +3030 -0
- package/runtime/third_party/v8-ieee754/ieee754.h +27 -0
- package/runtime/tools/regexp_compile.c +90 -0
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Unicode utilities
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2017-2018 Fabrice Bellard
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in
|
|
14
|
+
* all copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
19
|
+
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
22
|
+
* THE SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
#ifndef LIBUNICODE_H
|
|
25
|
+
#define LIBUNICODE_H
|
|
26
|
+
|
|
27
|
+
#include <stdint.h>
|
|
28
|
+
|
|
29
|
+
/* unicode standard version */
|
|
30
|
+
#define LIBUNICODE_UNICODE_VERSION_MAJOR 17
|
|
31
|
+
#define LIBUNICODE_UNICODE_VERSION_MINOR 0
|
|
32
|
+
#define LIBUNICODE_UNICODE_VERSION_PATCH 0
|
|
33
|
+
|
|
34
|
+
/* define it to include all the unicode tables (40KB larger) */
|
|
35
|
+
#define CONFIG_ALL_UNICODE
|
|
36
|
+
|
|
37
|
+
#define LRE_CC_RES_LEN_MAX 3
|
|
38
|
+
|
|
39
|
+
/* char ranges */
|
|
40
|
+
|
|
41
|
+
typedef struct {
|
|
42
|
+
int len; /* in points, always even */
|
|
43
|
+
int size;
|
|
44
|
+
uint32_t *points; /* points sorted by increasing value */
|
|
45
|
+
void *mem_opaque;
|
|
46
|
+
void *(*realloc_func)(void *opaque, void *ptr, size_t size);
|
|
47
|
+
} CharRange;
|
|
48
|
+
|
|
49
|
+
typedef enum {
|
|
50
|
+
CR_OP_UNION,
|
|
51
|
+
CR_OP_INTER,
|
|
52
|
+
CR_OP_XOR,
|
|
53
|
+
CR_OP_SUB,
|
|
54
|
+
} CharRangeOpEnum;
|
|
55
|
+
|
|
56
|
+
void cr_init(CharRange *cr, void *mem_opaque, void *(*realloc_func)(void *opaque, void *ptr, size_t size));
|
|
57
|
+
void cr_free(CharRange *cr);
|
|
58
|
+
int cr_realloc(CharRange *cr, int size);
|
|
59
|
+
int cr_copy(CharRange *cr, const CharRange *cr1);
|
|
60
|
+
|
|
61
|
+
static inline int cr_add_point(CharRange *cr, uint32_t v)
|
|
62
|
+
{
|
|
63
|
+
if (cr->len >= cr->size) {
|
|
64
|
+
if (cr_realloc(cr, cr->len + 1))
|
|
65
|
+
return -1;
|
|
66
|
+
}
|
|
67
|
+
cr->points[cr->len++] = v;
|
|
68
|
+
return 0;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
static inline int cr_add_interval(CharRange *cr, uint32_t c1, uint32_t c2)
|
|
72
|
+
{
|
|
73
|
+
if ((cr->len + 2) > cr->size) {
|
|
74
|
+
if (cr_realloc(cr, cr->len + 2))
|
|
75
|
+
return -1;
|
|
76
|
+
}
|
|
77
|
+
cr->points[cr->len++] = c1;
|
|
78
|
+
cr->points[cr->len++] = c2;
|
|
79
|
+
return 0;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
int cr_op(CharRange *cr, const uint32_t *a_pt, int a_len,
|
|
83
|
+
const uint32_t *b_pt, int b_len, int op);
|
|
84
|
+
int cr_op1(CharRange *cr, const uint32_t *b_pt, int b_len, int op);
|
|
85
|
+
|
|
86
|
+
static inline int cr_union_interval(CharRange *cr, uint32_t c1, uint32_t c2)
|
|
87
|
+
{
|
|
88
|
+
uint32_t b_pt[2];
|
|
89
|
+
b_pt[0] = c1;
|
|
90
|
+
b_pt[1] = c2 + 1;
|
|
91
|
+
return cr_op1(cr, b_pt, 2, CR_OP_UNION);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
int cr_invert(CharRange *cr);
|
|
95
|
+
|
|
96
|
+
int cr_regexp_canonicalize(CharRange *cr, int is_unicode);
|
|
97
|
+
|
|
98
|
+
typedef enum {
|
|
99
|
+
UNICODE_NFC,
|
|
100
|
+
UNICODE_NFD,
|
|
101
|
+
UNICODE_NFKC,
|
|
102
|
+
UNICODE_NFKD,
|
|
103
|
+
} UnicodeNormalizationEnum;
|
|
104
|
+
|
|
105
|
+
int unicode_normalize(uint32_t **pdst, const uint32_t *src, int src_len,
|
|
106
|
+
UnicodeNormalizationEnum n_type,
|
|
107
|
+
void *opaque, void *(*realloc_func)(void *opaque, void *ptr, size_t size));
|
|
108
|
+
|
|
109
|
+
/* Unicode character range functions */
|
|
110
|
+
|
|
111
|
+
int unicode_script(CharRange *cr, const char *script_name, int is_ext);
|
|
112
|
+
int unicode_general_category(CharRange *cr, const char *gc_name);
|
|
113
|
+
int unicode_prop(CharRange *cr, const char *prop_name);
|
|
114
|
+
|
|
115
|
+
typedef void UnicodeSequencePropCB(void *opaque, const uint32_t *buf, int len);
|
|
116
|
+
int unicode_sequence_prop(const char *prop_name, UnicodeSequencePropCB *cb, void *opaque,
|
|
117
|
+
CharRange *cr);
|
|
118
|
+
|
|
119
|
+
int lre_case_conv(uint32_t *res, uint32_t c, int conv_type);
|
|
120
|
+
int lre_canonicalize(uint32_t c, int is_unicode);
|
|
121
|
+
|
|
122
|
+
/* Code point type categories */
|
|
123
|
+
enum {
|
|
124
|
+
UNICODE_C_SPACE = (1 << 0),
|
|
125
|
+
UNICODE_C_DIGIT = (1 << 1),
|
|
126
|
+
UNICODE_C_UPPER = (1 << 2),
|
|
127
|
+
UNICODE_C_LOWER = (1 << 3),
|
|
128
|
+
UNICODE_C_UNDER = (1 << 4),
|
|
129
|
+
UNICODE_C_DOLLAR = (1 << 5),
|
|
130
|
+
UNICODE_C_XDIGIT = (1 << 6),
|
|
131
|
+
};
|
|
132
|
+
extern uint8_t const lre_ctype_bits[256];
|
|
133
|
+
|
|
134
|
+
/* zero or non-zero return value */
|
|
135
|
+
int lre_is_cased(uint32_t c);
|
|
136
|
+
int lre_is_case_ignorable(uint32_t c);
|
|
137
|
+
int lre_is_id_start(uint32_t c);
|
|
138
|
+
int lre_is_id_continue(uint32_t c);
|
|
139
|
+
|
|
140
|
+
static inline int lre_is_space_byte(uint8_t c) {
|
|
141
|
+
return lre_ctype_bits[c] & UNICODE_C_SPACE;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
static inline int lre_is_id_start_byte(uint8_t c) {
|
|
145
|
+
return lre_ctype_bits[c] & (UNICODE_C_UPPER | UNICODE_C_LOWER |
|
|
146
|
+
UNICODE_C_UNDER | UNICODE_C_DOLLAR);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
static inline int lre_is_id_continue_byte(uint8_t c) {
|
|
150
|
+
return lre_ctype_bits[c] & (UNICODE_C_UPPER | UNICODE_C_LOWER |
|
|
151
|
+
UNICODE_C_UNDER | UNICODE_C_DOLLAR |
|
|
152
|
+
UNICODE_C_DIGIT);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
static inline int lre_is_word_byte(uint8_t c) {
|
|
156
|
+
return lre_ctype_bits[c] & (UNICODE_C_UPPER | UNICODE_C_LOWER |
|
|
157
|
+
UNICODE_C_UNDER | UNICODE_C_DIGIT);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
int lre_is_space_non_ascii(uint32_t c);
|
|
161
|
+
|
|
162
|
+
static inline int lre_is_space(uint32_t c) {
|
|
163
|
+
if (c < 256)
|
|
164
|
+
return lre_is_space_byte(c);
|
|
165
|
+
else
|
|
166
|
+
return lre_is_space_non_ascii(c);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
static inline int lre_js_is_ident_first(uint32_t c) {
|
|
170
|
+
if (c < 128) {
|
|
171
|
+
return lre_is_id_start_byte(c);
|
|
172
|
+
} else {
|
|
173
|
+
#ifdef CONFIG_ALL_UNICODE
|
|
174
|
+
return lre_is_id_start(c);
|
|
175
|
+
#else
|
|
176
|
+
return !lre_is_space_non_ascii(c);
|
|
177
|
+
#endif
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
static inline int lre_js_is_ident_next(uint32_t c) {
|
|
182
|
+
if (c < 128) {
|
|
183
|
+
return lre_is_id_continue_byte(c);
|
|
184
|
+
} else {
|
|
185
|
+
/* ZWNJ and ZWJ are accepted in identifiers */
|
|
186
|
+
if (c >= 0x200C && c <= 0x200D)
|
|
187
|
+
return TRUE;
|
|
188
|
+
#ifdef CONFIG_ALL_UNICODE
|
|
189
|
+
return lre_is_id_continue(c);
|
|
190
|
+
#else
|
|
191
|
+
return !lre_is_space_non_ascii(c);
|
|
192
|
+
#endif
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
#endif /* LIBUNICODE_H */
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
This license applies to all parts of V8 that are not externally
|
|
2
|
+
maintained libraries. The externally maintained libraries used by V8
|
|
3
|
+
are:
|
|
4
|
+
|
|
5
|
+
- PCRE test suite, located in
|
|
6
|
+
test/mjsunit/third_party/regexp-pcre/regexp-pcre.js. This is based on the
|
|
7
|
+
test suite from PCRE-7.3, which is copyrighted by the University
|
|
8
|
+
of Cambridge and Google, Inc. The copyright notice and license
|
|
9
|
+
are embedded in regexp-pcre.js.
|
|
10
|
+
|
|
11
|
+
- Layout tests, located in test/mjsunit/third_party/object-keys. These are
|
|
12
|
+
based on layout tests from webkit.org which are copyrighted by
|
|
13
|
+
Apple Computer, Inc. and released under a 3-clause BSD license.
|
|
14
|
+
|
|
15
|
+
- Strongtalk assembler, the basis of the files assembler-arm-inl.h,
|
|
16
|
+
assembler-arm.cc, assembler-arm.h, assembler-ia32-inl.h,
|
|
17
|
+
assembler-ia32.cc, assembler-ia32.h, assembler-x64-inl.h,
|
|
18
|
+
assembler-x64.cc, assembler-x64.h, assembler.cc and assembler.h.
|
|
19
|
+
This code is copyrighted by Sun Microsystems Inc. and released
|
|
20
|
+
under a 3-clause BSD license.
|
|
21
|
+
|
|
22
|
+
- Valgrind client API header, located at src/third_party/valgrind/valgrind.h
|
|
23
|
+
This is released under the BSD license.
|
|
24
|
+
|
|
25
|
+
- The Wasm C/C++ API headers, located at third_party/wasm-api/wasm.{h,hh}
|
|
26
|
+
This is released under the Apache license. The API's upstream prototype
|
|
27
|
+
implementation also formed the basis of V8's implementation in
|
|
28
|
+
src/wasm/c-api.cc.
|
|
29
|
+
|
|
30
|
+
These libraries have their own licenses; we recommend you read them,
|
|
31
|
+
as their terms may differ from the terms below.
|
|
32
|
+
|
|
33
|
+
Further license information can be found in LICENSE files located in
|
|
34
|
+
sub-directories.
|
|
35
|
+
|
|
36
|
+
Copyright 2014, the V8 project authors. All rights reserved.
|
|
37
|
+
Redistribution and use in source and binary forms, with or without
|
|
38
|
+
modification, are permitted provided that the following conditions are
|
|
39
|
+
met:
|
|
40
|
+
|
|
41
|
+
* Redistributions of source code must retain the above copyright
|
|
42
|
+
notice, this list of conditions and the following disclaimer.
|
|
43
|
+
* Redistributions in binary form must reproduce the above
|
|
44
|
+
copyright notice, this list of conditions and the following
|
|
45
|
+
disclaimer in the documentation and/or other materials provided
|
|
46
|
+
with the distribution.
|
|
47
|
+
* Neither the name of Google Inc. nor the names of its
|
|
48
|
+
contributors may be used to endorse or promote products derived
|
|
49
|
+
from this software without specific prior written permission.
|
|
50
|
+
|
|
51
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
52
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
53
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
54
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
55
|
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
56
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
57
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
58
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
59
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
60
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
61
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# v8-ieee754
|
|
2
|
+
|
|
3
|
+
V8's port of fdlibm (`src/base/ieee754.cc`), converted to C: `Math`'s functions and `**`
|
|
4
|
+
return exactly what Node returns (ADR 0014). BSD license (`LICENSE`, V8's) and the fdlibm
|
|
5
|
+
notice at the top of `ieee754.c`.
|
|
6
|
+
|
|
7
|
+
- **Upstream:** V8 branch `12.4-lkgr`, the version Node 22 ships (`process.versions.v8` is
|
|
8
|
+
12.4.254.21-node.39). `sin` and `cos` are the fdlibm ones, which is what Node 22 uses.
|
|
9
|
+
- **Converted by `convert.py`** from the upstream file, mechanically: C casts instead of
|
|
10
|
+
`static_cast`, `memcpy` bit casts, the overflow helpers and `numeric_limits` spelled out,
|
|
11
|
+
`js_ieee754_` names, namespaces dropped, V8's optional libm `sin`/`cos` dropped.
|
|
12
|
+
- **Checked:** 146,346 inputs (special values, and random ones over 40 orders of magnitude) give
|
|
13
|
+
the same bits as Node for all 21 functions; glibc's libm differs on 6,783 of them.
|
|
14
|
+
|
|
15
|
+
## Updating
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
curl -fL https://raw.githubusercontent.com/v8/v8/<branch>/src/base/ieee754.cc -o v8-ieee754.cc
|
|
19
|
+
python3 convert.py <dir with v8-ieee754.cc> # writes ieee754.c and ieee754.h there
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Then rerun the runtime tests and `tests/programs/math.js` against the Node it should match.
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import re, sys
|
|
2
|
+
S=sys.argv[1] # the directory holding v8-ieee754.cc; ieee754.c/.h are written there
|
|
3
|
+
src=open(S+'/v8-ieee754.cc').read()
|
|
4
|
+
lines=src.split('\n')
|
|
5
|
+
first_inc=next(i for i,l in enumerate(lines) if l.startswith('#include'))
|
|
6
|
+
license='\n'.join(lines[:first_inc])
|
|
7
|
+
body='\n'.join(lines[first_inc:])
|
|
8
|
+
for inc in ['#include "src/base/ieee754.h"\n','#include <cmath>\n','#include <limits>\n','#include "src/base/build_config.h"\n','#include "src/base/macros.h"\n','#include "src/base/overflowing-math.h"\n']:
|
|
9
|
+
body=body.replace(inc,'')
|
|
10
|
+
for ns in ['namespace v8 {\n','namespace base {\n','namespace ieee754 {\n','namespace {\n','} // namespace ieee754\n','} // namespace base\n','} // namespace v8\n','} // namespace\n']:
|
|
11
|
+
body=body.replace(ns,'')
|
|
12
|
+
body=body.replace('#if V8_CC_MSVC','#if defined(_MSC_VER)')
|
|
13
|
+
body=body.replace('base::bit_cast<uint64_t>(d)','js_ieee754_bits(d)').replace('base::bit_cast<double>(bits)','js_ieee754_double(bits)')
|
|
14
|
+
body=body.replace(' V8_WARN_UNUSED_RESULT','').replace('V8_INLINE ','static inline ')
|
|
15
|
+
body=body.replace('std::numeric_limits<double>::signaling_NaN()','NAN').replace('std::numeric_limits<double>::quiet_NaN()','NAN')
|
|
16
|
+
body=body.replace('std::numeric_limits<double>::infinity()','INFINITY')
|
|
17
|
+
body=re.sub(r'NegateWithWraparound<int32_t>\((\w+)\)', r'((int32_t)(0u - (uint32_t)(\1)))', body)
|
|
18
|
+
body=re.sub(r'SubWithWraparound\((\w+), (\w+)\)', r'((int32_t)((uint32_t)(\1) - (uint32_t)(\2)))', body)
|
|
19
|
+
def conv(s):
|
|
20
|
+
out=[];i=0;pat='static_cast<'
|
|
21
|
+
while True:
|
|
22
|
+
j=s.find(pat,i)
|
|
23
|
+
if j<0: out.append(s[i:]); return ''.join(out)
|
|
24
|
+
out.append(s[i:j])
|
|
25
|
+
k=s.index('>',j); T=s[j+len(pat):k]
|
|
26
|
+
depth=0;m=k+1
|
|
27
|
+
while True:
|
|
28
|
+
c=s[m]
|
|
29
|
+
if c=='(': depth+=1
|
|
30
|
+
elif c==')':
|
|
31
|
+
depth-=1
|
|
32
|
+
if depth==0: break
|
|
33
|
+
m+=1
|
|
34
|
+
out.append('((%s)(%s))'%(T,conv(s[k+2:m])))
|
|
35
|
+
i=m+1
|
|
36
|
+
body=conv(body)
|
|
37
|
+
body=body.replace('const_cast<volatile double*>(&atanlo[3])','(volatile double*)(&atanlo[3])')
|
|
38
|
+
body=re.sub(r'base::bit_cast<uint64_t>\((\w+)\)', r'js_ieee754_bits(\1)', body)
|
|
39
|
+
body=re.sub(r'base::bit_cast<double>\((\w+)\)', r'js_ieee754_double(\1)', body)
|
|
40
|
+
body=re.sub(r'base::Divide\(', 'js_ieee754_divide(', body)
|
|
41
|
+
body=body.replace("0x0000'0000'FFFF'FFFF",'0x00000000FFFFFFFFull').replace("0xFFFF'FFFF'0000'0000",'0xFFFFFFFF00000000ull')
|
|
42
|
+
pub=['acos','acosh','asin','asinh','atan','atan2','cos','exp','atanh','log','log1p','log2','log10','expm1','cbrt','sin','tan','cosh','pow','sinh','tanh']
|
|
43
|
+
first_pub=body.index('double acos(double x) {')
|
|
44
|
+
head=re.sub(r'^(int32_t|int|double) (__\w+)\(', r'static \1 \2(', body[:first_pub], flags=re.M)
|
|
45
|
+
body=head+body[first_pub:]
|
|
46
|
+
for f in pub:
|
|
47
|
+
body=re.sub(r'(?<![\w.])%s\('%f, 'js_ieee754_%s('%f, body)
|
|
48
|
+
for f in ['cos','sin']:
|
|
49
|
+
body=body.replace('#if defined(V8_USE_LIBM_TRIG_FUNCTIONS)\ndouble fdlibm_%s(double x) {\n#else\ndouble js_ieee754_%s(double x) {\n#endif'%(f,f),'double js_ieee754_%s(double x) {'%f)
|
|
50
|
+
k=body.find('#if defined(V8_USE_LIBM_TRIG_FUNCTIONS) && defined(BUILDING_V8_BASE_SHARED)')
|
|
51
|
+
if k>=0:
|
|
52
|
+
e=body.index('#endif',k)+len('#endif'); body=body[:k]+body[e:]
|
|
53
|
+
assert 'V8_' not in body.replace('V8_USE','') or True
|
|
54
|
+
hdr='''/* V8's port of fdlibm (src/base/ieee754.cc, V8 12.4, the version Node 22 ships), in C so
|
|
55
|
+
* Math gives Node's results to the last bit (ADR 0014). Changes: C instead of C++ (casts,
|
|
56
|
+
* bit casts, the overflow helpers, numeric_limits), js_ieee754_ names, and only the fdlibm
|
|
57
|
+
* sin/cos (V8's optional libm variant dropped). */
|
|
58
|
+
#include "ieee754.h"
|
|
59
|
+
|
|
60
|
+
#include <math.h>
|
|
61
|
+
#include <stdbool.h>
|
|
62
|
+
#include <stdint.h>
|
|
63
|
+
#include <string.h>
|
|
64
|
+
|
|
65
|
+
static inline uint64_t js_ieee754_bits(double d) {
|
|
66
|
+
uint64_t u;
|
|
67
|
+
memcpy(&u, &d, sizeof u);
|
|
68
|
+
return u;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/* V8's base::Divide: IEEE division, including by zero */
|
|
72
|
+
static inline double js_ieee754_divide(double x, double y) {
|
|
73
|
+
return x / y;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
static inline double js_ieee754_double(uint64_t u) {
|
|
77
|
+
double d;
|
|
78
|
+
memcpy(&d, &u, sizeof d);
|
|
79
|
+
return d;
|
|
80
|
+
}
|
|
81
|
+
'''
|
|
82
|
+
open(S+'/ieee754.c','w').write(license+'\n'+hdr+body.lstrip('\n'))
|
|
83
|
+
decl=''.join('double js_ieee754_%s(%s);\n'%(f, 'double y, double x' if f=='atan2' else 'double x, double y' if f=='pow' else 'double x') for f in pub)
|
|
84
|
+
open(S+'/ieee754.h','w').write('/* V8\'s fdlibm port (ieee754.c): Math\'s functions with Node\'s results. */\n#ifndef JS_IEEE754_H\n#define JS_IEEE754_H\n\n'+decl+'\n#endif /* JS_IEEE754_H */\n')
|