script_core 0.2.7 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (283) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/Gemfile +2 -2
  4. data/ext/enterprise_script_service/Rakefile +1 -1
  5. data/ext/enterprise_script_service/mruby/.github/workflows/build.yml +117 -74
  6. data/ext/enterprise_script_service/mruby/.github/workflows/codeql-analysis.yml +41 -37
  7. data/ext/enterprise_script_service/mruby/.github/workflows/lint.yml +23 -0
  8. data/ext/enterprise_script_service/mruby/.github/workflows/oss-fuzz.yml +27 -0
  9. data/ext/enterprise_script_service/mruby/.github/workflows/spell-checker.yml +17 -0
  10. data/ext/enterprise_script_service/mruby/.gitlab-ci.yml +3 -3
  11. data/ext/enterprise_script_service/mruby/.markdownlint.yml +16 -0
  12. data/ext/enterprise_script_service/mruby/.travis.yml +2 -2
  13. data/ext/enterprise_script_service/mruby/.yamllint +8 -0
  14. data/ext/enterprise_script_service/mruby/AUTHORS +3 -0
  15. data/ext/enterprise_script_service/mruby/CODEOWNERS +1 -0
  16. data/ext/enterprise_script_service/mruby/CONTRIBUTING.md +6 -13
  17. data/ext/enterprise_script_service/mruby/Doxyfile +4 -4
  18. data/ext/enterprise_script_service/mruby/LICENSE +1 -1
  19. data/ext/enterprise_script_service/mruby/Makefile +1 -1
  20. data/ext/enterprise_script_service/mruby/README.md +4 -14
  21. data/ext/enterprise_script_service/mruby/Rakefile +18 -108
  22. data/ext/enterprise_script_service/mruby/TODO.md +17 -0
  23. data/ext/enterprise_script_service/mruby/appveyor.yml +31 -25
  24. data/ext/enterprise_script_service/mruby/benchmark/bm_ao_render.rb +1 -1
  25. data/ext/enterprise_script_service/mruby/build_config.rb +9 -152
  26. data/ext/enterprise_script_service/mruby/{examples/targets/build_config_ArduinoDue.rb → build_config/ArduinoDue.rb} +2 -19
  27. data/ext/enterprise_script_service/mruby/{examples/targets/build_config_IntelEdison.rb → build_config/IntelEdison.rb} +2 -2
  28. data/ext/enterprise_script_service/mruby/{examples/targets/build_config_IntelGalileo.rb → build_config/IntelGalileo.rb} +1 -18
  29. data/ext/enterprise_script_service/mruby/{examples/targets/build_config_RX630.rb → build_config/RX630.rb} +2 -19
  30. data/ext/enterprise_script_service/mruby/build_config/android_arm64-v8a.rb +11 -0
  31. data/ext/enterprise_script_service/mruby/build_config/android_armeabi.rb +11 -0
  32. data/ext/enterprise_script_service/mruby/{examples/targets/build_config_android_armeabi_v7a_neon_hard.rb → build_config/android_armeabi_v7a_neon_hard.rb} +0 -15
  33. data/ext/enterprise_script_service/mruby/build_config/bench.rb +11 -0
  34. data/ext/enterprise_script_service/mruby/build_config/boxing.rb +21 -0
  35. data/ext/enterprise_script_service/mruby/{examples/targets/build_config_chipKITMax32.rb → build_config/chipKITMax32.rb} +2 -19
  36. data/ext/enterprise_script_service/mruby/{travis_config.rb → build_config/ci/gcc-clang.rb} +10 -10
  37. data/ext/enterprise_script_service/mruby/build_config/ci/msvc.rb +20 -0
  38. data/ext/enterprise_script_service/mruby/build_config/clang-asan.rb +11 -0
  39. data/ext/enterprise_script_service/mruby/build_config/cross-32bit.rb +14 -0
  40. data/ext/enterprise_script_service/mruby/build_config/default.rb +80 -0
  41. data/ext/enterprise_script_service/mruby/{examples/targets/build_config_dreamcast_shelf.rb → build_config/dreamcast_shelf.rb} +5 -19
  42. data/ext/enterprise_script_service/mruby/build_config/gameboyadvance.rb +73 -0
  43. data/ext/enterprise_script_service/mruby/build_config/host-cxx.rb +12 -0
  44. data/ext/enterprise_script_service/mruby/build_config/host-debug.rb +20 -0
  45. data/ext/enterprise_script_service/mruby/build_config/host-gprof.rb +14 -0
  46. data/ext/enterprise_script_service/mruby/build_config/host-m32.rb +15 -0
  47. data/ext/enterprise_script_service/mruby/build_config/host-shared.rb +36 -0
  48. data/ext/enterprise_script_service/mruby/build_config/mrbc.rb +11 -0
  49. data/ext/enterprise_script_service/mruby/build_config/no-float.rb +17 -0
  50. data/ext/enterprise_script_service/mruby/doc/guides/compile.md +138 -49
  51. data/ext/enterprise_script_service/mruby/doc/guides/debugger.md +5 -4
  52. data/ext/enterprise_script_service/mruby/doc/guides/gc-arena-howto.md +1 -1
  53. data/ext/enterprise_script_service/mruby/doc/guides/mrbconf.md +49 -22
  54. data/ext/enterprise_script_service/mruby/doc/guides/mrbgems.md +31 -14
  55. data/ext/enterprise_script_service/mruby/doc/guides/symbol.md +83 -0
  56. data/ext/enterprise_script_service/mruby/doc/limitations.md +35 -36
  57. data/ext/enterprise_script_service/mruby/doc/mruby3.md +163 -0
  58. data/ext/enterprise_script_service/mruby/doc/opcode.md +93 -107
  59. data/ext/enterprise_script_service/mruby/examples/mrbgems/c_and_ruby_extension_example/mrblib/example.rb +1 -1
  60. data/ext/enterprise_script_service/mruby/examples/mrbgems/c_and_ruby_extension_example/src/example.c +5 -1
  61. data/ext/enterprise_script_service/mruby/examples/mrbgems/c_extension_example/src/example.c +5 -1
  62. data/ext/enterprise_script_service/mruby/examples/mrbgems/ruby_extension_example/mrblib/example.rb +1 -1
  63. data/ext/enterprise_script_service/mruby/include/mrbconf.h +81 -62
  64. data/ext/enterprise_script_service/mruby/include/mruby.h +137 -96
  65. data/ext/enterprise_script_service/mruby/include/mruby/array.h +23 -6
  66. data/ext/enterprise_script_service/mruby/include/mruby/boxing_nan.h +73 -48
  67. data/ext/enterprise_script_service/mruby/include/mruby/boxing_no.h +8 -8
  68. data/ext/enterprise_script_service/mruby/include/mruby/boxing_word.h +79 -48
  69. data/ext/enterprise_script_service/mruby/include/mruby/class.h +10 -8
  70. data/ext/enterprise_script_service/mruby/include/mruby/common.h +4 -1
  71. data/ext/enterprise_script_service/mruby/include/mruby/compile.h +13 -7
  72. data/ext/enterprise_script_service/mruby/include/mruby/debug.h +2 -2
  73. data/ext/enterprise_script_service/mruby/include/mruby/dump.h +17 -35
  74. data/ext/enterprise_script_service/mruby/include/mruby/endian.h +44 -0
  75. data/ext/enterprise_script_service/mruby/include/mruby/error.h +39 -5
  76. data/ext/enterprise_script_service/mruby/include/mruby/gc.h +1 -0
  77. data/ext/enterprise_script_service/mruby/include/mruby/hash.h +33 -13
  78. data/ext/enterprise_script_service/mruby/include/mruby/irep.h +64 -14
  79. data/ext/enterprise_script_service/mruby/include/mruby/khash.h +6 -14
  80. data/ext/enterprise_script_service/mruby/include/mruby/numeric.h +36 -63
  81. data/ext/enterprise_script_service/mruby/include/mruby/opcode.h +1 -27
  82. data/ext/enterprise_script_service/mruby/include/mruby/ops.h +27 -23
  83. data/ext/enterprise_script_service/mruby/include/mruby/presym.h +40 -0
  84. data/ext/enterprise_script_service/mruby/include/mruby/presym/disable.h +70 -0
  85. data/ext/enterprise_script_service/mruby/include/mruby/presym/enable.h +37 -0
  86. data/ext/enterprise_script_service/mruby/include/mruby/presym/scanning.h +73 -0
  87. data/ext/enterprise_script_service/mruby/include/mruby/proc.h +80 -13
  88. data/ext/enterprise_script_service/mruby/include/mruby/string.h +10 -15
  89. data/ext/enterprise_script_service/mruby/include/mruby/throw.h +14 -3
  90. data/ext/enterprise_script_service/mruby/include/mruby/value.h +29 -19
  91. data/ext/enterprise_script_service/mruby/include/mruby/variable.h +1 -0
  92. data/ext/enterprise_script_service/mruby/include/mruby/version.h +26 -7
  93. data/ext/enterprise_script_service/mruby/lib/mruby/build.rb +198 -44
  94. data/ext/enterprise_script_service/mruby/lib/mruby/build/command.rb +55 -37
  95. data/ext/enterprise_script_service/mruby/lib/mruby/build/load_gems.rb +12 -10
  96. data/ext/enterprise_script_service/mruby/lib/{mruby-core-ext.rb → mruby/core_ext.rb} +10 -3
  97. data/ext/enterprise_script_service/mruby/lib/mruby/gem.rb +75 -32
  98. data/ext/enterprise_script_service/mruby/lib/mruby/lockfile.rb +1 -1
  99. data/ext/enterprise_script_service/mruby/lib/mruby/presym.rb +132 -0
  100. data/ext/enterprise_script_service/mruby/mrbgems/default-no-fpu.gembox +3 -0
  101. data/ext/enterprise_script_service/mruby/mrbgems/default-no-stdio.gembox +4 -0
  102. data/ext/enterprise_script_service/mruby/mrbgems/default.gembox +9 -88
  103. data/ext/enterprise_script_service/mruby/mrbgems/full-core.gembox +1 -4
  104. data/ext/enterprise_script_service/mruby/mrbgems/math.gembox +10 -0
  105. data/ext/enterprise_script_service/mruby/mrbgems/metaprog.gembox +15 -0
  106. data/ext/enterprise_script_service/mruby/mrbgems/mruby-array-ext/mrblib/array.rb +1 -1
  107. data/ext/enterprise_script_service/mruby/mrbgems/mruby-array-ext/src/array.c +5 -4
  108. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-config/mrbgem.rake +28 -19
  109. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-config/mruby-config +18 -8
  110. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/bintest/mrdb.rb +3 -6
  111. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/bintest/print.rb +10 -10
  112. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.c +14 -9
  113. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/apiprint.c +3 -2
  114. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.c +4 -3
  115. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.h +2 -6
  116. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/mrdbconf.h +4 -4
  117. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mirb/bintest/mirb.rb +23 -5
  118. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mirb/mrbgem.rake +11 -2
  119. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mirb/tools/mirb/mirb.c +41 -34
  120. data/ext/enterprise_script_service/mruby/mrbgems/{mruby-compiler → mruby-bin-mrbc}/bintest/mrbc.rb +0 -0
  121. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mrbc/mrbgem.rake +3 -4
  122. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mrbc/tools/mrbc/mrbc.c +19 -9
  123. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mruby/bintest/mruby.rb +25 -4
  124. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mruby/mrbgem.rake +1 -1
  125. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c +22 -6
  126. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-strip/bintest/mruby-strip.rb +1 -1
  127. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-strip/tools/mruby-strip/mruby-strip.c +2 -2
  128. data/ext/enterprise_script_service/mruby/mrbgems/mruby-catch/mrbgem.rake +5 -0
  129. data/ext/enterprise_script_service/mruby/mrbgems/mruby-catch/mrblib/catch.rb +27 -0
  130. data/ext/enterprise_script_service/mruby/mrbgems/mruby-class-ext/src/class.c +2 -1
  131. data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/codegen.c +430 -399
  132. data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/keywords +5 -0
  133. data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/lex.def +49 -44
  134. data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/parse.y +559 -217
  135. data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/y.tab.c +4774 -4193
  136. data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/mrbgem.rake +18 -19
  137. data/ext/enterprise_script_service/mruby/mrbgems/mruby-complex/mrblib/complex.rb +1 -1
  138. data/ext/enterprise_script_service/mruby/mrbgems/mruby-complex/src/complex.c +8 -7
  139. data/ext/enterprise_script_service/mruby/mrbgems/mruby-complex/test/complex.rb +4 -4
  140. data/ext/enterprise_script_service/mruby/mrbgems/mruby-enumerator/mrblib/enumerator.rb +1 -0
  141. data/ext/enterprise_script_service/mruby/mrbgems/mruby-enumerator/test/enumerator.rb +2 -2
  142. data/ext/enterprise_script_service/mruby/mrbgems/mruby-error/mrbgem.rake +2 -2
  143. data/ext/enterprise_script_service/mruby/mrbgems/mruby-eval/src/eval.c +17 -25
  144. data/ext/enterprise_script_service/mruby/mrbgems/mruby-fiber/src/fiber.c +18 -13
  145. data/ext/enterprise_script_service/mruby/mrbgems/mruby-hash-ext/src/hash-ext.c +30 -2
  146. data/ext/enterprise_script_service/mruby/mrbgems/mruby-hash-ext/test/hash.rb +7 -0
  147. data/ext/enterprise_script_service/mruby/mrbgems/mruby-inline-struct/test/inline.c +2 -2
  148. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/README.md +18 -16
  149. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/include/mruby/ext/io.h +2 -2
  150. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/mrblib/file.rb +9 -4
  151. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/mrblib/io.rb +2 -2
  152. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/src/file.c +55 -52
  153. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/src/file_test.c +4 -2
  154. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/src/io.c +99 -87
  155. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/test/file.rb +2 -0
  156. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/test/io.rb +2 -3
  157. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/test/mruby_io_test.c +1 -1
  158. data/ext/enterprise_script_service/mruby/mrbgems/mruby-kernel-ext/src/kernel.c +7 -6
  159. data/ext/enterprise_script_service/mruby/mrbgems/mruby-math/src/math.c +13 -12
  160. data/ext/enterprise_script_service/mruby/mrbgems/mruby-math/test/math.rb +5 -4
  161. data/ext/enterprise_script_service/mruby/mrbgems/mruby-metaprog/src/metaprog.c +43 -58
  162. data/ext/enterprise_script_service/mruby/mrbgems/mruby-metaprog/test/metaprog.rb +4 -4
  163. data/ext/enterprise_script_service/mruby/mrbgems/mruby-method/README.md +4 -3
  164. data/ext/enterprise_script_service/mruby/mrbgems/mruby-method/src/method.c +77 -74
  165. data/ext/enterprise_script_service/mruby/mrbgems/mruby-method/test/method.rb +4 -4
  166. data/ext/enterprise_script_service/mruby/mrbgems/mruby-numeric-ext/src/numeric_ext.c +14 -13
  167. data/ext/enterprise_script_service/mruby/mrbgems/mruby-object-ext/src/object.c +5 -4
  168. data/ext/enterprise_script_service/mruby/mrbgems/mruby-objectspace/src/mruby_objectspace.c +18 -12
  169. data/ext/enterprise_script_service/mruby/mrbgems/mruby-os-memsize/mrbgem.rake +10 -0
  170. data/ext/enterprise_script_service/mruby/mrbgems/mruby-os-memsize/src/memsize.c +231 -0
  171. data/ext/enterprise_script_service/mruby/mrbgems/mruby-os-memsize/test/memsize.rb +63 -0
  172. data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/README.md +15 -18
  173. data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/src/pack.c +38 -88
  174. data/ext/enterprise_script_service/mruby/mrbgems/mruby-print/mrblib/print.rb +1 -30
  175. data/ext/enterprise_script_service/mruby/mrbgems/mruby-print/src/print.c +62 -26
  176. data/ext/enterprise_script_service/mruby/mrbgems/mruby-proc-ext/src/proc.c +32 -19
  177. data/ext/enterprise_script_service/mruby/mrbgems/mruby-proc-ext/test/proc.c +1 -1
  178. data/ext/enterprise_script_service/mruby/mrbgems/mruby-random/src/random.c +98 -43
  179. data/ext/enterprise_script_service/mruby/mrbgems/mruby-random/test/random.rb +2 -2
  180. data/ext/enterprise_script_service/mruby/mrbgems/mruby-range-ext/mrblib/range.rb +39 -6
  181. data/ext/enterprise_script_service/mruby/mrbgems/mruby-range-ext/src/range.c +20 -40
  182. data/ext/enterprise_script_service/mruby/mrbgems/mruby-range-ext/test/range.rb +27 -3
  183. data/ext/enterprise_script_service/mruby/mrbgems/mruby-rational/mrblib/rational.rb +11 -17
  184. data/ext/enterprise_script_service/mruby/mrbgems/mruby-rational/src/rational.c +216 -38
  185. data/ext/enterprise_script_service/mruby/mrbgems/mruby-rational/test/rational.rb +6 -6
  186. data/ext/enterprise_script_service/mruby/mrbgems/mruby-sleep/README.md +6 -4
  187. data/ext/enterprise_script_service/mruby/mrbgems/mruby-sleep/src/mrb_sleep.c +4 -4
  188. data/ext/enterprise_script_service/mruby/mrbgems/mruby-socket/README.md +3 -2
  189. data/ext/enterprise_script_service/mruby/mrbgems/mruby-socket/src/socket.c +47 -45
  190. data/ext/enterprise_script_service/mruby/mrbgems/mruby-sprintf/src/sprintf.c +102 -71
  191. data/ext/enterprise_script_service/mruby/mrbgems/mruby-sprintf/test/sprintf.rb +4 -2
  192. data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/mrblib/string.rb +23 -1
  193. data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/src/string.c +13 -9
  194. data/ext/enterprise_script_service/mruby/mrbgems/mruby-struct/mrblib/struct.rb +1 -1
  195. data/ext/enterprise_script_service/mruby/mrbgems/mruby-struct/src/struct.c +18 -25
  196. data/ext/enterprise_script_service/mruby/mrbgems/mruby-symbol-ext/src/symbol.c +6 -5
  197. data/ext/enterprise_script_service/mruby/mrbgems/mruby-symbol-ext/test/symbol.rb +1 -1
  198. data/ext/enterprise_script_service/mruby/mrbgems/mruby-test/README.md +0 -1
  199. data/ext/enterprise_script_service/mruby/mrbgems/mruby-test/driver.c +5 -5
  200. data/ext/enterprise_script_service/mruby/mrbgems/mruby-test/mrbgem.rake +16 -44
  201. data/ext/enterprise_script_service/mruby/mrbgems/mruby-test/vformat.c +4 -4
  202. data/ext/enterprise_script_service/mruby/mrbgems/mruby-time/src/time.c +27 -27
  203. data/ext/enterprise_script_service/mruby/mrbgems/stdlib-ext.gembox +18 -0
  204. data/ext/enterprise_script_service/mruby/mrbgems/stdlib-io.gembox +12 -0
  205. data/ext/enterprise_script_service/mruby/mrbgems/stdlib.gembox +54 -0
  206. data/ext/enterprise_script_service/mruby/mrblib/10error.rb +4 -0
  207. data/ext/enterprise_script_service/mruby/mrblib/array.rb +17 -9
  208. data/ext/enterprise_script_service/mruby/mrblib/enum.rb +1 -1
  209. data/ext/enterprise_script_service/mruby/mrblib/hash.rb +0 -20
  210. data/ext/enterprise_script_service/mruby/mrblib/init_mrblib.c +0 -11
  211. data/ext/enterprise_script_service/mruby/mrblib/numeric.rb +36 -11
  212. data/ext/enterprise_script_service/mruby/mrblib/range.rb +25 -3
  213. data/ext/enterprise_script_service/mruby/oss-fuzz/mruby_proto_fuzzer.cpp +2 -2
  214. data/ext/enterprise_script_service/mruby/oss-fuzz/proto_to_ruby.h +1 -1
  215. data/ext/enterprise_script_service/mruby/src/array.c +43 -80
  216. data/ext/enterprise_script_service/mruby/src/backtrace.c +16 -17
  217. data/ext/enterprise_script_service/mruby/src/class.c +774 -182
  218. data/ext/enterprise_script_service/mruby/src/codedump.c +223 -198
  219. data/ext/enterprise_script_service/mruby/src/debug.c +6 -6
  220. data/ext/enterprise_script_service/mruby/src/dump.c +466 -141
  221. data/ext/enterprise_script_service/mruby/src/enum.c +1 -1
  222. data/ext/enterprise_script_service/mruby/src/error.c +36 -13
  223. data/ext/enterprise_script_service/mruby/src/etc.c +43 -34
  224. data/ext/enterprise_script_service/mruby/src/fmt_fp.c +5 -6
  225. data/ext/enterprise_script_service/mruby/src/gc.c +73 -71
  226. data/ext/enterprise_script_service/mruby/src/hash.c +1050 -707
  227. data/ext/enterprise_script_service/mruby/src/kernel.c +75 -220
  228. data/ext/enterprise_script_service/mruby/src/load.c +196 -166
  229. data/ext/enterprise_script_service/mruby/src/numeric.c +352 -314
  230. data/ext/enterprise_script_service/mruby/src/object.c +97 -90
  231. data/ext/enterprise_script_service/mruby/src/print.c +4 -3
  232. data/ext/enterprise_script_service/mruby/src/proc.c +48 -56
  233. data/ext/enterprise_script_service/mruby/src/range.c +45 -21
  234. data/ext/enterprise_script_service/mruby/src/state.c +25 -32
  235. data/ext/enterprise_script_service/mruby/src/string.c +59 -101
  236. data/ext/enterprise_script_service/mruby/src/symbol.c +121 -56
  237. data/ext/enterprise_script_service/mruby/src/value_array.h +1 -0
  238. data/ext/enterprise_script_service/mruby/src/variable.c +158 -158
  239. data/ext/enterprise_script_service/mruby/src/vm.c +617 -602
  240. data/ext/enterprise_script_service/mruby/tasks/benchmark.rake +6 -6
  241. data/ext/enterprise_script_service/mruby/tasks/bin.rake +23 -0
  242. data/ext/enterprise_script_service/mruby/tasks/core.rake +12 -0
  243. data/ext/enterprise_script_service/mruby/tasks/doc.rake +50 -38
  244. data/ext/enterprise_script_service/mruby/tasks/gitlab.rake +83 -77
  245. data/ext/enterprise_script_service/mruby/tasks/libmruby.rake +10 -1
  246. data/ext/enterprise_script_service/mruby/tasks/mrbgems.rake +13 -1
  247. data/ext/enterprise_script_service/mruby/tasks/mrblib.rake +40 -0
  248. data/ext/enterprise_script_service/mruby/tasks/presym.rake +44 -0
  249. data/ext/enterprise_script_service/mruby/tasks/test.rake +68 -0
  250. data/ext/enterprise_script_service/mruby/tasks/toolchains/gcc.rake +6 -5
  251. data/ext/enterprise_script_service/mruby/tasks/toolchains/openwrt.rake +10 -14
  252. data/ext/enterprise_script_service/mruby/tasks/toolchains/visualcpp.rake +17 -21
  253. data/ext/enterprise_script_service/mruby/test/bintest.rb +5 -5
  254. data/ext/enterprise_script_service/mruby/test/t/argumenterror.rb +16 -0
  255. data/ext/enterprise_script_service/mruby/test/t/array.rb +7 -3
  256. data/ext/enterprise_script_service/mruby/test/t/bs_literal.rb +1 -1
  257. data/ext/enterprise_script_service/mruby/test/t/float.rb +18 -8
  258. data/ext/enterprise_script_service/mruby/test/t/hash.rb +903 -281
  259. data/ext/enterprise_script_service/mruby/test/t/integer.rb +10 -38
  260. data/ext/enterprise_script_service/mruby/test/t/kernel.rb +1 -1
  261. data/ext/enterprise_script_service/mruby/test/t/literals.rb +50 -0
  262. data/ext/enterprise_script_service/mruby/test/t/module.rb +2 -2
  263. data/ext/enterprise_script_service/mruby/test/t/numeric.rb +1 -1
  264. data/ext/enterprise_script_service/mruby/test/t/range.rb +83 -1
  265. data/ext/enterprise_script_service/mruby/test/t/string.rb +4 -0
  266. data/ext/enterprise_script_service/mruby/test/t/superclass.rb +10 -10
  267. data/ext/enterprise_script_service/mruby/test/t/syntax.rb +24 -0
  268. data/ext/enterprise_script_service/mruby/test/t/vformat.rb +3 -3
  269. data/ext/enterprise_script_service/mruby_config.rb +2 -5
  270. data/ext/enterprise_script_service/mruby_engine.cpp +1 -1
  271. data/lib/script_core/version.rb +1 -1
  272. data/spec/script_core_spec.rb +13 -0
  273. metadata +61 -23
  274. data/ext/enterprise_script_service/mruby/.github/workflows/main.yml +0 -24
  275. data/ext/enterprise_script_service/mruby/TODO +0 -8
  276. data/ext/enterprise_script_service/mruby/appveyor_config.rb +0 -46
  277. data/ext/enterprise_script_service/mruby/benchmark/build_config_boxing.rb +0 -28
  278. data/ext/enterprise_script_service/mruby/examples/targets/build_config_android_arm64-v8a.rb +0 -26
  279. data/ext/enterprise_script_service/mruby/examples/targets/build_config_android_armeabi.rb +0 -26
  280. data/ext/enterprise_script_service/mruby/mrbgems/mruby-sprintf/src/kernel.c +0 -30
  281. data/ext/enterprise_script_service/mruby/mrblib/mrblib.rake +0 -18
  282. data/ext/enterprise_script_service/mruby/src/crc.c +0 -39
  283. data/ext/enterprise_script_service/mruby/src/mruby_core.rake +0 -19
@@ -1,5 +1,5 @@
1
1
  module CRubyExtension
2
2
  def CRubyExtension.ruby_method
3
- puts "A Ruby Extension"
3
+ puts "#{self}: A Ruby Extension"
4
4
  end
5
5
  end
@@ -1,10 +1,14 @@
1
1
  #include <mruby.h>
2
+ #include <mruby/string.h>
2
3
  #include <stdio.h>
3
4
 
4
5
  static mrb_value
5
6
  mrb_c_method(mrb_state *mrb, mrb_value self)
6
7
  {
7
- puts("A C Extension");
8
+ mrb_value self_str = mrb_str_to_str(mrb, self);
9
+
10
+ printf("%s: A C Extension\n", mrb_str_to_cstr(mrb, self_str));
11
+
8
12
  return self;
9
13
  }
10
14
 
@@ -1,10 +1,14 @@
1
1
  #include <mruby.h>
2
+ #include <mruby/string.h>
2
3
  #include <stdio.h>
3
4
 
4
5
  static mrb_value
5
6
  mrb_c_method(mrb_state *mrb, mrb_value self)
6
7
  {
7
- puts("A C Extension");
8
+ mrb_value self_str = mrb_str_to_str(mrb, self);
9
+
10
+ printf("%s: A C Extension\n", mrb_str_to_cstr(mrb, self_str));
11
+
8
12
  return self;
9
13
  }
10
14
 
@@ -1,5 +1,5 @@
1
1
  class RubyExtension
2
2
  def RubyExtension.ruby_method
3
- puts "A Ruby Extension"
3
+ puts "#{self}: A Ruby Extension"
4
4
  end
5
5
  end
@@ -25,33 +25,69 @@
25
25
  #endif
26
26
 
27
27
  /* configuration options: */
28
- /* add -DMRB_USE_FLOAT to use float instead of double for floating point numbers */
29
- //#define MRB_USE_FLOAT
28
+ /* add -DMRB_USE_FLOAT32 to use float instead of double for floating point numbers */
29
+ //#define MRB_USE_FLOAT32
30
30
 
31
31
  /* exclude floating point numbers */
32
- //#define MRB_WITHOUT_FLOAT
32
+ //#define MRB_NO_FLOAT
33
33
 
34
- /* add -DMRB_METHOD_CACHE to use method cache to improve performance */
35
- //#define MRB_METHOD_CACHE
34
+ /* obsolete configuration */
35
+ #if defined(MRB_USE_FLOAT)
36
+ # define MRB_USE_FLOAT32
37
+ #endif
38
+
39
+ /* obsolete configuration */
40
+ #if defined(MRB_WITHOUT_FLOAT)
41
+ # define MRB_NO_FLOAT
42
+ #endif
43
+
44
+ #if defined(MRB_USE_FLOAT32) && defined(MRB_NO_FLOAT)
45
+ #error Cannot define MRB_USE_FLOAT32 and MRB_NO_FLOAT at the same time
46
+ #endif
47
+
48
+ /* add -DMRB_NO_METHOD_CACHE to disable method cache to save memory */
49
+ //#define MRB_NO_METHOD_CACHE
36
50
  /* size of the method cache (need to be the power of 2) */
37
- //#define MRB_METHOD_CACHE_SIZE (1<<7)
51
+ //#define MRB_METHOD_CACHE_SIZE (1<<8)
38
52
 
39
- /* add -DMRB_METHOD_T_STRUCT on machines that use higher bits of pointers */
40
- /* no MRB_METHOD_T_STRUCT requires highest 2 bits of function pointers to be zero */
41
- #ifndef MRB_METHOD_T_STRUCT
53
+ /* add -DMRB_USE_METHOD_T_STRUCT on machines that use higher bits of function pointers */
54
+ /* no MRB_USE_METHOD_T_STRUCT requires highest 2 bits of function pointers to be zero */
55
+ #ifndef MRB_USE_METHOD_T_STRUCT
42
56
  // can't use highest 2 bits of function pointers at least on 32bit
43
57
  // Windows and 32bit Linux.
44
58
  # ifdef MRB_32BIT
45
- # define MRB_METHOD_T_STRUCT
59
+ # define MRB_USE_METHOD_T_STRUCT
46
60
  # endif
47
61
  #endif
48
62
 
63
+ /* define on big endian machines; used by MRB_NAN_BOXING, etc. */
64
+ #ifndef MRB_ENDIAN_BIG
65
+ # if (defined(BYTE_ORDER) && defined(BIG_ENDIAN) && BYTE_ORDER == BIG_ENDIAN) || \
66
+ (defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
67
+ # define MRB_ENDIAN_BIG
68
+ # endif
69
+ #endif
70
+
71
+ /* represent mrb_value in boxed double; conflict with MRB_USE_FLOAT32 and MRB_NO_FLOAT */
72
+ //#define MRB_NAN_BOXING
73
+
74
+ /* represent mrb_value as a word (natural unit of data for the processor) */
75
+ //#define MRB_WORD_BOXING
76
+
77
+ /* represent mrb_value as a struct; occupies 2 words */
78
+ //#define MRB_NO_BOXING
79
+
80
+ /* if no specific boxing type is chosen */
81
+ #if !defined(MRB_NAN_BOXING) && !defined(MRB_WORD_BOXING) && !defined(MRB_NO_BOXING)
82
+ # define MRB_WORD_BOXING
83
+ #endif
84
+
49
85
  /* add -DMRB_INT32 to use 32bit integer for mrb_int; conflict with MRB_INT64;
50
86
  Default for 32-bit CPU mode. */
51
87
  //#define MRB_INT32
52
88
 
53
89
  /* add -DMRB_INT64 to use 64bit integer for mrb_int; conflict with MRB_INT32;
54
- Default for 64-bit CPU mode. */
90
+ Default for 64-bit CPU mode (unless using MRB_NAN_BOXING). */
55
91
  //#define MRB_INT64
56
92
 
57
93
  /* if no specific integer type is chosen */
@@ -65,19 +101,8 @@
65
101
  # endif
66
102
  #endif
67
103
 
68
- /* define on big endian machines; used by MRB_NAN_BOXING, etc. */
69
- #ifndef MRB_ENDIAN_BIG
70
- # if (defined(BYTE_ORDER) && defined(BIG_ENDIAN) && BYTE_ORDER == BIG_ENDIAN) || \
71
- (defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
72
- # define MRB_ENDIAN_BIG
73
- # endif
74
- #endif
75
-
76
- /* represent mrb_value in boxed double; conflict with MRB_USE_FLOAT and MRB_WITHOUT_FLOAT */
77
- //#define MRB_NAN_BOXING
78
-
79
- /* represent mrb_value as a word (natural unit of data for the processor) */
80
- //#define MRB_WORD_BOXING
104
+ /* call malloc_trim(0) from mrb_full_gc() */
105
+ //#define MRB_USE_MALLOC_TRIM
81
106
 
82
107
  /* string class to handle UTF-8 encoding */
83
108
  //#define MRB_UTF8_STRING
@@ -108,9 +133,6 @@
108
133
  /* page size of memory pool */
109
134
  //#define POOL_PAGE_SIZE 16000
110
135
 
111
- /* initial minimum size for string buffer */
112
- //#define MRB_STR_BUF_MIN_SIZE 128
113
-
114
136
  /* arena size */
115
137
  //#define MRB_GC_ARENA_SIZE 100
116
138
 
@@ -123,26 +145,39 @@
123
145
  /* fixed size state atexit stack */
124
146
  //#define MRB_FIXED_STATE_ATEXIT_STACK
125
147
 
126
- /* -DMRB_DISABLE_XXXX to drop following features */
127
- //#define MRB_DISABLE_STDIO /* use of stdio */
128
-
129
- /* -DMRB_ENABLE_XXXX to enable following features */
130
- //#define MRB_ENABLE_DEBUG_HOOK /* hooks for debugger */
131
- //#define MRB_ENABLE_ALL_SYMBOLS /* Symbols.all_symbols */
148
+ /* -DMRB_NO_XXXX to drop following features */
149
+ //#define MRB_NO_STDIO /* use of stdio */
132
150
 
133
- /* end of configuration */
151
+ /* -DMRB_USE_XXXX to enable following features */
152
+ //#define MRB_USE_DEBUG_HOOK /* hooks for debugger */
153
+ //#define MRB_USE_ALL_SYMBOLS /* Symbol.all_symbols */
134
154
 
135
- /* define MRB_DISABLE_XXXX from DISABLE_XXX (for compatibility) */
136
- #ifdef DISABLE_STDIO
137
- #define MRB_DISABLE_STDIO
155
+ /* obsolete configurations */
156
+ #ifdef MRB_METHOD_T_STRUCT
157
+ # define MRB_USE_METHOD_T_STRUCT
138
158
  #endif
139
-
140
- /* define MRB_ENABLE_XXXX from ENABLE_XXX (for compatibility) */
141
- #ifdef ENABLE_DEBUG
142
- #define MRB_ENABLE_DEBUG_HOOK
159
+ #if defined(DISABLE_STDIO) || defined(MRB_DISABLE_STDIO)
160
+ # define MRB_NO_STDIO
161
+ #endif
162
+ #ifdef MRB_DISABLE_DIRECT_THREADING
163
+ # define MRB_NO_DIRECT_THREADING
164
+ #endif
165
+ #if defined(ENABLE_DEBUG) || defined(MRB_ENABLE_DEBUG_HOOK)
166
+ # define MRB_USE_DEBUG_HOOK
167
+ #endif
168
+ #ifdef MRB_ENABLE_ALL_SYMBOLS
169
+ # define MRB_USE_ALL_SYMBOLS
170
+ #endif
171
+ #ifdef MRB_ENABLE_CXX_ABI
172
+ # define MRB_USE_CXX_ABI
173
+ #endif
174
+ #ifdef MRB_ENABLE_CXX_EXCEPTION
175
+ # define MRB_USE_CXX_EXCEPTION
143
176
  #endif
144
177
 
145
- #ifndef MRB_DISABLE_STDIO
178
+ /* end of configuration */
179
+
180
+ #ifndef MRB_NO_STDIO
146
181
  # include <stdio.h>
147
182
  #endif
148
183
 
@@ -160,12 +195,12 @@
160
195
 
161
196
  /* A profile for micro controllers */
162
197
  #if defined(MRB_CONSTRAINED_BASELINE_PROFILE)
163
- # ifndef KHASH_DEFAULT_SIZE
164
- # define KHASH_DEFAULT_SIZE 16
198
+ # ifndef MRB_NO_METHOD_CACHE
199
+ # define MRB_NO_METHOD_CACHE
165
200
  # endif
166
201
 
167
- # ifndef MRB_STR_BUF_MIN_SIZE
168
- # define MRB_STR_BUF_MIN_SIZE 32
202
+ # ifndef KHASH_DEFAULT_SIZE
203
+ # define KHASH_DEFAULT_SIZE 16
169
204
  # endif
170
205
 
171
206
  # ifndef MRB_HEAP_PAGE_SIZE
@@ -177,36 +212,20 @@
177
212
 
178
213
  /* A profile for desktop computers or workstations; rich memory! */
179
214
  #elif defined(MRB_MAIN_PROFILE)
180
- # ifndef MRB_METHOD_CACHE
181
- # define MRB_METHOD_CACHE
182
- # endif
183
-
184
215
  # ifndef MRB_METHOD_CACHE_SIZE
185
216
  # define MRB_METHOD_CACHE_SIZE (1<<10)
186
217
  # endif
187
218
 
188
- # ifndef MRB_IV_SEGMENT_SIZE
189
- # define MRB_IV_SEGMENT_SIZE 32
190
- # endif
191
-
192
219
  # ifndef MRB_HEAP_PAGE_SIZE
193
220
  # define MRB_HEAP_PAGE_SIZE 4096
194
221
  # endif
195
222
 
196
223
  /* A profile for server; mruby vm is long life */
197
224
  #elif defined(MRB_HIGH_PROFILE)
198
- # ifndef MRB_METHOD_CACHE
199
- # define MRB_METHOD_CACHE
200
- # endif
201
-
202
225
  # ifndef MRB_METHOD_CACHE_SIZE
203
226
  # define MRB_METHOD_CACHE_SIZE (1<<12)
204
227
  # endif
205
228
 
206
- # ifndef MRB_IV_SEGMENT_SIZE
207
- # define MRB_IV_SEGMENT_SIZE 64
208
- # endif
209
-
210
229
  # ifndef MRB_HEAP_PAGE_SIZE
211
230
  # define MRB_HEAP_PAGE_SIZE 4096
212
231
  # endif
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  ** mruby - An embeddable Ruby implementation
3
3
  **
4
- ** Copyright (c) mruby developers 2010-2020
4
+ ** Copyright (c) mruby developers 2010-2021
5
5
  **
6
6
  ** Permission is hereby granted, free of charge, to any person obtaining
7
7
  ** a copy of this software and associated documentation files (the
@@ -22,7 +22,7 @@
22
22
  ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23
23
  ** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24
24
  **
25
- ** [ MIT license: http://www.opensource.org/licenses/mit-license.php ]
25
+ ** [ MIT license: https://www.opensource.org/licenses/mit-license.php ]
26
26
  */
27
27
 
28
28
  /**
@@ -53,6 +53,10 @@
53
53
  #endif
54
54
  #endif
55
55
 
56
+ #ifdef _MSC_VER
57
+ # define __func__ __FUNCTION__
58
+ #endif
59
+
56
60
  #ifdef MRB_DEBUG
57
61
  #include <assert.h>
58
62
  #define mrb_assert(p) assert(p)
@@ -62,11 +66,27 @@
62
66
  #define mrb_assert_int_fit(t1,n,t2,max) ((void)0)
63
67
  #endif
64
68
 
65
- #if defined __STDC_VERSION__ && __STDC_VERSION__ >= 201112L
66
- #define mrb_static_assert(exp, str) _Static_assert(exp, str)
69
+ #if (defined __cplusplus && __cplusplus >= 201103L) || \
70
+ (defined _MSC_VER) || \
71
+ (defined __GXX_EXPERIMENTAL_CXX0X__) /* for old G++/Clang++ */
72
+ # define mrb_static_assert(exp, str) static_assert(exp, str)
73
+ #elif defined __STDC_VERSION__ && \
74
+ ((__STDC_VERSION__ >= 201112L) || \
75
+ (defined __GNUC__ && __GNUC__ * 100 + __GNUC_MINOR__ >= 406))
76
+ # define mrb_static_assert(exp, str) _Static_assert(exp, str)
67
77
  #else
68
- #define mrb_static_assert(exp, str) mrb_assert(exp)
78
+ # /* alternative implementation of static_assert() */
79
+ # define _mrb_static_assert_cat0(a, b) a##b
80
+ # define _mrb_static_assert_cat(a, b) _mrb_static_assert_cat0(a, b)
81
+ # ifdef __COUNTER__
82
+ # define _mrb_static_assert_id(prefix) _mrb_static_assert_cat(prefix, __COUNTER__)
83
+ # else
84
+ # define _mrb_static_assert_id(prefix) _mrb_static_assert_cat(prefix, __LINE__)
85
+ # endif
86
+ # define mrb_static_assert(exp, str) \
87
+ struct _mrb_static_assert_id(_mrb_static_assert_) { char x[(exp) ? 1 : -1]; }
69
88
  #endif
89
+ #define mrb_static_assert1(exp) mrb_static_assert(exp, #exp)
70
90
 
71
91
  #include "mrbconf.h"
72
92
 
@@ -75,7 +95,7 @@
75
95
  #include <mruby/gc.h>
76
96
  #include <mruby/version.h>
77
97
 
78
- #ifndef MRB_WITHOUT_FLOAT
98
+ #ifndef MRB_NO_FLOAT
79
99
  #include <float.h>
80
100
  #ifndef FLT_EPSILON
81
101
  #define FLT_EPSILON (1.19209290e-07f)
@@ -87,7 +107,7 @@
87
107
  #define LDBL_EPSILON (1.08420217248550443401e-19L)
88
108
  #endif
89
109
 
90
- #ifdef MRB_USE_FLOAT
110
+ #ifdef MRB_USE_FLOAT32
91
111
  #define MRB_FLOAT_EPSILON FLT_EPSILON
92
112
  #else
93
113
  #define MRB_FLOAT_EPSILON DBL_EPSILON
@@ -130,16 +150,15 @@ typedef void* (*mrb_allocf) (struct mrb_state *mrb, void*, size_t, void *ud);
130
150
 
131
151
  typedef struct {
132
152
  mrb_sym mid;
133
- struct RProc *proc;
134
- mrb_value *stackent;
135
- uint16_t ridx;
136
- uint16_t epos;
137
- struct REnv *env;
138
- const mrb_code *pc; /* return address */
139
- const mrb_code *err; /* error position */
140
- int argc;
141
- int acc;
142
- struct RClass *target_class;
153
+ int16_t argc;
154
+ int16_t acc;
155
+ const struct RProc *proc;
156
+ mrb_value *stack;
157
+ const mrb_code *pc; /* current address on iseq of this proc */
158
+ union {
159
+ struct REnv *env;
160
+ struct RClass *target_class;
161
+ } u;
143
162
  } mrb_callinfo;
144
163
 
145
164
  enum mrb_fiber_state {
@@ -154,28 +173,22 @@ enum mrb_fiber_state {
154
173
  struct mrb_context {
155
174
  struct mrb_context *prev;
156
175
 
157
- mrb_value *stack; /* stack of virtual machine */
158
- mrb_value *stbase, *stend;
176
+ mrb_value *stbase, *stend; /* stack of virtual machine */
159
177
 
160
178
  mrb_callinfo *ci;
161
179
  mrb_callinfo *cibase, *ciend;
162
180
 
163
- uint16_t *rescue; /* exception handler stack */
164
- uint16_t rsize;
165
- struct RProc **ensure; /* ensure handler stack */
166
- uint16_t esize, eidx;
167
-
168
181
  enum mrb_fiber_state status : 4;
169
182
  mrb_bool vmexec : 1;
170
183
  struct RFiber *fib;
171
184
  };
172
185
 
173
186
  #ifdef MRB_METHOD_CACHE_SIZE
174
- # define MRB_METHOD_CACHE
187
+ # undef MRB_NO_METHOD_CACHE
175
188
  #else
176
- /* default method cache size: 128 */
189
+ /* default method cache size: 256 */
177
190
  /* cache size needs to be power of 2 */
178
- # define MRB_METHOD_CACHE_SIZE (1<<7)
191
+ # define MRB_METHOD_CACHE_SIZE (1<<8)
179
192
  #endif
180
193
 
181
194
  /**
@@ -189,7 +202,7 @@ struct mrb_context {
189
202
  */
190
203
  typedef mrb_value (*mrb_func_t)(struct mrb_state *mrb, mrb_value self);
191
204
 
192
- #ifndef MRB_METHOD_T_STRUCT
205
+ #ifndef MRB_USE_METHOD_T_STRUCT
193
206
  typedef uintptr_t mrb_method_t;
194
207
  #else
195
208
  typedef struct {
@@ -201,7 +214,7 @@ typedef struct {
201
214
  } mrb_method_t;
202
215
  #endif
203
216
 
204
- #ifdef MRB_METHOD_CACHE
217
+ #ifndef MRB_NO_METHOD_CACHE
205
218
  struct mrb_cache_entry {
206
219
  struct RClass *c, *c0;
207
220
  mrb_sym mid;
@@ -235,10 +248,10 @@ typedef struct mrb_state {
235
248
  struct RClass *hash_class;
236
249
  struct RClass *range_class;
237
250
 
238
- #ifndef MRB_WITHOUT_FLOAT
251
+ #ifndef MRB_NO_FLOAT
239
252
  struct RClass *float_class;
240
253
  #endif
241
- struct RClass *fixnum_class;
254
+ struct RClass *integer_class;
242
255
  struct RClass *true_class;
243
256
  struct RClass *false_class;
244
257
  struct RClass *nil_class;
@@ -247,7 +260,7 @@ typedef struct mrb_state {
247
260
 
248
261
  mrb_gc gc;
249
262
 
250
- #ifdef MRB_METHOD_CACHE
263
+ #ifndef MRB_NO_METHOD_CACHE
251
264
  struct mrb_cache_entry cache[MRB_METHOD_CACHE_SIZE];
252
265
  #endif
253
266
 
@@ -255,13 +268,13 @@ typedef struct mrb_state {
255
268
  struct symbol_name *symtbl; /* symbol table */
256
269
  mrb_sym symhash[256];
257
270
  size_t symcapa;
258
- #ifndef MRB_ENABLE_SYMBOLL_ALL
271
+ #ifndef MRB_USE_ALL_SYMBOLS
259
272
  char symbuf[8]; /* buffer for small symbol names */
260
273
  #endif
261
274
 
262
- #ifdef MRB_ENABLE_DEBUG_HOOK
263
- void (*code_fetch_hook)(struct mrb_state* mrb, struct mrb_irep *irep, const mrb_code *pc, mrb_value *regs);
264
- void (*debug_op_hook)(struct mrb_state* mrb, struct mrb_irep *irep, const mrb_code *pc, mrb_value *regs);
275
+ #ifdef MRB_USE_DEBUG_HOOK
276
+ void (*code_fetch_hook)(struct mrb_state* mrb, const struct mrb_irep *irep, const mrb_code *pc, mrb_value *regs);
277
+ void (*debug_op_hook)(struct mrb_state* mrb, const struct mrb_irep *irep, const mrb_code *pc, mrb_value *regs);
265
278
  #endif
266
279
 
267
280
  #ifdef MRB_BYTECODE_DECODE_OPTION
@@ -273,7 +286,7 @@ typedef struct mrb_state {
273
286
  struct RObject *nomem_err; /* pre-allocated NoMemoryError */
274
287
  struct RObject *stack_err; /* pre-allocated SysStackError */
275
288
  #ifdef MRB_GC_FIXED_ARENA
276
- struct RObject *arena_err; /* pre-allocated arena overfow error */
289
+ struct RObject *arena_err; /* pre-allocated arena overflow error */
277
290
  #endif
278
291
 
279
292
  void *ud; /* auxiliary data */
@@ -284,7 +297,6 @@ typedef struct mrb_state {
284
297
  mrb_atexit_func *atexit_stack;
285
298
  #endif
286
299
  uint16_t atexit_stack_len;
287
- uint16_t ecall_nest; /* prevent infinite recursive ecall() */
288
300
  } mrb_state;
289
301
 
290
302
  /**
@@ -309,6 +321,7 @@ typedef struct mrb_state {
309
321
  * @see mrb_define_class_under
310
322
  */
311
323
  MRB_API struct RClass *mrb_define_class(mrb_state *mrb, const char *name, struct RClass *super);
324
+ MRB_API struct RClass *mrb_define_class_id(mrb_state *mrb, mrb_sym name, struct RClass *super);
312
325
 
313
326
  /**
314
327
  * Defines a new module.
@@ -318,6 +331,7 @@ MRB_API struct RClass *mrb_define_class(mrb_state *mrb, const char *name, struct
318
331
  * @return [struct RClass *] Reference to the newly defined module.
319
332
  */
320
333
  MRB_API struct RClass *mrb_define_module(mrb_state *mrb, const char *name);
334
+ MRB_API struct RClass *mrb_define_module_id(mrb_state *mrb, mrb_sym name);
321
335
 
322
336
  MRB_API mrb_value mrb_singleton_class(mrb_state *mrb, mrb_value val);
323
337
  MRB_API struct RClass *mrb_singleton_class_ptr(mrb_state *mrb, mrb_value val);
@@ -373,6 +387,7 @@ MRB_API void mrb_prepend_module(mrb_state *mrb, struct RClass *cla, struct RClas
373
387
  * @param aspec The method parameters declaration.
374
388
  */
375
389
  MRB_API void mrb_define_method(mrb_state *mrb, struct RClass *cla, const char *name, mrb_func_t func, mrb_aspec aspec);
390
+ MRB_API void mrb_define_method_id(mrb_state *mrb, struct RClass *c, mrb_sym mid, mrb_func_t func, mrb_aspec aspec);
376
391
 
377
392
  /**
378
393
  * Defines a class method.
@@ -400,6 +415,7 @@ MRB_API void mrb_define_method(mrb_state *mrb, struct RClass *cla, const char *n
400
415
  * @param aspec The method parameters declaration.
401
416
  */
402
417
  MRB_API void mrb_define_class_method(mrb_state *mrb, struct RClass *cla, const char *name, mrb_func_t fun, mrb_aspec aspec);
418
+ MRB_API void mrb_define_class_method_id(mrb_state *mrb, struct RClass *cla, mrb_sym name, mrb_func_t fun, mrb_aspec aspec);
403
419
 
404
420
  /**
405
421
  * Defines a singleton method
@@ -407,6 +423,7 @@ MRB_API void mrb_define_class_method(mrb_state *mrb, struct RClass *cla, const c
407
423
  * @see mrb_define_class_method
408
424
  */
409
425
  MRB_API void mrb_define_singleton_method(mrb_state *mrb, struct RObject *cla, const char *name, mrb_func_t fun, mrb_aspec aspec);
426
+ MRB_API void mrb_define_singleton_method_id(mrb_state *mrb, struct RObject *cla, mrb_sym name, mrb_func_t fun, mrb_aspec aspec);
410
427
 
411
428
  /**
412
429
  * Defines a module function.
@@ -434,6 +451,7 @@ MRB_API void mrb_define_singleton_method(mrb_state *mrb, struct RObject *cla, co
434
451
  * @param aspec The method parameters declaration.
435
452
  */
436
453
  MRB_API void mrb_define_module_function(mrb_state *mrb, struct RClass *cla, const char *name, mrb_func_t fun, mrb_aspec aspec);
454
+ MRB_API void mrb_define_module_function_id(mrb_state *mrb, struct RClass *cla, mrb_sym name, mrb_func_t fun, mrb_aspec aspec);
437
455
 
438
456
  /**
439
457
  * Defines a constant.
@@ -462,6 +480,7 @@ MRB_API void mrb_define_module_function(mrb_state *mrb, struct RClass *cla, cons
462
480
  * @param val The value for the constant.
463
481
  */
464
482
  MRB_API void mrb_define_const(mrb_state* mrb, struct RClass* cla, const char *name, mrb_value val);
483
+ MRB_API void mrb_define_const_id(mrb_state* mrb, struct RClass* cla, mrb_sym name, mrb_value val);
465
484
 
466
485
  /**
467
486
  * Undefines a method.
@@ -552,6 +571,7 @@ MRB_API void mrb_undef_method_id(mrb_state*, struct RClass*, mrb_sym);
552
571
  * @param name The name of the class method to be undefined.
553
572
  */
554
573
  MRB_API void mrb_undef_class_method(mrb_state *mrb, struct RClass *cls, const char *name);
574
+ MRB_API void mrb_undef_class_method_id(mrb_state *mrb, struct RClass *cls, mrb_sym name);
555
575
 
556
576
  /**
557
577
  * Initialize a new object instance of c class.
@@ -653,6 +673,7 @@ MRB_API struct RClass * mrb_module_new(mrb_state *mrb);
653
673
  * @return [mrb_bool] A boolean value.
654
674
  */
655
675
  MRB_API mrb_bool mrb_class_defined(mrb_state *mrb, const char *name);
676
+ MRB_API mrb_bool mrb_class_defined_id(mrb_state *mrb, mrb_sym name);
656
677
 
657
678
  /**
658
679
  * Gets a class.
@@ -660,7 +681,8 @@ MRB_API mrb_bool mrb_class_defined(mrb_state *mrb, const char *name);
660
681
  * @param name The name of the class.
661
682
  * @return [struct RClass *] A reference to the class.
662
683
  */
663
- MRB_API struct RClass * mrb_class_get(mrb_state *mrb, const char *name);
684
+ MRB_API struct RClass* mrb_class_get(mrb_state *mrb, const char *name);
685
+ MRB_API struct RClass* mrb_class_get_id(mrb_state *mrb, mrb_sym name);
664
686
 
665
687
  /**
666
688
  * Gets a exception class.
@@ -668,7 +690,8 @@ MRB_API struct RClass * mrb_class_get(mrb_state *mrb, const char *name);
668
690
  * @param name The name of the class.
669
691
  * @return [struct RClass *] A reference to the class.
670
692
  */
671
- MRB_API struct RClass * mrb_exc_get(mrb_state *mrb, const char *name);
693
+ MRB_API struct RClass* mrb_exc_get_id(mrb_state *mrb, mrb_sym name);
694
+ #define mrb_exc_get(mrb, name) mrb_exc_get_id(mrb, mrb_intern_cstr(mrb, name))
672
695
 
673
696
  /**
674
697
  * Returns an mrb_bool. True if inner class was defined, and false if the inner class was not defined.
@@ -700,6 +723,7 @@ MRB_API struct RClass * mrb_exc_get(mrb_state *mrb, const char *name);
700
723
  * @return [mrb_bool] A boolean value.
701
724
  */
702
725
  MRB_API mrb_bool mrb_class_defined_under(mrb_state *mrb, struct RClass *outer, const char *name);
726
+ MRB_API mrb_bool mrb_class_defined_under_id(mrb_state *mrb, struct RClass *outer, mrb_sym name);
703
727
 
704
728
  /**
705
729
  * Gets a child class.
@@ -709,6 +733,7 @@ MRB_API mrb_bool mrb_class_defined_under(mrb_state *mrb, struct RClass *outer, c
709
733
  * @return [struct RClass *] A reference to the class.
710
734
  */
711
735
  MRB_API struct RClass * mrb_class_get_under(mrb_state *mrb, struct RClass *outer, const char *name);
736
+ MRB_API struct RClass * mrb_class_get_under_id(mrb_state *mrb, struct RClass *outer, mrb_sym name);
712
737
 
713
738
  /**
714
739
  * Gets a module.
@@ -717,6 +742,7 @@ MRB_API struct RClass * mrb_class_get_under(mrb_state *mrb, struct RClass *outer
717
742
  * @return [struct RClass *] A reference to the module.
718
743
  */
719
744
  MRB_API struct RClass * mrb_module_get(mrb_state *mrb, const char *name);
745
+ MRB_API struct RClass * mrb_module_get_id(mrb_state *mrb, mrb_sym name);
720
746
 
721
747
  /**
722
748
  * Gets a module defined under another module.
@@ -726,6 +752,8 @@ MRB_API struct RClass * mrb_module_get(mrb_state *mrb, const char *name);
726
752
  * @return [struct RClass *] A reference to the module.
727
753
  */
728
754
  MRB_API struct RClass * mrb_module_get_under(mrb_state *mrb, struct RClass *outer, const char *name);
755
+ MRB_API struct RClass * mrb_module_get_under_id(mrb_state *mrb, struct RClass *outer, mrb_sym name);
756
+
729
757
  /* a function to raise NotImplementedError with current method name */
730
758
  MRB_API void mrb_notimplement(mrb_state*);
731
759
  /* a function to be replacement of unimplemented method */
@@ -794,9 +822,11 @@ MRB_API mrb_bool mrb_obj_respond_to(mrb_state *mrb, struct RClass* c, mrb_sym mi
794
822
  * @return [struct RClass *] Reference to the newly defined class
795
823
  * @see mrb_define_class
796
824
  */
797
- MRB_API struct RClass * mrb_define_class_under(mrb_state *mrb, struct RClass *outer, const char *name, struct RClass *super);
825
+ MRB_API struct RClass* mrb_define_class_under(mrb_state *mrb, struct RClass *outer, const char *name, struct RClass *super);
826
+ MRB_API struct RClass* mrb_define_class_under_id(mrb_state *mrb, struct RClass *outer, mrb_sym name, struct RClass *super);
798
827
 
799
- MRB_API struct RClass * mrb_define_module_under(mrb_state *mrb, struct RClass *outer, const char *name);
828
+ MRB_API struct RClass* mrb_define_module_under(mrb_state *mrb, struct RClass *outer, const char *name);
829
+ MRB_API struct RClass* mrb_define_module_under_id(mrb_state *mrb, struct RClass *outer, mrb_sym name);
800
830
 
801
831
  /**
802
832
  * Function requires n arguments.
@@ -860,17 +890,17 @@ MRB_API struct RClass * mrb_define_module_under(mrb_state *mrb, struct RClass *o
860
890
  * | `S` | {String} | {mrb_value} | when `!` follows, the value may be `nil` |
861
891
  * | `A` | {Array} | {mrb_value} | when `!` follows, the value may be `nil` |
862
892
  * | `H` | {Hash} | {mrb_value} | when `!` follows, the value may be `nil` |
863
- * | `s` | {String} | char *, {mrb_int} | Receive two arguments; `s!` gives (`NULL`,`0`) for `nil` |
864
- * | `z` | {String} | char * | `NULL` terminated string; `z!` gives `NULL` for `nil` |
865
- * | `a` | {Array} | {mrb_value} *, {mrb_int} | Receive two arguments; `a!` gives (`NULL`,`0`) for `nil` |
866
- * | `f` | {Fixnum}/{Float} | {mrb_float} | |
867
- * | `i` | {Fixnum}/{Float} | {mrb_int} | |
893
+ * | `s` | {String} | const char *, {mrb_int} | Receive two arguments; `s!` gives (`NULL`,`0`) for `nil` |
894
+ * | `z` | {String} | const char * | `NULL` terminated string; `z!` gives `NULL` for `nil` |
895
+ * | `a` | {Array} | const {mrb_value} *, {mrb_int} | Receive two arguments; `a!` gives (`NULL`,`0`) for `nil` |
896
+ * | `f` | {Integer}/{Float} | {mrb_float} | |
897
+ * | `i` | {Integer}/{Float} | {mrb_int} | |
868
898
  * | `b` | boolean | {mrb_bool} | |
869
899
  * | `n` | {String}/{Symbol} | {mrb_sym} | |
870
900
  * | `d` | data | void *, {mrb_data_type} const | 2nd argument will be used to check data type so it won't be modified; when `!` follows, the value may be `nil` |
871
901
  * | `I` | inline struct | void * | |
872
902
  * | `&` | block | {mrb_value} | &! raises exception if no block given. |
873
- * | `*` | rest arguments | {mrb_value} *, {mrb_int} | Receive the rest of arguments as an array; `*!` avoid copy of the stack. |
903
+ * | `*` | rest arguments | const {mrb_value} *, {mrb_int} | Receive the rest of arguments as an array; `*!` avoid copy of the stack. |
874
904
  * | <code>\|</code> | optional | | After this spec following specs would be optional. |
875
905
  * | `?` | optional given | {mrb_bool} | `TRUE` if preceding argument is given. Used to check optional argument is given. |
876
906
  * | `:` | keyword args | {mrb_kwargs} const | Get keyword arguments. @see mrb_kwargs |
@@ -902,7 +932,7 @@ typedef const char *mrb_args_format;
902
932
  * const char *kw_names[kw_num] = { "a", "b" };
903
933
  * uint32_t kw_required = 0;
904
934
  * mrb_value kw_values[kw_num];
905
- * const mrb_kwargs kwargs = { kw_num, kw_values, kw_names, kw_required, NULL };
935
+ * const mrb_kwargs kwargs = { kw_num, kw_required, kw_names, kw_values, NULL };
906
936
  *
907
937
  * mrb_get_args(mrb, ":", &kwargs);
908
938
  * if (mrb_undef_p(kw_values[0])) { kw_values[0] = mrb_fixnum_value(1); }
@@ -913,10 +943,10 @@ typedef const char *mrb_args_format;
913
943
  *
914
944
  * mrb_value str, kw_rest;
915
945
  * uint32_t kw_num = 3;
916
- * const char *kw_names[kw_num] = { "x", "y", "z" };
946
+ * const mrb_sym kw_names[kw_num] = { MRB_SYM(x), MRB_SYM(y), MRB_SYM(z) };
917
947
  * uint32_t kw_required = 1;
918
948
  * mrb_value kw_values[kw_num];
919
- * const mrb_kwargs kwargs = { kw_num, kw_values, kw_names, kw_required, &kw_rest };
949
+ * const mrb_kwargs kwargs = { kw_num, kw_required, kw_names, kw_values, &kw_rest };
920
950
  *
921
951
  * mrb_get_args(mrb, "S:", &str, &kwargs);
922
952
  * // or: mrb_get_args(mrb, ":S", &kwargs, &str);
@@ -927,11 +957,11 @@ typedef struct mrb_kwargs mrb_kwargs;
927
957
 
928
958
  struct mrb_kwargs
929
959
  {
930
- uint32_t num;
931
- mrb_value *values;
932
- const char *const *table;
933
- uint32_t required;
934
- mrb_value *rest;
960
+ uint32_t num; /* number of keyword arguments */
961
+ uint32_t required; /* number of required keyword arguments */
962
+ const mrb_sym *table; /* C array of symbols for keyword names */
963
+ mrb_value *values; /* keyword argument values */
964
+ mrb_value *rest; /* keyword rest (dict) */
935
965
  };
936
966
 
937
967
  /**
@@ -964,7 +994,7 @@ MRB_API mrb_int mrb_get_argc(mrb_state *mrb);
964
994
  *
965
995
  * Correctly handles *splat arguments.
966
996
  */
967
- MRB_API mrb_value* mrb_get_argv(mrb_state *mrb);
997
+ MRB_API const mrb_value *mrb_get_argv(mrb_state *mrb);
968
998
 
969
999
  /**
970
1000
  * Retrieve the first and only argument from mrb_state.
@@ -1001,6 +1031,7 @@ MRB_API mrb_value mrb_get_arg1(mrb_state *mrb);
1001
1031
  * FILE *fp = fopen("test.rb","r");
1002
1032
  * mrb_value obj = mrb_load_file(mrb,fp);
1003
1033
  * mrb_funcall(mrb, obj, "method_name", 1, mrb_fixnum_value(i));
1034
+ * mrb_funcall_id(mrb, obj, MRB_SYM(method_name), 1, mrb_fixnum_value(i));
1004
1035
  * fclose(fp);
1005
1036
  * mrb_close(mrb);
1006
1037
  * }
@@ -1013,6 +1044,7 @@ MRB_API mrb_value mrb_get_arg1(mrb_state *mrb);
1013
1044
  * @return [mrb_value] mruby function value.
1014
1045
  */
1015
1046
  MRB_API mrb_value mrb_funcall(mrb_state *mrb, mrb_value val, const char *name, mrb_int argc, ...);
1047
+ MRB_API mrb_value mrb_funcall_id(mrb_state *mrb, mrb_value val, mrb_sym mid, mrb_int argc, ...);
1016
1048
  /**
1017
1049
  * Call existing ruby functions. This is basically the type safe version of mrb_funcall.
1018
1050
  *
@@ -1022,15 +1054,14 @@ MRB_API mrb_value mrb_funcall(mrb_state *mrb, mrb_value val, const char *name, m
1022
1054
  * int
1023
1055
  * main()
1024
1056
  * {
1025
- * mrb_int i = 99;
1026
1057
  * mrb_state *mrb = mrb_open();
1058
+ * mrb_value obj = mrb_fixnum_value(1);
1027
1059
  *
1028
1060
  * if (!mrb) { }
1029
- * mrb_sym m_sym = mrb_intern_lit(mrb, "method_name"); // Symbol for method.
1030
1061
  *
1031
1062
  * FILE *fp = fopen("test.rb","r");
1032
1063
  * mrb_value obj = mrb_load_file(mrb,fp);
1033
- * mrb_funcall_argv(mrb, obj, m_sym, 1, &obj); // Calling ruby function from test.rb.
1064
+ * mrb_funcall_argv(mrb, obj, MRB_SYM(method_name), 1, &obj); // Calling ruby function from test.rb.
1034
1065
  * fclose(fp);
1035
1066
  * mrb_close(mrb);
1036
1067
  * }
@@ -1048,7 +1079,8 @@ MRB_API mrb_value mrb_funcall_argv(mrb_state *mrb, mrb_value val, mrb_sym name,
1048
1079
  */
1049
1080
  MRB_API mrb_value mrb_funcall_with_block(mrb_state *mrb, mrb_value val, mrb_sym name, mrb_int argc, const mrb_value *argv, mrb_value block);
1050
1081
  /**
1051
- * Create a symbol
1082
+ * Create a symbol from C string. But usually it's better to use MRB_SYM,
1083
+ * MRB_OPSYM, MRB_CVSYM, MRB_IVSYM, MRB_SYM_B, MRB_SYM_Q, MRB_SYM_E macros.
1052
1084
  *
1053
1085
  * Example:
1054
1086
  *
@@ -1056,7 +1088,9 @@ MRB_API mrb_value mrb_funcall_with_block(mrb_state *mrb, mrb_value val, mrb_sym
1056
1088
  * :pizza # => :pizza
1057
1089
  *
1058
1090
  * // C style:
1059
- * mrb_sym m_sym = mrb_intern_lit(mrb, "pizza"); // => :pizza
1091
+ * mrb_sym sym1 = mrb_intern_lit(mrb, "pizza"); // => :pizza
1092
+ * mrb_sym sym2 = MRB_SYM(pizza); // => :pizza
1093
+ * mrb_sym sym3 = MRB_SYM_Q(pizza); // => :pizza?
1060
1094
  *
1061
1095
  * @param mrb The current mruby state.
1062
1096
  * @param str The string to be symbolized
@@ -1065,8 +1099,14 @@ MRB_API mrb_value mrb_funcall_with_block(mrb_state *mrb, mrb_value val, mrb_sym
1065
1099
  MRB_API mrb_sym mrb_intern_cstr(mrb_state *mrb, const char* str);
1066
1100
  MRB_API mrb_sym mrb_intern(mrb_state*,const char*,size_t);
1067
1101
  MRB_API mrb_sym mrb_intern_static(mrb_state*,const char*,size_t);
1068
- #define mrb_intern_lit(mrb, lit) mrb_intern_static(mrb, lit, mrb_strlen_lit(lit))
1102
+ #define mrb_intern_lit(mrb, lit) mrb_intern_static(mrb, (lit ""), mrb_strlen_lit(lit))
1069
1103
  MRB_API mrb_sym mrb_intern_str(mrb_state*,mrb_value);
1104
+ /* mrb_intern_check series functions returns 0 if the symbol is not defined */
1105
+ MRB_API mrb_sym mrb_intern_check_cstr(mrb_state*,const char*);
1106
+ MRB_API mrb_sym mrb_intern_check(mrb_state*,const char*,size_t);
1107
+ MRB_API mrb_sym mrb_intern_check_str(mrb_state*,mrb_value);
1108
+ /* mrb_check_intern series functions returns nil if the symbol is not defined */
1109
+ /* otherwise returns mrb_value */
1070
1110
  MRB_API mrb_value mrb_check_intern_cstr(mrb_state*,const char*);
1071
1111
  MRB_API mrb_value mrb_check_intern(mrb_state*,const char*,size_t);
1072
1112
  MRB_API mrb_value mrb_check_intern_str(mrb_state*,mrb_value);
@@ -1164,9 +1204,9 @@ MRB_API void mrb_close(mrb_state *mrb);
1164
1204
  MRB_API void* mrb_default_allocf(mrb_state*, void*, size_t, void*);
1165
1205
 
1166
1206
  MRB_API mrb_value mrb_top_self(mrb_state *mrb);
1167
- MRB_API mrb_value mrb_top_run(mrb_state *mrb, struct RProc *proc, mrb_value self, unsigned int stack_keep);
1168
- MRB_API mrb_value mrb_vm_run(mrb_state *mrb, struct RProc *proc, mrb_value self, unsigned int stack_keep);
1169
- MRB_API mrb_value mrb_vm_exec(mrb_state *mrb, struct RProc *proc, const mrb_code *iseq);
1207
+ MRB_API mrb_value mrb_top_run(mrb_state *mrb, const struct RProc *proc, mrb_value self, mrb_int stack_keep);
1208
+ MRB_API mrb_value mrb_vm_run(mrb_state *mrb, const struct RProc *proc, mrb_value self, mrb_int stack_keep);
1209
+ MRB_API mrb_value mrb_vm_exec(mrb_state *mrb, const struct RProc *proc, const mrb_code *iseq);
1170
1210
  /* compatibility macros */
1171
1211
  #define mrb_toplevel_run_keep(m,p,k) mrb_top_run((m),(p),mrb_top_self(m),(k))
1172
1212
  #define mrb_toplevel_run(m,p) mrb_toplevel_run_keep((m),(p),0)
@@ -1181,7 +1221,7 @@ MRB_API mrb_bool mrb_obj_equal(mrb_state *mrb, mrb_value a, mrb_value b);
1181
1221
  MRB_API mrb_bool mrb_equal(mrb_state *mrb, mrb_value obj1, mrb_value obj2);
1182
1222
  MRB_API mrb_value mrb_convert_to_integer(mrb_state *mrb, mrb_value val, mrb_int base);
1183
1223
  MRB_API mrb_value mrb_Integer(mrb_state *mrb, mrb_value val);
1184
- #ifndef MRB_WITHOUT_FLOAT
1224
+ #ifndef MRB_NO_FLOAT
1185
1225
  MRB_API mrb_value mrb_Float(mrb_state *mrb, mrb_value val);
1186
1226
  #endif
1187
1227
  MRB_API mrb_value mrb_inspect(mrb_state *mrb, mrb_value obj);
@@ -1214,12 +1254,15 @@ MRB_API void mrb_field_write_barrier(mrb_state *, struct RBasic*, struct RBasic*
1214
1254
  } while (0)
1215
1255
  MRB_API void mrb_write_barrier(mrb_state *, struct RBasic*);
1216
1256
 
1217
- MRB_API mrb_value mrb_check_convert_type(mrb_state *mrb, mrb_value val, enum mrb_vtype type, const char *tname, const char *method);
1257
+ MRB_API mrb_value mrb_type_convert(mrb_state *mrb, mrb_value val, enum mrb_vtype type, mrb_sym method);
1258
+ #define mrb_convert_type(mrb, val, type, tname, method) mrb_type_convert(mrb, val, type, mrb_intern_lit(mrb, method))
1259
+ MRB_API mrb_value mrb_type_convert_check(mrb_state *mrb, mrb_value val, enum mrb_vtype type, mrb_sym method);
1260
+ #define mrb_check_convert_type(mrb, val, type, tname, method) mrb_type_convert_check(mrb, val, type, mrb_intern_lit(mrb, method))
1261
+
1218
1262
  MRB_API mrb_value mrb_any_to_s(mrb_state *mrb, mrb_value obj);
1219
1263
  MRB_API const char * mrb_obj_classname(mrb_state *mrb, mrb_value obj);
1220
1264
  MRB_API struct RClass* mrb_obj_class(mrb_state *mrb, mrb_value obj);
1221
1265
  MRB_API mrb_value mrb_class_path(mrb_state *mrb, struct RClass *c);
1222
- MRB_API mrb_value mrb_convert_type(mrb_state *mrb, mrb_value val, enum mrb_vtype type, const char *tname, const char *method);
1223
1266
  MRB_API mrb_bool mrb_obj_is_kind_of(mrb_state *mrb, mrb_value obj, struct RClass *c);
1224
1267
  MRB_API mrb_value mrb_obj_inspect(mrb_state *mrb, mrb_value self);
1225
1268
  MRB_API mrb_value mrb_obj_clone(mrb_state *mrb, mrb_value self);
@@ -1260,26 +1303,26 @@ MRB_API mrb_value mrb_vformat(mrb_state *mrb, const char *format, va_list ap);
1260
1303
  + those E_* macros requires mrb_state* variable named mrb.
1261
1304
  + exception objects obtained from those macros are local to mrb
1262
1305
  */
1263
- #define E_RUNTIME_ERROR (mrb_exc_get(mrb, "RuntimeError"))
1264
- #define E_TYPE_ERROR (mrb_exc_get(mrb, "TypeError"))
1265
- #define E_ARGUMENT_ERROR (mrb_exc_get(mrb, "ArgumentError"))
1266
- #define E_INDEX_ERROR (mrb_exc_get(mrb, "IndexError"))
1267
- #define E_RANGE_ERROR (mrb_exc_get(mrb, "RangeError"))
1268
- #define E_NAME_ERROR (mrb_exc_get(mrb, "NameError"))
1269
- #define E_NOMETHOD_ERROR (mrb_exc_get(mrb, "NoMethodError"))
1270
- #define E_SCRIPT_ERROR (mrb_exc_get(mrb, "ScriptError"))
1271
- #define E_SYNTAX_ERROR (mrb_exc_get(mrb, "SyntaxError"))
1272
- #define E_LOCALJUMP_ERROR (mrb_exc_get(mrb, "LocalJumpError"))
1273
- #define E_REGEXP_ERROR (mrb_exc_get(mrb, "RegexpError"))
1274
- #define E_FROZEN_ERROR (mrb_exc_get(mrb, "FrozenError"))
1275
-
1276
- #define E_NOTIMP_ERROR (mrb_exc_get(mrb, "NotImplementedError"))
1277
- #ifndef MRB_WITHOUT_FLOAT
1278
- #define E_FLOATDOMAIN_ERROR (mrb_exc_get(mrb, "FloatDomainError"))
1306
+ #define MRB_ERROR_SYM(sym) mrb_intern_lit(mrb, #sym)
1307
+ #define E_RUNTIME_ERROR mrb_exc_get_id(mrb, MRB_ERROR_SYM(RuntimeError))
1308
+ #define E_TYPE_ERROR mrb_exc_get_id(mrb, MRB_ERROR_SYM(TypeError))
1309
+ #define E_ZERODIV_ERROR mrb_exc_get_id(mrb, MRB_ERROR_SYM(ZeroDivisionError))
1310
+ #define E_ARGUMENT_ERROR mrb_exc_get_id(mrb, MRB_ERROR_SYM(ArgumentError))
1311
+ #define E_INDEX_ERROR mrb_exc_get_id(mrb, MRB_ERROR_SYM(IndexError))
1312
+ #define E_RANGE_ERROR mrb_exc_get_id(mrb, MRB_ERROR_SYM(RangeError))
1313
+ #define E_NAME_ERROR mrb_exc_get_id(mrb, MRB_ERROR_SYM(NameError))
1314
+ #define E_NOMETHOD_ERROR mrb_exc_get_id(mrb, MRB_ERROR_SYM(NoMethodError))
1315
+ #define E_SCRIPT_ERROR mrb_exc_get_id(mrb, MRB_ERROR_SYM(ScriptError))
1316
+ #define E_SYNTAX_ERROR mrb_exc_get_id(mrb, MRB_ERROR_SYM(SyntaxError))
1317
+ #define E_LOCALJUMP_ERROR mrb_exc_get_id(mrb, MRB_ERROR_SYM(LocalJumpError))
1318
+ #define E_REGEXP_ERROR mrb_exc_get_id(mrb, MRB_ERROR_SYM(RegexpError))
1319
+ #define E_FROZEN_ERROR mrb_exc_get_id(mrb, MRB_ERROR_SYM(FrozenError))
1320
+ #define E_NOTIMP_ERROR mrb_exc_get_id(mrb, MRB_ERROR_SYM(NotImplementedError))
1321
+ #define E_KEY_ERROR mrb_exc_get_id(mrb, MRB_ERROR_SYM(KeyError))
1322
+ #ifndef MRB_NO_FLOAT
1323
+ # define E_FLOATDOMAIN_ERROR mrb_exc_get_id(mrb, MRB_ERROR_SYM(FloatDomainError))
1279
1324
  #endif
1280
1325
 
1281
- #define E_KEY_ERROR (mrb_exc_get(mrb, "KeyError"))
1282
-
1283
1326
  MRB_API mrb_value mrb_yield(mrb_state *mrb, mrb_value b, mrb_value arg);
1284
1327
  MRB_API mrb_value mrb_yield_argv(mrb_state *mrb, mrb_value b, mrb_int argc, const mrb_value *argv);
1285
1328
  MRB_API mrb_value mrb_yield_with_class(mrb_state *mrb, mrb_value b, mrb_int argc, const mrb_value *argv, mrb_value self, struct RClass *c);
@@ -1297,7 +1340,7 @@ MRB_API void mrb_gc_register(mrb_state *mrb, mrb_value obj);
1297
1340
  MRB_API void mrb_gc_unregister(mrb_state *mrb, mrb_value obj);
1298
1341
 
1299
1342
  MRB_API mrb_value mrb_to_int(mrb_state *mrb, mrb_value val);
1300
- #define mrb_int(mrb, val) mrb_fixnum(mrb_to_int(mrb, val))
1343
+ #define mrb_int(mrb, val) mrb_integer(mrb_to_int(mrb, val))
1301
1344
  /* string type checking (contrary to the name, it doesn't convert) */
1302
1345
  MRB_API mrb_value mrb_to_str(mrb_state *mrb, mrb_value val);
1303
1346
  MRB_API void mrb_check_type(mrb_state *mrb, mrb_value x, enum mrb_vtype t);
@@ -1307,14 +1350,8 @@ MRB_INLINE void mrb_check_frozen(mrb_state *mrb, void *o)
1307
1350
  if (mrb_frozen_p((struct RBasic*)o)) mrb_frozen_error(mrb, o);
1308
1351
  }
1309
1352
 
1310
- typedef enum call_type {
1311
- CALL_PUBLIC,
1312
- CALL_FCALL,
1313
- CALL_VCALL,
1314
- CALL_TYPE_MAX
1315
- } call_type;
1316
-
1317
1353
  MRB_API void mrb_define_alias(mrb_state *mrb, struct RClass *c, const char *a, const char *b);
1354
+ MRB_API void mrb_define_alias_id(mrb_state *mrb, struct RClass *c, mrb_sym a, mrb_sym b);
1318
1355
  MRB_API const char *mrb_class_name(mrb_state *mrb, struct RClass* klass);
1319
1356
  MRB_API void mrb_define_global_const(mrb_state *mrb, const char *name, mrb_value val);
1320
1357
 
@@ -1351,7 +1388,7 @@ MRB_API mrb_value mrb_fiber_alive_p(mrb_state *mrb, mrb_value fib);
1351
1388
  *
1352
1389
  * Implemented in mruby-fiber
1353
1390
  */
1354
- #define E_FIBER_ERROR (mrb_exc_get(mrb, "FiberError"))
1391
+ #define E_FIBER_ERROR mrb_exc_get_id(mrb, MRB_ERROR_SYM(FiberError))
1355
1392
  MRB_API void mrb_stack_extend(mrb_state*, mrb_int);
1356
1393
 
1357
1394
  /* memory pool implementation */
@@ -1371,6 +1408,10 @@ MRB_API void mrb_show_copyright(mrb_state *mrb);
1371
1408
 
1372
1409
  MRB_API mrb_value mrb_format(mrb_state *mrb, const char *format, ...);
1373
1410
 
1411
+ #ifdef MRB_PRESYM_SCANNING
1412
+ # include <mruby/presym/scanning.h>
1413
+ #endif
1414
+
1374
1415
  #if 0
1375
1416
  /* memcpy and memset does not work with gdb reverse-next on my box */
1376
1417
  /* use naive memcpy and memset instead */