script_core 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (381) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/.rubocop.yml +8 -6
  4. data/.ruby-version +1 -1
  5. data/Gemfile +2 -1
  6. data/bin/sandbox +1 -1
  7. data/ext/enterprise_script_service/Rakefile +1 -1
  8. data/ext/enterprise_script_service/flags.rb +5 -0
  9. data/ext/enterprise_script_service/libseccomp/CHANGELOG +15 -0
  10. data/ext/enterprise_script_service/libseccomp/CREDITS +3 -0
  11. data/ext/enterprise_script_service/libseccomp/Makefile.am +1 -1
  12. data/ext/enterprise_script_service/libseccomp/README.md +1 -1
  13. data/ext/enterprise_script_service/libseccomp/SECURITY.md +45 -0
  14. data/ext/enterprise_script_service/libseccomp/configure.ac +3 -3
  15. data/ext/enterprise_script_service/libseccomp/doc/admin/MAINTAINER_PROCESS.md +95 -0
  16. data/ext/enterprise_script_service/libseccomp/{RELEASE_PROCESS.md → doc/admin/RELEASE_PROCESS.md} +9 -1
  17. data/ext/enterprise_script_service/libseccomp/include/Makefile.am +1 -1
  18. data/ext/enterprise_script_service/libseccomp/include/seccomp-syscalls.h +2292 -0
  19. data/ext/enterprise_script_service/libseccomp/include/seccomp.h.in +3 -1065
  20. data/ext/enterprise_script_service/libseccomp/src/arch-aarch64-syscalls.c +35 -3
  21. data/ext/enterprise_script_service/libseccomp/src/arch-arm-syscalls.c +35 -3
  22. data/ext/enterprise_script_service/libseccomp/src/arch-mips-syscalls.c +43 -11
  23. data/ext/enterprise_script_service/libseccomp/src/arch-mips64-syscalls.c +33 -1
  24. data/ext/enterprise_script_service/libseccomp/src/arch-mips64n32-syscalls.c +33 -1
  25. data/ext/enterprise_script_service/libseccomp/src/arch-parisc-syscalls.c +34 -2
  26. data/ext/enterprise_script_service/libseccomp/src/arch-ppc-syscalls.c +43 -11
  27. data/ext/enterprise_script_service/libseccomp/src/arch-ppc64-syscalls.c +44 -12
  28. data/ext/enterprise_script_service/libseccomp/src/arch-s390-syscalls.c +46 -14
  29. data/ext/enterprise_script_service/libseccomp/src/arch-s390.c +142 -18
  30. data/ext/enterprise_script_service/libseccomp/src/arch-s390x-syscalls.c +47 -15
  31. data/ext/enterprise_script_service/libseccomp/src/arch-s390x.c +143 -17
  32. data/ext/enterprise_script_service/libseccomp/src/arch-x32-syscalls.c +33 -1
  33. data/ext/enterprise_script_service/libseccomp/src/arch-x86-syscalls.c +94 -12
  34. data/ext/enterprise_script_service/libseccomp/src/arch-x86.c +142 -19
  35. data/ext/enterprise_script_service/libseccomp/src/arch-x86_64-syscalls.c +33 -1
  36. data/ext/enterprise_script_service/libseccomp/src/db.c +1 -0
  37. data/ext/enterprise_script_service/libseccomp/src/gen_bpf.c +10 -3
  38. data/ext/enterprise_script_service/libseccomp/src/python/Makefile.am +4 -4
  39. data/ext/enterprise_script_service/libseccomp/src/python/seccomp.pyx +2 -0
  40. data/ext/enterprise_script_service/libseccomp/tests/.gitignore +1 -0
  41. data/ext/enterprise_script_service/libseccomp/tests/50-sim-hash_collision.c +98 -0
  42. data/ext/enterprise_script_service/libseccomp/tests/50-sim-hash_collision.py +61 -0
  43. data/ext/enterprise_script_service/libseccomp/tests/50-sim-hash_collision.tests +18 -0
  44. data/ext/enterprise_script_service/libseccomp/tests/Makefile.am +6 -3
  45. data/ext/enterprise_script_service/libseccomp/tools/Makefile.am +0 -2
  46. data/ext/enterprise_script_service/libseccomp/tools/check-syntax +1 -0
  47. data/ext/enterprise_script_service/libseccomp/tools/scmp_bpf_sim.c +2 -0
  48. data/ext/enterprise_script_service/mruby-mpdecimal/src/ext.c +1 -1
  49. data/ext/enterprise_script_service/mruby/.gitignore +2 -2
  50. data/ext/enterprise_script_service/mruby/CONTRIBUTING.md +10 -3
  51. data/ext/enterprise_script_service/mruby/Doxyfile +2408 -0
  52. data/ext/enterprise_script_service/mruby/README.md +21 -8
  53. data/ext/enterprise_script_service/mruby/Rakefile +4 -13
  54. data/ext/enterprise_script_service/mruby/appveyor_config.rb +1 -1
  55. data/ext/enterprise_script_service/mruby/build_config.rb +3 -3
  56. data/ext/enterprise_script_service/mruby/doc/guides/compile.md +42 -42
  57. data/ext/enterprise_script_service/mruby/doc/guides/debugger.md +1 -1
  58. data/ext/enterprise_script_service/mruby/doc/guides/mrbconf.md +45 -6
  59. data/ext/enterprise_script_service/mruby/doc/guides/mrbgems.md +5 -0
  60. data/ext/enterprise_script_service/mruby/doc/limitations.md +88 -38
  61. data/ext/enterprise_script_service/mruby/doc/mruby_logo_red_icon.png +0 -0
  62. data/ext/enterprise_script_service/mruby/doc/opcode.md +94 -94
  63. data/ext/enterprise_script_service/mruby/include/mrbconf.h +74 -11
  64. data/ext/enterprise_script_service/mruby/include/mruby.h +242 -146
  65. data/ext/enterprise_script_service/mruby/include/mruby/array.h +7 -7
  66. data/ext/enterprise_script_service/mruby/include/mruby/boxing_nan.h +2 -9
  67. data/ext/enterprise_script_service/mruby/include/mruby/boxing_no.h +11 -10
  68. data/ext/enterprise_script_service/mruby/include/mruby/boxing_word.h +104 -69
  69. data/ext/enterprise_script_service/mruby/include/mruby/class.h +7 -5
  70. data/ext/enterprise_script_service/mruby/include/mruby/common.h +9 -7
  71. data/ext/enterprise_script_service/mruby/include/mruby/compile.h +6 -6
  72. data/ext/enterprise_script_service/mruby/include/mruby/data.h +5 -5
  73. data/ext/enterprise_script_service/mruby/include/mruby/debug.h +2 -2
  74. data/ext/enterprise_script_service/mruby/include/mruby/dump.h +3 -7
  75. data/ext/enterprise_script_service/mruby/include/mruby/error.h +34 -6
  76. data/ext/enterprise_script_service/mruby/include/mruby/gc.h +2 -2
  77. data/ext/enterprise_script_service/mruby/include/mruby/hash.h +4 -11
  78. data/ext/enterprise_script_service/mruby/include/mruby/irep.h +16 -4
  79. data/ext/enterprise_script_service/mruby/include/mruby/istruct.h +4 -4
  80. data/ext/enterprise_script_service/mruby/include/mruby/khash.h +2 -2
  81. data/ext/enterprise_script_service/mruby/include/mruby/numeric.h +41 -7
  82. data/ext/enterprise_script_service/mruby/include/mruby/object.h +8 -9
  83. data/ext/enterprise_script_service/mruby/include/mruby/opcode.h +2 -2
  84. data/ext/enterprise_script_service/mruby/include/mruby/ops.h +6 -6
  85. data/ext/enterprise_script_service/mruby/include/mruby/proc.h +19 -13
  86. data/ext/enterprise_script_service/mruby/include/mruby/range.h +10 -4
  87. data/ext/enterprise_script_service/mruby/include/mruby/re.h +2 -2
  88. data/ext/enterprise_script_service/mruby/include/mruby/string.h +130 -107
  89. data/ext/enterprise_script_service/mruby/include/mruby/throw.h +2 -2
  90. data/ext/enterprise_script_service/mruby/include/mruby/value.h +137 -49
  91. data/ext/enterprise_script_service/mruby/include/mruby/variable.h +3 -5
  92. data/ext/enterprise_script_service/mruby/include/mruby/version.h +24 -10
  93. data/ext/enterprise_script_service/mruby/lib/mruby-core-ext.rb +2 -39
  94. data/ext/enterprise_script_service/mruby/lib/mruby/build.rb +32 -15
  95. data/ext/enterprise_script_service/mruby/lib/mruby/build/command.rb +63 -17
  96. data/ext/enterprise_script_service/mruby/lib/mruby/build/load_gems.rb +24 -10
  97. data/ext/enterprise_script_service/mruby/lib/mruby/gem.rb +11 -7
  98. data/ext/enterprise_script_service/mruby/lib/mruby/lockfile.rb +81 -0
  99. data/ext/enterprise_script_service/mruby/minirake +27 -11
  100. data/ext/enterprise_script_service/mruby/mrbgems/default.gembox +3 -0
  101. data/ext/enterprise_script_service/mruby/mrbgems/mruby-array-ext/mrbgem.rake +0 -1
  102. data/ext/enterprise_script_service/mruby/mrbgems/mruby-array-ext/mrblib/array.rb +47 -9
  103. data/ext/enterprise_script_service/mruby/mrbgems/mruby-array-ext/src/array.c +3 -3
  104. data/ext/enterprise_script_service/mruby/mrbgems/mruby-array-ext/test/array.rb +50 -29
  105. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.c +3 -3
  106. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/apiprint.c +2 -2
  107. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/cmdprint.c +3 -3
  108. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.c +2 -2
  109. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.h +1 -1
  110. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/mrdbconf.h +4 -0
  111. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mirb/tools/mirb/mirb.c +28 -1
  112. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mrbc/tools/mrbc/mrbc.c +1 -2
  113. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mruby/bintest/mruby.rb +75 -8
  114. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c +134 -90
  115. data/ext/enterprise_script_service/mruby/mrbgems/mruby-class-ext/src/class.c +7 -8
  116. data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/codegen.c +69 -46
  117. data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/keywords +0 -3
  118. data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/lex.def +51 -59
  119. data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/parse.y +430 -241
  120. data/ext/enterprise_script_service/mruby/mrbgems/mruby-complex/mrbgem.rake +10 -0
  121. data/ext/enterprise_script_service/mruby/mrbgems/mruby-complex/mrblib/complex.rb +122 -0
  122. data/ext/enterprise_script_service/mruby/mrbgems/mruby-complex/src/complex.c +249 -0
  123. data/ext/enterprise_script_service/mruby/mrbgems/mruby-complex/test/complex.rb +153 -0
  124. data/ext/enterprise_script_service/mruby/mrbgems/mruby-enum-chain/mrblib/chain.rb +19 -17
  125. data/ext/enterprise_script_service/mruby/mrbgems/mruby-enum-chain/test/enum_chain.rb +41 -9
  126. data/ext/enterprise_script_service/mruby/mrbgems/mruby-enum-ext/mrblib/enum.rb +30 -4
  127. data/ext/enterprise_script_service/mruby/mrbgems/mruby-enum-ext/test/enum.rb +8 -3
  128. data/ext/enterprise_script_service/mruby/mrbgems/mruby-enumerator/mrbgem.rake +0 -1
  129. data/ext/enterprise_script_service/mruby/mrbgems/mruby-enumerator/mrblib/enumerator.rb +46 -14
  130. data/ext/enterprise_script_service/mruby/mrbgems/mruby-enumerator/test/enumerator.rb +51 -2
  131. data/ext/enterprise_script_service/mruby/mrbgems/mruby-error/src/exception.c +10 -0
  132. data/ext/enterprise_script_service/mruby/mrbgems/mruby-eval/src/eval.c +47 -44
  133. data/ext/enterprise_script_service/mruby/mrbgems/mruby-eval/test/eval.rb +2 -2
  134. data/ext/enterprise_script_service/mruby/mrbgems/mruby-exit/src/mruby-exit.c +9 -4
  135. data/ext/enterprise_script_service/mruby/mrbgems/mruby-fiber/src/fiber.c +16 -12
  136. data/ext/enterprise_script_service/mruby/mrbgems/mruby-fiber/test/fiber.rb +1 -1
  137. data/ext/enterprise_script_service/mruby/mrbgems/mruby-hash-ext/mrbgem.rake +0 -2
  138. data/ext/enterprise_script_service/mruby/mrbgems/mruby-hash-ext/mrblib/hash.rb +3 -0
  139. data/ext/enterprise_script_service/mruby/mrbgems/mruby-hash-ext/test/hash.rb +3 -7
  140. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/README.md +1 -3
  141. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/mrbgem.rake +1 -1
  142. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/mrblib/file.rb +0 -5
  143. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/mrblib/io.rb +24 -38
  144. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/mrblib/kernel.rb +16 -0
  145. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/src/file.c +19 -18
  146. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/src/file_test.c +5 -16
  147. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/src/io.c +54 -42
  148. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/test/file.rb +24 -20
  149. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/test/file_test.rb +4 -9
  150. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/test/io.rb +41 -35
  151. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/test/mruby_io_test.c +9 -36
  152. data/ext/enterprise_script_service/mruby/mrbgems/mruby-kernel-ext/mrbgem.rake +1 -1
  153. data/ext/enterprise_script_service/mruby/mrbgems/mruby-kernel-ext/src/kernel.c +9 -27
  154. data/ext/enterprise_script_service/mruby/mrbgems/mruby-kernel-ext/test/kernel.rb +2 -0
  155. data/ext/enterprise_script_service/mruby/mrbgems/mruby-math/src/math.c +5 -2
  156. data/ext/enterprise_script_service/mruby/mrbgems/mruby-metaprog/src/metaprog.c +39 -24
  157. data/ext/enterprise_script_service/mruby/mrbgems/mruby-metaprog/test/metaprog.rb +48 -17
  158. data/ext/enterprise_script_service/mruby/mrbgems/mruby-method/mrblib/method.rb +0 -12
  159. data/ext/enterprise_script_service/mruby/mrbgems/mruby-method/src/method.c +134 -101
  160. data/ext/enterprise_script_service/mruby/mrbgems/mruby-method/test/method.rb +9 -1
  161. data/ext/enterprise_script_service/mruby/mrbgems/mruby-numeric-ext/mrblib/numeric_ext.rb +1 -5
  162. data/ext/enterprise_script_service/mruby/mrbgems/mruby-numeric-ext/src/numeric_ext.c +17 -37
  163. data/ext/enterprise_script_service/mruby/mrbgems/mruby-numeric-ext/test/numeric.rb +0 -8
  164. data/ext/enterprise_script_service/mruby/mrbgems/mruby-object-ext/mrbgem.rake +1 -1
  165. data/ext/enterprise_script_service/mruby/mrbgems/mruby-object-ext/mrblib/object.rb +15 -1
  166. data/ext/enterprise_script_service/mruby/mrbgems/mruby-object-ext/src/object.c +35 -6
  167. data/ext/enterprise_script_service/mruby/mrbgems/mruby-object-ext/test/nil.rb +4 -0
  168. data/ext/enterprise_script_service/mruby/mrbgems/mruby-objectspace/src/mruby_objectspace.c +1 -5
  169. data/ext/enterprise_script_service/mruby/mrbgems/mruby-objectspace/test/objectspace.rb +1 -1
  170. data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/src/pack.c +28 -23
  171. data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/test/pack.rb +43 -49
  172. data/ext/enterprise_script_service/mruby/mrbgems/mruby-print/mrblib/print.rb +3 -9
  173. data/ext/enterprise_script_service/mruby/mrbgems/mruby-proc-ext/src/proc.c +6 -9
  174. data/ext/enterprise_script_service/mruby/mrbgems/mruby-proc-ext/test/proc.rb +21 -5
  175. data/ext/enterprise_script_service/mruby/mrbgems/mruby-random/src/random.c +157 -124
  176. data/ext/enterprise_script_service/mruby/mrbgems/mruby-random/test/random.rb +72 -26
  177. data/ext/enterprise_script_service/mruby/mrbgems/mruby-range-ext/mrblib/range.rb +38 -0
  178. data/ext/enterprise_script_service/mruby/mrbgems/mruby-range-ext/src/range.c +26 -11
  179. data/ext/enterprise_script_service/mruby/mrbgems/mruby-range-ext/test/range.rb +111 -1
  180. data/ext/enterprise_script_service/mruby/mrbgems/mruby-rational/mrbgem.rake +5 -0
  181. data/ext/enterprise_script_service/mruby/mrbgems/mruby-rational/mrblib/rational.rb +117 -0
  182. data/ext/enterprise_script_service/mruby/mrbgems/mruby-rational/src/rational.c +209 -0
  183. data/ext/enterprise_script_service/mruby/mrbgems/mruby-rational/test/rational.rb +308 -0
  184. data/ext/enterprise_script_service/mruby/mrbgems/mruby-socket/README.md +1 -1
  185. data/ext/enterprise_script_service/mruby/mrbgems/mruby-socket/src/socket.c +10 -9
  186. data/ext/enterprise_script_service/mruby/mrbgems/mruby-sprintf/src/kernel.c +2 -2
  187. data/ext/enterprise_script_service/mruby/mrbgems/mruby-sprintf/src/sprintf.c +22 -24
  188. data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/mrbgem.rake +0 -1
  189. data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/mrblib/string.rb +8 -4
  190. data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/src/string.c +116 -117
  191. data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/test/numeric.rb +29 -0
  192. data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/test/range.rb +26 -0
  193. data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/test/string.rb +32 -50
  194. data/ext/enterprise_script_service/mruby/mrbgems/mruby-struct/mrblib/struct.rb +5 -7
  195. data/ext/enterprise_script_service/mruby/mrbgems/mruby-struct/src/struct.c +43 -57
  196. data/ext/enterprise_script_service/mruby/mrbgems/mruby-struct/test/struct.rb +16 -11
  197. data/ext/enterprise_script_service/mruby/mrbgems/mruby-symbol-ext/src/symbol.c +2 -2
  198. data/ext/enterprise_script_service/mruby/mrbgems/mruby-symbol-ext/test/symbol.rb +1 -1
  199. data/ext/enterprise_script_service/mruby/mrbgems/mruby-test/driver.c +152 -1
  200. data/ext/enterprise_script_service/mruby/mrbgems/mruby-test/mrbgem.rake +4 -3
  201. data/ext/enterprise_script_service/mruby/mrbgems/mruby-test/vformat.c +200 -0
  202. data/ext/enterprise_script_service/mruby/mrbgems/mruby-time/include/mruby/time.h +2 -1
  203. data/ext/enterprise_script_service/mruby/mrbgems/mruby-time/src/time.c +199 -68
  204. data/ext/enterprise_script_service/mruby/mrbgems/mruby-time/test/time.rb +81 -46
  205. data/ext/enterprise_script_service/mruby/mrblib/array.rb +14 -16
  206. data/ext/enterprise_script_service/mruby/mrblib/enum.rb +13 -9
  207. data/ext/enterprise_script_service/mruby/mrblib/hash.rb +5 -7
  208. data/ext/enterprise_script_service/mruby/mrblib/kernel.rb +1 -1
  209. data/ext/enterprise_script_service/mruby/mrblib/numeric.rb +4 -4
  210. data/ext/enterprise_script_service/mruby/mrblib/range.rb +1 -1
  211. data/ext/enterprise_script_service/mruby/mrblib/string.rb +55 -112
  212. data/ext/enterprise_script_service/mruby/mruby-source.gemspec +1 -1
  213. data/ext/enterprise_script_service/mruby/oss-fuzz/config/mruby.dict +105 -0
  214. data/ext/enterprise_script_service/mruby/oss-fuzz/config/mruby_fuzzer.options +5 -0
  215. data/ext/enterprise_script_service/mruby/oss-fuzz/config/mruby_proto_fuzzer.options +4 -0
  216. data/ext/enterprise_script_service/mruby/oss-fuzz/mruby_fuzzer.c +18 -0
  217. data/ext/enterprise_script_service/mruby/oss-fuzz/mruby_proto_fuzzer.cpp +44 -0
  218. data/ext/enterprise_script_service/mruby/oss-fuzz/proto_to_ruby.cpp +455 -0
  219. data/ext/enterprise_script_service/mruby/oss-fuzz/proto_to_ruby.h +55 -0
  220. data/ext/enterprise_script_service/mruby/oss-fuzz/ruby.proto +201 -0
  221. data/ext/enterprise_script_service/mruby/src/array.c +95 -46
  222. data/ext/enterprise_script_service/mruby/src/backtrace.c +6 -8
  223. data/ext/enterprise_script_service/mruby/src/class.c +370 -278
  224. data/ext/enterprise_script_service/mruby/src/codedump.c +34 -34
  225. data/ext/enterprise_script_service/mruby/src/debug.c +2 -2
  226. data/ext/enterprise_script_service/mruby/src/dump.c +8 -6
  227. data/ext/enterprise_script_service/mruby/src/enum.c +1 -1
  228. data/ext/enterprise_script_service/mruby/src/error.c +157 -55
  229. data/ext/enterprise_script_service/mruby/src/etc.c +13 -46
  230. data/ext/enterprise_script_service/mruby/src/fmt_fp.c +2 -2
  231. data/ext/enterprise_script_service/mruby/src/gc.c +30 -11
  232. data/ext/enterprise_script_service/mruby/src/hash.c +23 -14
  233. data/ext/enterprise_script_service/mruby/src/kernel.c +16 -54
  234. data/ext/enterprise_script_service/mruby/src/load.c +40 -76
  235. data/ext/enterprise_script_service/mruby/src/numeric.c +164 -94
  236. data/ext/enterprise_script_service/mruby/src/object.c +16 -39
  237. data/ext/enterprise_script_service/mruby/src/pool.c +0 -2
  238. data/ext/enterprise_script_service/mruby/src/proc.c +47 -48
  239. data/ext/enterprise_script_service/mruby/src/range.c +22 -35
  240. data/ext/enterprise_script_service/mruby/src/state.c +5 -94
  241. data/ext/enterprise_script_service/mruby/src/string.c +874 -710
  242. data/ext/enterprise_script_service/mruby/src/symbol.c +73 -48
  243. data/ext/enterprise_script_service/mruby/src/variable.c +58 -38
  244. data/ext/enterprise_script_service/mruby/src/vm.c +133 -304
  245. data/ext/enterprise_script_service/mruby/tasks/doc.rake +48 -0
  246. data/ext/enterprise_script_service/mruby/tasks/toolchains/clang.rake +3 -4
  247. data/ext/enterprise_script_service/mruby/tasks/toolchains/gcc.rake +20 -19
  248. data/ext/enterprise_script_service/mruby/tasks/toolchains/visualcpp.rake +0 -12
  249. data/ext/enterprise_script_service/mruby/test/assert.rb +186 -25
  250. data/ext/enterprise_script_service/mruby/test/t/array.rb +34 -6
  251. data/ext/enterprise_script_service/mruby/test/t/class.rb +26 -0
  252. data/ext/enterprise_script_service/mruby/test/t/enumerable.rb +2 -2
  253. data/ext/enterprise_script_service/mruby/test/t/float.rb +17 -17
  254. data/ext/enterprise_script_service/mruby/test/t/hash.rb +2 -0
  255. data/ext/enterprise_script_service/mruby/test/t/integer.rb +14 -6
  256. data/ext/enterprise_script_service/mruby/test/t/kernel.rb +38 -19
  257. data/ext/enterprise_script_service/mruby/test/t/module.rb +87 -14
  258. data/ext/enterprise_script_service/mruby/test/t/numeric.rb +65 -23
  259. data/ext/enterprise_script_service/mruby/test/t/range.rb +4 -4
  260. data/ext/enterprise_script_service/mruby/test/t/string.rb +211 -49
  261. data/ext/enterprise_script_service/mruby/test/t/syntax.rb +19 -2
  262. data/ext/enterprise_script_service/mruby/test/t/vformat.rb +92 -0
  263. data/ext/enterprise_script_service/mruby/travis_config.rb +2 -2
  264. data/ext/enterprise_script_service/mruby_config.rb +10 -0
  265. data/ext/enterprise_script_service/mruby_engine.cpp +2 -2
  266. data/ext/enterprise_script_service/mruby_engine.gembox +1 -0
  267. data/ext/enterprise_script_service/msgpack/CHANGELOG.md +14 -0
  268. data/ext/enterprise_script_service/msgpack/Files.cmake +4 -0
  269. data/ext/enterprise_script_service/msgpack/README.md +1 -1
  270. data/ext/enterprise_script_service/msgpack/appveyor.yml +1 -1
  271. data/ext/enterprise_script_service/msgpack/erb/v1/cpp03_msgpack_tuple.hpp.erb +1 -1
  272. data/ext/enterprise_script_service/msgpack/erb/v1/cpp03_msgpack_tuple_decl.hpp.erb +1 -1
  273. data/ext/enterprise_script_service/msgpack/erb/v1/cpp03_zone.hpp.erb +3 -3
  274. data/ext/enterprise_script_service/msgpack/example/boost/asio_send_recv.cpp +1 -1
  275. data/ext/enterprise_script_service/msgpack/include/msgpack/adaptor/cpp11/timespec.hpp +16 -0
  276. data/ext/enterprise_script_service/msgpack/include/msgpack/adaptor/wstring.hpp +15 -0
  277. data/ext/enterprise_script_service/msgpack/include/msgpack/object.h +2 -0
  278. data/ext/enterprise_script_service/msgpack/include/msgpack/pack_template.h +17 -9
  279. data/ext/enterprise_script_service/msgpack/include/msgpack/sysdep.h +27 -16
  280. data/ext/enterprise_script_service/msgpack/include/msgpack/type.hpp +2 -0
  281. data/ext/enterprise_script_service/msgpack/include/msgpack/unpack_template.h +5 -0
  282. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/array_ref.hpp +0 -1
  283. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/check_container_size.hpp +1 -1
  284. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/cpp11/chrono.hpp +5 -5
  285. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/cpp11/timespec.hpp +140 -0
  286. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/detail/cpp03_msgpack_tuple.hpp +32 -32
  287. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/detail/cpp03_msgpack_tuple_decl.hpp +32 -32
  288. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/detail/cpp11_msgpack_tuple.hpp +6 -6
  289. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/detail/cpp11_msgpack_tuple_decl.hpp +10 -10
  290. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/ext.hpp +1 -1
  291. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/fixint.hpp +5 -4
  292. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/int.hpp +40 -13
  293. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/int_decl.hpp +3 -2
  294. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/wstring.hpp +121 -0
  295. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/detail/cpp03_zone.hpp +3 -3
  296. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/detail/cpp11_zone.hpp +3 -3
  297. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/object.hpp +6 -6
  298. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/object_fwd.hpp +1 -1
  299. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/pack.hpp +40 -5
  300. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/unpack.hpp +11 -11
  301. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/vrefbuffer.hpp +7 -7
  302. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/zbuffer.hpp +5 -5
  303. data/ext/enterprise_script_service/msgpack/include/msgpack/v2/adaptor/int_decl.hpp +1 -1
  304. data/ext/enterprise_script_service/msgpack/include/msgpack/v2/create_object_visitor.hpp +1 -1
  305. data/ext/enterprise_script_service/msgpack/include/msgpack/v2/parse.hpp +13 -13
  306. data/ext/enterprise_script_service/msgpack/include/msgpack/v2/x3_parse.hpp +28 -26
  307. data/ext/enterprise_script_service/msgpack/include/msgpack/v3/adaptor/int_decl.hpp +1 -1
  308. data/ext/enterprise_script_service/msgpack/include/msgpack/v3/parse.hpp +13 -13
  309. data/ext/enterprise_script_service/msgpack/include/msgpack/version_master.h +2 -2
  310. data/ext/enterprise_script_service/msgpack/include/msgpack/zbuffer.h +6 -6
  311. data/ext/enterprise_script_service/msgpack/include/msgpack/zone.h +1 -1
  312. data/ext/enterprise_script_service/msgpack/src/objectc.c +83 -148
  313. data/ext/enterprise_script_service/msgpack/src/unpack.c +73 -47
  314. data/ext/enterprise_script_service/msgpack/test/CMakeLists.txt +1 -1
  315. data/ext/enterprise_script_service/msgpack/test/array_ref.cpp +5 -0
  316. data/ext/enterprise_script_service/msgpack/test/boost_fusion.cpp +5 -0
  317. data/ext/enterprise_script_service/msgpack/test/boost_optional.cpp +7 -0
  318. data/ext/enterprise_script_service/msgpack/test/boost_string_ref.cpp +7 -0
  319. data/ext/enterprise_script_service/msgpack/test/boost_string_view.cpp +6 -0
  320. data/ext/enterprise_script_service/msgpack/test/boost_variant.cpp +15 -9
  321. data/ext/enterprise_script_service/msgpack/test/buffer.cpp +7 -0
  322. data/ext/enterprise_script_service/msgpack/test/carray.cpp +7 -0
  323. data/ext/enterprise_script_service/msgpack/test/cases.cpp +7 -1
  324. data/ext/enterprise_script_service/msgpack/test/convert.cpp +6 -0
  325. data/ext/enterprise_script_service/msgpack/test/fixint.cpp +7 -1
  326. data/ext/enterprise_script_service/msgpack/test/fixint_c.cpp +6 -1
  327. data/ext/enterprise_script_service/msgpack/test/fuzz_unpack_pack_fuzzer_cpp11.cpp +5 -0
  328. data/ext/enterprise_script_service/msgpack/test/iterator_cpp11.cpp +8 -2
  329. data/ext/enterprise_script_service/msgpack/test/json.cpp +6 -0
  330. data/ext/enterprise_script_service/msgpack/test/limit.cpp +7 -0
  331. data/ext/enterprise_script_service/msgpack/test/msgpack_basic.cpp +128 -6
  332. data/ext/enterprise_script_service/msgpack/test/msgpack_c.cpp +7 -2
  333. data/ext/enterprise_script_service/msgpack/test/msgpack_container.cpp +20 -3
  334. data/ext/enterprise_script_service/msgpack/test/msgpack_cpp11.cpp +159 -0
  335. data/ext/enterprise_script_service/msgpack/test/msgpack_cpp17.cpp +5 -0
  336. data/ext/enterprise_script_service/msgpack/test/msgpack_stream.cpp +8 -3
  337. data/ext/enterprise_script_service/msgpack/test/msgpack_tuple.cpp +6 -0
  338. data/ext/enterprise_script_service/msgpack/test/msgpack_vref.cpp +5 -0
  339. data/ext/enterprise_script_service/msgpack/test/msgpack_x3_parse.cpp +23 -18
  340. data/ext/enterprise_script_service/msgpack/test/object.cpp +77 -45
  341. data/ext/enterprise_script_service/msgpack/test/object_with_zone.cpp +28 -10
  342. data/ext/enterprise_script_service/msgpack/test/pack_unpack.cpp +25 -18
  343. data/ext/enterprise_script_service/msgpack/test/pack_unpack_c.cpp +7 -0
  344. data/ext/enterprise_script_service/msgpack/test/raw.cpp +17 -12
  345. data/ext/enterprise_script_service/msgpack/test/reference.cpp +6 -0
  346. data/ext/enterprise_script_service/msgpack/test/reference_cpp11.cpp +6 -0
  347. data/ext/enterprise_script_service/msgpack/test/reference_wrapper_cpp11.cpp +6 -0
  348. data/ext/enterprise_script_service/msgpack/test/shared_ptr_cpp11.cpp +6 -0
  349. data/ext/enterprise_script_service/msgpack/test/size_equal_only.cpp +6 -2
  350. data/ext/enterprise_script_service/msgpack/test/streaming.cpp +10 -3
  351. data/ext/enterprise_script_service/msgpack/test/streaming_c.cpp +7 -0
  352. data/ext/enterprise_script_service/msgpack/test/unique_ptr_cpp11.cpp +6 -0
  353. data/ext/enterprise_script_service/msgpack/test/user_class.cpp +5 -0
  354. data/ext/enterprise_script_service/msgpack/test/version.cpp +6 -0
  355. data/ext/enterprise_script_service/msgpack/test/visitor.cpp +7 -0
  356. data/ext/enterprise_script_service/msgpack/test/zone.cpp +6 -0
  357. data/lib/script_core/version.rb +1 -1
  358. data/lib/tasks/mruby/engine.gembox.example +1 -0
  359. data/lib/tasks/script_core.rake +21 -3
  360. data/spec/dummy/app/helpers/fields_helper.rb +2 -2
  361. data/spec/dummy/mruby/engine.gembox +1 -0
  362. data/spec/script_core_spec.rb +1 -1
  363. metadata +38 -22
  364. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/.gitignore +0 -1
  365. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/.travis.yml +0 -2
  366. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/run_test.rb +0 -26
  367. data/ext/enterprise_script_service/mruby/mrbgems/mruby-kernel-ext/mrblib/kernel.rb +0 -15
  368. data/ext/enterprise_script_service/mruby/mrbgems/mruby-method/mrblib/unbound_method.rb +0 -9
  369. data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/.gitignore +0 -5
  370. data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/.travis.yml +0 -2
  371. data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/packtest.rb +0 -157
  372. data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/run_test.rb +0 -26
  373. data/ext/enterprise_script_service/mruby/mrbgems/mruby-random/src/mt19937ar.c +0 -224
  374. data/ext/enterprise_script_service/mruby/mrbgems/mruby-random/src/mt19937ar.h +0 -80
  375. data/ext/enterprise_script_service/mruby/mrbgems/mruby-random/src/random.h +0 -12
  376. data/ext/enterprise_script_service/mruby/mrbgems/mruby-sleep/.gitignore +0 -4
  377. data/ext/enterprise_script_service/mruby/mrbgems/mruby-sleep/.travis.yml +0 -29
  378. data/ext/enterprise_script_service/mruby/mrbgems/mruby-sleep/.travis_build_config.rb +0 -6
  379. data/ext/enterprise_script_service/mruby/mrbgems/mruby-sleep/Rakefile +0 -29
  380. data/ext/enterprise_script_service/mruby/mrbgems/mruby-socket/.travis.yml +0 -4
  381. data/ext/enterprise_script_service/mruby/mrbgems/mruby-socket/run_test.rb +0 -28
@@ -1,5 +1,5 @@
1
- /*
2
- ** mruby/debug.h - mruby debug info
1
+ /**
2
+ ** @file mruby/debug.h - mruby debug info
3
3
  **
4
4
  ** See Copyright Notice in mruby.h
5
5
  */
@@ -1,5 +1,5 @@
1
- /*
2
- ** mruby/dump.h - mruby binary dumper (mrbc binary format)
1
+ /**
2
+ ** @file mruby/dump.h - mruby binary dumper (mrbc binary format)
3
3
  **
4
4
  ** See Copyright Notice in mruby.h
5
5
  */
@@ -31,6 +31,7 @@ MRB_API mrb_value mrb_load_irep_file(mrb_state*,FILE*);
31
31
  MRB_API mrb_value mrb_load_irep_file_cxt(mrb_state*, FILE*, mrbc_context*);
32
32
  #endif
33
33
  MRB_API mrb_irep *mrb_read_irep(mrb_state*, const uint8_t*);
34
+ MRB_API mrb_irep *mrb_read_irep_buf(mrb_state*, const void*, size_t);
34
35
 
35
36
  /* dump/load error code
36
37
  *
@@ -60,7 +61,6 @@ MRB_API mrb_irep *mrb_read_irep(mrb_state*, const uint8_t*);
60
61
 
61
62
  #define RITE_BINARY_EOF "END\0"
62
63
  #define RITE_SECTION_IREP_IDENT "IREP"
63
- #define RITE_SECTION_LINENO_IDENT "LINE"
64
64
  #define RITE_SECTION_DEBUG_IDENT "DBG\0"
65
65
  #define RITE_SECTION_LV_IDENT "LVAR"
66
66
 
@@ -92,10 +92,6 @@ struct rite_section_irep_header {
92
92
  uint8_t rite_version[4]; /* Rite Instruction Specification Version */
93
93
  };
94
94
 
95
- struct rite_section_lineno_header {
96
- RITE_SECTION_HEADER;
97
- };
98
-
99
95
  struct rite_section_debug_header {
100
96
  RITE_SECTION_HEADER;
101
97
  };
@@ -1,5 +1,5 @@
1
- /*
2
- ** mruby/error.h - Exception class
1
+ /**
2
+ ** @file mruby/error.h - Exception class
3
3
  **
4
4
  ** See Copyright Notice in mruby.h
5
5
  */
@@ -32,23 +32,51 @@ MRB_API mrb_noreturn void mrb_no_method_error(mrb_state *mrb, mrb_sym id, mrb_va
32
32
  /* declaration for `fail` method */
33
33
  MRB_API mrb_value mrb_f_raise(mrb_state*, mrb_value);
34
34
 
35
+ #if defined(MRB_64BIT) || defined(MRB_USE_FLOAT) || defined(MRB_NAN_BOXING) || defined(MRB_WORD_BOXING)
35
36
  struct RBreak {
36
37
  MRB_OBJECT_HEADER;
37
38
  struct RProc *proc;
38
39
  mrb_value val;
39
40
  };
41
+ #define mrb_break_value_get(brk) ((brk)->val)
42
+ #define mrb_break_value_set(brk, v) ((brk)->val = v)
43
+ #else
44
+ struct RBreak {
45
+ MRB_OBJECT_HEADER;
46
+ struct RProc *proc;
47
+ union mrb_value_union value;
48
+ };
49
+ #define RBREAK_VALUE_TT_MASK ((1 << 8) - 1)
50
+ static inline mrb_value
51
+ mrb_break_value_get(struct RBreak *brk)
52
+ {
53
+ mrb_value val;
54
+ val.value = brk->value;
55
+ val.tt = (enum mrb_vtype)(brk->flags & RBREAK_VALUE_TT_MASK);
56
+ return val;
57
+ }
58
+ static inline void
59
+ mrb_break_value_set(struct RBreak *brk, mrb_value val)
60
+ {
61
+ brk->value = val.value;
62
+ brk->flags &= ~RBREAK_VALUE_TT_MASK;
63
+ brk->flags |= val.tt;
64
+ }
65
+ #endif /* MRB_64BIT || MRB_USE_FLOAT || MRB_NAN_BOXING || MRB_WORD_BOXING */
66
+ #define mrb_break_proc_get(brk) ((brk)->proc)
67
+ #define mrb_break_proc_set(brk, p) ((brk)->proc = p)
40
68
 
41
69
  /**
42
70
  * Protect
43
71
  *
44
- * @mrbgem mruby-error
72
+ * Implemented in the mruby-error mrbgem
45
73
  */
46
74
  MRB_API mrb_value mrb_protect(mrb_state *mrb, mrb_func_t body, mrb_value data, mrb_bool *state);
47
75
 
48
76
  /**
49
77
  * Ensure
50
78
  *
51
- * @mrbgem mruby-error
79
+ * Implemented in the mruby-error mrbgem
52
80
  */
53
81
  MRB_API mrb_value mrb_ensure(mrb_state *mrb, mrb_func_t body, mrb_value b_data,
54
82
  mrb_func_t ensure, mrb_value e_data);
@@ -56,7 +84,7 @@ MRB_API mrb_value mrb_ensure(mrb_state *mrb, mrb_func_t body, mrb_value b_data,
56
84
  /**
57
85
  * Rescue
58
86
  *
59
- * @mrbgem mruby-error
87
+ * Implemented in the mruby-error mrbgem
60
88
  */
61
89
  MRB_API mrb_value mrb_rescue(mrb_state *mrb, mrb_func_t body, mrb_value b_data,
62
90
  mrb_func_t rescue, mrb_value r_data);
@@ -64,7 +92,7 @@ MRB_API mrb_value mrb_rescue(mrb_state *mrb, mrb_func_t body, mrb_value b_data,
64
92
  /**
65
93
  * Rescue exception
66
94
  *
67
- * @mrbgem mruby-error
95
+ * Implemented in the mruby-error mrbgem
68
96
  */
69
97
  MRB_API mrb_value mrb_rescue_exceptions(mrb_state *mrb, mrb_func_t body, mrb_value b_data,
70
98
  mrb_func_t rescue, mrb_value r_data,
@@ -1,5 +1,5 @@
1
- /*
2
- ** mruby/gc.h - garbage collector for mruby
1
+ /**
2
+ ** @file mruby/gc.h - garbage collector for mruby
3
3
  **
4
4
  ** See Copyright Notice in mruby.h
5
5
  */
@@ -1,5 +1,5 @@
1
- /*
2
- ** mruby/hash.h - Hash class
1
+ /**
2
+ ** @file mruby/hash.h - Hash class
3
3
  **
4
4
  ** See Copyright Notice in mruby.h
5
5
  */
@@ -23,7 +23,7 @@ struct RHash {
23
23
  #define mrb_hash_ptr(v) ((struct RHash*)(mrb_ptr(v)))
24
24
  #define mrb_hash_value(p) mrb_obj_value((void*)(p))
25
25
 
26
- MRB_API mrb_value mrb_hash_new_capa(mrb_state*, mrb_int);
26
+ MRB_API mrb_value mrb_hash_new_capa(mrb_state *mrb, mrb_int capa);
27
27
  MRB_API mrb_value mrb_ensure_hash_type(mrb_state *mrb, mrb_value hash);
28
28
  MRB_API mrb_value mrb_check_hash_type(mrb_state *mrb, mrb_value hash);
29
29
 
@@ -95,7 +95,7 @@ MRB_API mrb_value mrb_hash_fetch(mrb_state *mrb, mrb_value hash, mrb_value key,
95
95
  * @param mrb The mruby state reference.
96
96
  * @param hash The target hash.
97
97
  * @param key The key to delete.
98
- * @return The deleted value.
98
+ * @return The deleted value. This value is not protected from GC. Use `mrb_gc_protect()` if necessary.
99
99
  */
100
100
  MRB_API mrb_value mrb_hash_delete_key(mrb_state *mrb, mrb_value hash, mrb_value key);
101
101
 
@@ -197,13 +197,6 @@ MRB_API mrb_value mrb_hash_dup(mrb_state *mrb, mrb_value hash);
197
197
  */
198
198
  MRB_API void mrb_hash_merge(mrb_state *mrb, mrb_value hash1, mrb_value hash2);
199
199
 
200
- /* declaration of struct mrb_hash_value */
201
- /* be careful when you touch the internal */
202
- typedef struct {
203
- mrb_value v;
204
- mrb_int n;
205
- } mrb_hash_value;
206
-
207
200
  /* RHASH_TBL allocates st_table if not available. */
208
201
  #define RHASH(obj) ((struct RHash*)(mrb_ptr(obj)))
209
202
  #define RHASH_TBL(h) (RHASH(h)->ht)
@@ -1,5 +1,5 @@
1
- /*
2
- ** mruby/irep.h - mrb_irep structure
1
+ /**
2
+ ** @file mruby/irep.h - mrb_irep structure
3
3
  **
4
4
  ** See Copyright Notice in mruby.h
5
5
  */
@@ -32,7 +32,7 @@ typedef struct mrb_irep {
32
32
  uint16_t nregs; /* Number of register variables */
33
33
  uint8_t flags;
34
34
 
35
- mrb_code *iseq;
35
+ const mrb_code *iseq;
36
36
  mrb_value *pool;
37
37
  mrb_sym *syms;
38
38
  struct mrb_irep **reps;
@@ -52,9 +52,21 @@ MRB_API mrb_irep *mrb_add_irep(mrb_state *mrb);
52
52
  /* @param [const uint8_t*] irep code, expected as a literal */
53
53
  MRB_API mrb_value mrb_load_irep(mrb_state*, const uint8_t*);
54
54
 
55
+ /*
56
+ * @param [const void*] irep code
57
+ * @param [size_t] size of irep buffer. If -1 is given, it is considered unrestricted.
58
+ */
59
+ MRB_API mrb_value mrb_load_irep_buf(mrb_state*, const void*, size_t);
60
+
55
61
  /* @param [const uint8_t*] irep code, expected as a literal */
56
62
  MRB_API mrb_value mrb_load_irep_cxt(mrb_state*, const uint8_t*, mrbc_context*);
57
63
 
64
+ /*
65
+ * @param [const void*] irep code
66
+ * @param [size_t] size of irep buffer. If -1 is given, it is considered unrestricted.
67
+ */
68
+ MRB_API mrb_value mrb_load_irep_buf_cxt(mrb_state*, const void*, size_t, mrbc_context*);
69
+
58
70
  void mrb_irep_free(mrb_state*, struct mrb_irep*);
59
71
  void mrb_irep_incref(mrb_state*, struct mrb_irep*);
60
72
  void mrb_irep_decref(mrb_state*, struct mrb_irep*);
@@ -68,7 +80,7 @@ struct mrb_insn_data {
68
80
  uint8_t c;
69
81
  };
70
82
 
71
- struct mrb_insn_data mrb_decode_insn(mrb_code *pc);
83
+ struct mrb_insn_data mrb_decode_insn(const mrb_code *pc);
72
84
 
73
85
  MRB_END_DECL
74
86
 
@@ -1,5 +1,5 @@
1
- /*
2
- ** mruby/istruct.h - Inline structures
1
+ /**
2
+ ** @file mruby/istruct.h - Inline structures
3
3
  **
4
4
  ** See Copyright Notice in mruby.h
5
5
  */
@@ -19,12 +19,12 @@ MRB_BEGIN_DECL
19
19
 
20
20
  #define ISTRUCT_DATA_SIZE (sizeof(void*) * 3)
21
21
 
22
- struct RIstruct {
22
+ struct RIStruct {
23
23
  MRB_OBJECT_HEADER;
24
24
  char inline_data[ISTRUCT_DATA_SIZE];
25
25
  };
26
26
 
27
- #define RISTRUCT(obj) ((struct RIstruct*)(mrb_ptr(obj)))
27
+ #define RISTRUCT(obj) ((struct RIStruct*)(mrb_ptr(obj)))
28
28
  #define ISTRUCT_PTR(obj) (RISTRUCT(obj)->inline_data)
29
29
 
30
30
  MRB_INLINE mrb_int mrb_istruct_size()
@@ -1,5 +1,5 @@
1
- /*
2
- ** mruby/khash.c - Hash for mruby
1
+ /**
2
+ ** @file mruby/khash.h - Hash for mruby
3
3
  **
4
4
  ** See Copyright Notice in mruby.h
5
5
  */
@@ -1,5 +1,5 @@
1
- /*
2
- ** mruby/numeric.h - Numeric, Integer, Float, Fixnum class
1
+ /**
2
+ ** @file mruby/numeric.h - Numeric, Integer, Float, Fixnum class
3
3
  **
4
4
  ** See Copyright Notice in mruby.h
5
5
  */
@@ -23,7 +23,11 @@ MRB_BEGIN_DECL
23
23
  #define NEGFIXABLE(f) TYPED_NEGFIXABLE(f,mrb_int)
24
24
  #define FIXABLE(f) TYPED_FIXABLE(f,mrb_int)
25
25
  #ifndef MRB_WITHOUT_FLOAT
26
- #define FIXABLE_FLOAT(f) TYPED_FIXABLE(f,double)
26
+ #ifdef MRB_INT64
27
+ #define FIXABLE_FLOAT(f) ((f)>=-9223372036854775808.0 && (f)<9223372036854775808.0)
28
+ #else
29
+ #define FIXABLE_FLOAT(f) TYPED_FIXABLE(f,mrb_float)
30
+ #endif
27
31
  #endif
28
32
 
29
33
  #ifndef MRB_WITHOUT_FLOAT
@@ -34,12 +38,12 @@ MRB_API mrb_value mrb_fixnum_to_str(mrb_state *mrb, mrb_value x, mrb_int base);
34
38
  #ifndef MRB_WITHOUT_FLOAT
35
39
  MRB_API mrb_value mrb_float_to_str(mrb_state *mrb, mrb_value x, const char *fmt);
36
40
  MRB_API mrb_float mrb_to_flo(mrb_state *mrb, mrb_value x);
41
+ MRB_API mrb_value mrb_int_value(mrb_state *mrb, mrb_float f);
37
42
  #endif
38
43
 
39
- mrb_value mrb_fixnum_plus(mrb_state *mrb, mrb_value x, mrb_value y);
40
- mrb_value mrb_fixnum_minus(mrb_state *mrb, mrb_value x, mrb_value y);
41
- mrb_value mrb_fixnum_mul(mrb_state *mrb, mrb_value x, mrb_value y);
42
- mrb_value mrb_num_div(mrb_state *mrb, mrb_value x, mrb_value y);
44
+ MRB_API mrb_value mrb_num_plus(mrb_state *mrb, mrb_value x, mrb_value y);
45
+ MRB_API mrb_value mrb_num_minus(mrb_state *mrb, mrb_value x, mrb_value y);
46
+ MRB_API mrb_value mrb_num_mul(mrb_state *mrb, mrb_value x, mrb_value y);
43
47
 
44
48
  #ifndef __has_builtin
45
49
  #define __has_builtin(x) 0
@@ -156,6 +160,36 @@ mrb_int_mul_overflow(mrb_int multiplier, mrb_int multiplicand, mrb_int *product)
156
160
 
157
161
  #endif
158
162
 
163
+ #ifndef MRB_WITHOUT_FLOAT
164
+ # include <stdint.h>
165
+ # include <float.h>
166
+
167
+ # define MRB_FLT_RADIX FLT_RADIX
168
+
169
+ # ifdef MRB_USE_FLOAT
170
+ # define MRB_FLT_MANT_DIG FLT_MANT_DIG
171
+ # define MRB_FLT_EPSILON FLT_EPSILON
172
+ # define MRB_FLT_DIG FLT_DIG
173
+ # define MRB_FLT_MIN_EXP FLT_MIN_EXP
174
+ # define MRB_FLT_MIN FLT_MIN
175
+ # define MRB_FLT_MIN_10_EXP FLT_MIN_10_EXP
176
+ # define MRB_FLT_MAX_EXP FLT_MAX_EXP
177
+ # define MRB_FLT_MAX FLT_MAX
178
+ # define MRB_FLT_MAX_10_EXP FLT_MAX_10_EXP
179
+
180
+ # else /* not MRB_USE_FLOAT */
181
+ # define MRB_FLT_MANT_DIG DBL_MANT_DIG
182
+ # define MRB_FLT_EPSILON DBL_EPSILON
183
+ # define MRB_FLT_DIG DBL_DIG
184
+ # define MRB_FLT_MIN_EXP DBL_MIN_EXP
185
+ # define MRB_FLT_MIN DBL_MIN
186
+ # define MRB_FLT_MIN_10_EXP DBL_MIN_10_EXP
187
+ # define MRB_FLT_MAX_EXP DBL_MAX_EXP
188
+ # define MRB_FLT_MAX DBL_MAX
189
+ # define MRB_FLT_MAX_10_EXP DBL_MAX_10_EXP
190
+ # endif /* MRB_USE_FLOAT */
191
+ #endif /* MRB_WITHOUT_FLOAT */
192
+
159
193
  MRB_END_DECL
160
194
 
161
195
  #endif /* MRUBY_NUMERIC_H */
@@ -1,5 +1,5 @@
1
- /*
2
- ** mruby/object.h - mruby object definition
1
+ /**
2
+ ** @file mruby/object.h - mruby object definition
3
3
  **
4
4
  ** See Copyright Notice in mruby.h
5
5
  */
@@ -8,15 +8,14 @@
8
8
  #define MRUBY_OBJECT_H
9
9
 
10
10
  #define MRB_OBJECT_HEADER \
11
- enum mrb_vtype tt:8;\
12
- uint32_t color:3;\
13
- uint32_t flags:21;\
14
- struct RClass *c;\
15
- struct RBasic *gcnext
11
+ struct RClass *c; \
12
+ struct RBasic *gcnext; \
13
+ enum mrb_vtype tt:8; \
14
+ uint32_t color:3; \
15
+ uint32_t flags:21
16
16
 
17
17
  #define MRB_FLAG_TEST(obj, flag) ((obj)->flags & (flag))
18
18
 
19
-
20
19
  struct RBasic {
21
20
  MRB_OBJECT_HEADER;
22
21
  };
@@ -26,6 +25,7 @@ struct RBasic {
26
25
  #define MRB_FROZEN_P(o) ((o)->flags & MRB_FL_OBJ_IS_FROZEN)
27
26
  #define MRB_SET_FROZEN_FLAG(o) ((o)->flags |= MRB_FL_OBJ_IS_FROZEN)
28
27
  #define MRB_UNSET_FROZEN_FLAG(o) ((o)->flags &= ~MRB_FL_OBJ_IS_FROZEN)
28
+ #define mrb_frozen_p(o) MRB_FROZEN_P(o)
29
29
 
30
30
  struct RObject {
31
31
  MRB_OBJECT_HEADER;
@@ -33,7 +33,6 @@ struct RObject {
33
33
  };
34
34
  #define mrb_obj_ptr(v) ((struct RObject*)(mrb_ptr(v)))
35
35
 
36
- #define mrb_immediate_p(x) (mrb_type(x) < MRB_TT_HAS_BASIC)
37
36
  #define mrb_special_const_p(x) mrb_immediate_p(x)
38
37
 
39
38
  struct RFiber {
@@ -1,5 +1,5 @@
1
- /*
2
- ** mruby/opcode.h - RiteVM operation codes
1
+ /**
2
+ ** @file mruby/opcode.h - RiteVM operation codes
3
3
  **
4
4
  ** See Copyright Notice in mruby.h
5
5
  */
@@ -45,9 +45,9 @@ OPCODE(SETMCNST, BB) /* R(a+1)::Syms(b) = R(a) */
45
45
  OPCODE(GETUPVAR, BBB) /* R(a) = uvget(b,c) */
46
46
  OPCODE(SETUPVAR, BBB) /* uvset(b,c,R(a)) */
47
47
  OPCODE(JMP, S) /* pc=a */
48
- OPCODE(JMPIF, BS) /* if R(b) pc=a */
49
- OPCODE(JMPNOT, BS) /* if !R(b) pc=a */
50
- OPCODE(JMPNIL, BS) /* if R(b)==nil pc=a */
48
+ OPCODE(JMPIF, BS) /* if R(a) pc=b */
49
+ OPCODE(JMPNOT, BS) /* if !R(a) pc=b */
50
+ OPCODE(JMPNIL, BS) /* if R(a)==nil pc=b */
51
51
  OPCODE(ONERR, S) /* rescue_push(a) */
52
52
  OPCODE(EXCEPT, B) /* R(a) = exc */
53
53
  OPCODE(RESCUE, BB) /* R(b) = R(a).isa?(R(b)) */
@@ -58,7 +58,7 @@ OPCODE(EPOP, B) /* A.times{ensure_pop().call} */
58
58
  OPCODE(SENDV, BB) /* R(a) = call(R(a),Syms(b),*R(a+1)) */
59
59
  OPCODE(SENDVB, BB) /* R(a) = call(R(a),Syms(b),*R(a+1),&R(a+2)) */
60
60
  OPCODE(SEND, BBB) /* R(a) = call(R(a),Syms(b),R(a+1),...,R(a+c)) */
61
- OPCODE(SENDB, BBB) /* R(a) = call(R(a),Syms(Bx),R(a+1),...,R(a+c),&R(a+c+1)) */
61
+ OPCODE(SENDB, BBB) /* R(a) = call(R(a),Syms(b),R(a+1),...,R(a+c),&R(a+c+1)) */
62
62
  OPCODE(CALL, Z) /* R(0) = self.call(frame.argc, frame.argv) */
63
63
  OPCODE(SUPER, BB) /* R(a) = super(R(a+1),... ,R(a+b+1)) */
64
64
  OPCODE(ARGARY, BS) /* R(a) = argument array (16=m5:r1:m5:d1:lv4) */
@@ -71,9 +71,9 @@ OPCODE(RETURN_BLK, B) /* return R(a) (in-block return) */
71
71
  OPCODE(BREAK, B) /* break R(a) */
72
72
  OPCODE(BLKPUSH, BS) /* R(a) = block (16=m5:r1:m5:d1:lv4) */
73
73
  OPCODE(ADD, B) /* R(a) = R(a)+R(a+1) */
74
- OPCODE(ADDI, BB) /* R(a) = R(a)+mrb_int(c) */
74
+ OPCODE(ADDI, BB) /* R(a) = R(a)+mrb_int(b) */
75
75
  OPCODE(SUB, B) /* R(a) = R(a)-R(a+1) */
76
- OPCODE(SUBI, BB) /* R(a) = R(a)-C */
76
+ OPCODE(SUBI, BB) /* R(a) = R(a)-mrb_int(b) */
77
77
  OPCODE(MUL, B) /* R(a) = R(a)*R(a+1) */
78
78
  OPCODE(DIV, B) /* R(a) = R(a)/R(a+1) */
79
79
  OPCODE(EQ, B) /* R(a) = R(a)==R(a+1) */
@@ -1,5 +1,5 @@
1
- /*
2
- ** mruby/proc.h - Proc class
1
+ /**
2
+ ** @file mruby/proc.h - Proc class
3
3
  **
4
4
  ** See Copyright Notice in mruby.h
5
5
  */
@@ -86,38 +86,44 @@ struct RProc *mrb_closure_new(mrb_state*, mrb_irep*);
86
86
  MRB_API struct RProc *mrb_proc_new_cfunc(mrb_state*, mrb_func_t);
87
87
  MRB_API struct RProc *mrb_closure_new_cfunc(mrb_state *mrb, mrb_func_t func, int nlocals);
88
88
  void mrb_proc_copy(struct RProc *a, struct RProc *b);
89
+ mrb_int mrb_proc_arity(const struct RProc *p);
89
90
 
90
91
  /* implementation of #send method */
91
92
  mrb_value mrb_f_send(mrb_state *mrb, mrb_value self);
92
93
 
93
94
  /* following functions are defined in mruby-proc-ext so please include it when using */
94
- MRB_API struct RProc *mrb_proc_new_cfunc_with_env(mrb_state*, mrb_func_t, mrb_int, const mrb_value*);
95
- MRB_API mrb_value mrb_proc_cfunc_env_get(mrb_state*, mrb_int);
95
+ MRB_API struct RProc *mrb_proc_new_cfunc_with_env(mrb_state *mrb, mrb_func_t func, mrb_int argc, const mrb_value *argv);
96
+ MRB_API mrb_value mrb_proc_cfunc_env_get(mrb_state *mrb, mrb_int idx);
96
97
  /* old name */
97
98
  #define mrb_cfunc_env_get(mrb, idx) mrb_proc_cfunc_env_get(mrb, idx)
98
99
 
99
- #ifdef MRB_METHOD_TABLE_INLINE
100
+ #define MRB_METHOD_FUNC_FL 1
101
+ #define MRB_METHOD_NOARG_FL 2
102
+ #ifndef MRB_METHOD_T_STRUCT
100
103
 
101
- #define MRB_METHOD_FUNC_FL ((uintptr_t)1)
102
104
  #define MRB_METHOD_FUNC_P(m) (((uintptr_t)(m))&MRB_METHOD_FUNC_FL)
103
- #define MRB_METHOD_FUNC(m) ((mrb_func_t)((uintptr_t)(m)&(~MRB_METHOD_FUNC_FL)))
104
- #define MRB_METHOD_FROM_FUNC(m,fn) ((m)=(mrb_method_t)((struct RProc*)((uintptr_t)(fn)|MRB_METHOD_FUNC_FL)))
105
- #define MRB_METHOD_FROM_PROC(m,pr) ((m)=(mrb_method_t)(struct RProc*)(pr))
105
+ #define MRB_METHOD_NOARG_P(m) (((uintptr_t)(m))&MRB_METHOD_NOARG_FL)
106
+ #define MRB_METHOD_NOARG_SET(m) ((m)=(mrb_method_t)(((uintptr_t)(m))|MRB_METHOD_NOARG_FL))
107
+ #define MRB_METHOD_FUNC(m) ((mrb_func_t)((uintptr_t)(m)>>2))
108
+ #define MRB_METHOD_FROM_FUNC(m,fn) ((m)=(mrb_method_t)((((uintptr_t)(fn))<<2)|MRB_METHOD_FUNC_FL))
109
+ #define MRB_METHOD_FROM_PROC(m,pr) ((m)=(mrb_method_t)(pr))
106
110
  #define MRB_METHOD_PROC_P(m) (!MRB_METHOD_FUNC_P(m))
107
111
  #define MRB_METHOD_PROC(m) ((struct RProc*)(m))
108
112
  #define MRB_METHOD_UNDEF_P(m) ((m)==0)
109
113
 
110
114
  #else
111
115
 
112
- #define MRB_METHOD_FUNC_P(m) ((m).func_p)
116
+ #define MRB_METHOD_FUNC_P(m) ((m).flags&MRB_METHOD_FUNC_FL)
117
+ #define MRB_METHOD_NOARG_P(m) ((m).flags&MRB_METHOD_NOARG_FL)
113
118
  #define MRB_METHOD_FUNC(m) ((m).func)
114
- #define MRB_METHOD_FROM_FUNC(m,fn) do{(m).func_p=TRUE;(m).func=(fn);}while(0)
115
- #define MRB_METHOD_FROM_PROC(m,pr) do{(m).func_p=FALSE;(m).proc=(pr);}while(0)
119
+ #define MRB_METHOD_NOARG_SET(m) do{(m).flags|=MRB_METHOD_NOARG_FL;}while(0)
120
+ #define MRB_METHOD_FROM_FUNC(m,fn) do{(m).flags=MRB_METHOD_FUNC_FL;(m).func=(fn);}while(0)
121
+ #define MRB_METHOD_FROM_PROC(m,pr) do{(m).flags=0;(m).proc=(pr);}while(0)
116
122
  #define MRB_METHOD_PROC_P(m) (!MRB_METHOD_FUNC_P(m))
117
123
  #define MRB_METHOD_PROC(m) ((m).proc)
118
124
  #define MRB_METHOD_UNDEF_P(m) ((m).proc==NULL)
119
125
 
120
- #endif /* MRB_METHOD_TABLE_INLINE */
126
+ #endif /* MRB_METHOD_T_STRUCT */
121
127
 
122
128
  #define MRB_METHOD_CFUNC_P(m) (MRB_METHOD_FUNC_P(m)?TRUE:(MRB_METHOD_PROC(m)?(MRB_PROC_CFUNC_P(MRB_METHOD_PROC(m))):FALSE))
123
129
  #define MRB_METHOD_CFUNC(m) (MRB_METHOD_FUNC_P(m)?MRB_METHOD_FUNC(m):((MRB_METHOD_PROC(m)&&MRB_PROC_CFUNC_P(MRB_METHOD_PROC(m)))?MRB_PROC_CFUNC(MRB_METHOD_PROC(m)):NULL))