@port-labs/jq-node-bindings 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 (286) hide show
  1. package/binding.gyp +3 -3
  2. package/configure +8 -6
  3. package/deps/jq/.travis.yml +184 -35
  4. package/deps/jq/AUTHORS +31 -30
  5. package/deps/jq/COPYING +2 -2
  6. package/deps/jq/KEYS +8 -0
  7. package/deps/jq/Makefile.am +85 -70
  8. package/deps/jq/NEWS +5 -4
  9. package/deps/jq/README.md +18 -9
  10. package/deps/jq/appveyor.yml +53 -0
  11. package/deps/jq/compile-ios.sh +5 -5
  12. package/deps/jq/config/m4/check-math-func.m4 +7 -2
  13. package/deps/jq/configure.ac +130 -68
  14. package/deps/jq/docs/Rakefile +14 -135
  15. package/deps/jq/docs/Rakefile.manual +49 -0
  16. package/deps/jq/docs/Rakefile.website +76 -0
  17. package/deps/jq/docs/content/2.download/default.yml +115 -39
  18. package/deps/jq/docs/content/3.manual/manual.yml +641 -231
  19. package/deps/jq/docs/content/3.manual/v1.3/manual.yml +130 -130
  20. package/deps/jq/docs/content/3.manual/v1.4/manual.yml +160 -160
  21. package/deps/jq/docs/content/3.manual/v1.5/manual.yml +2878 -0
  22. package/deps/jq/docs/content/3.manual/v1.6/manual.yml +3287 -0
  23. package/deps/jq/docs/content/index/index.yml +28 -6
  24. package/deps/jq/docs/public/.htaccess +2 -2
  25. package/deps/jq/docs/public/css/base.scss +141 -59
  26. package/deps/jq/docs/public/js/manual-search.js +52 -0
  27. package/deps/jq/docs/site.yml +1 -10
  28. package/deps/jq/docs/templates/default.liquid +10 -10
  29. package/deps/jq/docs/templates/index.liquid +45 -32
  30. package/deps/jq/docs/templates/manual.liquid +67 -90
  31. package/deps/jq/docs/templates/shared/_footer.liquid +10 -5
  32. package/deps/jq/docs/templates/shared/_head.liquid +17 -12
  33. package/deps/jq/docs/templates/shared/_navbar.liquid +27 -0
  34. package/deps/jq/jq.1.prebuilt +523 -139
  35. package/deps/jq/modules/oniguruma/AUTHORS +1 -0
  36. package/deps/jq/modules/oniguruma/CMakeLists.txt +86 -0
  37. package/deps/jq/modules/oniguruma/COPYING +28 -0
  38. package/deps/jq/modules/oniguruma/ChangeLog +0 -0
  39. package/deps/jq/modules/oniguruma/HISTORY +2138 -0
  40. package/deps/jq/modules/oniguruma/Makefile.am +33 -0
  41. package/deps/jq/modules/oniguruma/NEWS +0 -0
  42. package/deps/jq/modules/oniguruma/README +189 -0
  43. package/deps/jq/modules/oniguruma/README.ja +195 -0
  44. package/deps/jq/modules/oniguruma/README.md +203 -0
  45. package/deps/jq/modules/oniguruma/cmake/dist.cmake +321 -0
  46. package/deps/jq/modules/oniguruma/compile +348 -0
  47. package/deps/jq/modules/oniguruma/config.guess +1754 -0
  48. package/deps/jq/modules/oniguruma/config.sub +1890 -0
  49. package/deps/jq/modules/oniguruma/configure.ac +87 -0
  50. package/deps/jq/modules/oniguruma/contributed/libfuzzer-onig.cpp +31 -0
  51. package/deps/jq/modules/oniguruma/depcomp +791 -0
  52. package/deps/jq/modules/oniguruma/dist.info +10 -0
  53. package/deps/jq/modules/oniguruma/doc/API +660 -0
  54. package/deps/jq/modules/oniguruma/doc/API.ja +667 -0
  55. package/deps/jq/modules/oniguruma/doc/FAQ +12 -0
  56. package/deps/jq/modules/oniguruma/doc/FAQ.ja +22 -0
  57. package/deps/jq/modules/oniguruma/doc/RE +436 -0
  58. package/deps/jq/modules/oniguruma/doc/RE.ja +448 -0
  59. package/deps/jq/modules/oniguruma/doc/UNICODE_PROPERTIES +698 -0
  60. package/deps/jq/modules/oniguruma/index.html +181 -0
  61. package/deps/jq/modules/oniguruma/index_ja.html +184 -0
  62. package/deps/jq/modules/oniguruma/install-sh +541 -0
  63. package/deps/jq/modules/oniguruma/m4/.whatever +0 -0
  64. package/deps/jq/modules/oniguruma/make_win32.bat +3 -0
  65. package/deps/jq/modules/oniguruma/make_win64.bat +3 -0
  66. package/deps/jq/modules/oniguruma/missing +215 -0
  67. package/deps/jq/modules/oniguruma/onig-config.in +78 -0
  68. package/deps/jq/modules/oniguruma/oniguruma.pc.cmake.in +13 -0
  69. package/deps/jq/modules/oniguruma/oniguruma.pc.in +14 -0
  70. package/deps/jq/modules/oniguruma/sample/CMakeLists.txt +28 -0
  71. package/deps/jq/modules/oniguruma/sample/Makefile.am +34 -0
  72. package/deps/jq/modules/oniguruma/sample/bug_fix.c +131 -0
  73. package/deps/jq/modules/oniguruma/sample/crnl.c +127 -0
  74. package/deps/jq/modules/oniguruma/sample/encode.c +308 -0
  75. package/deps/jq/modules/oniguruma/sample/listcap.c +110 -0
  76. package/deps/jq/modules/oniguruma/sample/names.c +75 -0
  77. package/deps/jq/modules/oniguruma/sample/posix.c +96 -0
  78. package/deps/jq/modules/oniguruma/sample/scan.c +88 -0
  79. package/deps/jq/modules/oniguruma/sample/simple.c +59 -0
  80. package/deps/jq/modules/oniguruma/sample/sql.c +76 -0
  81. package/deps/jq/modules/oniguruma/sample/syntax.c +76 -0
  82. package/deps/jq/modules/oniguruma/sample/user_property.c +87 -0
  83. package/deps/jq/modules/oniguruma/src/Makefile.am +58 -0
  84. package/deps/jq/modules/oniguruma/src/Makefile.windows +183 -0
  85. package/deps/jq/modules/oniguruma/src/ascii.c +61 -0
  86. package/deps/jq/modules/oniguruma/src/big5.c +190 -0
  87. package/deps/jq/modules/oniguruma/src/config.h.cmake.in +71 -0
  88. package/deps/jq/modules/oniguruma/src/config.h.win32 +84 -0
  89. package/deps/jq/modules/oniguruma/src/config.h.win64 +84 -0
  90. package/deps/jq/modules/oniguruma/src/cp1251.c +203 -0
  91. package/deps/jq/modules/oniguruma/src/euc_jp.c +310 -0
  92. package/deps/jq/modules/oniguruma/src/euc_jp_prop.c +158 -0
  93. package/deps/jq/modules/oniguruma/src/euc_jp_prop.gperf +27 -0
  94. package/deps/jq/modules/oniguruma/src/euc_kr.c +188 -0
  95. package/deps/jq/modules/oniguruma/src/euc_tw.c +171 -0
  96. package/deps/jq/modules/oniguruma/src/gb18030.c +538 -0
  97. package/deps/jq/modules/oniguruma/src/gperf_fold_key_conv.py +67 -0
  98. package/deps/jq/modules/oniguruma/src/gperf_unfold_key_conv.py +55 -0
  99. package/deps/jq/modules/oniguruma/src/iso8859_1.c +275 -0
  100. package/deps/jq/modules/oniguruma/src/iso8859_10.c +242 -0
  101. package/deps/jq/modules/oniguruma/src/iso8859_11.c +99 -0
  102. package/deps/jq/modules/oniguruma/src/iso8859_13.c +231 -0
  103. package/deps/jq/modules/oniguruma/src/iso8859_14.c +244 -0
  104. package/deps/jq/modules/oniguruma/src/iso8859_15.c +238 -0
  105. package/deps/jq/modules/oniguruma/src/iso8859_16.c +240 -0
  106. package/deps/jq/modules/oniguruma/src/iso8859_2.c +238 -0
  107. package/deps/jq/modules/oniguruma/src/iso8859_3.c +238 -0
  108. package/deps/jq/modules/oniguruma/src/iso8859_4.c +240 -0
  109. package/deps/jq/modules/oniguruma/src/iso8859_5.c +229 -0
  110. package/deps/jq/modules/oniguruma/src/iso8859_6.c +99 -0
  111. package/deps/jq/modules/oniguruma/src/iso8859_7.c +225 -0
  112. package/deps/jq/modules/oniguruma/src/iso8859_8.c +99 -0
  113. package/deps/jq/modules/oniguruma/src/iso8859_9.c +231 -0
  114. package/deps/jq/modules/oniguruma/src/koi8.c +253 -0
  115. package/deps/jq/modules/oniguruma/src/koi8_r.c +215 -0
  116. package/deps/jq/modules/oniguruma/src/make_unicode_fold.sh +22 -0
  117. package/deps/jq/modules/oniguruma/src/make_unicode_fold_data.py +306 -0
  118. package/deps/jq/modules/oniguruma/src/make_unicode_property.sh +18 -0
  119. package/deps/jq/modules/oniguruma/src/make_unicode_property_data.py +545 -0
  120. package/deps/jq/modules/oniguruma/src/mktable.c +1184 -0
  121. package/deps/jq/modules/oniguruma/src/onig_init.c +45 -0
  122. package/deps/jq/modules/oniguruma/src/oniggnu.h +85 -0
  123. package/deps/jq/modules/oniguruma/src/onigposix.h +169 -0
  124. package/deps/jq/modules/oniguruma/src/oniguruma.h +841 -0
  125. package/deps/jq/modules/oniguruma/src/regcomp.c +6300 -0
  126. package/deps/jq/modules/oniguruma/src/regenc.c +917 -0
  127. package/deps/jq/modules/oniguruma/src/regenc.h +243 -0
  128. package/deps/jq/modules/oniguruma/src/regerror.c +393 -0
  129. package/deps/jq/modules/oniguruma/src/regexec.c +3856 -0
  130. package/deps/jq/modules/oniguruma/src/regext.c +202 -0
  131. package/deps/jq/modules/oniguruma/src/reggnu.c +147 -0
  132. package/deps/jq/modules/oniguruma/src/regint.h +779 -0
  133. package/deps/jq/modules/oniguruma/src/regparse.c +5403 -0
  134. package/deps/jq/modules/oniguruma/src/regparse.h +351 -0
  135. package/deps/jq/modules/oniguruma/src/regposerr.c +105 -0
  136. package/deps/jq/modules/oniguruma/src/regposix.c +306 -0
  137. package/deps/jq/modules/oniguruma/src/regsyntax.c +315 -0
  138. package/deps/jq/modules/oniguruma/src/regtrav.c +76 -0
  139. package/deps/jq/modules/oniguruma/src/regversion.c +57 -0
  140. package/deps/jq/modules/oniguruma/src/sjis.c +341 -0
  141. package/deps/jq/modules/oniguruma/src/sjis_prop.c +158 -0
  142. package/deps/jq/modules/oniguruma/src/sjis_prop.gperf +27 -0
  143. package/deps/jq/modules/oniguruma/src/st.c +589 -0
  144. package/deps/jq/modules/oniguruma/src/st.h +68 -0
  145. package/deps/jq/modules/oniguruma/src/unicode-7.0/unicode_fold1_key.c +2250 -0
  146. package/deps/jq/modules/oniguruma/src/unicode-7.0/unicode_fold2_key.c +203 -0
  147. package/deps/jq/modules/oniguruma/src/unicode-7.0/unicode_fold3_key.c +113 -0
  148. package/deps/jq/modules/oniguruma/src/unicode-7.0/unicode_fold_data.c +1225 -0
  149. package/deps/jq/modules/oniguruma/src/unicode-7.0/unicode_property_data.c +24742 -0
  150. package/deps/jq/modules/oniguruma/src/unicode-7.0/unicode_property_data_posix.c +4846 -0
  151. package/deps/jq/modules/oniguruma/src/unicode-7.0/unicode_unfold_key.c +2571 -0
  152. package/deps/jq/modules/oniguruma/src/unicode.c +664 -0
  153. package/deps/jq/modules/oniguruma/src/unicode_fold1_key.c +2548 -0
  154. package/deps/jq/modules/oniguruma/src/unicode_fold2_key.c +203 -0
  155. package/deps/jq/modules/oniguruma/src/unicode_fold3_key.c +113 -0
  156. package/deps/jq/modules/oniguruma/src/unicode_fold_data.c +1366 -0
  157. package/deps/jq/modules/oniguruma/src/unicode_property_data.c +25306 -0
  158. package/deps/jq/modules/oniguruma/src/unicode_property_data_posix.c +4940 -0
  159. package/deps/jq/modules/oniguruma/src/unicode_unfold_key.c +2854 -0
  160. package/deps/jq/modules/oniguruma/src/utf16_be.c +235 -0
  161. package/deps/jq/modules/oniguruma/src/utf16_le.c +245 -0
  162. package/deps/jq/modules/oniguruma/src/utf32_be.c +194 -0
  163. package/deps/jq/modules/oniguruma/src/utf32_le.c +194 -0
  164. package/deps/jq/modules/oniguruma/src/utf8.c +335 -0
  165. package/deps/jq/modules/oniguruma/test/Makefile.am +28 -0
  166. package/deps/jq/modules/oniguruma/test/testc.c +874 -0
  167. package/deps/jq/modules/oniguruma/test/testu.c +916 -0
  168. package/deps/jq/modules/oniguruma/test-driver +153 -0
  169. package/deps/jq/modules/oniguruma/windows/testc.c +869 -0
  170. package/deps/jq/scripts/crosscompile +2 -1
  171. package/deps/jq/scripts/gen_utf8_tables.py +2 -3
  172. package/deps/jq/scripts/update-website +29 -0
  173. package/deps/jq/scripts/version +7 -2
  174. package/deps/jq/sig/jq-release.key +41 -0
  175. package/deps/jq/sig/v1.3/jq-linux-x86.asc +17 -0
  176. package/deps/jq/sig/v1.3/jq-linux-x86_64.asc +17 -0
  177. package/deps/jq/sig/v1.3/jq-osx-x86.asc +17 -0
  178. package/deps/jq/sig/v1.3/jq-osx-x86_64.asc +17 -0
  179. package/deps/jq/sig/v1.3/jq-win32.exe.asc +17 -0
  180. package/deps/jq/sig/v1.3/jq-win64.exe.asc +17 -0
  181. package/deps/jq/sig/v1.3/sha256sum.txt +6 -0
  182. package/deps/jq/sig/v1.4/jq-linux-x86.asc +17 -0
  183. package/deps/jq/sig/v1.4/jq-linux-x86_64.asc +17 -0
  184. package/deps/jq/sig/v1.4/jq-osx-x86.asc +17 -0
  185. package/deps/jq/sig/v1.4/jq-osx-x86_64.asc +17 -0
  186. package/deps/jq/sig/v1.4/jq-solaris11-32.asc +17 -0
  187. package/deps/jq/sig/v1.4/jq-solaris11-64.asc +17 -0
  188. package/deps/jq/sig/v1.4/jq-win32.exe.asc +17 -0
  189. package/deps/jq/sig/v1.4/jq-win64.exe.asc +17 -0
  190. package/deps/jq/sig/v1.4/sha256sum.txt +8 -0
  191. package/deps/jq/sig/v1.5/jq-linux32-no-oniguruma.asc +17 -0
  192. package/deps/jq/sig/v1.5/jq-linux32.asc +17 -0
  193. package/deps/jq/sig/v1.5/jq-linux64.asc +17 -0
  194. package/deps/jq/sig/v1.5/jq-osx-amd64.asc +17 -0
  195. package/deps/jq/sig/v1.5/jq-win32.exe.asc +17 -0
  196. package/deps/jq/sig/v1.5/jq-win64.exe.asc +17 -0
  197. package/deps/jq/sig/v1.5/sha256sum.txt +5 -0
  198. package/deps/jq/sig/v1.5rc1/jq-linux-x86_64-static.asc +17 -0
  199. package/deps/jq/sig/v1.5rc1/jq-win32.exe.asc +17 -0
  200. package/deps/jq/sig/v1.5rc1/jq-win64.exe.asc +17 -0
  201. package/deps/jq/sig/v1.5rc1/sha256sum.txt +3 -0
  202. package/deps/jq/sig/v1.5rc2/jq-linux-x86.asc +17 -0
  203. package/deps/jq/sig/v1.5rc2/jq-linux-x86_64.asc +17 -0
  204. package/deps/jq/sig/v1.5rc2/jq-osx-x86_64.asc +17 -0
  205. package/deps/jq/sig/v1.5rc2/jq-win32.exe.asc +17 -0
  206. package/deps/jq/sig/v1.5rc2/jq-win64.exe.asc +17 -0
  207. package/deps/jq/sig/v1.5rc2/sha256sum.txt +5 -0
  208. package/deps/jq/sig/v1.6/jq-linux32.asc +16 -0
  209. package/deps/jq/sig/v1.6/jq-linux64.asc +16 -0
  210. package/deps/jq/sig/v1.6/jq-osx-amd64.asc +16 -0
  211. package/deps/jq/sig/v1.6/jq-win32.exe.asc +16 -0
  212. package/deps/jq/sig/v1.6/jq-win64.exe.asc +16 -0
  213. package/deps/jq/sig/v1.6/sha256sum.txt +5 -0
  214. package/deps/jq/{builtin.c → src/builtin.c} +449 -344
  215. package/deps/jq/{builtin.h → src/builtin.h} +0 -0
  216. package/deps/jq/src/builtin.jq +311 -0
  217. package/deps/jq/{bytecode.c → src/bytecode.c} +0 -0
  218. package/deps/jq/{bytecode.h → src/bytecode.h} +0 -0
  219. package/deps/jq/{compile.c → src/compile.c} +213 -37
  220. package/deps/jq/{compile.h → src/compile.h} +7 -2
  221. package/deps/jq/{exec_stack.h → src/exec_stack.h} +0 -0
  222. package/deps/jq/{execute.c → src/execute.c} +127 -24
  223. package/deps/jq/{inject_errors.c → src/inject_errors.c} +0 -0
  224. package/deps/jq/{jq.h → src/jq.h} +13 -2
  225. package/deps/jq/{jq_parser.h → src/jq_parser.h} +0 -0
  226. package/deps/jq/{jq_test.c → src/jq_test.c} +1 -1
  227. package/deps/jq/{jv.c → src/jv.c} +24 -5
  228. package/deps/jq/{jv.h → src/jv.h} +46 -11
  229. package/deps/jq/{jv_alloc.c → src/jv_alloc.c} +0 -0
  230. package/deps/jq/{jv_alloc.h → src/jv_alloc.h} +0 -0
  231. package/deps/jq/{jv_aux.c → src/jv_aux.c} +38 -14
  232. package/deps/jq/{jv_dtoa.c → src/jv_dtoa.c} +4 -5
  233. package/deps/jq/{jv_dtoa.h → src/jv_dtoa.h} +0 -0
  234. package/deps/jq/src/jv_file.c +81 -0
  235. package/deps/jq/{jv_parse.c → src/jv_parse.c} +8 -2
  236. package/deps/jq/{jv_print.c → src/jv_print.c} +80 -27
  237. package/deps/jq/{jv_unicode.c → src/jv_unicode.c} +28 -4
  238. package/deps/jq/{jv_unicode.h → src/jv_unicode.h} +1 -0
  239. package/deps/jq/{jv_utf8_tables.h → src/jv_utf8_tables.h} +0 -0
  240. package/deps/jq/{lexer.c → src/lexer.c} +317 -292
  241. package/deps/jq/{lexer.h → src/lexer.h} +16 -12
  242. package/deps/jq/{lexer.l → src/lexer.l} +5 -4
  243. package/deps/jq/src/libm.h +291 -0
  244. package/deps/jq/{linker.c → src/linker.c} +5 -3
  245. package/deps/jq/{linker.h → src/linker.h} +0 -0
  246. package/deps/jq/{locfile.c → src/locfile.c} +1 -1
  247. package/deps/jq/{locfile.h → src/locfile.h} +0 -0
  248. package/deps/jq/{main.c → src/main.c} +202 -100
  249. package/deps/jq/{opcode_list.h → src/opcode_list.h} +4 -0
  250. package/deps/jq/{parser.c → src/parser.c} +1149 -1069
  251. package/deps/jq/{parser.h → src/parser.h} +28 -24
  252. package/deps/jq/{parser.y → src/parser.y} +108 -52
  253. package/deps/jq/{util.c → src/util.c} +12 -9
  254. package/deps/jq/{util.h → src/util.h} +0 -0
  255. package/deps/jq/tests/base64.test +35 -0
  256. package/deps/jq/tests/base64test +5 -0
  257. package/deps/jq/tests/jq-f-test.sh +4 -0
  258. package/deps/jq/tests/jq.test +305 -21
  259. package/deps/jq/tests/jqtest +1 -1
  260. package/deps/jq/tests/mantest +1 -1
  261. package/deps/jq/tests/onig.test +13 -0
  262. package/deps/jq/tests/onigtest +1 -1
  263. package/deps/jq/tests/optional.test +20 -0
  264. package/deps/jq/tests/optionaltest +5 -0
  265. package/deps/jq/tests/setup +7 -1
  266. package/deps/jq/tests/shtest +133 -29
  267. package/deps/jq/tests/utf8-truncate.jq +3 -0
  268. package/deps/jq/tests/utf8test +10 -0
  269. package/lib/index.js +7 -1
  270. package/package.json +3 -3
  271. package/test/santiy.test.js +24 -0
  272. package/deps/jq/docs/default_manpage.md +0 -22
  273. package/deps/jq/docs/public/bootstrap/css/bootstrap-responsive.css +0 -1058
  274. package/deps/jq/docs/public/bootstrap/css/bootstrap-responsive.min.css +0 -9
  275. package/deps/jq/docs/public/bootstrap/css/bootstrap.css +0 -5224
  276. package/deps/jq/docs/public/bootstrap/css/bootstrap.min.css +0 -9
  277. package/deps/jq/docs/public/bootstrap/img/glyphicons-halflings-white.png +0 -0
  278. package/deps/jq/docs/public/bootstrap/img/glyphicons-halflings.png +0 -0
  279. package/deps/jq/docs/public/bootstrap/js/bootstrap.js +0 -2027
  280. package/deps/jq/docs/public/bootstrap/js/bootstrap.min.js +0 -6
  281. package/deps/jq/docs/templates/shared/_header.liquid +0 -26
  282. package/deps/jq/jq.1.default +0 -39
  283. package/deps/jq/jv_file.c +0 -49
  284. package/deps/jq/libm.h +0 -160
  285. package/deps/jq/setup.sh +0 -33
  286. package/reports/jest-port-api.xml +0 -35
@@ -0,0 +1,253 @@
1
+ /**********************************************************************
2
+ koi8.c - Oniguruma (regular expression library)
3
+ **********************************************************************/
4
+ /*-
5
+ * Copyright (c) 2002-2016 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
6
+ * All rights reserved.
7
+ *
8
+ * Redistribution and use in source and binary forms, with or without
9
+ * modification, are permitted provided that the following conditions
10
+ * are met:
11
+ * 1. Redistributions of source code must retain the above copyright
12
+ * notice, this list of conditions and the following disclaimer.
13
+ * 2. Redistributions in binary form must reproduce the above copyright
14
+ * notice, this list of conditions and the following disclaimer in the
15
+ * documentation and/or other materials provided with the distribution.
16
+ *
17
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27
+ * SUCH DAMAGE.
28
+ */
29
+
30
+ #include "regenc.h"
31
+
32
+ #define ENC_KOI8_TO_LOWER_CASE(c) EncKOI8_ToLowerCaseTable[c]
33
+ #define ENC_IS_KOI8_CTYPE(code,ctype) \
34
+ ((EncKOI8_CtypeTable[code] & CTYPE_TO_BIT(ctype)) != 0)
35
+
36
+ static const UChar EncKOI8_ToLowerCaseTable[256] = {
37
+ '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007',
38
+ '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017',
39
+ '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027',
40
+ '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037',
41
+ '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047',
42
+ '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057',
43
+ '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067',
44
+ '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077',
45
+ '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
46
+ '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
47
+ '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
48
+ '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137',
49
+ '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
50
+ '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
51
+ '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
52
+ '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177',
53
+ '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207',
54
+ '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217',
55
+ '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227',
56
+ '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237',
57
+ '\240', '\241', '\242', '\243', '\244', '\245', '\246', '\247',
58
+ '\250', '\251', '\252', '\253', '\254', '\255', '\256', '\257',
59
+ '\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267',
60
+ '\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277',
61
+ '\300', '\301', '\302', '\303', '\304', '\305', '\306', '\307',
62
+ '\310', '\311', '\312', '\313', '\314', '\315', '\316', '\317',
63
+ '\320', '\321', '\322', '\323', '\324', '\325', '\326', '\327',
64
+ '\330', '\331', '\332', '\333', '\334', '\335', '\336', '\337',
65
+ '\300', '\301', '\302', '\303', '\304', '\305', '\306', '\307',
66
+ '\310', '\311', '\312', '\313', '\314', '\315', '\316', '\317',
67
+ '\320', '\321', '\322', '\323', '\324', '\325', '\326', '\327',
68
+ '\330', '\331', '\332', '\333', '\334', '\335', '\336', '\337'
69
+ };
70
+
71
+ static const unsigned short EncKOI8_CtypeTable[256] = {
72
+ 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008,
73
+ 0x4008, 0x420c, 0x4209, 0x4208, 0x4208, 0x4208, 0x4008, 0x4008,
74
+ 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008,
75
+ 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008,
76
+ 0x4284, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0,
77
+ 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0,
78
+ 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0,
79
+ 0x78b0, 0x78b0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0,
80
+ 0x41a0, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x74a2,
81
+ 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2,
82
+ 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2,
83
+ 0x74a2, 0x74a2, 0x74a2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x51a0,
84
+ 0x41a0, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x70e2,
85
+ 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2,
86
+ 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2,
87
+ 0x70e2, 0x70e2, 0x70e2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x4008,
88
+ 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008,
89
+ 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008,
90
+ 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008,
91
+ 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008,
92
+ 0x0284, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
93
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
94
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
95
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
96
+ 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2,
97
+ 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2,
98
+ 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2,
99
+ 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2,
100
+ 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2,
101
+ 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2,
102
+ 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2,
103
+ 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2
104
+ };
105
+
106
+
107
+ static int
108
+ koi8_mbc_case_fold(OnigCaseFoldType flag ARG_UNUSED,
109
+ const UChar** pp, const UChar* end ARG_UNUSED, UChar* lower)
110
+ {
111
+ const UChar* p = *pp;
112
+
113
+ *lower = ENC_KOI8_TO_LOWER_CASE(*p);
114
+ (*pp)++;
115
+ return 1;
116
+ }
117
+
118
+ #if 0
119
+ static int
120
+ koi8_is_mbc_ambiguous(OnigAmbigType flag, const OnigUChar** pp, const OnigUChar* end)
121
+ {
122
+ const OnigUChar* p = *pp;
123
+
124
+ (*pp)++;
125
+ if (((flag & ONIGENC_CASE_FOLD_ASCII_CASE) != 0 &&
126
+ ONIGENC_IS_MBC_ASCII(p)) ||
127
+ ((flag & ONIGENC_CASE_FOLD_NONASCII_CASE) != 0 &&
128
+ !ONIGENC_IS_MBC_ASCII(p))) {
129
+ int v = (EncKOI8_CtypeTable[*p] &
130
+ (BIT_CTYPE_UPPER | BIT_CTYPE_LOWER));
131
+ return (v != 0 ? TRUE : FALSE);
132
+ }
133
+ return FALSE;
134
+ }
135
+ #endif
136
+
137
+ static int
138
+ koi8_is_code_ctype(OnigCodePoint code, unsigned int ctype)
139
+ {
140
+ if (code < 256)
141
+ return ENC_IS_KOI8_CTYPE(code, ctype);
142
+ else
143
+ return FALSE;
144
+ }
145
+
146
+ static const OnigPairCaseFoldCodes CaseFoldMap[] = {
147
+ { 0xc0, 0xe0 },
148
+ { 0xc1, 0xe1 },
149
+ { 0xc2, 0xe2 },
150
+ { 0xc3, 0xe3 },
151
+ { 0xc4, 0xe4 },
152
+ { 0xc5, 0xe5 },
153
+ { 0xc6, 0xe6 },
154
+ { 0xc7, 0xe7 },
155
+ { 0xc8, 0xe8 },
156
+ { 0xc9, 0xe9 },
157
+ { 0xca, 0xea },
158
+ { 0xcb, 0xeb },
159
+ { 0xcc, 0xec },
160
+ { 0xcd, 0xed },
161
+ { 0xce, 0xee },
162
+ { 0xcf, 0xef },
163
+
164
+ { 0xd0, 0xf0 },
165
+ { 0xd1, 0xf1 },
166
+ { 0xd2, 0xf2 },
167
+ { 0xd3, 0xf3 },
168
+ { 0xd4, 0xf4 },
169
+ { 0xd5, 0xf5 },
170
+ { 0xd6, 0xf6 },
171
+ { 0xd7, 0xf7 },
172
+ { 0xd8, 0xf8 },
173
+ { 0xd9, 0xf9 },
174
+ { 0xda, 0xfa },
175
+ { 0xdb, 0xfb },
176
+ { 0xdc, 0xfc },
177
+ { 0xdd, 0xfd },
178
+ { 0xde, 0xfe },
179
+ { 0xdf, 0xff },
180
+
181
+ { 0xe0, 0xc0 },
182
+ { 0xe1, 0xc1 },
183
+ { 0xe2, 0xc2 },
184
+ { 0xe3, 0xc3 },
185
+ { 0xe4, 0xc4 },
186
+ { 0xe5, 0xc5 },
187
+ { 0xe6, 0xc6 },
188
+ { 0xe7, 0xc7 },
189
+ { 0xe8, 0xc8 },
190
+ { 0xe9, 0xc9 },
191
+ { 0xea, 0xca },
192
+ { 0xeb, 0xcb },
193
+ { 0xec, 0xcc },
194
+ { 0xed, 0xcd },
195
+ { 0xee, 0xce },
196
+ { 0xef, 0xcf },
197
+
198
+ { 0xf0, 0xd0 },
199
+ { 0xf1, 0xd1 },
200
+ { 0xf2, 0xd2 },
201
+ { 0xf3, 0xd3 },
202
+ { 0xf4, 0xd4 },
203
+ { 0xf5, 0xd5 },
204
+ { 0xf6, 0xd6 },
205
+ { 0xf7, 0xd7 },
206
+ { 0xf8, 0xd8 },
207
+ { 0xf9, 0xd9 },
208
+ { 0xfa, 0xda },
209
+ { 0xfb, 0xdb },
210
+ { 0xfc, 0xdc },
211
+ { 0xfe, 0xde },
212
+ { 0xff, 0xdf }
213
+ };
214
+
215
+ static int
216
+ koi8_apply_all_case_fold(OnigCaseFoldType flag,
217
+ OnigApplyAllCaseFoldFunc f, void* arg)
218
+ {
219
+ return onigenc_apply_all_case_fold_with_map(
220
+ sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 0,
221
+ flag, f, arg);
222
+ }
223
+
224
+ static int
225
+ koi8_get_case_fold_codes_by_str(OnigCaseFoldType flag,
226
+ const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[])
227
+ {
228
+ return onigenc_get_case_fold_codes_by_str_with_map(
229
+ sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 0,
230
+ flag, p, end, items);
231
+ }
232
+
233
+ OnigEncodingType OnigEncodingKOI8 = {
234
+ onigenc_single_byte_mbc_enc_len,
235
+ "KOI8", /* name */
236
+ 1, /* max enc length */
237
+ 1, /* min enc length */
238
+ onigenc_is_mbc_newline_0x0a,
239
+ onigenc_single_byte_mbc_to_code,
240
+ onigenc_single_byte_code_to_mbclen,
241
+ onigenc_single_byte_code_to_mbc,
242
+ koi8_mbc_case_fold,
243
+ koi8_apply_all_case_fold,
244
+ koi8_get_case_fold_codes_by_str,
245
+ onigenc_minimum_property_name_to_ctype,
246
+ koi8_is_code_ctype,
247
+ onigenc_not_support_get_ctype_code_range,
248
+ onigenc_single_byte_left_adjust_char_head,
249
+ onigenc_always_true_is_allowed_reverse_match,
250
+ NULL, /* init */
251
+ NULL, /* is_initialized */
252
+ onigenc_always_true_is_valid_mbc_string
253
+ };
@@ -0,0 +1,215 @@
1
+ /**********************************************************************
2
+ koi8_r.c - Oniguruma (regular expression library)
3
+ **********************************************************************/
4
+ /*-
5
+ * Copyright (c) 2002-2016 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
6
+ * All rights reserved.
7
+ *
8
+ * Redistribution and use in source and binary forms, with or without
9
+ * modification, are permitted provided that the following conditions
10
+ * are met:
11
+ * 1. Redistributions of source code must retain the above copyright
12
+ * notice, this list of conditions and the following disclaimer.
13
+ * 2. Redistributions in binary form must reproduce the above copyright
14
+ * notice, this list of conditions and the following disclaimer in the
15
+ * documentation and/or other materials provided with the distribution.
16
+ *
17
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27
+ * SUCH DAMAGE.
28
+ */
29
+
30
+ #include "regenc.h"
31
+
32
+ #define ENC_KOI8_R_TO_LOWER_CASE(c) EncKOI8_R_ToLowerCaseTable[c]
33
+ #define ENC_IS_KOI8_R_CTYPE(code,ctype) \
34
+ ((EncKOI8_R_CtypeTable[code] & CTYPE_TO_BIT(ctype)) != 0)
35
+
36
+ static const UChar EncKOI8_R_ToLowerCaseTable[256] = {
37
+ '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007',
38
+ '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017',
39
+ '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027',
40
+ '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037',
41
+ '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047',
42
+ '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057',
43
+ '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067',
44
+ '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077',
45
+ '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
46
+ '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
47
+ '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
48
+ '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137',
49
+ '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
50
+ '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
51
+ '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
52
+ '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177',
53
+ '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207',
54
+ '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217',
55
+ '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227',
56
+ '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237',
57
+ '\240', '\241', '\242', '\243', '\244', '\245', '\246', '\247',
58
+ '\250', '\251', '\252', '\253', '\254', '\255', '\256', '\257',
59
+ '\260', '\261', '\262', '\243', '\264', '\265', '\266', '\267',
60
+ '\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277',
61
+ '\300', '\301', '\302', '\303', '\304', '\305', '\306', '\307',
62
+ '\310', '\311', '\312', '\313', '\314', '\315', '\316', '\317',
63
+ '\320', '\321', '\322', '\323', '\324', '\325', '\326', '\327',
64
+ '\330', '\331', '\332', '\333', '\334', '\335', '\336', '\337',
65
+ '\300', '\301', '\302', '\303', '\304', '\305', '\306', '\307',
66
+ '\310', '\311', '\312', '\313', '\314', '\315', '\316', '\317',
67
+ '\320', '\321', '\322', '\323', '\324', '\325', '\326', '\327',
68
+ '\330', '\331', '\332', '\333', '\334', '\335', '\336', '\337'
69
+ };
70
+
71
+ static const unsigned short EncKOI8_R_CtypeTable[256] = {
72
+ 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008,
73
+ 0x4008, 0x420c, 0x4209, 0x4208, 0x4208, 0x4208, 0x4008, 0x4008,
74
+ 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008,
75
+ 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008,
76
+ 0x4284, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0,
77
+ 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0,
78
+ 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0,
79
+ 0x78b0, 0x78b0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0,
80
+ 0x41a0, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x74a2,
81
+ 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2,
82
+ 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2,
83
+ 0x74a2, 0x74a2, 0x74a2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x51a0,
84
+ 0x41a0, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x70e2,
85
+ 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2,
86
+ 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2,
87
+ 0x70e2, 0x70e2, 0x70e2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x4008,
88
+ 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0,
89
+ 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0,
90
+ 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0,
91
+ 0x00a0, 0x00a0, 0x0284, 0x00a0, 0x00a0, 0x10a0, 0x01a0, 0x00a0,
92
+ 0x00a0, 0x00a0, 0x00a0, 0x30e2, 0x00a0, 0x00a0, 0x00a0, 0x00a0,
93
+ 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0,
94
+ 0x00a0, 0x00a0, 0x00a0, 0x34a2, 0x00a0, 0x00a0, 0x00a0, 0x00a0,
95
+ 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0,
96
+ 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2,
97
+ 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2,
98
+ 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2,
99
+ 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2,
100
+ 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2,
101
+ 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2,
102
+ 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2,
103
+ 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2
104
+ };
105
+
106
+ static int
107
+ koi8_r_mbc_case_fold(OnigCaseFoldType flag ARG_UNUSED,
108
+ const UChar** pp, const UChar* end ARG_UNUSED, UChar* lower)
109
+ {
110
+ const UChar* p = *pp;
111
+
112
+ *lower = ENC_KOI8_R_TO_LOWER_CASE(*p);
113
+ (*pp)++;
114
+ return 1;
115
+ }
116
+
117
+ #if 0
118
+ static int
119
+ koi8_r_is_mbc_ambiguous(OnigCaseFoldType flag, const UChar** pp, const UChar* end)
120
+ {
121
+ int v;
122
+ const UChar* p = *pp;
123
+
124
+ (*pp)++;
125
+ v = (EncKOI8_R_CtypeTable[*p] & (BIT_CTYPE_UPPER | BIT_CTYPE_LOWER));
126
+ return (v != 0 ? TRUE : FALSE);
127
+ }
128
+ #endif
129
+
130
+ static int
131
+ koi8_r_is_code_ctype(OnigCodePoint code, unsigned int ctype)
132
+ {
133
+ if (code < 256)
134
+ return ENC_IS_KOI8_R_CTYPE(code, ctype);
135
+ else
136
+ return FALSE;
137
+ }
138
+
139
+ static const OnigPairCaseFoldCodes CaseFoldMap[] = {
140
+ { 0xa3, 0xb3 },
141
+
142
+ { 0xc0, 0xe0 },
143
+ { 0xc1, 0xe1 },
144
+ { 0xc2, 0xe2 },
145
+ { 0xc3, 0xe3 },
146
+ { 0xc4, 0xe4 },
147
+ { 0xc5, 0xe5 },
148
+ { 0xc6, 0xe6 },
149
+ { 0xc7, 0xe7 },
150
+ { 0xc8, 0xe8 },
151
+ { 0xc9, 0xe9 },
152
+ { 0xca, 0xea },
153
+ { 0xcb, 0xeb },
154
+ { 0xcc, 0xec },
155
+ { 0xcd, 0xed },
156
+ { 0xce, 0xee },
157
+ { 0xcf, 0xef },
158
+
159
+ { 0xd0, 0xf0 },
160
+ { 0xd1, 0xf1 },
161
+ { 0xd2, 0xf2 },
162
+ { 0xd3, 0xf3 },
163
+ { 0xd4, 0xf4 },
164
+ { 0xd5, 0xf5 },
165
+ { 0xd6, 0xf6 },
166
+ { 0xd7, 0xf7 },
167
+ { 0xd8, 0xf8 },
168
+ { 0xd9, 0xf9 },
169
+ { 0xda, 0xfa },
170
+ { 0xdb, 0xfb },
171
+ { 0xdc, 0xfc },
172
+ { 0xdd, 0xfd },
173
+ { 0xde, 0xfe },
174
+ { 0xdf, 0xff }
175
+ };
176
+
177
+ static int
178
+ koi8_r_apply_all_case_fold(OnigCaseFoldType flag,
179
+ OnigApplyAllCaseFoldFunc f, void* arg)
180
+ {
181
+ return onigenc_apply_all_case_fold_with_map(
182
+ sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 0,
183
+ flag, f, arg);
184
+ }
185
+
186
+ static int
187
+ koi8_r_get_case_fold_codes_by_str(OnigCaseFoldType flag,
188
+ const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[])
189
+ {
190
+ return onigenc_get_case_fold_codes_by_str_with_map(
191
+ sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 0,
192
+ flag, p, end, items);
193
+ }
194
+
195
+ OnigEncodingType OnigEncodingKOI8_R = {
196
+ onigenc_single_byte_mbc_enc_len,
197
+ "KOI8-R", /* name */
198
+ 1, /* max enc length */
199
+ 1, /* min enc length */
200
+ onigenc_is_mbc_newline_0x0a,
201
+ onigenc_single_byte_mbc_to_code,
202
+ onigenc_single_byte_code_to_mbclen,
203
+ onigenc_single_byte_code_to_mbc,
204
+ koi8_r_mbc_case_fold,
205
+ koi8_r_apply_all_case_fold,
206
+ koi8_r_get_case_fold_codes_by_str,
207
+ onigenc_minimum_property_name_to_ctype,
208
+ koi8_r_is_code_ctype,
209
+ onigenc_not_support_get_ctype_code_range,
210
+ onigenc_single_byte_left_adjust_char_head,
211
+ onigenc_always_true_is_allowed_reverse_match,
212
+ NULL, /* init */
213
+ NULL, /* is_initialized */
214
+ onigenc_always_true_is_valid_mbc_string
215
+ };
@@ -0,0 +1,22 @@
1
+ #!/bin/sh
2
+
3
+ TMP=gperf.tmp
4
+ GPERF_OPT='-n -C -T -c -t -j1 -L ANSI-C '
5
+
6
+ ./make_unicode_fold_data.py > unicode_fold_data.c
7
+
8
+ gperf ${GPERF_OPT} -F,-1,0 -N unicode_unfold_key unicode_unfold_key.gperf > ${TMP}
9
+ ./gperf_unfold_key_conv.py < ${TMP} > unicode_unfold_key.c
10
+
11
+ gperf ${GPERF_OPT} -F,-1 -N unicode_fold1_key unicode_fold1_key.gperf > ${TMP}
12
+ ./gperf_fold_key_conv.py 1 < ${TMP} > unicode_fold1_key.c
13
+
14
+ gperf ${GPERF_OPT} -F,-1 -N unicode_fold2_key unicode_fold2_key.gperf > ${TMP}
15
+ ./gperf_fold_key_conv.py 2 < ${TMP} > unicode_fold2_key.c
16
+
17
+ gperf ${GPERF_OPT} -F,-1 -N unicode_fold3_key unicode_fold3_key.gperf > ${TMP}
18
+ ./gperf_fold_key_conv.py 3 < ${TMP} > unicode_fold3_key.c
19
+
20
+ rm -f ${TMP}
21
+
22
+ exit 0