webruby 0.2.7 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (1537) hide show
  1. checksums.yaml +4 -4
  2. data/lib/webruby/environment.rb +24 -8
  3. data/lib/webruby/rake/files.rake +6 -22
  4. data/lib/webruby/rake/general.rake +1 -1
  5. data/lib/webruby/rake/mruby.rake +1 -0
  6. data/lib/webruby/utility.rb +14 -0
  7. data/modules/mruby/AUTHORS +14 -0
  8. data/modules/mruby/CONTRIBUTING.md +7 -4
  9. data/modules/mruby/INSTALL +28 -11
  10. data/modules/mruby/MITL +13 -13
  11. data/modules/mruby/Makefile +4 -5
  12. data/modules/mruby/README.md +54 -49
  13. data/modules/mruby/Rakefile +36 -6
  14. data/modules/mruby/benchmark/ao-render.rb +1 -2
  15. data/modules/mruby/benchmark/bm_app_lc_fizzbuzz.rb +52 -0
  16. data/modules/mruby/benchmark/fib39.rb +0 -0
  17. data/modules/mruby/bintest/mrbc.rb +12 -0
  18. data/modules/mruby/build_config.rb +32 -2
  19. data/modules/mruby/doc/api/README.md +30 -0
  20. data/modules/mruby/doc/api/mruby.h.md +69 -0
  21. data/modules/mruby/doc/compile/README.md +208 -99
  22. data/modules/mruby/doc/debugger/README.md +370 -0
  23. data/modules/mruby/doc/language/Core.md +1590 -0
  24. data/modules/mruby/doc/language/README.md +9 -0
  25. data/modules/mruby/doc/language/generator.rb +15 -0
  26. data/modules/mruby/doc/language/mrbdoc/lib/mrbdoc_analyze.rb +231 -0
  27. data/modules/mruby/doc/language/mrbdoc/lib/mrbdoc_docu.rb +118 -0
  28. data/modules/mruby/doc/language/mrbdoc/mrbdoc.rb +38 -0
  29. data/modules/mruby/doc/mrbconf/README.md +160 -0
  30. data/modules/mruby/doc/mrbgems/README.md +136 -66
  31. data/modules/mruby/examples/mrbgems/c_and_ruby_extension_example/mrbgem.rake +1 -1
  32. data/modules/mruby/examples/mrbgems/c_and_ruby_extension_example/src/example.c +1 -1
  33. data/modules/mruby/examples/mrbgems/c_extension_example/mrbgem.rake +1 -1
  34. data/modules/mruby/examples/mrbgems/c_extension_example/src/example.c +1 -1
  35. data/modules/mruby/examples/mrbgems/ruby_extension_example/mrbgem.rake +1 -1
  36. data/modules/mruby/examples/targets/{ArduinoDue.rb → build_config_ArduinoDue.rb} +32 -6
  37. data/modules/mruby/examples/targets/build_config_IntelGalileo.rb +106 -0
  38. data/modules/mruby/examples/targets/{chipKitMax32.rb → build_config_chipKITMax32.rb} +26 -7
  39. data/modules/mruby/include/mrbconf.h +25 -1
  40. data/modules/mruby/include/mruby/array.h +32 -22
  41. data/modules/mruby/include/mruby/boxing_nan.h +94 -0
  42. data/modules/mruby/include/mruby/boxing_no.h +49 -0
  43. data/modules/mruby/include/mruby/boxing_word.h +119 -0
  44. data/modules/mruby/include/mruby/class.h +15 -13
  45. data/modules/mruby/include/mruby/compile.h +43 -36
  46. data/modules/mruby/include/mruby/data.h +13 -5
  47. data/modules/mruby/include/mruby/debug.h +9 -9
  48. data/modules/mruby/include/mruby/dump.h +32 -23
  49. data/modules/mruby/include/mruby/error.h +36 -0
  50. data/modules/mruby/include/mruby/gc.h +11 -6
  51. data/modules/mruby/include/mruby/hash.h +12 -12
  52. data/modules/mruby/include/mruby/irep.h +9 -3
  53. data/modules/mruby/include/mruby/khash.h +58 -41
  54. data/modules/mruby/include/mruby/numeric.h +38 -4
  55. data/modules/mruby/include/mruby/object.h +55 -0
  56. data/modules/mruby/include/mruby/opcode.h +160 -0
  57. data/modules/mruby/include/mruby/proc.h +19 -5
  58. data/modules/mruby/include/mruby/range.h +4 -3
  59. data/modules/mruby/include/mruby/re.h +20 -0
  60. data/modules/mruby/include/mruby/string.h +86 -47
  61. data/modules/mruby/include/mruby/value.h +100 -374
  62. data/modules/mruby/include/mruby/variable.h +34 -32
  63. data/modules/mruby/include/mruby/version.h +40 -0
  64. data/modules/mruby/include/mruby.h +211 -139
  65. data/modules/mruby/minirake +16 -9
  66. data/modules/mruby/mrbgems/default.gembox +12 -0
  67. data/modules/mruby/mrbgems/full-core.gembox +3 -3
  68. data/modules/mruby/mrbgems/mruby-array-ext/mrbgem.rake +1 -0
  69. data/modules/mruby/mrbgems/mruby-array-ext/mrblib/array.rb +488 -8
  70. data/modules/mruby/mrbgems/mruby-array-ext/src/array.c +57 -31
  71. data/modules/mruby/mrbgems/mruby-array-ext/test/array.rb +231 -45
  72. data/modules/mruby/mrbgems/mruby-bin-debugger/bintest/mrdb.rb +286 -0
  73. data/modules/mruby/mrbgems/mruby-bin-debugger/bintest/print.rb +701 -0
  74. data/modules/mruby/mrbgems/mruby-bin-debugger/mrbgem.rake +9 -0
  75. data/modules/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.c +516 -0
  76. data/modules/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.h +26 -0
  77. data/modules/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/apilist.c +235 -0
  78. data/modules/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/apilist.h +14 -0
  79. data/modules/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/apiprint.c +78 -0
  80. data/modules/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/apiprint.h +13 -0
  81. data/modules/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/cmdbreak.c +428 -0
  82. data/modules/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/cmdmisc.c +501 -0
  83. data/modules/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/cmdprint.c +58 -0
  84. data/modules/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/cmdrun.c +54 -0
  85. data/modules/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.c +746 -0
  86. data/modules/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.h +163 -0
  87. data/modules/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/mrdbconf.h +16 -0
  88. data/modules/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/mrdberror.h +20 -0
  89. data/modules/mruby/mrbgems/mruby-bin-mirb/bintest/mirb.rb +12 -0
  90. data/modules/mruby/mrbgems/mruby-bin-mirb/mrbgem.rake +14 -1
  91. data/modules/mruby/mrbgems/mruby-bin-mirb/tools/mirb/mirb.c +154 -72
  92. data/modules/mruby/mrbgems/mruby-bin-mruby/bintest/mruby.rb +46 -0
  93. data/modules/mruby/mrbgems/mruby-bin-mruby/mrbgem.rake +1 -0
  94. data/modules/mruby/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c +37 -28
  95. data/modules/mruby/mrbgems/mruby-bin-mruby-config/mrbgem.rake +30 -0
  96. data/modules/mruby/mrbgems/mruby-bin-mruby-config/mruby-config +16 -0
  97. data/modules/mruby/mrbgems/mruby-bin-mruby-config/mruby-config.bat +30 -0
  98. data/modules/mruby/mrbgems/mruby-bin-strip/bintest/mruby-strip.rb +73 -0
  99. data/modules/mruby/mrbgems/mruby-bin-strip/mrbgem.rake +6 -0
  100. data/modules/mruby/mrbgems/mruby-bin-strip/tools/mruby-strip/mruby-strip.c +155 -0
  101. data/modules/mruby/mrbgems/mruby-enum-ext/mrbgem.rake +1 -0
  102. data/modules/mruby/mrbgems/mruby-enum-ext/mrblib/enum.rb +555 -21
  103. data/modules/mruby/mrbgems/mruby-enum-ext/test/enum.rb +119 -0
  104. data/modules/mruby/mrbgems/mruby-enum-lazy/mrbgem.rake +7 -0
  105. data/modules/mruby/mrbgems/mruby-enum-lazy/mrblib/lazy.rb +150 -0
  106. data/modules/mruby/mrbgems/mruby-enum-lazy/test/lazy.rb +47 -0
  107. data/modules/mruby/mrbgems/mruby-enumerator/mrbgem.rake +7 -0
  108. data/modules/mruby/mrbgems/mruby-enumerator/mrblib/enumerator.rb +636 -0
  109. data/modules/mruby/mrbgems/mruby-enumerator/test/enumerator.rb +537 -0
  110. data/modules/mruby/mrbgems/mruby-eval/mrbgem.rake +1 -0
  111. data/modules/mruby/mrbgems/mruby-eval/src/eval.c +243 -4
  112. data/modules/mruby/mrbgems/mruby-eval/test/eval.rb +80 -0
  113. data/modules/mruby/mrbgems/mruby-exit/mrbgem.rake +1 -0
  114. data/modules/mruby/mrbgems/mruby-exit/src/mruby-exit.c +1 -1
  115. data/modules/mruby/mrbgems/mruby-fiber/mrbgem.rake +1 -0
  116. data/modules/mruby/mrbgems/mruby-fiber/src/fiber.c +157 -51
  117. data/modules/mruby/mrbgems/mruby-fiber/test/fiber.rb +179 -35
  118. data/modules/mruby/mrbgems/mruby-hash-ext/mrbgem.rake +3 -0
  119. data/modules/mruby/mrbgems/mruby-hash-ext/mrblib/hash.rb +241 -1
  120. data/modules/mruby/mrbgems/mruby-hash-ext/src/hash-ext.c +11 -19
  121. data/modules/mruby/mrbgems/mruby-hash-ext/test/hash.rb +138 -1
  122. data/modules/mruby/mrbgems/mruby-kernel-ext/mrbgem.rake +5 -0
  123. data/modules/mruby/mrbgems/mruby-kernel-ext/src/kernel.c +183 -0
  124. data/modules/mruby/mrbgems/mruby-kernel-ext/test/kernel.rb +53 -0
  125. data/modules/mruby/mrbgems/mruby-math/mrbgem.rake +1 -0
  126. data/modules/mruby/mrbgems/mruby-math/src/math.c +107 -14
  127. data/modules/mruby/mrbgems/mruby-math/test/math.rb +16 -0
  128. data/modules/mruby/mrbgems/mruby-numeric-ext/mrbgem.rake +1 -0
  129. data/modules/mruby/mrbgems/mruby-numeric-ext/mrblib/numeric_ext.rb +5 -0
  130. data/modules/mruby/mrbgems/mruby-numeric-ext/test/numeric.rb +9 -1
  131. data/modules/mruby/mrbgems/mruby-object-ext/mrbgem.rake +1 -0
  132. data/modules/mruby/mrbgems/mruby-object-ext/mrblib/object.rb +19 -0
  133. data/modules/mruby/mrbgems/mruby-object-ext/src/object.c +5 -8
  134. data/modules/mruby/mrbgems/mruby-object-ext/test/object.rb +16 -0
  135. data/modules/mruby/mrbgems/mruby-objectspace/mrbgem.rake +1 -0
  136. data/modules/mruby/mrbgems/mruby-objectspace/src/mruby_objectspace.c +121 -53
  137. data/modules/mruby/mrbgems/mruby-objectspace/test/objectspace.rb +27 -4
  138. data/modules/mruby/mrbgems/mruby-print/mrbgem.rake +1 -0
  139. data/modules/mruby/mrbgems/mruby-print/src/print.c +3 -5
  140. data/modules/mruby/mrbgems/mruby-proc-ext/mrbgem.rake +1 -0
  141. data/modules/mruby/mrbgems/mruby-proc-ext/src/proc.c +89 -19
  142. data/modules/mruby/mrbgems/mruby-proc-ext/test/proc.c +56 -0
  143. data/modules/mruby/mrbgems/mruby-proc-ext/test/proc.rb +47 -0
  144. data/modules/mruby/mrbgems/mruby-random/mrbgem.rake +1 -0
  145. data/modules/mruby/mrbgems/mruby-random/src/mt19937ar.c +30 -25
  146. data/modules/mruby/mrbgems/mruby-random/src/mt19937ar.h +6 -3
  147. data/modules/mruby/mrbgems/mruby-random/src/random.c +157 -137
  148. data/modules/mruby/mrbgems/mruby-random/src/random.h +3 -3
  149. data/modules/mruby/mrbgems/mruby-random/test/random.rb +9 -9
  150. data/modules/mruby/mrbgems/mruby-range-ext/mrbgem.rake +1 -0
  151. data/modules/mruby/mrbgems/mruby-range-ext/src/range.c +57 -3
  152. data/modules/mruby/mrbgems/mruby-range-ext/test/range.rb +9 -0
  153. data/modules/mruby/mrbgems/mruby-sprintf/mrbgem.rake +1 -0
  154. data/modules/mruby/mrbgems/mruby-sprintf/mrblib/string.rb +9 -0
  155. data/modules/mruby/mrbgems/mruby-sprintf/src/sprintf.c +29 -23
  156. data/modules/mruby/mrbgems/mruby-sprintf/test/sprintf.rb +7 -2
  157. data/modules/mruby/mrbgems/mruby-string-ext/mrbgem.rake +1 -0
  158. data/modules/mruby/mrbgems/mruby-string-ext/mrblib/string.rb +250 -11
  159. data/modules/mruby/mrbgems/mruby-string-ext/src/string.c +220 -5
  160. data/modules/mruby/mrbgems/mruby-string-ext/test/string.rb +326 -4
  161. data/modules/mruby/mrbgems/mruby-string-utf8/mrbgem.rake +2 -0
  162. data/modules/mruby/mrbgems/mruby-string-utf8/src/string.c +486 -52
  163. data/modules/mruby/mrbgems/mruby-string-utf8/test/string.rb +97 -14
  164. data/modules/mruby/mrbgems/mruby-struct/mrbgem.rake +1 -0
  165. data/modules/mruby/mrbgems/mruby-struct/mrblib/struct.rb +31 -0
  166. data/modules/mruby/mrbgems/mruby-struct/src/struct.c +178 -196
  167. data/modules/mruby/mrbgems/mruby-struct/test/struct.rb +115 -61
  168. data/modules/mruby/mrbgems/mruby-symbol-ext/mrbgem.rake +1 -0
  169. data/modules/mruby/mrbgems/mruby-symbol-ext/mrblib/symbol.rb +22 -17
  170. data/modules/mruby/mrbgems/mruby-symbol-ext/src/symbol.c +20 -11
  171. data/modules/mruby/mrbgems/mruby-symbol-ext/test/symbol.rb +14 -0
  172. data/modules/mruby/mrbgems/mruby-time/mrbgem.rake +1 -0
  173. data/modules/mruby/mrbgems/mruby-time/mrblib/time.rb +9 -0
  174. data/modules/mruby/mrbgems/mruby-time/src/time.c +98 -37
  175. data/modules/mruby/mrbgems/mruby-time/test/time.rb +152 -148
  176. data/modules/mruby/mrbgems/mruby-toplevel-ext/mrbgem.rake +1 -0
  177. data/modules/mruby/mrbgems/mruby-toplevel-ext/test/toplevel.rb +1 -1
  178. data/modules/mruby/mrblib/array.rb +110 -4
  179. data/modules/mruby/mrblib/class.rb +1 -22
  180. data/modules/mruby/mrblib/compar.rb +10 -30
  181. data/modules/mruby/mrblib/enum.rb +64 -52
  182. data/modules/mruby/mrblib/error.rb +9 -4
  183. data/modules/mruby/mrblib/hash.rb +164 -23
  184. data/modules/mruby/mrblib/kernel.rb +26 -22
  185. data/modules/mruby/mrblib/mrblib.rake +4 -4
  186. data/modules/mruby/mrblib/numeric.rb +22 -9
  187. data/modules/mruby/mrblib/range.rb +24 -2
  188. data/modules/mruby/mrblib/string.rb +15 -3
  189. data/modules/mruby/src/array.c +279 -339
  190. data/modules/mruby/src/backtrace.c +68 -16
  191. data/modules/mruby/src/class.c +539 -379
  192. data/modules/mruby/src/codegen.c +424 -207
  193. data/modules/mruby/src/compar.c +1 -1
  194. data/modules/mruby/src/crc.c +7 -6
  195. data/modules/mruby/src/debug.c +37 -36
  196. data/modules/mruby/src/dump.c +463 -213
  197. data/modules/mruby/src/enum.c +1 -1
  198. data/modules/mruby/src/error.c +91 -92
  199. data/modules/mruby/src/error.h +3 -19
  200. data/modules/mruby/src/etc.c +85 -82
  201. data/modules/mruby/src/gc.c +134 -108
  202. data/modules/mruby/src/hash.c +161 -565
  203. data/modules/mruby/src/init.c +2 -13
  204. data/modules/mruby/src/kernel.c +217 -251
  205. data/modules/mruby/src/load.c +280 -283
  206. data/modules/mruby/src/mrb_throw.h +41 -0
  207. data/modules/mruby/src/mruby_core.rake +57 -7
  208. data/modules/mruby/src/node.h +104 -104
  209. data/modules/mruby/src/numeric.c +221 -208
  210. data/modules/mruby/src/object.c +41 -42
  211. data/modules/mruby/src/opcode.h +2 -160
  212. data/modules/mruby/src/parse.y +3430 -3223
  213. data/modules/mruby/src/pool.c +13 -9
  214. data/modules/mruby/src/print.c +20 -17
  215. data/modules/mruby/src/proc.c +77 -21
  216. data/modules/mruby/src/range.c +55 -45
  217. data/modules/mruby/src/state.c +95 -31
  218. data/modules/mruby/src/string.c +462 -468
  219. data/modules/mruby/src/symbol.c +95 -85
  220. data/modules/mruby/src/variable.c +104 -74
  221. data/modules/mruby/src/version.c +13 -0
  222. data/modules/mruby/src/vm.c +528 -296
  223. data/modules/mruby/tasks/libmruby.rake +9 -5
  224. data/modules/mruby/tasks/mrbgem_spec.rake +130 -26
  225. data/modules/mruby/tasks/mrbgems.rake +21 -11
  226. data/modules/mruby/tasks/mrbgems_test.rake +46 -40
  227. data/modules/mruby/tasks/mruby_build.rake +54 -12
  228. data/modules/mruby/tasks/mruby_build_commands.rake +34 -5
  229. data/modules/mruby/tasks/mruby_build_gem.rake +25 -3
  230. data/modules/mruby/tasks/ruby_ext.rake +11 -2
  231. data/modules/mruby/tasks/toolchains/clang.rake +2 -1
  232. data/modules/mruby/tasks/toolchains/gcc.rake +26 -3
  233. data/modules/mruby/tasks/toolchains/visualcpp.rake +17 -8
  234. data/modules/mruby/test/assert.rb +30 -8
  235. data/modules/mruby/test/bintest.rb +10 -0
  236. data/modules/mruby/test/driver.c +74 -24
  237. data/modules/mruby/test/init_mrbtest.c +21 -2
  238. data/modules/mruby/test/mrbtest.rake +27 -5
  239. data/modules/mruby/test/t/argumenterror.rb +0 -5
  240. data/modules/mruby/test/t/array.rb +23 -7
  241. data/modules/mruby/test/t/bs_block.rb +32 -0
  242. data/modules/mruby/test/t/class.rb +29 -5
  243. data/modules/mruby/test/t/comparable.rb +20 -12
  244. data/modules/mruby/test/t/enumerable.rb +33 -7
  245. data/modules/mruby/test/t/exception.rb +63 -38
  246. data/modules/mruby/test/t/false.rb +2 -4
  247. data/modules/mruby/test/t/float.rb +39 -4
  248. data/modules/mruby/test/t/hash.rb +40 -6
  249. data/modules/mruby/test/t/indexerror.rb +0 -4
  250. data/modules/mruby/test/t/integer.rb +41 -5
  251. data/modules/mruby/test/t/kernel.rb +90 -3
  252. data/modules/mruby/test/t/localjumperror.rb +4 -4
  253. data/modules/mruby/test/t/methods.rb +1 -1
  254. data/modules/mruby/test/t/module.rb +43 -13
  255. data/modules/mruby/test/t/nameerror.rb +0 -4
  256. data/modules/mruby/test/t/nil.rb +5 -0
  257. data/modules/mruby/test/t/nomethoderror.rb +11 -2
  258. data/modules/mruby/test/t/numeric.rb +18 -4
  259. data/modules/mruby/test/t/proc.rb +59 -6
  260. data/modules/mruby/test/t/range.rb +15 -5
  261. data/modules/mruby/test/t/rangeerror.rb +0 -4
  262. data/modules/mruby/test/t/standarderror.rb +0 -4
  263. data/modules/mruby/test/t/string.rb +56 -12
  264. data/modules/mruby/test/t/superclass.rb +46 -0
  265. data/modules/mruby/test/t/symbol.rb +0 -4
  266. data/modules/mruby/test/t/syntax.rb +134 -1
  267. data/modules/mruby/test/t/true.rb +2 -4
  268. data/modules/mruby/test/t/typeerror.rb +0 -5
  269. data/modules/mruby/test/t/unicode.rb +35 -0
  270. data/modules/mruby/tools/mrbc/mrbc.c +9 -12
  271. data/modules/mruby/travis_config.rb +22 -2
  272. metadata +98 -1299
  273. data/modules/emscripten/AUTHORS +0 -117
  274. data/modules/emscripten/CONTRIBUTING.markdown +0 -5
  275. data/modules/emscripten/ChangeLog +0 -468
  276. data/modules/emscripten/LICENSE +0 -94
  277. data/modules/emscripten/README.markdown +0 -14
  278. data/modules/emscripten/cmake/Modules/FindOpenAL.cmake +0 -26
  279. data/modules/emscripten/cmake/Platform/Emscripten.cmake +0 -228
  280. data/modules/emscripten/em++ +0 -12
  281. data/modules/emscripten/em++.bat +0 -2
  282. data/modules/emscripten/em-config +0 -24
  283. data/modules/emscripten/em-config.bat +0 -2
  284. data/modules/emscripten/emar +0 -24
  285. data/modules/emscripten/emar.bat +0 -2
  286. data/modules/emscripten/emcc +0 -2069
  287. data/modules/emscripten/emcc.bat +0 -2
  288. data/modules/emscripten/emcc.py +0 -5
  289. data/modules/emscripten/emconfigure +0 -27
  290. data/modules/emscripten/emconfigure.bat +0 -2
  291. data/modules/emscripten/emlink.py +0 -33
  292. data/modules/emscripten/emmake +0 -29
  293. data/modules/emscripten/emmake.bat +0 -2
  294. data/modules/emscripten/emranlib +0 -9
  295. data/modules/emscripten/emranlib.bat +0 -2
  296. data/modules/emscripten/emrun +0 -1087
  297. data/modules/emscripten/emrun.bat +0 -2
  298. data/modules/emscripten/emscons +0 -20
  299. data/modules/emscripten/emscripten.py +0 -1347
  300. data/modules/emscripten/package.json +0 -7
  301. data/modules/emscripten/patches/README +0 -4
  302. data/modules/emscripten/patches/series +0 -2
  303. data/modules/emscripten/scons-tools/closure.py +0 -28
  304. data/modules/emscripten/scons-tools/emscripten.py +0 -364
  305. data/modules/emscripten/scons-tools/llvm.py +0 -34
  306. data/modules/emscripten/src/analyzer.js +0 -1781
  307. data/modules/emscripten/src/closure-externs.js +0 -110
  308. data/modules/emscripten/src/compiler.html +0 -48
  309. data/modules/emscripten/src/compiler.js +0 -331
  310. data/modules/emscripten/src/compiler_phase.html +0 -33
  311. data/modules/emscripten/src/corruptionCheck.js +0 -98
  312. data/modules/emscripten/src/determinstic.js +0 -20
  313. data/modules/emscripten/src/embind/embind.js +0 -1677
  314. data/modules/emscripten/src/embind/emval.js +0 -284
  315. data/modules/emscripten/src/emrun_postjs.js +0 -20
  316. data/modules/emscripten/src/emrun_prejs.js +0 -5
  317. data/modules/emscripten/src/emscripten-source-map.min.js +0 -31
  318. data/modules/emscripten/src/experimental/allow_loopvars_from_memsetcpy_inasm.diff +0 -97
  319. data/modules/emscripten/src/experimental/batching.diff +0 -44
  320. data/modules/emscripten/src/experimental/functypeopt.diff +0 -113
  321. data/modules/emscripten/src/experimental/multiple_heaps.diff +0 -175
  322. data/modules/emscripten/src/experimental/noncallgraphprofiling.diff +0 -197
  323. data/modules/emscripten/src/experimental/optimize_memcpy_for_ta1.diff +0 -124
  324. data/modules/emscripten/src/experimental/remove__label__s.diff +0 -140
  325. data/modules/emscripten/src/experimental/renderer_cache_hash.diff +0 -99
  326. data/modules/emscripten/src/experimental/sdl_key_forwarding.diff +0 -57
  327. data/modules/emscripten/src/experimental/simplifyGeneratedFunctionsDetection.diff +0 -336
  328. data/modules/emscripten/src/experimental/stringCache.diff +0 -147
  329. data/modules/emscripten/src/fastLong.js +0 -299
  330. data/modules/emscripten/src/gl-matrix.js +0 -1952
  331. data/modules/emscripten/src/headless.js +0 -295
  332. data/modules/emscripten/src/headlessCanvas.js +0 -618
  333. data/modules/emscripten/src/hello_world.js +0 -92
  334. data/modules/emscripten/src/intertyper.js +0 -1228
  335. data/modules/emscripten/src/jsifier.js +0 -1969
  336. data/modules/emscripten/src/library.js +0 -9196
  337. data/modules/emscripten/src/library_browser.js +0 -988
  338. data/modules/emscripten/src/library_egl.js +0 -564
  339. data/modules/emscripten/src/library_fs.js +0 -1619
  340. data/modules/emscripten/src/library_gc.js +0 -236
  341. data/modules/emscripten/src/library_gl.js +0 -5194
  342. data/modules/emscripten/src/library_glfw.js +0 -585
  343. data/modules/emscripten/src/library_glut.js +0 -504
  344. data/modules/emscripten/src/library_idbfs.js +0 -216
  345. data/modules/emscripten/src/library_jansson.js +0 -320
  346. data/modules/emscripten/src/library_memfs.js +0 -303
  347. data/modules/emscripten/src/library_nodefs.js +0 -286
  348. data/modules/emscripten/src/library_openal.js +0 -915
  349. data/modules/emscripten/src/library_path.js +0 -133
  350. data/modules/emscripten/src/library_sdl.js +0 -2728
  351. data/modules/emscripten/src/library_sockfs.js +0 -578
  352. data/modules/emscripten/src/library_strtok_r.c +0 -97
  353. data/modules/emscripten/src/library_tty.js +0 -146
  354. data/modules/emscripten/src/library_uuid.js +0 -140
  355. data/modules/emscripten/src/library_xlib.js +0 -23
  356. data/modules/emscripten/src/long.js +0 -1609
  357. data/modules/emscripten/src/modules.js +0 -543
  358. data/modules/emscripten/src/parseTools.js +0 -2723
  359. data/modules/emscripten/src/postamble.js +0 -239
  360. data/modules/emscripten/src/postamble_sharedlib.js +0 -16
  361. data/modules/emscripten/src/preamble.js +0 -1233
  362. data/modules/emscripten/src/preamble_sharedlib.js +0 -25
  363. data/modules/emscripten/src/proxyClient.js +0 -82
  364. data/modules/emscripten/src/proxyWorker.js +0 -143
  365. data/modules/emscripten/src/relooper/README.markdown +0 -14
  366. data/modules/emscripten/src/relooper/Relooper.cpp +0 -1301
  367. data/modules/emscripten/src/relooper/Relooper.h +0 -257
  368. data/modules/emscripten/src/relooper/doit.sh +0 -70
  369. data/modules/emscripten/src/relooper/emscripten/glue.js +0 -67
  370. data/modules/emscripten/src/relooper/emscripten/test.js +0 -44
  371. data/modules/emscripten/src/relooper/fuzzer.py +0 -131
  372. data/modules/emscripten/src/relooper/ministring.h +0 -35
  373. data/modules/emscripten/src/relooper/paper.pdf +0 -0
  374. data/modules/emscripten/src/relooper/test.cpp +0 -290
  375. data/modules/emscripten/src/relooper/test.txt +0 -317
  376. data/modules/emscripten/src/relooper/test2.c +0 -44
  377. data/modules/emscripten/src/relooper/test2.txt +0 -26
  378. data/modules/emscripten/src/relooper/test3.c +0 -42
  379. data/modules/emscripten/src/relooper/test3.txt +0 -56
  380. data/modules/emscripten/src/relooper/test4.cpp +0 -40
  381. data/modules/emscripten/src/relooper/test4.txt +0 -44
  382. data/modules/emscripten/src/relooper/test5.cpp +0 -40
  383. data/modules/emscripten/src/relooper/test5.txt +0 -56
  384. data/modules/emscripten/src/relooper/test6.cpp +0 -31
  385. data/modules/emscripten/src/relooper/test6.txt +0 -26
  386. data/modules/emscripten/src/relooper/test_dead.cpp +0 -28
  387. data/modules/emscripten/src/relooper/test_dead.txt +0 -9
  388. data/modules/emscripten/src/relooper/test_debug.cpp +0 -30
  389. data/modules/emscripten/src/relooper/test_debug.txt +0 -142
  390. data/modules/emscripten/src/relooper/test_fuzz1.cpp +0 -52
  391. data/modules/emscripten/src/relooper/test_fuzz1.txt +0 -72
  392. data/modules/emscripten/src/relooper/test_fuzz2.cpp +0 -34
  393. data/modules/emscripten/src/relooper/test_fuzz2.txt +0 -30
  394. data/modules/emscripten/src/relooper/test_fuzz3.cpp +0 -36
  395. data/modules/emscripten/src/relooper/test_fuzz3.txt +0 -25
  396. data/modules/emscripten/src/relooper/test_fuzz4.cpp +0 -38
  397. data/modules/emscripten/src/relooper/test_fuzz4.txt +0 -41
  398. data/modules/emscripten/src/relooper/test_fuzz5.cpp +0 -57
  399. data/modules/emscripten/src/relooper/test_fuzz5.txt +0 -86
  400. data/modules/emscripten/src/relooper/test_fuzz6.cpp +0 -322
  401. data/modules/emscripten/src/relooper/test_fuzz6.txt +0 -291
  402. data/modules/emscripten/src/relooper/test_inf.cpp +0 -813
  403. data/modules/emscripten/src/relooper/test_inf.txt +0 -1131
  404. data/modules/emscripten/src/relooper/testit.sh +0 -62
  405. data/modules/emscripten/src/relooper/updateit.sh +0 -17
  406. data/modules/emscripten/src/runtime.js +0 -604
  407. data/modules/emscripten/src/settings.js +0 -476
  408. data/modules/emscripten/src/shell.html +0 -95
  409. data/modules/emscripten/src/shell.js +0 -173
  410. data/modules/emscripten/src/shell_sharedlib.js +0 -29
  411. data/modules/emscripten/src/simd.js +0 -1128
  412. data/modules/emscripten/src/socket.io.js +0 -3870
  413. data/modules/emscripten/src/struct_info.json +0 -1077
  414. data/modules/emscripten/src/utility.js +0 -411
  415. data/modules/emscripten/src/wrtcp.js +0 -821
  416. data/modules/emscripten/system/bin/sdl-config +0 -13
  417. data/modules/emscripten/system/include/AL/al.h +0 -172
  418. data/modules/emscripten/system/include/AL/alc.h +0 -84
  419. data/modules/emscripten/system/include/EGL/egl.h +0 -329
  420. data/modules/emscripten/system/include/EGL/eglext.h +0 -398
  421. data/modules/emscripten/system/include/EGL/eglplatform.h +0 -141
  422. data/modules/emscripten/system/include/GL/freeglut_std.h +0 -628
  423. data/modules/emscripten/system/include/GL/gl.h +0 -2241
  424. data/modules/emscripten/system/include/GL/glew.h +0 -6
  425. data/modules/emscripten/system/include/GL/glext.h +0 -11127
  426. data/modules/emscripten/system/include/GL/glfw.h +0 -518
  427. data/modules/emscripten/system/include/GL/glu.h +0 -353
  428. data/modules/emscripten/system/include/GL/glut.h +0 -21
  429. data/modules/emscripten/system/include/GLES/gl.h +0 -770
  430. data/modules/emscripten/system/include/GLES/glext.h +0 -1278
  431. data/modules/emscripten/system/include/GLES/glplatform.h +0 -30
  432. data/modules/emscripten/system/include/GLES2/gl2.h +0 -621
  433. data/modules/emscripten/system/include/GLES2/gl2ext.h +0 -803
  434. data/modules/emscripten/system/include/GLES2/gl2platform.h +0 -30
  435. data/modules/emscripten/system/include/KHR/khrplatform.h +0 -277
  436. data/modules/emscripten/system/include/SDL/COPYING +0 -19
  437. data/modules/emscripten/system/include/SDL/SDL.h +0 -162
  438. data/modules/emscripten/system/include/SDL/SDL_assert.h +0 -241
  439. data/modules/emscripten/system/include/SDL/SDL_atomic.h +0 -318
  440. data/modules/emscripten/system/include/SDL/SDL_audio.h +0 -509
  441. data/modules/emscripten/system/include/SDL/SDL_blendmode.h +0 -60
  442. data/modules/emscripten/system/include/SDL/SDL_clipboard.h +0 -75
  443. data/modules/emscripten/system/include/SDL/SDL_compat.h +0 -365
  444. data/modules/emscripten/system/include/SDL/SDL_config.h +0 -48
  445. data/modules/emscripten/system/include/SDL/SDL_config.h.in +0 -297
  446. data/modules/emscripten/system/include/SDL/SDL_config_android.h +0 -133
  447. data/modules/emscripten/system/include/SDL/SDL_config_iphoneos.h +0 -148
  448. data/modules/emscripten/system/include/SDL/SDL_config_macosx.h +0 -172
  449. data/modules/emscripten/system/include/SDL/SDL_config_minimal.h +0 -74
  450. data/modules/emscripten/system/include/SDL/SDL_config_nintendods.h +0 -129
  451. data/modules/emscripten/system/include/SDL/SDL_config_pandora.h +0 -125
  452. data/modules/emscripten/system/include/SDL/SDL_config_windows.h +0 -207
  453. data/modules/emscripten/system/include/SDL/SDL_config_wiz.h +0 -119
  454. data/modules/emscripten/system/include/SDL/SDL_copying.h +0 -20
  455. data/modules/emscripten/system/include/SDL/SDL_cpuinfo.h +0 -150
  456. data/modules/emscripten/system/include/SDL/SDL_endian.h +0 -248
  457. data/modules/emscripten/system/include/SDL/SDL_error.h +0 -77
  458. data/modules/emscripten/system/include/SDL/SDL_events.h +0 -640
  459. data/modules/emscripten/system/include/SDL/SDL_gesture.h +0 -91
  460. data/modules/emscripten/system/include/SDL/SDL_gfxPrimitives.h +0 -246
  461. data/modules/emscripten/system/include/SDL/SDL_haptic.h +0 -1200
  462. data/modules/emscripten/system/include/SDL/SDL_hints.h +0 -206
  463. data/modules/emscripten/system/include/SDL/SDL_image.h +0 -138
  464. data/modules/emscripten/system/include/SDL/SDL_input.h +0 -87
  465. data/modules/emscripten/system/include/SDL/SDL_joystick.h +0 -208
  466. data/modules/emscripten/system/include/SDL/SDL_keyboard.h +0 -169
  467. data/modules/emscripten/system/include/SDL/SDL_keycode.h +0 -344
  468. data/modules/emscripten/system/include/SDL/SDL_loadso.h +0 -85
  469. data/modules/emscripten/system/include/SDL/SDL_log.h +0 -211
  470. data/modules/emscripten/system/include/SDL/SDL_main.h +0 -98
  471. data/modules/emscripten/system/include/SDL/SDL_mixer.h +0 -634
  472. data/modules/emscripten/system/include/SDL/SDL_mouse.h +0 -213
  473. data/modules/emscripten/system/include/SDL/SDL_mutex.h +0 -248
  474. data/modules/emscripten/system/include/SDL/SDL_name.h +0 -11
  475. data/modules/emscripten/system/include/SDL/SDL_opengl.h +0 -11116
  476. data/modules/emscripten/system/include/SDL/SDL_opengles.h +0 -38
  477. data/modules/emscripten/system/include/SDL/SDL_opengles2.h +0 -38
  478. data/modules/emscripten/system/include/SDL/SDL_pixels.h +0 -423
  479. data/modules/emscripten/system/include/SDL/SDL_platform.h +0 -160
  480. data/modules/emscripten/system/include/SDL/SDL_power.h +0 -79
  481. data/modules/emscripten/system/include/SDL/SDL_quit.h +0 -58
  482. data/modules/emscripten/system/include/SDL/SDL_rect.h +0 -136
  483. data/modules/emscripten/system/include/SDL/SDL_render.h +0 -615
  484. data/modules/emscripten/system/include/SDL/SDL_revision.h +0 -2
  485. data/modules/emscripten/system/include/SDL/SDL_revision.h.orig +0 -2
  486. data/modules/emscripten/system/include/SDL/SDL_rotozoom.h +0 -123
  487. data/modules/emscripten/system/include/SDL/SDL_rwops.h +0 -220
  488. data/modules/emscripten/system/include/SDL/SDL_scancode.h +0 -398
  489. data/modules/emscripten/system/include/SDL/SDL_shape.h +0 -147
  490. data/modules/emscripten/system/include/SDL/SDL_stdinc.h +0 -764
  491. data/modules/emscripten/system/include/SDL/SDL_surface.h +0 -499
  492. data/modules/emscripten/system/include/SDL/SDL_syswm.h +0 -241
  493. data/modules/emscripten/system/include/SDL/SDL_thread.h +0 -182
  494. data/modules/emscripten/system/include/SDL/SDL_timer.h +0 -108
  495. data/modules/emscripten/system/include/SDL/SDL_touch.h +0 -124
  496. data/modules/emscripten/system/include/SDL/SDL_ttf.h +0 -249
  497. data/modules/emscripten/system/include/SDL/SDL_types.h +0 -29
  498. data/modules/emscripten/system/include/SDL/SDL_version.h +0 -166
  499. data/modules/emscripten/system/include/SDL/SDL_video.h +0 -820
  500. data/modules/emscripten/system/include/SDL/begin_code.h +0 -135
  501. data/modules/emscripten/system/include/SDL/close_code.h +0 -37
  502. data/modules/emscripten/system/include/X11/X.h +0 -717
  503. data/modules/emscripten/system/include/X11/Xatom.h +0 -79
  504. data/modules/emscripten/system/include/X11/Xfuncproto.h +0 -127
  505. data/modules/emscripten/system/include/X11/Xlib.h +0 -4023
  506. data/modules/emscripten/system/include/X11/Xosdefs.h +0 -116
  507. data/modules/emscripten/system/include/X11/Xutil.h +0 -826
  508. data/modules/emscripten/system/include/X11/keysym.h +0 -73
  509. data/modules/emscripten/system/include/X11/keysymdef.h +0 -2389
  510. data/modules/emscripten/system/include/compat/ctype.h +0 -34
  511. data/modules/emscripten/system/include/compat/malloc.h +0 -48
  512. data/modules/emscripten/system/include/compat/math.h +0 -14
  513. data/modules/emscripten/system/include/compat/netdb.h +0 -22
  514. data/modules/emscripten/system/include/compat/stdarg.h +0 -16
  515. data/modules/emscripten/system/include/compat/stdlib.h +0 -16
  516. data/modules/emscripten/system/include/compat/string.h +0 -17
  517. data/modules/emscripten/system/include/compat/sys/socketvar.h +0 -14
  518. data/modules/emscripten/system/include/compat/sys/stat.h +0 -20
  519. data/modules/emscripten/system/include/compat/sys/timeb.h +0 -35
  520. data/modules/emscripten/system/include/compat/time.h +0 -18
  521. data/modules/emscripten/system/include/compat/unistd.h +0 -16
  522. data/modules/emscripten/system/include/compat/wchar.h +0 -23
  523. data/modules/emscripten/system/include/compat/wctype.h +0 -23
  524. data/modules/emscripten/system/include/compat/xlocale.h +0 -19
  525. data/modules/emscripten/system/include/emscripten/bind.h +0 -1210
  526. data/modules/emscripten/system/include/emscripten/emmintrin.h +0 -87
  527. data/modules/emscripten/system/include/emscripten/emscripten.h +0 -519
  528. data/modules/emscripten/system/include/emscripten/val.h +0 -311
  529. data/modules/emscripten/system/include/emscripten/vector.h +0 -34
  530. data/modules/emscripten/system/include/emscripten/wire.h +0 -393
  531. data/modules/emscripten/system/include/emscripten/xmmintrin.h +0 -131
  532. data/modules/emscripten/system/include/execinfo.h +0 -44
  533. data/modules/emscripten/system/include/gc.h +0 -70
  534. data/modules/emscripten/system/include/gfx/png.h +0 -3798
  535. data/modules/emscripten/system/include/gfx/pngconf.h +0 -1665
  536. data/modules/emscripten/system/include/gfx/tiff.h +0 -654
  537. data/modules/emscripten/system/include/gfx/tiffconf.h +0 -104
  538. data/modules/emscripten/system/include/gfx/tiffio.h +0 -526
  539. data/modules/emscripten/system/include/gfx/tiffvers.h +0 -9
  540. data/modules/emscripten/system/include/jansson.h +0 -323
  541. data/modules/emscripten/system/include/jansson_config.h +0 -54
  542. data/modules/emscripten/system/include/libc/aio.h +0 -69
  543. data/modules/emscripten/system/include/libc/alloca.h +0 -21
  544. data/modules/emscripten/system/include/libc/ar.h +0 -25
  545. data/modules/emscripten/system/include/libc/arpa/ftp.h +0 -35
  546. data/modules/emscripten/system/include/libc/arpa/inet.h +0 -36
  547. data/modules/emscripten/system/include/libc/arpa/nameser.h +0 -467
  548. data/modules/emscripten/system/include/libc/arpa/nameser_compat.h +0 -2
  549. data/modules/emscripten/system/include/libc/arpa/telnet.h +0 -251
  550. data/modules/emscripten/system/include/libc/arpa/tftp.h +0 -31
  551. data/modules/emscripten/system/include/libc/assert.h +0 -19
  552. data/modules/emscripten/system/include/libc/bits/alltypes.h +0 -397
  553. data/modules/emscripten/system/include/libc/bits/endian.h +0 -1
  554. data/modules/emscripten/system/include/libc/bits/errno.h +0 -134
  555. data/modules/emscripten/system/include/libc/bits/fcntl.h +0 -38
  556. data/modules/emscripten/system/include/libc/bits/fenv.h +0 -34
  557. data/modules/emscripten/system/include/libc/bits/float.h +0 -17
  558. data/modules/emscripten/system/include/libc/bits/io.h +0 -0
  559. data/modules/emscripten/system/include/libc/bits/ioctl.h +0 -197
  560. data/modules/emscripten/system/include/libc/bits/ipc.h +0 -14
  561. data/modules/emscripten/system/include/libc/bits/limits.h +0 -8
  562. data/modules/emscripten/system/include/libc/bits/mman.h +0 -62
  563. data/modules/emscripten/system/include/libc/bits/msg.h +0 -16
  564. data/modules/emscripten/system/include/libc/bits/posix.h +0 -2
  565. data/modules/emscripten/system/include/libc/bits/reg.h +0 -19
  566. data/modules/emscripten/system/include/libc/bits/setjmp.h +0 -1
  567. data/modules/emscripten/system/include/libc/bits/shm.h +0 -18
  568. data/modules/emscripten/system/include/libc/bits/signal.h +0 -112
  569. data/modules/emscripten/system/include/libc/bits/socket.h +0 -17
  570. data/modules/emscripten/system/include/libc/bits/stat.h +0 -22
  571. data/modules/emscripten/system/include/libc/bits/statfs.h +0 -7
  572. data/modules/emscripten/system/include/libc/bits/stdarg.h +0 -4
  573. data/modules/emscripten/system/include/libc/bits/stdint.h +0 -20
  574. data/modules/emscripten/system/include/libc/bits/syscall.h +0 -696
  575. data/modules/emscripten/system/include/libc/bits/termios.h +0 -160
  576. data/modules/emscripten/system/include/libc/bits/user.h +0 -48
  577. data/modules/emscripten/system/include/libc/byteswap.h +0 -26
  578. data/modules/emscripten/system/include/libc/complex.h +0 -125
  579. data/modules/emscripten/system/include/libc/cpio.h +0 -29
  580. data/modules/emscripten/system/include/libc/crypt.h +0 -20
  581. data/modules/emscripten/system/include/libc/ctype.h +0 -67
  582. data/modules/emscripten/system/include/libc/dirent.h +0 -79
  583. data/modules/emscripten/system/include/libc/dlfcn.h +0 -42
  584. data/modules/emscripten/system/include/libc/elf.h +0 -2555
  585. data/modules/emscripten/system/include/libc/endian.h +0 -82
  586. data/modules/emscripten/system/include/libc/err.h +0 -25
  587. data/modules/emscripten/system/include/libc/errno.h +0 -27
  588. data/modules/emscripten/system/include/libc/fcntl.h +0 -175
  589. data/modules/emscripten/system/include/libc/features.h +0 -32
  590. data/modules/emscripten/system/include/libc/fenv.h +0 -28
  591. data/modules/emscripten/system/include/libc/float.h +0 -34
  592. data/modules/emscripten/system/include/libc/fnmatch.h +0 -29
  593. data/modules/emscripten/system/include/libc/ftw.h +0 -42
  594. data/modules/emscripten/system/include/libc/getopt.h +0 -31
  595. data/modules/emscripten/system/include/libc/glob.h +0 -48
  596. data/modules/emscripten/system/include/libc/grp.h +0 -52
  597. data/modules/emscripten/system/include/libc/iconv.h +0 -24
  598. data/modules/emscripten/system/include/libc/ifaddrs.h +0 -35
  599. data/modules/emscripten/system/include/libc/inttypes.h +0 -227
  600. data/modules/emscripten/system/include/libc/iso646.h +0 -20
  601. data/modules/emscripten/system/include/libc/langinfo.h +0 -88
  602. data/modules/emscripten/system/include/libc/lastlog.h +0 -1
  603. data/modules/emscripten/system/include/libc/libgen.h +0 -15
  604. data/modules/emscripten/system/include/libc/libintl.h +0 -25
  605. data/modules/emscripten/system/include/libc/limits.h +0 -146
  606. data/modules/emscripten/system/include/libc/link.h +0 -54
  607. data/modules/emscripten/system/include/libc/locale.h +0 -82
  608. data/modules/emscripten/system/include/libc/malloc.h +0 -0
  609. data/modules/emscripten/system/include/libc/math.h +0 -422
  610. data/modules/emscripten/system/include/libc/memory.h +0 -1
  611. data/modules/emscripten/system/include/libc/mntent.h +0 -44
  612. data/modules/emscripten/system/include/libc/monetary.h +0 -23
  613. data/modules/emscripten/system/include/libc/mqueue.h +0 -36
  614. data/modules/emscripten/system/include/libc/net/ethernet.h +0 -55
  615. data/modules/emscripten/system/include/libc/net/if.h +0 -135
  616. data/modules/emscripten/system/include/libc/net/if_arp.h +0 -133
  617. data/modules/emscripten/system/include/libc/net/route.h +0 -124
  618. data/modules/emscripten/system/include/libc/netdb.h +0 -161
  619. data/modules/emscripten/system/include/libc/netinet/ether.h +0 -14
  620. data/modules/emscripten/system/include/libc/netinet/icmp6.h +0 -305
  621. data/modules/emscripten/system/include/libc/netinet/if_ether.h +0 -126
  622. data/modules/emscripten/system/include/libc/netinet/in.h +0 -336
  623. data/modules/emscripten/system/include/libc/netinet/in_systm.h +0 -9
  624. data/modules/emscripten/system/include/libc/netinet/ip.h +0 -186
  625. data/modules/emscripten/system/include/libc/netinet/ip6.h +0 -142
  626. data/modules/emscripten/system/include/libc/netinet/ip_icmp.h +0 -192
  627. data/modules/emscripten/system/include/libc/netinet/tcp.h +0 -71
  628. data/modules/emscripten/system/include/libc/netinet/udp.h +0 -35
  629. data/modules/emscripten/system/include/libc/netpacket/packet.h +0 -44
  630. data/modules/emscripten/system/include/libc/nl_types.h +0 -22
  631. data/modules/emscripten/system/include/libc/paths.h +0 -32
  632. data/modules/emscripten/system/include/libc/poll.h +0 -46
  633. data/modules/emscripten/system/include/libc/pthread.h +0 -222
  634. data/modules/emscripten/system/include/libc/pty.h +0 -18
  635. data/modules/emscripten/system/include/libc/pwd.h +0 -49
  636. data/modules/emscripten/system/include/libc/readme.txt +0 -3
  637. data/modules/emscripten/system/include/libc/regex.h +0 -62
  638. data/modules/emscripten/system/include/libc/resolv.h +0 -144
  639. data/modules/emscripten/system/include/libc/sched.h +0 -132
  640. data/modules/emscripten/system/include/libc/search.h +0 -51
  641. data/modules/emscripten/system/include/libc/semaphore.h +0 -35
  642. data/modules/emscripten/system/include/libc/setjmp.h +0 -42
  643. data/modules/emscripten/system/include/libc/shadow.h +0 -44
  644. data/modules/emscripten/system/include/libc/signal.h +0 -255
  645. data/modules/emscripten/system/include/libc/spawn.h +0 -74
  646. data/modules/emscripten/system/include/libc/stdalign.h +0 -15
  647. data/modules/emscripten/system/include/libc/stdarg.h +0 -25
  648. data/modules/emscripten/system/include/libc/stdbool.h +0 -14
  649. data/modules/emscripten/system/include/libc/stddef.h +0 -18
  650. data/modules/emscripten/system/include/libc/stdint.h +0 -117
  651. data/modules/emscripten/system/include/libc/stdio.h +0 -199
  652. data/modules/emscripten/system/include/libc/stdio_ext.h +0 -34
  653. data/modules/emscripten/system/include/libc/stdlib.h +0 -171
  654. data/modules/emscripten/system/include/libc/stdnoreturn.h +0 -5
  655. data/modules/emscripten/system/include/libc/string.h +0 -102
  656. data/modules/emscripten/system/include/libc/strings.h +0 -35
  657. data/modules/emscripten/system/include/libc/stropts.h +0 -139
  658. data/modules/emscripten/system/include/libc/sys/acct.h +0 -75
  659. data/modules/emscripten/system/include/libc/sys/cachectl.h +0 -22
  660. data/modules/emscripten/system/include/libc/sys/dir.h +0 -2
  661. data/modules/emscripten/system/include/libc/sys/epoll.h +0 -67
  662. data/modules/emscripten/system/include/libc/sys/errno.h +0 -2
  663. data/modules/emscripten/system/include/libc/sys/eventfd.h +0 -26
  664. data/modules/emscripten/system/include/libc/sys/fcntl.h +0 -2
  665. data/modules/emscripten/system/include/libc/sys/file.h +0 -21
  666. data/modules/emscripten/system/include/libc/sys/fsuid.h +0 -20
  667. data/modules/emscripten/system/include/libc/sys/inotify.h +0 -57
  668. data/modules/emscripten/system/include/libc/sys/io.h +0 -17
  669. data/modules/emscripten/system/include/libc/sys/ioctl.h +0 -14
  670. data/modules/emscripten/system/include/libc/sys/ipc.h +0 -42
  671. data/modules/emscripten/system/include/libc/sys/klog.h +0 -14
  672. data/modules/emscripten/system/include/libc/sys/mman.h +0 -55
  673. data/modules/emscripten/system/include/libc/sys/mount.h +0 -72
  674. data/modules/emscripten/system/include/libc/sys/msg.h +0 -52
  675. data/modules/emscripten/system/include/libc/sys/mtio.h +0 -188
  676. data/modules/emscripten/system/include/libc/sys/param.h +0 -35
  677. data/modules/emscripten/system/include/libc/sys/personality.h +0 -46
  678. data/modules/emscripten/system/include/libc/sys/poll.h +0 -2
  679. data/modules/emscripten/system/include/libc/sys/prctl.h +0 -101
  680. data/modules/emscripten/system/include/libc/sys/procfs.h +0 -65
  681. data/modules/emscripten/system/include/libc/sys/ptrace.h +0 -96
  682. data/modules/emscripten/system/include/libc/sys/reboot.h +0 -20
  683. data/modules/emscripten/system/include/libc/sys/reg.h +0 -9
  684. data/modules/emscripten/system/include/libc/sys/resource.h +0 -103
  685. data/modules/emscripten/system/include/libc/sys/select.h +0 -42
  686. data/modules/emscripten/system/include/libc/sys/sem.h +0 -82
  687. data/modules/emscripten/system/include/libc/sys/sendfile.h +0 -22
  688. data/modules/emscripten/system/include/libc/sys/shm.h +0 -61
  689. data/modules/emscripten/system/include/libc/sys/signal.h +0 -2
  690. data/modules/emscripten/system/include/libc/sys/signalfd.h +0 -44
  691. data/modules/emscripten/system/include/libc/sys/socket.h +0 -299
  692. data/modules/emscripten/system/include/libc/sys/stat.h +0 -114
  693. data/modules/emscripten/system/include/libc/sys/statfs.h +0 -32
  694. data/modules/emscripten/system/include/libc/sys/statvfs.h +0 -57
  695. data/modules/emscripten/system/include/libc/sys/stropts.h +0 -1
  696. data/modules/emscripten/system/include/libc/sys/swap.h +0 -21
  697. data/modules/emscripten/system/include/libc/sys/syscall.h +0 -6
  698. data/modules/emscripten/system/include/libc/sys/sysctl.h +0 -17
  699. data/modules/emscripten/system/include/libc/sys/sysinfo.h +0 -36
  700. data/modules/emscripten/system/include/libc/sys/syslog.h +0 -1
  701. data/modules/emscripten/system/include/libc/sys/sysmacros.h +0 -15
  702. data/modules/emscripten/system/include/libc/sys/termios.h +0 -2
  703. data/modules/emscripten/system/include/libc/sys/time.h +0 -57
  704. data/modules/emscripten/system/include/libc/sys/timerfd.h +0 -24
  705. data/modules/emscripten/system/include/libc/sys/times.h +0 -26
  706. data/modules/emscripten/system/include/libc/sys/timex.h +0 -98
  707. data/modules/emscripten/system/include/libc/sys/ttydefaults.h +0 -39
  708. data/modules/emscripten/system/include/libc/sys/types.h +0 -91
  709. data/modules/emscripten/system/include/libc/sys/ucontext.h +0 -1
  710. data/modules/emscripten/system/include/libc/sys/uio.h +0 -48
  711. data/modules/emscripten/system/include/libc/sys/un.h +0 -32
  712. data/modules/emscripten/system/include/libc/sys/user.h +0 -16
  713. data/modules/emscripten/system/include/libc/sys/utsname.h +0 -30
  714. data/modules/emscripten/system/include/libc/sys/vfs.h +0 -1
  715. data/modules/emscripten/system/include/libc/sys/wait.h +0 -55
  716. data/modules/emscripten/system/include/libc/sys/xattr.h +0 -30
  717. data/modules/emscripten/system/include/libc/syscall.h +0 -1
  718. data/modules/emscripten/system/include/libc/sysexits.h +0 -21
  719. data/modules/emscripten/system/include/libc/syslog.h +0 -104
  720. data/modules/emscripten/system/include/libc/tar.h +0 -33
  721. data/modules/emscripten/system/include/libc/termios.h +0 -46
  722. data/modules/emscripten/system/include/libc/tgmath.h +0 -270
  723. data/modules/emscripten/system/include/libc/time.h +0 -132
  724. data/modules/emscripten/system/include/libc/ucontext.h +0 -25
  725. data/modules/emscripten/system/include/libc/ulimit.h +0 -17
  726. data/modules/emscripten/system/include/libc/unistd.h +0 -519
  727. data/modules/emscripten/system/include/libc/utime.h +0 -24
  728. data/modules/emscripten/system/include/libc/utmp.h +0 -47
  729. data/modules/emscripten/system/include/libc/utmpx.h +0 -58
  730. data/modules/emscripten/system/include/libc/values.h +0 -39
  731. data/modules/emscripten/system/include/libc/wchar.h +0 -183
  732. data/modules/emscripten/system/include/libc/wctype.h +0 -77
  733. data/modules/emscripten/system/include/libc/wordexp.h +0 -42
  734. data/modules/emscripten/system/include/libcxx/CREDITS.TXT +0 -123
  735. data/modules/emscripten/system/include/libcxx/LICENSE.txt +0 -76
  736. data/modules/emscripten/system/include/libcxx/__bit_reference +0 -1287
  737. data/modules/emscripten/system/include/libcxx/__config +0 -610
  738. data/modules/emscripten/system/include/libcxx/__debug +0 -218
  739. data/modules/emscripten/system/include/libcxx/__functional_03 +0 -2130
  740. data/modules/emscripten/system/include/libcxx/__functional_base +0 -615
  741. data/modules/emscripten/system/include/libcxx/__functional_base_03 +0 -1087
  742. data/modules/emscripten/system/include/libcxx/__hash_table +0 -2457
  743. data/modules/emscripten/system/include/libcxx/__locale +0 -1445
  744. data/modules/emscripten/system/include/libcxx/__mutex_base +0 -407
  745. data/modules/emscripten/system/include/libcxx/__split_buffer +0 -654
  746. data/modules/emscripten/system/include/libcxx/__sso_allocator +0 -77
  747. data/modules/emscripten/system/include/libcxx/__std_stream +0 -359
  748. data/modules/emscripten/system/include/libcxx/__tree +0 -2309
  749. data/modules/emscripten/system/include/libcxx/__tuple +0 -305
  750. data/modules/emscripten/system/include/libcxx/__tuple_03 +0 -27
  751. data/modules/emscripten/system/include/libcxx/__undef_min_max +0 -27
  752. data/modules/emscripten/system/include/libcxx/algorithm +0 -5679
  753. data/modules/emscripten/system/include/libcxx/array +0 -342
  754. data/modules/emscripten/system/include/libcxx/atomic +0 -1531
  755. data/modules/emscripten/system/include/libcxx/bitset +0 -1081
  756. data/modules/emscripten/system/include/libcxx/cassert +0 -25
  757. data/modules/emscripten/system/include/libcxx/ccomplex +0 -29
  758. data/modules/emscripten/system/include/libcxx/cctype +0 -164
  759. data/modules/emscripten/system/include/libcxx/cerrno +0 -393
  760. data/modules/emscripten/system/include/libcxx/cfenv +0 -82
  761. data/modules/emscripten/system/include/libcxx/cfloat +0 -78
  762. data/modules/emscripten/system/include/libcxx/chrono +0 -1027
  763. data/modules/emscripten/system/include/libcxx/cinttypes +0 -259
  764. data/modules/emscripten/system/include/libcxx/ciso646 +0 -25
  765. data/modules/emscripten/system/include/libcxx/climits +0 -48
  766. data/modules/emscripten/system/include/libcxx/clocale +0 -53
  767. data/modules/emscripten/system/include/libcxx/cmath +0 -1690
  768. data/modules/emscripten/system/include/libcxx/codecvt +0 -550
  769. data/modules/emscripten/system/include/libcxx/complex +0 -1567
  770. data/modules/emscripten/system/include/libcxx/complex.h +0 -35
  771. data/modules/emscripten/system/include/libcxx/condition_variable +0 -256
  772. data/modules/emscripten/system/include/libcxx/csetjmp +0 -52
  773. data/modules/emscripten/system/include/libcxx/csignal +0 -58
  774. data/modules/emscripten/system/include/libcxx/cstdarg +0 -48
  775. data/modules/emscripten/system/include/libcxx/cstdbool +0 -32
  776. data/modules/emscripten/system/include/libcxx/cstddef +0 -103
  777. data/modules/emscripten/system/include/libcxx/cstdint +0 -191
  778. data/modules/emscripten/system/include/libcxx/cstdio +0 -182
  779. data/modules/emscripten/system/include/libcxx/cstdlib +0 -172
  780. data/modules/emscripten/system/include/libcxx/cstring +0 -112
  781. data/modules/emscripten/system/include/libcxx/ctgmath +0 -29
  782. data/modules/emscripten/system/include/libcxx/ctime +0 -72
  783. data/modules/emscripten/system/include/libcxx/cwchar +0 -217
  784. data/modules/emscripten/system/include/libcxx/cwctype +0 -213
  785. data/modules/emscripten/system/include/libcxx/deque +0 -2873
  786. data/modules/emscripten/system/include/libcxx/dynarray +0 -311
  787. data/modules/emscripten/system/include/libcxx/exception +0 -250
  788. data/modules/emscripten/system/include/libcxx/ext/__hash +0 -46
  789. data/modules/emscripten/system/include/libcxx/ext/hash_map +0 -1007
  790. data/modules/emscripten/system/include/libcxx/ext/hash_set +0 -661
  791. data/modules/emscripten/system/include/libcxx/forward_list +0 -1663
  792. data/modules/emscripten/system/include/libcxx/fstream +0 -1431
  793. data/modules/emscripten/system/include/libcxx/functional +0 -2418
  794. data/modules/emscripten/system/include/libcxx/future +0 -2615
  795. data/modules/emscripten/system/include/libcxx/initializer_list +0 -118
  796. data/modules/emscripten/system/include/libcxx/iomanip +0 -651
  797. data/modules/emscripten/system/include/libcxx/ios +0 -1023
  798. data/modules/emscripten/system/include/libcxx/iosfwd +0 -194
  799. data/modules/emscripten/system/include/libcxx/iostream +0 -60
  800. data/modules/emscripten/system/include/libcxx/istream +0 -1716
  801. data/modules/emscripten/system/include/libcxx/iterator +0 -1568
  802. data/modules/emscripten/system/include/libcxx/limits +0 -813
  803. data/modules/emscripten/system/include/libcxx/list +0 -2355
  804. data/modules/emscripten/system/include/libcxx/locale +0 -4465
  805. data/modules/emscripten/system/include/libcxx/map +0 -2045
  806. data/modules/emscripten/system/include/libcxx/memory +0 -5448
  807. data/modules/emscripten/system/include/libcxx/mutex +0 -566
  808. data/modules/emscripten/system/include/libcxx/new +0 -146
  809. data/modules/emscripten/system/include/libcxx/numeric +0 -197
  810. data/modules/emscripten/system/include/libcxx/optional +0 -697
  811. data/modules/emscripten/system/include/libcxx/ostream +0 -1295
  812. data/modules/emscripten/system/include/libcxx/queue +0 -717
  813. data/modules/emscripten/system/include/libcxx/random +0 -6725
  814. data/modules/emscripten/system/include/libcxx/ratio +0 -487
  815. data/modules/emscripten/system/include/libcxx/readme.txt +0 -1
  816. data/modules/emscripten/system/include/libcxx/regex +0 -6487
  817. data/modules/emscripten/system/include/libcxx/scoped_allocator +0 -578
  818. data/modules/emscripten/system/include/libcxx/set +0 -1189
  819. data/modules/emscripten/system/include/libcxx/shared_mutex +0 -419
  820. data/modules/emscripten/system/include/libcxx/sstream +0 -972
  821. data/modules/emscripten/system/include/libcxx/stack +0 -292
  822. data/modules/emscripten/system/include/libcxx/stdexcept +0 -162
  823. data/modules/emscripten/system/include/libcxx/streambuf +0 -564
  824. data/modules/emscripten/system/include/libcxx/string +0 -4198
  825. data/modules/emscripten/system/include/libcxx/strstream +0 -400
  826. data/modules/emscripten/system/include/libcxx/support/ibm/limits.h +0 -99
  827. data/modules/emscripten/system/include/libcxx/support/ibm/support.h +0 -54
  828. data/modules/emscripten/system/include/libcxx/support/ibm/xlocale.h +0 -326
  829. data/modules/emscripten/system/include/libcxx/support/solaris/floatingpoint.h +0 -5
  830. data/modules/emscripten/system/include/libcxx/support/solaris/wchar.h +0 -38
  831. data/modules/emscripten/system/include/libcxx/support/solaris/xlocale.h +0 -146
  832. data/modules/emscripten/system/include/libcxx/support/win32/limits_win32.h +0 -79
  833. data/modules/emscripten/system/include/libcxx/support/win32/locale_win32.h +0 -129
  834. data/modules/emscripten/system/include/libcxx/support/win32/math_win32.h +0 -115
  835. data/modules/emscripten/system/include/libcxx/support/win32/support.h +0 -119
  836. data/modules/emscripten/system/include/libcxx/system_error +0 -642
  837. data/modules/emscripten/system/include/libcxx/tgmath.h +0 -29
  838. data/modules/emscripten/system/include/libcxx/thread +0 -458
  839. data/modules/emscripten/system/include/libcxx/tuple +0 -1102
  840. data/modules/emscripten/system/include/libcxx/type_traits +0 -3292
  841. data/modules/emscripten/system/include/libcxx/typeindex +0 -103
  842. data/modules/emscripten/system/include/libcxx/typeinfo +0 -124
  843. data/modules/emscripten/system/include/libcxx/unordered_map +0 -2078
  844. data/modules/emscripten/system/include/libcxx/unordered_set +0 -1379
  845. data/modules/emscripten/system/include/libcxx/utility +0 -768
  846. data/modules/emscripten/system/include/libcxx/valarray +0 -4779
  847. data/modules/emscripten/system/include/libcxx/vector +0 -3246
  848. data/modules/emscripten/system/include/unwind.h +0 -154
  849. data/modules/emscripten/system/include/uuid/uuid.h +0 -35
  850. data/modules/emscripten/system/include/zconf.h +0 -428
  851. data/modules/emscripten/system/include/zlib.h +0 -1613
  852. data/modules/emscripten/system/lib/compiler-rt/LICENSE.TXT +0 -97
  853. data/modules/emscripten/system/lib/compiler-rt/divdi3.c +0 -47
  854. data/modules/emscripten/system/lib/compiler-rt/int_endianness.h +0 -116
  855. data/modules/emscripten/system/lib/compiler-rt/int_lib.h +0 -46
  856. data/modules/emscripten/system/lib/compiler-rt/int_math.h +0 -67
  857. data/modules/emscripten/system/lib/compiler-rt/int_types.h +0 -140
  858. data/modules/emscripten/system/lib/compiler-rt/int_util.h +0 -29
  859. data/modules/emscripten/system/lib/compiler-rt/muldi3.c +0 -56
  860. data/modules/emscripten/system/lib/compiler-rt/readme.txt +0 -20
  861. data/modules/emscripten/system/lib/compiler-rt/udivdi3.c +0 -36
  862. data/modules/emscripten/system/lib/compiler-rt/udivmoddi4.c +0 -251
  863. data/modules/emscripten/system/lib/debugging.cpp +0 -24
  864. data/modules/emscripten/system/lib/dlmalloc.c +0 -6297
  865. data/modules/emscripten/system/lib/embind/bind.cpp +0 -63
  866. data/modules/emscripten/system/lib/libc/gen/err.c +0 -49
  867. data/modules/emscripten/system/lib/libc/gen/errx.c +0 -49
  868. data/modules/emscripten/system/lib/libc/gen/verr.c +0 -58
  869. data/modules/emscripten/system/lib/libc/gen/verrx.c +0 -51
  870. data/modules/emscripten/system/lib/libc/gen/vwarn.c +0 -55
  871. data/modules/emscripten/system/lib/libc/gen/vwarnx.c +0 -48
  872. data/modules/emscripten/system/lib/libc/gen/warn.c +0 -49
  873. data/modules/emscripten/system/lib/libc/gen/warnx.c +0 -49
  874. data/modules/emscripten/system/lib/libc/musl/COPYRIGHT +0 -92
  875. data/modules/emscripten/system/lib/libc/musl/readme.txt +0 -9
  876. data/modules/emscripten/system/lib/libc/musl/src/ctype/alpha.h +0 -125
  877. data/modules/emscripten/system/lib/libc/musl/src/ctype/iswalnum.c +0 -7
  878. data/modules/emscripten/system/lib/libc/musl/src/ctype/iswalpha.c +0 -14
  879. data/modules/emscripten/system/lib/libc/musl/src/ctype/iswblank.c +0 -8
  880. data/modules/emscripten/system/lib/libc/musl/src/ctype/iswcntrl.c +0 -10
  881. data/modules/emscripten/system/lib/libc/musl/src/ctype/iswctype.c +0 -63
  882. data/modules/emscripten/system/lib/libc/musl/src/ctype/iswdigit.c +0 -9
  883. data/modules/emscripten/system/lib/libc/musl/src/ctype/iswgraph.c +0 -7
  884. data/modules/emscripten/system/lib/libc/musl/src/ctype/iswlower.c +0 -6
  885. data/modules/emscripten/system/lib/libc/musl/src/ctype/iswprint.c +0 -19
  886. data/modules/emscripten/system/lib/libc/musl/src/ctype/iswpunct.c +0 -12
  887. data/modules/emscripten/system/lib/libc/musl/src/ctype/iswspace.c +0 -19
  888. data/modules/emscripten/system/lib/libc/musl/src/ctype/iswupper.c +0 -6
  889. data/modules/emscripten/system/lib/libc/musl/src/ctype/iswxdigit.c +0 -7
  890. data/modules/emscripten/system/lib/libc/musl/src/ctype/nonspacing.h +0 -62
  891. data/modules/emscripten/system/lib/libc/musl/src/ctype/punct.h +0 -109
  892. data/modules/emscripten/system/lib/libc/musl/src/ctype/towctrans.c +0 -268
  893. data/modules/emscripten/system/lib/libc/musl/src/ctype/wcswidth.c +0 -8
  894. data/modules/emscripten/system/lib/libc/musl/src/ctype/wctrans.c +0 -16
  895. data/modules/emscripten/system/lib/libc/musl/src/ctype/wcwidth.c +0 -29
  896. data/modules/emscripten/system/lib/libc/musl/src/ctype/wide.h +0 -42
  897. data/modules/emscripten/system/lib/libc/musl/src/internal/libc.c +0 -22
  898. data/modules/emscripten/system/lib/libc/musl/src/internal/libc.h +0 -71
  899. data/modules/emscripten/system/lib/libc/musl/src/internal/locale_impl.h +0 -5
  900. data/modules/emscripten/system/lib/libc/musl/src/internal/stdio_impl.h +0 -92
  901. data/modules/emscripten/system/lib/libc/musl/src/locale/big5.h +0 -1085
  902. data/modules/emscripten/system/lib/libc/musl/src/locale/codepages.h +0 -238
  903. data/modules/emscripten/system/lib/libc/musl/src/locale/gb18030.h +0 -1836
  904. data/modules/emscripten/system/lib/libc/musl/src/locale/hkscs.h +0 -390
  905. data/modules/emscripten/system/lib/libc/musl/src/locale/iconv.c +0 -454
  906. data/modules/emscripten/system/lib/libc/musl/src/locale/iswalnum_l.c +0 -6
  907. data/modules/emscripten/system/lib/libc/musl/src/locale/iswalpha_l.c +0 -6
  908. data/modules/emscripten/system/lib/libc/musl/src/locale/iswblank_l.c +0 -6
  909. data/modules/emscripten/system/lib/libc/musl/src/locale/iswcntrl_l.c +0 -6
  910. data/modules/emscripten/system/lib/libc/musl/src/locale/iswctype_l.c +0 -9
  911. data/modules/emscripten/system/lib/libc/musl/src/locale/iswdigit_l.c +0 -6
  912. data/modules/emscripten/system/lib/libc/musl/src/locale/iswgraph_l.c +0 -6
  913. data/modules/emscripten/system/lib/libc/musl/src/locale/iswlower_l.c +0 -6
  914. data/modules/emscripten/system/lib/libc/musl/src/locale/iswprint_l.c +0 -6
  915. data/modules/emscripten/system/lib/libc/musl/src/locale/iswpunct_l.c +0 -6
  916. data/modules/emscripten/system/lib/libc/musl/src/locale/iswspace_l.c +0 -6
  917. data/modules/emscripten/system/lib/libc/musl/src/locale/iswupper_l.c +0 -6
  918. data/modules/emscripten/system/lib/libc/musl/src/locale/iswxdigit_l.c +0 -6
  919. data/modules/emscripten/system/lib/libc/musl/src/locale/jis0208.h +0 -550
  920. data/modules/emscripten/system/lib/libc/musl/src/locale/ksc.h +0 -640
  921. data/modules/emscripten/system/lib/libc/musl/src/locale/legacychars.h +0 -39
  922. data/modules/emscripten/system/lib/libc/musl/src/locale/strfmon.c +0 -101
  923. data/modules/emscripten/system/lib/libc/musl/src/locale/strxfrm.c +0 -18
  924. data/modules/emscripten/system/lib/libc/musl/src/locale/towctrans_l.c +0 -6
  925. data/modules/emscripten/system/lib/libc/musl/src/locale/towlower_l.c +0 -9
  926. data/modules/emscripten/system/lib/libc/musl/src/locale/towupper_l.c +0 -9
  927. data/modules/emscripten/system/lib/libc/musl/src/locale/wcscoll.c +0 -16
  928. data/modules/emscripten/system/lib/libc/musl/src/locale/wcscoll_l.c +0 -6
  929. data/modules/emscripten/system/lib/libc/musl/src/locale/wcsxfrm.c +0 -21
  930. data/modules/emscripten/system/lib/libc/musl/src/locale/wcsxfrm_l.c +0 -6
  931. data/modules/emscripten/system/lib/libc/musl/src/locale/wctrans_l.c +0 -6
  932. data/modules/emscripten/system/lib/libc/musl/src/locale/wctype_l.c +0 -9
  933. data/modules/emscripten/system/lib/libc/musl/src/multibyte/btowc.c +0 -7
  934. data/modules/emscripten/system/lib/libc/musl/src/multibyte/internal.c +0 -38
  935. data/modules/emscripten/system/lib/libc/musl/src/multibyte/internal.h +0 -22
  936. data/modules/emscripten/system/lib/libc/musl/src/multibyte/mblen.c +0 -17
  937. data/modules/emscripten/system/lib/libc/musl/src/multibyte/mbrlen.c +0 -18
  938. data/modules/emscripten/system/lib/libc/musl/src/multibyte/mbrtowc.c +0 -57
  939. data/modules/emscripten/system/lib/libc/musl/src/multibyte/mbsinit.c +0 -17
  940. data/modules/emscripten/system/lib/libc/musl/src/multibyte/mbsnrtowcs.c +0 -65
  941. data/modules/emscripten/system/lib/libc/musl/src/multibyte/mbsrtowcs.c +0 -100
  942. data/modules/emscripten/system/lib/libc/musl/src/multibyte/mbstowcs.c +0 -7
  943. data/modules/emscripten/system/lib/libc/musl/src/multibyte/mbtowc.c +0 -53
  944. data/modules/emscripten/system/lib/libc/musl/src/multibyte/wcrtomb.c +0 -38
  945. data/modules/emscripten/system/lib/libc/musl/src/multibyte/wcsnrtombs.c +0 -52
  946. data/modules/emscripten/system/lib/libc/musl/src/multibyte/wcsrtombs.c +0 -58
  947. data/modules/emscripten/system/lib/libc/musl/src/multibyte/wcstombs.c +0 -7
  948. data/modules/emscripten/system/lib/libc/musl/src/multibyte/wctob.c +0 -8
  949. data/modules/emscripten/system/lib/libc/musl/src/multibyte/wctomb.c +0 -18
  950. data/modules/emscripten/system/lib/libc/musl/src/regex/regcomp.c +0 -3352
  951. data/modules/emscripten/system/lib/libc/musl/src/regex/regerror.c +0 -35
  952. data/modules/emscripten/system/lib/libc/musl/src/regex/regexec.c +0 -1011
  953. data/modules/emscripten/system/lib/libc/musl/src/regex/tre-mem.c +0 -158
  954. data/modules/emscripten/system/lib/libc/musl/src/regex/tre.h +0 -231
  955. data/modules/emscripten/system/lib/libc/musl/src/stdio/fwprintf.c +0 -13
  956. data/modules/emscripten/system/lib/libc/musl/src/stdio/swprintf.c +0 -14
  957. data/modules/emscripten/system/lib/libc/musl/src/stdio/vfwprintf.c +0 -361
  958. data/modules/emscripten/system/lib/libc/musl/src/stdio/vswprintf.c +0 -53
  959. data/modules/emscripten/system/lib/libc/musl/src/stdio/vwprintf.c +0 -7
  960. data/modules/emscripten/system/lib/libc/musl/src/stdio/wprintf.c +0 -13
  961. data/modules/emscripten/system/lib/libc/musl/src/stdlib/ecvt.c +0 -19
  962. data/modules/emscripten/system/lib/libc/musl/src/stdlib/fcvt.c +0 -25
  963. data/modules/emscripten/system/lib/libc/musl/src/stdlib/gcvt.c +0 -8
  964. data/modules/emscripten/system/lib/libc/musl/src/string/wcpcpy.c +0 -6
  965. data/modules/emscripten/system/lib/libc/musl/src/string/wcpncpy.c +0 -6
  966. data/modules/emscripten/system/lib/libc/musl/src/string/wcscasecmp.c +0 -7
  967. data/modules/emscripten/system/lib/libc/musl/src/string/wcscasecmp_l.c +0 -6
  968. data/modules/emscripten/system/lib/libc/musl/src/string/wcscat.c +0 -7
  969. data/modules/emscripten/system/lib/libc/musl/src/string/wcschr.c +0 -8
  970. data/modules/emscripten/system/lib/libc/musl/src/string/wcscmp.c +0 -7
  971. data/modules/emscripten/system/lib/libc/musl/src/string/wcscpy.c +0 -8
  972. data/modules/emscripten/system/lib/libc/musl/src/string/wcscspn.c +0 -10
  973. data/modules/emscripten/system/lib/libc/musl/src/string/wcsdup.c +0 -11
  974. data/modules/emscripten/system/lib/libc/musl/src/string/wcslen.c +0 -8
  975. data/modules/emscripten/system/lib/libc/musl/src/string/wcsncasecmp.c +0 -9
  976. data/modules/emscripten/system/lib/libc/musl/src/string/wcsncasecmp_l.c +0 -6
  977. data/modules/emscripten/system/lib/libc/musl/src/string/wcsncat.c +0 -10
  978. data/modules/emscripten/system/lib/libc/musl/src/string/wcsncmp.c +0 -7
  979. data/modules/emscripten/system/lib/libc/musl/src/string/wcsncpy.c +0 -9
  980. data/modules/emscripten/system/lib/libc/musl/src/string/wcsnlen.c +0 -8
  981. data/modules/emscripten/system/lib/libc/musl/src/string/wcspbrk.c +0 -7
  982. data/modules/emscripten/system/lib/libc/musl/src/string/wcsrchr.c +0 -8
  983. data/modules/emscripten/system/lib/libc/musl/src/string/wcsspn.c +0 -8
  984. data/modules/emscripten/system/lib/libc/musl/src/string/wcsstr.c +0 -108
  985. data/modules/emscripten/system/lib/libc/musl/src/string/wcstok.c +0 -12
  986. data/modules/emscripten/system/lib/libc/musl/src/string/wcswcs.c +0 -6
  987. data/modules/emscripten/system/lib/libc/musl/src/string/wmemchr.c +0 -8
  988. data/modules/emscripten/system/lib/libc/musl/src/string/wmemcmp.c +0 -8
  989. data/modules/emscripten/system/lib/libc/musl/src/string/wmemcpy.c +0 -9
  990. data/modules/emscripten/system/lib/libc/musl/src/string/wmemmove.c +0 -12
  991. data/modules/emscripten/system/lib/libc/musl/src/string/wmemset.c +0 -9
  992. data/modules/emscripten/system/lib/libc/stdlib/getopt_long.c +0 -511
  993. data/modules/emscripten/system/lib/libc/stdlib/strtod.c +0 -305
  994. data/modules/emscripten/system/lib/libc.symbols +0 -81
  995. data/modules/emscripten/system/lib/libcextra.symbols +0 -115
  996. data/modules/emscripten/system/lib/libcxx/CREDITS.TXT +0 -123
  997. data/modules/emscripten/system/lib/libcxx/LICENSE.txt +0 -76
  998. data/modules/emscripten/system/lib/libcxx/algorithm.cpp +0 -84
  999. data/modules/emscripten/system/lib/libcxx/bind.cpp +0 -30
  1000. data/modules/emscripten/system/lib/libcxx/chrono.cpp +0 -132
  1001. data/modules/emscripten/system/lib/libcxx/condition_variable.cpp +0 -81
  1002. data/modules/emscripten/system/lib/libcxx/debug.cpp +0 -530
  1003. data/modules/emscripten/system/lib/libcxx/exception.cpp +0 -307
  1004. data/modules/emscripten/system/lib/libcxx/future.cpp +0 -291
  1005. data/modules/emscripten/system/lib/libcxx/hash.cpp +0 -570
  1006. data/modules/emscripten/system/lib/libcxx/ios.cpp +0 -460
  1007. data/modules/emscripten/system/lib/libcxx/iostream.cpp +0 -68
  1008. data/modules/emscripten/system/lib/libcxx/locale.cpp +0 -6169
  1009. data/modules/emscripten/system/lib/libcxx/memory.cpp +0 -223
  1010. data/modules/emscripten/system/lib/libcxx/mutex.cpp +0 -253
  1011. data/modules/emscripten/system/lib/libcxx/new.cpp +0 -239
  1012. data/modules/emscripten/system/lib/libcxx/optional.cpp +0 -25
  1013. data/modules/emscripten/system/lib/libcxx/random.cpp +0 -74
  1014. data/modules/emscripten/system/lib/libcxx/readme.txt +0 -1
  1015. data/modules/emscripten/system/lib/libcxx/regex.cpp +0 -325
  1016. data/modules/emscripten/system/lib/libcxx/shared_mutex.cpp +0 -101
  1017. data/modules/emscripten/system/lib/libcxx/stdexcept.cpp +0 -200
  1018. data/modules/emscripten/system/lib/libcxx/string.cpp +0 -530
  1019. data/modules/emscripten/system/lib/libcxx/strstream.cpp +0 -329
  1020. data/modules/emscripten/system/lib/libcxx/support/solaris/README +0 -4
  1021. data/modules/emscripten/system/lib/libcxx/support/solaris/mbsnrtowcs.inc +0 -76
  1022. data/modules/emscripten/system/lib/libcxx/support/solaris/wcsnrtombs.inc +0 -93
  1023. data/modules/emscripten/system/lib/libcxx/support/solaris/xlocale.c +0 -245
  1024. data/modules/emscripten/system/lib/libcxx/support/win32/locale_win32.cpp +0 -95
  1025. data/modules/emscripten/system/lib/libcxx/support/win32/support.cpp +0 -166
  1026. data/modules/emscripten/system/lib/libcxx/symbols +0 -2699
  1027. data/modules/emscripten/system/lib/libcxx/system_error.cpp +0 -205
  1028. data/modules/emscripten/system/lib/libcxx/thread.cpp +0 -225
  1029. data/modules/emscripten/system/lib/libcxx/typeinfo.cpp +0 -73
  1030. data/modules/emscripten/system/lib/libcxx/utility.cpp +0 -17
  1031. data/modules/emscripten/system/lib/libcxx/valarray.cpp +0 -56
  1032. data/modules/emscripten/system/lib/libcxxabi/CREDITS.TXT +0 -38
  1033. data/modules/emscripten/system/lib/libcxxabi/LICENSE.TXT +0 -76
  1034. data/modules/emscripten/system/lib/libcxxabi/include/cxa_demangle.h +0 -167
  1035. data/modules/emscripten/system/lib/libcxxabi/include/cxxabi.h +0 -175
  1036. data/modules/emscripten/system/lib/libcxxabi/lib/buildit +0 -99
  1037. data/modules/emscripten/system/lib/libcxxabi/readme.txt +0 -1
  1038. data/modules/emscripten/system/lib/libcxxabi/src/abort_message.cpp +0 -50
  1039. data/modules/emscripten/system/lib/libcxxabi/src/abort_message.h +0 -33
  1040. data/modules/emscripten/system/lib/libcxxabi/src/cxa_aux_runtime.cpp +0 -34
  1041. data/modules/emscripten/system/lib/libcxxabi/src/cxa_demangle.cpp +0 -11036
  1042. data/modules/emscripten/system/lib/libcxxabi/src/cxa_exception.cpp +0 -622
  1043. data/modules/emscripten/system/lib/libcxxabi/src/cxa_exception.hpp +0 -123
  1044. data/modules/emscripten/system/lib/libcxxabi/src/cxa_exception_storage.cpp +0 -91
  1045. data/modules/emscripten/system/lib/libcxxabi/src/cxa_guard.cpp +0 -231
  1046. data/modules/emscripten/system/lib/libcxxabi/src/cxa_handlers.cpp +0 -125
  1047. data/modules/emscripten/system/lib/libcxxabi/src/cxa_handlers.hpp +0 -54
  1048. data/modules/emscripten/system/lib/libcxxabi/src/cxa_new_delete.cpp +0 -242
  1049. data/modules/emscripten/system/lib/libcxxabi/src/cxa_personality.cpp +0 -1055
  1050. data/modules/emscripten/system/lib/libcxxabi/src/cxa_unexpected.cpp +0 -27
  1051. data/modules/emscripten/system/lib/libcxxabi/src/cxa_vector.cpp +0 -367
  1052. data/modules/emscripten/system/lib/libcxxabi/src/cxa_virtual.cpp +0 -31
  1053. data/modules/emscripten/system/lib/libcxxabi/src/exception.cpp +0 -41
  1054. data/modules/emscripten/system/lib/libcxxabi/src/fallback_malloc.ipp +0 -174
  1055. data/modules/emscripten/system/lib/libcxxabi/src/private_typeinfo.cpp +0 -1146
  1056. data/modules/emscripten/system/lib/libcxxabi/src/private_typeinfo.h +0 -248
  1057. data/modules/emscripten/system/lib/libcxxabi/src/stdexcept.cpp +0 -169
  1058. data/modules/emscripten/system/lib/libcxxabi/src/typeinfo.cpp +0 -53
  1059. data/modules/emscripten/system/lib/libcxxabi/symbols +0 -236
  1060. data/modules/emscripten/system/lib/sdl.cpp +0 -13
  1061. data/modules/emscripten/system/lib/sdl.symbols +0 -1
  1062. data/modules/emscripten/third_party/CppHeaderParser/CppHeaderParser/CppHeaderParser.py +0 -2347
  1063. data/modules/emscripten/third_party/CppHeaderParser/CppHeaderParser/__init__.py +0 -4
  1064. data/modules/emscripten/third_party/CppHeaderParser/CppHeaderParser/doc/CppHeaderParser.html +0 -657
  1065. data/modules/emscripten/third_party/CppHeaderParser/CppHeaderParser/examples/SampleClass.h +0 -147
  1066. data/modules/emscripten/third_party/CppHeaderParser/CppHeaderParser/examples/readSampleClass.py +0 -74
  1067. data/modules/emscripten/third_party/CppHeaderParser/PKG-INFO +0 -249
  1068. data/modules/emscripten/third_party/CppHeaderParser/README.html +0 -544
  1069. data/modules/emscripten/third_party/CppHeaderParser/README.txt +0 -226
  1070. data/modules/emscripten/third_party/CppHeaderParser/setup.py +0 -43
  1071. data/modules/emscripten/third_party/ansidecl.h +0 -371
  1072. data/modules/emscripten/third_party/closure-compiler/COPYING +0 -202
  1073. data/modules/emscripten/third_party/closure-compiler/README +0 -292
  1074. data/modules/emscripten/third_party/closure-compiler/compiler.jar +0 -0
  1075. data/modules/emscripten/third_party/closure-compiler/readme.txt +0 -3
  1076. data/modules/emscripten/third_party/cp-demangle.h +0 -161
  1077. data/modules/emscripten/third_party/demangle.h +0 -549
  1078. data/modules/emscripten/third_party/demangler.py +0 -49
  1079. data/modules/emscripten/third_party/gcc_demangler.c +0 -4226
  1080. data/modules/emscripten/third_party/gcc_demangler.js +0 -21282
  1081. data/modules/emscripten/third_party/jni/emjvm.cpp +0 -133
  1082. data/modules/emscripten/third_party/jni/emjvm.h +0 -8
  1083. data/modules/emscripten/third_party/jni/emjvm.js +0 -185
  1084. data/modules/emscripten/third_party/jni/jni.h +0 -1154
  1085. data/modules/emscripten/third_party/libiberty.h +0 -634
  1086. data/modules/emscripten/third_party/lzma.js/README.markdown +0 -37
  1087. data/modules/emscripten/third_party/lzma.js/doit.bat +0 -4
  1088. data/modules/emscripten/third_party/lzma.js/doit.sh +0 -44
  1089. data/modules/emscripten/third_party/lzma.js/lzip/AUTHORS +0 -7
  1090. data/modules/emscripten/third_party/lzma.js/lzip/COPYING +0 -676
  1091. data/modules/emscripten/third_party/lzma.js/lzip/ChangeLog +0 -201
  1092. data/modules/emscripten/third_party/lzma.js/lzip/INSTALL +0 -56
  1093. data/modules/emscripten/third_party/lzma.js/lzip/Makefile +0 -160
  1094. data/modules/emscripten/third_party/lzma.js/lzip/Makefile.in +0 -138
  1095. data/modules/emscripten/third_party/lzma.js/lzip/NEWS +0 -22
  1096. data/modules/emscripten/third_party/lzma.js/lzip/README +0 -77
  1097. data/modules/emscripten/third_party/lzma.js/lzip/arg_parser.cc +0 -204
  1098. data/modules/emscripten/third_party/lzma.js/lzip/arg_parser.h +0 -106
  1099. data/modules/emscripten/third_party/lzma.js/lzip/configure +0 -192
  1100. data/modules/emscripten/third_party/lzma.js/lzip/decoder.cc +0 -252
  1101. data/modules/emscripten/third_party/lzma.js/lzip/decoder.h +0 -268
  1102. data/modules/emscripten/third_party/lzma.js/lzip/encoder.cc +0 -643
  1103. data/modules/emscripten/third_party/lzma.js/lzip/encoder.h +0 -582
  1104. data/modules/emscripten/third_party/lzma.js/lzip/fast_encoder.cc +0 -378
  1105. data/modules/emscripten/third_party/lzma.js/lzip/fast_encoder.h +0 -171
  1106. data/modules/emscripten/third_party/lzma.js/lzip/lzip.h +0 -264
  1107. data/modules/emscripten/third_party/lzma.js/lzip/main.cc +0 -545
  1108. data/modules/emscripten/third_party/lzma.js/lzma-decoder.js +0 -27
  1109. data/modules/emscripten/third_party/lzma.js/lzma-full.js +0 -27
  1110. data/modules/emscripten/third_party/lzma.js/native_test.sh +0 -5
  1111. data/modules/emscripten/third_party/lzma.js/post.js +0 -13
  1112. data/modules/emscripten/third_party/lzma.js/pre.js +0 -13
  1113. data/modules/emscripten/third_party/lzma.js/test-decoder.js +0 -39
  1114. data/modules/emscripten/third_party/lzma.js/test-full.html +0 -9
  1115. data/modules/emscripten/third_party/lzma.js/test-full.js +0 -78
  1116. data/modules/emscripten/third_party/ply/ANNOUNCE +0 -40
  1117. data/modules/emscripten/third_party/ply/CHANGES +0 -1093
  1118. data/modules/emscripten/third_party/ply/PKG-INFO +0 -22
  1119. data/modules/emscripten/third_party/ply/README +0 -271
  1120. data/modules/emscripten/third_party/ply/TODO +0 -16
  1121. data/modules/emscripten/third_party/ply/doc/internal.html +0 -874
  1122. data/modules/emscripten/third_party/ply/doc/makedoc.py +0 -194
  1123. data/modules/emscripten/third_party/ply/doc/ply.html +0 -3262
  1124. data/modules/emscripten/third_party/ply/example/BASIC/README +0 -79
  1125. data/modules/emscripten/third_party/ply/example/BASIC/basic.py +0 -71
  1126. data/modules/emscripten/third_party/ply/example/BASIC/basiclex.py +0 -74
  1127. data/modules/emscripten/third_party/ply/example/BASIC/basiclog.py +0 -79
  1128. data/modules/emscripten/third_party/ply/example/BASIC/basinterp.py +0 -441
  1129. data/modules/emscripten/third_party/ply/example/BASIC/basparse.py +0 -424
  1130. data/modules/emscripten/third_party/ply/example/BASIC/dim.bas +0 -14
  1131. data/modules/emscripten/third_party/ply/example/BASIC/func.bas +0 -5
  1132. data/modules/emscripten/third_party/ply/example/BASIC/gcd.bas +0 -22
  1133. data/modules/emscripten/third_party/ply/example/BASIC/gosub.bas +0 -13
  1134. data/modules/emscripten/third_party/ply/example/BASIC/hello.bas +0 -4
  1135. data/modules/emscripten/third_party/ply/example/BASIC/linear.bas +0 -17
  1136. data/modules/emscripten/third_party/ply/example/BASIC/maxsin.bas +0 -12
  1137. data/modules/emscripten/third_party/ply/example/BASIC/powers.bas +0 -13
  1138. data/modules/emscripten/third_party/ply/example/BASIC/rand.bas +0 -4
  1139. data/modules/emscripten/third_party/ply/example/BASIC/sales.bas +0 -20
  1140. data/modules/emscripten/third_party/ply/example/BASIC/sears.bas +0 -18
  1141. data/modules/emscripten/third_party/ply/example/BASIC/sqrt1.bas +0 -5
  1142. data/modules/emscripten/third_party/ply/example/BASIC/sqrt2.bas +0 -4
  1143. data/modules/emscripten/third_party/ply/example/GardenSnake/GardenSnake.py +0 -709
  1144. data/modules/emscripten/third_party/ply/example/GardenSnake/README +0 -5
  1145. data/modules/emscripten/third_party/ply/example/README +0 -10
  1146. data/modules/emscripten/third_party/ply/example/ansic/README +0 -2
  1147. data/modules/emscripten/third_party/ply/example/ansic/clex.py +0 -164
  1148. data/modules/emscripten/third_party/ply/example/ansic/cparse.py +0 -863
  1149. data/modules/emscripten/third_party/ply/example/calc/calc.py +0 -107
  1150. data/modules/emscripten/third_party/ply/example/calcdebug/calc.py +0 -113
  1151. data/modules/emscripten/third_party/ply/example/classcalc/calc.py +0 -157
  1152. data/modules/emscripten/third_party/ply/example/cleanup.sh +0 -2
  1153. data/modules/emscripten/third_party/ply/example/closurecalc/calc.py +0 -130
  1154. data/modules/emscripten/third_party/ply/example/hedit/hedit.py +0 -48
  1155. data/modules/emscripten/third_party/ply/example/newclasscalc/calc.py +0 -160
  1156. data/modules/emscripten/third_party/ply/example/optcalc/README +0 -9
  1157. data/modules/emscripten/third_party/ply/example/optcalc/calc.py +0 -119
  1158. data/modules/emscripten/third_party/ply/example/unicalc/calc.py +0 -117
  1159. data/modules/emscripten/third_party/ply/example/yply/README +0 -41
  1160. data/modules/emscripten/third_party/ply/example/yply/ylex.py +0 -112
  1161. data/modules/emscripten/third_party/ply/example/yply/yparse.py +0 -217
  1162. data/modules/emscripten/third_party/ply/example/yply/yply.py +0 -53
  1163. data/modules/emscripten/third_party/ply/ply/__init__.py +0 -4
  1164. data/modules/emscripten/third_party/ply/ply/cpp.py +0 -898
  1165. data/modules/emscripten/third_party/ply/ply/ctokens.py +0 -133
  1166. data/modules/emscripten/third_party/ply/ply/lex.py +0 -1058
  1167. data/modules/emscripten/third_party/ply/ply/yacc.py +0 -3276
  1168. data/modules/emscripten/third_party/ply/setup.py +0 -31
  1169. data/modules/emscripten/third_party/ply/test/README +0 -7
  1170. data/modules/emscripten/third_party/ply/test/calclex.py +0 -49
  1171. data/modules/emscripten/third_party/ply/test/cleanup.sh +0 -4
  1172. data/modules/emscripten/third_party/ply/test/lex_closure.py +0 -54
  1173. data/modules/emscripten/third_party/ply/test/lex_doc1.py +0 -26
  1174. data/modules/emscripten/third_party/ply/test/lex_dup1.py +0 -29
  1175. data/modules/emscripten/third_party/ply/test/lex_dup2.py +0 -33
  1176. data/modules/emscripten/third_party/ply/test/lex_dup3.py +0 -31
  1177. data/modules/emscripten/third_party/ply/test/lex_empty.py +0 -20
  1178. data/modules/emscripten/third_party/ply/test/lex_error1.py +0 -24
  1179. data/modules/emscripten/third_party/ply/test/lex_error2.py +0 -26
  1180. data/modules/emscripten/third_party/ply/test/lex_error3.py +0 -27
  1181. data/modules/emscripten/third_party/ply/test/lex_error4.py +0 -27
  1182. data/modules/emscripten/third_party/ply/test/lex_hedit.py +0 -47
  1183. data/modules/emscripten/third_party/ply/test/lex_ignore.py +0 -31
  1184. data/modules/emscripten/third_party/ply/test/lex_ignore2.py +0 -29
  1185. data/modules/emscripten/third_party/ply/test/lex_literal1.py +0 -25
  1186. data/modules/emscripten/third_party/ply/test/lex_literal2.py +0 -25
  1187. data/modules/emscripten/third_party/ply/test/lex_many_tokens.py +0 -27
  1188. data/modules/emscripten/third_party/ply/test/lex_module.py +0 -10
  1189. data/modules/emscripten/third_party/ply/test/lex_module_import.py +0 -42
  1190. data/modules/emscripten/third_party/ply/test/lex_object.py +0 -55
  1191. data/modules/emscripten/third_party/ply/test/lex_opt_alias.py +0 -54
  1192. data/modules/emscripten/third_party/ply/test/lex_optimize.py +0 -50
  1193. data/modules/emscripten/third_party/ply/test/lex_optimize2.py +0 -50
  1194. data/modules/emscripten/third_party/ply/test/lex_optimize3.py +0 -52
  1195. data/modules/emscripten/third_party/ply/test/lex_re1.py +0 -27
  1196. data/modules/emscripten/third_party/ply/test/lex_re2.py +0 -27
  1197. data/modules/emscripten/third_party/ply/test/lex_re3.py +0 -29
  1198. data/modules/emscripten/third_party/ply/test/lex_rule1.py +0 -27
  1199. data/modules/emscripten/third_party/ply/test/lex_rule2.py +0 -29
  1200. data/modules/emscripten/third_party/ply/test/lex_rule3.py +0 -27
  1201. data/modules/emscripten/third_party/ply/test/lex_state1.py +0 -40
  1202. data/modules/emscripten/third_party/ply/test/lex_state2.py +0 -40
  1203. data/modules/emscripten/third_party/ply/test/lex_state3.py +0 -42
  1204. data/modules/emscripten/third_party/ply/test/lex_state4.py +0 -41
  1205. data/modules/emscripten/third_party/ply/test/lex_state5.py +0 -40
  1206. data/modules/emscripten/third_party/ply/test/lex_state_noerror.py +0 -39
  1207. data/modules/emscripten/third_party/ply/test/lex_state_norule.py +0 -40
  1208. data/modules/emscripten/third_party/ply/test/lex_state_try.py +0 -45
  1209. data/modules/emscripten/third_party/ply/test/lex_token1.py +0 -19
  1210. data/modules/emscripten/third_party/ply/test/lex_token2.py +0 -22
  1211. data/modules/emscripten/third_party/ply/test/lex_token3.py +0 -24
  1212. data/modules/emscripten/third_party/ply/test/lex_token4.py +0 -26
  1213. data/modules/emscripten/third_party/ply/test/lex_token5.py +0 -31
  1214. data/modules/emscripten/third_party/ply/test/lex_token_dup.py +0 -29
  1215. data/modules/emscripten/third_party/ply/test/testlex.py +0 -606
  1216. data/modules/emscripten/third_party/ply/test/testyacc.py +0 -347
  1217. data/modules/emscripten/third_party/ply/test/yacc_badargs.py +0 -68
  1218. data/modules/emscripten/third_party/ply/test/yacc_badid.py +0 -77
  1219. data/modules/emscripten/third_party/ply/test/yacc_badprec.py +0 -64
  1220. data/modules/emscripten/third_party/ply/test/yacc_badprec2.py +0 -68
  1221. data/modules/emscripten/third_party/ply/test/yacc_badprec3.py +0 -68
  1222. data/modules/emscripten/third_party/ply/test/yacc_badrule.py +0 -68
  1223. data/modules/emscripten/third_party/ply/test/yacc_badtok.py +0 -68
  1224. data/modules/emscripten/third_party/ply/test/yacc_dup.py +0 -68
  1225. data/modules/emscripten/third_party/ply/test/yacc_error1.py +0 -68
  1226. data/modules/emscripten/third_party/ply/test/yacc_error2.py +0 -68
  1227. data/modules/emscripten/third_party/ply/test/yacc_error3.py +0 -67
  1228. data/modules/emscripten/third_party/ply/test/yacc_error4.py +0 -72
  1229. data/modules/emscripten/third_party/ply/test/yacc_inf.py +0 -56
  1230. data/modules/emscripten/third_party/ply/test/yacc_literal.py +0 -69
  1231. data/modules/emscripten/third_party/ply/test/yacc_misplaced.py +0 -68
  1232. data/modules/emscripten/third_party/ply/test/yacc_missing1.py +0 -68
  1233. data/modules/emscripten/third_party/ply/test/yacc_nested.py +0 -33
  1234. data/modules/emscripten/third_party/ply/test/yacc_nodoc.py +0 -67
  1235. data/modules/emscripten/third_party/ply/test/yacc_noerror.py +0 -66
  1236. data/modules/emscripten/third_party/ply/test/yacc_nop.py +0 -68
  1237. data/modules/emscripten/third_party/ply/test/yacc_notfunc.py +0 -66
  1238. data/modules/emscripten/third_party/ply/test/yacc_notok.py +0 -67
  1239. data/modules/emscripten/third_party/ply/test/yacc_prec1.py +0 -68
  1240. data/modules/emscripten/third_party/ply/test/yacc_rr.py +0 -72
  1241. data/modules/emscripten/third_party/ply/test/yacc_rr_unused.py +0 -30
  1242. data/modules/emscripten/third_party/ply/test/yacc_simple.py +0 -68
  1243. data/modules/emscripten/third_party/ply/test/yacc_sr.py +0 -63
  1244. data/modules/emscripten/third_party/ply/test/yacc_term1.py +0 -68
  1245. data/modules/emscripten/third_party/ply/test/yacc_unused.py +0 -77
  1246. data/modules/emscripten/third_party/ply/test/yacc_unused_rule.py +0 -72
  1247. data/modules/emscripten/third_party/ply/test/yacc_uprec.py +0 -63
  1248. data/modules/emscripten/third_party/ply/test/yacc_uprec2.py +0 -63
  1249. data/modules/emscripten/third_party/readme.txt +0 -7
  1250. data/modules/emscripten/third_party/stb_image.c +0 -4673
  1251. data/modules/emscripten/third_party/websockify/CHANGES.txt +0 -23
  1252. data/modules/emscripten/third_party/websockify/LICENSE.txt +0 -16
  1253. data/modules/emscripten/third_party/websockify/MANIFEST.in +0 -1
  1254. data/modules/emscripten/third_party/websockify/Makefile +0 -11
  1255. data/modules/emscripten/third_party/websockify/README.md +0 -168
  1256. data/modules/emscripten/third_party/websockify/Windows/Windows Service Readme.txt +0 -39
  1257. data/modules/emscripten/third_party/websockify/Windows/noVNC Websocket Service Project/Program.cs +0 -24
  1258. data/modules/emscripten/third_party/websockify/Windows/noVNC Websocket Service Project/ProjectInstaller.Designer.cs +0 -61
  1259. data/modules/emscripten/third_party/websockify/Windows/noVNC Websocket Service Project/ProjectInstaller.cs +0 -19
  1260. data/modules/emscripten/third_party/websockify/Windows/noVNC Websocket Service Project/ProjectInstaller.resx +0 -129
  1261. data/modules/emscripten/third_party/websockify/Windows/noVNC Websocket Service Project/Properties/AssemblyInfo.cs +0 -36
  1262. data/modules/emscripten/third_party/websockify/Windows/noVNC Websocket Service Project/Service1.Designer.cs +0 -37
  1263. data/modules/emscripten/third_party/websockify/Windows/noVNC Websocket Service Project/Service1.cs +0 -41
  1264. data/modules/emscripten/third_party/websockify/Windows/noVNC Websocket Service Project/noVNC Websocket.csproj +0 -75
  1265. data/modules/emscripten/third_party/websockify/Windows/noVNC Websocket Service Project/noVNC Websocket.sln +0 -20
  1266. data/modules/emscripten/third_party/websockify/docs/LICENSE.GPL-3 +0 -621
  1267. data/modules/emscripten/third_party/websockify/docs/LICENSE.LGPL-3 +0 -165
  1268. data/modules/emscripten/third_party/websockify/docs/LICENSE.MPL-2.0 +0 -373
  1269. data/modules/emscripten/third_party/websockify/docs/TODO +0 -9
  1270. data/modules/emscripten/third_party/websockify/docs/flash_policy.txt +0 -4
  1271. data/modules/emscripten/third_party/websockify/docs/latency_results.txt +0 -114
  1272. data/modules/emscripten/third_party/websockify/docs/notes +0 -17
  1273. data/modules/emscripten/third_party/websockify/docs/release.txt +0 -9
  1274. data/modules/emscripten/third_party/websockify/docs/websockify.1 +0 -110
  1275. data/modules/emscripten/third_party/websockify/include/VT100.js +0 -919
  1276. data/modules/emscripten/third_party/websockify/include/base64.js +0 -114
  1277. data/modules/emscripten/third_party/websockify/include/keysym.js +0 -99
  1278. data/modules/emscripten/third_party/websockify/include/util.js +0 -359
  1279. data/modules/emscripten/third_party/websockify/include/web-socket-js/README.txt +0 -109
  1280. data/modules/emscripten/third_party/websockify/include/web-socket-js/WebSocketMain.swf +0 -0
  1281. data/modules/emscripten/third_party/websockify/include/web-socket-js/swfobject.js +0 -4
  1282. data/modules/emscripten/third_party/websockify/include/web-socket-js/web_socket.js +0 -391
  1283. data/modules/emscripten/third_party/websockify/include/websock.js +0 -422
  1284. data/modules/emscripten/third_party/websockify/include/webutil.js +0 -216
  1285. data/modules/emscripten/third_party/websockify/include/wsirc.js +0 -235
  1286. data/modules/emscripten/third_party/websockify/include/wstelnet.js +0 -335
  1287. data/modules/emscripten/third_party/websockify/other/Makefile +0 -14
  1288. data/modules/emscripten/third_party/websockify/other/README.md +0 -51
  1289. data/modules/emscripten/third_party/websockify/other/launch.sh +0 -108
  1290. data/modules/emscripten/third_party/websockify/other/project.clj +0 -13
  1291. data/modules/emscripten/third_party/websockify/other/websocket.c +0 -802
  1292. data/modules/emscripten/third_party/websockify/other/websocket.h +0 -84
  1293. data/modules/emscripten/third_party/websockify/other/websocket.rb +0 -456
  1294. data/modules/emscripten/third_party/websockify/other/websockify.c +0 -385
  1295. data/modules/emscripten/third_party/websockify/other/websockify.clj +0 -233
  1296. data/modules/emscripten/third_party/websockify/other/websockify.js +0 -196
  1297. data/modules/emscripten/third_party/websockify/other/websockify.rb +0 -171
  1298. data/modules/emscripten/third_party/websockify/other/wswrap +0 -22
  1299. data/modules/emscripten/third_party/websockify/rebind +0 -18
  1300. data/modules/emscripten/third_party/websockify/rebind.c +0 -94
  1301. data/modules/emscripten/third_party/websockify/run +0 -5
  1302. data/modules/emscripten/third_party/websockify/setup.py +0 -30
  1303. data/modules/emscripten/third_party/websockify/tests/b64_vs_utf8.py +0 -29
  1304. data/modules/emscripten/third_party/websockify/tests/base64.html +0 -91
  1305. data/modules/emscripten/third_party/websockify/tests/base64.js +0 -12
  1306. data/modules/emscripten/third_party/websockify/tests/echo.html +0 -148
  1307. data/modules/emscripten/third_party/websockify/tests/echo.py +0 -75
  1308. data/modules/emscripten/third_party/websockify/tests/echo.rb +0 -62
  1309. data/modules/emscripten/third_party/websockify/tests/latency.html +0 -290
  1310. data/modules/emscripten/third_party/websockify/tests/latency.py +0 -75
  1311. data/modules/emscripten/third_party/websockify/tests/load.html +0 -250
  1312. data/modules/emscripten/third_party/websockify/tests/load.py +0 -167
  1313. data/modules/emscripten/third_party/websockify/tests/plain_echo.html +0 -168
  1314. data/modules/emscripten/third_party/websockify/tests/simple.html +0 -68
  1315. data/modules/emscripten/third_party/websockify/tests/utf8-list.py +0 -22
  1316. data/modules/emscripten/third_party/websockify/websockify/__init__.py +0 -2
  1317. data/modules/emscripten/third_party/websockify/websockify/websocket.py +0 -982
  1318. data/modules/emscripten/third_party/websockify/websockify/websocketproxy.py +0 -393
  1319. data/modules/emscripten/third_party/websockify/websockify.py +0 -5
  1320. data/modules/emscripten/third_party/websockify/wsirc.html +0 -99
  1321. data/modules/emscripten/third_party/websockify/wstelnet.html +0 -74
  1322. data/modules/emscripten/tools/__init__.py +0 -0
  1323. data/modules/emscripten/tools/asm_module.py +0 -275
  1324. data/modules/emscripten/tools/autodebugger.py +0 -291
  1325. data/modules/emscripten/tools/autodebugger_c.py +0 -37
  1326. data/modules/emscripten/tools/autodebugger_indenter.py +0 -18
  1327. data/modules/emscripten/tools/autodebugger_js.py +0 -47
  1328. data/modules/emscripten/tools/autodediffer.py +0 -60
  1329. data/modules/emscripten/tools/bindings_generator.py +0 -832
  1330. data/modules/emscripten/tools/bisect_pair.py +0 -88
  1331. data/modules/emscripten/tools/cache.py +0 -196
  1332. data/modules/emscripten/tools/clean_webconsole.py +0 -34
  1333. data/modules/emscripten/tools/crunch-worker.js +0 -124
  1334. data/modules/emscripten/tools/diff_autodebugger.py +0 -15
  1335. data/modules/emscripten/tools/eliminator/asm-eliminator-test-output.js +0 -307
  1336. data/modules/emscripten/tools/eliminator/asm-eliminator-test.js +0 -382
  1337. data/modules/emscripten/tools/eliminator/eliminator-test-output.js +0 -6136
  1338. data/modules/emscripten/tools/eliminator/eliminator-test.js +0 -8879
  1339. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/README.html +0 -888
  1340. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/README.org +0 -463
  1341. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/bin/uglifyjs +0 -317
  1342. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/docstyle.css +0 -75
  1343. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/lib/object-ast.js +0 -75
  1344. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/lib/parse-js.js +0 -1363
  1345. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/lib/process.js +0 -2005
  1346. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/lib/squeeze-more.js +0 -51
  1347. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/package.json +0 -22
  1348. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/beautify.js +0 -28
  1349. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/testparser.js +0 -402
  1350. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/array1.js +0 -1
  1351. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/array2.js +0 -1
  1352. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/array3.js +0 -1
  1353. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/array4.js +0 -1
  1354. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/assignment.js +0 -1
  1355. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/concatstring.js +0 -1
  1356. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/const.js +0 -1
  1357. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/empty-blocks.js +0 -1
  1358. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/forstatement.js +0 -1
  1359. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/if.js +0 -1
  1360. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/ifreturn.js +0 -1
  1361. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/ifreturn2.js +0 -1
  1362. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue10.js +0 -1
  1363. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue11.js +0 -1
  1364. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue13.js +0 -1
  1365. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue14.js +0 -1
  1366. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue16.js +0 -1
  1367. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue17.js +0 -1
  1368. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue20.js +0 -1
  1369. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue21.js +0 -1
  1370. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue25.js +0 -1
  1371. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue27.js +0 -1
  1372. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue28.js +0 -1
  1373. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue29.js +0 -1
  1374. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue30.js +0 -1
  1375. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue34.js +0 -1
  1376. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue4.js +0 -1
  1377. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue48.js +0 -1
  1378. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue50.js +0 -1
  1379. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue53.js +0 -1
  1380. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue54.1.js +0 -1
  1381. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue68.js +0 -1
  1382. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue69.js +0 -1
  1383. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue9.js +0 -1
  1384. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/mangle.js +0 -1
  1385. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/strict-equals.js +0 -1
  1386. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/var.js +0 -1
  1387. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/with.js +0 -1
  1388. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/array1.js +0 -3
  1389. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/array2.js +0 -4
  1390. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/array3.js +0 -4
  1391. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/array4.js +0 -6
  1392. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/assignment.js +0 -20
  1393. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/concatstring.js +0 -3
  1394. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/const.js +0 -5
  1395. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/empty-blocks.js +0 -4
  1396. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/forstatement.js +0 -10
  1397. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/if.js +0 -6
  1398. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/ifreturn.js +0 -9
  1399. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/ifreturn2.js +0 -16
  1400. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue10.js +0 -1
  1401. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue11.js +0 -3
  1402. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue13.js +0 -1
  1403. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue14.js +0 -1
  1404. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue16.js +0 -1
  1405. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue17.js +0 -4
  1406. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue20.js +0 -1
  1407. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue21.js +0 -6
  1408. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue25.js +0 -7
  1409. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue27.js +0 -1
  1410. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue28.js +0 -3
  1411. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue29.js +0 -1
  1412. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue30.js +0 -3
  1413. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue34.js +0 -3
  1414. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue4.js +0 -3
  1415. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue48.js +0 -1
  1416. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue50.js +0 -9
  1417. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue53.js +0 -1
  1418. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue54.1.js +0 -3
  1419. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue68.js +0 -5
  1420. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue69.js +0 -1
  1421. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue9.js +0 -4
  1422. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/mangle.js +0 -5
  1423. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/strict-equals.js +0 -3
  1424. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/var.js +0 -3
  1425. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/with.js +0 -2
  1426. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/scripts.js +0 -55
  1427. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/tmp/hoist.js +0 -33
  1428. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/tmp/instrument.js +0 -97
  1429. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/tmp/instrument2.js +0 -138
  1430. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/tmp/test.js +0 -16
  1431. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/uglify-js.js +0 -17
  1432. data/modules/emscripten/tools/eliminator/safe-eliminator-test-output.js +0 -85
  1433. data/modules/emscripten/tools/eliminator/safe-eliminator-test.js +0 -103
  1434. data/modules/emscripten/tools/emconfiguren.py +0 -19
  1435. data/modules/emscripten/tools/emmaken.py +0 -230
  1436. data/modules/emscripten/tools/emmakenxx.py +0 -18
  1437. data/modules/emscripten/tools/exec_llvm.py +0 -50
  1438. data/modules/emscripten/tools/file2json.py +0 -49
  1439. data/modules/emscripten/tools/file_packager.py +0 -719
  1440. data/modules/emscripten/tools/find_bigfuncs.py +0 -23
  1441. data/modules/emscripten/tools/find_bigis.py +0 -18
  1442. data/modules/emscripten/tools/find_bigvars.py +0 -24
  1443. data/modules/emscripten/tools/fix_closure.py +0 -88
  1444. data/modules/emscripten/tools/gen_struct_info.py +0 -509
  1445. data/modules/emscripten/tools/ie7_fix.py +0 -14
  1446. data/modules/emscripten/tools/js-optimizer.js +0 -4023
  1447. data/modules/emscripten/tools/js_optimizer.py +0 -357
  1448. data/modules/emscripten/tools/jsrun.py +0 -37
  1449. data/modules/emscripten/tools/ll-strip.py +0 -56
  1450. data/modules/emscripten/tools/make_file.py +0 -19
  1451. data/modules/emscripten/tools/make_minigzip.py +0 -13
  1452. data/modules/emscripten/tools/merge_asm.py +0 -26
  1453. data/modules/emscripten/tools/namespacer.py +0 -95
  1454. data/modules/emscripten/tools/nativize_llvm.py +0 -34
  1455. data/modules/emscripten/tools/node_modules/source-map/CHANGELOG.md +0 -58
  1456. data/modules/emscripten/tools/node_modules/source-map/LICENSE +0 -28
  1457. data/modules/emscripten/tools/node_modules/source-map/Makefile.dryice.js +0 -166
  1458. data/modules/emscripten/tools/node_modules/source-map/README.md +0 -347
  1459. data/modules/emscripten/tools/node_modules/source-map/build/assert-shim.js +0 -56
  1460. data/modules/emscripten/tools/node_modules/source-map/build/mini-require.js +0 -152
  1461. data/modules/emscripten/tools/node_modules/source-map/build/prefix-source-map.jsm +0 -20
  1462. data/modules/emscripten/tools/node_modules/source-map/build/prefix-utils.jsm +0 -18
  1463. data/modules/emscripten/tools/node_modules/source-map/build/suffix-browser.js +0 -8
  1464. data/modules/emscripten/tools/node_modules/source-map/build/suffix-source-map.jsm +0 -6
  1465. data/modules/emscripten/tools/node_modules/source-map/build/suffix-utils.jsm +0 -21
  1466. data/modules/emscripten/tools/node_modules/source-map/build/test-prefix.js +0 -8
  1467. data/modules/emscripten/tools/node_modules/source-map/build/test-suffix.js +0 -3
  1468. data/modules/emscripten/tools/node_modules/source-map/lib/source-map/array-set.js +0 -96
  1469. data/modules/emscripten/tools/node_modules/source-map/lib/source-map/base64-vlq.js +0 -144
  1470. data/modules/emscripten/tools/node_modules/source-map/lib/source-map/base64.js +0 -42
  1471. data/modules/emscripten/tools/node_modules/source-map/lib/source-map/binary-search.js +0 -81
  1472. data/modules/emscripten/tools/node_modules/source-map/lib/source-map/source-map-consumer.js +0 -430
  1473. data/modules/emscripten/tools/node_modules/source-map/lib/source-map/source-map-generator.js +0 -381
  1474. data/modules/emscripten/tools/node_modules/source-map/lib/source-map/source-node.js +0 -353
  1475. data/modules/emscripten/tools/node_modules/source-map/lib/source-map/util.js +0 -117
  1476. data/modules/emscripten/tools/node_modules/source-map/lib/source-map.js +0 -8
  1477. data/modules/emscripten/tools/node_modules/source-map/node_modules/amdefine/LICENSE +0 -58
  1478. data/modules/emscripten/tools/node_modules/source-map/node_modules/amdefine/README.md +0 -119
  1479. data/modules/emscripten/tools/node_modules/source-map/node_modules/amdefine/amdefine.js +0 -299
  1480. data/modules/emscripten/tools/node_modules/source-map/node_modules/amdefine/package.json +0 -33
  1481. data/modules/emscripten/tools/node_modules/source-map/package.json +0 -74
  1482. data/modules/emscripten/tools/node_modules/source-map/test/run-tests.js +0 -73
  1483. data/modules/emscripten/tools/node_modules/source-map/test/source-map/test-api.js +0 -26
  1484. data/modules/emscripten/tools/node_modules/source-map/test/source-map/test-array-set.js +0 -71
  1485. data/modules/emscripten/tools/node_modules/source-map/test/source-map/test-base64-vlq.js +0 -24
  1486. data/modules/emscripten/tools/node_modules/source-map/test/source-map/test-base64.js +0 -35
  1487. data/modules/emscripten/tools/node_modules/source-map/test/source-map/test-binary-search.js +0 -54
  1488. data/modules/emscripten/tools/node_modules/source-map/test/source-map/test-dog-fooding.js +0 -72
  1489. data/modules/emscripten/tools/node_modules/source-map/test/source-map/test-source-map-consumer.js +0 -306
  1490. data/modules/emscripten/tools/node_modules/source-map/test/source-map/test-source-map-generator.js +0 -391
  1491. data/modules/emscripten/tools/node_modules/source-map/test/source-map/test-source-node.js +0 -282
  1492. data/modules/emscripten/tools/node_modules/source-map/test/source-map/util.js +0 -152
  1493. data/modules/emscripten/tools/reproduceriter.js +0 -216
  1494. data/modules/emscripten/tools/reproduceriter.py +0 -160
  1495. data/modules/emscripten/tools/response_file.py +0 -34
  1496. data/modules/emscripten/tools/scan_js.py +0 -20
  1497. data/modules/emscripten/tools/scan_ll.py +0 -18
  1498. data/modules/emscripten/tools/scons/site_scons/site_tools/emscripten/__init__.py +0 -3
  1499. data/modules/emscripten/tools/scons/site_scons/site_tools/emscripten/emscripten.py +0 -46
  1500. data/modules/emscripten/tools/settings_template_readonly.py +0 -49
  1501. data/modules/emscripten/tools/shared.py +0 -1705
  1502. data/modules/emscripten/tools/source-maps/sourcemap2json.js +0 -15
  1503. data/modules/emscripten/tools/source-maps/sourcemapper.js +0 -208
  1504. data/modules/emscripten/tools/split.py +0 -105
  1505. data/modules/emscripten/tools/split_asm.py +0 -30
  1506. data/modules/emscripten/tools/tempfiles.py +0 -41
  1507. data/modules/emscripten/tools/test-js-optimizer-asm-last-output.js +0 -75
  1508. data/modules/emscripten/tools/test-js-optimizer-asm-last.js +0 -91
  1509. data/modules/emscripten/tools/test-js-optimizer-asm-minlast-output.js +0 -2
  1510. data/modules/emscripten/tools/test-js-optimizer-asm-minlast.js +0 -8
  1511. data/modules/emscripten/tools/test-js-optimizer-asm-outline1-output.js +0 -929
  1512. data/modules/emscripten/tools/test-js-optimizer-asm-outline1.js +0 -351
  1513. data/modules/emscripten/tools/test-js-optimizer-asm-outline2-output.js +0 -793
  1514. data/modules/emscripten/tools/test-js-optimizer-asm-outline2.js +0 -606
  1515. data/modules/emscripten/tools/test-js-optimizer-asm-outline3-output.js +0 -28
  1516. data/modules/emscripten/tools/test-js-optimizer-asm-outline3.js +0 -30
  1517. data/modules/emscripten/tools/test-js-optimizer-asm-pre-output.js +0 -522
  1518. data/modules/emscripten/tools/test-js-optimizer-asm-pre.js +0 -533
  1519. data/modules/emscripten/tools/test-js-optimizer-asm-regs-min-output.js +0 -36
  1520. data/modules/emscripten/tools/test-js-optimizer-asm-regs-min.js +0 -37
  1521. data/modules/emscripten/tools/test-js-optimizer-asm-regs-output.js +0 -106
  1522. data/modules/emscripten/tools/test-js-optimizer-asm-regs.js +0 -110
  1523. data/modules/emscripten/tools/test-js-optimizer-asm-relocate-output.js +0 -9
  1524. data/modules/emscripten/tools/test-js-optimizer-asm-relocate.js +0 -12
  1525. data/modules/emscripten/tools/test-js-optimizer-output.js +0 -291
  1526. data/modules/emscripten/tools/test-js-optimizer-regs-output.js +0 -232
  1527. data/modules/emscripten/tools/test-js-optimizer-regs.js +0 -237
  1528. data/modules/emscripten/tools/test-js-optimizer-t2-output.js +0 -91
  1529. data/modules/emscripten/tools/test-js-optimizer-t2.js +0 -92
  1530. data/modules/emscripten/tools/test-js-optimizer-t2c-output.js +0 -17
  1531. data/modules/emscripten/tools/test-js-optimizer-t2c.js +0 -18
  1532. data/modules/emscripten/tools/test-js-optimizer-t3-output.js +0 -49
  1533. data/modules/emscripten/tools/test-js-optimizer-t3.js +0 -50
  1534. data/modules/emscripten/tools/test-js-optimizer.js +0 -401
  1535. data/modules/emscripten/tools/validate_asmjs.py +0 -82
  1536. data/modules/mruby/mrblib/print.rb +0 -18
  1537. data/modules/mruby/src/re.h +0 -12
@@ -1,3352 +0,0 @@
1
- /*
2
- regcomp.c - TRE POSIX compatible regex compilation functions.
3
-
4
- Copyright (c) 2001-2009 Ville Laurikari <vl@iki.fi>
5
- All rights reserved.
6
-
7
- Redistribution and use in source and binary forms, with or without
8
- modification, are permitted provided that the following conditions
9
- are met:
10
-
11
- 1. Redistributions of source code must retain the above copyright
12
- notice, this list of conditions and the following disclaimer.
13
-
14
- 2. Redistributions in binary form must reproduce the above copyright
15
- notice, this list of conditions and the following disclaimer in the
16
- documentation and/or other materials provided with the distribution.
17
-
18
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS
19
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22
- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
-
30
- */
31
-
32
- #include <string.h>
33
- #include <errno.h>
34
- #include <stdlib.h>
35
- #include <regex.h>
36
- #include <limits.h>
37
- #include <stdint.h>
38
-
39
- #include "tre.h"
40
-
41
- #include <assert.h>
42
-
43
- /***********************************************************************
44
- from tre-compile.h
45
- ***********************************************************************/
46
-
47
- typedef struct {
48
- int position;
49
- int code_min;
50
- int code_max;
51
- int *tags;
52
- int assertions;
53
- tre_ctype_t class;
54
- tre_ctype_t *neg_classes;
55
- int backref;
56
- } tre_pos_and_tags_t;
57
-
58
-
59
- /***********************************************************************
60
- from tre-ast.c and tre-ast.h
61
- ***********************************************************************/
62
-
63
- /* The different AST node types. */
64
- typedef enum {
65
- LITERAL,
66
- CATENATION,
67
- ITERATION,
68
- UNION
69
- } tre_ast_type_t;
70
-
71
- /* Special subtypes of TRE_LITERAL. */
72
- #define EMPTY -1 /* Empty leaf (denotes empty string). */
73
- #define ASSERTION -2 /* Assertion leaf. */
74
- #define TAG -3 /* Tag leaf. */
75
- #define BACKREF -4 /* Back reference leaf. */
76
-
77
- #define IS_SPECIAL(x) ((x)->code_min < 0)
78
- #define IS_EMPTY(x) ((x)->code_min == EMPTY)
79
- #define IS_ASSERTION(x) ((x)->code_min == ASSERTION)
80
- #define IS_TAG(x) ((x)->code_min == TAG)
81
- #define IS_BACKREF(x) ((x)->code_min == BACKREF)
82
-
83
-
84
- /* A generic AST node. All AST nodes consist of this node on the top
85
- level with `obj' pointing to the actual content. */
86
- typedef struct {
87
- tre_ast_type_t type; /* Type of the node. */
88
- void *obj; /* Pointer to actual node. */
89
- int nullable;
90
- int submatch_id;
91
- int num_submatches;
92
- int num_tags;
93
- tre_pos_and_tags_t *firstpos;
94
- tre_pos_and_tags_t *lastpos;
95
- } tre_ast_node_t;
96
-
97
-
98
- /* A "literal" node. These are created for assertions, back references,
99
- tags, matching parameter settings, and all expressions that match one
100
- character. */
101
- typedef struct {
102
- long code_min;
103
- long code_max;
104
- int position;
105
- tre_ctype_t class;
106
- tre_ctype_t *neg_classes;
107
- } tre_literal_t;
108
-
109
- /* A "catenation" node. These are created when two regexps are concatenated.
110
- If there are more than one subexpressions in sequence, the `left' part
111
- holds all but the last, and `right' part holds the last subexpression
112
- (catenation is left associative). */
113
- typedef struct {
114
- tre_ast_node_t *left;
115
- tre_ast_node_t *right;
116
- } tre_catenation_t;
117
-
118
- /* An "iteration" node. These are created for the "*", "+", "?", and "{m,n}"
119
- operators. */
120
- typedef struct {
121
- /* Subexpression to match. */
122
- tre_ast_node_t *arg;
123
- /* Minimum number of consecutive matches. */
124
- int min;
125
- /* Maximum number of consecutive matches. */
126
- int max;
127
- /* If 0, match as many characters as possible, if 1 match as few as
128
- possible. Note that this does not always mean the same thing as
129
- matching as many/few repetitions as possible. */
130
- unsigned int minimal:1;
131
- } tre_iteration_t;
132
-
133
- /* An "union" node. These are created for the "|" operator. */
134
- typedef struct {
135
- tre_ast_node_t *left;
136
- tre_ast_node_t *right;
137
- } tre_union_t;
138
-
139
- static tre_ast_node_t *
140
- tre_ast_new_node(tre_mem_t mem, tre_ast_type_t type, size_t size);
141
-
142
- static tre_ast_node_t *
143
- tre_ast_new_literal(tre_mem_t mem, int code_min, int code_max, int position);
144
-
145
- static tre_ast_node_t *
146
- tre_ast_new_iter(tre_mem_t mem, tre_ast_node_t *arg, int min, int max,
147
- int minimal);
148
-
149
- static tre_ast_node_t *
150
- tre_ast_new_union(tre_mem_t mem, tre_ast_node_t *left, tre_ast_node_t *right);
151
-
152
- static tre_ast_node_t *
153
- tre_ast_new_catenation(tre_mem_t mem, tre_ast_node_t *left,
154
- tre_ast_node_t *right);
155
-
156
-
157
- static tre_ast_node_t *
158
- tre_ast_new_node(tre_mem_t mem, tre_ast_type_t type, size_t size)
159
- {
160
- tre_ast_node_t *node;
161
-
162
- node = tre_mem_calloc(mem, sizeof(*node));
163
- if (!node)
164
- return NULL;
165
- node->obj = tre_mem_calloc(mem, size);
166
- if (!node->obj)
167
- return NULL;
168
- node->type = type;
169
- node->nullable = -1;
170
- node->submatch_id = -1;
171
-
172
- return node;
173
- }
174
-
175
- static tre_ast_node_t *
176
- tre_ast_new_literal(tre_mem_t mem, int code_min, int code_max, int position)
177
- {
178
- tre_ast_node_t *node;
179
- tre_literal_t *lit;
180
-
181
- node = tre_ast_new_node(mem, LITERAL, sizeof(tre_literal_t));
182
- if (!node)
183
- return NULL;
184
- lit = node->obj;
185
- lit->code_min = code_min;
186
- lit->code_max = code_max;
187
- lit->position = position;
188
-
189
- return node;
190
- }
191
-
192
- static tre_ast_node_t *
193
- tre_ast_new_iter(tre_mem_t mem, tre_ast_node_t *arg, int min, int max,
194
- int minimal)
195
- {
196
- tre_ast_node_t *node;
197
- tre_iteration_t *iter;
198
-
199
- node = tre_ast_new_node(mem, ITERATION, sizeof(tre_iteration_t));
200
- if (!node)
201
- return NULL;
202
- iter = node->obj;
203
- iter->arg = arg;
204
- iter->min = min;
205
- iter->max = max;
206
- iter->minimal = minimal;
207
- node->num_submatches = arg->num_submatches;
208
-
209
- return node;
210
- }
211
-
212
- static tre_ast_node_t *
213
- tre_ast_new_union(tre_mem_t mem, tre_ast_node_t *left, tre_ast_node_t *right)
214
- {
215
- tre_ast_node_t *node;
216
-
217
- node = tre_ast_new_node(mem, UNION, sizeof(tre_union_t));
218
- if (node == NULL)
219
- return NULL;
220
- ((tre_union_t *)node->obj)->left = left;
221
- ((tre_union_t *)node->obj)->right = right;
222
- node->num_submatches = left->num_submatches + right->num_submatches;
223
-
224
- return node;
225
- }
226
-
227
- static tre_ast_node_t *
228
- tre_ast_new_catenation(tre_mem_t mem, tre_ast_node_t *left,
229
- tre_ast_node_t *right)
230
- {
231
- tre_ast_node_t *node;
232
-
233
- node = tre_ast_new_node(mem, CATENATION, sizeof(tre_catenation_t));
234
- if (node == NULL)
235
- return NULL;
236
- ((tre_catenation_t *)node->obj)->left = left;
237
- ((tre_catenation_t *)node->obj)->right = right;
238
- node->num_submatches = left->num_submatches + right->num_submatches;
239
-
240
- return node;
241
- }
242
-
243
-
244
- /***********************************************************************
245
- from tre-stack.c and tre-stack.h
246
- ***********************************************************************/
247
-
248
- typedef struct tre_stack_rec tre_stack_t;
249
-
250
- /* Creates a new stack object. `size' is initial size in bytes, `max_size'
251
- is maximum size, and `increment' specifies how much more space will be
252
- allocated with realloc() if all space gets used up. Returns the stack
253
- object or NULL if out of memory. */
254
- static tre_stack_t *
255
- tre_stack_new(int size, int max_size, int increment);
256
-
257
- /* Frees the stack object. */
258
- static void
259
- tre_stack_destroy(tre_stack_t *s);
260
-
261
- /* Returns the current number of objects in the stack. */
262
- static int
263
- tre_stack_num_objects(tre_stack_t *s);
264
-
265
- /* Each tre_stack_push_*(tre_stack_t *s, <type> value) function pushes
266
- `value' on top of stack `s'. Returns REG_ESPACE if out of memory.
267
- This tries to realloc() more space before failing if maximum size
268
- has not yet been reached. Returns REG_OK if successful. */
269
- #define declare_pushf(typetag, type) \
270
- static reg_errcode_t tre_stack_push_ ## typetag(tre_stack_t *s, type value)
271
-
272
- declare_pushf(voidptr, void *);
273
- declare_pushf(int, int);
274
-
275
- /* Each tre_stack_pop_*(tre_stack_t *s) function pops the topmost
276
- element off of stack `s' and returns it. The stack must not be
277
- empty. */
278
- #define declare_popf(typetag, type) \
279
- static type tre_stack_pop_ ## typetag(tre_stack_t *s)
280
-
281
- declare_popf(voidptr, void *);
282
- declare_popf(int, int);
283
-
284
- /* Just to save some typing. */
285
- #define STACK_PUSH(s, typetag, value) \
286
- do \
287
- { \
288
- status = tre_stack_push_ ## typetag(s, value); \
289
- } \
290
- while (/*CONSTCOND*/0)
291
-
292
- #define STACK_PUSHX(s, typetag, value) \
293
- { \
294
- status = tre_stack_push_ ## typetag(s, value); \
295
- if (status != REG_OK) \
296
- break; \
297
- }
298
-
299
- #define STACK_PUSHR(s, typetag, value) \
300
- { \
301
- reg_errcode_t _status; \
302
- _status = tre_stack_push_ ## typetag(s, value); \
303
- if (_status != REG_OK) \
304
- return _status; \
305
- }
306
-
307
- union tre_stack_item {
308
- void *voidptr_value;
309
- int int_value;
310
- };
311
-
312
- struct tre_stack_rec {
313
- int size;
314
- int max_size;
315
- int increment;
316
- int ptr;
317
- union tre_stack_item *stack;
318
- };
319
-
320
-
321
- static tre_stack_t *
322
- tre_stack_new(int size, int max_size, int increment)
323
- {
324
- tre_stack_t *s;
325
-
326
- s = xmalloc(sizeof(*s));
327
- if (s != NULL)
328
- {
329
- s->stack = xmalloc(sizeof(*s->stack) * size);
330
- if (s->stack == NULL)
331
- {
332
- xfree(s);
333
- return NULL;
334
- }
335
- s->size = size;
336
- s->max_size = max_size;
337
- s->increment = increment;
338
- s->ptr = 0;
339
- }
340
- return s;
341
- }
342
-
343
- static void
344
- tre_stack_destroy(tre_stack_t *s)
345
- {
346
- xfree(s->stack);
347
- xfree(s);
348
- }
349
-
350
- static int
351
- tre_stack_num_objects(tre_stack_t *s)
352
- {
353
- return s->ptr;
354
- }
355
-
356
- static reg_errcode_t
357
- tre_stack_push(tre_stack_t *s, union tre_stack_item value)
358
- {
359
- if (s->ptr < s->size)
360
- {
361
- s->stack[s->ptr] = value;
362
- s->ptr++;
363
- }
364
- else
365
- {
366
- if (s->size >= s->max_size)
367
- {
368
- return REG_ESPACE;
369
- }
370
- else
371
- {
372
- union tre_stack_item *new_buffer;
373
- int new_size;
374
- new_size = s->size + s->increment;
375
- if (new_size > s->max_size)
376
- new_size = s->max_size;
377
- new_buffer = xrealloc(s->stack, sizeof(*new_buffer) * new_size);
378
- if (new_buffer == NULL)
379
- {
380
- return REG_ESPACE;
381
- }
382
- assert(new_size > s->size);
383
- s->size = new_size;
384
- s->stack = new_buffer;
385
- tre_stack_push(s, value);
386
- }
387
- }
388
- return REG_OK;
389
- }
390
-
391
- #define define_pushf(typetag, type) \
392
- declare_pushf(typetag, type) { \
393
- union tre_stack_item item; \
394
- item.typetag ## _value = value; \
395
- return tre_stack_push(s, item); \
396
- }
397
-
398
- define_pushf(int, int)
399
- define_pushf(voidptr, void *)
400
-
401
- #define define_popf(typetag, type) \
402
- declare_popf(typetag, type) { \
403
- return s->stack[--s->ptr].typetag ## _value; \
404
- }
405
-
406
- define_popf(int, int)
407
- define_popf(voidptr, void *)
408
-
409
-
410
- /***********************************************************************
411
- from tre-parse.c and tre-parse.h
412
- ***********************************************************************/
413
-
414
- /* Parse context. */
415
- typedef struct {
416
- /* Memory allocator. The AST is allocated using this. */
417
- tre_mem_t mem;
418
- /* Stack used for keeping track of regexp syntax. */
419
- tre_stack_t *stack;
420
- /* The parse result. */
421
- tre_ast_node_t *result;
422
- /* The regexp to parse and its length. */
423
- const char *re;
424
- /* The first character of the entire regexp. */
425
- const char *re_start;
426
- /* Current submatch ID. */
427
- int submatch_id;
428
- /* Current position (number of literal). */
429
- int position;
430
- /* The highest back reference or -1 if none seen so far. */
431
- int max_backref;
432
- /* This flag is set if the regexp uses approximate matching. */
433
- int have_approx;
434
- /* Compilation flags. */
435
- int cflags;
436
- /* If this flag is set the top-level submatch is not captured. */
437
- int nofirstsub;
438
- } tre_parse_ctx_t;
439
-
440
- /* Parses a wide character regexp pattern into a syntax tree. This parser
441
- handles both syntaxes (BRE and ERE), including the TRE extensions. */
442
- static reg_errcode_t
443
- tre_parse(tre_parse_ctx_t *ctx);
444
-
445
-
446
- /*
447
- This parser is just a simple recursive descent parser for POSIX.2
448
- regexps. The parser supports both the obsolete default syntax and
449
- the "extended" syntax, and some nonstandard extensions.
450
- */
451
-
452
- /* Characters with special meanings in regexp syntax. */
453
- #define CHAR_PIPE '|'
454
- #define CHAR_LPAREN '('
455
- #define CHAR_RPAREN ')'
456
- #define CHAR_LBRACE '{'
457
- #define CHAR_RBRACE '}'
458
- #define CHAR_LBRACKET '['
459
- #define CHAR_RBRACKET ']'
460
- #define CHAR_MINUS '-'
461
- #define CHAR_STAR '*'
462
- #define CHAR_QUESTIONMARK '?'
463
- #define CHAR_PLUS '+'
464
- #define CHAR_PERIOD '.'
465
- #define CHAR_COLON ':'
466
- #define CHAR_EQUAL '='
467
- #define CHAR_COMMA ','
468
- #define CHAR_CARET '^'
469
- #define CHAR_DOLLAR '$'
470
- #define CHAR_BACKSLASH '\\'
471
- #define CHAR_HASH '#'
472
- #define CHAR_TILDE '~'
473
-
474
-
475
- /* Some macros for expanding \w, \s, etc. */
476
- static const struct tre_macro_struct {
477
- const char c;
478
- const char *expansion;
479
- } tre_macros[] =
480
- { {'t', "\t"}, {'n', "\n"}, {'r', "\r"},
481
- {'f', "\f"}, {'a', "\a"}, {'e', "\033"},
482
- {'w', "[[:alnum:]_]"}, {'W', "[^[:alnum:]_]"}, {'s', "[[:space:]]"},
483
- {'S', "[^[:space:]]"}, {'d', "[[:digit:]]"}, {'D', "[^[:digit:]]"},
484
- { 0, NULL }
485
- };
486
-
487
-
488
- /* Expands a macro delimited by `regex' and `regex_end' to `buf', which
489
- must have at least `len' items. Sets buf[0] to zero if the there
490
- is no match in `tre_macros'. */
491
- static const char *
492
- tre_expand_macro(const char *regex)
493
- {
494
- int i;
495
-
496
- if (!*regex)
497
- return 0;
498
-
499
- for (i = 0; tre_macros[i].expansion && tre_macros[i].c != *regex; i++);
500
- return tre_macros[i].expansion;
501
- }
502
-
503
- static reg_errcode_t
504
- tre_new_item(tre_mem_t mem, int min, int max, int *i, int *max_i,
505
- tre_ast_node_t ***items)
506
- {
507
- reg_errcode_t status;
508
- tre_ast_node_t **array = *items;
509
- /* Allocate more space if necessary. */
510
- if (*i >= *max_i)
511
- {
512
- tre_ast_node_t **new_items;
513
- /* If the array is already 1024 items large, give up -- there's
514
- probably an error in the regexp (e.g. not a '\0' terminated
515
- string and missing ']') */
516
- if (*max_i > 1024)
517
- return REG_ESPACE;
518
- *max_i *= 2;
519
- new_items = xrealloc(array, sizeof(*items) * *max_i);
520
- if (new_items == NULL)
521
- return REG_ESPACE;
522
- *items = array = new_items;
523
- }
524
- array[*i] = tre_ast_new_literal(mem, min, max, -1);
525
- status = array[*i] == NULL ? REG_ESPACE : REG_OK;
526
- (*i)++;
527
- return status;
528
- }
529
-
530
-
531
- static int
532
- tre_compare_items(const void *a, const void *b)
533
- {
534
- const tre_ast_node_t *node_a = *(tre_ast_node_t * const *)a;
535
- const tre_ast_node_t *node_b = *(tre_ast_node_t * const *)b;
536
- tre_literal_t *l_a = node_a->obj, *l_b = node_b->obj;
537
- int a_min = l_a->code_min, b_min = l_b->code_min;
538
-
539
- if (a_min < b_min)
540
- return -1;
541
- else if (a_min > b_min)
542
- return 1;
543
- else
544
- return 0;
545
- }
546
-
547
- /* Maximum number of character classes that can occur in a negated bracket
548
- expression. */
549
- #define MAX_NEG_CLASSES 64
550
-
551
- /* Maximum length of character class names. */
552
- #define MAX_CLASS_NAME
553
-
554
- static reg_errcode_t
555
- tre_parse_bracket_items(tre_parse_ctx_t *ctx, int negate,
556
- tre_ctype_t neg_classes[], int *num_neg_classes,
557
- tre_ast_node_t ***items, int *num_items,
558
- int *items_size)
559
- {
560
- const char *re = ctx->re;
561
- reg_errcode_t status = REG_OK;
562
- tre_ctype_t class = (tre_ctype_t)0;
563
- int i = *num_items;
564
- int max_i = *items_size;
565
- int skip;
566
-
567
- /* Build an array of the items in the bracket expression. */
568
- while (status == REG_OK)
569
- {
570
- skip = 0;
571
- if (!*re)
572
- {
573
- status = REG_EBRACK;
574
- }
575
- else if (*re == CHAR_RBRACKET && re > ctx->re)
576
- {
577
- re++;
578
- break;
579
- }
580
- else
581
- {
582
- tre_cint_t min = 0, max = 0;
583
- wchar_t wc;
584
- int clen = mbtowc(&wc, re, -1);
585
-
586
- if (clen<0) clen=1, wc=WEOF;
587
-
588
- class = (tre_ctype_t)0;
589
- if (*(re + clen) == CHAR_MINUS && *(re + clen + 1) != CHAR_RBRACKET)
590
- {
591
- min = wc;
592
- re += clen+1;
593
- clen = mbtowc(&wc, re, -1);
594
- if (clen<0) clen=1, wc=WEOF;
595
- max = wc;
596
- re += clen;
597
- /* XXX - Should use collation order instead of encoding values
598
- in character ranges. */
599
- if (min > max)
600
- status = REG_ERANGE;
601
- }
602
- else if (*re == CHAR_LBRACKET && *(re + 1) == CHAR_PERIOD)
603
- status = REG_ECOLLATE;
604
- else if (*re == CHAR_LBRACKET && *(re + 1) == CHAR_EQUAL)
605
- status = REG_ECOLLATE;
606
- else if (*re == CHAR_LBRACKET && *(re + 1) == CHAR_COLON)
607
- {
608
- char tmp_str[64];
609
- const char *endptr = re + 2;
610
- int len;
611
- while (*endptr && *endptr != CHAR_COLON)
612
- endptr++;
613
- if (*endptr)
614
- {
615
- len = MIN(endptr - re - 2, 63);
616
- strncpy(tmp_str, re + 2, len);
617
- tmp_str[len] = '\0';
618
- class = tre_ctype(tmp_str);
619
- if (!class)
620
- status = REG_ECTYPE;
621
- re = endptr + 2;
622
- }
623
- else
624
- status = REG_ECTYPE;
625
- min = 0;
626
- max = TRE_CHAR_MAX;
627
- }
628
- else
629
- {
630
- if (*re == CHAR_MINUS && *(re + 1) != CHAR_RBRACKET
631
- && ctx->re != re)
632
- /* Two ranges are not allowed to share and endpoint. */
633
- status = REG_ERANGE;
634
- min = max = wc;
635
- re += clen;
636
- }
637
-
638
- if (status != REG_OK)
639
- break;
640
-
641
- if (class && negate)
642
- if (*num_neg_classes >= MAX_NEG_CLASSES)
643
- status = REG_ESPACE;
644
- else
645
- neg_classes[(*num_neg_classes)++] = class;
646
- else if (!skip)
647
- {
648
- status = tre_new_item(ctx->mem, min, max, &i, &max_i, items);
649
- if (status != REG_OK)
650
- break;
651
- ((tre_literal_t*)((*items)[i-1])->obj)->class = class;
652
- }
653
-
654
- /* Add opposite-case counterpoints if REG_ICASE is present.
655
- This is broken if there are more than two "same" characters. */
656
- if (ctx->cflags & REG_ICASE && !class && status == REG_OK && !skip)
657
- {
658
- tre_cint_t cmin, ccurr;
659
-
660
- while (min <= max)
661
- {
662
- if (tre_islower(min))
663
- {
664
- cmin = ccurr = tre_toupper(min++);
665
- while (tre_islower(min) && tre_toupper(min) == ccurr + 1
666
- && min <= max)
667
- ccurr = tre_toupper(min++);
668
- status = tre_new_item(ctx->mem, cmin, ccurr,
669
- &i, &max_i, items);
670
- }
671
- else if (tre_isupper(min))
672
- {
673
- cmin = ccurr = tre_tolower(min++);
674
- while (tre_isupper(min) && tre_tolower(min) == ccurr + 1
675
- && min <= max)
676
- ccurr = tre_tolower(min++);
677
- status = tre_new_item(ctx->mem, cmin, ccurr,
678
- &i, &max_i, items);
679
- }
680
- else min++;
681
- if (status != REG_OK)
682
- break;
683
- }
684
- if (status != REG_OK)
685
- break;
686
- }
687
- }
688
- }
689
- *num_items = i;
690
- *items_size = max_i;
691
- ctx->re = re;
692
- return status;
693
- }
694
-
695
- static reg_errcode_t
696
- tre_parse_bracket(tre_parse_ctx_t *ctx, tre_ast_node_t **result)
697
- {
698
- tre_ast_node_t *node = NULL;
699
- int negate = 0;
700
- reg_errcode_t status = REG_OK;
701
- tre_ast_node_t **items, *u, *n;
702
- int i = 0, j, max_i = 32, curr_max, curr_min;
703
- tre_ctype_t neg_classes[MAX_NEG_CLASSES];
704
- int num_neg_classes = 0;
705
-
706
- /* Start off with an array of `max_i' elements. */
707
- items = xmalloc(sizeof(*items) * max_i);
708
- if (items == NULL)
709
- return REG_ESPACE;
710
-
711
- if (*ctx->re == CHAR_CARET)
712
- {
713
- negate = 1;
714
- ctx->re++;
715
- }
716
-
717
- status = tre_parse_bracket_items(ctx, negate, neg_classes, &num_neg_classes,
718
- &items, &i, &max_i);
719
-
720
- if (status != REG_OK)
721
- goto parse_bracket_done;
722
-
723
- /* Sort the array if we need to negate it. */
724
- if (negate)
725
- qsort(items, (unsigned)i, sizeof(*items), tre_compare_items);
726
-
727
- curr_max = curr_min = 0;
728
- /* Build a union of the items in the array, negated if necessary. */
729
- for (j = 0; j < i && status == REG_OK; j++)
730
- {
731
- int min, max;
732
- tre_literal_t *l = items[j]->obj;
733
- min = l->code_min;
734
- max = l->code_max;
735
-
736
- if (negate)
737
- {
738
- if (min < curr_max)
739
- {
740
- /* Overlap. */
741
- curr_max = MAX(max + 1, curr_max);
742
- l = NULL;
743
- }
744
- else
745
- {
746
- /* No overlap. */
747
- curr_max = min - 1;
748
- if (curr_max >= curr_min)
749
- {
750
- l->code_min = curr_min;
751
- l->code_max = curr_max;
752
- }
753
- else
754
- {
755
- l = NULL;
756
- }
757
- curr_min = curr_max = max + 1;
758
- }
759
- }
760
-
761
- if (l != NULL)
762
- {
763
- int k;
764
- l->position = ctx->position;
765
- if (num_neg_classes > 0)
766
- {
767
- l->neg_classes = tre_mem_alloc(ctx->mem,
768
- (sizeof(l->neg_classes)
769
- * (num_neg_classes + 1)));
770
- if (l->neg_classes == NULL)
771
- {
772
- status = REG_ESPACE;
773
- break;
774
- }
775
- for (k = 0; k < num_neg_classes; k++)
776
- l->neg_classes[k] = neg_classes[k];
777
- l->neg_classes[k] = (tre_ctype_t)0;
778
- }
779
- else
780
- l->neg_classes = NULL;
781
- if (node == NULL)
782
- node = items[j];
783
- else
784
- {
785
- u = tre_ast_new_union(ctx->mem, node, items[j]);
786
- if (u == NULL)
787
- status = REG_ESPACE;
788
- node = u;
789
- }
790
- }
791
- }
792
-
793
- if (status != REG_OK)
794
- goto parse_bracket_done;
795
-
796
- if (negate)
797
- {
798
- int k;
799
- n = tre_ast_new_literal(ctx->mem, curr_min, TRE_CHAR_MAX, ctx->position);
800
- if (n == NULL)
801
- status = REG_ESPACE;
802
- else
803
- {
804
- tre_literal_t *l = n->obj;
805
- if (num_neg_classes > 0)
806
- {
807
- l->neg_classes = tre_mem_alloc(ctx->mem,
808
- (sizeof(l->neg_classes)
809
- * (num_neg_classes + 1)));
810
- if (l->neg_classes == NULL)
811
- {
812
- status = REG_ESPACE;
813
- goto parse_bracket_done;
814
- }
815
- for (k = 0; k < num_neg_classes; k++)
816
- l->neg_classes[k] = neg_classes[k];
817
- l->neg_classes[k] = (tre_ctype_t)0;
818
- }
819
- else
820
- l->neg_classes = NULL;
821
- if (node == NULL)
822
- node = n;
823
- else
824
- {
825
- u = tre_ast_new_union(ctx->mem, node, n);
826
- if (u == NULL)
827
- status = REG_ESPACE;
828
- node = u;
829
- }
830
- }
831
- }
832
-
833
- if (status != REG_OK)
834
- goto parse_bracket_done;
835
-
836
- #ifdef TRE_DEBUG
837
- tre_ast_print(node);
838
- #endif /* TRE_DEBUG */
839
-
840
- parse_bracket_done:
841
- xfree(items);
842
- ctx->position++;
843
- *result = node;
844
- return status;
845
- }
846
-
847
-
848
- /* Parses a positive decimal integer. Returns -1 if the string does not
849
- contain a valid number. */
850
- static int
851
- tre_parse_int(const char **regex)
852
- {
853
- int num = -1;
854
- const char *r = *regex;
855
- while (*r-'0'<10U)
856
- {
857
- if (num < 0)
858
- num = 0;
859
- num = num * 10 + *r - '0';
860
- r++;
861
- }
862
- *regex = r;
863
- return num;
864
- }
865
-
866
-
867
- static reg_errcode_t
868
- tre_parse_bound(tre_parse_ctx_t *ctx, tre_ast_node_t **result)
869
- {
870
- int min, max;
871
- const char *r = ctx->re;
872
- int minimal = 0;
873
-
874
- /* Parse number (minimum repetition count). */
875
- min = -1;
876
- if (*r >= '0' && *r <= '9') {
877
- min = tre_parse_int(&r);
878
- }
879
-
880
- /* Parse comma and second number (maximum repetition count). */
881
- max = min;
882
- if (*r == CHAR_COMMA)
883
- {
884
- r++;
885
- max = tre_parse_int(&r);
886
- }
887
-
888
- /* Check that the repeat counts are sane. */
889
- if ((max >= 0 && min > max) || max > RE_DUP_MAX)
890
- return REG_BADBR;
891
-
892
- /* Missing }. */
893
- if (!*r)
894
- return REG_EBRACE;
895
-
896
- /* Empty contents of {}. */
897
- if (r == ctx->re)
898
- return REG_BADBR;
899
-
900
- /* Parse the ending '}' or '\}'.*/
901
- if (ctx->cflags & REG_EXTENDED)
902
- {
903
- if (*r != CHAR_RBRACE)
904
- return REG_BADBR;
905
- r++;
906
- }
907
- else
908
- {
909
- if (*r != CHAR_BACKSLASH || *(r + 1) != CHAR_RBRACE)
910
- return REG_BADBR;
911
- r += 2;
912
- }
913
-
914
- /* Create the AST node(s). */
915
- if (min == 0 && max == 0)
916
- {
917
- *result = tre_ast_new_literal(ctx->mem, EMPTY, -1, -1);
918
- if (*result == NULL)
919
- return REG_ESPACE;
920
- }
921
- else
922
- {
923
- if (min < 0 && max < 0)
924
- /* Only approximate parameters set, no repetitions. */
925
- min = max = 1;
926
-
927
- *result = tre_ast_new_iter(ctx->mem, *result, min, max, minimal);
928
- if (!*result)
929
- return REG_ESPACE;
930
- }
931
-
932
- ctx->re = r;
933
- return REG_OK;
934
- }
935
-
936
- typedef enum {
937
- PARSE_RE = 0,
938
- PARSE_ATOM,
939
- PARSE_MARK_FOR_SUBMATCH,
940
- PARSE_BRANCH,
941
- PARSE_PIECE,
942
- PARSE_CATENATION,
943
- PARSE_POST_CATENATION,
944
- PARSE_UNION,
945
- PARSE_POST_UNION,
946
- PARSE_POSTFIX,
947
- PARSE_RESTORE_CFLAGS
948
- } tre_parse_re_stack_symbol_t;
949
-
950
-
951
- static reg_errcode_t
952
- tre_parse(tre_parse_ctx_t *ctx)
953
- {
954
- tre_ast_node_t *result = NULL;
955
- tre_parse_re_stack_symbol_t symbol;
956
- reg_errcode_t status = REG_OK;
957
- tre_stack_t *stack = ctx->stack;
958
- int bottom = tre_stack_num_objects(stack);
959
- int depth = 0;
960
- wchar_t wc;
961
- int clen;
962
-
963
- if (!ctx->nofirstsub)
964
- {
965
- STACK_PUSH(stack, int, ctx->submatch_id);
966
- STACK_PUSH(stack, int, PARSE_MARK_FOR_SUBMATCH);
967
- ctx->submatch_id++;
968
- }
969
- STACK_PUSH(stack, int, PARSE_RE);
970
- ctx->re_start = ctx->re;
971
-
972
-
973
- /* The following is basically just a recursive descent parser. I use
974
- an explicit stack instead of recursive functions mostly because of
975
- two reasons: compatibility with systems which have an overflowable
976
- call stack, and efficiency (both in lines of code and speed). */
977
- while (tre_stack_num_objects(stack) > bottom && status == REG_OK)
978
- {
979
- if (status != REG_OK)
980
- break;
981
- symbol = tre_stack_pop_int(stack);
982
- switch (symbol)
983
- {
984
- case PARSE_RE:
985
- /* Parse a full regexp. A regexp is one or more branches,
986
- separated by the union operator `|'. */
987
- if (ctx->cflags & REG_EXTENDED)
988
- STACK_PUSHX(stack, int, PARSE_UNION);
989
- STACK_PUSHX(stack, int, PARSE_BRANCH);
990
- break;
991
-
992
- case PARSE_BRANCH:
993
- /* Parse a branch. A branch is one or more pieces, concatenated.
994
- A piece is an atom possibly followed by a postfix operator. */
995
- STACK_PUSHX(stack, int, PARSE_CATENATION);
996
- STACK_PUSHX(stack, int, PARSE_PIECE);
997
- break;
998
-
999
- case PARSE_PIECE:
1000
- /* Parse a piece. A piece is an atom possibly followed by one
1001
- or more postfix operators. */
1002
- STACK_PUSHX(stack, int, PARSE_POSTFIX);
1003
- STACK_PUSHX(stack, int, PARSE_ATOM);
1004
- break;
1005
-
1006
- case PARSE_CATENATION:
1007
- /* If the expression has not ended, parse another piece. */
1008
- {
1009
- tre_char_t c;
1010
- if (!*ctx->re)
1011
- break;
1012
- c = *ctx->re;
1013
- if (ctx->cflags & REG_EXTENDED && c == CHAR_PIPE)
1014
- break;
1015
- if ((ctx->cflags & REG_EXTENDED
1016
- && c == CHAR_RPAREN && depth > 0)
1017
- || (!(ctx->cflags & REG_EXTENDED)
1018
- && (c == CHAR_BACKSLASH
1019
- && *(ctx->re + 1) == CHAR_RPAREN)))
1020
- {
1021
- if (!(ctx->cflags & REG_EXTENDED) && depth == 0)
1022
- status = REG_EPAREN;
1023
- depth--;
1024
- if (!(ctx->cflags & REG_EXTENDED))
1025
- ctx->re += 2;
1026
- break;
1027
- }
1028
-
1029
- {
1030
- /* Default case, left associative concatenation. */
1031
- STACK_PUSHX(stack, int, PARSE_CATENATION);
1032
- STACK_PUSHX(stack, voidptr, result);
1033
- STACK_PUSHX(stack, int, PARSE_POST_CATENATION);
1034
- STACK_PUSHX(stack, int, PARSE_PIECE);
1035
- }
1036
- break;
1037
- }
1038
-
1039
- case PARSE_POST_CATENATION:
1040
- {
1041
- tre_ast_node_t *tree = tre_stack_pop_voidptr(stack);
1042
- tre_ast_node_t *tmp_node;
1043
- tmp_node = tre_ast_new_catenation(ctx->mem, tree, result);
1044
- if (!tmp_node)
1045
- return REG_ESPACE;
1046
- result = tmp_node;
1047
- break;
1048
- }
1049
-
1050
- case PARSE_UNION:
1051
- switch (*ctx->re)
1052
- {
1053
- case CHAR_PIPE:
1054
- STACK_PUSHX(stack, int, PARSE_UNION);
1055
- STACK_PUSHX(stack, voidptr, result);
1056
- STACK_PUSHX(stack, int, PARSE_POST_UNION);
1057
- STACK_PUSHX(stack, int, PARSE_BRANCH);
1058
- ctx->re++;
1059
- break;
1060
-
1061
- case CHAR_RPAREN:
1062
- ctx->re++;
1063
- break;
1064
-
1065
- default:
1066
- break;
1067
- }
1068
- break;
1069
-
1070
- case PARSE_POST_UNION:
1071
- {
1072
- tre_ast_node_t *tmp_node;
1073
- tre_ast_node_t *tree = tre_stack_pop_voidptr(stack);
1074
- tmp_node = tre_ast_new_union(ctx->mem, tree, result);
1075
- if (!tmp_node)
1076
- return REG_ESPACE;
1077
- result = tmp_node;
1078
- break;
1079
- }
1080
-
1081
- case PARSE_POSTFIX:
1082
- /* Parse postfix operators. */
1083
- switch (*ctx->re)
1084
- {
1085
- case CHAR_PLUS:
1086
- case CHAR_QUESTIONMARK:
1087
- if (!(ctx->cflags & REG_EXTENDED))
1088
- break;
1089
- /*FALLTHROUGH*/
1090
- case CHAR_STAR:
1091
- {
1092
- tre_ast_node_t *tmp_node;
1093
- int minimal = 0;
1094
- int rep_min = 0;
1095
- int rep_max = -1;
1096
-
1097
- if (*ctx->re == CHAR_PLUS)
1098
- rep_min = 1;
1099
- if (*ctx->re == CHAR_QUESTIONMARK)
1100
- rep_max = 1;
1101
-
1102
- ctx->re++;
1103
- tmp_node = tre_ast_new_iter(ctx->mem, result, rep_min, rep_max,
1104
- minimal);
1105
- if (tmp_node == NULL)
1106
- return REG_ESPACE;
1107
- result = tmp_node;
1108
- STACK_PUSHX(stack, int, PARSE_POSTFIX);
1109
- }
1110
- break;
1111
-
1112
- case CHAR_BACKSLASH:
1113
- /* "\{" is special without REG_EXTENDED */
1114
- if (!(ctx->cflags & REG_EXTENDED)
1115
- && *(ctx->re + 1) == CHAR_LBRACE)
1116
- {
1117
- ctx->re++;
1118
- goto parse_brace;
1119
- }
1120
- else
1121
- break;
1122
-
1123
- case CHAR_LBRACE:
1124
- /* "{" is literal without REG_EXTENDED */
1125
- if (!(ctx->cflags & REG_EXTENDED))
1126
- break;
1127
-
1128
- parse_brace:
1129
- ctx->re++;
1130
-
1131
- status = tre_parse_bound(ctx, &result);
1132
- if (status != REG_OK)
1133
- return status;
1134
- STACK_PUSHX(stack, int, PARSE_POSTFIX);
1135
- break;
1136
- }
1137
- break;
1138
-
1139
- case PARSE_ATOM:
1140
- /* Parse an atom. An atom is a regular expression enclosed in `()',
1141
- an empty set of `()', a bracket expression, `.', `^', `$',
1142
- a `\' followed by a character, or a single character. */
1143
-
1144
- switch (*ctx->re)
1145
- {
1146
- case CHAR_LPAREN: /* parenthesized subexpression */
1147
-
1148
- if (ctx->cflags & REG_EXTENDED)
1149
- {
1150
- lparen:
1151
- depth++;
1152
- {
1153
- ctx->re++;
1154
- /* First parse a whole RE, then mark the resulting tree
1155
- for submatching. */
1156
- STACK_PUSHX(stack, int, ctx->submatch_id);
1157
- STACK_PUSHX(stack, int, PARSE_MARK_FOR_SUBMATCH);
1158
- STACK_PUSHX(stack, int, PARSE_RE);
1159
- ctx->submatch_id++;
1160
- }
1161
- }
1162
- else
1163
- goto parse_literal;
1164
- break;
1165
-
1166
- case CHAR_LBRACKET: /* bracket expression */
1167
- ctx->re++;
1168
- status = tre_parse_bracket(ctx, &result);
1169
- if (status != REG_OK)
1170
- return status;
1171
- break;
1172
-
1173
- case CHAR_BACKSLASH:
1174
- /* If this is "\(" or "\)" chew off the backslash and
1175
- try again. */
1176
- if (!(ctx->cflags & REG_EXTENDED) && *(ctx->re + 1) == CHAR_LPAREN)
1177
- {
1178
- ctx->re++;
1179
- goto lparen;
1180
- }
1181
- if (!(ctx->cflags & REG_EXTENDED) && *(ctx->re + 1) == CHAR_RPAREN)
1182
- {
1183
- goto empty_atom;
1184
- }
1185
-
1186
- /* If a macro is used, parse the expanded macro recursively. */
1187
- {
1188
- const char *buf = tre_expand_macro(ctx->re + 1);
1189
- if (buf)
1190
- {
1191
- tre_parse_ctx_t subctx;
1192
- memcpy(&subctx, ctx, sizeof(subctx));
1193
- subctx.re = buf;
1194
- subctx.nofirstsub = 1;
1195
- status = tre_parse(&subctx);
1196
- if (status != REG_OK)
1197
- return status;
1198
- ctx->re += 2;
1199
- ctx->position = subctx.position;
1200
- result = subctx.result;
1201
- break;
1202
- }
1203
- }
1204
-
1205
- if (!ctx->re[1])
1206
- /* Trailing backslash. */
1207
- return REG_EESCAPE;
1208
-
1209
- ctx->re++;
1210
- switch (*ctx->re)
1211
- {
1212
- case 'b':
1213
- result = tre_ast_new_literal(ctx->mem, ASSERTION,
1214
- ASSERT_AT_WB, -1);
1215
- ctx->re++;
1216
- break;
1217
- case 'B':
1218
- result = tre_ast_new_literal(ctx->mem, ASSERTION,
1219
- ASSERT_AT_WB_NEG, -1);
1220
- ctx->re++;
1221
- break;
1222
- case '<':
1223
- result = tre_ast_new_literal(ctx->mem, ASSERTION,
1224
- ASSERT_AT_BOW, -1);
1225
- ctx->re++;
1226
- break;
1227
- case '>':
1228
- result = tre_ast_new_literal(ctx->mem, ASSERTION,
1229
- ASSERT_AT_EOW, -1);
1230
- ctx->re++;
1231
- break;
1232
- case 'x':
1233
- ctx->re++;
1234
- if (ctx->re[0] != CHAR_LBRACE)
1235
- {
1236
- /* 8 bit hex char. */
1237
- char tmp[3] = {0, 0, 0};
1238
- long val;
1239
-
1240
- if (tre_isxdigit(ctx->re[0]))
1241
- {
1242
- tmp[0] = (char)ctx->re[0];
1243
- ctx->re++;
1244
- }
1245
- if (tre_isxdigit(ctx->re[0]))
1246
- {
1247
- tmp[1] = (char)ctx->re[0];
1248
- ctx->re++;
1249
- }
1250
- val = strtol(tmp, NULL, 16);
1251
- result = tre_ast_new_literal(ctx->mem, (int)val,
1252
- (int)val, ctx->position);
1253
- ctx->position++;
1254
- break;
1255
- }
1256
- else if (*ctx->re)
1257
- {
1258
- /* Wide char. */
1259
- char tmp[32];
1260
- long val;
1261
- int i = 0;
1262
- ctx->re++;
1263
- while (*ctx->re && i < sizeof tmp)
1264
- {
1265
- if (ctx->re[0] == CHAR_RBRACE)
1266
- break;
1267
- if (tre_isxdigit(ctx->re[0]))
1268
- {
1269
- tmp[i] = (char)ctx->re[0];
1270
- i++;
1271
- ctx->re++;
1272
- continue;
1273
- }
1274
- return REG_EBRACE;
1275
- }
1276
- ctx->re++;
1277
- tmp[i] = 0;
1278
- val = strtol(tmp, NULL, 16);
1279
- result = tre_ast_new_literal(ctx->mem, (int)val, (int)val,
1280
- ctx->position);
1281
- ctx->position++;
1282
- break;
1283
- }
1284
- /*FALLTHROUGH*/
1285
-
1286
- default:
1287
- if (tre_isdigit(*ctx->re))
1288
- {
1289
- /* Back reference. */
1290
- int val = *ctx->re - '0';
1291
- result = tre_ast_new_literal(ctx->mem, BACKREF, val,
1292
- ctx->position);
1293
- if (result == NULL)
1294
- return REG_ESPACE;
1295
- ctx->position++;
1296
- ctx->max_backref = MAX(val, ctx->max_backref);
1297
- ctx->re++;
1298
- }
1299
- else
1300
- {
1301
- /* Escaped character. */
1302
- result = tre_ast_new_literal(ctx->mem, *ctx->re, *ctx->re,
1303
- ctx->position);
1304
- ctx->position++;
1305
- ctx->re++;
1306
- }
1307
- break;
1308
- }
1309
- if (result == NULL)
1310
- return REG_ESPACE;
1311
- break;
1312
-
1313
- case CHAR_PERIOD: /* the any-symbol */
1314
- if (ctx->cflags & REG_NEWLINE)
1315
- {
1316
- tre_ast_node_t *tmp1;
1317
- tre_ast_node_t *tmp2;
1318
- tmp1 = tre_ast_new_literal(ctx->mem, 0, '\n' - 1,
1319
- ctx->position);
1320
- if (!tmp1)
1321
- return REG_ESPACE;
1322
- tmp2 = tre_ast_new_literal(ctx->mem, '\n' + 1, TRE_CHAR_MAX,
1323
- ctx->position + 1);
1324
- if (!tmp2)
1325
- return REG_ESPACE;
1326
- result = tre_ast_new_union(ctx->mem, tmp1, tmp2);
1327
- if (!result)
1328
- return REG_ESPACE;
1329
- ctx->position += 2;
1330
- }
1331
- else
1332
- {
1333
- result = tre_ast_new_literal(ctx->mem, 0, TRE_CHAR_MAX,
1334
- ctx->position);
1335
- if (!result)
1336
- return REG_ESPACE;
1337
- ctx->position++;
1338
- }
1339
- ctx->re++;
1340
- break;
1341
-
1342
- case CHAR_CARET: /* beginning of line assertion */
1343
- /* '^' has a special meaning everywhere in EREs, and at
1344
- beginning of BRE. */
1345
- if (ctx->cflags & REG_EXTENDED
1346
- || ctx->re == ctx->re_start)
1347
- {
1348
- if (!(ctx->cflags & REG_EXTENDED))
1349
- STACK_PUSHX(stack, int, PARSE_CATENATION);
1350
- result = tre_ast_new_literal(ctx->mem, ASSERTION,
1351
- ASSERT_AT_BOL, -1);
1352
- if (result == NULL)
1353
- return REG_ESPACE;
1354
- ctx->re++;
1355
- }
1356
- else
1357
- goto parse_literal;
1358
- break;
1359
-
1360
- case CHAR_DOLLAR: /* end of line assertion. */
1361
- /* '$' is special everywhere in EREs, and in the end of the
1362
- string in BREs. */
1363
- if (ctx->cflags & REG_EXTENDED
1364
- || !*(ctx->re + 1))
1365
- {
1366
- result = tre_ast_new_literal(ctx->mem, ASSERTION,
1367
- ASSERT_AT_EOL, -1);
1368
- if (result == NULL)
1369
- return REG_ESPACE;
1370
- ctx->re++;
1371
- }
1372
- else
1373
- goto parse_literal;
1374
- break;
1375
-
1376
- case CHAR_RPAREN:
1377
- if (!depth)
1378
- goto parse_literal;
1379
- case CHAR_STAR:
1380
- case CHAR_PIPE:
1381
- case CHAR_LBRACE:
1382
- case CHAR_PLUS:
1383
- case CHAR_QUESTIONMARK:
1384
- if (!(ctx->cflags & REG_EXTENDED))
1385
- goto parse_literal;
1386
-
1387
- case 0:
1388
- empty_atom:
1389
- result = tre_ast_new_literal(ctx->mem, EMPTY, -1, -1);
1390
- if (!result)
1391
- return REG_ESPACE;
1392
- break;
1393
-
1394
- default:
1395
- parse_literal:
1396
-
1397
- clen = mbtowc(&wc, ctx->re, -1);
1398
- if (clen<0) clen=1, wc=WEOF;
1399
-
1400
- /* Note that we can't use an tre_isalpha() test here, since there
1401
- may be characters which are alphabetic but neither upper or
1402
- lower case. */
1403
- if (ctx->cflags & REG_ICASE
1404
- && (tre_isupper(wc) || tre_islower(wc)))
1405
- {
1406
- tre_ast_node_t *tmp1;
1407
- tre_ast_node_t *tmp2;
1408
-
1409
- /* XXX - Can there be more than one opposite-case
1410
- counterpoints for some character in some locale? Or
1411
- more than two characters which all should be regarded
1412
- the same character if case is ignored? If yes, there
1413
- does not seem to be a portable way to detect it. I guess
1414
- that at least for multi-character collating elements there
1415
- could be several opposite-case counterpoints, but they
1416
- cannot be supported portably anyway. */
1417
- tmp1 = tre_ast_new_literal(ctx->mem, tre_toupper(wc),
1418
- tre_toupper(wc),
1419
- ctx->position);
1420
- if (!tmp1)
1421
- return REG_ESPACE;
1422
- tmp2 = tre_ast_new_literal(ctx->mem, tre_tolower(wc),
1423
- tre_tolower(wc),
1424
- ctx->position);
1425
- if (!tmp2)
1426
- return REG_ESPACE;
1427
- result = tre_ast_new_union(ctx->mem, tmp1, tmp2);
1428
- if (!result)
1429
- return REG_ESPACE;
1430
- }
1431
- else
1432
- {
1433
- result = tre_ast_new_literal(ctx->mem, wc, wc,
1434
- ctx->position);
1435
- if (!result)
1436
- return REG_ESPACE;
1437
- }
1438
- ctx->position++;
1439
- ctx->re += clen;
1440
- break;
1441
- }
1442
- break;
1443
-
1444
- case PARSE_MARK_FOR_SUBMATCH:
1445
- {
1446
- int submatch_id = tre_stack_pop_int(stack);
1447
-
1448
- if (result->submatch_id >= 0)
1449
- {
1450
- tre_ast_node_t *n, *tmp_node;
1451
- n = tre_ast_new_literal(ctx->mem, EMPTY, -1, -1);
1452
- if (n == NULL)
1453
- return REG_ESPACE;
1454
- tmp_node = tre_ast_new_catenation(ctx->mem, n, result);
1455
- if (tmp_node == NULL)
1456
- return REG_ESPACE;
1457
- tmp_node->num_submatches = result->num_submatches;
1458
- result = tmp_node;
1459
- }
1460
- result->submatch_id = submatch_id;
1461
- result->num_submatches++;
1462
- break;
1463
- }
1464
-
1465
- case PARSE_RESTORE_CFLAGS:
1466
- ctx->cflags = tre_stack_pop_int(stack);
1467
- break;
1468
-
1469
- default:
1470
- assert(0);
1471
- break;
1472
- }
1473
- }
1474
-
1475
- /* Check for missing closing parentheses. */
1476
- if (depth > 0)
1477
- return REG_EPAREN;
1478
-
1479
- if (status == REG_OK)
1480
- ctx->result = result;
1481
-
1482
- return status;
1483
- }
1484
-
1485
-
1486
-
1487
- /***********************************************************************
1488
- from tre-compile.c
1489
- ***********************************************************************/
1490
-
1491
-
1492
- /*
1493
- TODO:
1494
- - Fix tre_ast_to_tnfa() to recurse using a stack instead of recursive
1495
- function calls.
1496
- */
1497
-
1498
- /*
1499
- Algorithms to setup tags so that submatch addressing can be done.
1500
- */
1501
-
1502
-
1503
- /* Inserts a catenation node to the root of the tree given in `node'.
1504
- As the left child a new tag with number `tag_id' to `node' is added,
1505
- and the right child is the old root. */
1506
- static reg_errcode_t
1507
- tre_add_tag_left(tre_mem_t mem, tre_ast_node_t *node, int tag_id)
1508
- {
1509
- tre_catenation_t *c;
1510
-
1511
- c = tre_mem_alloc(mem, sizeof(*c));
1512
- if (c == NULL)
1513
- return REG_ESPACE;
1514
- c->left = tre_ast_new_literal(mem, TAG, tag_id, -1);
1515
- if (c->left == NULL)
1516
- return REG_ESPACE;
1517
- c->right = tre_mem_alloc(mem, sizeof(tre_ast_node_t));
1518
- if (c->right == NULL)
1519
- return REG_ESPACE;
1520
-
1521
- c->right->obj = node->obj;
1522
- c->right->type = node->type;
1523
- c->right->nullable = -1;
1524
- c->right->submatch_id = -1;
1525
- c->right->firstpos = NULL;
1526
- c->right->lastpos = NULL;
1527
- c->right->num_tags = 0;
1528
- node->obj = c;
1529
- node->type = CATENATION;
1530
- return REG_OK;
1531
- }
1532
-
1533
- /* Inserts a catenation node to the root of the tree given in `node'.
1534
- As the right child a new tag with number `tag_id' to `node' is added,
1535
- and the left child is the old root. */
1536
- static reg_errcode_t
1537
- tre_add_tag_right(tre_mem_t mem, tre_ast_node_t *node, int tag_id)
1538
- {
1539
- tre_catenation_t *c;
1540
-
1541
- c = tre_mem_alloc(mem, sizeof(*c));
1542
- if (c == NULL)
1543
- return REG_ESPACE;
1544
- c->right = tre_ast_new_literal(mem, TAG, tag_id, -1);
1545
- if (c->right == NULL)
1546
- return REG_ESPACE;
1547
- c->left = tre_mem_alloc(mem, sizeof(tre_ast_node_t));
1548
- if (c->left == NULL)
1549
- return REG_ESPACE;
1550
-
1551
- c->left->obj = node->obj;
1552
- c->left->type = node->type;
1553
- c->left->nullable = -1;
1554
- c->left->submatch_id = -1;
1555
- c->left->firstpos = NULL;
1556
- c->left->lastpos = NULL;
1557
- c->left->num_tags = 0;
1558
- node->obj = c;
1559
- node->type = CATENATION;
1560
- return REG_OK;
1561
- }
1562
-
1563
- typedef enum {
1564
- ADDTAGS_RECURSE,
1565
- ADDTAGS_AFTER_ITERATION,
1566
- ADDTAGS_AFTER_UNION_LEFT,
1567
- ADDTAGS_AFTER_UNION_RIGHT,
1568
- ADDTAGS_AFTER_CAT_LEFT,
1569
- ADDTAGS_AFTER_CAT_RIGHT,
1570
- ADDTAGS_SET_SUBMATCH_END
1571
- } tre_addtags_symbol_t;
1572
-
1573
-
1574
- typedef struct {
1575
- int tag;
1576
- int next_tag;
1577
- } tre_tag_states_t;
1578
-
1579
-
1580
- /* Go through `regset' and set submatch data for submatches that are
1581
- using this tag. */
1582
- static void
1583
- tre_purge_regset(int *regset, tre_tnfa_t *tnfa, int tag)
1584
- {
1585
- int i;
1586
-
1587
- for (i = 0; regset[i] >= 0; i++)
1588
- {
1589
- int id = regset[i] / 2;
1590
- int start = !(regset[i] % 2);
1591
- if (start)
1592
- tnfa->submatch_data[id].so_tag = tag;
1593
- else
1594
- tnfa->submatch_data[id].eo_tag = tag;
1595
- }
1596
- regset[0] = -1;
1597
- }
1598
-
1599
-
1600
- /* Adds tags to appropriate locations in the parse tree in `tree', so that
1601
- subexpressions marked for submatch addressing can be traced. */
1602
- static reg_errcode_t
1603
- tre_add_tags(tre_mem_t mem, tre_stack_t *stack, tre_ast_node_t *tree,
1604
- tre_tnfa_t *tnfa)
1605
- {
1606
- reg_errcode_t status = REG_OK;
1607
- tre_addtags_symbol_t symbol;
1608
- tre_ast_node_t *node = tree; /* Tree node we are currently looking at. */
1609
- int bottom = tre_stack_num_objects(stack);
1610
- /* True for first pass (counting number of needed tags) */
1611
- int first_pass = (mem == NULL || tnfa == NULL);
1612
- int *regset, *orig_regset;
1613
- int num_tags = 0; /* Total number of tags. */
1614
- int num_minimals = 0; /* Number of special minimal tags. */
1615
- int tag = 0; /* The tag that is to be added next. */
1616
- int next_tag = 1; /* Next tag to use after this one. */
1617
- int *parents; /* Stack of submatches the current submatch is
1618
- contained in. */
1619
- int minimal_tag = -1; /* Tag that marks the beginning of a minimal match. */
1620
- tre_tag_states_t *saved_states;
1621
-
1622
- tre_tag_direction_t direction = TRE_TAG_MINIMIZE;
1623
- if (!first_pass)
1624
- {
1625
- tnfa->end_tag = 0;
1626
- tnfa->minimal_tags[0] = -1;
1627
- }
1628
-
1629
- regset = xmalloc(sizeof(*regset) * ((tnfa->num_submatches + 1) * 2));
1630
- if (regset == NULL)
1631
- return REG_ESPACE;
1632
- regset[0] = -1;
1633
- orig_regset = regset;
1634
-
1635
- parents = xmalloc(sizeof(*parents) * (tnfa->num_submatches + 1));
1636
- if (parents == NULL)
1637
- {
1638
- xfree(regset);
1639
- return REG_ESPACE;
1640
- }
1641
- parents[0] = -1;
1642
-
1643
- saved_states = xmalloc(sizeof(*saved_states) * (tnfa->num_submatches + 1));
1644
- if (saved_states == NULL)
1645
- {
1646
- xfree(regset);
1647
- xfree(parents);
1648
- return REG_ESPACE;
1649
- }
1650
- else
1651
- {
1652
- unsigned int i;
1653
- for (i = 0; i <= tnfa->num_submatches; i++)
1654
- saved_states[i].tag = -1;
1655
- }
1656
-
1657
- STACK_PUSH(stack, voidptr, node);
1658
- STACK_PUSH(stack, int, ADDTAGS_RECURSE);
1659
-
1660
- while (tre_stack_num_objects(stack) > bottom)
1661
- {
1662
- if (status != REG_OK)
1663
- break;
1664
-
1665
- symbol = (tre_addtags_symbol_t)tre_stack_pop_int(stack);
1666
- switch (symbol)
1667
- {
1668
-
1669
- case ADDTAGS_SET_SUBMATCH_END:
1670
- {
1671
- int id = tre_stack_pop_int(stack);
1672
- int i;
1673
-
1674
- /* Add end of this submatch to regset. */
1675
- for (i = 0; regset[i] >= 0; i++);
1676
- regset[i] = id * 2 + 1;
1677
- regset[i + 1] = -1;
1678
-
1679
- /* Pop this submatch from the parents stack. */
1680
- for (i = 0; parents[i] >= 0; i++);
1681
- parents[i - 1] = -1;
1682
- break;
1683
- }
1684
-
1685
- case ADDTAGS_RECURSE:
1686
- node = tre_stack_pop_voidptr(stack);
1687
-
1688
- if (node->submatch_id >= 0)
1689
- {
1690
- int id = node->submatch_id;
1691
- int i;
1692
-
1693
-
1694
- /* Add start of this submatch to regset. */
1695
- for (i = 0; regset[i] >= 0; i++);
1696
- regset[i] = id * 2;
1697
- regset[i + 1] = -1;
1698
-
1699
- if (!first_pass)
1700
- {
1701
- for (i = 0; parents[i] >= 0; i++);
1702
- tnfa->submatch_data[id].parents = NULL;
1703
- if (i > 0)
1704
- {
1705
- int *p = xmalloc(sizeof(*p) * (i + 1));
1706
- if (p == NULL)
1707
- {
1708
- status = REG_ESPACE;
1709
- break;
1710
- }
1711
- assert(tnfa->submatch_data[id].parents == NULL);
1712
- tnfa->submatch_data[id].parents = p;
1713
- for (i = 0; parents[i] >= 0; i++)
1714
- p[i] = parents[i];
1715
- p[i] = -1;
1716
- }
1717
- }
1718
-
1719
- /* Add end of this submatch to regset after processing this
1720
- node. */
1721
- STACK_PUSHX(stack, int, node->submatch_id);
1722
- STACK_PUSHX(stack, int, ADDTAGS_SET_SUBMATCH_END);
1723
- }
1724
-
1725
- switch (node->type)
1726
- {
1727
- case LITERAL:
1728
- {
1729
- tre_literal_t *lit = node->obj;
1730
-
1731
- if (!IS_SPECIAL(lit) || IS_BACKREF(lit))
1732
- {
1733
- int i;
1734
- if (regset[0] >= 0)
1735
- {
1736
- /* Regset is not empty, so add a tag before the
1737
- literal or backref. */
1738
- if (!first_pass)
1739
- {
1740
- status = tre_add_tag_left(mem, node, tag);
1741
- tnfa->tag_directions[tag] = direction;
1742
- if (minimal_tag >= 0)
1743
- {
1744
- for (i = 0; tnfa->minimal_tags[i] >= 0; i++);
1745
- tnfa->minimal_tags[i] = tag;
1746
- tnfa->minimal_tags[i + 1] = minimal_tag;
1747
- tnfa->minimal_tags[i + 2] = -1;
1748
- minimal_tag = -1;
1749
- num_minimals++;
1750
- }
1751
- tre_purge_regset(regset, tnfa, tag);
1752
- }
1753
- else
1754
- {
1755
- node->num_tags = 1;
1756
- }
1757
-
1758
- regset[0] = -1;
1759
- tag = next_tag;
1760
- num_tags++;
1761
- next_tag++;
1762
- }
1763
- }
1764
- else
1765
- {
1766
- assert(!IS_TAG(lit));
1767
- }
1768
- break;
1769
- }
1770
- case CATENATION:
1771
- {
1772
- tre_catenation_t *cat = node->obj;
1773
- tre_ast_node_t *left = cat->left;
1774
- tre_ast_node_t *right = cat->right;
1775
- int reserved_tag = -1;
1776
-
1777
-
1778
- /* After processing right child. */
1779
- STACK_PUSHX(stack, voidptr, node);
1780
- STACK_PUSHX(stack, int, ADDTAGS_AFTER_CAT_RIGHT);
1781
-
1782
- /* Process right child. */
1783
- STACK_PUSHX(stack, voidptr, right);
1784
- STACK_PUSHX(stack, int, ADDTAGS_RECURSE);
1785
-
1786
- /* After processing left child. */
1787
- STACK_PUSHX(stack, int, next_tag + left->num_tags);
1788
- if (left->num_tags > 0 && right->num_tags > 0)
1789
- {
1790
- /* Reserve the next tag to the right child. */
1791
- reserved_tag = next_tag;
1792
- next_tag++;
1793
- }
1794
- STACK_PUSHX(stack, int, reserved_tag);
1795
- STACK_PUSHX(stack, int, ADDTAGS_AFTER_CAT_LEFT);
1796
-
1797
- /* Process left child. */
1798
- STACK_PUSHX(stack, voidptr, left);
1799
- STACK_PUSHX(stack, int, ADDTAGS_RECURSE);
1800
-
1801
- }
1802
- break;
1803
- case ITERATION:
1804
- {
1805
- tre_iteration_t *iter = node->obj;
1806
-
1807
- if (first_pass)
1808
- {
1809
- STACK_PUSHX(stack, int, regset[0] >= 0 || iter->minimal);
1810
- }
1811
- else
1812
- {
1813
- STACK_PUSHX(stack, int, tag);
1814
- STACK_PUSHX(stack, int, iter->minimal);
1815
- }
1816
- STACK_PUSHX(stack, voidptr, node);
1817
- STACK_PUSHX(stack, int, ADDTAGS_AFTER_ITERATION);
1818
-
1819
- STACK_PUSHX(stack, voidptr, iter->arg);
1820
- STACK_PUSHX(stack, int, ADDTAGS_RECURSE);
1821
-
1822
- /* Regset is not empty, so add a tag here. */
1823
- if (regset[0] >= 0 || iter->minimal)
1824
- {
1825
- if (!first_pass)
1826
- {
1827
- int i;
1828
- status = tre_add_tag_left(mem, node, tag);
1829
- if (iter->minimal)
1830
- tnfa->tag_directions[tag] = TRE_TAG_MAXIMIZE;
1831
- else
1832
- tnfa->tag_directions[tag] = direction;
1833
- if (minimal_tag >= 0)
1834
- {
1835
- for (i = 0; tnfa->minimal_tags[i] >= 0; i++);
1836
- tnfa->minimal_tags[i] = tag;
1837
- tnfa->minimal_tags[i + 1] = minimal_tag;
1838
- tnfa->minimal_tags[i + 2] = -1;
1839
- minimal_tag = -1;
1840
- num_minimals++;
1841
- }
1842
- tre_purge_regset(regset, tnfa, tag);
1843
- }
1844
-
1845
- regset[0] = -1;
1846
- tag = next_tag;
1847
- num_tags++;
1848
- next_tag++;
1849
- }
1850
- direction = TRE_TAG_MINIMIZE;
1851
- }
1852
- break;
1853
- case UNION:
1854
- {
1855
- tre_union_t *uni = node->obj;
1856
- tre_ast_node_t *left = uni->left;
1857
- tre_ast_node_t *right = uni->right;
1858
- int left_tag;
1859
- int right_tag;
1860
-
1861
- if (regset[0] >= 0)
1862
- {
1863
- left_tag = next_tag;
1864
- right_tag = next_tag + 1;
1865
- }
1866
- else
1867
- {
1868
- left_tag = tag;
1869
- right_tag = next_tag;
1870
- }
1871
-
1872
- /* After processing right child. */
1873
- STACK_PUSHX(stack, int, right_tag);
1874
- STACK_PUSHX(stack, int, left_tag);
1875
- STACK_PUSHX(stack, voidptr, regset);
1876
- STACK_PUSHX(stack, int, regset[0] >= 0);
1877
- STACK_PUSHX(stack, voidptr, node);
1878
- STACK_PUSHX(stack, voidptr, right);
1879
- STACK_PUSHX(stack, voidptr, left);
1880
- STACK_PUSHX(stack, int, ADDTAGS_AFTER_UNION_RIGHT);
1881
-
1882
- /* Process right child. */
1883
- STACK_PUSHX(stack, voidptr, right);
1884
- STACK_PUSHX(stack, int, ADDTAGS_RECURSE);
1885
-
1886
- /* After processing left child. */
1887
- STACK_PUSHX(stack, int, ADDTAGS_AFTER_UNION_LEFT);
1888
-
1889
- /* Process left child. */
1890
- STACK_PUSHX(stack, voidptr, left);
1891
- STACK_PUSHX(stack, int, ADDTAGS_RECURSE);
1892
-
1893
- /* Regset is not empty, so add a tag here. */
1894
- if (regset[0] >= 0)
1895
- {
1896
- if (!first_pass)
1897
- {
1898
- int i;
1899
- status = tre_add_tag_left(mem, node, tag);
1900
- tnfa->tag_directions[tag] = direction;
1901
- if (minimal_tag >= 0)
1902
- {
1903
- for (i = 0; tnfa->minimal_tags[i] >= 0; i++);
1904
- tnfa->minimal_tags[i] = tag;
1905
- tnfa->minimal_tags[i + 1] = minimal_tag;
1906
- tnfa->minimal_tags[i + 2] = -1;
1907
- minimal_tag = -1;
1908
- num_minimals++;
1909
- }
1910
- tre_purge_regset(regset, tnfa, tag);
1911
- }
1912
-
1913
- regset[0] = -1;
1914
- tag = next_tag;
1915
- num_tags++;
1916
- next_tag++;
1917
- }
1918
-
1919
- if (node->num_submatches > 0)
1920
- {
1921
- /* The next two tags are reserved for markers. */
1922
- next_tag++;
1923
- tag = next_tag;
1924
- next_tag++;
1925
- }
1926
-
1927
- break;
1928
- }
1929
- }
1930
-
1931
- if (node->submatch_id >= 0)
1932
- {
1933
- int i;
1934
- /* Push this submatch on the parents stack. */
1935
- for (i = 0; parents[i] >= 0; i++);
1936
- parents[i] = node->submatch_id;
1937
- parents[i + 1] = -1;
1938
- }
1939
-
1940
- break; /* end case: ADDTAGS_RECURSE */
1941
-
1942
- case ADDTAGS_AFTER_ITERATION:
1943
- {
1944
- int minimal = 0;
1945
- int enter_tag;
1946
- node = tre_stack_pop_voidptr(stack);
1947
- if (first_pass)
1948
- {
1949
- node->num_tags = ((tre_iteration_t *)node->obj)->arg->num_tags
1950
- + tre_stack_pop_int(stack);
1951
- minimal_tag = -1;
1952
- }
1953
- else
1954
- {
1955
- minimal = tre_stack_pop_int(stack);
1956
- enter_tag = tre_stack_pop_int(stack);
1957
- if (minimal)
1958
- minimal_tag = enter_tag;
1959
- }
1960
-
1961
- if (!first_pass)
1962
- {
1963
- if (minimal)
1964
- direction = TRE_TAG_MINIMIZE;
1965
- else
1966
- direction = TRE_TAG_MAXIMIZE;
1967
- }
1968
- break;
1969
- }
1970
-
1971
- case ADDTAGS_AFTER_CAT_LEFT:
1972
- {
1973
- int new_tag = tre_stack_pop_int(stack);
1974
- next_tag = tre_stack_pop_int(stack);
1975
- if (new_tag >= 0)
1976
- {
1977
- tag = new_tag;
1978
- }
1979
- break;
1980
- }
1981
-
1982
- case ADDTAGS_AFTER_CAT_RIGHT:
1983
- node = tre_stack_pop_voidptr(stack);
1984
- if (first_pass)
1985
- node->num_tags = ((tre_catenation_t *)node->obj)->left->num_tags
1986
- + ((tre_catenation_t *)node->obj)->right->num_tags;
1987
- break;
1988
-
1989
- case ADDTAGS_AFTER_UNION_LEFT:
1990
- /* Lift the bottom of the `regset' array so that when processing
1991
- the right operand the items currently in the array are
1992
- invisible. The original bottom was saved at ADDTAGS_UNION and
1993
- will be restored at ADDTAGS_AFTER_UNION_RIGHT below. */
1994
- while (*regset >= 0)
1995
- regset++;
1996
- break;
1997
-
1998
- case ADDTAGS_AFTER_UNION_RIGHT:
1999
- {
2000
- int added_tags, tag_left, tag_right;
2001
- tre_ast_node_t *left = tre_stack_pop_voidptr(stack);
2002
- tre_ast_node_t *right = tre_stack_pop_voidptr(stack);
2003
- node = tre_stack_pop_voidptr(stack);
2004
- added_tags = tre_stack_pop_int(stack);
2005
- if (first_pass)
2006
- {
2007
- node->num_tags = ((tre_union_t *)node->obj)->left->num_tags
2008
- + ((tre_union_t *)node->obj)->right->num_tags + added_tags
2009
- + ((node->num_submatches > 0) ? 2 : 0);
2010
- }
2011
- regset = tre_stack_pop_voidptr(stack);
2012
- tag_left = tre_stack_pop_int(stack);
2013
- tag_right = tre_stack_pop_int(stack);
2014
-
2015
- /* Add tags after both children, the left child gets a smaller
2016
- tag than the right child. This guarantees that we prefer
2017
- the left child over the right child. */
2018
- /* XXX - This is not always necessary (if the children have
2019
- tags which must be seen for every match of that child). */
2020
- /* XXX - Check if this is the only place where tre_add_tag_right
2021
- is used. If so, use tre_add_tag_left (putting the tag before
2022
- the child as opposed after the child) and throw away
2023
- tre_add_tag_right. */
2024
- if (node->num_submatches > 0)
2025
- {
2026
- if (!first_pass)
2027
- {
2028
- status = tre_add_tag_right(mem, left, tag_left);
2029
- tnfa->tag_directions[tag_left] = TRE_TAG_MAXIMIZE;
2030
- status = tre_add_tag_right(mem, right, tag_right);
2031
- tnfa->tag_directions[tag_right] = TRE_TAG_MAXIMIZE;
2032
- }
2033
- num_tags += 2;
2034
- }
2035
- direction = TRE_TAG_MAXIMIZE;
2036
- break;
2037
- }
2038
-
2039
- default:
2040
- assert(0);
2041
- break;
2042
-
2043
- } /* end switch(symbol) */
2044
- } /* end while(tre_stack_num_objects(stack) > bottom) */
2045
-
2046
- if (!first_pass)
2047
- tre_purge_regset(regset, tnfa, tag);
2048
-
2049
- if (!first_pass && minimal_tag >= 0)
2050
- {
2051
- int i;
2052
- for (i = 0; tnfa->minimal_tags[i] >= 0; i++);
2053
- tnfa->minimal_tags[i] = tag;
2054
- tnfa->minimal_tags[i + 1] = minimal_tag;
2055
- tnfa->minimal_tags[i + 2] = -1;
2056
- minimal_tag = -1;
2057
- num_minimals++;
2058
- }
2059
-
2060
- assert(tree->num_tags == num_tags);
2061
- tnfa->end_tag = num_tags;
2062
- tnfa->num_tags = num_tags;
2063
- tnfa->num_minimals = num_minimals;
2064
- xfree(orig_regset);
2065
- xfree(parents);
2066
- xfree(saved_states);
2067
- return status;
2068
- }
2069
-
2070
-
2071
-
2072
- /*
2073
- AST to TNFA compilation routines.
2074
- */
2075
-
2076
- typedef enum {
2077
- COPY_RECURSE,
2078
- COPY_SET_RESULT_PTR
2079
- } tre_copyast_symbol_t;
2080
-
2081
- /* Flags for tre_copy_ast(). */
2082
- #define COPY_REMOVE_TAGS 1
2083
- #define COPY_MAXIMIZE_FIRST_TAG 2
2084
-
2085
- static reg_errcode_t
2086
- tre_copy_ast(tre_mem_t mem, tre_stack_t *stack, tre_ast_node_t *ast,
2087
- int flags, int *pos_add, tre_tag_direction_t *tag_directions,
2088
- tre_ast_node_t **copy, int *max_pos)
2089
- {
2090
- reg_errcode_t status = REG_OK;
2091
- int bottom = tre_stack_num_objects(stack);
2092
- int num_copied = 0;
2093
- int first_tag = 1;
2094
- tre_ast_node_t **result = copy;
2095
- tre_copyast_symbol_t symbol;
2096
-
2097
- STACK_PUSH(stack, voidptr, ast);
2098
- STACK_PUSH(stack, int, COPY_RECURSE);
2099
-
2100
- while (status == REG_OK && tre_stack_num_objects(stack) > bottom)
2101
- {
2102
- tre_ast_node_t *node;
2103
- if (status != REG_OK)
2104
- break;
2105
-
2106
- symbol = (tre_copyast_symbol_t)tre_stack_pop_int(stack);
2107
- switch (symbol)
2108
- {
2109
- case COPY_SET_RESULT_PTR:
2110
- result = tre_stack_pop_voidptr(stack);
2111
- break;
2112
- case COPY_RECURSE:
2113
- node = tre_stack_pop_voidptr(stack);
2114
- switch (node->type)
2115
- {
2116
- case LITERAL:
2117
- {
2118
- tre_literal_t *lit = node->obj;
2119
- int pos = lit->position;
2120
- int min = lit->code_min;
2121
- int max = lit->code_max;
2122
- if (!IS_SPECIAL(lit) || IS_BACKREF(lit))
2123
- {
2124
- /* XXX - e.g. [ab] has only one position but two
2125
- nodes, so we are creating holes in the state space
2126
- here. Not fatal, just wastes memory. */
2127
- pos += *pos_add;
2128
- num_copied++;
2129
- }
2130
- else if (IS_TAG(lit) && (flags & COPY_REMOVE_TAGS))
2131
- {
2132
- /* Change this tag to empty. */
2133
- min = EMPTY;
2134
- max = pos = -1;
2135
- }
2136
- else if (IS_TAG(lit) && (flags & COPY_MAXIMIZE_FIRST_TAG)
2137
- && first_tag)
2138
- {
2139
- /* Maximize the first tag. */
2140
- tag_directions[max] = TRE_TAG_MAXIMIZE;
2141
- first_tag = 0;
2142
- }
2143
- *result = tre_ast_new_literal(mem, min, max, pos);
2144
- if (*result == NULL)
2145
- status = REG_ESPACE;
2146
-
2147
- if (pos > *max_pos)
2148
- *max_pos = pos;
2149
- break;
2150
- }
2151
- case UNION:
2152
- {
2153
- tre_union_t *uni = node->obj;
2154
- tre_union_t *tmp;
2155
- *result = tre_ast_new_union(mem, uni->left, uni->right);
2156
- if (*result == NULL)
2157
- {
2158
- status = REG_ESPACE;
2159
- break;
2160
- }
2161
- tmp = (*result)->obj;
2162
- result = &tmp->left;
2163
- STACK_PUSHX(stack, voidptr, uni->right);
2164
- STACK_PUSHX(stack, int, COPY_RECURSE);
2165
- STACK_PUSHX(stack, voidptr, &tmp->right);
2166
- STACK_PUSHX(stack, int, COPY_SET_RESULT_PTR);
2167
- STACK_PUSHX(stack, voidptr, uni->left);
2168
- STACK_PUSHX(stack, int, COPY_RECURSE);
2169
- break;
2170
- }
2171
- case CATENATION:
2172
- {
2173
- tre_catenation_t *cat = node->obj;
2174
- tre_catenation_t *tmp;
2175
- *result = tre_ast_new_catenation(mem, cat->left, cat->right);
2176
- if (*result == NULL)
2177
- {
2178
- status = REG_ESPACE;
2179
- break;
2180
- }
2181
- tmp = (*result)->obj;
2182
- tmp->left = NULL;
2183
- tmp->right = NULL;
2184
- result = &tmp->left;
2185
-
2186
- STACK_PUSHX(stack, voidptr, cat->right);
2187
- STACK_PUSHX(stack, int, COPY_RECURSE);
2188
- STACK_PUSHX(stack, voidptr, &tmp->right);
2189
- STACK_PUSHX(stack, int, COPY_SET_RESULT_PTR);
2190
- STACK_PUSHX(stack, voidptr, cat->left);
2191
- STACK_PUSHX(stack, int, COPY_RECURSE);
2192
- break;
2193
- }
2194
- case ITERATION:
2195
- {
2196
- tre_iteration_t *iter = node->obj;
2197
- STACK_PUSHX(stack, voidptr, iter->arg);
2198
- STACK_PUSHX(stack, int, COPY_RECURSE);
2199
- *result = tre_ast_new_iter(mem, iter->arg, iter->min,
2200
- iter->max, iter->minimal);
2201
- if (*result == NULL)
2202
- {
2203
- status = REG_ESPACE;
2204
- break;
2205
- }
2206
- iter = (*result)->obj;
2207
- result = &iter->arg;
2208
- break;
2209
- }
2210
- default:
2211
- assert(0);
2212
- break;
2213
- }
2214
- break;
2215
- }
2216
- }
2217
- *pos_add += num_copied;
2218
- return status;
2219
- }
2220
-
2221
- typedef enum {
2222
- EXPAND_RECURSE,
2223
- EXPAND_AFTER_ITER
2224
- } tre_expand_ast_symbol_t;
2225
-
2226
- /* Expands each iteration node that has a finite nonzero minimum or maximum
2227
- iteration count to a catenated sequence of copies of the node. */
2228
- static reg_errcode_t
2229
- tre_expand_ast(tre_mem_t mem, tre_stack_t *stack, tre_ast_node_t *ast,
2230
- int *position, tre_tag_direction_t *tag_directions)
2231
- {
2232
- reg_errcode_t status = REG_OK;
2233
- int bottom = tre_stack_num_objects(stack);
2234
- int pos_add = 0;
2235
- int pos_add_total = 0;
2236
- int max_pos = 0;
2237
- int iter_depth = 0;
2238
-
2239
- STACK_PUSHR(stack, voidptr, ast);
2240
- STACK_PUSHR(stack, int, EXPAND_RECURSE);
2241
- while (status == REG_OK && tre_stack_num_objects(stack) > bottom)
2242
- {
2243
- tre_ast_node_t *node;
2244
- tre_expand_ast_symbol_t symbol;
2245
-
2246
- if (status != REG_OK)
2247
- break;
2248
-
2249
- symbol = (tre_expand_ast_symbol_t)tre_stack_pop_int(stack);
2250
- node = tre_stack_pop_voidptr(stack);
2251
- switch (symbol)
2252
- {
2253
- case EXPAND_RECURSE:
2254
- switch (node->type)
2255
- {
2256
- case LITERAL:
2257
- {
2258
- tre_literal_t *lit= node->obj;
2259
- if (!IS_SPECIAL(lit) || IS_BACKREF(lit))
2260
- {
2261
- lit->position += pos_add;
2262
- if (lit->position > max_pos)
2263
- max_pos = lit->position;
2264
- }
2265
- break;
2266
- }
2267
- case UNION:
2268
- {
2269
- tre_union_t *uni = node->obj;
2270
- STACK_PUSHX(stack, voidptr, uni->right);
2271
- STACK_PUSHX(stack, int, EXPAND_RECURSE);
2272
- STACK_PUSHX(stack, voidptr, uni->left);
2273
- STACK_PUSHX(stack, int, EXPAND_RECURSE);
2274
- break;
2275
- }
2276
- case CATENATION:
2277
- {
2278
- tre_catenation_t *cat = node->obj;
2279
- STACK_PUSHX(stack, voidptr, cat->right);
2280
- STACK_PUSHX(stack, int, EXPAND_RECURSE);
2281
- STACK_PUSHX(stack, voidptr, cat->left);
2282
- STACK_PUSHX(stack, int, EXPAND_RECURSE);
2283
- break;
2284
- }
2285
- case ITERATION:
2286
- {
2287
- tre_iteration_t *iter = node->obj;
2288
- STACK_PUSHX(stack, int, pos_add);
2289
- STACK_PUSHX(stack, voidptr, node);
2290
- STACK_PUSHX(stack, int, EXPAND_AFTER_ITER);
2291
- STACK_PUSHX(stack, voidptr, iter->arg);
2292
- STACK_PUSHX(stack, int, EXPAND_RECURSE);
2293
- /* If we are going to expand this node at EXPAND_AFTER_ITER
2294
- then don't increase the `pos' fields of the nodes now, it
2295
- will get done when expanding. */
2296
- if (iter->min > 1 || iter->max > 1)
2297
- pos_add = 0;
2298
- iter_depth++;
2299
- break;
2300
- }
2301
- default:
2302
- assert(0);
2303
- break;
2304
- }
2305
- break;
2306
- case EXPAND_AFTER_ITER:
2307
- {
2308
- tre_iteration_t *iter = node->obj;
2309
- int pos_add_last;
2310
- pos_add = tre_stack_pop_int(stack);
2311
- pos_add_last = pos_add;
2312
- if (iter->min > 1 || iter->max > 1)
2313
- {
2314
- tre_ast_node_t *seq1 = NULL, *seq2 = NULL;
2315
- int j;
2316
- int pos_add_save = pos_add;
2317
-
2318
- /* Create a catenated sequence of copies of the node. */
2319
- for (j = 0; j < iter->min; j++)
2320
- {
2321
- tre_ast_node_t *copy;
2322
- /* Remove tags from all but the last copy. */
2323
- int flags = ((j + 1 < iter->min)
2324
- ? COPY_REMOVE_TAGS
2325
- : COPY_MAXIMIZE_FIRST_TAG);
2326
- pos_add_save = pos_add;
2327
- status = tre_copy_ast(mem, stack, iter->arg, flags,
2328
- &pos_add, tag_directions, &copy,
2329
- &max_pos);
2330
- if (status != REG_OK)
2331
- return status;
2332
- if (seq1 != NULL)
2333
- seq1 = tre_ast_new_catenation(mem, seq1, copy);
2334
- else
2335
- seq1 = copy;
2336
- if (seq1 == NULL)
2337
- return REG_ESPACE;
2338
- }
2339
-
2340
- if (iter->max == -1)
2341
- {
2342
- /* No upper limit. */
2343
- pos_add_save = pos_add;
2344
- status = tre_copy_ast(mem, stack, iter->arg, 0,
2345
- &pos_add, NULL, &seq2, &max_pos);
2346
- if (status != REG_OK)
2347
- return status;
2348
- seq2 = tre_ast_new_iter(mem, seq2, 0, -1, 0);
2349
- if (seq2 == NULL)
2350
- return REG_ESPACE;
2351
- }
2352
- else
2353
- {
2354
- for (j = iter->min; j < iter->max; j++)
2355
- {
2356
- tre_ast_node_t *tmp, *copy;
2357
- pos_add_save = pos_add;
2358
- status = tre_copy_ast(mem, stack, iter->arg, 0,
2359
- &pos_add, NULL, &copy, &max_pos);
2360
- if (status != REG_OK)
2361
- return status;
2362
- if (seq2 != NULL)
2363
- seq2 = tre_ast_new_catenation(mem, copy, seq2);
2364
- else
2365
- seq2 = copy;
2366
- if (seq2 == NULL)
2367
- return REG_ESPACE;
2368
- tmp = tre_ast_new_literal(mem, EMPTY, -1, -1);
2369
- if (tmp == NULL)
2370
- return REG_ESPACE;
2371
- seq2 = tre_ast_new_union(mem, tmp, seq2);
2372
- if (seq2 == NULL)
2373
- return REG_ESPACE;
2374
- }
2375
- }
2376
-
2377
- pos_add = pos_add_save;
2378
- if (seq1 == NULL)
2379
- seq1 = seq2;
2380
- else if (seq2 != NULL)
2381
- seq1 = tre_ast_new_catenation(mem, seq1, seq2);
2382
- if (seq1 == NULL)
2383
- return REG_ESPACE;
2384
- node->obj = seq1->obj;
2385
- node->type = seq1->type;
2386
- }
2387
-
2388
- iter_depth--;
2389
- pos_add_total += pos_add - pos_add_last;
2390
- if (iter_depth == 0)
2391
- pos_add = pos_add_total;
2392
-
2393
- break;
2394
- }
2395
- default:
2396
- assert(0);
2397
- break;
2398
- }
2399
- }
2400
-
2401
- *position += pos_add_total;
2402
-
2403
- /* `max_pos' should never be larger than `*position' if the above
2404
- code works, but just an extra safeguard let's make sure
2405
- `*position' is set large enough so enough memory will be
2406
- allocated for the transition table. */
2407
- if (max_pos > *position)
2408
- *position = max_pos;
2409
-
2410
- return status;
2411
- }
2412
-
2413
- static tre_pos_and_tags_t *
2414
- tre_set_empty(tre_mem_t mem)
2415
- {
2416
- tre_pos_and_tags_t *new_set;
2417
-
2418
- new_set = tre_mem_calloc(mem, sizeof(*new_set));
2419
- if (new_set == NULL)
2420
- return NULL;
2421
-
2422
- new_set[0].position = -1;
2423
- new_set[0].code_min = -1;
2424
- new_set[0].code_max = -1;
2425
-
2426
- return new_set;
2427
- }
2428
-
2429
- static tre_pos_and_tags_t *
2430
- tre_set_one(tre_mem_t mem, int position, int code_min, int code_max,
2431
- tre_ctype_t class, tre_ctype_t *neg_classes, int backref)
2432
- {
2433
- tre_pos_and_tags_t *new_set;
2434
-
2435
- new_set = tre_mem_calloc(mem, sizeof(*new_set) * 2);
2436
- if (new_set == NULL)
2437
- return NULL;
2438
-
2439
- new_set[0].position = position;
2440
- new_set[0].code_min = code_min;
2441
- new_set[0].code_max = code_max;
2442
- new_set[0].class = class;
2443
- new_set[0].neg_classes = neg_classes;
2444
- new_set[0].backref = backref;
2445
- new_set[1].position = -1;
2446
- new_set[1].code_min = -1;
2447
- new_set[1].code_max = -1;
2448
-
2449
- return new_set;
2450
- }
2451
-
2452
- static tre_pos_and_tags_t *
2453
- tre_set_union(tre_mem_t mem, tre_pos_and_tags_t *set1, tre_pos_and_tags_t *set2,
2454
- int *tags, int assertions)
2455
- {
2456
- int s1, s2, i, j;
2457
- tre_pos_and_tags_t *new_set;
2458
- int *new_tags;
2459
- int num_tags;
2460
-
2461
- for (num_tags = 0; tags != NULL && tags[num_tags] >= 0; num_tags++);
2462
- for (s1 = 0; set1[s1].position >= 0; s1++);
2463
- for (s2 = 0; set2[s2].position >= 0; s2++);
2464
- new_set = tre_mem_calloc(mem, sizeof(*new_set) * (s1 + s2 + 1));
2465
- if (!new_set )
2466
- return NULL;
2467
-
2468
- for (s1 = 0; set1[s1].position >= 0; s1++)
2469
- {
2470
- new_set[s1].position = set1[s1].position;
2471
- new_set[s1].code_min = set1[s1].code_min;
2472
- new_set[s1].code_max = set1[s1].code_max;
2473
- new_set[s1].assertions = set1[s1].assertions | assertions;
2474
- new_set[s1].class = set1[s1].class;
2475
- new_set[s1].neg_classes = set1[s1].neg_classes;
2476
- new_set[s1].backref = set1[s1].backref;
2477
- if (set1[s1].tags == NULL && tags == NULL)
2478
- new_set[s1].tags = NULL;
2479
- else
2480
- {
2481
- for (i = 0; set1[s1].tags != NULL && set1[s1].tags[i] >= 0; i++);
2482
- new_tags = tre_mem_alloc(mem, (sizeof(*new_tags)
2483
- * (i + num_tags + 1)));
2484
- if (new_tags == NULL)
2485
- return NULL;
2486
- for (j = 0; j < i; j++)
2487
- new_tags[j] = set1[s1].tags[j];
2488
- for (i = 0; i < num_tags; i++)
2489
- new_tags[j + i] = tags[i];
2490
- new_tags[j + i] = -1;
2491
- new_set[s1].tags = new_tags;
2492
- }
2493
- }
2494
-
2495
- for (s2 = 0; set2[s2].position >= 0; s2++)
2496
- {
2497
- new_set[s1 + s2].position = set2[s2].position;
2498
- new_set[s1 + s2].code_min = set2[s2].code_min;
2499
- new_set[s1 + s2].code_max = set2[s2].code_max;
2500
- /* XXX - why not | assertions here as well? */
2501
- new_set[s1 + s2].assertions = set2[s2].assertions;
2502
- new_set[s1 + s2].class = set2[s2].class;
2503
- new_set[s1 + s2].neg_classes = set2[s2].neg_classes;
2504
- new_set[s1 + s2].backref = set2[s2].backref;
2505
- if (set2[s2].tags == NULL)
2506
- new_set[s1 + s2].tags = NULL;
2507
- else
2508
- {
2509
- for (i = 0; set2[s2].tags[i] >= 0; i++);
2510
- new_tags = tre_mem_alloc(mem, sizeof(*new_tags) * (i + 1));
2511
- if (new_tags == NULL)
2512
- return NULL;
2513
- for (j = 0; j < i; j++)
2514
- new_tags[j] = set2[s2].tags[j];
2515
- new_tags[j] = -1;
2516
- new_set[s1 + s2].tags = new_tags;
2517
- }
2518
- }
2519
- new_set[s1 + s2].position = -1;
2520
- return new_set;
2521
- }
2522
-
2523
- /* Finds the empty path through `node' which is the one that should be
2524
- taken according to POSIX.2 rules, and adds the tags on that path to
2525
- `tags'. `tags' may be NULL. If `num_tags_seen' is not NULL, it is
2526
- set to the number of tags seen on the path. */
2527
- static reg_errcode_t
2528
- tre_match_empty(tre_stack_t *stack, tre_ast_node_t *node, int *tags,
2529
- int *assertions, int *num_tags_seen)
2530
- {
2531
- tre_literal_t *lit;
2532
- tre_union_t *uni;
2533
- tre_catenation_t *cat;
2534
- tre_iteration_t *iter;
2535
- int i;
2536
- int bottom = tre_stack_num_objects(stack);
2537
- reg_errcode_t status = REG_OK;
2538
- if (num_tags_seen)
2539
- *num_tags_seen = 0;
2540
-
2541
- status = tre_stack_push_voidptr(stack, node);
2542
-
2543
- /* Walk through the tree recursively. */
2544
- while (status == REG_OK && tre_stack_num_objects(stack) > bottom)
2545
- {
2546
- node = tre_stack_pop_voidptr(stack);
2547
-
2548
- switch (node->type)
2549
- {
2550
- case LITERAL:
2551
- lit = (tre_literal_t *)node->obj;
2552
- switch (lit->code_min)
2553
- {
2554
- case TAG:
2555
- if (lit->code_max >= 0)
2556
- {
2557
- if (tags != NULL)
2558
- {
2559
- /* Add the tag to `tags'. */
2560
- for (i = 0; tags[i] >= 0; i++)
2561
- if (tags[i] == lit->code_max)
2562
- break;
2563
- if (tags[i] < 0)
2564
- {
2565
- tags[i] = lit->code_max;
2566
- tags[i + 1] = -1;
2567
- }
2568
- }
2569
- if (num_tags_seen)
2570
- (*num_tags_seen)++;
2571
- }
2572
- break;
2573
- case ASSERTION:
2574
- assert(lit->code_max >= 1
2575
- || lit->code_max <= ASSERT_LAST);
2576
- if (assertions != NULL)
2577
- *assertions |= lit->code_max;
2578
- break;
2579
- case EMPTY:
2580
- break;
2581
- default:
2582
- assert(0);
2583
- break;
2584
- }
2585
- break;
2586
-
2587
- case UNION:
2588
- /* Subexpressions starting earlier take priority over ones
2589
- starting later, so we prefer the left subexpression over the
2590
- right subexpression. */
2591
- uni = (tre_union_t *)node->obj;
2592
- if (uni->left->nullable)
2593
- STACK_PUSHX(stack, voidptr, uni->left)
2594
- else if (uni->right->nullable)
2595
- STACK_PUSHX(stack, voidptr, uni->right)
2596
- else
2597
- assert(0);
2598
- break;
2599
-
2600
- case CATENATION:
2601
- /* The path must go through both children. */
2602
- cat = (tre_catenation_t *)node->obj;
2603
- assert(cat->left->nullable);
2604
- assert(cat->right->nullable);
2605
- STACK_PUSHX(stack, voidptr, cat->left);
2606
- STACK_PUSHX(stack, voidptr, cat->right);
2607
- break;
2608
-
2609
- case ITERATION:
2610
- /* A match with an empty string is preferred over no match at
2611
- all, so we go through the argument if possible. */
2612
- iter = (tre_iteration_t *)node->obj;
2613
- if (iter->arg->nullable)
2614
- STACK_PUSHX(stack, voidptr, iter->arg);
2615
- break;
2616
-
2617
- default:
2618
- assert(0);
2619
- break;
2620
- }
2621
- }
2622
-
2623
- return status;
2624
- }
2625
-
2626
-
2627
- typedef enum {
2628
- NFL_RECURSE,
2629
- NFL_POST_UNION,
2630
- NFL_POST_CATENATION,
2631
- NFL_POST_ITERATION
2632
- } tre_nfl_stack_symbol_t;
2633
-
2634
-
2635
- /* Computes and fills in the fields `nullable', `firstpos', and `lastpos' for
2636
- the nodes of the AST `tree'. */
2637
- static reg_errcode_t
2638
- tre_compute_nfl(tre_mem_t mem, tre_stack_t *stack, tre_ast_node_t *tree)
2639
- {
2640
- int bottom = tre_stack_num_objects(stack);
2641
-
2642
- STACK_PUSHR(stack, voidptr, tree);
2643
- STACK_PUSHR(stack, int, NFL_RECURSE);
2644
-
2645
- while (tre_stack_num_objects(stack) > bottom)
2646
- {
2647
- tre_nfl_stack_symbol_t symbol;
2648
- tre_ast_node_t *node;
2649
-
2650
- symbol = (tre_nfl_stack_symbol_t)tre_stack_pop_int(stack);
2651
- node = tre_stack_pop_voidptr(stack);
2652
- switch (symbol)
2653
- {
2654
- case NFL_RECURSE:
2655
- switch (node->type)
2656
- {
2657
- case LITERAL:
2658
- {
2659
- tre_literal_t *lit = (tre_literal_t *)node->obj;
2660
- if (IS_BACKREF(lit))
2661
- {
2662
- /* Back references: nullable = false, firstpos = {i},
2663
- lastpos = {i}. */
2664
- node->nullable = 0;
2665
- node->firstpos = tre_set_one(mem, lit->position, 0,
2666
- TRE_CHAR_MAX, 0, NULL, -1);
2667
- if (!node->firstpos)
2668
- return REG_ESPACE;
2669
- node->lastpos = tre_set_one(mem, lit->position, 0,
2670
- TRE_CHAR_MAX, 0, NULL,
2671
- (int)lit->code_max);
2672
- if (!node->lastpos)
2673
- return REG_ESPACE;
2674
- }
2675
- else if (lit->code_min < 0)
2676
- {
2677
- /* Tags, empty strings, params, and zero width assertions:
2678
- nullable = true, firstpos = {}, and lastpos = {}. */
2679
- node->nullable = 1;
2680
- node->firstpos = tre_set_empty(mem);
2681
- if (!node->firstpos)
2682
- return REG_ESPACE;
2683
- node->lastpos = tre_set_empty(mem);
2684
- if (!node->lastpos)
2685
- return REG_ESPACE;
2686
- }
2687
- else
2688
- {
2689
- /* Literal at position i: nullable = false, firstpos = {i},
2690
- lastpos = {i}. */
2691
- node->nullable = 0;
2692
- node->firstpos =
2693
- tre_set_one(mem, lit->position, (int)lit->code_min,
2694
- (int)lit->code_max, 0, NULL, -1);
2695
- if (!node->firstpos)
2696
- return REG_ESPACE;
2697
- node->lastpos = tre_set_one(mem, lit->position,
2698
- (int)lit->code_min,
2699
- (int)lit->code_max,
2700
- lit->class, lit->neg_classes,
2701
- -1);
2702
- if (!node->lastpos)
2703
- return REG_ESPACE;
2704
- }
2705
- break;
2706
- }
2707
-
2708
- case UNION:
2709
- /* Compute the attributes for the two subtrees, and after that
2710
- for this node. */
2711
- STACK_PUSHR(stack, voidptr, node);
2712
- STACK_PUSHR(stack, int, NFL_POST_UNION);
2713
- STACK_PUSHR(stack, voidptr, ((tre_union_t *)node->obj)->right);
2714
- STACK_PUSHR(stack, int, NFL_RECURSE);
2715
- STACK_PUSHR(stack, voidptr, ((tre_union_t *)node->obj)->left);
2716
- STACK_PUSHR(stack, int, NFL_RECURSE);
2717
- break;
2718
-
2719
- case CATENATION:
2720
- /* Compute the attributes for the two subtrees, and after that
2721
- for this node. */
2722
- STACK_PUSHR(stack, voidptr, node);
2723
- STACK_PUSHR(stack, int, NFL_POST_CATENATION);
2724
- STACK_PUSHR(stack, voidptr, ((tre_catenation_t *)node->obj)->right);
2725
- STACK_PUSHR(stack, int, NFL_RECURSE);
2726
- STACK_PUSHR(stack, voidptr, ((tre_catenation_t *)node->obj)->left);
2727
- STACK_PUSHR(stack, int, NFL_RECURSE);
2728
- break;
2729
-
2730
- case ITERATION:
2731
- /* Compute the attributes for the subtree, and after that for
2732
- this node. */
2733
- STACK_PUSHR(stack, voidptr, node);
2734
- STACK_PUSHR(stack, int, NFL_POST_ITERATION);
2735
- STACK_PUSHR(stack, voidptr, ((tre_iteration_t *)node->obj)->arg);
2736
- STACK_PUSHR(stack, int, NFL_RECURSE);
2737
- break;
2738
- }
2739
- break; /* end case: NFL_RECURSE */
2740
-
2741
- case NFL_POST_UNION:
2742
- {
2743
- tre_union_t *uni = (tre_union_t *)node->obj;
2744
- node->nullable = uni->left->nullable || uni->right->nullable;
2745
- node->firstpos = tre_set_union(mem, uni->left->firstpos,
2746
- uni->right->firstpos, NULL, 0);
2747
- if (!node->firstpos)
2748
- return REG_ESPACE;
2749
- node->lastpos = tre_set_union(mem, uni->left->lastpos,
2750
- uni->right->lastpos, NULL, 0);
2751
- if (!node->lastpos)
2752
- return REG_ESPACE;
2753
- break;
2754
- }
2755
-
2756
- case NFL_POST_ITERATION:
2757
- {
2758
- tre_iteration_t *iter = (tre_iteration_t *)node->obj;
2759
-
2760
- if (iter->min == 0 || iter->arg->nullable)
2761
- node->nullable = 1;
2762
- else
2763
- node->nullable = 0;
2764
- node->firstpos = iter->arg->firstpos;
2765
- node->lastpos = iter->arg->lastpos;
2766
- break;
2767
- }
2768
-
2769
- case NFL_POST_CATENATION:
2770
- {
2771
- int num_tags, *tags, assertions;
2772
- reg_errcode_t status;
2773
- tre_catenation_t *cat = node->obj;
2774
- node->nullable = cat->left->nullable && cat->right->nullable;
2775
-
2776
- /* Compute firstpos. */
2777
- if (cat->left->nullable)
2778
- {
2779
- /* The left side matches the empty string. Make a first pass
2780
- with tre_match_empty() to get the number of tags and
2781
- parameters. */
2782
- status = tre_match_empty(stack, cat->left,
2783
- NULL, NULL, &num_tags);
2784
- if (status != REG_OK)
2785
- return status;
2786
- /* Allocate arrays for the tags and parameters. */
2787
- tags = xmalloc(sizeof(*tags) * (num_tags + 1));
2788
- if (!tags)
2789
- return REG_ESPACE;
2790
- tags[0] = -1;
2791
- assertions = 0;
2792
- /* Second pass with tre_mach_empty() to get the list of
2793
- tags and parameters. */
2794
- status = tre_match_empty(stack, cat->left, tags,
2795
- &assertions, NULL);
2796
- if (status != REG_OK)
2797
- {
2798
- xfree(tags);
2799
- return status;
2800
- }
2801
- node->firstpos =
2802
- tre_set_union(mem, cat->right->firstpos, cat->left->firstpos,
2803
- tags, assertions);
2804
- xfree(tags);
2805
- if (!node->firstpos)
2806
- return REG_ESPACE;
2807
- }
2808
- else
2809
- {
2810
- node->firstpos = cat->left->firstpos;
2811
- }
2812
-
2813
- /* Compute lastpos. */
2814
- if (cat->right->nullable)
2815
- {
2816
- /* The right side matches the empty string. Make a first pass
2817
- with tre_match_empty() to get the number of tags and
2818
- parameters. */
2819
- status = tre_match_empty(stack, cat->right,
2820
- NULL, NULL, &num_tags);
2821
- if (status != REG_OK)
2822
- return status;
2823
- /* Allocate arrays for the tags and parameters. */
2824
- tags = xmalloc(sizeof(int) * (num_tags + 1));
2825
- if (!tags)
2826
- return REG_ESPACE;
2827
- tags[0] = -1;
2828
- assertions = 0;
2829
- /* Second pass with tre_mach_empty() to get the list of
2830
- tags and parameters. */
2831
- status = tre_match_empty(stack, cat->right, tags,
2832
- &assertions, NULL);
2833
- if (status != REG_OK)
2834
- {
2835
- xfree(tags);
2836
- return status;
2837
- }
2838
- node->lastpos =
2839
- tre_set_union(mem, cat->left->lastpos, cat->right->lastpos,
2840
- tags, assertions);
2841
- xfree(tags);
2842
- if (!node->lastpos)
2843
- return REG_ESPACE;
2844
- }
2845
- else
2846
- {
2847
- node->lastpos = cat->right->lastpos;
2848
- }
2849
- break;
2850
- }
2851
-
2852
- default:
2853
- assert(0);
2854
- break;
2855
- }
2856
- }
2857
-
2858
- return REG_OK;
2859
- }
2860
-
2861
-
2862
- /* Adds a transition from each position in `p1' to each position in `p2'. */
2863
- static reg_errcode_t
2864
- tre_make_trans(tre_pos_and_tags_t *p1, tre_pos_and_tags_t *p2,
2865
- tre_tnfa_transition_t *transitions,
2866
- int *counts, int *offs)
2867
- {
2868
- tre_pos_and_tags_t *orig_p2 = p2;
2869
- tre_tnfa_transition_t *trans;
2870
- int i, j, k, l, dup, prev_p2_pos;
2871
-
2872
- if (transitions != NULL)
2873
- while (p1->position >= 0)
2874
- {
2875
- p2 = orig_p2;
2876
- prev_p2_pos = -1;
2877
- while (p2->position >= 0)
2878
- {
2879
- /* Optimization: if this position was already handled, skip it. */
2880
- if (p2->position == prev_p2_pos)
2881
- {
2882
- p2++;
2883
- continue;
2884
- }
2885
- prev_p2_pos = p2->position;
2886
- /* Set `trans' to point to the next unused transition from
2887
- position `p1->position'. */
2888
- trans = transitions + offs[p1->position];
2889
- while (trans->state != NULL)
2890
- {
2891
- #if 0
2892
- /* If we find a previous transition from `p1->position' to
2893
- `p2->position', it is overwritten. This can happen only
2894
- if there are nested loops in the regexp, like in "((a)*)*".
2895
- In POSIX.2 repetition using the outer loop is always
2896
- preferred over using the inner loop. Therefore the
2897
- transition for the inner loop is useless and can be thrown
2898
- away. */
2899
- /* XXX - The same position is used for all nodes in a bracket
2900
- expression, so this optimization cannot be used (it will
2901
- break bracket expressions) unless I figure out a way to
2902
- detect it here. */
2903
- if (trans->state_id == p2->position)
2904
- {
2905
- break;
2906
- }
2907
- #endif
2908
- trans++;
2909
- }
2910
-
2911
- if (trans->state == NULL)
2912
- (trans + 1)->state = NULL;
2913
- /* Use the character ranges, assertions, etc. from `p1' for
2914
- the transition from `p1' to `p2'. */
2915
- trans->code_min = p1->code_min;
2916
- trans->code_max = p1->code_max;
2917
- trans->state = transitions + offs[p2->position];
2918
- trans->state_id = p2->position;
2919
- trans->assertions = p1->assertions | p2->assertions
2920
- | (p1->class ? ASSERT_CHAR_CLASS : 0)
2921
- | (p1->neg_classes != NULL ? ASSERT_CHAR_CLASS_NEG : 0);
2922
- if (p1->backref >= 0)
2923
- {
2924
- assert((trans->assertions & ASSERT_CHAR_CLASS) == 0);
2925
- assert(p2->backref < 0);
2926
- trans->u.backref = p1->backref;
2927
- trans->assertions |= ASSERT_BACKREF;
2928
- }
2929
- else
2930
- trans->u.class = p1->class;
2931
- if (p1->neg_classes != NULL)
2932
- {
2933
- for (i = 0; p1->neg_classes[i] != (tre_ctype_t)0; i++);
2934
- trans->neg_classes =
2935
- xmalloc(sizeof(*trans->neg_classes) * (i + 1));
2936
- if (trans->neg_classes == NULL)
2937
- return REG_ESPACE;
2938
- for (i = 0; p1->neg_classes[i] != (tre_ctype_t)0; i++)
2939
- trans->neg_classes[i] = p1->neg_classes[i];
2940
- trans->neg_classes[i] = (tre_ctype_t)0;
2941
- }
2942
- else
2943
- trans->neg_classes = NULL;
2944
-
2945
- /* Find out how many tags this transition has. */
2946
- i = 0;
2947
- if (p1->tags != NULL)
2948
- while(p1->tags[i] >= 0)
2949
- i++;
2950
- j = 0;
2951
- if (p2->tags != NULL)
2952
- while(p2->tags[j] >= 0)
2953
- j++;
2954
-
2955
- /* If we are overwriting a transition, free the old tag array. */
2956
- if (trans->tags != NULL)
2957
- xfree(trans->tags);
2958
- trans->tags = NULL;
2959
-
2960
- /* If there were any tags, allocate an array and fill it. */
2961
- if (i + j > 0)
2962
- {
2963
- trans->tags = xmalloc(sizeof(*trans->tags) * (i + j + 1));
2964
- if (!trans->tags)
2965
- return REG_ESPACE;
2966
- i = 0;
2967
- if (p1->tags != NULL)
2968
- while(p1->tags[i] >= 0)
2969
- {
2970
- trans->tags[i] = p1->tags[i];
2971
- i++;
2972
- }
2973
- l = i;
2974
- j = 0;
2975
- if (p2->tags != NULL)
2976
- while (p2->tags[j] >= 0)
2977
- {
2978
- /* Don't add duplicates. */
2979
- dup = 0;
2980
- for (k = 0; k < i; k++)
2981
- if (trans->tags[k] == p2->tags[j])
2982
- {
2983
- dup = 1;
2984
- break;
2985
- }
2986
- if (!dup)
2987
- trans->tags[l++] = p2->tags[j];
2988
- j++;
2989
- }
2990
- trans->tags[l] = -1;
2991
- }
2992
-
2993
- p2++;
2994
- }
2995
- p1++;
2996
- }
2997
- else
2998
- /* Compute a maximum limit for the number of transitions leaving
2999
- from each state. */
3000
- while (p1->position >= 0)
3001
- {
3002
- p2 = orig_p2;
3003
- while (p2->position >= 0)
3004
- {
3005
- counts[p1->position]++;
3006
- p2++;
3007
- }
3008
- p1++;
3009
- }
3010
- return REG_OK;
3011
- }
3012
-
3013
- /* Converts the syntax tree to a TNFA. All the transitions in the TNFA are
3014
- labelled with one character range (there are no transitions on empty
3015
- strings). The TNFA takes O(n^2) space in the worst case, `n' is size of
3016
- the regexp. */
3017
- static reg_errcode_t
3018
- tre_ast_to_tnfa(tre_ast_node_t *node, tre_tnfa_transition_t *transitions,
3019
- int *counts, int *offs)
3020
- {
3021
- tre_union_t *uni;
3022
- tre_catenation_t *cat;
3023
- tre_iteration_t *iter;
3024
- reg_errcode_t errcode = REG_OK;
3025
-
3026
- /* XXX - recurse using a stack!. */
3027
- switch (node->type)
3028
- {
3029
- case LITERAL:
3030
- break;
3031
- case UNION:
3032
- uni = (tre_union_t *)node->obj;
3033
- errcode = tre_ast_to_tnfa(uni->left, transitions, counts, offs);
3034
- if (errcode != REG_OK)
3035
- return errcode;
3036
- errcode = tre_ast_to_tnfa(uni->right, transitions, counts, offs);
3037
- break;
3038
-
3039
- case CATENATION:
3040
- cat = (tre_catenation_t *)node->obj;
3041
- /* Add a transition from each position in cat->left->lastpos
3042
- to each position in cat->right->firstpos. */
3043
- errcode = tre_make_trans(cat->left->lastpos, cat->right->firstpos,
3044
- transitions, counts, offs);
3045
- if (errcode != REG_OK)
3046
- return errcode;
3047
- errcode = tre_ast_to_tnfa(cat->left, transitions, counts, offs);
3048
- if (errcode != REG_OK)
3049
- return errcode;
3050
- errcode = tre_ast_to_tnfa(cat->right, transitions, counts, offs);
3051
- break;
3052
-
3053
- case ITERATION:
3054
- iter = (tre_iteration_t *)node->obj;
3055
- assert(iter->max == -1 || iter->max == 1);
3056
-
3057
- if (iter->max == -1)
3058
- {
3059
- assert(iter->min == 0 || iter->min == 1);
3060
- /* Add a transition from each last position in the iterated
3061
- expression to each first position. */
3062
- errcode = tre_make_trans(iter->arg->lastpos, iter->arg->firstpos,
3063
- transitions, counts, offs);
3064
- if (errcode != REG_OK)
3065
- return errcode;
3066
- }
3067
- errcode = tre_ast_to_tnfa(iter->arg, transitions, counts, offs);
3068
- break;
3069
- }
3070
- return errcode;
3071
- }
3072
-
3073
-
3074
- #define ERROR_EXIT(err) \
3075
- do \
3076
- { \
3077
- errcode = err; \
3078
- if (/*CONSTCOND*/1) \
3079
- goto error_exit; \
3080
- } \
3081
- while (/*CONSTCOND*/0)
3082
-
3083
-
3084
- int
3085
- regcomp(regex_t *restrict preg, const char *restrict regex, int cflags)
3086
- {
3087
- tre_stack_t *stack;
3088
- tre_ast_node_t *tree, *tmp_ast_l, *tmp_ast_r;
3089
- tre_pos_and_tags_t *p;
3090
- int *counts = NULL, *offs = NULL;
3091
- int i, add = 0;
3092
- tre_tnfa_transition_t *transitions, *initial;
3093
- tre_tnfa_t *tnfa = NULL;
3094
- tre_submatch_data_t *submatch_data;
3095
- tre_tag_direction_t *tag_directions = NULL;
3096
- reg_errcode_t errcode;
3097
- tre_mem_t mem;
3098
-
3099
- /* Parse context. */
3100
- tre_parse_ctx_t parse_ctx;
3101
-
3102
- /* Allocate a stack used throughout the compilation process for various
3103
- purposes. */
3104
- stack = tre_stack_new(512, 10240, 128);
3105
- if (!stack)
3106
- return REG_ESPACE;
3107
- /* Allocate a fast memory allocator. */
3108
- mem = tre_mem_new();
3109
- if (!mem)
3110
- {
3111
- tre_stack_destroy(stack);
3112
- return REG_ESPACE;
3113
- }
3114
-
3115
- /* Parse the regexp. */
3116
- memset(&parse_ctx, 0, sizeof(parse_ctx));
3117
- parse_ctx.mem = mem;
3118
- parse_ctx.stack = stack;
3119
- parse_ctx.re = regex;
3120
- parse_ctx.cflags = cflags;
3121
- parse_ctx.max_backref = -1;
3122
- errcode = tre_parse(&parse_ctx);
3123
- if (errcode != REG_OK)
3124
- ERROR_EXIT(errcode);
3125
- preg->re_nsub = parse_ctx.submatch_id - 1;
3126
- tree = parse_ctx.result;
3127
-
3128
- /* Back references and approximate matching cannot currently be used
3129
- in the same regexp. */
3130
- if (parse_ctx.max_backref >= 0 && parse_ctx.have_approx)
3131
- ERROR_EXIT(REG_BADPAT);
3132
-
3133
- #ifdef TRE_DEBUG
3134
- tre_ast_print(tree);
3135
- #endif /* TRE_DEBUG */
3136
-
3137
- /* Referring to nonexistent subexpressions is illegal. */
3138
- if (parse_ctx.max_backref > (int)preg->re_nsub)
3139
- ERROR_EXIT(REG_ESUBREG);
3140
-
3141
- /* Allocate the TNFA struct. */
3142
- tnfa = xcalloc(1, sizeof(tre_tnfa_t));
3143
- if (tnfa == NULL)
3144
- ERROR_EXIT(REG_ESPACE);
3145
- tnfa->have_backrefs = parse_ctx.max_backref >= 0;
3146
- tnfa->have_approx = parse_ctx.have_approx;
3147
- tnfa->num_submatches = parse_ctx.submatch_id;
3148
-
3149
- /* Set up tags for submatch addressing. If REG_NOSUB is set and the
3150
- regexp does not have back references, this can be skipped. */
3151
- if (tnfa->have_backrefs || !(cflags & REG_NOSUB))
3152
- {
3153
-
3154
- /* Figure out how many tags we will need. */
3155
- errcode = tre_add_tags(NULL, stack, tree, tnfa);
3156
- if (errcode != REG_OK)
3157
- ERROR_EXIT(errcode);
3158
-
3159
- if (tnfa->num_tags > 0)
3160
- {
3161
- tag_directions = xmalloc(sizeof(*tag_directions)
3162
- * (tnfa->num_tags + 1));
3163
- if (tag_directions == NULL)
3164
- ERROR_EXIT(REG_ESPACE);
3165
- tnfa->tag_directions = tag_directions;
3166
- memset(tag_directions, -1,
3167
- sizeof(*tag_directions) * (tnfa->num_tags + 1));
3168
- }
3169
- tnfa->minimal_tags = xcalloc((unsigned)tnfa->num_tags * 2 + 1,
3170
- sizeof(tnfa->minimal_tags));
3171
- if (tnfa->minimal_tags == NULL)
3172
- ERROR_EXIT(REG_ESPACE);
3173
-
3174
- submatch_data = xcalloc((unsigned)parse_ctx.submatch_id,
3175
- sizeof(*submatch_data));
3176
- if (submatch_data == NULL)
3177
- ERROR_EXIT(REG_ESPACE);
3178
- tnfa->submatch_data = submatch_data;
3179
-
3180
- errcode = tre_add_tags(mem, stack, tree, tnfa);
3181
- if (errcode != REG_OK)
3182
- ERROR_EXIT(errcode);
3183
-
3184
- }
3185
-
3186
- /* Expand iteration nodes. */
3187
- errcode = tre_expand_ast(mem, stack, tree, &parse_ctx.position,
3188
- tag_directions);
3189
- if (errcode != REG_OK)
3190
- ERROR_EXIT(errcode);
3191
-
3192
- /* Add a dummy node for the final state.
3193
- XXX - For certain patterns this dummy node can be optimized away,
3194
- for example "a*" or "ab*". Figure out a simple way to detect
3195
- this possibility. */
3196
- tmp_ast_l = tree;
3197
- tmp_ast_r = tre_ast_new_literal(mem, 0, 0, parse_ctx.position++);
3198
- if (tmp_ast_r == NULL)
3199
- ERROR_EXIT(REG_ESPACE);
3200
-
3201
- tree = tre_ast_new_catenation(mem, tmp_ast_l, tmp_ast_r);
3202
- if (tree == NULL)
3203
- ERROR_EXIT(REG_ESPACE);
3204
-
3205
- errcode = tre_compute_nfl(mem, stack, tree);
3206
- if (errcode != REG_OK)
3207
- ERROR_EXIT(errcode);
3208
-
3209
- counts = xmalloc(sizeof(int) * parse_ctx.position);
3210
- if (counts == NULL)
3211
- ERROR_EXIT(REG_ESPACE);
3212
-
3213
- offs = xmalloc(sizeof(int) * parse_ctx.position);
3214
- if (offs == NULL)
3215
- ERROR_EXIT(REG_ESPACE);
3216
-
3217
- for (i = 0; i < parse_ctx.position; i++)
3218
- counts[i] = 0;
3219
- tre_ast_to_tnfa(tree, NULL, counts, NULL);
3220
-
3221
- add = 0;
3222
- for (i = 0; i < parse_ctx.position; i++)
3223
- {
3224
- offs[i] = add;
3225
- add += counts[i] + 1;
3226
- counts[i] = 0;
3227
- }
3228
- transitions = xcalloc((unsigned)add + 1, sizeof(*transitions));
3229
- if (transitions == NULL)
3230
- ERROR_EXIT(REG_ESPACE);
3231
- tnfa->transitions = transitions;
3232
- tnfa->num_transitions = add;
3233
-
3234
- errcode = tre_ast_to_tnfa(tree, transitions, counts, offs);
3235
- if (errcode != REG_OK)
3236
- ERROR_EXIT(errcode);
3237
-
3238
- tnfa->firstpos_chars = NULL;
3239
-
3240
- p = tree->firstpos;
3241
- i = 0;
3242
- while (p->position >= 0)
3243
- {
3244
- i++;
3245
- p++;
3246
- }
3247
-
3248
- initial = xcalloc((unsigned)i + 1, sizeof(tre_tnfa_transition_t));
3249
- if (initial == NULL)
3250
- ERROR_EXIT(REG_ESPACE);
3251
- tnfa->initial = initial;
3252
-
3253
- i = 0;
3254
- for (p = tree->firstpos; p->position >= 0; p++)
3255
- {
3256
- initial[i].state = transitions + offs[p->position];
3257
- initial[i].state_id = p->position;
3258
- initial[i].tags = NULL;
3259
- /* Copy the arrays p->tags, and p->params, they are allocated
3260
- from a tre_mem object. */
3261
- if (p->tags)
3262
- {
3263
- int j;
3264
- for (j = 0; p->tags[j] >= 0; j++);
3265
- initial[i].tags = xmalloc(sizeof(*p->tags) * (j + 1));
3266
- if (!initial[i].tags)
3267
- ERROR_EXIT(REG_ESPACE);
3268
- memcpy(initial[i].tags, p->tags, sizeof(*p->tags) * (j + 1));
3269
- }
3270
- initial[i].assertions = p->assertions;
3271
- i++;
3272
- }
3273
- initial[i].state = NULL;
3274
-
3275
- tnfa->num_transitions = add;
3276
- tnfa->final = transitions + offs[tree->lastpos[0].position];
3277
- tnfa->num_states = parse_ctx.position;
3278
- tnfa->cflags = cflags;
3279
-
3280
- tre_mem_destroy(mem);
3281
- tre_stack_destroy(stack);
3282
- xfree(counts);
3283
- xfree(offs);
3284
-
3285
- preg->TRE_REGEX_T_FIELD = (void *)tnfa;
3286
- return REG_OK;
3287
-
3288
- error_exit:
3289
- /* Free everything that was allocated and return the error code. */
3290
- tre_mem_destroy(mem);
3291
- if (stack != NULL)
3292
- tre_stack_destroy(stack);
3293
- if (counts != NULL)
3294
- xfree(counts);
3295
- if (offs != NULL)
3296
- xfree(offs);
3297
- preg->TRE_REGEX_T_FIELD = (void *)tnfa;
3298
- regfree(preg);
3299
- return errcode;
3300
- }
3301
-
3302
-
3303
-
3304
-
3305
- void
3306
- regfree(regex_t *preg)
3307
- {
3308
- tre_tnfa_t *tnfa;
3309
- unsigned int i;
3310
- tre_tnfa_transition_t *trans;
3311
-
3312
- tnfa = (void *)preg->TRE_REGEX_T_FIELD;
3313
- if (!tnfa)
3314
- return;
3315
-
3316
- for (i = 0; i < tnfa->num_transitions; i++)
3317
- if (tnfa->transitions[i].state)
3318
- {
3319
- if (tnfa->transitions[i].tags)
3320
- xfree(tnfa->transitions[i].tags);
3321
- if (tnfa->transitions[i].neg_classes)
3322
- xfree(tnfa->transitions[i].neg_classes);
3323
- }
3324
- if (tnfa->transitions)
3325
- xfree(tnfa->transitions);
3326
-
3327
- if (tnfa->initial)
3328
- {
3329
- for (trans = tnfa->initial; trans->state; trans++)
3330
- {
3331
- if (trans->tags)
3332
- xfree(trans->tags);
3333
- }
3334
- xfree(tnfa->initial);
3335
- }
3336
-
3337
- if (tnfa->submatch_data)
3338
- {
3339
- for (i = 0; i < tnfa->num_submatches; i++)
3340
- if (tnfa->submatch_data[i].parents)
3341
- xfree(tnfa->submatch_data[i].parents);
3342
- xfree(tnfa->submatch_data);
3343
- }
3344
-
3345
- if (tnfa->tag_directions)
3346
- xfree(tnfa->tag_directions);
3347
- if (tnfa->firstpos_chars)
3348
- xfree(tnfa->firstpos_chars);
3349
- if (tnfa->minimal_tags)
3350
- xfree(tnfa->minimal_tags);
3351
- xfree(tnfa);
3352
- }