@port-labs/jq-node-bindings 0.0.13 → 0.0.15-dev1

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 (453) hide show
  1. package/README.md +6 -1
  2. package/binding.gyp +41 -19
  3. package/configure +1 -1
  4. package/deps/jq/.gitattributes +12 -0
  5. package/deps/jq/AUTHORS +149 -43
  6. package/deps/jq/COPYING +75 -1
  7. package/deps/jq/ChangeLog +2 -2
  8. package/deps/jq/Makefile.am +106 -65
  9. package/deps/jq/NEWS.md +391 -0
  10. package/deps/jq/README.md +54 -52
  11. package/deps/jq/SECURITY.md +7 -0
  12. package/deps/jq/compile-ios.sh +106 -102
  13. package/deps/jq/configure.ac +72 -59
  14. package/deps/jq/docs/Pipfile +14 -0
  15. package/deps/jq/docs/Pipfile.lock +415 -0
  16. package/deps/jq/docs/README.md +15 -14
  17. package/deps/jq/docs/build_manpage.py +251 -0
  18. package/deps/jq/docs/build_mantests.py +21 -0
  19. package/deps/jq/docs/build_website.py +95 -0
  20. package/deps/jq/docs/content/download/default.yml +249 -0
  21. package/deps/jq/docs/content/index.yml +83 -0
  22. package/deps/jq/docs/content/{3.manual/v1.6 → manual/dev}/manual.yml +992 -452
  23. package/deps/jq/docs/content/{3.manual → manual}/v1.3/manual.yml +105 -116
  24. package/deps/jq/docs/content/{3.manual → manual}/v1.4/manual.yml +122 -129
  25. package/deps/jq/docs/content/{3.manual → manual}/v1.5/manual.yml +313 -262
  26. package/deps/jq/docs/content/{3.manual → manual/v1.6}/manual.yml +407 -332
  27. package/deps/jq/docs/content/manual/v1.7/manual.yml +3697 -0
  28. package/deps/jq/docs/content/tutorial/default.yml +337 -0
  29. package/deps/jq/docs/manual_schema.yml +60 -0
  30. package/deps/jq/docs/public/css/style.css +99 -0
  31. package/deps/jq/docs/public/icon.png +0 -0
  32. package/deps/jq/docs/public/icon.svg +1 -0
  33. package/deps/jq/docs/public/jq.svg +1 -0
  34. package/deps/jq/docs/public/js/manual-search.js +31 -49
  35. package/deps/jq/docs/templates/default.html.j2 +31 -0
  36. package/deps/jq/docs/templates/index.html.j2 +58 -0
  37. package/deps/jq/docs/templates/manual.html.j2 +120 -0
  38. package/deps/jq/docs/templates/shared/_footer.html.j2 +14 -0
  39. package/deps/jq/docs/templates/shared/_head.html.j2 +23 -0
  40. package/deps/jq/docs/templates/shared/_navbar.html.j2 +40 -0
  41. package/deps/jq/docs/validate_manual_schema.py +19 -0
  42. package/deps/jq/jq.1.prebuilt +1102 -294
  43. package/deps/jq/jq.spec +2 -3
  44. package/deps/jq/libjq.pc.in +11 -0
  45. package/deps/jq/m4/ax_pthread.m4 +522 -0
  46. package/deps/jq/modules/oniguruma/.travis.yml +17 -0
  47. package/deps/jq/modules/oniguruma/CMakeLists.txt +206 -41
  48. package/deps/jq/modules/oniguruma/COPYING +23 -25
  49. package/deps/jq/modules/oniguruma/HISTORY +368 -23
  50. package/deps/jq/modules/oniguruma/Makefile.am +61 -7
  51. package/deps/jq/modules/oniguruma/README +34 -20
  52. package/deps/jq/modules/oniguruma/README.md +106 -33
  53. package/deps/jq/modules/oniguruma/README_japanese +183 -0
  54. package/deps/jq/modules/oniguruma/autogen.sh +9 -0
  55. package/deps/jq/modules/oniguruma/cmake/Config.cmake.in +4 -0
  56. package/deps/jq/modules/oniguruma/configure.ac +66 -55
  57. package/deps/jq/modules/oniguruma/doc/API +485 -42
  58. package/deps/jq/modules/oniguruma/doc/API.ja +732 -293
  59. package/deps/jq/modules/oniguruma/doc/CALLOUTS.API +397 -0
  60. package/deps/jq/modules/oniguruma/doc/CALLOUTS.API.ja +393 -0
  61. package/deps/jq/modules/oniguruma/doc/CALLOUTS.BUILTIN +95 -0
  62. package/deps/jq/modules/oniguruma/doc/CALLOUTS.BUILTIN.ja +93 -0
  63. package/deps/jq/modules/oniguruma/doc/FAQ +3 -3
  64. package/deps/jq/modules/oniguruma/doc/FAQ.ja +8 -8
  65. package/deps/jq/modules/oniguruma/doc/RE +223 -63
  66. package/deps/jq/modules/oniguruma/doc/RE.ja +420 -265
  67. package/deps/jq/modules/oniguruma/doc/SYNTAX.md +1091 -0
  68. package/deps/jq/modules/oniguruma/doc/UNICODE_PROPERTIES +840 -697
  69. package/deps/jq/modules/oniguruma/harnesses/ascii_compatible.dict +113 -0
  70. package/deps/jq/modules/oniguruma/harnesses/base.c +749 -0
  71. package/deps/jq/modules/oniguruma/harnesses/deluxe.c +206 -0
  72. package/deps/jq/modules/oniguruma/harnesses/dict_conv.py +72 -0
  73. package/deps/jq/modules/oniguruma/harnesses/fuzzer.options +2 -0
  74. package/deps/jq/modules/oniguruma/harnesses/libfuzzer-onig.cpp +45 -0
  75. package/deps/jq/modules/oniguruma/harnesses/regset.c +392 -0
  76. package/deps/jq/modules/oniguruma/index.html +16 -5
  77. package/deps/jq/modules/oniguruma/index_ja.html +16 -5
  78. package/deps/jq/modules/oniguruma/make_win.bat +5 -0
  79. package/deps/jq/modules/oniguruma/make_win32.bat +5 -3
  80. package/deps/jq/modules/oniguruma/make_win64.bat +5 -3
  81. package/deps/jq/modules/oniguruma/onig-config.cmake.in +80 -0
  82. package/deps/jq/modules/oniguruma/onig-config.in +1 -1
  83. package/deps/jq/modules/oniguruma/oniguruma.pc.cmake.in +1 -1
  84. package/deps/jq/modules/oniguruma/oniguruma.pc.in +0 -1
  85. package/deps/jq/modules/oniguruma/sample/CMakeLists.txt +9 -2
  86. package/deps/jq/modules/oniguruma/sample/Makefile.am +24 -5
  87. package/deps/jq/modules/oniguruma/sample/bug_fix.c +13 -51
  88. package/deps/jq/modules/oniguruma/sample/callback_each_match.c +168 -0
  89. package/deps/jq/modules/oniguruma/sample/callout.c +268 -0
  90. package/deps/jq/modules/oniguruma/sample/count.c +125 -0
  91. package/deps/jq/modules/oniguruma/sample/crnl.c +6 -4
  92. package/deps/jq/modules/oniguruma/sample/echo.c +136 -0
  93. package/deps/jq/modules/oniguruma/sample/encode.c +53 -146
  94. package/deps/jq/modules/oniguruma/sample/listcap.c +18 -10
  95. package/deps/jq/modules/oniguruma/sample/names.c +10 -6
  96. package/deps/jq/modules/oniguruma/sample/posix.c +13 -2
  97. package/deps/jq/modules/oniguruma/sample/regset.c +95 -0
  98. package/deps/jq/modules/oniguruma/sample/scan.c +20 -6
  99. package/deps/jq/modules/oniguruma/sample/simple.c +8 -4
  100. package/deps/jq/modules/oniguruma/sample/sql.c +13 -8
  101. package/deps/jq/modules/oniguruma/sample/syntax.c +11 -10
  102. package/deps/jq/modules/oniguruma/sample/user_property.c +12 -7
  103. package/deps/jq/modules/oniguruma/src/Makefile.am +41 -15
  104. package/deps/jq/modules/oniguruma/src/Makefile.windows +196 -183
  105. package/deps/jq/modules/oniguruma/src/ascii.c +64 -7
  106. package/deps/jq/modules/oniguruma/src/big5.c +25 -15
  107. package/deps/jq/modules/oniguruma/src/config.h.cmake.in +7 -22
  108. package/deps/jq/modules/oniguruma/src/config.h.win32 +56 -84
  109. package/deps/jq/modules/oniguruma/src/config.h.win64 +56 -84
  110. package/deps/jq/modules/oniguruma/src/config.h.windows.in +62 -0
  111. package/deps/jq/modules/oniguruma/src/cp1251.c +14 -8
  112. package/deps/jq/modules/oniguruma/src/euc_jp.c +28 -30
  113. package/deps/jq/modules/oniguruma/src/euc_jp_prop.c +25 -32
  114. package/deps/jq/modules/oniguruma/src/euc_jp_prop.gperf +1 -2
  115. package/deps/jq/modules/oniguruma/src/euc_kr.c +27 -15
  116. package/deps/jq/modules/oniguruma/src/euc_tw.c +40 -17
  117. package/deps/jq/modules/oniguruma/src/gb18030.c +177 -119
  118. package/deps/jq/modules/oniguruma/src/gperf_fold_key_conv.py +12 -8
  119. package/deps/jq/modules/oniguruma/src/gperf_unfold_key_conv.py +8 -6
  120. package/deps/jq/modules/oniguruma/src/iso8859_1.c +92 -91
  121. package/deps/jq/modules/oniguruma/src/iso8859_10.c +13 -29
  122. package/deps/jq/modules/oniguruma/src/iso8859_11.c +4 -2
  123. package/deps/jq/modules/oniguruma/src/iso8859_13.c +13 -33
  124. package/deps/jq/modules/oniguruma/src/iso8859_14.c +13 -30
  125. package/deps/jq/modules/oniguruma/src/iso8859_15.c +13 -34
  126. package/deps/jq/modules/oniguruma/src/iso8859_16.c +13 -29
  127. package/deps/jq/modules/oniguruma/src/iso8859_2.c +13 -29
  128. package/deps/jq/modules/oniguruma/src/iso8859_3.c +13 -33
  129. package/deps/jq/modules/oniguruma/src/iso8859_4.c +13 -32
  130. package/deps/jq/modules/oniguruma/src/iso8859_5.c +16 -23
  131. package/deps/jq/modules/oniguruma/src/iso8859_6.c +4 -2
  132. package/deps/jq/modules/oniguruma/src/iso8859_7.c +14 -29
  133. package/deps/jq/modules/oniguruma/src/iso8859_8.c +4 -2
  134. package/deps/jq/modules/oniguruma/src/iso8859_9.c +13 -33
  135. package/deps/jq/modules/oniguruma/src/koi8.c +14 -27
  136. package/deps/jq/modules/oniguruma/src/koi8_r.c +12 -19
  137. package/deps/jq/modules/oniguruma/src/make_property.sh +21 -0
  138. package/deps/jq/modules/oniguruma/src/make_unicode_egcb.sh +7 -0
  139. package/deps/jq/modules/oniguruma/src/make_unicode_egcb_data.py +267 -0
  140. package/deps/jq/modules/oniguruma/src/make_unicode_fold.sh +25 -11
  141. package/deps/jq/modules/oniguruma/src/make_unicode_fold_data.py +206 -26
  142. package/deps/jq/modules/oniguruma/src/make_unicode_property.sh +19 -10
  143. package/deps/jq/modules/oniguruma/src/make_unicode_property_data.py +474 -375
  144. package/deps/jq/modules/oniguruma/src/make_unicode_wb.sh +7 -0
  145. package/deps/jq/modules/oniguruma/src/make_unicode_wb_data.py +267 -0
  146. package/deps/jq/modules/oniguruma/src/mktable.c +28 -24
  147. package/deps/jq/modules/oniguruma/src/onig_init.c +2 -2
  148. package/deps/jq/modules/oniguruma/src/oniggnu.h +7 -5
  149. package/deps/jq/modules/oniguruma/src/onigposix.h +40 -16
  150. package/deps/jq/modules/oniguruma/src/oniguruma.h +357 -107
  151. package/deps/jq/modules/oniguruma/src/regcomp.c +6214 -3933
  152. package/deps/jq/modules/oniguruma/src/regenc.c +197 -120
  153. package/deps/jq/modules/oniguruma/src/regenc.h +106 -63
  154. package/deps/jq/modules/oniguruma/src/regerror.c +112 -91
  155. package/deps/jq/modules/oniguruma/src/regexec.c +4876 -2010
  156. package/deps/jq/modules/oniguruma/src/regext.c +8 -8
  157. package/deps/jq/modules/oniguruma/src/reggnu.c +13 -17
  158. package/deps/jq/modules/oniguruma/src/regint.h +757 -491
  159. package/deps/jq/modules/oniguruma/src/regparse.c +7204 -3240
  160. package/deps/jq/modules/oniguruma/src/regparse.h +361 -218
  161. package/deps/jq/modules/oniguruma/src/regposerr.c +49 -9
  162. package/deps/jq/modules/oniguruma/src/regposix.c +106 -24
  163. package/deps/jq/modules/oniguruma/src/regsyntax.c +66 -13
  164. package/deps/jq/modules/oniguruma/src/regtrav.c +1 -1
  165. package/deps/jq/modules/oniguruma/src/regversion.c +6 -4
  166. package/deps/jq/modules/oniguruma/src/sjis.c +23 -52
  167. package/deps/jq/modules/oniguruma/src/sjis_prop.c +25 -32
  168. package/deps/jq/modules/oniguruma/src/sjis_prop.gperf +1 -2
  169. package/deps/jq/modules/oniguruma/src/st.c +248 -249
  170. package/deps/jq/modules/oniguruma/src/st.h +4 -5
  171. package/deps/jq/modules/oniguruma/src/unicode.c +869 -294
  172. package/deps/jq/modules/oniguruma/src/unicode_egcb_data.c +1419 -0
  173. package/deps/jq/modules/oniguruma/src/unicode_fold1_key.c +1829 -1300
  174. package/deps/jq/modules/oniguruma/src/unicode_fold2_key.c +32 -9
  175. package/deps/jq/modules/oniguruma/src/unicode_fold3_key.c +32 -9
  176. package/deps/jq/modules/oniguruma/src/unicode_fold_data.c +1210 -984
  177. package/deps/jq/modules/oniguruma/src/unicode_property_data.c +22480 -15198
  178. package/deps/jq/modules/oniguruma/src/unicode_property_data_posix.c +1463 -591
  179. package/deps/jq/modules/oniguruma/src/unicode_unfold_key.c +1958 -1418
  180. package/deps/jq/modules/oniguruma/src/unicode_wb_data.c +1106 -0
  181. package/deps/jq/modules/oniguruma/src/utf16_be.c +90 -49
  182. package/deps/jq/modules/oniguruma/src/utf16_le.c +80 -49
  183. package/deps/jq/modules/oniguruma/src/utf32_be.c +14 -42
  184. package/deps/jq/modules/oniguruma/src/utf32_le.c +13 -40
  185. package/deps/jq/modules/oniguruma/src/utf8.c +33 -78
  186. package/deps/jq/modules/oniguruma/test/CMakeLists.txt +55 -0
  187. package/deps/jq/modules/oniguruma/test/Makefile.am +65 -10
  188. package/deps/jq/modules/oniguruma/test/test.sh +17 -0
  189. package/deps/jq/modules/oniguruma/test/test_back.c +1450 -0
  190. package/deps/jq/modules/oniguruma/test/test_options.c +228 -0
  191. package/deps/jq/modules/oniguruma/test/test_regset.c +466 -0
  192. package/deps/jq/modules/oniguruma/test/test_syntax.c +365 -0
  193. package/deps/jq/modules/oniguruma/test/test_utf8.c +1761 -0
  194. package/deps/jq/modules/oniguruma/test/testc.c +128 -88
  195. package/deps/jq/modules/oniguruma/test/testp.c +613 -0
  196. package/deps/jq/modules/oniguruma/test/testu.c +75 -28
  197. package/deps/jq/modules/oniguruma/tis-ci/stub.c +3 -0
  198. package/deps/jq/modules/oniguruma/tis-ci/test_back.config +26 -0
  199. package/deps/jq/modules/oniguruma/tis-ci/test_regset.config +20 -0
  200. package/deps/jq/modules/oniguruma/tis-ci/test_syntax.config +26 -0
  201. package/deps/jq/modules/oniguruma/tis-ci/test_utf8.config +25 -0
  202. package/deps/jq/modules/oniguruma/tis-ci/testc.config +26 -0
  203. package/deps/jq/modules/oniguruma/tis-ci/testu.config +24 -0
  204. package/deps/jq/modules/oniguruma/tis.config +1336 -0
  205. package/deps/jq/modules/oniguruma/windows/CMakeLists.txt +8 -0
  206. package/deps/jq/modules/oniguruma/windows/testc.c +865 -869
  207. package/deps/jq/scripts/update-website +6 -5
  208. package/deps/jq/scripts/version +10 -7
  209. package/deps/jq/sig/jq-release-new.key +29 -0
  210. package/deps/jq/sig/v1.4/sha256sum.txt +1 -0
  211. package/deps/jq/sig/v1.5/sha256sum.txt +2 -0
  212. package/deps/jq/sig/v1.5rc1/sha256sum.txt +1 -0
  213. package/deps/jq/sig/v1.5rc2/sha256sum.txt +2 -0
  214. package/deps/jq/sig/v1.6/sha256sum.txt +2 -0
  215. package/deps/jq/sig/v1.7/jq-1.7.tar.gz.asc +16 -0
  216. package/deps/jq/sig/v1.7/jq-1.7.zip.asc +16 -0
  217. package/deps/jq/sig/v1.7/jq-linux-amd64.asc +16 -0
  218. package/deps/jq/sig/v1.7/jq-linux-arm64.asc +16 -0
  219. package/deps/jq/sig/v1.7/jq-linux-armel.asc +16 -0
  220. package/deps/jq/sig/v1.7/jq-linux-armhf.asc +16 -0
  221. package/deps/jq/sig/v1.7/jq-linux-i386.asc +16 -0
  222. package/deps/jq/sig/v1.7/jq-linux-mips.asc +16 -0
  223. package/deps/jq/sig/v1.7/jq-linux-mips64.asc +16 -0
  224. package/deps/jq/sig/v1.7/jq-linux-mips64el.asc +16 -0
  225. package/deps/jq/sig/v1.7/jq-linux-mips64r6.asc +16 -0
  226. package/deps/jq/sig/v1.7/jq-linux-mips64r6el.asc +16 -0
  227. package/deps/jq/sig/v1.7/jq-linux-mipsel.asc +16 -0
  228. package/deps/jq/sig/v1.7/jq-linux-mipsr6.asc +16 -0
  229. package/deps/jq/sig/v1.7/jq-linux-mipsr6el.asc +16 -0
  230. package/deps/jq/sig/v1.7/jq-linux-powerpc.asc +16 -0
  231. package/deps/jq/sig/v1.7/jq-linux-ppc64el.asc +16 -0
  232. package/deps/jq/sig/v1.7/jq-linux-riscv64.asc +16 -0
  233. package/deps/jq/sig/v1.7/jq-linux-s390x.asc +16 -0
  234. package/deps/jq/sig/v1.7/jq-macos-amd64.asc +16 -0
  235. package/deps/jq/sig/v1.7/jq-macos-arm64.asc +16 -0
  236. package/deps/jq/sig/v1.7/jq-windows-amd64.exe.asc +16 -0
  237. package/deps/jq/sig/v1.7/jq-windows-i386.exe.asc +16 -0
  238. package/deps/jq/sig/v1.7/sha256sum.txt +23 -0
  239. package/deps/jq/sig/v1.7.1/jq-1.7.1.tar.gz.asc +16 -0
  240. package/deps/jq/sig/v1.7.1/jq-1.7.1.zip.asc +16 -0
  241. package/deps/jq/sig/v1.7.1/jq-linux-amd64.asc +16 -0
  242. package/deps/jq/sig/v1.7.1/jq-linux-arm64.asc +16 -0
  243. package/deps/jq/sig/v1.7.1/jq-linux-armel.asc +16 -0
  244. package/deps/jq/sig/v1.7.1/jq-linux-armhf.asc +16 -0
  245. package/deps/jq/sig/v1.7.1/jq-linux-i386.asc +16 -0
  246. package/deps/jq/sig/v1.7.1/jq-linux-mips.asc +16 -0
  247. package/deps/jq/sig/v1.7.1/jq-linux-mips64.asc +16 -0
  248. package/deps/jq/sig/v1.7.1/jq-linux-mips64el.asc +16 -0
  249. package/deps/jq/sig/v1.7.1/jq-linux-mips64r6.asc +16 -0
  250. package/deps/jq/sig/v1.7.1/jq-linux-mips64r6el.asc +16 -0
  251. package/deps/jq/sig/v1.7.1/jq-linux-mipsel.asc +16 -0
  252. package/deps/jq/sig/v1.7.1/jq-linux-mipsr6.asc +16 -0
  253. package/deps/jq/sig/v1.7.1/jq-linux-mipsr6el.asc +16 -0
  254. package/deps/jq/sig/v1.7.1/jq-linux-powerpc.asc +16 -0
  255. package/deps/jq/sig/v1.7.1/jq-linux-ppc64el.asc +16 -0
  256. package/deps/jq/sig/v1.7.1/jq-linux-riscv64.asc +16 -0
  257. package/deps/jq/sig/v1.7.1/jq-linux-s390x.asc +16 -0
  258. package/deps/jq/sig/v1.7.1/jq-linux64.asc +16 -0
  259. package/deps/jq/sig/v1.7.1/jq-macos-amd64.asc +16 -0
  260. package/deps/jq/sig/v1.7.1/jq-macos-arm64.asc +16 -0
  261. package/deps/jq/sig/v1.7.1/jq-osx-amd64.asc +16 -0
  262. package/deps/jq/sig/v1.7.1/jq-win64.exe.asc +16 -0
  263. package/deps/jq/sig/v1.7.1/jq-windows-amd64.exe.asc +16 -0
  264. package/deps/jq/sig/v1.7.1/jq-windows-i386.exe.asc +16 -0
  265. package/deps/jq/sig/v1.7.1/sha256sum.txt +26 -0
  266. package/deps/jq/sig/v1.7rc1/jq-1.7rc1.tar.gz.asc +16 -0
  267. package/deps/jq/sig/v1.7rc1/jq-1.7rc1.zip.asc +16 -0
  268. package/deps/jq/sig/v1.7rc1/jq-linux-amd64.asc +16 -0
  269. package/deps/jq/sig/v1.7rc1/jq-linux-arm64.asc +16 -0
  270. package/deps/jq/sig/v1.7rc1/jq-linux-armel.asc +16 -0
  271. package/deps/jq/sig/v1.7rc1/jq-linux-armhf.asc +16 -0
  272. package/deps/jq/sig/v1.7rc1/jq-linux-i386.asc +16 -0
  273. package/deps/jq/sig/v1.7rc1/jq-linux-mips.asc +16 -0
  274. package/deps/jq/sig/v1.7rc1/jq-linux-mips64.asc +16 -0
  275. package/deps/jq/sig/v1.7rc1/jq-linux-mips64el.asc +16 -0
  276. package/deps/jq/sig/v1.7rc1/jq-linux-mips64r6.asc +16 -0
  277. package/deps/jq/sig/v1.7rc1/jq-linux-mips64r6el.asc +16 -0
  278. package/deps/jq/sig/v1.7rc1/jq-linux-mipsel.asc +16 -0
  279. package/deps/jq/sig/v1.7rc1/jq-linux-mipsr6.asc +16 -0
  280. package/deps/jq/sig/v1.7rc1/jq-linux-mipsr6el.asc +16 -0
  281. package/deps/jq/sig/v1.7rc1/jq-linux-powerpc.asc +16 -0
  282. package/deps/jq/sig/v1.7rc1/jq-linux-ppc64el.asc +16 -0
  283. package/deps/jq/sig/v1.7rc1/jq-linux-riscv64.asc +16 -0
  284. package/deps/jq/sig/v1.7rc1/jq-linux-s390x.asc +16 -0
  285. package/deps/jq/sig/v1.7rc1/jq-macos-amd64.asc +16 -0
  286. package/deps/jq/sig/v1.7rc1/jq-macos-arm64.asc +16 -0
  287. package/deps/jq/sig/v1.7rc1/jq-windows-amd64.exe.asc +16 -0
  288. package/deps/jq/sig/v1.7rc1/jq-windows-i386.exe.asc +16 -0
  289. package/deps/jq/sig/v1.7rc1/sha256sum.txt +23 -0
  290. package/deps/jq/sig/v1.7rc2/jq-1.7rc2.tar.gz.asc +16 -0
  291. package/deps/jq/sig/v1.7rc2/jq-1.7rc2.zip.asc +16 -0
  292. package/deps/jq/sig/v1.7rc2/jq-linux-amd64.asc +16 -0
  293. package/deps/jq/sig/v1.7rc2/jq-linux-arm64.asc +16 -0
  294. package/deps/jq/sig/v1.7rc2/jq-linux-armel.asc +16 -0
  295. package/deps/jq/sig/v1.7rc2/jq-linux-armhf.asc +16 -0
  296. package/deps/jq/sig/v1.7rc2/jq-linux-i386.asc +16 -0
  297. package/deps/jq/sig/v1.7rc2/jq-linux-mips.asc +16 -0
  298. package/deps/jq/sig/v1.7rc2/jq-linux-mips64.asc +16 -0
  299. package/deps/jq/sig/v1.7rc2/jq-linux-mips64el.asc +16 -0
  300. package/deps/jq/sig/v1.7rc2/jq-linux-mips64r6.asc +16 -0
  301. package/deps/jq/sig/v1.7rc2/jq-linux-mips64r6el.asc +16 -0
  302. package/deps/jq/sig/v1.7rc2/jq-linux-mipsel.asc +16 -0
  303. package/deps/jq/sig/v1.7rc2/jq-linux-mipsr6.asc +16 -0
  304. package/deps/jq/sig/v1.7rc2/jq-linux-mipsr6el.asc +16 -0
  305. package/deps/jq/sig/v1.7rc2/jq-linux-powerpc.asc +16 -0
  306. package/deps/jq/sig/v1.7rc2/jq-linux-ppc64el.asc +16 -0
  307. package/deps/jq/sig/v1.7rc2/jq-linux-riscv64.asc +16 -0
  308. package/deps/jq/sig/v1.7rc2/jq-linux-s390x.asc +16 -0
  309. package/deps/jq/sig/v1.7rc2/jq-macos-amd64.asc +16 -0
  310. package/deps/jq/sig/v1.7rc2/jq-macos-arm64.asc +16 -0
  311. package/deps/jq/sig/v1.7rc2/jq-windows-amd64.exe.asc +16 -0
  312. package/deps/jq/sig/v1.7rc2/jq-windows-i386.exe.asc +16 -0
  313. package/deps/jq/sig/v1.7rc2/sha256sum.txt +23 -0
  314. package/deps/jq/src/builtin.c +537 -343
  315. package/deps/jq/src/builtin.h +18 -0
  316. package/deps/jq/src/builtin.jq +116 -143
  317. package/deps/jq/src/bytecode.h +8 -4
  318. package/deps/jq/src/compile.c +157 -143
  319. package/deps/jq/src/compile.h +3 -4
  320. package/deps/jq/src/decNumber/ICU-license.html +45 -0
  321. package/deps/jq/src/decNumber/decBasic.c +3908 -0
  322. package/deps/jq/src/decNumber/decCommon.c +1835 -0
  323. package/deps/jq/src/decNumber/decContext.c +437 -0
  324. package/deps/jq/src/decNumber/decContext.h +254 -0
  325. package/deps/jq/src/decNumber/decDPD.h +1185 -0
  326. package/deps/jq/src/decNumber/decDouble.c +140 -0
  327. package/deps/jq/src/decNumber/decDouble.h +155 -0
  328. package/deps/jq/src/decNumber/decNumber.c +8143 -0
  329. package/deps/jq/src/decNumber/decNumber.h +182 -0
  330. package/deps/jq/src/decNumber/decNumberLocal.h +757 -0
  331. package/deps/jq/src/decNumber/decPacked.c +220 -0
  332. package/deps/jq/src/decNumber/decPacked.h +52 -0
  333. package/deps/jq/src/decNumber/decQuad.c +135 -0
  334. package/deps/jq/src/decNumber/decQuad.h +177 -0
  335. package/deps/jq/src/decNumber/decSingle.c +71 -0
  336. package/deps/jq/src/decNumber/decSingle.h +86 -0
  337. package/deps/jq/src/decNumber/decimal128.c +553 -0
  338. package/deps/jq/src/decNumber/decimal128.h +81 -0
  339. package/deps/jq/src/decNumber/decimal32.c +476 -0
  340. package/deps/jq/src/decNumber/decimal32.h +81 -0
  341. package/deps/jq/src/decNumber/decimal64.c +839 -0
  342. package/deps/jq/src/decNumber/decimal64.h +83 -0
  343. package/deps/jq/src/decNumber/decnumber.pdf +0 -0
  344. package/deps/jq/src/decNumber/example1.c +38 -0
  345. package/deps/jq/src/decNumber/example2.c +52 -0
  346. package/deps/jq/src/decNumber/example3.c +64 -0
  347. package/deps/jq/src/decNumber/example4.c +61 -0
  348. package/deps/jq/src/decNumber/example5.c +36 -0
  349. package/deps/jq/src/decNumber/example6.c +61 -0
  350. package/deps/jq/src/decNumber/example7.c +35 -0
  351. package/deps/jq/src/decNumber/example8.c +39 -0
  352. package/deps/jq/src/decNumber/readme.txt +81 -0
  353. package/deps/jq/src/exec_stack.h +5 -3
  354. package/deps/jq/src/execute.c +126 -44
  355. package/deps/jq/src/inject_errors.c +0 -2
  356. package/deps/jq/src/jq.h +10 -1
  357. package/deps/jq/src/jq_test.c +222 -11
  358. package/deps/jq/src/jv.c +807 -176
  359. package/deps/jq/src/jv.h +22 -1
  360. package/deps/jq/src/jv_alloc.c +33 -26
  361. package/deps/jq/src/jv_alloc.h +0 -11
  362. package/deps/jq/src/jv_aux.c +153 -67
  363. package/deps/jq/src/jv_dtoa.c +12 -2
  364. package/deps/jq/src/jv_dtoa_tsd.c +51 -0
  365. package/deps/jq/src/jv_dtoa_tsd.h +4 -0
  366. package/deps/jq/src/jv_parse.c +70 -15
  367. package/deps/jq/src/jv_print.c +56 -60
  368. package/deps/jq/src/jv_private.h +7 -0
  369. package/deps/jq/src/jv_thread.h +76 -0
  370. package/deps/jq/src/jv_unicode.c +18 -0
  371. package/deps/jq/src/jv_unicode.h +2 -0
  372. package/deps/jq/src/lexer.c +782 -543
  373. package/deps/jq/src/lexer.h +438 -64
  374. package/deps/jq/src/lexer.l +10 -3
  375. package/deps/jq/src/libm.h +16 -6
  376. package/deps/jq/src/linker.c +97 -40
  377. package/deps/jq/src/locfile.c +2 -1
  378. package/deps/jq/src/main.c +384 -336
  379. package/deps/jq/src/opcode_list.h +5 -2
  380. package/deps/jq/src/parser.c +2260 -1898
  381. package/deps/jq/src/parser.h +115 -98
  382. package/deps/jq/src/parser.y +124 -89
  383. package/deps/jq/src/util.c +854 -55
  384. package/deps/jq/src/util.h +6 -4
  385. package/deps/jq/tests/jq.test +762 -26
  386. package/deps/jq/tests/jq_fuzz_compile.c +27 -0
  387. package/deps/jq/tests/jq_fuzz_execute.cpp +42 -0
  388. package/deps/jq/tests/jq_fuzz_fixed.cpp +297 -0
  389. package/deps/jq/tests/jq_fuzz_load_file.c +28 -0
  390. package/deps/jq/tests/jq_fuzz_parse.c +21 -0
  391. package/deps/jq/tests/jq_fuzz_parse_extended.c +36 -0
  392. package/deps/jq/tests/jq_fuzz_parse_stream.c +21 -0
  393. package/deps/jq/tests/local.supp +14 -0
  394. package/deps/jq/tests/man.test +979 -0
  395. package/deps/jq/tests/manonig.test +76 -0
  396. package/deps/jq/tests/manonigtest +5 -0
  397. package/deps/jq/tests/mantest +1 -2
  398. package/deps/jq/tests/modules/home2/.jq/g.jq +1 -0
  399. package/deps/jq/tests/modules/shadow1.jq +2 -0
  400. package/deps/jq/tests/modules/shadow2.jq +1 -0
  401. package/deps/jq/tests/modules/test_bind_order0.jq +1 -0
  402. package/deps/jq/tests/modules/test_bind_order1.jq +1 -1
  403. package/deps/jq/tests/modules/test_bind_order2.jq +0 -1
  404. package/deps/jq/tests/no-main-program.jq +1 -0
  405. package/deps/jq/tests/onig.test +77 -2
  406. package/deps/jq/tests/setup +7 -2
  407. package/deps/jq/tests/shtest +478 -59
  408. package/deps/jq/tests/uri.test +38 -0
  409. package/deps/jq/tests/uritest +5 -0
  410. package/deps/jq/tests/yes-main-program.jq +2 -0
  411. package/lib/index.js +3 -0
  412. package/lib/jq.js +15 -1
  413. package/lib/templateAsync.js +137 -0
  414. package/package.json +7 -7
  415. package/src/binding.cc +623 -146
  416. package/src/binding.h +3 -4
  417. package/test/santiy-async.test.js +171 -0
  418. package/test/santiy.test.js +2 -2
  419. package/test/template-async.test.js +182 -0
  420. package/test/template.test.js +3 -3
  421. package/deps/jq/.travis.yml +0 -202
  422. package/deps/jq/NEWS +0 -89
  423. package/deps/jq/appveyor.yml +0 -53
  424. package/deps/jq/docs/Gemfile +0 -7
  425. package/deps/jq/docs/Gemfile.lock +0 -63
  426. package/deps/jq/docs/Rakefile +0 -24
  427. package/deps/jq/docs/Rakefile.manual +0 -49
  428. package/deps/jq/docs/Rakefile.website +0 -76
  429. package/deps/jq/docs/content/1.tutorial/default.yml +0 -327
  430. package/deps/jq/docs/content/2.download/default.yml +0 -193
  431. package/deps/jq/docs/content/index/index.yml +0 -73
  432. package/deps/jq/docs/public/css/base.scss +0 -181
  433. package/deps/jq/docs/public/jq.png +0 -0
  434. package/deps/jq/docs/site.yml +0 -9
  435. package/deps/jq/docs/templates/default.liquid +0 -34
  436. package/deps/jq/docs/templates/index.liquid +0 -73
  437. package/deps/jq/docs/templates/manual.liquid +0 -99
  438. package/deps/jq/docs/templates/shared/_footer.liquid +0 -10
  439. package/deps/jq/docs/templates/shared/_head.liquid +0 -17
  440. package/deps/jq/docs/templates/shared/_navbar.liquid +0 -27
  441. package/deps/jq/modules/oniguruma/README.ja +0 -195
  442. package/deps/jq/modules/oniguruma/cmake/dist.cmake +0 -321
  443. package/deps/jq/modules/oniguruma/contributed/libfuzzer-onig.cpp +0 -31
  444. package/deps/jq/modules/oniguruma/dist.info +0 -10
  445. package/deps/jq/modules/oniguruma/src/unicode-7.0/unicode_fold1_key.c +0 -2250
  446. package/deps/jq/modules/oniguruma/src/unicode-7.0/unicode_fold2_key.c +0 -203
  447. package/deps/jq/modules/oniguruma/src/unicode-7.0/unicode_fold3_key.c +0 -113
  448. package/deps/jq/modules/oniguruma/src/unicode-7.0/unicode_fold_data.c +0 -1225
  449. package/deps/jq/modules/oniguruma/src/unicode-7.0/unicode_property_data.c +0 -24742
  450. package/deps/jq/modules/oniguruma/src/unicode-7.0/unicode_property_data_posix.c +0 -4846
  451. package/deps/jq/modules/oniguruma/src/unicode-7.0/unicode_unfold_key.c +0 -2571
  452. /package/deps/jq/sig/{jq-release.key → jq-release-old.key} +0 -0
  453. /package/deps/jq/tests/modules/{.jq → home1/.jq} +0 -0
package/deps/jq/src/jv.h CHANGED
@@ -5,6 +5,17 @@
5
5
  #include <stdint.h>
6
6
  #include <stdio.h>
7
7
 
8
+ #ifdef __cplusplus
9
+ extern "C" {
10
+ #endif
11
+
12
+ #if (defined(__GNUC__) && __GNUC__ >= 7) || \
13
+ (defined(__clang__) && __clang_major__ >= 10)
14
+ # define JQ_FALLTHROUGH __attribute__((fallthrough))
15
+ #else
16
+ # define JQ_FALLTHROUGH do {} while (0) /* fallthrough */
17
+ #endif
18
+
8
19
  typedef enum {
9
20
  JV_KIND_INVALID,
10
21
  JV_KIND_NULL,
@@ -54,16 +65,19 @@ jv jv_invalid_with_msg(jv);
54
65
  jv jv_invalid_get_msg(jv);
55
66
  int jv_invalid_has_msg(jv);
56
67
 
57
-
58
68
  jv jv_null(void);
59
69
  jv jv_true(void);
60
70
  jv jv_false(void);
61
71
  jv jv_bool(int);
62
72
 
63
73
  jv jv_number(double);
74
+ jv jv_number_with_literal(const char*);
64
75
  double jv_number_value(jv);
65
76
  int jv_is_integer(jv);
66
77
 
78
+ int jv_number_has_literal(jv n);
79
+ const char* jv_number_get_literal(jv);
80
+
67
81
  jv jv_array(void);
68
82
  jv jv_array_sized(int);
69
83
  int jv_array_length(jv);
@@ -99,6 +113,9 @@ jv jv_array_indexes(jv, jv);
99
113
  __attribute__ ((__format__( __printf__, fmt_arg_num, args_num)))
100
114
  #define JV_VPRINTF_LIKE(fmt_arg_num) \
101
115
  __attribute__ ((__format__( __printf__, fmt_arg_num, 0)))
116
+ #else
117
+ #define JV_PRINTF_LIKE(fmt_arg_num, args_num)
118
+ #define JV_VPRINTF_LIKE(fmt_arg_num)
102
119
  #endif
103
120
 
104
121
 
@@ -224,6 +241,7 @@ enum {
224
241
 
225
242
  jv jv_parse(const char* string);
226
243
  jv jv_parse_sized(const char* string, int length);
244
+ jv jv_parse_custom_flags(const char* string, int flags);
227
245
 
228
246
  typedef void (*jv_nomem_handler_f)(void *);
229
247
  void jv_nomem_handler(jv_nomem_handler_f, void *);
@@ -249,6 +267,9 @@ int jv_cmp(jv, jv);
249
267
  jv jv_group(jv, jv);
250
268
  jv jv_sort(jv, jv);
251
269
 
270
+ #ifdef __cplusplus
271
+ }
272
+ #endif
252
273
 
253
274
  #endif
254
275
 
@@ -37,7 +37,7 @@ static void memory_exhausted() {
37
37
  if (nomem_handler.handler)
38
38
  nomem_handler.handler(nomem_handler.data); // Maybe handler() will longjmp() to safety
39
39
  // Or not
40
- fprintf(stderr, "error: cannot allocate memory\n");
40
+ fprintf(stderr, "jq: error: cannot allocate memory\n");
41
41
  abort();
42
42
  }
43
43
  #else /* USE_TLS */
@@ -45,9 +45,11 @@ static void memory_exhausted() {
45
45
  #ifdef HAVE_PTHREAD_KEY_CREATE
46
46
  #include <pthread.h>
47
47
 
48
- pthread_key_t nomem_handler_key;
49
- pthread_once_t mem_once = PTHREAD_ONCE_INIT;
48
+ static pthread_key_t nomem_handler_key;
49
+ static pthread_once_t mem_once = PTHREAD_ONCE_INIT;
50
50
 
51
+ /* tsd_fini is called on application exit */
52
+ /* it clears the nomem_handler allocated in the main thread */
51
53
  static void tsd_fini(void) {
52
54
  struct nomem_handler *nomem_handler;
53
55
  nomem_handler = pthread_getspecific(nomem_handler_key);
@@ -57,30 +59,45 @@ static void tsd_fini(void) {
57
59
  }
58
60
  }
59
61
 
62
+ /* The tsd_fini_thread is a destructor set by calling */
63
+ /* pthread_key_create(&nomem_handler_key, tsd_fini_thread) */
64
+ /* It is called when thread ends */
65
+ static void tsd_fini_thread(void *nomem_handler) {
66
+ free(nomem_handler);
67
+ }
68
+
60
69
  static void tsd_init(void) {
61
- if (pthread_key_create(&nomem_handler_key, NULL) != 0) {
62
- fprintf(stderr, "error: cannot create thread specific key");
70
+ if (pthread_key_create(&nomem_handler_key, tsd_fini_thread) != 0) {
71
+ fprintf(stderr, "jq: error: cannot create thread specific key");
63
72
  abort();
64
73
  }
65
74
  if (atexit(tsd_fini) != 0) {
66
- fprintf(stderr, "error: cannot set an exit handler");
75
+ fprintf(stderr, "jq: error: cannot set an exit handler");
67
76
  abort();
68
77
  }
69
- struct nomem_handler *nomem_handler = calloc(1, sizeof(struct nomem_handler));
70
- if (pthread_setspecific(nomem_handler_key, nomem_handler) != 0) {
71
- fprintf(stderr, "error: cannot set thread specific data");
72
- abort();
78
+ }
79
+
80
+ static void tsd_init_nomem_handler(void)
81
+ {
82
+ if (pthread_getspecific(nomem_handler_key) == NULL) {
83
+ struct nomem_handler *nomem_handler = calloc(1, sizeof(struct nomem_handler));
84
+ if (pthread_setspecific(nomem_handler_key, nomem_handler) != 0) {
85
+ fprintf(stderr, "jq: error: cannot set thread specific data");
86
+ abort();
87
+ }
73
88
  }
74
89
  }
75
90
 
76
91
  void jv_nomem_handler(jv_nomem_handler_f handler, void *data) {
77
92
  pthread_once(&mem_once, tsd_init); // cannot fail
93
+ tsd_init_nomem_handler();
94
+
78
95
  struct nomem_handler *nomem_handler;
79
96
 
80
97
  nomem_handler = pthread_getspecific(nomem_handler_key);
81
98
  if (nomem_handler == NULL) {
82
99
  handler(data);
83
- fprintf(stderr, "error: cannot allocate memory\n");
100
+ fprintf(stderr, "jq: error: cannot allocate memory\n");
84
101
  abort();
85
102
  }
86
103
  nomem_handler->handler = handler;
@@ -91,11 +108,13 @@ static void memory_exhausted() {
91
108
  struct nomem_handler *nomem_handler;
92
109
 
93
110
  pthread_once(&mem_once, tsd_init);
111
+ tsd_init_nomem_handler();
112
+
94
113
  nomem_handler = pthread_getspecific(nomem_handler_key);
95
- if (nomem_handler)
114
+ if (nomem_handler && nomem_handler->handler)
96
115
  nomem_handler->handler(nomem_handler->data); // Maybe handler() will longjmp() to safety
97
116
  // Or not
98
- fprintf(stderr, "error: cannot allocate memory\n");
117
+ fprintf(stderr, "jq: error: cannot allocate memory\n");
99
118
  abort();
100
119
  }
101
120
 
@@ -110,7 +129,7 @@ void jv_nomem_handler(jv_nomem_handler_f handler, void *data) {
110
129
  }
111
130
 
112
131
  static void memory_exhausted() {
113
- fprintf(stderr, "error: cannot allocate memory\n");
132
+ fprintf(stderr, "jq: error: cannot allocate memory\n");
114
133
  abort();
115
134
  }
116
135
 
@@ -165,15 +184,3 @@ void* jv_mem_realloc(void* p, size_t sz) {
165
184
  }
166
185
  return p;
167
186
  }
168
-
169
- #ifndef NDEBUG
170
- volatile char jv_mem_uninitialised;
171
- __attribute__((constructor)) void jv_mem_uninit_setup(){
172
- // ignore warning that this reads uninitialized memory - that's the point!
173
- #ifndef __clang_analyzer__
174
- char* p = malloc(1);
175
- jv_mem_uninitialised = *p;
176
- free(p);
177
- #endif
178
- }
179
- #endif
@@ -4,17 +4,6 @@
4
4
  #include <stddef.h>
5
5
  #include "jv.h"
6
6
 
7
- #ifndef NDEBUG
8
- extern volatile char jv_mem_uninitialised;
9
- #endif
10
-
11
- static void jv_mem_invalidate(void* mem, size_t n) {
12
- #ifndef NDEBUG
13
- char* m = mem;
14
- while (n--) *m++ ^= jv_mem_uninitialised ^ jv_mem_uninitialised;
15
- #endif
16
- }
17
-
18
7
  void* jv_mem_alloc(size_t);
19
8
  void* jv_mem_alloc_unguarded(size_t);
20
9
  void* jv_mem_calloc(size_t, size_t);
@@ -1,9 +1,21 @@
1
+ #include <assert.h>
2
+ #include <limits.h>
3
+ #include <math.h>
1
4
  #include <string.h>
2
5
  #include <stdlib.h>
3
- #include <assert.h>
4
6
  #include "jv_alloc.h"
7
+ #include "jv_private.h"
8
+
9
+ // making this static verbose function here
10
+ // until we introduce a less confusing naming scheme
11
+ // of jv_* API with regards to the memory management
12
+ static double jv_number_get_value_and_consume(jv number) {
13
+ double value = jv_number_value(number);
14
+ jv_free(number);
15
+ return value;
16
+ }
5
17
 
6
- static int parse_slice(jv j, jv slice, int* pstart, int* pend) {
18
+ static jv parse_slice(jv j, jv slice, int* pstart, int* pend) {
7
19
  // Array slices
8
20
  jv start_jv = jv_object_get(jv_copy(slice), jv_string("start"));
9
21
  jv end_jv = jv_object_get(slice, jv_string("end"));
@@ -17,8 +29,14 @@ static int parse_slice(jv j, jv slice, int* pstart, int* pend) {
17
29
  } else if (jv_get_kind(j) == JV_KIND_STRING) {
18
30
  len = jv_string_length_codepoints(j);
19
31
  } else {
32
+ /*
33
+ * XXX This should be dead code because callers shouldn't call this
34
+ * function if `j' is neither an array nor a string.
35
+ */
20
36
  jv_free(j);
21
- return 0;
37
+ jv_free(start_jv);
38
+ jv_free(end_jv);
39
+ return jv_invalid_with_msg(jv_string("Only arrays and strings can be sliced"));
22
40
  }
23
41
  if (jv_get_kind(end_jv) == JV_KIND_NULL) {
24
42
  jv_free(end_jv);
@@ -28,27 +46,34 @@ static int parse_slice(jv j, jv slice, int* pstart, int* pend) {
28
46
  jv_get_kind(end_jv) != JV_KIND_NUMBER) {
29
47
  jv_free(start_jv);
30
48
  jv_free(end_jv);
31
- return 0;
32
- } else {
33
- double dstart = jv_number_value(start_jv);
34
- double dend = jv_number_value(end_jv);
35
- if (dstart < 0) dstart += len;
36
- if (dend < 0) dend += len;
37
- if (dstart < 0) dstart = 0;
38
- if (dstart > len) dstart = len;
39
-
40
- int start = (int)dstart;
41
- int end = (dend > len) ? len : (int)dend;
42
- // Ends are exclusive but e.g. 1 < 1.5 so :1.5 should be :2 not :1
43
- if(end < dend) end += 1;
44
-
45
- if (end > len) end = len;
46
- if (end < start) end = start;
47
- assert(0 <= start && start <= end && end <= len);
48
- *pstart = start;
49
- *pend = end;
50
- return 1;
49
+ return jv_invalid_with_msg(jv_string("Array/string slice indices must be integers"));
51
50
  }
51
+
52
+ double dstart = jv_number_value(start_jv);
53
+ double dend = jv_number_value(end_jv);
54
+ int start, end;
55
+
56
+ jv_free(start_jv);
57
+ jv_free(end_jv);
58
+ if (isnan(dstart)) dstart = 0;
59
+ if (dstart < 0) dstart += len;
60
+ if (dstart < 0) dstart = 0;
61
+ if (dstart > len) dstart = len;
62
+ start = dstart > INT_MAX ? INT_MAX : (int)dstart; // Rounds down
63
+
64
+ if (isnan(dend)) dend = len;
65
+ if (dend < 0) dend += len;
66
+ if (dend < 0) dend = start;
67
+ end = dend > INT_MAX ? INT_MAX : (int)dend;
68
+ if (end > len) end = len;
69
+ if (end < len) end += end < dend ? 1 : 0; // We round start down
70
+ // but round end up
71
+
72
+ if (end < start) end = start;
73
+ assert(0 <= start && start <= end && end <= len);
74
+ *pstart = start;
75
+ *pend = end;
76
+ return jv_true();
52
77
  }
53
78
 
54
79
  jv jv_get(jv t, jv k) {
@@ -60,35 +85,44 @@ jv jv_get(jv t, jv k) {
60
85
  v = jv_null();
61
86
  }
62
87
  } else if (jv_get_kind(t) == JV_KIND_ARRAY && jv_get_kind(k) == JV_KIND_NUMBER) {
63
- if(jv_is_integer(k)){
64
- int idx = (int)jv_number_value(k);
65
- if (idx < 0)
66
- idx += jv_array_length(jv_copy(t));
67
- v = jv_array_get(t, idx);
68
- if (!jv_is_valid(v)) {
69
- jv_free(v);
70
- v = jv_null();
71
- }
72
- } else {
88
+ if (jvp_number_is_nan(k)) {
73
89
  jv_free(t);
74
- jv_free(k);
75
90
  v = jv_null();
91
+ } else {
92
+ double didx = jv_number_value(k);
93
+ if (jvp_number_is_nan(k)) {
94
+ v = jv_null();
95
+ } else {
96
+ if (didx < INT_MIN) didx = INT_MIN;
97
+ if (didx > INT_MAX) didx = INT_MAX;
98
+ int idx = (int)didx;
99
+ if (idx < 0)
100
+ idx += jv_array_length(jv_copy(t));
101
+ v = jv_array_get(t, idx);
102
+ if (!jv_is_valid(v)) {
103
+ jv_free(v);
104
+ v = jv_null();
105
+ }
106
+ }
76
107
  }
108
+ jv_free(k);
77
109
  } else if (jv_get_kind(t) == JV_KIND_ARRAY && jv_get_kind(k) == JV_KIND_OBJECT) {
78
110
  int start, end;
79
- if (parse_slice(jv_copy(t), k, &start, &end)) {
111
+ jv e = parse_slice(jv_copy(t), k, &start, &end);
112
+ if (jv_get_kind(e) == JV_KIND_TRUE) {
80
113
  v = jv_array_slice(t, start, end);
81
114
  } else {
82
115
  jv_free(t);
83
- v = jv_invalid_with_msg(jv_string_fmt("Start and end indices of an array slice must be numbers"));
116
+ v = e;
84
117
  }
85
118
  } else if (jv_get_kind(t) == JV_KIND_STRING && jv_get_kind(k) == JV_KIND_OBJECT) {
86
119
  int start, end;
87
- if (parse_slice(jv_copy(t), k, &start, &end)) {
120
+ jv e = parse_slice(jv_copy(t), k, &start, &end);
121
+ if (jv_get_kind(e) == JV_KIND_TRUE) {
88
122
  v = jv_string_slice(t, start, end);
89
123
  } else {
90
- v = jv_invalid_with_msg(jv_string_fmt("Start and end indices of an string slice must be numbers"));
91
124
  jv_free(t);
125
+ v = e;
92
126
  }
93
127
  } else if (jv_get_kind(t) == JV_KIND_ARRAY && jv_get_kind(k) == JV_KIND_ARRAY) {
94
128
  v = jv_array_indexes(t, k);
@@ -133,13 +167,24 @@ jv jv_set(jv t, jv k, jv v) {
133
167
  t = jv_object_set(t, k, v);
134
168
  } else if (jv_get_kind(k) == JV_KIND_NUMBER &&
135
169
  (jv_get_kind(t) == JV_KIND_ARRAY || isnull)) {
136
- if (isnull) t = jv_array();
137
- t = jv_array_set(t, (int)jv_number_value(k), v);
170
+ if (jvp_number_is_nan(k)) {
171
+ jv_free(t);
172
+ jv_free(k);
173
+ t = jv_invalid_with_msg(jv_string("Cannot set array element at NaN index"));
174
+ } else {
175
+ double didx = jv_number_value(k);
176
+ if (didx < INT_MIN) didx = INT_MIN;
177
+ if (didx > INT_MAX) didx = INT_MAX;
178
+ if (isnull) t = jv_array();
179
+ t = jv_array_set(t, (int)didx, v);
180
+ jv_free(k);
181
+ }
138
182
  } else if (jv_get_kind(k) == JV_KIND_OBJECT &&
139
183
  (jv_get_kind(t) == JV_KIND_ARRAY || isnull)) {
140
184
  if (isnull) t = jv_array();
141
185
  int start, end;
142
- if (parse_slice(jv_copy(t), k, &start, &end)) {
186
+ jv e = parse_slice(jv_copy(t), k, &start, &end);
187
+ if (jv_get_kind(e) == JV_KIND_TRUE) {
143
188
  if (jv_get_kind(v) == JV_KIND_ARRAY) {
144
189
  int array_len = jv_array_length(jv_copy(t));
145
190
  assert(0 <= start && start <= end && end <= array_len);
@@ -171,8 +216,14 @@ jv jv_set(jv t, jv k, jv v) {
171
216
  } else {
172
217
  jv_free(t);
173
218
  jv_free(v);
174
- t = jv_invalid_with_msg(jv_string_fmt("Start and end indices of an array slice must be numbers"));
219
+ t = e;
175
220
  }
221
+ } else if (jv_get_kind(k) == JV_KIND_OBJECT && jv_get_kind(t) == JV_KIND_STRING) {
222
+ jv_free(t);
223
+ jv_free(k);
224
+ jv_free(v);
225
+ /* Well, why not? We should implement this... */
226
+ t = jv_invalid_with_msg(jv_string_fmt("Cannot update string slices"));
176
227
  } else {
177
228
  jv err = jv_invalid_with_msg(jv_string_fmt("Cannot update field at %s index of %s",
178
229
  jv_kind_name(jv_get_kind(k)),
@@ -200,9 +251,15 @@ jv jv_has(jv t, jv k) {
200
251
  jv_free(elem);
201
252
  } else if (jv_get_kind(t) == JV_KIND_ARRAY &&
202
253
  jv_get_kind(k) == JV_KIND_NUMBER) {
203
- jv elem = jv_array_get(t, (int)jv_number_value(k));
204
- ret = jv_bool(jv_is_valid(elem));
205
- jv_free(elem);
254
+ if (jvp_number_is_nan(k)) {
255
+ jv_free(t);
256
+ ret = jv_false();
257
+ } else {
258
+ jv elem = jv_array_get(t, (int)jv_number_value(k));
259
+ ret = jv_bool(jv_is_valid(elem));
260
+ jv_free(elem);
261
+ }
262
+ jv_free(k);
206
263
  } else {
207
264
  ret = jv_invalid_with_msg(jv_string_fmt("Cannot check whether %s has a %s key",
208
265
  jv_kind_name(jv_get_kind(t)),
@@ -235,12 +292,14 @@ static jv jv_dels(jv t, jv keys) {
235
292
  }
236
293
  } else if (jv_get_kind(key) == JV_KIND_OBJECT) {
237
294
  int start, end;
238
- if (parse_slice(jv_copy(t), key, &start, &end)) {
295
+ jv e = parse_slice(jv_copy(t), key, &start, &end);
296
+ if (jv_get_kind(e) == JV_KIND_TRUE) {
239
297
  starts = jv_array_append(starts, jv_number(start));
240
298
  ends = jv_array_append(ends, jv_number(end));
241
299
  } else {
242
300
  jv_free(new_array);
243
- new_array = jv_invalid_with_msg(jv_string_fmt("Start and end indices of an array slice must be numbers"));
301
+ jv_free(key);
302
+ new_array = e;
244
303
  goto arr_out;
245
304
  }
246
305
  } else {
@@ -255,10 +314,10 @@ static jv jv_dels(jv t, jv keys) {
255
314
  int neg_idx = 0;
256
315
  int nonneg_idx = 0;
257
316
  int len = jv_array_length(jv_copy(t));
258
- jv_array_foreach(t, i, elem) {
317
+ for (int i = 0; i < len; ++i) {
259
318
  int del = 0;
260
319
  while (neg_idx < jv_array_length(jv_copy(neg_keys))) {
261
- int delidx = len + (int)jv_number_value(jv_array_get(jv_copy(neg_keys), neg_idx));
320
+ int delidx = len + (int)jv_number_get_value_and_consume(jv_array_get(jv_copy(neg_keys), neg_idx));
262
321
  if (i == delidx) {
263
322
  del = 1;
264
323
  }
@@ -268,7 +327,7 @@ static jv jv_dels(jv t, jv keys) {
268
327
  neg_idx++;
269
328
  }
270
329
  while (nonneg_idx < jv_array_length(jv_copy(nonneg_keys))) {
271
- int delidx = (int)jv_number_value(jv_array_get(jv_copy(nonneg_keys), nonneg_idx));
330
+ int delidx = (int)jv_number_get_value_and_consume(jv_array_get(jv_copy(nonneg_keys), nonneg_idx));
272
331
  if (i == delidx) {
273
332
  del = 1;
274
333
  }
@@ -278,15 +337,13 @@ static jv jv_dels(jv t, jv keys) {
278
337
  nonneg_idx++;
279
338
  }
280
339
  for (int sidx=0; !del && sidx<jv_array_length(jv_copy(starts)); sidx++) {
281
- if ((int)jv_number_value(jv_array_get(jv_copy(starts), sidx)) <= i &&
282
- i < (int)jv_number_value(jv_array_get(jv_copy(ends), sidx))) {
340
+ if ((int)jv_number_get_value_and_consume(jv_array_get(jv_copy(starts), sidx)) <= i &&
341
+ i < (int)jv_number_get_value_and_consume(jv_array_get(jv_copy(ends), sidx))) {
283
342
  del = 1;
284
343
  }
285
344
  }
286
345
  if (!del)
287
- new_array = jv_array_append(new_array, elem);
288
- else
289
- jv_free(elem);
346
+ new_array = jv_array_append(new_array, jv_array_get(jv_copy(t), i));
290
347
  }
291
348
  arr_out:
292
349
  jv_free(neg_keys);
@@ -335,8 +392,38 @@ jv jv_setpath(jv root, jv path, jv value) {
335
392
  }
336
393
  jv pathcurr = jv_array_get(jv_copy(path), 0);
337
394
  jv pathrest = jv_array_slice(path, 1, jv_array_length(jv_copy(path)));
338
- return jv_set(root, pathcurr,
339
- jv_setpath(jv_get(jv_copy(root), jv_copy(pathcurr)), pathrest, value));
395
+
396
+ /*
397
+ * We need to be careful not to make extra copies since that leads to
398
+ * quadratic behavior (e.g., when growing large data structures in a
399
+ * reduction with `setpath/2`, i.e., with `|=`.
400
+ */
401
+ if (jv_get_kind(pathcurr) == JV_KIND_OBJECT) {
402
+ // Assignment to slice -- dunno yet how to avoid the extra copy
403
+ return jv_set(root, pathcurr,
404
+ jv_setpath(jv_get(jv_copy(root), jv_copy(pathcurr)), pathrest, value));
405
+ }
406
+
407
+ jv subroot = jv_get(jv_copy(root), jv_copy(pathcurr));
408
+ if (!jv_is_valid(subroot)) {
409
+ jv_free(root);
410
+ jv_free(pathcurr);
411
+ jv_free(pathrest);
412
+ jv_free(value);
413
+ return subroot;
414
+ }
415
+
416
+ // To avoid the extra copy we drop the reference from `root` by setting that
417
+ // to null first.
418
+ root = jv_set(root, jv_copy(pathcurr), jv_null());
419
+ if (!jv_is_valid(root)) {
420
+ jv_free(subroot);
421
+ jv_free(pathcurr);
422
+ jv_free(pathrest);
423
+ jv_free(value);
424
+ return root;
425
+ }
426
+ return jv_set(root, pathcurr, jv_setpath(subroot, pathrest, value));
340
427
  }
341
428
 
342
429
  jv jv_getpath(jv root, jv path) {
@@ -465,7 +552,7 @@ jv jv_keys_unsorted(jv x) {
465
552
  jv jv_keys(jv x) {
466
553
  if (jv_get_kind(x) == JV_KIND_OBJECT) {
467
554
  int nkeys = jv_object_length(jv_copy(x));
468
- jv* keys = jv_mem_calloc(sizeof(jv), nkeys);
555
+ jv* keys = jv_mem_calloc(nkeys, sizeof(jv));
469
556
  int kidx = 0;
470
557
  jv_object_foreach(x, key, value) {
471
558
  keys[kidx++] = key;
@@ -511,14 +598,13 @@ int jv_cmp(jv a, jv b) {
511
598
  break;
512
599
 
513
600
  case JV_KIND_NUMBER: {
514
- double da = jv_number_value(a), db = jv_number_value(b);
515
-
516
- // handle NaN as though it were null
517
- if (da != da) r = jv_cmp(jv_null(), jv_number(db));
518
- else if (db != db) r = jv_cmp(jv_number(da), jv_null());
519
- else if (da < db) r = -1;
520
- else if (da == db) r = 0;
521
- else r = 1;
601
+ if (jvp_number_is_nan(a)) {
602
+ r = jv_cmp(jv_null(), jv_copy(b));
603
+ } else if (jvp_number_is_nan(b)) {
604
+ r = jv_cmp(jv_copy(a), jv_null());
605
+ } else {
606
+ r = jvp_number_cmp(a, b);
607
+ }
522
608
  break;
523
609
  }
524
610
 
@@ -587,7 +673,7 @@ static struct sort_entry* sort_items(jv objects, jv keys) {
587
673
  assert(jv_get_kind(keys) == JV_KIND_ARRAY);
588
674
  assert(jv_array_length(jv_copy(objects)) == jv_array_length(jv_copy(keys)));
589
675
  int n = jv_array_length(jv_copy(objects));
590
- struct sort_entry* entries = jv_mem_calloc(sizeof(struct sort_entry), n);
676
+ struct sort_entry* entries = jv_mem_calloc(n, sizeof(struct sort_entry));
591
677
  for (int i=0; i<n; i++) {
592
678
  entries[i].object = jv_array_get(jv_copy(objects), i);
593
679
  entries[i].key = jv_array_get(jv_copy(keys), i);
@@ -195,6 +195,7 @@
195
195
  #include "jv_dtoa.h"
196
196
 
197
197
  #include "jv_alloc.h"
198
+ #include "jv.h"
198
199
  #define MALLOC jv_mem_alloc
199
200
  #define FREE jv_mem_free
200
201
 
@@ -298,7 +299,7 @@ extern "C" {
298
299
  #endif
299
300
 
300
301
  #if defined(IEEE_8087) + defined(IEEE_MC68k) + defined(VAX) + defined(IBM) != 1
301
- Exactly one of IEEE_8087, IEEE_MC68k, VAX, or IBM should be defined.
302
+ # error Exactly one of IEEE_8087, IEEE_MC68k, VAX, or IBM should be defined.
302
303
  #endif
303
304
 
304
305
  typedef union { double d; ULong L[2]; } U;
@@ -1723,6 +1724,7 @@ gethex(struct dtoa_context* C, CONST char **sp, U *rvp, int rounding, int sign)
1723
1724
  case '-':
1724
1725
  esign = 1;
1725
1726
  /* no break */
1727
+ JQ_FALLTHROUGH;
1726
1728
  case '+':
1727
1729
  s++;
1728
1730
  }
@@ -2327,7 +2329,10 @@ retlow1:
2327
2329
  jvp_strtod
2328
2330
  (struct dtoa_context* C, const char *s00, char **se)
2329
2331
  {
2330
- int bb2, bb5, bbe, bd2, bd5, bbbits, bs2, c, e, e1, test_scale;
2332
+ int bb2, bb5, bbe, bd2, bd5, bbbits, bs2, c, e, e1;
2333
+ #ifdef Honor_FLT_ROUNDS
2334
+ int test_scale;
2335
+ #endif
2331
2336
  int esign, i, j, k, nd, nd0, nf, nz, nz0, nz1, sign;
2332
2337
  CONST char *s, *s0, *s1;
2333
2338
  double aadj, aadj1;
@@ -2367,10 +2372,12 @@ jvp_strtod
2367
2372
  case '-':
2368
2373
  sign = 1;
2369
2374
  /* no break */
2375
+ JQ_FALLTHROUGH;
2370
2376
  case '+':
2371
2377
  if (*++s)
2372
2378
  goto break2;
2373
2379
  /* no break */
2380
+ JQ_FALLTHROUGH;
2374
2381
  case 0:
2375
2382
  goto ret0;
2376
2383
  case '\t':
@@ -2478,6 +2485,7 @@ jvp_strtod
2478
2485
  switch(c = *++s) {
2479
2486
  case '-':
2480
2487
  esign = 1;
2488
+ JQ_FALLTHROUGH;
2481
2489
  case '+':
2482
2490
  c = *++s;
2483
2491
  }
@@ -3699,6 +3707,7 @@ jvp_dtoa
3699
3707
  case 2:
3700
3708
  leftright = 0;
3701
3709
  /* no break */
3710
+ JQ_FALLTHROUGH;
3702
3711
  case 4:
3703
3712
  if (ndigits <= 0)
3704
3713
  ndigits = 1;
@@ -3707,6 +3716,7 @@ jvp_dtoa
3707
3716
  case 3:
3708
3717
  leftright = 0;
3709
3718
  /* no break */
3719
+ JQ_FALLTHROUGH;
3710
3720
  case 5:
3711
3721
  i = ndigits + k + 1;
3712
3722
  ilim = i;
@@ -0,0 +1,51 @@
1
+ #include <stdlib.h>
2
+ #include <stdio.h>
3
+
4
+ #include "jv_thread.h"
5
+ #include "jv_dtoa_tsd.h"
6
+ #include "jv_dtoa.h"
7
+ #include "jv_alloc.h"
8
+
9
+ static pthread_once_t dtoa_ctx_once = PTHREAD_ONCE_INIT;
10
+
11
+ static pthread_key_t dtoa_ctx_key;
12
+ static void tsd_dtoa_ctx_dtor(void *ctx) {
13
+ if (ctx) {
14
+ jvp_dtoa_context_free((struct dtoa_context *)ctx);
15
+ jv_mem_free(ctx);
16
+ }
17
+ }
18
+
19
+ #ifndef WIN32
20
+ static
21
+ #endif
22
+ void jv_tsd_dtoa_ctx_fini() {
23
+ struct dtoa_context *ctx = pthread_getspecific(dtoa_ctx_key);
24
+ tsd_dtoa_ctx_dtor(ctx);
25
+ pthread_setspecific(dtoa_ctx_key, NULL);
26
+ }
27
+
28
+ #ifndef WIN32
29
+ static
30
+ #endif
31
+ void jv_tsd_dtoa_ctx_init() {
32
+ if (pthread_key_create(&dtoa_ctx_key, tsd_dtoa_ctx_dtor) != 0) {
33
+ fprintf(stderr, "error: cannot create thread specific key");
34
+ abort();
35
+ }
36
+ atexit(jv_tsd_dtoa_ctx_fini);
37
+ }
38
+
39
+ inline struct dtoa_context *tsd_dtoa_context_get() {
40
+ pthread_once(&dtoa_ctx_once, jv_tsd_dtoa_ctx_init); // cannot fail
41
+ struct dtoa_context *ctx = (struct dtoa_context*)pthread_getspecific(dtoa_ctx_key);
42
+ if (!ctx) {
43
+ ctx = malloc(sizeof(struct dtoa_context));
44
+ jvp_dtoa_context_init(ctx);
45
+ if (pthread_setspecific(dtoa_ctx_key, ctx) != 0) {
46
+ fprintf(stderr, "error: cannot set thread specific data");
47
+ abort();
48
+ }
49
+ }
50
+ return ctx;
51
+ }
@@ -0,0 +1,4 @@
1
+ #ifndef JV_DTOA_TSD_H
2
+ #define JV_DTOA_TSD_H
3
+ struct dtoa_context *tsd_dtoa_context_get();
4
+ #endif