visaljs 0.0.4 → 0.0.6

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.
Files changed (433) hide show
  1. package/cli.js +469 -53
  2. package/node/include/js_node.h +36 -0
  3. package/node/prelude/async_hooks.js +63 -8
  4. package/node/prelude/buffer.js +0 -0
  5. package/node/prelude/diagnostics_channel.js +322 -0
  6. package/node/prelude/dns.js +3 -2
  7. package/node/prelude/events.js +17 -3
  8. package/node/prelude/fs.js +177 -5
  9. package/node/prelude/fs_promises.js +24 -0
  10. package/node/prelude/http.js +13 -4
  11. package/node/prelude/http2.js +0 -0
  12. package/node/prelude/internal/async_context.js +27 -0
  13. package/node/prelude/internal/crypto/asym.js +0 -0
  14. package/node/prelude/internal/crypto/cipher.js +0 -0
  15. package/node/prelude/internal/crypto/kdf.js +0 -0
  16. package/node/prelude/internal/crypto/keys.js +0 -0
  17. package/node/prelude/internal/crypto/random.js +0 -0
  18. package/node/prelude/internal/crypto/util.js +0 -0
  19. package/node/prelude/internal/errors.js +11 -0
  20. package/node/prelude/internal/process_events.js +14 -0
  21. package/node/prelude/internal/process_signals.js +42 -0
  22. package/node/prelude/internal/querystring.js +0 -0
  23. package/node/prelude/internal/timers.js +233 -0
  24. package/node/prelude/internal/timers_global.js +9 -0
  25. package/node/prelude/internal/zlib_brotli.js +6 -0
  26. package/node/prelude/internal/zlib_engines.js +4 -0
  27. package/node/prelude/internal/zlib_zstd.js +6 -0
  28. package/node/prelude/module.js +22 -6
  29. package/node/prelude/net.js +9 -8
  30. package/node/prelude/os.js +0 -0
  31. package/node/prelude/path.js +1599 -186
  32. package/node/prelude/path_posix.js +9 -0
  33. package/node/prelude/path_win32.js +9 -0
  34. package/node/prelude/process.js +3 -0
  35. package/node/prelude/querystring.js +0 -0
  36. package/node/prelude/stream.js +18 -6
  37. package/node/prelude/stream_promises.js +0 -0
  38. package/node/prelude/stream_web.js +0 -0
  39. package/node/prelude/string_decoder.js +0 -0
  40. package/node/prelude/timers.js +92 -0
  41. package/node/prelude/timers_promises.js +133 -0
  42. package/node/prelude/tty.js +0 -0
  43. package/node/prelude/url.js +0 -0
  44. package/node/prelude/util.js +0 -0
  45. package/node/prelude/zlib.js +912 -72
  46. package/node/src/host_brotli.c +157 -0
  47. package/node/src/host_fs.c +95 -1
  48. package/node/src/host_loop.c +10 -4
  49. package/node/src/host_os.c +0 -0
  50. package/node/src/host_signal.c +70 -0
  51. package/node/src/host_sys.c +50 -0
  52. package/node/src/host_zlib.c +314 -0
  53. package/node/src/host_zstd.c +179 -0
  54. package/node/third_party/brotli/LICENSE +19 -0
  55. package/node/third_party/brotli/common/constants.c +15 -0
  56. package/node/third_party/brotli/common/constants.h +201 -0
  57. package/node/third_party/brotli/common/context.c +156 -0
  58. package/node/third_party/brotli/common/context.h +113 -0
  59. package/node/third_party/brotli/common/dictionary.c +5916 -0
  60. package/node/third_party/brotli/common/dictionary.h +64 -0
  61. package/node/third_party/brotli/common/platform.c +23 -0
  62. package/node/third_party/brotli/common/platform.h +541 -0
  63. package/node/third_party/brotli/common/shared_dictionary.c +521 -0
  64. package/node/third_party/brotli/common/shared_dictionary_internal.h +75 -0
  65. package/node/third_party/brotli/common/transform.c +291 -0
  66. package/node/third_party/brotli/common/transform.h +85 -0
  67. package/node/third_party/brotli/common/version.h +51 -0
  68. package/node/third_party/brotli/dec/bit_reader.c +78 -0
  69. package/node/third_party/brotli/dec/bit_reader.h +423 -0
  70. package/node/third_party/brotli/dec/decode.c +2875 -0
  71. package/node/third_party/brotli/dec/huffman.c +342 -0
  72. package/node/third_party/brotli/dec/huffman.h +122 -0
  73. package/node/third_party/brotli/dec/prefix.h +733 -0
  74. package/node/third_party/brotli/dec/state.c +183 -0
  75. package/node/third_party/brotli/dec/state.h +400 -0
  76. package/node/third_party/brotli/enc/backward_references.c +207 -0
  77. package/node/third_party/brotli/enc/backward_references.h +40 -0
  78. package/node/third_party/brotli/enc/backward_references_hq.c +939 -0
  79. package/node/third_party/brotli/enc/backward_references_hq.h +96 -0
  80. package/node/third_party/brotli/enc/backward_references_inc.h +189 -0
  81. package/node/third_party/brotli/enc/bit_cost.c +36 -0
  82. package/node/third_party/brotli/enc/bit_cost.h +64 -0
  83. package/node/third_party/brotli/enc/bit_cost_inc.h +127 -0
  84. package/node/third_party/brotli/enc/block_encoder_inc.h +34 -0
  85. package/node/third_party/brotli/enc/block_splitter.c +217 -0
  86. package/node/third_party/brotli/enc/block_splitter.h +52 -0
  87. package/node/third_party/brotli/enc/block_splitter_inc.h +481 -0
  88. package/node/third_party/brotli/enc/brotli_bit_stream.c +1336 -0
  89. package/node/third_party/brotli/enc/brotli_bit_stream.h +89 -0
  90. package/node/third_party/brotli/enc/cluster.c +57 -0
  91. package/node/third_party/brotli/enc/cluster.h +49 -0
  92. package/node/third_party/brotli/enc/cluster_inc.h +325 -0
  93. package/node/third_party/brotli/enc/command.c +28 -0
  94. package/node/third_party/brotli/enc/command.h +191 -0
  95. package/node/third_party/brotli/enc/compound_dictionary.c +207 -0
  96. package/node/third_party/brotli/enc/compound_dictionary.h +74 -0
  97. package/node/third_party/brotli/enc/compress_fragment.c +800 -0
  98. package/node/third_party/brotli/enc/compress_fragment.h +86 -0
  99. package/node/third_party/brotli/enc/compress_fragment_two_pass.c +657 -0
  100. package/node/third_party/brotli/enc/compress_fragment_two_pass.h +72 -0
  101. package/node/third_party/brotli/enc/dictionary_hash.c +1848 -0
  102. package/node/third_party/brotli/enc/dictionary_hash.h +25 -0
  103. package/node/third_party/brotli/enc/encode.c +1996 -0
  104. package/node/third_party/brotli/enc/encoder_dict.c +640 -0
  105. package/node/third_party/brotli/enc/encoder_dict.h +157 -0
  106. package/node/third_party/brotli/enc/entropy_encode.c +504 -0
  107. package/node/third_party/brotli/enc/entropy_encode.h +123 -0
  108. package/node/third_party/brotli/enc/entropy_encode_static.h +542 -0
  109. package/node/third_party/brotli/enc/fast_log.c +105 -0
  110. package/node/third_party/brotli/enc/fast_log.h +67 -0
  111. package/node/third_party/brotli/enc/find_match_length.h +72 -0
  112. package/node/third_party/brotli/enc/hash.h +728 -0
  113. package/node/third_party/brotli/enc/hash_composite_inc.h +140 -0
  114. package/node/third_party/brotli/enc/hash_forgetful_chain_inc.h +295 -0
  115. package/node/third_party/brotli/enc/hash_longest_match64_inc.h +262 -0
  116. package/node/third_party/brotli/enc/hash_longest_match_inc.h +258 -0
  117. package/node/third_party/brotli/enc/hash_longest_match_quickly_inc.h +266 -0
  118. package/node/third_party/brotli/enc/hash_rolling_inc.h +212 -0
  119. package/node/third_party/brotli/enc/hash_to_binary_tree_inc.h +330 -0
  120. package/node/third_party/brotli/enc/histogram.c +100 -0
  121. package/node/third_party/brotli/enc/histogram.h +64 -0
  122. package/node/third_party/brotli/enc/histogram_inc.h +51 -0
  123. package/node/third_party/brotli/enc/literal_cost.c +180 -0
  124. package/node/third_party/brotli/enc/literal_cost.h +32 -0
  125. package/node/third_party/brotli/enc/memory.c +194 -0
  126. package/node/third_party/brotli/enc/memory.h +131 -0
  127. package/node/third_party/brotli/enc/metablock.c +677 -0
  128. package/node/third_party/brotli/enc/metablock.h +106 -0
  129. package/node/third_party/brotli/enc/metablock_inc.h +185 -0
  130. package/node/third_party/brotli/enc/params.h +47 -0
  131. package/node/third_party/brotli/enc/prefix.h +54 -0
  132. package/node/third_party/brotli/enc/quality.h +202 -0
  133. package/node/third_party/brotli/enc/ringbuffer.h +168 -0
  134. package/node/third_party/brotli/enc/state.h +104 -0
  135. package/node/third_party/brotli/enc/static_dict.c +542 -0
  136. package/node/third_party/brotli/enc/static_dict.h +41 -0
  137. package/node/third_party/brotli/enc/static_dict_lut.h +5866 -0
  138. package/node/third_party/brotli/enc/utf8_util.c +85 -0
  139. package/node/third_party/brotli/enc/utf8_util.h +33 -0
  140. package/node/third_party/brotli/enc/write_bits.h +88 -0
  141. package/node/third_party/brotli/include/brotli/decode.h +409 -0
  142. package/node/third_party/brotli/include/brotli/encode.h +501 -0
  143. package/node/third_party/brotli/include/brotli/port.h +305 -0
  144. package/node/third_party/brotli/include/brotli/shared_dictionary.h +100 -0
  145. package/node/third_party/brotli/include/brotli/types.h +83 -0
  146. package/node/third_party/libuv/LICENSE +0 -0
  147. package/node/third_party/libuv/include/uv/aix.h +0 -0
  148. package/node/third_party/libuv/include/uv/bsd.h +0 -0
  149. package/node/third_party/libuv/include/uv/darwin.h +0 -0
  150. package/node/third_party/libuv/include/uv/errno.h +0 -0
  151. package/node/third_party/libuv/include/uv/linux.h +0 -0
  152. package/node/third_party/libuv/include/uv/os390.h +0 -0
  153. package/node/third_party/libuv/include/uv/posix.h +0 -0
  154. package/node/third_party/libuv/include/uv/sunos.h +0 -0
  155. package/node/third_party/libuv/include/uv/threadpool.h +0 -0
  156. package/node/third_party/libuv/include/uv/tree.h +0 -0
  157. package/node/third_party/libuv/include/uv/unix.h +0 -0
  158. package/node/third_party/libuv/include/uv/version.h +0 -0
  159. package/node/third_party/libuv/include/uv/win.h +0 -0
  160. package/node/third_party/libuv/include/uv.h +0 -0
  161. package/node/third_party/libuv/src/fs-poll.c +0 -0
  162. package/node/third_party/libuv/src/heap-inl.h +0 -0
  163. package/node/third_party/libuv/src/idna.c +0 -0
  164. package/node/third_party/libuv/src/idna.h +0 -0
  165. package/node/third_party/libuv/src/inet.c +0 -0
  166. package/node/third_party/libuv/src/queue.h +0 -0
  167. package/node/third_party/libuv/src/random.c +0 -0
  168. package/node/third_party/libuv/src/strscpy.c +0 -0
  169. package/node/third_party/libuv/src/strscpy.h +0 -0
  170. package/node/third_party/libuv/src/strtok.c +0 -0
  171. package/node/third_party/libuv/src/strtok.h +0 -0
  172. package/node/third_party/libuv/src/thread-common.c +0 -0
  173. package/node/third_party/libuv/src/threadpool.c +0 -0
  174. package/node/third_party/libuv/src/timer.c +0 -0
  175. package/node/third_party/libuv/src/unix/async.c +0 -0
  176. package/node/third_party/libuv/src/unix/bsd-ifaddrs.c +0 -0
  177. package/node/third_party/libuv/src/unix/core.c +0 -0
  178. package/node/third_party/libuv/src/unix/darwin-proctitle.c +0 -0
  179. package/node/third_party/libuv/src/unix/darwin-stub.h +0 -0
  180. package/node/third_party/libuv/src/unix/darwin-syscalls.h +0 -0
  181. package/node/third_party/libuv/src/unix/darwin.c +0 -0
  182. package/node/third_party/libuv/src/unix/dl.c +0 -0
  183. package/node/third_party/libuv/src/unix/fs.c +0 -0
  184. package/node/third_party/libuv/src/unix/fsevents.c +0 -0
  185. package/node/third_party/libuv/src/unix/getaddrinfo.c +0 -0
  186. package/node/third_party/libuv/src/unix/getnameinfo.c +0 -0
  187. package/node/third_party/libuv/src/unix/internal.h +0 -0
  188. package/node/third_party/libuv/src/unix/kqueue.c +0 -0
  189. package/node/third_party/libuv/src/unix/linux.c +0 -0
  190. package/node/third_party/libuv/src/unix/loop-watcher.c +0 -0
  191. package/node/third_party/libuv/src/unix/loop.c +0 -0
  192. package/node/third_party/libuv/src/unix/pipe.c +0 -0
  193. package/node/third_party/libuv/src/unix/poll.c +0 -0
  194. package/node/third_party/libuv/src/unix/process.c +0 -0
  195. package/node/third_party/libuv/src/unix/procfs-exepath.c +0 -0
  196. package/node/third_party/libuv/src/unix/proctitle.c +0 -0
  197. package/node/third_party/libuv/src/unix/random-devurandom.c +0 -0
  198. package/node/third_party/libuv/src/unix/random-getentropy.c +0 -0
  199. package/node/third_party/libuv/src/unix/random-getrandom.c +0 -0
  200. package/node/third_party/libuv/src/unix/random-sysctl-linux.c +0 -0
  201. package/node/third_party/libuv/src/unix/signal.c +0 -0
  202. package/node/third_party/libuv/src/unix/stream.c +0 -0
  203. package/node/third_party/libuv/src/unix/tcp.c +0 -0
  204. package/node/third_party/libuv/src/unix/thread.c +0 -0
  205. package/node/third_party/libuv/src/unix/tty.c +0 -0
  206. package/node/third_party/libuv/src/unix/udp.c +0 -0
  207. package/node/third_party/libuv/src/uv-common.c +0 -0
  208. package/node/third_party/libuv/src/uv-common.h +0 -0
  209. package/node/third_party/libuv/src/uv-data-getter-setters.c +0 -0
  210. package/node/third_party/libuv/src/version.c +0 -0
  211. package/node/third_party/llhttp/LICENSE +0 -0
  212. package/node/third_party/llhttp/api.c +0 -0
  213. package/node/third_party/llhttp/http.c +0 -0
  214. package/node/third_party/llhttp/llhttp.c +0 -0
  215. package/node/third_party/llhttp/llhttp.h +0 -0
  216. package/node/third_party/zlib/LICENSE +19 -0
  217. package/node/third_party/zlib/README.chromium +38 -0
  218. package/node/third_party/zlib/adler32.c +197 -0
  219. package/node/third_party/zlib/chromeconf.h +203 -0
  220. package/node/third_party/zlib/contrib/optimizations/insert_string.h +80 -0
  221. package/node/third_party/zlib/cpu_features.c +213 -0
  222. package/node/third_party/zlib/cpu_features.h +22 -0
  223. package/node/third_party/zlib/crc32.c +1192 -0
  224. package/node/third_party/zlib/crc32.h +9446 -0
  225. package/node/third_party/zlib/deflate.c +2289 -0
  226. package/node/third_party/zlib/deflate.h +407 -0
  227. package/node/third_party/zlib/gzguts.h +214 -0
  228. package/node/third_party/zlib/inffast.c +327 -0
  229. package/node/third_party/zlib/inffast.h +26 -0
  230. package/node/third_party/zlib/inffixed.h +94 -0
  231. package/node/third_party/zlib/inflate.c +1528 -0
  232. package/node/third_party/zlib/inflate.h +126 -0
  233. package/node/third_party/zlib/inftrees.c +299 -0
  234. package/node/third_party/zlib/inftrees.h +62 -0
  235. package/node/third_party/zlib/trees.c +1161 -0
  236. package/node/third_party/zlib/trees.h +128 -0
  237. package/node/third_party/zlib/zconf.h +558 -0
  238. package/node/third_party/zlib/zlib.h +1967 -0
  239. package/node/third_party/zlib/zutil.c +299 -0
  240. package/node/third_party/zlib/zutil.h +275 -0
  241. package/node/third_party/zstd/LICENSE +30 -0
  242. package/node/third_party/zstd/common/allocations.h +55 -0
  243. package/node/third_party/zstd/common/bits.h +205 -0
  244. package/node/third_party/zstd/common/bitstream.h +454 -0
  245. package/node/third_party/zstd/common/compiler.h +464 -0
  246. package/node/third_party/zstd/common/cpu.h +249 -0
  247. package/node/third_party/zstd/common/debug.c +30 -0
  248. package/node/third_party/zstd/common/debug.h +107 -0
  249. package/node/third_party/zstd/common/entropy_common.c +340 -0
  250. package/node/third_party/zstd/common/error_private.c +64 -0
  251. package/node/third_party/zstd/common/error_private.h +158 -0
  252. package/node/third_party/zstd/common/fse.h +625 -0
  253. package/node/third_party/zstd/common/fse_decompress.c +315 -0
  254. package/node/third_party/zstd/common/huf.h +277 -0
  255. package/node/third_party/zstd/common/mem.h +422 -0
  256. package/node/third_party/zstd/common/pool.c +371 -0
  257. package/node/third_party/zstd/common/pool.h +81 -0
  258. package/node/third_party/zstd/common/portability_macros.h +171 -0
  259. package/node/third_party/zstd/common/threading.c +182 -0
  260. package/node/third_party/zstd/common/threading.h +142 -0
  261. package/node/third_party/zstd/common/xxhash.c +18 -0
  262. package/node/third_party/zstd/common/xxhash.h +7094 -0
  263. package/node/third_party/zstd/common/zstd_common.c +48 -0
  264. package/node/third_party/zstd/common/zstd_deps.h +123 -0
  265. package/node/third_party/zstd/common/zstd_internal.h +324 -0
  266. package/node/third_party/zstd/common/zstd_trace.h +156 -0
  267. package/node/third_party/zstd/compress/clevels.h +134 -0
  268. package/node/third_party/zstd/compress/fse_compress.c +625 -0
  269. package/node/third_party/zstd/compress/hist.c +191 -0
  270. package/node/third_party/zstd/compress/hist.h +82 -0
  271. package/node/third_party/zstd/compress/huf_compress.c +1464 -0
  272. package/node/third_party/zstd/compress/zstd_compress.c +7843 -0
  273. package/node/third_party/zstd/compress/zstd_compress_internal.h +1636 -0
  274. package/node/third_party/zstd/compress/zstd_compress_literals.c +235 -0
  275. package/node/third_party/zstd/compress/zstd_compress_literals.h +39 -0
  276. package/node/third_party/zstd/compress/zstd_compress_sequences.c +442 -0
  277. package/node/third_party/zstd/compress/zstd_compress_sequences.h +55 -0
  278. package/node/third_party/zstd/compress/zstd_compress_superblock.c +688 -0
  279. package/node/third_party/zstd/compress/zstd_compress_superblock.h +32 -0
  280. package/node/third_party/zstd/compress/zstd_cwksp.h +765 -0
  281. package/node/third_party/zstd/compress/zstd_double_fast.c +778 -0
  282. package/node/third_party/zstd/compress/zstd_double_fast.h +42 -0
  283. package/node/third_party/zstd/compress/zstd_fast.c +985 -0
  284. package/node/third_party/zstd/compress/zstd_fast.h +30 -0
  285. package/node/third_party/zstd/compress/zstd_lazy.c +2199 -0
  286. package/node/third_party/zstd/compress/zstd_lazy.h +193 -0
  287. package/node/third_party/zstd/compress/zstd_ldm.c +745 -0
  288. package/node/third_party/zstd/compress/zstd_ldm.h +109 -0
  289. package/node/third_party/zstd/compress/zstd_ldm_geartab.h +106 -0
  290. package/node/third_party/zstd/compress/zstd_opt.c +1580 -0
  291. package/node/third_party/zstd/compress/zstd_opt.h +72 -0
  292. package/node/third_party/zstd/compress/zstd_preSplit.c +238 -0
  293. package/node/third_party/zstd/compress/zstd_preSplit.h +33 -0
  294. package/node/third_party/zstd/compress/zstdmt_compress.c +1923 -0
  295. package/node/third_party/zstd/compress/zstdmt_compress.h +102 -0
  296. package/node/third_party/zstd/decompress/huf_decompress.c +1944 -0
  297. package/node/third_party/zstd/decompress/zstd_ddict.c +244 -0
  298. package/node/third_party/zstd/decompress/zstd_ddict.h +44 -0
  299. package/node/third_party/zstd/decompress/zstd_decompress.c +2410 -0
  300. package/node/third_party/zstd/decompress/zstd_decompress_block.c +2209 -0
  301. package/node/third_party/zstd/decompress/zstd_decompress_block.h +73 -0
  302. package/node/third_party/zstd/decompress/zstd_decompress_internal.h +240 -0
  303. package/node/third_party/zstd/zdict.h +481 -0
  304. package/node/third_party/zstd/zstd.h +3198 -0
  305. package/node/third_party/zstd/zstd_errors.h +107 -0
  306. package/package.json +1 -1
  307. package/runtime/include/js_atoms.gen.h +0 -0
  308. package/runtime/include/js_atoms.h +0 -0
  309. package/runtime/include/js_bigint.h +0 -0
  310. package/runtime/include/js_buffer.h +0 -0
  311. package/runtime/include/js_builtins.h +0 -0
  312. package/runtime/include/js_console.h +5 -2
  313. package/runtime/include/js_convert.h +0 -0
  314. package/runtime/include/js_core.def +0 -0
  315. package/runtime/include/js_error.h +0 -0
  316. package/runtime/include/js_exception.h +0 -0
  317. package/runtime/include/js_function.h +0 -0
  318. package/runtime/include/js_gc.h +0 -0
  319. package/runtime/include/js_generator.h +0 -0
  320. package/runtime/include/js_host.h +5 -3
  321. package/runtime/include/js_jobs.h +18 -1
  322. package/runtime/include/js_module.h +0 -0
  323. package/runtime/include/js_object.h +0 -0
  324. package/runtime/include/js_ops.h +0 -0
  325. package/runtime/include/js_promise.h +1 -0
  326. package/runtime/include/js_regexp.h +0 -0
  327. package/runtime/include/js_runtime.h +0 -0
  328. package/runtime/include/js_symbol.h +0 -0
  329. package/runtime/include/js_web.h +0 -0
  330. package/runtime/include/jscell.h +0 -0
  331. package/runtime/include/jscontext.h +14 -0
  332. package/runtime/include/jsnum.h +0 -0
  333. package/runtime/include/jsstring.h +0 -0
  334. package/runtime/include/jsvalue.h +0 -0
  335. package/runtime/src/arguments.c +0 -0
  336. package/runtime/src/array.c +0 -0
  337. package/runtime/src/arraybuffer.c +0 -0
  338. package/runtime/src/async_iter.c +0 -0
  339. package/runtime/src/atoms.c +0 -0
  340. package/runtime/src/base64.c +0 -0
  341. package/runtime/src/bigint.c +0 -0
  342. package/runtime/src/blob.c +0 -0
  343. package/runtime/src/buffer.c +20 -16
  344. package/runtime/src/builtin_table.c +0 -0
  345. package/runtime/src/builtins.c +0 -0
  346. package/runtime/src/builtins_util.h +0 -0
  347. package/runtime/src/collections.c +0 -0
  348. package/runtime/src/components.c +0 -0
  349. package/runtime/src/console.c +15 -2
  350. package/runtime/src/convert.c +0 -0
  351. package/runtime/src/core_all.c +0 -0
  352. package/runtime/src/crypto.c +0 -0
  353. package/runtime/src/crypto_host.c +0 -0
  354. package/runtime/src/crypto_kdf.c +0 -0
  355. package/runtime/src/crypto_key.c +0 -0
  356. package/runtime/src/date.c +0 -0
  357. package/runtime/src/domexception.c +0 -0
  358. package/runtime/src/elements.c +0 -0
  359. package/runtime/src/elements.h +0 -0
  360. package/runtime/src/encoding.c +0 -0
  361. package/runtime/src/error.c +0 -0
  362. package/runtime/src/events.c +1 -1
  363. package/runtime/src/exception.c +0 -0
  364. package/runtime/src/fetch.c +0 -0
  365. package/runtime/src/function.c +0 -0
  366. package/runtime/src/gc.c +2 -0
  367. package/runtime/src/generator.c +0 -0
  368. package/runtime/src/global.c +0 -0
  369. package/runtime/src/headers.c +0 -0
  370. package/runtime/src/inspect.c +0 -0
  371. package/runtime/src/internal.h +0 -0
  372. package/runtime/src/iterate.c +0 -0
  373. package/runtime/src/iterator.c +0 -0
  374. package/runtime/src/jobs.c +123 -44
  375. package/runtime/src/jsnum.c +0 -0
  376. package/runtime/src/json.c +0 -0
  377. package/runtime/src/math.c +0 -0
  378. package/runtime/src/module.c +0 -0
  379. package/runtime/src/number.c +0 -0
  380. package/runtime/src/object.c +0 -0
  381. package/runtime/src/ops.c +0 -0
  382. package/runtime/src/os.c +0 -0
  383. package/runtime/src/os.h +0 -0
  384. package/runtime/src/process.c +92 -8
  385. package/runtime/src/promise.c +7 -2
  386. package/runtime/src/proxy.c +0 -0
  387. package/runtime/src/reflect.c +0 -0
  388. package/runtime/src/regexp.c +0 -0
  389. package/runtime/src/regexp_anchor.h +0 -0
  390. package/runtime/src/regexp_message.h +0 -0
  391. package/runtime/src/shape.c +0 -0
  392. package/runtime/src/shape.h +0 -0
  393. package/runtime/src/streams.c +0 -0
  394. package/runtime/src/streams.h +0 -0
  395. package/runtime/src/string.c +0 -0
  396. package/runtime/src/string_builtins.c +0 -0
  397. package/runtime/src/symbol.c +0 -0
  398. package/runtime/src/test_host.c +0 -0
  399. package/runtime/src/typedarray.c +0 -0
  400. package/runtime/src/tznames.gen.h +0 -0
  401. package/runtime/src/uri.c +0 -0
  402. package/runtime/src/url.c +0 -0
  403. package/runtime/src/weak.c +1 -4
  404. package/runtime/src/web.c +0 -0
  405. package/runtime/src/wrapper.c +0 -0
  406. package/runtime/src/writable.c +0 -0
  407. package/runtime/third_party/ada-idna/LICENSE-MIT +0 -0
  408. package/runtime/third_party/ada-idna/README.md +0 -0
  409. package/runtime/third_party/ada-idna/convert.mjs +0 -0
  410. package/runtime/third_party/ada-idna/idna.c +0 -0
  411. package/runtime/third_party/ada-idna/idna.h +0 -0
  412. package/runtime/third_party/ada-idna/idna_tables.h +0 -0
  413. package/runtime/third_party/quickjs-dtoa/LICENSE +0 -0
  414. package/runtime/third_party/quickjs-dtoa/README.md +0 -0
  415. package/runtime/third_party/quickjs-dtoa/dtoa.c +0 -0
  416. package/runtime/third_party/quickjs-dtoa/dtoa.h +0 -0
  417. package/runtime/third_party/quickjs-dtoa/dtoa_compat.h +0 -0
  418. package/runtime/third_party/quickjs-regexp/LICENSE +0 -0
  419. package/runtime/third_party/quickjs-regexp/README.md +0 -0
  420. package/runtime/third_party/quickjs-regexp/cutils.c +0 -0
  421. package/runtime/third_party/quickjs-regexp/cutils.h +0 -0
  422. package/runtime/third_party/quickjs-regexp/libregexp-opcode.h +0 -0
  423. package/runtime/third_party/quickjs-regexp/libregexp.c +0 -0
  424. package/runtime/third_party/quickjs-regexp/libregexp.h +0 -0
  425. package/runtime/third_party/quickjs-regexp/libunicode-table.h +0 -0
  426. package/runtime/third_party/quickjs-regexp/libunicode.c +0 -0
  427. package/runtime/third_party/quickjs-regexp/libunicode.h +0 -0
  428. package/runtime/third_party/v8-ieee754/LICENSE +0 -0
  429. package/runtime/third_party/v8-ieee754/README.md +0 -0
  430. package/runtime/third_party/v8-ieee754/convert.py +0 -0
  431. package/runtime/third_party/v8-ieee754/ieee754.c +0 -0
  432. package/runtime/third_party/v8-ieee754/ieee754.h +0 -0
  433. package/runtime/tools/regexp_compile.c +0 -0
@@ -0,0 +1,299 @@
1
+ /* zutil.c -- target dependent utility functions for the compression library
2
+ * Copyright (C) 1995-2017 Jean-loup Gailly
3
+ * For conditions of distribution and use, see copyright notice in zlib.h
4
+ */
5
+
6
+ /* @(#) $Id$ */
7
+
8
+ #include "zutil.h"
9
+ #ifndef Z_SOLO
10
+ # include "gzguts.h"
11
+ #endif
12
+
13
+ z_const char * const z_errmsg[10] = {
14
+ (z_const char *)"need dictionary", /* Z_NEED_DICT 2 */
15
+ (z_const char *)"stream end", /* Z_STREAM_END 1 */
16
+ (z_const char *)"", /* Z_OK 0 */
17
+ (z_const char *)"file error", /* Z_ERRNO (-1) */
18
+ (z_const char *)"stream error", /* Z_STREAM_ERROR (-2) */
19
+ (z_const char *)"data error", /* Z_DATA_ERROR (-3) */
20
+ (z_const char *)"insufficient memory", /* Z_MEM_ERROR (-4) */
21
+ (z_const char *)"buffer error", /* Z_BUF_ERROR (-5) */
22
+ (z_const char *)"incompatible version",/* Z_VERSION_ERROR (-6) */
23
+ (z_const char *)""
24
+ };
25
+
26
+
27
+ const char * ZEXPORT zlibVersion(void) {
28
+ return ZLIB_VERSION;
29
+ }
30
+
31
+ uLong ZEXPORT zlibCompileFlags(void) {
32
+ uLong flags;
33
+
34
+ flags = 0;
35
+ switch ((int)(sizeof(uInt))) {
36
+ case 2: break;
37
+ case 4: flags += 1; break;
38
+ case 8: flags += 2; break;
39
+ default: flags += 3;
40
+ }
41
+ switch ((int)(sizeof(uLong))) {
42
+ case 2: break;
43
+ case 4: flags += 1 << 2; break;
44
+ case 8: flags += 2 << 2; break;
45
+ default: flags += 3 << 2;
46
+ }
47
+ switch ((int)(sizeof(voidpf))) {
48
+ case 2: break;
49
+ case 4: flags += 1 << 4; break;
50
+ case 8: flags += 2 << 4; break;
51
+ default: flags += 3 << 4;
52
+ }
53
+ switch ((int)(sizeof(z_off_t))) {
54
+ case 2: break;
55
+ case 4: flags += 1 << 6; break;
56
+ case 8: flags += 2 << 6; break;
57
+ default: flags += 3 << 6;
58
+ }
59
+ #ifdef ZLIB_DEBUG
60
+ flags += 1 << 8;
61
+ #endif
62
+ /*
63
+ #if defined(ASMV) || defined(ASMINF)
64
+ flags += 1 << 9;
65
+ #endif
66
+ */
67
+ #ifdef ZLIB_WINAPI
68
+ flags += 1 << 10;
69
+ #endif
70
+ #ifdef BUILDFIXED
71
+ flags += 1 << 12;
72
+ #endif
73
+ #ifdef DYNAMIC_CRC_TABLE
74
+ flags += 1 << 13;
75
+ #endif
76
+ #ifdef NO_GZCOMPRESS
77
+ flags += 1L << 16;
78
+ #endif
79
+ #ifdef NO_GZIP
80
+ flags += 1L << 17;
81
+ #endif
82
+ #ifdef PKZIP_BUG_WORKAROUND
83
+ flags += 1L << 20;
84
+ #endif
85
+ #ifdef FASTEST
86
+ flags += 1L << 21;
87
+ #endif
88
+ #if defined(STDC) || defined(Z_HAVE_STDARG_H)
89
+ # ifdef NO_vsnprintf
90
+ flags += 1L << 25;
91
+ # ifdef HAS_vsprintf_void
92
+ flags += 1L << 26;
93
+ # endif
94
+ # else
95
+ # ifdef HAS_vsnprintf_void
96
+ flags += 1L << 26;
97
+ # endif
98
+ # endif
99
+ #else
100
+ flags += 1L << 24;
101
+ # ifdef NO_snprintf
102
+ flags += 1L << 25;
103
+ # ifdef HAS_sprintf_void
104
+ flags += 1L << 26;
105
+ # endif
106
+ # else
107
+ # ifdef HAS_snprintf_void
108
+ flags += 1L << 26;
109
+ # endif
110
+ # endif
111
+ #endif
112
+ return flags;
113
+ }
114
+
115
+ #ifdef ZLIB_DEBUG
116
+ #include <stdlib.h>
117
+ # ifndef verbose
118
+ # define verbose 0
119
+ # endif
120
+ int ZLIB_INTERNAL z_verbose = verbose;
121
+
122
+ void ZLIB_INTERNAL z_error(char *m) {
123
+ fprintf(stderr, "%s\n", m);
124
+ exit(1);
125
+ }
126
+ #endif
127
+
128
+ /* exported to allow conversion of error code to string for compress() and
129
+ * uncompress()
130
+ */
131
+ const char * ZEXPORT zError(int err) {
132
+ return ERR_MSG(err);
133
+ }
134
+
135
+ #if defined(_WIN32_WCE) && _WIN32_WCE < 0x800
136
+ /* The older Microsoft C Run-Time Library for Windows CE doesn't have
137
+ * errno. We define it as a global variable to simplify porting.
138
+ * Its value is always 0 and should not be used.
139
+ */
140
+ int errno = 0;
141
+ #endif
142
+
143
+ #ifndef HAVE_MEMCPY
144
+
145
+ void ZLIB_INTERNAL zmemcpy(Bytef* dest, const Bytef* source, uInt len) {
146
+ if (len == 0) return;
147
+ do {
148
+ *dest++ = *source++; /* ??? to be unrolled */
149
+ } while (--len != 0);
150
+ }
151
+
152
+ int ZLIB_INTERNAL zmemcmp(const Bytef* s1, const Bytef* s2, uInt len) {
153
+ uInt j;
154
+
155
+ for (j = 0; j < len; j++) {
156
+ if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1;
157
+ }
158
+ return 0;
159
+ }
160
+
161
+ void ZLIB_INTERNAL zmemzero(Bytef* dest, uInt len) {
162
+ if (len == 0) return;
163
+ do {
164
+ *dest++ = 0; /* ??? to be unrolled */
165
+ } while (--len != 0);
166
+ }
167
+ #endif
168
+
169
+ #ifndef Z_SOLO
170
+
171
+ #ifdef SYS16BIT
172
+
173
+ #ifdef __TURBOC__
174
+ /* Turbo C in 16-bit mode */
175
+
176
+ # define MY_ZCALLOC
177
+
178
+ /* Turbo C malloc() does not allow dynamic allocation of 64K bytes
179
+ * and farmalloc(64K) returns a pointer with an offset of 8, so we
180
+ * must fix the pointer. Warning: the pointer must be put back to its
181
+ * original form in order to free it, use zcfree().
182
+ */
183
+
184
+ #define MAX_PTR 10
185
+ /* 10*64K = 640K */
186
+
187
+ local int next_ptr = 0;
188
+
189
+ typedef struct ptr_table_s {
190
+ voidpf org_ptr;
191
+ voidpf new_ptr;
192
+ } ptr_table;
193
+
194
+ local ptr_table table[MAX_PTR];
195
+ /* This table is used to remember the original form of pointers
196
+ * to large buffers (64K). Such pointers are normalized with a zero offset.
197
+ * Since MSDOS is not a preemptive multitasking OS, this table is not
198
+ * protected from concurrent access. This hack doesn't work anyway on
199
+ * a protected system like OS/2. Use Microsoft C instead.
200
+ */
201
+
202
+ voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, unsigned items, unsigned size) {
203
+ voidpf buf;
204
+ ulg bsize = (ulg)items*size;
205
+
206
+ (void)opaque;
207
+
208
+ /* If we allocate less than 65520 bytes, we assume that farmalloc
209
+ * will return a usable pointer which doesn't have to be normalized.
210
+ */
211
+ if (bsize < 65520L) {
212
+ buf = farmalloc(bsize);
213
+ if (*(ush*)&buf != 0) return buf;
214
+ } else {
215
+ buf = farmalloc(bsize + 16L);
216
+ }
217
+ if (buf == NULL || next_ptr >= MAX_PTR) return NULL;
218
+ table[next_ptr].org_ptr = buf;
219
+
220
+ /* Normalize the pointer to seg:0 */
221
+ *((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4;
222
+ *(ush*)&buf = 0;
223
+ table[next_ptr++].new_ptr = buf;
224
+ return buf;
225
+ }
226
+
227
+ void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr) {
228
+ int n;
229
+
230
+ (void)opaque;
231
+
232
+ if (*(ush*)&ptr != 0) { /* object < 64K */
233
+ farfree(ptr);
234
+ return;
235
+ }
236
+ /* Find the original pointer */
237
+ for (n = 0; n < next_ptr; n++) {
238
+ if (ptr != table[n].new_ptr) continue;
239
+
240
+ farfree(table[n].org_ptr);
241
+ while (++n < next_ptr) {
242
+ table[n-1] = table[n];
243
+ }
244
+ next_ptr--;
245
+ return;
246
+ }
247
+ Assert(0, "zcfree: ptr not found");
248
+ }
249
+
250
+ #endif /* __TURBOC__ */
251
+
252
+
253
+ #ifdef M_I86
254
+ /* Microsoft C in 16-bit mode */
255
+
256
+ # define MY_ZCALLOC
257
+
258
+ #if (!defined(_MSC_VER) || (_MSC_VER <= 600))
259
+ # define _halloc halloc
260
+ # define _hfree hfree
261
+ #endif
262
+
263
+ voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, uInt items, uInt size) {
264
+ (void)opaque;
265
+ return _halloc((long)items, size);
266
+ }
267
+
268
+ void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr) {
269
+ (void)opaque;
270
+ _hfree(ptr);
271
+ }
272
+
273
+ #endif /* M_I86 */
274
+
275
+ #endif /* SYS16BIT */
276
+
277
+
278
+ #ifndef MY_ZCALLOC /* Any system without a special alloc function */
279
+
280
+ #ifndef STDC
281
+ extern voidp malloc(uInt size);
282
+ extern voidp calloc(uInt items, uInt size);
283
+ extern void free(voidpf ptr);
284
+ #endif
285
+
286
+ voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, unsigned items, unsigned size) {
287
+ (void)opaque;
288
+ return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) :
289
+ (voidpf)calloc(items, size);
290
+ }
291
+
292
+ void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr) {
293
+ (void)opaque;
294
+ free(ptr);
295
+ }
296
+
297
+ #endif /* MY_ZCALLOC */
298
+
299
+ #endif /* !Z_SOLO */
@@ -0,0 +1,275 @@
1
+ /* zutil.h -- internal interface and configuration of the compression library
2
+ * Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler
3
+ * For conditions of distribution and use, see copyright notice in zlib.h
4
+ */
5
+
6
+ /* WARNING: this file should *not* be used by applications. It is
7
+ part of the implementation of the compression library and is
8
+ subject to change. Applications should only use zlib.h.
9
+ */
10
+
11
+ /* @(#) $Id$ */
12
+
13
+ #ifndef ZUTIL_H
14
+ #define ZUTIL_H
15
+
16
+ #ifdef HAVE_HIDDEN
17
+ # define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
18
+ #else
19
+ # define ZLIB_INTERNAL
20
+ #endif
21
+
22
+ #include "zlib.h"
23
+
24
+ #if defined(STDC) && !defined(Z_SOLO)
25
+ # if !(defined(_WIN32_WCE) && defined(_MSC_VER))
26
+ # include <stddef.h>
27
+ # endif
28
+ # include <string.h>
29
+ # include <stdlib.h>
30
+ #endif
31
+ #ifdef NO_ERRNO_H
32
+ # ifdef _WIN32_WCE
33
+ /* The Microsoft C Run-Time Library for Windows CE doesn't have
34
+ * errno. We define it as a global variable to simplify porting.
35
+ * Its value is always 0 and should not be used. We rename it to
36
+ * avoid conflict with other libraries that use the same workaround.
37
+ */
38
+ # define errno z_errno
39
+ # endif
40
+ extern int errno;
41
+ #else
42
+ # ifndef _WIN32_WCE
43
+ # include <errno.h>
44
+ # endif
45
+ #endif
46
+
47
+ #ifndef local
48
+ # define local static
49
+ #endif
50
+ /* since "static" is used to mean two completely different things in C, we
51
+ define "local" for the non-static meaning of "static", for readability
52
+ (compile with -Dlocal if your debugger can't find static symbols) */
53
+
54
+ typedef unsigned char uch;
55
+ typedef uch FAR uchf;
56
+ typedef unsigned short ush;
57
+ typedef ush FAR ushf;
58
+ typedef unsigned long ulg;
59
+
60
+ #if !defined(Z_U8) && !defined(Z_SOLO) && defined(STDC)
61
+ # include <limits.h>
62
+ # if (ULONG_MAX == 0xffffffffffffffff)
63
+ # define Z_U8 unsigned long
64
+ # elif (ULLONG_MAX == 0xffffffffffffffff)
65
+ # define Z_U8 unsigned long long
66
+ # elif (UINT_MAX == 0xffffffffffffffff)
67
+ # define Z_U8 unsigned
68
+ # endif
69
+ #endif
70
+
71
+ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
72
+ /* (size given to avoid silly warnings with Visual C++) */
73
+
74
+ #define ERR_MSG(err) z_errmsg[(err) < -6 || (err) > 2 ? 9 : 2 - (err)]
75
+
76
+ #define ERR_RETURN(strm,err) \
77
+ return (strm->msg = ERR_MSG(err), (err))
78
+ /* To be used only when the state is known to be valid */
79
+
80
+ /* common constants */
81
+
82
+ #ifndef DEF_WBITS
83
+ # define DEF_WBITS MAX_WBITS
84
+ #endif
85
+ /* default windowBits for decompression. MAX_WBITS is for compression only */
86
+
87
+ #if MAX_MEM_LEVEL >= 8
88
+ # define DEF_MEM_LEVEL 8
89
+ #else
90
+ # define DEF_MEM_LEVEL MAX_MEM_LEVEL
91
+ #endif
92
+ /* default memLevel */
93
+
94
+ #define STORED_BLOCK 0
95
+ #define STATIC_TREES 1
96
+ #define DYN_TREES 2
97
+ /* The three kinds of block type */
98
+
99
+ #define MIN_MATCH 3
100
+ #define MAX_MATCH 258
101
+ /* The minimum and maximum match lengths */
102
+
103
+ #define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */
104
+
105
+ /* target dependencies */
106
+
107
+ #if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32))
108
+ # define OS_CODE 0x00
109
+ # ifndef Z_SOLO
110
+ # if defined(__TURBOC__) || defined(__BORLANDC__)
111
+ # if (__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__))
112
+ /* Allow compilation with ANSI keywords only enabled */
113
+ void _Cdecl farfree( void *block );
114
+ void *_Cdecl farmalloc( unsigned long nbytes );
115
+ # else
116
+ # include <alloc.h>
117
+ # endif
118
+ # else /* MSC or DJGPP */
119
+ # include <malloc.h>
120
+ # endif
121
+ # endif
122
+ #endif
123
+
124
+ #ifdef AMIGA
125
+ # define OS_CODE 1
126
+ #endif
127
+
128
+ #if defined(VAXC) || defined(VMS)
129
+ # define OS_CODE 2
130
+ # define F_OPEN(name, mode) \
131
+ fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512")
132
+ #endif
133
+
134
+ #ifdef __370__
135
+ # if __TARGET_LIB__ < 0x20000000
136
+ # define OS_CODE 4
137
+ # elif __TARGET_LIB__ < 0x40000000
138
+ # define OS_CODE 11
139
+ # else
140
+ # define OS_CODE 8
141
+ # endif
142
+ #endif
143
+
144
+ #if defined(ATARI) || defined(atarist)
145
+ # define OS_CODE 5
146
+ #endif
147
+
148
+ #ifdef OS2
149
+ # define OS_CODE 6
150
+ # if defined(M_I86) && !defined(Z_SOLO)
151
+ # include <malloc.h>
152
+ # endif
153
+ #endif
154
+
155
+ #if defined(MACOS)
156
+ # define OS_CODE 7
157
+ #endif
158
+
159
+ #ifdef __acorn
160
+ # define OS_CODE 13
161
+ #endif
162
+
163
+ #if defined(WIN32) && !defined(__CYGWIN__)
164
+ # define OS_CODE 10
165
+ #endif
166
+
167
+ #ifdef _BEOS_
168
+ # define OS_CODE 16
169
+ #endif
170
+
171
+ #ifdef __TOS_OS400__
172
+ # define OS_CODE 18
173
+ #endif
174
+
175
+ #ifdef __APPLE__
176
+ # define OS_CODE 19
177
+ #endif
178
+
179
+ #if defined(__BORLANDC__) && !defined(MSDOS)
180
+ #pragma warn -8004
181
+ #pragma warn -8008
182
+ #pragma warn -8066
183
+ #endif
184
+
185
+ /* provide prototypes for these when building zlib without LFS */
186
+ #if !defined(_WIN32) && \
187
+ (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0)
188
+ ZEXTERN uLong ZEXPORT adler32_combine64(uLong, uLong, z_off_t);
189
+ ZEXTERN uLong ZEXPORT crc32_combine64(uLong, uLong, z_off_t);
190
+ ZEXTERN uLong ZEXPORT crc32_combine_gen64(z_off_t);
191
+ #endif
192
+
193
+ /* common defaults */
194
+
195
+ #ifndef OS_CODE
196
+ # define OS_CODE 3 /* assume Unix */
197
+ #endif
198
+
199
+ #ifndef F_OPEN
200
+ # define F_OPEN(name, mode) fopen((name), (mode))
201
+ #endif
202
+
203
+ /* functions */
204
+
205
+ #if defined(pyr) || defined(Z_SOLO)
206
+ # define NO_MEMCPY
207
+ #endif
208
+ #if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__)
209
+ /* Use our own functions for small and medium model with MSC <= 5.0.
210
+ * You may have to use the same strategy for Borland C (untested).
211
+ * The __SC__ check is for Symantec.
212
+ */
213
+ # define NO_MEMCPY
214
+ #endif
215
+ #if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY)
216
+ # define HAVE_MEMCPY
217
+ #endif
218
+ #ifdef HAVE_MEMCPY
219
+ # ifdef SMALL_MEDIUM /* MSDOS small or medium model */
220
+ # define zmemcpy _fmemcpy
221
+ # define zmemcmp _fmemcmp
222
+ # define zmemzero(dest, len) _fmemset(dest, 0, len)
223
+ # else
224
+ # define zmemcpy memcpy
225
+ # define zmemcmp memcmp
226
+ # define zmemzero(dest, len) memset(dest, 0, len)
227
+ # endif
228
+ #else
229
+ void ZLIB_INTERNAL zmemcpy(Bytef* dest, const Bytef* source, uInt len);
230
+ int ZLIB_INTERNAL zmemcmp(const Bytef* s1, const Bytef* s2, uInt len);
231
+ void ZLIB_INTERNAL zmemzero(Bytef* dest, uInt len);
232
+ #endif
233
+
234
+ /* Diagnostic functions */
235
+ #ifdef ZLIB_DEBUG
236
+ # include <stdio.h>
237
+ extern int ZLIB_INTERNAL z_verbose;
238
+ extern void ZLIB_INTERNAL z_error(char *m);
239
+ # define Assert(cond,msg) {if(!(cond)) z_error(msg);}
240
+ # define Trace(x) {if (z_verbose>=0) fprintf x ;}
241
+ # define Tracev(x) {if (z_verbose>0) fprintf x ;}
242
+ # define Tracevv(x) {if (z_verbose>1) fprintf x ;}
243
+ # define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;}
244
+ # define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;}
245
+ #else
246
+ # define Assert(cond,msg)
247
+ # define Trace(x)
248
+ # define Tracev(x)
249
+ # define Tracevv(x)
250
+ # define Tracec(c,x)
251
+ # define Tracecv(c,x)
252
+ #endif
253
+
254
+ #ifndef Z_SOLO
255
+ voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, unsigned items,
256
+ unsigned size);
257
+ void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr);
258
+ #endif
259
+
260
+ #define ZALLOC(strm, items, size) \
261
+ (*((strm)->zalloc))((strm)->opaque, (items), (size))
262
+ #define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
263
+ #define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
264
+
265
+ /* Reverse the bytes in a 32-bit value */
266
+ #define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
267
+ (((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
268
+
269
+ #ifdef _MSC_VER
270
+ #define zalign(x) __declspec(align(x))
271
+ #else
272
+ #define zalign(x) __attribute__((aligned((x))))
273
+ #endif
274
+
275
+ #endif /* ZUTIL_H */
@@ -0,0 +1,30 @@
1
+ BSD License
2
+
3
+ For Zstandard software
4
+
5
+ Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved.
6
+
7
+ Redistribution and use in source and binary forms, with or without modification,
8
+ are permitted provided that the following conditions are met:
9
+
10
+ * Redistributions of source code must retain the above copyright notice, this
11
+ list of conditions and the following disclaimer.
12
+
13
+ * Redistributions in binary form must reproduce the above copyright notice,
14
+ this list of conditions and the following disclaimer in the documentation
15
+ and/or other materials provided with the distribution.
16
+
17
+ * Neither the name Facebook, nor Meta, nor the names of its contributors may
18
+ be used to endorse or promote products derived from this software without
19
+ specific prior written permission.
20
+
21
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
25
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
28
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,55 @@
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under both the BSD-style license (found in the
6
+ * LICENSE file in the root directory of this source tree) and the GPLv2 (found
7
+ * in the COPYING file in the root directory of this source tree).
8
+ * You may select, at your option, one of the above-listed licenses.
9
+ */
10
+
11
+ /* This file provides custom allocation primitives
12
+ */
13
+
14
+ #define ZSTD_DEPS_NEED_MALLOC
15
+ #include "zstd_deps.h" /* ZSTD_malloc, ZSTD_calloc, ZSTD_free, ZSTD_memset */
16
+
17
+ #include "compiler.h" /* MEM_STATIC */
18
+ #define ZSTD_STATIC_LINKING_ONLY
19
+ #include "../zstd.h" /* ZSTD_customMem */
20
+
21
+ #ifndef ZSTD_ALLOCATIONS_H
22
+ #define ZSTD_ALLOCATIONS_H
23
+
24
+ /* custom memory allocation functions */
25
+
26
+ MEM_STATIC void* ZSTD_customMalloc(size_t size, ZSTD_customMem customMem)
27
+ {
28
+ if (customMem.customAlloc)
29
+ return customMem.customAlloc(customMem.opaque, size);
30
+ return ZSTD_malloc(size);
31
+ }
32
+
33
+ MEM_STATIC void* ZSTD_customCalloc(size_t size, ZSTD_customMem customMem)
34
+ {
35
+ if (customMem.customAlloc) {
36
+ /* calloc implemented as malloc+memset;
37
+ * not as efficient as calloc, but next best guess for custom malloc */
38
+ void* const ptr = customMem.customAlloc(customMem.opaque, size);
39
+ ZSTD_memset(ptr, 0, size);
40
+ return ptr;
41
+ }
42
+ return ZSTD_calloc(1, size);
43
+ }
44
+
45
+ MEM_STATIC void ZSTD_customFree(void* ptr, ZSTD_customMem customMem)
46
+ {
47
+ if (ptr!=NULL) {
48
+ if (customMem.customFree)
49
+ customMem.customFree(customMem.opaque, ptr);
50
+ else
51
+ ZSTD_free(ptr);
52
+ }
53
+ }
54
+
55
+ #endif /* ZSTD_ALLOCATIONS_H */