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,37 @@
|
|
|
1
|
+
/* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
|
|
2
|
+
*
|
|
3
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
* of this software and associated documentation files (the "Software"), to
|
|
5
|
+
* deal in the Software without restriction, including without limitation the
|
|
6
|
+
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
7
|
+
* sell copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
* furnished to do so, subject to the following conditions:
|
|
9
|
+
*
|
|
10
|
+
* The above copyright notice and this permission notice shall be included in
|
|
11
|
+
* all copies or substantial portions of the Software.
|
|
12
|
+
*
|
|
13
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
18
|
+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
19
|
+
* IN THE SOFTWARE.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/*
|
|
23
|
+
* This file is private to libuv. It provides common functionality to both
|
|
24
|
+
* Windows and Unix backends.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
#ifndef UV_THREADPOOL_H_
|
|
28
|
+
#define UV_THREADPOOL_H_
|
|
29
|
+
|
|
30
|
+
struct uv__work {
|
|
31
|
+
void (*work)(struct uv__work *w);
|
|
32
|
+
void (*done)(struct uv__work *w, int status);
|
|
33
|
+
struct uv_loop_s* loop;
|
|
34
|
+
struct uv__queue wq;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
#endif /* UV_THREADPOOL_H_ */
|
|
@@ -0,0 +1,521 @@
|
|
|
1
|
+
/*-
|
|
2
|
+
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* Redistribution and use in source and binary forms, with or without
|
|
6
|
+
* modification, are permitted provided that the following conditions
|
|
7
|
+
* are met:
|
|
8
|
+
* 1. Redistributions of source code must retain the above copyright
|
|
9
|
+
* notice, this list of conditions and the following disclaimer.
|
|
10
|
+
* 2. Redistributions in binary form must reproduce the above copyright
|
|
11
|
+
* notice, this list of conditions and the following disclaimer in the
|
|
12
|
+
* documentation and/or other materials provided with the distribution.
|
|
13
|
+
*
|
|
14
|
+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
15
|
+
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
16
|
+
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
17
|
+
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
18
|
+
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
19
|
+
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
20
|
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
21
|
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
22
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
23
|
+
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
#ifndef UV_TREE_H_
|
|
27
|
+
#define UV_TREE_H_
|
|
28
|
+
|
|
29
|
+
#ifndef UV__UNUSED
|
|
30
|
+
# if __GNUC__
|
|
31
|
+
# define UV__UNUSED __attribute__((unused))
|
|
32
|
+
# else
|
|
33
|
+
# define UV__UNUSED
|
|
34
|
+
# endif
|
|
35
|
+
#endif
|
|
36
|
+
|
|
37
|
+
/*
|
|
38
|
+
* This file defines data structures for red-black trees.
|
|
39
|
+
* A red-black tree is a binary search tree with the node color as an
|
|
40
|
+
* extra attribute. It fulfills a set of conditions:
|
|
41
|
+
* - every search path from the root to a leaf consists of the
|
|
42
|
+
* same number of black nodes,
|
|
43
|
+
* - each red node (except for the root) has a black parent,
|
|
44
|
+
* - each leaf node is black.
|
|
45
|
+
*
|
|
46
|
+
* Every operation on a red-black tree is bounded as O(lg n).
|
|
47
|
+
* The maximum height of a red-black tree is 2lg (n+1).
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
/* Macros that define a red-black tree */
|
|
51
|
+
#define RB_HEAD(name, type) \
|
|
52
|
+
struct name { \
|
|
53
|
+
struct type *rbh_root; /* root of the tree */ \
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
#define RB_INITIALIZER(root) \
|
|
57
|
+
{ NULL }
|
|
58
|
+
|
|
59
|
+
#define RB_INIT(root) do { \
|
|
60
|
+
(root)->rbh_root = NULL; \
|
|
61
|
+
} while (/*CONSTCOND*/ 0)
|
|
62
|
+
|
|
63
|
+
#define RB_BLACK 0
|
|
64
|
+
#define RB_RED 1
|
|
65
|
+
#define RB_ENTRY(type) \
|
|
66
|
+
struct { \
|
|
67
|
+
struct type *rbe_left; /* left element */ \
|
|
68
|
+
struct type *rbe_right; /* right element */ \
|
|
69
|
+
struct type *rbe_parent; /* parent element */ \
|
|
70
|
+
int rbe_color; /* node color */ \
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
#define RB_LEFT(elm, field) (elm)->field.rbe_left
|
|
74
|
+
#define RB_RIGHT(elm, field) (elm)->field.rbe_right
|
|
75
|
+
#define RB_PARENT(elm, field) (elm)->field.rbe_parent
|
|
76
|
+
#define RB_COLOR(elm, field) (elm)->field.rbe_color
|
|
77
|
+
#define RB_ROOT(head) (head)->rbh_root
|
|
78
|
+
#define RB_EMPTY(head) (RB_ROOT(head) == NULL)
|
|
79
|
+
|
|
80
|
+
#define RB_SET(elm, parent, field) do { \
|
|
81
|
+
RB_PARENT(elm, field) = parent; \
|
|
82
|
+
RB_LEFT(elm, field) = RB_RIGHT(elm, field) = NULL; \
|
|
83
|
+
RB_COLOR(elm, field) = RB_RED; \
|
|
84
|
+
} while (/*CONSTCOND*/ 0)
|
|
85
|
+
|
|
86
|
+
#define RB_SET_BLACKRED(black, red, field) do { \
|
|
87
|
+
RB_COLOR(black, field) = RB_BLACK; \
|
|
88
|
+
RB_COLOR(red, field) = RB_RED; \
|
|
89
|
+
} while (/*CONSTCOND*/ 0)
|
|
90
|
+
|
|
91
|
+
#ifndef RB_AUGMENT
|
|
92
|
+
#define RB_AUGMENT(x) do {} while (0)
|
|
93
|
+
#endif
|
|
94
|
+
|
|
95
|
+
#define RB_ROTATE_LEFT(head, elm, tmp, field) do { \
|
|
96
|
+
(tmp) = RB_RIGHT(elm, field); \
|
|
97
|
+
if ((RB_RIGHT(elm, field) = RB_LEFT(tmp, field)) != NULL) { \
|
|
98
|
+
RB_PARENT(RB_LEFT(tmp, field), field) = (elm); \
|
|
99
|
+
} \
|
|
100
|
+
RB_AUGMENT(elm); \
|
|
101
|
+
if ((RB_PARENT(tmp, field) = RB_PARENT(elm, field)) != NULL) { \
|
|
102
|
+
if ((elm) == RB_LEFT(RB_PARENT(elm, field), field)) \
|
|
103
|
+
RB_LEFT(RB_PARENT(elm, field), field) = (tmp); \
|
|
104
|
+
else \
|
|
105
|
+
RB_RIGHT(RB_PARENT(elm, field), field) = (tmp); \
|
|
106
|
+
} else \
|
|
107
|
+
(head)->rbh_root = (tmp); \
|
|
108
|
+
RB_LEFT(tmp, field) = (elm); \
|
|
109
|
+
RB_PARENT(elm, field) = (tmp); \
|
|
110
|
+
RB_AUGMENT(tmp); \
|
|
111
|
+
if ((RB_PARENT(tmp, field))) \
|
|
112
|
+
RB_AUGMENT(RB_PARENT(tmp, field)); \
|
|
113
|
+
} while (/*CONSTCOND*/ 0)
|
|
114
|
+
|
|
115
|
+
#define RB_ROTATE_RIGHT(head, elm, tmp, field) do { \
|
|
116
|
+
(tmp) = RB_LEFT(elm, field); \
|
|
117
|
+
if ((RB_LEFT(elm, field) = RB_RIGHT(tmp, field)) != NULL) { \
|
|
118
|
+
RB_PARENT(RB_RIGHT(tmp, field), field) = (elm); \
|
|
119
|
+
} \
|
|
120
|
+
RB_AUGMENT(elm); \
|
|
121
|
+
if ((RB_PARENT(tmp, field) = RB_PARENT(elm, field)) != NULL) { \
|
|
122
|
+
if ((elm) == RB_LEFT(RB_PARENT(elm, field), field)) \
|
|
123
|
+
RB_LEFT(RB_PARENT(elm, field), field) = (tmp); \
|
|
124
|
+
else \
|
|
125
|
+
RB_RIGHT(RB_PARENT(elm, field), field) = (tmp); \
|
|
126
|
+
} else \
|
|
127
|
+
(head)->rbh_root = (tmp); \
|
|
128
|
+
RB_RIGHT(tmp, field) = (elm); \
|
|
129
|
+
RB_PARENT(elm, field) = (tmp); \
|
|
130
|
+
RB_AUGMENT(tmp); \
|
|
131
|
+
if ((RB_PARENT(tmp, field))) \
|
|
132
|
+
RB_AUGMENT(RB_PARENT(tmp, field)); \
|
|
133
|
+
} while (/*CONSTCOND*/ 0)
|
|
134
|
+
|
|
135
|
+
/* Generates prototypes and inline functions */
|
|
136
|
+
#define RB_PROTOTYPE(name, type, field, cmp) \
|
|
137
|
+
RB_PROTOTYPE_INTERNAL(name, type, field, cmp,)
|
|
138
|
+
#define RB_PROTOTYPE_STATIC(name, type, field, cmp) \
|
|
139
|
+
RB_PROTOTYPE_INTERNAL(name, type, field, cmp, UV__UNUSED static)
|
|
140
|
+
#define RB_PROTOTYPE_INTERNAL(name, type, field, cmp, attr) \
|
|
141
|
+
attr void name##_RB_INSERT_COLOR(struct name *, struct type *); \
|
|
142
|
+
attr void name##_RB_REMOVE_COLOR(struct name *, struct type *, struct type *);\
|
|
143
|
+
attr struct type *name##_RB_REMOVE(struct name *, struct type *); \
|
|
144
|
+
attr struct type *name##_RB_INSERT(struct name *, struct type *); \
|
|
145
|
+
attr struct type *name##_RB_FIND(struct name *, struct type *); \
|
|
146
|
+
attr struct type *name##_RB_NFIND(struct name *, struct type *); \
|
|
147
|
+
attr struct type *name##_RB_NEXT(struct type *); \
|
|
148
|
+
attr struct type *name##_RB_PREV(struct type *); \
|
|
149
|
+
attr struct type *name##_RB_MINMAX(struct name *, int); \
|
|
150
|
+
\
|
|
151
|
+
|
|
152
|
+
/* Main rb operation.
|
|
153
|
+
* Moves node close to the key of elm to top
|
|
154
|
+
*/
|
|
155
|
+
#define RB_GENERATE(name, type, field, cmp) \
|
|
156
|
+
RB_GENERATE_INTERNAL(name, type, field, cmp,)
|
|
157
|
+
#define RB_GENERATE_STATIC(name, type, field, cmp) \
|
|
158
|
+
RB_GENERATE_INTERNAL(name, type, field, cmp, UV__UNUSED static)
|
|
159
|
+
#define RB_GENERATE_INTERNAL(name, type, field, cmp, attr) \
|
|
160
|
+
attr void \
|
|
161
|
+
name##_RB_INSERT_COLOR(struct name *head, struct type *elm) \
|
|
162
|
+
{ \
|
|
163
|
+
struct type *parent, *gparent, *tmp; \
|
|
164
|
+
while ((parent = RB_PARENT(elm, field)) != NULL && \
|
|
165
|
+
RB_COLOR(parent, field) == RB_RED) { \
|
|
166
|
+
gparent = RB_PARENT(parent, field); \
|
|
167
|
+
if (parent == RB_LEFT(gparent, field)) { \
|
|
168
|
+
tmp = RB_RIGHT(gparent, field); \
|
|
169
|
+
if (tmp && RB_COLOR(tmp, field) == RB_RED) { \
|
|
170
|
+
RB_COLOR(tmp, field) = RB_BLACK; \
|
|
171
|
+
RB_SET_BLACKRED(parent, gparent, field); \
|
|
172
|
+
elm = gparent; \
|
|
173
|
+
continue; \
|
|
174
|
+
} \
|
|
175
|
+
if (RB_RIGHT(parent, field) == elm) { \
|
|
176
|
+
RB_ROTATE_LEFT(head, parent, tmp, field); \
|
|
177
|
+
tmp = parent; \
|
|
178
|
+
parent = elm; \
|
|
179
|
+
elm = tmp; \
|
|
180
|
+
} \
|
|
181
|
+
RB_SET_BLACKRED(parent, gparent, field); \
|
|
182
|
+
RB_ROTATE_RIGHT(head, gparent, tmp, field); \
|
|
183
|
+
} else { \
|
|
184
|
+
tmp = RB_LEFT(gparent, field); \
|
|
185
|
+
if (tmp && RB_COLOR(tmp, field) == RB_RED) { \
|
|
186
|
+
RB_COLOR(tmp, field) = RB_BLACK; \
|
|
187
|
+
RB_SET_BLACKRED(parent, gparent, field); \
|
|
188
|
+
elm = gparent; \
|
|
189
|
+
continue; \
|
|
190
|
+
} \
|
|
191
|
+
if (RB_LEFT(parent, field) == elm) { \
|
|
192
|
+
RB_ROTATE_RIGHT(head, parent, tmp, field); \
|
|
193
|
+
tmp = parent; \
|
|
194
|
+
parent = elm; \
|
|
195
|
+
elm = tmp; \
|
|
196
|
+
} \
|
|
197
|
+
RB_SET_BLACKRED(parent, gparent, field); \
|
|
198
|
+
RB_ROTATE_LEFT(head, gparent, tmp, field); \
|
|
199
|
+
} \
|
|
200
|
+
} \
|
|
201
|
+
RB_COLOR(head->rbh_root, field) = RB_BLACK; \
|
|
202
|
+
} \
|
|
203
|
+
\
|
|
204
|
+
attr void \
|
|
205
|
+
name##_RB_REMOVE_COLOR(struct name *head, struct type *parent, \
|
|
206
|
+
struct type *elm) \
|
|
207
|
+
{ \
|
|
208
|
+
struct type *tmp; \
|
|
209
|
+
while ((elm == NULL || RB_COLOR(elm, field) == RB_BLACK) && \
|
|
210
|
+
elm != RB_ROOT(head)) { \
|
|
211
|
+
if (RB_LEFT(parent, field) == elm) { \
|
|
212
|
+
tmp = RB_RIGHT(parent, field); \
|
|
213
|
+
if (RB_COLOR(tmp, field) == RB_RED) { \
|
|
214
|
+
RB_SET_BLACKRED(tmp, parent, field); \
|
|
215
|
+
RB_ROTATE_LEFT(head, parent, tmp, field); \
|
|
216
|
+
tmp = RB_RIGHT(parent, field); \
|
|
217
|
+
} \
|
|
218
|
+
if ((RB_LEFT(tmp, field) == NULL || \
|
|
219
|
+
RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) && \
|
|
220
|
+
(RB_RIGHT(tmp, field) == NULL || \
|
|
221
|
+
RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK)) { \
|
|
222
|
+
RB_COLOR(tmp, field) = RB_RED; \
|
|
223
|
+
elm = parent; \
|
|
224
|
+
parent = RB_PARENT(elm, field); \
|
|
225
|
+
} else { \
|
|
226
|
+
if (RB_RIGHT(tmp, field) == NULL || \
|
|
227
|
+
RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK) { \
|
|
228
|
+
struct type *oleft; \
|
|
229
|
+
if ((oleft = RB_LEFT(tmp, field)) \
|
|
230
|
+
!= NULL) \
|
|
231
|
+
RB_COLOR(oleft, field) = RB_BLACK; \
|
|
232
|
+
RB_COLOR(tmp, field) = RB_RED; \
|
|
233
|
+
RB_ROTATE_RIGHT(head, tmp, oleft, field); \
|
|
234
|
+
tmp = RB_RIGHT(parent, field); \
|
|
235
|
+
} \
|
|
236
|
+
RB_COLOR(tmp, field) = RB_COLOR(parent, field); \
|
|
237
|
+
RB_COLOR(parent, field) = RB_BLACK; \
|
|
238
|
+
if (RB_RIGHT(tmp, field)) \
|
|
239
|
+
RB_COLOR(RB_RIGHT(tmp, field), field) = RB_BLACK; \
|
|
240
|
+
RB_ROTATE_LEFT(head, parent, tmp, field); \
|
|
241
|
+
elm = RB_ROOT(head); \
|
|
242
|
+
break; \
|
|
243
|
+
} \
|
|
244
|
+
} else { \
|
|
245
|
+
tmp = RB_LEFT(parent, field); \
|
|
246
|
+
if (RB_COLOR(tmp, field) == RB_RED) { \
|
|
247
|
+
RB_SET_BLACKRED(tmp, parent, field); \
|
|
248
|
+
RB_ROTATE_RIGHT(head, parent, tmp, field); \
|
|
249
|
+
tmp = RB_LEFT(parent, field); \
|
|
250
|
+
} \
|
|
251
|
+
if ((RB_LEFT(tmp, field) == NULL || \
|
|
252
|
+
RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) && \
|
|
253
|
+
(RB_RIGHT(tmp, field) == NULL || \
|
|
254
|
+
RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK)) { \
|
|
255
|
+
RB_COLOR(tmp, field) = RB_RED; \
|
|
256
|
+
elm = parent; \
|
|
257
|
+
parent = RB_PARENT(elm, field); \
|
|
258
|
+
} else { \
|
|
259
|
+
if (RB_LEFT(tmp, field) == NULL || \
|
|
260
|
+
RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) { \
|
|
261
|
+
struct type *oright; \
|
|
262
|
+
if ((oright = RB_RIGHT(tmp, field)) \
|
|
263
|
+
!= NULL) \
|
|
264
|
+
RB_COLOR(oright, field) = RB_BLACK; \
|
|
265
|
+
RB_COLOR(tmp, field) = RB_RED; \
|
|
266
|
+
RB_ROTATE_LEFT(head, tmp, oright, field); \
|
|
267
|
+
tmp = RB_LEFT(parent, field); \
|
|
268
|
+
} \
|
|
269
|
+
RB_COLOR(tmp, field) = RB_COLOR(parent, field); \
|
|
270
|
+
RB_COLOR(parent, field) = RB_BLACK; \
|
|
271
|
+
if (RB_LEFT(tmp, field)) \
|
|
272
|
+
RB_COLOR(RB_LEFT(tmp, field), field) = RB_BLACK; \
|
|
273
|
+
RB_ROTATE_RIGHT(head, parent, tmp, field); \
|
|
274
|
+
elm = RB_ROOT(head); \
|
|
275
|
+
break; \
|
|
276
|
+
} \
|
|
277
|
+
} \
|
|
278
|
+
} \
|
|
279
|
+
if (elm) \
|
|
280
|
+
RB_COLOR(elm, field) = RB_BLACK; \
|
|
281
|
+
} \
|
|
282
|
+
\
|
|
283
|
+
attr struct type * \
|
|
284
|
+
name##_RB_REMOVE(struct name *head, struct type *elm) \
|
|
285
|
+
{ \
|
|
286
|
+
struct type *child, *parent, *old = elm; \
|
|
287
|
+
int color; \
|
|
288
|
+
if (RB_LEFT(elm, field) == NULL) \
|
|
289
|
+
child = RB_RIGHT(elm, field); \
|
|
290
|
+
else if (RB_RIGHT(elm, field) == NULL) \
|
|
291
|
+
child = RB_LEFT(elm, field); \
|
|
292
|
+
else { \
|
|
293
|
+
struct type *left; \
|
|
294
|
+
elm = RB_RIGHT(elm, field); \
|
|
295
|
+
while ((left = RB_LEFT(elm, field)) != NULL) \
|
|
296
|
+
elm = left; \
|
|
297
|
+
child = RB_RIGHT(elm, field); \
|
|
298
|
+
parent = RB_PARENT(elm, field); \
|
|
299
|
+
color = RB_COLOR(elm, field); \
|
|
300
|
+
if (child) \
|
|
301
|
+
RB_PARENT(child, field) = parent; \
|
|
302
|
+
if (parent) { \
|
|
303
|
+
if (RB_LEFT(parent, field) == elm) \
|
|
304
|
+
RB_LEFT(parent, field) = child; \
|
|
305
|
+
else \
|
|
306
|
+
RB_RIGHT(parent, field) = child; \
|
|
307
|
+
RB_AUGMENT(parent); \
|
|
308
|
+
} else \
|
|
309
|
+
RB_ROOT(head) = child; \
|
|
310
|
+
if (RB_PARENT(elm, field) == old) \
|
|
311
|
+
parent = elm; \
|
|
312
|
+
(elm)->field = (old)->field; \
|
|
313
|
+
if (RB_PARENT(old, field)) { \
|
|
314
|
+
if (RB_LEFT(RB_PARENT(old, field), field) == old) \
|
|
315
|
+
RB_LEFT(RB_PARENT(old, field), field) = elm; \
|
|
316
|
+
else \
|
|
317
|
+
RB_RIGHT(RB_PARENT(old, field), field) = elm; \
|
|
318
|
+
RB_AUGMENT(RB_PARENT(old, field)); \
|
|
319
|
+
} else \
|
|
320
|
+
RB_ROOT(head) = elm; \
|
|
321
|
+
RB_PARENT(RB_LEFT(old, field), field) = elm; \
|
|
322
|
+
if (RB_RIGHT(old, field)) \
|
|
323
|
+
RB_PARENT(RB_RIGHT(old, field), field) = elm; \
|
|
324
|
+
if (parent) { \
|
|
325
|
+
left = parent; \
|
|
326
|
+
do { \
|
|
327
|
+
RB_AUGMENT(left); \
|
|
328
|
+
} while ((left = RB_PARENT(left, field)) != NULL); \
|
|
329
|
+
} \
|
|
330
|
+
goto color; \
|
|
331
|
+
} \
|
|
332
|
+
parent = RB_PARENT(elm, field); \
|
|
333
|
+
color = RB_COLOR(elm, field); \
|
|
334
|
+
if (child) \
|
|
335
|
+
RB_PARENT(child, field) = parent; \
|
|
336
|
+
if (parent) { \
|
|
337
|
+
if (RB_LEFT(parent, field) == elm) \
|
|
338
|
+
RB_LEFT(parent, field) = child; \
|
|
339
|
+
else \
|
|
340
|
+
RB_RIGHT(parent, field) = child; \
|
|
341
|
+
RB_AUGMENT(parent); \
|
|
342
|
+
} else \
|
|
343
|
+
RB_ROOT(head) = child; \
|
|
344
|
+
color: \
|
|
345
|
+
if (color == RB_BLACK) \
|
|
346
|
+
name##_RB_REMOVE_COLOR(head, parent, child); \
|
|
347
|
+
return (old); \
|
|
348
|
+
} \
|
|
349
|
+
\
|
|
350
|
+
/* Inserts a node into the RB tree */ \
|
|
351
|
+
attr struct type * \
|
|
352
|
+
name##_RB_INSERT(struct name *head, struct type *elm) \
|
|
353
|
+
{ \
|
|
354
|
+
struct type *tmp; \
|
|
355
|
+
struct type *parent = NULL; \
|
|
356
|
+
int comp = 0; \
|
|
357
|
+
tmp = RB_ROOT(head); \
|
|
358
|
+
while (tmp) { \
|
|
359
|
+
parent = tmp; \
|
|
360
|
+
comp = (cmp)(elm, parent); \
|
|
361
|
+
if (comp < 0) \
|
|
362
|
+
tmp = RB_LEFT(tmp, field); \
|
|
363
|
+
else if (comp > 0) \
|
|
364
|
+
tmp = RB_RIGHT(tmp, field); \
|
|
365
|
+
else \
|
|
366
|
+
return (tmp); \
|
|
367
|
+
} \
|
|
368
|
+
RB_SET(elm, parent, field); \
|
|
369
|
+
if (parent != NULL) { \
|
|
370
|
+
if (comp < 0) \
|
|
371
|
+
RB_LEFT(parent, field) = elm; \
|
|
372
|
+
else \
|
|
373
|
+
RB_RIGHT(parent, field) = elm; \
|
|
374
|
+
RB_AUGMENT(parent); \
|
|
375
|
+
} else \
|
|
376
|
+
RB_ROOT(head) = elm; \
|
|
377
|
+
name##_RB_INSERT_COLOR(head, elm); \
|
|
378
|
+
return (NULL); \
|
|
379
|
+
} \
|
|
380
|
+
\
|
|
381
|
+
/* Finds the node with the same key as elm */ \
|
|
382
|
+
attr struct type * \
|
|
383
|
+
name##_RB_FIND(struct name *head, struct type *elm) \
|
|
384
|
+
{ \
|
|
385
|
+
struct type *tmp = RB_ROOT(head); \
|
|
386
|
+
int comp; \
|
|
387
|
+
while (tmp) { \
|
|
388
|
+
comp = cmp(elm, tmp); \
|
|
389
|
+
if (comp < 0) \
|
|
390
|
+
tmp = RB_LEFT(tmp, field); \
|
|
391
|
+
else if (comp > 0) \
|
|
392
|
+
tmp = RB_RIGHT(tmp, field); \
|
|
393
|
+
else \
|
|
394
|
+
return (tmp); \
|
|
395
|
+
} \
|
|
396
|
+
return (NULL); \
|
|
397
|
+
} \
|
|
398
|
+
\
|
|
399
|
+
/* Finds the first node greater than or equal to the search key */ \
|
|
400
|
+
attr struct type * \
|
|
401
|
+
name##_RB_NFIND(struct name *head, struct type *elm) \
|
|
402
|
+
{ \
|
|
403
|
+
struct type *tmp = RB_ROOT(head); \
|
|
404
|
+
struct type *res = NULL; \
|
|
405
|
+
int comp; \
|
|
406
|
+
while (tmp) { \
|
|
407
|
+
comp = cmp(elm, tmp); \
|
|
408
|
+
if (comp < 0) { \
|
|
409
|
+
res = tmp; \
|
|
410
|
+
tmp = RB_LEFT(tmp, field); \
|
|
411
|
+
} \
|
|
412
|
+
else if (comp > 0) \
|
|
413
|
+
tmp = RB_RIGHT(tmp, field); \
|
|
414
|
+
else \
|
|
415
|
+
return (tmp); \
|
|
416
|
+
} \
|
|
417
|
+
return (res); \
|
|
418
|
+
} \
|
|
419
|
+
\
|
|
420
|
+
/* ARGSUSED */ \
|
|
421
|
+
attr struct type * \
|
|
422
|
+
name##_RB_NEXT(struct type *elm) \
|
|
423
|
+
{ \
|
|
424
|
+
if (RB_RIGHT(elm, field)) { \
|
|
425
|
+
elm = RB_RIGHT(elm, field); \
|
|
426
|
+
while (RB_LEFT(elm, field)) \
|
|
427
|
+
elm = RB_LEFT(elm, field); \
|
|
428
|
+
} else { \
|
|
429
|
+
if (RB_PARENT(elm, field) && \
|
|
430
|
+
(elm == RB_LEFT(RB_PARENT(elm, field), field))) \
|
|
431
|
+
elm = RB_PARENT(elm, field); \
|
|
432
|
+
else { \
|
|
433
|
+
while (RB_PARENT(elm, field) && \
|
|
434
|
+
(elm == RB_RIGHT(RB_PARENT(elm, field), field))) \
|
|
435
|
+
elm = RB_PARENT(elm, field); \
|
|
436
|
+
elm = RB_PARENT(elm, field); \
|
|
437
|
+
} \
|
|
438
|
+
} \
|
|
439
|
+
return (elm); \
|
|
440
|
+
} \
|
|
441
|
+
\
|
|
442
|
+
/* ARGSUSED */ \
|
|
443
|
+
attr struct type * \
|
|
444
|
+
name##_RB_PREV(struct type *elm) \
|
|
445
|
+
{ \
|
|
446
|
+
if (RB_LEFT(elm, field)) { \
|
|
447
|
+
elm = RB_LEFT(elm, field); \
|
|
448
|
+
while (RB_RIGHT(elm, field)) \
|
|
449
|
+
elm = RB_RIGHT(elm, field); \
|
|
450
|
+
} else { \
|
|
451
|
+
if (RB_PARENT(elm, field) && \
|
|
452
|
+
(elm == RB_RIGHT(RB_PARENT(elm, field), field))) \
|
|
453
|
+
elm = RB_PARENT(elm, field); \
|
|
454
|
+
else { \
|
|
455
|
+
while (RB_PARENT(elm, field) && \
|
|
456
|
+
(elm == RB_LEFT(RB_PARENT(elm, field), field))) \
|
|
457
|
+
elm = RB_PARENT(elm, field); \
|
|
458
|
+
elm = RB_PARENT(elm, field); \
|
|
459
|
+
} \
|
|
460
|
+
} \
|
|
461
|
+
return (elm); \
|
|
462
|
+
} \
|
|
463
|
+
\
|
|
464
|
+
attr struct type * \
|
|
465
|
+
name##_RB_MINMAX(struct name *head, int val) \
|
|
466
|
+
{ \
|
|
467
|
+
struct type *tmp = RB_ROOT(head); \
|
|
468
|
+
struct type *parent = NULL; \
|
|
469
|
+
while (tmp) { \
|
|
470
|
+
parent = tmp; \
|
|
471
|
+
if (val < 0) \
|
|
472
|
+
tmp = RB_LEFT(tmp, field); \
|
|
473
|
+
else \
|
|
474
|
+
tmp = RB_RIGHT(tmp, field); \
|
|
475
|
+
} \
|
|
476
|
+
return (parent); \
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
#define RB_NEGINF -1
|
|
480
|
+
#define RB_INF 1
|
|
481
|
+
|
|
482
|
+
#define RB_INSERT(name, x, y) name##_RB_INSERT(x, y)
|
|
483
|
+
#define RB_REMOVE(name, x, y) name##_RB_REMOVE(x, y)
|
|
484
|
+
#define RB_FIND(name, x, y) name##_RB_FIND(x, y)
|
|
485
|
+
#define RB_NFIND(name, x, y) name##_RB_NFIND(x, y)
|
|
486
|
+
#define RB_NEXT(name, x) name##_RB_NEXT(x)
|
|
487
|
+
#define RB_PREV(name, x) name##_RB_PREV(x)
|
|
488
|
+
#define RB_MIN(name, x) name##_RB_MINMAX(x, RB_NEGINF)
|
|
489
|
+
#define RB_MAX(name, x) name##_RB_MINMAX(x, RB_INF)
|
|
490
|
+
|
|
491
|
+
#define RB_FOREACH(x, name, head) \
|
|
492
|
+
for ((x) = RB_MIN(name, head); \
|
|
493
|
+
(x) != NULL; \
|
|
494
|
+
(x) = name##_RB_NEXT(x))
|
|
495
|
+
|
|
496
|
+
#define RB_FOREACH_FROM(x, name, y) \
|
|
497
|
+
for ((x) = (y); \
|
|
498
|
+
((x) != NULL) && ((y) = name##_RB_NEXT(x), (x) != NULL); \
|
|
499
|
+
(x) = (y))
|
|
500
|
+
|
|
501
|
+
#define RB_FOREACH_SAFE(x, name, head, y) \
|
|
502
|
+
for ((x) = RB_MIN(name, head); \
|
|
503
|
+
((x) != NULL) && ((y) = name##_RB_NEXT(x), (x) != NULL); \
|
|
504
|
+
(x) = (y))
|
|
505
|
+
|
|
506
|
+
#define RB_FOREACH_REVERSE(x, name, head) \
|
|
507
|
+
for ((x) = RB_MAX(name, head); \
|
|
508
|
+
(x) != NULL; \
|
|
509
|
+
(x) = name##_RB_PREV(x))
|
|
510
|
+
|
|
511
|
+
#define RB_FOREACH_REVERSE_FROM(x, name, y) \
|
|
512
|
+
for ((x) = (y); \
|
|
513
|
+
((x) != NULL) && ((y) = name##_RB_PREV(x), (x) != NULL); \
|
|
514
|
+
(x) = (y))
|
|
515
|
+
|
|
516
|
+
#define RB_FOREACH_REVERSE_SAFE(x, name, head, y) \
|
|
517
|
+
for ((x) = RB_MAX(name, head); \
|
|
518
|
+
((x) != NULL) && ((y) = name##_RB_PREV(x), (x) != NULL); \
|
|
519
|
+
(x) = (y))
|
|
520
|
+
|
|
521
|
+
#endif /* UV_TREE_H_ */
|