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
@@ -0,0 +1,73 @@
1
+ # Cross Compiling configuration for the Nintendo GameBoyAdvance.
2
+ # This configuration requires devkitARM
3
+ # https://devkitpro.org/wiki/Getting_Started/devkitARM
4
+ #
5
+ # Tested only on GNU/Linux
6
+ #
7
+ MRuby::CrossBuild.new("gameboyadvance") do |conf|
8
+ toolchain :gcc
9
+
10
+ DEVKITPRO_PATH = "/opt/devkitpro"
11
+ BIN_PATH = "#{DEVKITPRO_PATH}/devkitARM/bin"
12
+
13
+ # C compiler
14
+ conf.cc do |cc|
15
+ cc.command = "#{BIN_PATH}/arm-none-eabi-gcc"
16
+ cc.flags << ["-mthumb-interwork", "-mthumb", "-O2"]
17
+ cc.compile_options = %(%{flags} -o "%{outfile}" -c "%{infile}")
18
+ end
19
+
20
+ # C++ compiler
21
+ conf.cxx do |cxx|
22
+ cxx.command = "#{BIN_PATH}/arm-none-eabi-g++"
23
+ cxx.include_paths = conf.cc.include_paths.dup
24
+ cxx.flags = conf.cc.flags.dup
25
+ cxx.flags << %w[-fno-rtti -fno-exceptions]
26
+ cxx.defines = conf.cc.defines.dup
27
+ cxx.compile_options = conf.cc.compile_options.dup
28
+ end
29
+
30
+ # Linker
31
+ conf.linker do |linker|
32
+ linker.command = "#{BIN_PATH}/arm-none-eabi-gcc"
33
+ linker.flags << ["-mthumb-interwork", "-mthumb", "-specs=gba.specs"]
34
+ end
35
+
36
+ # No executables
37
+ conf.bins = []
38
+
39
+ # Do not build executable test
40
+ conf.build_mrbtest_lib_only
41
+
42
+ # Disable C++ exception
43
+ conf.disable_cxx_exception
44
+
45
+ # Gems from core
46
+ # removing mruby-io
47
+ conf.gem core: "mruby-metaprog"
48
+ conf.gem core: "mruby-pack"
49
+ conf.gem core: "mruby-sprintf"
50
+ conf.gem core: "mruby-print"
51
+ conf.gem core: "mruby-math"
52
+ conf.gem core: "mruby-time"
53
+ conf.gem core: "mruby-struct"
54
+ conf.gem core: "mruby-compar-ext"
55
+ conf.gem core: "mruby-enum-ext"
56
+ conf.gem core: "mruby-string-ext"
57
+ conf.gem core: "mruby-numeric-ext"
58
+ conf.gem core: "mruby-array-ext"
59
+ conf.gem core: "mruby-hash-ext"
60
+ conf.gem core: "mruby-range-ext"
61
+ conf.gem core: "mruby-proc-ext"
62
+ conf.gem core: "mruby-symbol-ext"
63
+ conf.gem core: "mruby-random"
64
+ conf.gem core: "mruby-object-ext"
65
+ conf.gem core: "mruby-objectspace"
66
+ conf.gem core: "mruby-fiber"
67
+ conf.gem core: "mruby-enumerator"
68
+ conf.gem core: "mruby-enum-lazy"
69
+ conf.gem core: "mruby-toplevel-ext"
70
+ conf.gem core: "mruby-kernel-ext"
71
+ conf.gem core: "mruby-class-ext"
72
+ conf.gem core: "mruby-compiler"
73
+ end
@@ -0,0 +1,12 @@
1
+ MRuby::Build.new do |conf|
2
+ conf.toolchain
3
+
4
+ # include the default GEMs
5
+ conf.gembox 'default'
6
+
7
+ # C compiler settings
8
+ conf.cc.defines = %w(MRB_USE_DEBUG_HOOK)
9
+ conf.enable_debug
10
+ conf.enable_cxx_abi
11
+ conf.enable_test
12
+ end
@@ -0,0 +1,20 @@
1
+ MRuby::Build.new('host') do |conf|
2
+ # load specific toolchain settings
3
+ conf.toolchain
4
+
5
+ conf.enable_debug
6
+
7
+ # include the default GEMs
8
+ conf.gembox 'full-core'
9
+
10
+ # C compiler settings
11
+ conf.cc.defines = %w(MRB_USE_DEBUG_HOOK MRB_NO_BOXING)
12
+
13
+ # Generate mruby debugger command (require mruby-eval)
14
+ conf.gem :core => "mruby-bin-debugger"
15
+
16
+ # test
17
+ conf.enable_test
18
+ # bintest
19
+ conf.enable_bintest
20
+ end
@@ -0,0 +1,14 @@
1
+ MRuby::Build.new do |conf|
2
+ # load specific toolchain settings
3
+ toolchain :gcc
4
+
5
+ # include the GEM box
6
+ conf.gembox 'default'
7
+
8
+ conf.cc.flags << '-pg'
9
+ conf.linker.flags << '-pg'
10
+
11
+ # Turn on `enable_debug` for better debugging
12
+ conf.enable_debug
13
+ conf.enable_test
14
+ end
@@ -0,0 +1,15 @@
1
+ MRuby::Build.new do |conf|
2
+ # load specific toolchain settings
3
+ toolchain :gcc
4
+
5
+ # include the GEM box
6
+ conf.gembox 'default'
7
+
8
+ conf.cc.flags << '-m32'
9
+ conf.linker.flags << '-m32'
10
+
11
+ # Turn on `enable_debug` for better debugging
12
+ conf.enable_debug
13
+ conf.enable_test
14
+ conf.enable_bintest
15
+ end
@@ -0,0 +1,36 @@
1
+ MRuby::Build.new do |conf|
2
+ # load specific toolchain settings
3
+
4
+ # Gets set by the VS command prompts.
5
+ if ENV['VisualStudioVersion'] || ENV['VSINSTALLDIR']
6
+ toolchain :visualcpp
7
+ else
8
+ toolchain :gcc
9
+ end
10
+
11
+ # include the GEM box
12
+ conf.gembox 'default'
13
+
14
+ # C compiler settings
15
+ conf.cc do |cc|
16
+ cc.flags = '-fPIC'
17
+ end
18
+
19
+ conf.archiver do |archiver|
20
+ archiver.command = 'gcc'
21
+ archiver.archive_options = '-shared -o %{outfile} %{objs}'
22
+ end
23
+
24
+ # file extensions
25
+ conf.exts do |exts|
26
+ exts.library = '.so'
27
+ end
28
+
29
+ # file separator
30
+ # conf.file_separator = '/'
31
+
32
+ # Turn on `enable_debug` for better debugging
33
+ conf.enable_debug
34
+ conf.enable_bintest
35
+ conf.enable_test
36
+ end
@@ -0,0 +1,11 @@
1
+ MRuby::Build.new do |conf|
2
+ if ENV['VisualStudioVersion'] || ENV['VSINSTALLDIR']
3
+ conf.toolchain :visualcpp
4
+ else
5
+ conf.toolchain :gcc
6
+ end
7
+
8
+ conf.build_mrbc_exec
9
+ conf.disable_libmruby
10
+ conf.disable_presym
11
+ end
@@ -0,0 +1,17 @@
1
+ # Define cross build settings
2
+ MRuby::CrossBuild.new('no-float') do |conf|
3
+ conf.toolchain
4
+
5
+ # Add configuration
6
+ conf.compilers.each do |c|
7
+ c.defines << "MRB_NO_FLOAT"
8
+ end
9
+
10
+ conf.gem :core => "mruby-bin-mruby"
11
+
12
+ conf.test_runner.command = 'env'
13
+
14
+ conf.enable_debug
15
+ # conf.enable_bintest
16
+ conf.enable_test
17
+ end
@@ -6,45 +6,53 @@ binaries.
6
6
  ## Prerequisites
7
7
 
8
8
  To compile mruby out of the source code you need the following tools:
9
+
9
10
  * C Compiler (e.g. `gcc` or `clang`)
10
11
  * Linker (e.g. `gcc` or `clang`)
11
12
  * Archive utility (e.g. `ar`)
12
- * Parser generator (e.g. `bison`)
13
+ * Parser generator (`bison`)
13
14
  * Ruby 2.0 or later (e.g. `ruby` or `jruby`)
14
15
 
15
16
  Note that `bison` bundled with MacOS is too old to compile `mruby`.
16
- Try `brew install bison` and follow the instuction shown to update
17
- the `$PATH` to compile `mruby`.
17
+ Try `brew install bison` and follow the instruction shown to update
18
+ the `$PATH` to compile `mruby`. We also encourage to upgrade `ruby`
19
+ on MacOS in similar manner.
18
20
 
19
21
  Optional:
20
- * GIT (to update mruby source and integrate mrbgems easier)
22
+
23
+ * git (to update mruby source and integrate mrbgems easier)
21
24
  * C++ compiler (to use GEMs which include \*.cpp, \*.cxx, \*.cc)
22
- * Assembler (to use GEMs which include \*.asm)
23
25
 
24
- ## Usage
26
+ ## Build
27
+
28
+ To compile `mruby` with the default build configuration, just invoke `rake`
29
+ inside of the mruby source root. To generate and execute the test tools call
30
+ `rake test`. To clean all build files call `rake clean`. To see full command
31
+ line on build, call `rake -v`.
32
+
33
+ You can specify your own configuration file by the `MRUBY_CONFIG` environment
34
+ variable (you can use `CONFIG` for shorthand for `MRUBY_CONFIG`). If the path
35
+ doesn't exist, *build_config/${MRUBY_CONFIG}.rb* is used. The default
36
+ configuration is defined in the `build_config/default.rb` file.
37
+
38
+ Those build configuration files contain the build configuration of mruby, for
39
+ example:
25
40
 
26
- Inside of the root directory of the mruby source a file exists
27
- called *build_config.rb*. This file contains the build configuration
28
- of mruby and looks like this for example:
29
41
  ```ruby
30
42
  MRuby::Build.new do |conf|
31
- toolchain :gcc
43
+ conf.toolchain :gcc
32
44
  end
33
45
  ```
34
46
 
35
- All tools necessary to compile mruby can be set or modified here. In case
36
- you want to maintain an additional *build_config.rb* you can define a
37
- customized path using the *$MRUBY_CONFIG* environment variable.
38
-
39
- To compile just call `rake` inside of the mruby source root. To
40
- generate and execute the test tools call `rake test`. To clean
41
- all build files call `rake clean`. To see full command line on
42
- build, call `rake -v`.
47
+ All tools necessary to compile mruby can be set or modified here.
43
48
 
44
49
  ## Build Configuration
45
50
 
46
- Inside of the *build_config.rb* the following options can be configured
47
- based on your environment.
51
+ We wish you submit a pull-request to *build_config/**PLATFORM**.rb*, once you
52
+ created a new configuration for a new platform.
53
+
54
+ Inside of the configuration file, the following options can be
55
+ configured based on your environment.
48
56
 
49
57
  ### Toolchains
50
58
 
@@ -54,32 +62,36 @@ configure the build environment for specific compiler infrastructures.
54
62
  #### GCC
55
63
 
56
64
  Toolchain configuration for the GNU C Compiler.
65
+
57
66
  ```ruby
58
- toolchain :gcc
67
+ conf.toolchain :gcc
59
68
  ```
60
69
 
61
70
  #### clang
62
71
 
63
72
  Toolchain configuration for the LLVM C Compiler clang. Mainly equal to the
64
73
  GCC toolchain.
74
+
65
75
  ```ruby
66
- toolchain :clang
76
+ conf.toolchain :clang
67
77
  ```
68
78
 
69
79
  #### Visual Studio 2010, 2012 and 2013
70
80
 
71
81
  Toolchain configuration for Visual Studio on Windows. If you use the
72
- [Visual Studio Command Prompt](http://msdn.microsoft.com/en-us/library/ms229859\(v=vs.110\).aspx),
82
+ [Visual Studio Command Prompt](https://msdn.microsoft.com/en-us/library/ms229859\(v=vs.110\).aspx),
73
83
  you normally do not have to specify this manually, since it gets automatically detected by our build process.
84
+
74
85
  ```ruby
75
- toolchain :visualcpp
86
+ conf.toolchain :visualcpp
76
87
  ```
77
88
 
78
89
  #### Android
79
90
 
80
91
  Toolchain configuration for Android.
92
+
81
93
  ```ruby
82
- toolchain :android
94
+ conf.toolchain :android
83
95
  ```
84
96
 
85
97
  Requires the custom standalone Android NDK and the toolchain path
@@ -88,20 +100,18 @@ in `ANDROID_STANDALONE_TOOLCHAIN`.
88
100
  ### Binaries
89
101
 
90
102
  It is possible to select which tools should be compiled during the compilation
91
- process. The following tools can be selected:
92
- * mruby (mruby interpreter)
93
- * mirb (mruby interactive shell)
103
+ process. For example,
94
104
 
95
- To select them declare conf.gem as follows:
96
- ```ruby
97
- conf.gem "#{root}/mrbgems/mruby-bin-mruby"
98
- conf.gem "#{root}/mrbgems/mruby-bin-mirb"
99
- ```
105
+ * `mruby`
106
+ * `mirb`
107
+
108
+ The configuration are done via `mrbgems`. See `Mrbgems` section.
100
109
 
101
110
  ### File Separator
102
111
 
103
112
  Some environments require a different file separator character. It is possible to
104
113
  set the character via `conf.file_separator`.
114
+
105
115
  ```ruby
106
116
  conf.file_separator = '/'
107
117
  ```
@@ -109,6 +119,7 @@ conf.file_separator = '/'
109
119
  ### C Compiler
110
120
 
111
121
  Configuration of the C compiler binary, flags and include paths.
122
+
112
123
  ```ruby
113
124
  conf.cc do |cc|
114
125
  cc.command = ...
@@ -124,6 +135,7 @@ end
124
135
  C Compiler has header searcher to detect installed library.
125
136
 
126
137
  If you need a include path of header file use `search_header_path`:
138
+
127
139
  ```ruby
128
140
  # Searches ```iconv.h```.
129
141
  # If found it will return include path of the header file.
@@ -132,6 +144,7 @@ fail 'iconv.h not found' unless conf.cc.search_header_path 'iconv.h'
132
144
  ```
133
145
 
134
146
  If you need a full file name of header file use `search_header`:
147
+
135
148
  ```ruby
136
149
  # Searches ```iconv.h```.
137
150
  # If found it will return full path of the header file.
@@ -145,6 +158,7 @@ When you are using GCC toolchain (including clang toolchain since its base is gc
145
158
  it will use compiler specific include paths too. (For example `/usr/local/include`, `/usr/include`)
146
159
 
147
160
  If you need a special header search paths define a singleton method `header_search_paths` to C compiler:
161
+
148
162
  ```ruby
149
163
  def conf.cc.header_search_paths
150
164
  ['/opt/local/include'] + include_paths
@@ -154,6 +168,7 @@ end
154
168
  ### Linker
155
169
 
156
170
  Configuration of the Linker binary, flags and library paths.
171
+
157
172
  ```ruby
158
173
  conf.linker do |linker|
159
174
  linker.command = ...
@@ -171,6 +186,7 @@ end
171
186
  ### Archiver
172
187
 
173
188
  Configuration of the Archiver binary and flags.
189
+
174
190
  ```ruby
175
191
  conf.archiver do |archiver|
176
192
  archiver.command = ...
@@ -181,6 +197,7 @@ end
181
197
  ### Parser Generator
182
198
 
183
199
  Configuration of the Parser Generator binary and flags.
200
+
184
201
  ```ruby
185
202
  conf.yacc do |yacc|
186
203
  yacc.command = ...
@@ -191,6 +208,7 @@ end
191
208
  ### GPerf
192
209
 
193
210
  Configuration of the GPerf binary and flags.
211
+
194
212
  ```ruby
195
213
  conf.gperf do |gperf|
196
214
  gperf.command = ...
@@ -199,6 +217,7 @@ end
199
217
  ```
200
218
 
201
219
  ### File Extensions
220
+
202
221
  ```ruby
203
222
  conf.exts do |exts|
204
223
  exts.object = ...
@@ -207,19 +226,44 @@ conf.exts do |exts|
207
226
  end
208
227
  ```
209
228
 
229
+ ### Preallocated Symbols
230
+
231
+ By far, preallocate symbols are highly compatible with the previous versions, so
232
+ we expect you won't see any problem with them. But just in case you face any
233
+ issue, you can disable preallocated symbols by specifying `conf.disable_presym`.
234
+
235
+ In the build process, `mrbc` under cross compiling environment will be compiled
236
+ with this configuration.
237
+
210
238
  ### Mrbgems
211
239
 
212
- Integrate GEMs in the build process.
240
+ `mruby` comes with the (sort of) packaging system named `mrbgems`. To
241
+ specify `gem`, you can use `conf.gem` in the configuration file.
242
+
213
243
  ```ruby
214
- # Integrate GEM with additional configuration
215
- conf.gem 'path/to/gem' do |g|
216
- g.cc.flags << ...
217
- end
244
+ # Integrate a bundled Gem you see in `mrbgems` directory
245
+ conf.gem :core => 'mruby-something'
246
+
247
+ # Integrate a Gem from GitHub
248
+ conf.gem :github => 'someone/mruby-another'
218
249
 
219
- # Integrate GEM without additional configuration
220
- conf.gem 'path/to/another/gem'
250
+ # Integrate a mruby binary Gem
251
+ conf.gem :core => 'mruby-bin-mruby'
252
+
253
+ # Integrate a interactive mruby binary Gem
254
+ conf.gem :core => 'mruby-bin-mirb'
255
+
256
+ # Integrate GemBox (set of Gems)
257
+ conf.gembox "default"
221
258
  ```
222
259
 
260
+ A GemBox is a set of Gems defined in `mrbgems/default.gembox` for example.
261
+ It's just a set of `mrbgem` configurations.
262
+
263
+ There is a `RubyGem` (gem for CRuby) named `mgem` that help you to
264
+ manage `mrbgems`. Try `gem install mgem`. `mgem` can show you the list
265
+ of registered `mrbgems`.
266
+
223
267
  See doc/mrbgems/README.md for more option about mrbgems.
224
268
 
225
269
  ### Mrbtest
@@ -227,6 +271,7 @@ See doc/mrbgems/README.md for more option about mrbgems.
227
271
  Configuration Mrbtest build process.
228
272
 
229
273
  If you want mrbtest.a only, You should set `conf.build_mrbtest_lib_only`
274
+
230
275
  ```ruby
231
276
  conf.build_mrbtest_lib_only
232
277
  ```
@@ -239,6 +284,7 @@ See `mruby-bin-*/bintest/*.rb` if you need examples.
239
284
  If you want a temporary files use `tempfile` module of CRuby instead of `/tmp/`.
240
285
 
241
286
  You can enable it with following:
287
+
242
288
  ```ruby
243
289
  conf.enable_bintest
244
290
  ```
@@ -257,6 +303,7 @@ files are compiled by C++ compiler.
257
303
 
258
304
  When you mix C++ code, C++ exception would be enabled automatically.
259
305
  If you need to enable C++ exception explicitly add the following:
306
+
260
307
  ```ruby
261
308
  conf.enable_cxx_exception
262
309
  ```
@@ -266,20 +313,24 @@ conf.enable_cxx_exception
266
313
  If your compiler does not support C++ and you want to ensure
267
314
  you don't use mrbgem written in C++, you can explicitly disable
268
315
  C++ exception, add following:
316
+
269
317
  ```ruby
270
318
  conf.disable_cxx_exception
271
319
  ```
320
+
272
321
  and you will get an error when you try to use C++ gem.
273
322
  Note that it must be called before `enable_cxx_exception` or `gem` method.
274
323
 
275
324
  ### Debugging mode
276
325
 
277
326
  To enable debugging mode add the following:
327
+
278
328
  ```ruby
279
329
  conf.enable_debug
280
330
  ```
281
331
 
282
332
  When debugging mode is enabled
333
+
283
334
  * Macro `MRB_DEBUG` would be defined.
284
335
  * Which means `mrb_assert()` macro is enabled.
285
336
  * Debug information of irep would be generated by `mrbc`.
@@ -288,27 +339,29 @@ When debugging mode is enabled
288
339
 
289
340
  ## Cross-Compilation
290
341
 
291
- mruby can also be cross-compiled from one platform to another. To
292
- achieve this the *build_config.rb* needs to contain an instance of
293
- `MRuby::CrossBuild`. This instance defines the compilation
294
- tools and flags for the target platform. An example could look
295
- like this:
342
+ mruby can also be cross-compiled from one platform to another. To achieve
343
+ cross-compilation, the build configuration needs to contain an instance of
344
+ `MRuby::CrossBuild`. This instance defines the compilation tools and flags
345
+ for the target platform. An example could look like this:
346
+
296
347
  ```ruby
297
348
  MRuby::CrossBuild.new('32bit') do |conf|
298
- toolchain :gcc
349
+ conf.toolchain :gcc
299
350
 
300
351
  conf.cc.flags << "-m32"
301
352
  conf.linker.flags << "-m32"
302
353
  end
303
354
  ```
304
355
 
305
- All configuration options of `MRuby::Build` can also be used
306
- in `MRuby::CrossBuild`.
356
+ All configuration options of `MRuby::Build` can also be used in
357
+ `MRuby::CrossBuild`. You can find examples under the *build_config*
358
+ directory.
307
359
 
308
360
  ### Mrbtest in Cross-Compilation
309
361
 
310
362
  In cross compilation, you can run `mrbtest` on emulator if
311
363
  you have it by changing configuration of test runner.
364
+
312
365
  ```ruby
313
366
  conf.test_runner do |t|
314
367
  t.command = ... # set emulator. this value must be non nil or false
@@ -348,6 +401,7 @@ root directory. The structure of this directory will look like this:
348
401
  +- mruby
349
402
 
350
403
  The compilation workflow will look like this:
404
+
351
405
  * compile all files under *src* (object files will be stored
352
406
  in *build/host/src*)
353
407
  * generate parser grammar out of *src/parse.y* (generated
@@ -425,6 +479,7 @@ build directory.
425
479
  The cross compilation workflow starts in the same way as the normal
426
480
  compilation by compiling all *native* libraries and binaries.
427
481
  Afterwards the cross compilation process proceeds like this:
482
+
428
483
  * cross-compile all files under *src* (object files will be stored
429
484
  in *build/i386/src*)
430
485
  * generate parser grammar out of *src/parse.y* (generated
@@ -474,7 +529,7 @@ can't be disabled for the main build.
474
529
  MRuby::CrossBuild.new('Minimal') do |conf|
475
530
  toolchain :gcc
476
531
 
477
- conf.cc.defines = %w(MRB_DISABLE_STDIO)
532
+ conf.cc.defines = %w(MRB_NO_STDIO)
478
533
  conf.bins = []
479
534
  end
480
535
  ```
@@ -490,3 +545,37 @@ of mruby, a native binary called `mrbtest` will be generated and executed.
490
545
  This binary contains all test cases which are defined under *test/t*. In case
491
546
  of a cross-compilation an additional cross-compiled *mrbtest* binary is
492
547
  generated. You can copy this binary and run on your target system.
548
+
549
+ ## Embedding `mruby` in Your Application
550
+
551
+ After the build, you will get `libmruby.a`. You can link it to your application.
552
+
553
+ For compiler options and library path, you can use `mruby-config` command for
554
+ convenience. `mruby-config` command prints the configuration used for `libmruby.a`.
555
+
556
+ ```
557
+ $ mruby-config --help
558
+ Usage: mruby-config [switches]
559
+ switches:
560
+ --cflags print flags passed to compiler
561
+ --ldflags print flags passed to linker
562
+ --ldflags-before-libs print flags passed to linker before linked libraries
563
+ --libs print linked libraries
564
+ --libmruby-path print libmruby path
565
+ ```
566
+
567
+ For example, when you have a C source file (`c.c`) and try to
568
+ compile and link it with `libmruby.a`, you can run the following command,
569
+
570
+ ```
571
+ gcc `mruby-config --cflags` c.c `mruby-config --ldflags` `mruby-config --libs`
572
+ ```
573
+
574
+ When you use `make`, add following lines in `Makefile`
575
+
576
+ ```
577
+ MRB_CONFIG = <path-to-mruby-config>
578
+ CFLAGS = `$(MRB_CONFIG) --cflags`
579
+ LDFLAGS = `$(MRB_CONFIG) --ldflags`
580
+ LIBS = `$(MRB_CONFIG) --libs`
581
+ ```