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
@@ -16,7 +16,7 @@ print_r(mrb_state *mrb, mrb_irep *irep, size_t n)
16
16
  for (i=0; i+1<irep->nlocals; i++) {
17
17
  if (irep->lv[i].r == n) {
18
18
  mrb_sym sym = irep->lv[i].name;
19
- printf(" R%d:%s", (int)n, mrb_sym2name(mrb, sym));
19
+ printf(" R%d:%s", (int)n, mrb_sym_dump(mrb, sym));
20
20
  break;
21
21
  }
22
22
  }
@@ -69,7 +69,7 @@ static void
69
69
  codedump(mrb_state *mrb, mrb_irep *irep)
70
70
  {
71
71
  int ai;
72
- mrb_code *pc, *pcend;
72
+ const mrb_code *pc, *pcend;
73
73
  mrb_code ins;
74
74
  const char *file = NULL, *next_file;
75
75
 
@@ -82,7 +82,7 @@ codedump(mrb_state *mrb, mrb_irep *irep)
82
82
 
83
83
  printf("local variable names:\n");
84
84
  for (i = 1; i < irep->nlocals; ++i) {
85
- char const *s = mrb_sym2name(mrb, irep->lv[i - 1].name);
85
+ char const *s = mrb_sym_dump(mrb, irep->lv[i - 1].name);
86
86
  int n = irep->lv[i - 1].r ? irep->lv[i - 1].r : i;
87
87
  printf(" R%d:%s\n", n, s ? s : "");
88
88
  }
@@ -147,7 +147,7 @@ codedump(mrb_state *mrb, mrb_irep *irep)
147
147
  print_lv_a(mrb, irep, a);
148
148
  break;
149
149
  CASE(OP_LOADSYM, BB):
150
- printf("OP_LOADSYM\tR%d\t:%s\t", a, mrb_sym2name(mrb, irep->syms[b]));
150
+ printf("OP_LOADSYM\tR%d\t:%s\t", a, mrb_sym_dump(mrb, irep->syms[b]));
151
151
  print_lv_a(mrb, irep, a);
152
152
  break;
153
153
  CASE(OP_LOADNIL, B):
@@ -167,43 +167,43 @@ codedump(mrb_state *mrb, mrb_irep *irep)
167
167
  print_lv_a(mrb, irep, a);
168
168
  break;
169
169
  CASE(OP_GETGV, BB):
170
- printf("OP_GETGV\tR%d\t:%s", a, mrb_sym2name(mrb, irep->syms[b]));
170
+ printf("OP_GETGV\tR%d\t:%s", a, mrb_sym_dump(mrb, irep->syms[b]));
171
171
  print_lv_a(mrb, irep, a);
172
172
  break;
173
173
  CASE(OP_SETGV, BB):
174
- printf("OP_SETGV\t:%s\tR%d", mrb_sym2name(mrb, irep->syms[b]), a);
174
+ printf("OP_SETGV\t:%s\tR%d", mrb_sym_dump(mrb, irep->syms[b]), a);
175
175
  print_lv_a(mrb, irep, a);
176
176
  break;
177
177
  CASE(OP_GETSV, BB):
178
- printf("OP_GETSV\tR%d\t:%s", a, mrb_sym2name(mrb, irep->syms[b]));
178
+ printf("OP_GETSV\tR%d\t:%s", a, mrb_sym_dump(mrb, irep->syms[b]));
179
179
  print_lv_a(mrb, irep, a);
180
180
  break;
181
181
  CASE(OP_SETSV, BB):
182
- printf("OP_SETSV\t:%s\tR%d", mrb_sym2name(mrb, irep->syms[b]), a);
182
+ printf("OP_SETSV\t:%s\tR%d", mrb_sym_dump(mrb, irep->syms[b]), a);
183
183
  print_lv_a(mrb, irep, a);
184
184
  break;
185
185
  CASE(OP_GETCONST, BB):
186
- printf("OP_GETCONST\tR%d\t:%s", a, mrb_sym2name(mrb, irep->syms[b]));
186
+ printf("OP_GETCONST\tR%d\t:%s", a, mrb_sym_dump(mrb, irep->syms[b]));
187
187
  print_lv_a(mrb, irep, a);
188
188
  break;
189
189
  CASE(OP_SETCONST, BB):
190
- printf("OP_SETCONST\t:%s\tR%d", mrb_sym2name(mrb, irep->syms[b]), a);
190
+ printf("OP_SETCONST\t:%s\tR%d", mrb_sym_dump(mrb, irep->syms[b]), a);
191
191
  print_lv_a(mrb, irep, a);
192
192
  break;
193
193
  CASE(OP_GETMCNST, BB):
194
- printf("OP_GETMCNST\tR%d\tR%d::%s", a, a, mrb_sym2name(mrb, irep->syms[b]));
194
+ printf("OP_GETMCNST\tR%d\tR%d::%s", a, a, mrb_sym_dump(mrb, irep->syms[b]));
195
195
  print_lv_a(mrb, irep, a);
196
196
  break;
197
197
  CASE(OP_SETMCNST, BB):
198
- printf("OP_SETMCNST\tR%d::%s\tR%d", a+1, mrb_sym2name(mrb, irep->syms[b]), a);
198
+ printf("OP_SETMCNST\tR%d::%s\tR%d", a+1, mrb_sym_dump(mrb, irep->syms[b]), a);
199
199
  print_lv_a(mrb, irep, a);
200
200
  break;
201
201
  CASE(OP_GETIV, BB):
202
- printf("OP_GETIV\tR%d\t%s", a, mrb_sym2name(mrb, irep->syms[b]));
202
+ printf("OP_GETIV\tR%d\t%s", a, mrb_sym_dump(mrb, irep->syms[b]));
203
203
  print_lv_a(mrb, irep, a);
204
204
  break;
205
205
  CASE(OP_SETIV, BB):
206
- printf("OP_SETIV\t%s\tR%d", mrb_sym2name(mrb, irep->syms[b]), a);
206
+ printf("OP_SETIV\t%s\tR%d", mrb_sym_dump(mrb, irep->syms[b]), a);
207
207
  print_lv_a(mrb, irep, a);
208
208
  break;
209
209
  CASE(OP_GETUPVAR, BBB):
@@ -215,11 +215,11 @@ codedump(mrb_state *mrb, mrb_irep *irep)
215
215
  print_lv_a(mrb, irep, a);
216
216
  break;
217
217
  CASE(OP_GETCV, BB):
218
- printf("OP_GETCV\tR%d\t%s", a, mrb_sym2name(mrb, irep->syms[b]));
218
+ printf("OP_GETCV\tR%d\t%s", a, mrb_sym_dump(mrb, irep->syms[b]));
219
219
  print_lv_a(mrb, irep, a);
220
220
  break;
221
221
  CASE(OP_SETCV, BB):
222
- printf("OP_SETCV\t%s\tR%d", mrb_sym2name(mrb, irep->syms[b]), a);
222
+ printf("OP_SETCV\t%s\tR%d", mrb_sym_dump(mrb, irep->syms[b]), a);
223
223
  print_lv_a(mrb, irep, a);
224
224
  break;
225
225
  CASE(OP_JMP, S):
@@ -238,16 +238,16 @@ codedump(mrb_state *mrb, mrb_irep *irep)
238
238
  print_lv_a(mrb, irep, a);
239
239
  break;
240
240
  CASE(OP_SENDV, BB):
241
- printf("OP_SENDV\tR%d\t:%s\n", a, mrb_sym2name(mrb, irep->syms[b]));
241
+ printf("OP_SENDV\tR%d\t:%s\n", a, mrb_sym_dump(mrb, irep->syms[b]));
242
242
  break;
243
243
  CASE(OP_SENDVB, BB):
244
- printf("OP_SENDVB\tR%d\t:%s\n", a, mrb_sym2name(mrb, irep->syms[b]));
244
+ printf("OP_SENDVB\tR%d\t:%s\n", a, mrb_sym_dump(mrb, irep->syms[b]));
245
245
  break;
246
246
  CASE(OP_SEND, BBB):
247
- printf("OP_SEND\tR%d\t:%s\t%d\n", a, mrb_sym2name(mrb, irep->syms[b]), c);
247
+ printf("OP_SEND\tR%d\t:%s\t%d\n", a, mrb_sym_dump(mrb, irep->syms[b]), c);
248
248
  break;
249
249
  CASE(OP_SENDB, BBB):
250
- printf("OP_SENDB\tR%d\t:%s\t%d\n", a, mrb_sym2name(mrb, irep->syms[b]), c);
250
+ printf("OP_SENDB\tR%d\t:%s\t%d\n", a, mrb_sym_dump(mrb, irep->syms[b]), c);
251
251
  break;
252
252
  CASE(OP_CALL, Z):
253
253
  printf("OP_CALL\n");
@@ -266,23 +266,23 @@ codedump(mrb_state *mrb, mrb_irep *irep)
266
266
  break;
267
267
  CASE(OP_ENTER, W):
268
268
  printf("OP_ENTER\t%d:%d:%d:%d:%d:%d:%d\n",
269
- (a>>18)&0x1f,
270
- (a>>13)&0x1f,
271
- (a>>12)&0x1,
272
- (a>>7)&0x1f,
273
- (a>>2)&0x1f,
274
- (a>>1)&0x1,
275
- a & 0x1);
269
+ MRB_ASPEC_REQ(a),
270
+ MRB_ASPEC_OPT(a),
271
+ MRB_ASPEC_REST(a),
272
+ MRB_ASPEC_POST(a),
273
+ MRB_ASPEC_KEY(a),
274
+ MRB_ASPEC_KDICT(a),
275
+ MRB_ASPEC_BLOCK(a));
276
276
  break;
277
277
  CASE(OP_KEY_P, BB):
278
- printf("OP_KEY_P\tR%d\t:%s\t", a, mrb_sym2name(mrb, irep->syms[b]));
278
+ printf("OP_KEY_P\tR%d\t:%s\t", a, mrb_sym_dump(mrb, irep->syms[b]));
279
279
  print_lv_a(mrb, irep, a);
280
280
  break;
281
281
  CASE(OP_KEYEND, Z):
282
282
  printf("OP_KEYEND\n");
283
283
  break;
284
284
  CASE(OP_KARG, BB):
285
- printf("OP_KARG\tR%d\t:%s\t", a, mrb_sym2name(mrb, irep->syms[b]));
285
+ printf("OP_KARG\tR%d\t:%s\t", a, mrb_sym_dump(mrb, irep->syms[b]));
286
286
  print_lv_a(mrb, irep, a);
287
287
  break;
288
288
  CASE(OP_RETURN, B):
@@ -322,13 +322,13 @@ codedump(mrb_state *mrb, mrb_irep *irep)
322
322
  printf("OP_RANGE_EXC\tR%d\n", a);
323
323
  break;
324
324
  CASE(OP_DEF, BB):
325
- printf("OP_DEF\tR%d\t:%s\n", a, mrb_sym2name(mrb, irep->syms[b]));
325
+ printf("OP_DEF\tR%d\t:%s\n", a, mrb_sym_dump(mrb, irep->syms[b]));
326
326
  break;
327
327
  CASE(OP_UNDEF, B):
328
- printf("OP_UNDEF\t:%s\n", mrb_sym2name(mrb, irep->syms[a]));
328
+ printf("OP_UNDEF\t:%s\n", mrb_sym_dump(mrb, irep->syms[a]));
329
329
  break;
330
330
  CASE(OP_ALIAS, BB):
331
- printf("OP_ALIAS\t:%s\t%s\n", mrb_sym2name(mrb, irep->syms[a]), mrb_sym2name(mrb, irep->syms[b]));
331
+ printf("OP_ALIAS\t:%s\t%s\n", mrb_sym_dump(mrb, irep->syms[a]), mrb_sym_dump(mrb, irep->syms[b]));
332
332
  break;
333
333
  CASE(OP_ADD, B):
334
334
  printf("OP_ADD\tR%d\t\n", a);
@@ -429,11 +429,11 @@ codedump(mrb_state *mrb, mrb_irep *irep)
429
429
  print_lv_a(mrb, irep, a);
430
430
  break;
431
431
  CASE(OP_CLASS, BB):
432
- printf("OP_CLASS\tR%d\t:%s", a, mrb_sym2name(mrb, irep->syms[b]));
432
+ printf("OP_CLASS\tR%d\t:%s", a, mrb_sym_dump(mrb, irep->syms[b]));
433
433
  print_lv_a(mrb, irep, a);
434
434
  break;
435
435
  CASE(OP_MODULE, BB):
436
- printf("OP_MODULE\tR%d\t:%s", a, mrb_sym2name(mrb, irep->syms[b]));
436
+ printf("OP_MODULE\tR%d\t:%s", a, mrb_sym_dump(mrb, irep->syms[b]));
437
437
  print_lv_a(mrb, irep, a);
438
438
  break;
439
439
  CASE(OP_EXEC, BB):
@@ -57,7 +57,7 @@ mrb_debug_get_filename(mrb_state *mrb, mrb_irep *irep, ptrdiff_t pc)
57
57
  mrb_irep_debug_info_file* f = NULL;
58
58
  if (!irep->debug_info) return NULL;
59
59
  else if ((f = get_file(irep->debug_info, (uint32_t)pc))) {
60
- return mrb_sym2name_len(mrb, f->filename_sym, NULL);
60
+ return mrb_sym_name_len(mrb, f->filename_sym, NULL);
61
61
  }
62
62
  }
63
63
  return NULL;
@@ -138,7 +138,7 @@ mrb_debug_info_append_file(mrb_state *mrb, mrb_irep_debug_info *d,
138
138
  mrb_assert(lines);
139
139
 
140
140
  if (d->flen > 0) {
141
- const char *fn = mrb_sym2name_len(mrb, d->files[d->flen - 1]->filename_sym, NULL);
141
+ const char *fn = mrb_sym_name_len(mrb, d->files[d->flen - 1]->filename_sym, NULL);
142
142
  if (strcmp(filename, fn) == 0)
143
143
  return NULL;
144
144
  }
@@ -220,7 +220,7 @@ get_syms_block_size(mrb_state *mrb, mrb_irep *irep)
220
220
  for (sym_no = 0; sym_no < irep->slen; sym_no++) {
221
221
  size += sizeof(uint16_t); /* snl(n) */
222
222
  if (irep->syms[sym_no] != 0) {
223
- mrb_sym2name_len(mrb, irep->syms[sym_no], &len);
223
+ mrb_sym_name_len(mrb, irep->syms[sym_no], &len);
224
224
  size += len + 1; /* sn(n) + null char */
225
225
  }
226
226
  }
@@ -241,7 +241,7 @@ write_syms_block(mrb_state *mrb, mrb_irep *irep, uint8_t *buf)
241
241
  if (irep->syms[sym_no] != 0) {
242
242
  mrb_int len;
243
243
 
244
- name = mrb_sym2name_len(mrb, irep->syms[sym_no], &len);
244
+ name = mrb_sym_name_len(mrb, irep->syms[sym_no], &len);
245
245
 
246
246
  mrb_assert_int_fit(mrb_int, len, uint16_t, UINT16_MAX);
247
247
  cur += uint16_to_bin((uint16_t)len, cur); /* length of symbol name */
@@ -436,7 +436,7 @@ get_filename_table_size(mrb_state *mrb, mrb_irep *irep, mrb_sym **fp, uint16_t *
436
436
  filenames[*lp - 1] = file->filename_sym;
437
437
 
438
438
  /* filename */
439
- mrb_sym2name_len(mrb, file->filename_sym, &filename_len);
439
+ mrb_sym_name_len(mrb, file->filename_sym, &filename_len);
440
440
  size += sizeof(uint16_t) + (size_t)filename_len;
441
441
  }
442
442
  }
@@ -540,7 +540,7 @@ write_section_debug(mrb_state *mrb, mrb_irep *irep, uint8_t *cur, mrb_sym const
540
540
  cur += uint16_to_bin(filenames_len, cur);
541
541
  section_size += sizeof(uint16_t);
542
542
  for (i = 0; i < filenames_len; ++i) {
543
- sym = mrb_sym2name_len(mrb, filenames[i], &sym_len);
543
+ sym = mrb_sym_name_len(mrb, filenames[i], &sym_len);
544
544
  mrb_assert(sym);
545
545
  cur += uint16_to_bin((uint16_t)sym_len, cur);
546
546
  memcpy(cur, sym, sym_len);
@@ -594,7 +594,7 @@ write_lv_sym_table(mrb_state *mrb, uint8_t **start, mrb_sym const *syms, uint32_
594
594
  cur += uint32_to_bin(syms_len, cur);
595
595
 
596
596
  for (i = 0; i < syms_len; ++i) {
597
- str = mrb_sym2name_len(mrb, syms[i], &str_len);
597
+ str = mrb_sym_name_len(mrb, syms[i], &str_len);
598
598
  cur += uint16_to_bin((uint16_t)str_len, cur);
599
599
  memcpy(cur, str, str_len);
600
600
  cur += str_len;
@@ -658,7 +658,7 @@ get_lv_section_size(mrb_state *mrb, mrb_irep *irep, mrb_sym const *syms, uint32_
658
658
  ret += sizeof(uint16_t) * syms_len; /* symbol name lengths */
659
659
  for (i = 0; i < syms_len; ++i) {
660
660
  mrb_int str_len;
661
- mrb_sym2name_len(mrb, syms[i], &str_len);
661
+ mrb_sym_name_len(mrb, syms[i], &str_len);
662
662
  ret += str_len;
663
663
  }
664
664
 
@@ -943,7 +943,9 @@ mrb_dump_irep_cfunc(mrb_state *mrb, mrb_irep *irep, uint8_t flags, FILE *fp, con
943
943
  return MRB_DUMP_WRITE_FAULT;
944
944
  }
945
945
  if (fprintf(fp,
946
+ "#ifdef __cplusplus\n"
946
947
  "extern const uint8_t %s[];\n"
948
+ "#endif\n"
947
949
  "const uint8_t\n"
948
950
  "#if defined __GNUC__\n"
949
951
  "__attribute__((aligned(%u)))\n"
@@ -26,5 +26,5 @@ mrb_init_enumerable(mrb_state *mrb)
26
26
  {
27
27
  struct RClass *enumerable;
28
28
  enumerable = mrb_define_module(mrb, "Enumerable"); /* 15.3.2 */
29
- mrb_define_module_function(mrb, enumerable, "__update_hash", enum_update_hash, MRB_ARGS_REQ(1));
29
+ mrb_define_module_function(mrb, enumerable, "__update_hash", enum_update_hash, MRB_ARGS_REQ(3));
30
30
  }
@@ -44,10 +44,8 @@ static mrb_value
44
44
  exc_initialize(mrb_state *mrb, mrb_value exc)
45
45
  {
46
46
  mrb_value mesg;
47
- mrb_int argc;
48
- mrb_value *argv;
49
47
 
50
- if (mrb_get_args(mrb, "|o*!", &mesg, &argv, &argc) >= 1) {
48
+ if (mrb_get_args(mrb, "|o", &mesg) == 1) {
51
49
  mrb_iv_set(mrb, exc, mrb_intern_lit(mrb, "mesg"), mesg);
52
50
  }
53
51
  return exc;
@@ -151,14 +149,14 @@ exc_inspect(mrb_state *mrb, mrb_value exc)
151
149
  str = mrb_str_new_cstr(mrb, cname);
152
150
  if (mrb_string_p(file) && mrb_fixnum_p(line)) {
153
151
  if (append_mesg) {
154
- str = mrb_format(mrb, "%S:%S: %S (%S)", file, line, mesg, str);
152
+ str = mrb_format(mrb, "%v:%v: %v (%v)", file, line, mesg, str);
155
153
  }
156
154
  else {
157
- str = mrb_format(mrb, "%S:%S: %S", file, line, str);
155
+ str = mrb_format(mrb, "%v:%v: %v", file, line, str);
158
156
  }
159
157
  }
160
158
  else if (append_mesg) {
161
- str = mrb_format(mrb, "%S: %S", str, mesg);
159
+ str = mrb_format(mrb, "%v: %v", str, mesg);
162
160
  }
163
161
  return str;
164
162
  }
@@ -198,11 +196,11 @@ static void
198
196
  exc_debug_info(mrb_state *mrb, struct RObject *exc)
199
197
  {
200
198
  mrb_callinfo *ci = mrb->c->ci;
201
- mrb_code *pc = ci->pc;
199
+ const mrb_code *pc = ci->pc;
202
200
 
203
201
  if (mrb_obj_iv_defined(mrb, exc, mrb_intern_lit(mrb, "file"))) return;
204
202
  while (ci >= mrb->c->cibase) {
205
- mrb_code *err = ci->err;
203
+ const mrb_code *err = ci->err;
206
204
 
207
205
  if (!err && pc) err = pc - 1;
208
206
  if (err && ci->proc && !MRB_PROC_CFUNC_P(ci->proc)) {
@@ -233,7 +231,7 @@ mrb_exc_set(mrb_state *mrb, mrb_value exc)
233
231
  (struct RBasic*)mrb->exc == mrb->gc.arena[mrb->gc.arena_idx-1]) {
234
232
  mrb->gc.arena_idx--;
235
233
  }
236
- if (!mrb->gc.out_of_memory && !MRB_FROZEN_P(mrb->exc)) {
234
+ if (!mrb->gc.out_of_memory && !mrb_frozen_p(mrb->exc)) {
237
235
  exc_debug_info(mrb, mrb->exc);
238
236
  mrb_keep_backtrace(mrb, exc);
239
237
  }
@@ -243,10 +241,15 @@ mrb_exc_set(mrb_state *mrb, mrb_value exc)
243
241
  MRB_API mrb_noreturn void
244
242
  mrb_exc_raise(mrb_state *mrb, mrb_value exc)
245
243
  {
246
- if (!mrb_obj_is_kind_of(mrb, exc, mrb->eException_class)) {
247
- mrb_raise(mrb, E_TYPE_ERROR, "exception object expected");
244
+ if (mrb_break_p(exc)) {
245
+ mrb->exc = mrb_obj_ptr(exc);
246
+ }
247
+ else {
248
+ if (!mrb_obj_is_kind_of(mrb, exc, mrb->eException_class)) {
249
+ mrb_raise(mrb, E_TYPE_ERROR, "exception object expected");
250
+ }
251
+ mrb_exc_set(mrb, exc);
248
252
  }
249
- mrb_exc_set(mrb, exc);
250
253
  if (!mrb->jmp) {
251
254
  mrb_p(mrb, exc);
252
255
  abort();
@@ -260,59 +263,152 @@ mrb_raise(mrb_state *mrb, struct RClass *c, const char *msg)
260
263
  mrb_exc_raise(mrb, mrb_exc_new_str(mrb, c, mrb_str_new_cstr(mrb, msg)));
261
264
  }
262
265
 
266
+ /*
267
+ * <code>vsprintf</code> like formatting.
268
+ *
269
+ * The syntax of a format sequence is as follows.
270
+ *
271
+ * %[modifier]specifier
272
+ *
273
+ * The modifiers are:
274
+ *
275
+ * ----------+------------------------------------------------------------
276
+ * Modifier | Meaning
277
+ * ----------+------------------------------------------------------------
278
+ * ! | Convert to string by corresponding `inspect` instead of
279
+ * | corresponding `to_s`.
280
+ * ----------+------------------------------------------------------------
281
+ *
282
+ * The specifiers are:
283
+ *
284
+ * ----------+----------------+--------------------------------------------
285
+ * Specifier | Argument Type | Note
286
+ * ----------+----------------+--------------------------------------------
287
+ * c | char |
288
+ * d | int |
289
+ * f | mrb_float |
290
+ * i | mrb_int |
291
+ * l | char*, size_t | Arguments are string and length.
292
+ * n | mrb_sym |
293
+ * s | char* | Argument is NUL terminated string.
294
+ * t | mrb_value | Convert to type (class) of object.
295
+ * v,S | mrb_value |
296
+ * C | struct RClass* |
297
+ * T | mrb_value | Convert to real type (class) of object.
298
+ * Y | mrb_value | Same as `!v` if argument is `true`, `false`
299
+ * | | or `nil`, otherwise same as `T`.
300
+ * % | - | Convert to percent sign itself (no argument
301
+ * | | taken).
302
+ * ----------+----------------+--------------------------------------------
303
+ */
263
304
  MRB_API mrb_value
264
305
  mrb_vformat(mrb_state *mrb, const char *format, va_list ap)
265
306
  {
266
- const char *p = format;
267
- const char *b = p;
268
- ptrdiff_t size;
269
- int ai0 = mrb_gc_arena_save(mrb);
270
- mrb_value ary = mrb_ary_new_capa(mrb, 4);
307
+ const char *chars, *p = format, *b = format, *e;
308
+ char ch;
309
+ size_t len;
310
+ mrb_int i;
311
+ struct RClass *cls;
312
+ mrb_bool inspect = FALSE;
313
+ mrb_value result = mrb_str_new_capa(mrb, 128), obj, str;
271
314
  int ai = mrb_gc_arena_save(mrb);
272
315
 
273
316
  while (*p) {
274
317
  const char c = *p++;
275
-
318
+ e = p;
276
319
  if (c == '%') {
277
- if (*p == 'S') {
278
- mrb_value val;
279
-
280
- size = p - b - 1;
281
- mrb_ary_push(mrb, ary, mrb_str_new(mrb, b, size));
282
- val = va_arg(ap, mrb_value);
283
- mrb_ary_push(mrb, ary, mrb_obj_as_string(mrb, val));
284
- b = p + 1;
320
+ if (*p == '!') {
321
+ inspect = TRUE;
322
+ ++p;
285
323
  }
286
- }
287
- else if (c == '\\') {
288
- if (*p) {
289
- size = p - b - 1;
290
- mrb_ary_push(mrb, ary, mrb_str_new(mrb, b, size));
291
- mrb_ary_push(mrb, ary, mrb_str_new(mrb, p, 1));
292
- b = ++p;
293
- }
294
- else {
295
- break;
324
+ if (!*p) break;
325
+ switch (*p) {
326
+ case 'c':
327
+ ch = (char)va_arg(ap, int);
328
+ chars = &ch;
329
+ len = 1;
330
+ goto L_cat;
331
+ case 'd': case 'i':
332
+ #if MRB_INT_MAX < INT_MAX
333
+ i = (mrb_int)va_arg(ap, int);
334
+ #else
335
+ i = *p == 'd' ? (mrb_int)va_arg(ap, int) : va_arg(ap, mrb_int);
336
+ #endif
337
+ obj = mrb_fixnum_value(i);
338
+ goto L_cat_obj;
339
+ #ifndef MRB_WITHOUT_FLOAT
340
+ case 'f':
341
+ obj = mrb_float_value(mrb, (mrb_float)va_arg(ap, double));
342
+ goto L_cat_obj;
343
+ #endif
344
+ case 'l':
345
+ chars = va_arg(ap, char*);
346
+ len = va_arg(ap, size_t);
347
+ L_cat:
348
+ if (inspect) {
349
+ obj = mrb_str_new(mrb, chars, len);
350
+ goto L_cat_obj;
351
+ }
352
+ mrb_str_cat(mrb, result, b, e - b - 1);
353
+ mrb_str_cat(mrb, result, chars, len);
354
+ b = ++p;
355
+ mrb_gc_arena_restore(mrb, ai);
356
+ break;
357
+ case 'n':
358
+ obj = mrb_symbol_value(va_arg(ap, mrb_sym));
359
+ goto L_cat_obj;
360
+ case 's':
361
+ chars = va_arg(ap, char*);
362
+ len = strlen(chars);
363
+ goto L_cat;
364
+ case 't':
365
+ cls = mrb_class(mrb, va_arg(ap, mrb_value));
366
+ goto L_cat_class;
367
+ case 'v': case 'S':
368
+ obj = va_arg(ap, mrb_value);
369
+ L_cat_obj:
370
+ str = (inspect ? mrb_inspect : mrb_obj_as_string)(mrb, obj);
371
+ chars = RSTRING_PTR(str);
372
+ len = RSTRING_LEN(str);
373
+ inspect = FALSE;
374
+ goto L_cat;
375
+ case 'C':
376
+ cls = va_arg(ap, struct RClass*);
377
+ L_cat_class:
378
+ obj = mrb_obj_value(cls);
379
+ goto L_cat_obj;
380
+ case 'T':
381
+ obj = va_arg(ap, mrb_value);
382
+ L_cat_real_class_of:
383
+ cls = mrb_obj_class(mrb, obj);
384
+ goto L_cat_class;
385
+ case 'Y':
386
+ obj = va_arg(ap, mrb_value);
387
+ if (!mrb_test(obj) || mrb_true_p(obj)) {
388
+ inspect = TRUE;
389
+ goto L_cat_obj;
390
+ }
391
+ else {
392
+ goto L_cat_real_class_of;
393
+ }
394
+ case '%':
395
+ L_cat_current:
396
+ chars = p;
397
+ len = 1;
398
+ goto L_cat;
399
+ default:
400
+ mrb_raisef(mrb, E_ARGUMENT_ERROR, "malformed format string - %%%c", *p);
296
401
  }
297
402
  }
298
- mrb_gc_arena_restore(mrb, ai);
299
- }
300
- if (b == format) {
301
- mrb_gc_arena_restore(mrb, ai0);
302
- return mrb_str_new_cstr(mrb, format);
303
- }
304
- else {
305
- mrb_value val;
403
+ else if (c == '\\') {
404
+ if (!*p) break;
405
+ goto L_cat_current;
306
406
 
307
- size = p - b;
308
- if (size > 0) {
309
- mrb_ary_push(mrb, ary, mrb_str_new(mrb, b, size));
310
407
  }
311
- val = mrb_ary_join(mrb, ary, mrb_nil_value());
312
- mrb_gc_arena_restore(mrb, ai0);
313
- mrb_gc_protect(mrb, val);
314
- return val;
315
408
  }
409
+
410
+ mrb_str_cat(mrb, result, b, p - b);
411
+ return result;
316
412
  }
317
413
 
318
414
  MRB_API mrb_value
@@ -434,7 +530,7 @@ exception_call:
434
530
 
435
531
  break;
436
532
  default:
437
- mrb_raisef(mrb, E_ARGUMENT_ERROR, "wrong number of arguments (%S for 0..3)", mrb_fixnum_value(argc));
533
+ mrb_raisef(mrb, E_ARGUMENT_ERROR, "wrong number of arguments (%i for 0..3)", argc);
438
534
  break;
439
535
  }
440
536
  if (argc > 0) {
@@ -484,6 +580,12 @@ mrb_no_method_error(mrb_state *mrb, mrb_sym id, mrb_value args, char const* fmt,
484
580
  mrb_exc_raise(mrb, exc);
485
581
  }
486
582
 
583
+ MRB_API mrb_noreturn void
584
+ mrb_frozen_error(mrb_state *mrb, void *frozen_obj)
585
+ {
586
+ mrb_raisef(mrb, E_FROZEN_ERROR, "can't modify frozen %t", mrb_obj_value(frozen_obj));
587
+ }
588
+
487
589
  void
488
590
  mrb_init_exception(mrb_state *mrb)
489
591
  {
@@ -491,9 +593,9 @@ mrb_init_exception(mrb_state *mrb)
491
593
 
492
594
  mrb->eException_class = exception = mrb_define_class(mrb, "Exception", mrb->object_class); /* 15.2.22 */
493
595
  MRB_SET_INSTANCE_TT(exception, MRB_TT_EXCEPTION);
494
- mrb_define_class_method(mrb, exception, "exception", mrb_instance_new, MRB_ARGS_ANY());
495
- mrb_define_method(mrb, exception, "exception", exc_exception, MRB_ARGS_ANY());
496
- mrb_define_method(mrb, exception, "initialize", exc_initialize, MRB_ARGS_ANY());
596
+ mrb_define_class_method(mrb, exception, "exception", mrb_instance_new, MRB_ARGS_OPT(1));
597
+ mrb_define_method(mrb, exception, "exception", exc_exception, MRB_ARGS_OPT(1));
598
+ mrb_define_method(mrb, exception, "initialize", exc_initialize, MRB_ARGS_OPT(1));
497
599
  mrb_define_method(mrb, exception, "to_s", exc_to_s, MRB_ARGS_NONE());
498
600
  mrb_define_method(mrb, exception, "message", exc_message, MRB_ARGS_NONE());
499
601
  mrb_define_method(mrb, exception, "inspect", exc_inspect, MRB_ARGS_NONE());