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.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/Gemfile +2 -2
- data/ext/enterprise_script_service/Rakefile +1 -1
- data/ext/enterprise_script_service/mruby/.github/workflows/build.yml +117 -74
- data/ext/enterprise_script_service/mruby/.github/workflows/codeql-analysis.yml +41 -37
- data/ext/enterprise_script_service/mruby/.github/workflows/lint.yml +23 -0
- data/ext/enterprise_script_service/mruby/.github/workflows/oss-fuzz.yml +27 -0
- data/ext/enterprise_script_service/mruby/.github/workflows/spell-checker.yml +17 -0
- data/ext/enterprise_script_service/mruby/.gitlab-ci.yml +3 -3
- data/ext/enterprise_script_service/mruby/.markdownlint.yml +16 -0
- data/ext/enterprise_script_service/mruby/.travis.yml +2 -2
- data/ext/enterprise_script_service/mruby/.yamllint +8 -0
- data/ext/enterprise_script_service/mruby/AUTHORS +3 -0
- data/ext/enterprise_script_service/mruby/CODEOWNERS +1 -0
- data/ext/enterprise_script_service/mruby/CONTRIBUTING.md +6 -13
- data/ext/enterprise_script_service/mruby/Doxyfile +4 -4
- data/ext/enterprise_script_service/mruby/LICENSE +1 -1
- data/ext/enterprise_script_service/mruby/Makefile +1 -1
- data/ext/enterprise_script_service/mruby/README.md +4 -14
- data/ext/enterprise_script_service/mruby/Rakefile +18 -108
- data/ext/enterprise_script_service/mruby/TODO.md +17 -0
- data/ext/enterprise_script_service/mruby/appveyor.yml +31 -25
- data/ext/enterprise_script_service/mruby/benchmark/bm_ao_render.rb +1 -1
- data/ext/enterprise_script_service/mruby/build_config.rb +9 -152
- data/ext/enterprise_script_service/mruby/{examples/targets/build_config_ArduinoDue.rb → build_config/ArduinoDue.rb} +2 -19
- data/ext/enterprise_script_service/mruby/{examples/targets/build_config_IntelEdison.rb → build_config/IntelEdison.rb} +2 -2
- data/ext/enterprise_script_service/mruby/{examples/targets/build_config_IntelGalileo.rb → build_config/IntelGalileo.rb} +1 -18
- data/ext/enterprise_script_service/mruby/{examples/targets/build_config_RX630.rb → build_config/RX630.rb} +2 -19
- data/ext/enterprise_script_service/mruby/build_config/android_arm64-v8a.rb +11 -0
- data/ext/enterprise_script_service/mruby/build_config/android_armeabi.rb +11 -0
- 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
- data/ext/enterprise_script_service/mruby/build_config/bench.rb +11 -0
- data/ext/enterprise_script_service/mruby/build_config/boxing.rb +21 -0
- data/ext/enterprise_script_service/mruby/{examples/targets/build_config_chipKITMax32.rb → build_config/chipKITMax32.rb} +2 -19
- data/ext/enterprise_script_service/mruby/{travis_config.rb → build_config/ci/gcc-clang.rb} +10 -10
- data/ext/enterprise_script_service/mruby/build_config/ci/msvc.rb +20 -0
- data/ext/enterprise_script_service/mruby/build_config/clang-asan.rb +11 -0
- data/ext/enterprise_script_service/mruby/build_config/cross-32bit.rb +14 -0
- data/ext/enterprise_script_service/mruby/build_config/default.rb +80 -0
- data/ext/enterprise_script_service/mruby/{examples/targets/build_config_dreamcast_shelf.rb → build_config/dreamcast_shelf.rb} +5 -19
- data/ext/enterprise_script_service/mruby/build_config/gameboyadvance.rb +73 -0
- data/ext/enterprise_script_service/mruby/build_config/host-cxx.rb +12 -0
- data/ext/enterprise_script_service/mruby/build_config/host-debug.rb +20 -0
- data/ext/enterprise_script_service/mruby/build_config/host-gprof.rb +14 -0
- data/ext/enterprise_script_service/mruby/build_config/host-m32.rb +15 -0
- data/ext/enterprise_script_service/mruby/build_config/host-shared.rb +36 -0
- data/ext/enterprise_script_service/mruby/build_config/mrbc.rb +11 -0
- data/ext/enterprise_script_service/mruby/build_config/no-float.rb +17 -0
- data/ext/enterprise_script_service/mruby/doc/guides/compile.md +138 -49
- data/ext/enterprise_script_service/mruby/doc/guides/debugger.md +5 -4
- data/ext/enterprise_script_service/mruby/doc/guides/gc-arena-howto.md +1 -1
- data/ext/enterprise_script_service/mruby/doc/guides/mrbconf.md +49 -22
- data/ext/enterprise_script_service/mruby/doc/guides/mrbgems.md +31 -14
- data/ext/enterprise_script_service/mruby/doc/guides/symbol.md +83 -0
- data/ext/enterprise_script_service/mruby/doc/limitations.md +35 -36
- data/ext/enterprise_script_service/mruby/doc/mruby3.md +163 -0
- data/ext/enterprise_script_service/mruby/doc/opcode.md +93 -107
- data/ext/enterprise_script_service/mruby/examples/mrbgems/c_and_ruby_extension_example/mrblib/example.rb +1 -1
- data/ext/enterprise_script_service/mruby/examples/mrbgems/c_and_ruby_extension_example/src/example.c +5 -1
- data/ext/enterprise_script_service/mruby/examples/mrbgems/c_extension_example/src/example.c +5 -1
- data/ext/enterprise_script_service/mruby/examples/mrbgems/ruby_extension_example/mrblib/example.rb +1 -1
- data/ext/enterprise_script_service/mruby/include/mrbconf.h +81 -62
- data/ext/enterprise_script_service/mruby/include/mruby.h +137 -96
- data/ext/enterprise_script_service/mruby/include/mruby/array.h +23 -6
- data/ext/enterprise_script_service/mruby/include/mruby/boxing_nan.h +73 -48
- data/ext/enterprise_script_service/mruby/include/mruby/boxing_no.h +8 -8
- data/ext/enterprise_script_service/mruby/include/mruby/boxing_word.h +79 -48
- data/ext/enterprise_script_service/mruby/include/mruby/class.h +10 -8
- data/ext/enterprise_script_service/mruby/include/mruby/common.h +4 -1
- data/ext/enterprise_script_service/mruby/include/mruby/compile.h +13 -7
- data/ext/enterprise_script_service/mruby/include/mruby/debug.h +2 -2
- data/ext/enterprise_script_service/mruby/include/mruby/dump.h +17 -35
- data/ext/enterprise_script_service/mruby/include/mruby/endian.h +44 -0
- data/ext/enterprise_script_service/mruby/include/mruby/error.h +39 -5
- data/ext/enterprise_script_service/mruby/include/mruby/gc.h +1 -0
- data/ext/enterprise_script_service/mruby/include/mruby/hash.h +33 -13
- data/ext/enterprise_script_service/mruby/include/mruby/irep.h +64 -14
- data/ext/enterprise_script_service/mruby/include/mruby/khash.h +6 -14
- data/ext/enterprise_script_service/mruby/include/mruby/numeric.h +36 -63
- data/ext/enterprise_script_service/mruby/include/mruby/opcode.h +1 -27
- data/ext/enterprise_script_service/mruby/include/mruby/ops.h +27 -23
- data/ext/enterprise_script_service/mruby/include/mruby/presym.h +40 -0
- data/ext/enterprise_script_service/mruby/include/mruby/presym/disable.h +70 -0
- data/ext/enterprise_script_service/mruby/include/mruby/presym/enable.h +37 -0
- data/ext/enterprise_script_service/mruby/include/mruby/presym/scanning.h +73 -0
- data/ext/enterprise_script_service/mruby/include/mruby/proc.h +80 -13
- data/ext/enterprise_script_service/mruby/include/mruby/string.h +10 -15
- data/ext/enterprise_script_service/mruby/include/mruby/throw.h +14 -3
- data/ext/enterprise_script_service/mruby/include/mruby/value.h +29 -19
- data/ext/enterprise_script_service/mruby/include/mruby/variable.h +1 -0
- data/ext/enterprise_script_service/mruby/include/mruby/version.h +26 -7
- data/ext/enterprise_script_service/mruby/lib/mruby/build.rb +198 -44
- data/ext/enterprise_script_service/mruby/lib/mruby/build/command.rb +55 -37
- data/ext/enterprise_script_service/mruby/lib/mruby/build/load_gems.rb +12 -10
- data/ext/enterprise_script_service/mruby/lib/{mruby-core-ext.rb → mruby/core_ext.rb} +10 -3
- data/ext/enterprise_script_service/mruby/lib/mruby/gem.rb +75 -32
- data/ext/enterprise_script_service/mruby/lib/mruby/lockfile.rb +1 -1
- data/ext/enterprise_script_service/mruby/lib/mruby/presym.rb +132 -0
- data/ext/enterprise_script_service/mruby/mrbgems/default-no-fpu.gembox +3 -0
- data/ext/enterprise_script_service/mruby/mrbgems/default-no-stdio.gembox +4 -0
- data/ext/enterprise_script_service/mruby/mrbgems/default.gembox +9 -88
- data/ext/enterprise_script_service/mruby/mrbgems/full-core.gembox +1 -4
- data/ext/enterprise_script_service/mruby/mrbgems/math.gembox +10 -0
- data/ext/enterprise_script_service/mruby/mrbgems/metaprog.gembox +15 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-array-ext/mrblib/array.rb +1 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-array-ext/src/array.c +5 -4
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-config/mrbgem.rake +28 -19
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-config/mruby-config +18 -8
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/bintest/mrdb.rb +3 -6
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/bintest/print.rb +10 -10
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.c +14 -9
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/apiprint.c +3 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.c +4 -3
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.h +2 -6
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/mrdbconf.h +4 -4
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mirb/bintest/mirb.rb +23 -5
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mirb/mrbgem.rake +11 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mirb/tools/mirb/mirb.c +41 -34
- data/ext/enterprise_script_service/mruby/mrbgems/{mruby-compiler → mruby-bin-mrbc}/bintest/mrbc.rb +0 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mrbc/mrbgem.rake +3 -4
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mrbc/tools/mrbc/mrbc.c +19 -9
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mruby/bintest/mruby.rb +25 -4
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mruby/mrbgem.rake +1 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c +22 -6
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-strip/bintest/mruby-strip.rb +1 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-strip/tools/mruby-strip/mruby-strip.c +2 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-catch/mrbgem.rake +5 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-catch/mrblib/catch.rb +27 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-class-ext/src/class.c +2 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/codegen.c +430 -399
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/keywords +5 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/lex.def +49 -44
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/parse.y +559 -217
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/y.tab.c +4774 -4193
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/mrbgem.rake +18 -19
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-complex/mrblib/complex.rb +1 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-complex/src/complex.c +8 -7
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-complex/test/complex.rb +4 -4
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-enumerator/mrblib/enumerator.rb +1 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-enumerator/test/enumerator.rb +2 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-error/mrbgem.rake +2 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-eval/src/eval.c +17 -25
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-fiber/src/fiber.c +18 -13
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-hash-ext/src/hash-ext.c +30 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-hash-ext/test/hash.rb +7 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-inline-struct/test/inline.c +2 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/README.md +18 -16
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/include/mruby/ext/io.h +2 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/mrblib/file.rb +9 -4
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/mrblib/io.rb +2 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/src/file.c +55 -52
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/src/file_test.c +4 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/src/io.c +99 -87
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/test/file.rb +2 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/test/io.rb +2 -3
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/test/mruby_io_test.c +1 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-kernel-ext/src/kernel.c +7 -6
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-math/src/math.c +13 -12
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-math/test/math.rb +5 -4
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-metaprog/src/metaprog.c +43 -58
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-metaprog/test/metaprog.rb +4 -4
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-method/README.md +4 -3
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-method/src/method.c +77 -74
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-method/test/method.rb +4 -4
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-numeric-ext/src/numeric_ext.c +14 -13
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-object-ext/src/object.c +5 -4
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-objectspace/src/mruby_objectspace.c +18 -12
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-os-memsize/mrbgem.rake +10 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-os-memsize/src/memsize.c +231 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-os-memsize/test/memsize.rb +63 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/README.md +15 -18
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/src/pack.c +38 -88
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-print/mrblib/print.rb +1 -30
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-print/src/print.c +62 -26
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-proc-ext/src/proc.c +32 -19
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-proc-ext/test/proc.c +1 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-random/src/random.c +98 -43
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-random/test/random.rb +2 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-range-ext/mrblib/range.rb +39 -6
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-range-ext/src/range.c +20 -40
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-range-ext/test/range.rb +27 -3
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-rational/mrblib/rational.rb +11 -17
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-rational/src/rational.c +216 -38
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-rational/test/rational.rb +6 -6
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-sleep/README.md +6 -4
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-sleep/src/mrb_sleep.c +4 -4
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-socket/README.md +3 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-socket/src/socket.c +47 -45
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-sprintf/src/sprintf.c +102 -71
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-sprintf/test/sprintf.rb +4 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/mrblib/string.rb +23 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/src/string.c +13 -9
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-struct/mrblib/struct.rb +1 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-struct/src/struct.c +18 -25
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-symbol-ext/src/symbol.c +6 -5
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-symbol-ext/test/symbol.rb +1 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-test/README.md +0 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-test/driver.c +5 -5
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-test/mrbgem.rake +16 -44
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-test/vformat.c +4 -4
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-time/src/time.c +27 -27
- data/ext/enterprise_script_service/mruby/mrbgems/stdlib-ext.gembox +18 -0
- data/ext/enterprise_script_service/mruby/mrbgems/stdlib-io.gembox +12 -0
- data/ext/enterprise_script_service/mruby/mrbgems/stdlib.gembox +54 -0
- data/ext/enterprise_script_service/mruby/mrblib/10error.rb +4 -0
- data/ext/enterprise_script_service/mruby/mrblib/array.rb +17 -9
- data/ext/enterprise_script_service/mruby/mrblib/enum.rb +1 -1
- data/ext/enterprise_script_service/mruby/mrblib/hash.rb +0 -20
- data/ext/enterprise_script_service/mruby/mrblib/init_mrblib.c +0 -11
- data/ext/enterprise_script_service/mruby/mrblib/numeric.rb +36 -11
- data/ext/enterprise_script_service/mruby/mrblib/range.rb +25 -3
- data/ext/enterprise_script_service/mruby/oss-fuzz/mruby_proto_fuzzer.cpp +2 -2
- data/ext/enterprise_script_service/mruby/oss-fuzz/proto_to_ruby.h +1 -1
- data/ext/enterprise_script_service/mruby/src/array.c +43 -80
- data/ext/enterprise_script_service/mruby/src/backtrace.c +16 -17
- data/ext/enterprise_script_service/mruby/src/class.c +774 -182
- data/ext/enterprise_script_service/mruby/src/codedump.c +223 -198
- data/ext/enterprise_script_service/mruby/src/debug.c +6 -6
- data/ext/enterprise_script_service/mruby/src/dump.c +466 -141
- data/ext/enterprise_script_service/mruby/src/enum.c +1 -1
- data/ext/enterprise_script_service/mruby/src/error.c +36 -13
- data/ext/enterprise_script_service/mruby/src/etc.c +43 -34
- data/ext/enterprise_script_service/mruby/src/fmt_fp.c +5 -6
- data/ext/enterprise_script_service/mruby/src/gc.c +73 -71
- data/ext/enterprise_script_service/mruby/src/hash.c +1050 -707
- data/ext/enterprise_script_service/mruby/src/kernel.c +75 -220
- data/ext/enterprise_script_service/mruby/src/load.c +196 -166
- data/ext/enterprise_script_service/mruby/src/numeric.c +352 -314
- data/ext/enterprise_script_service/mruby/src/object.c +97 -90
- data/ext/enterprise_script_service/mruby/src/print.c +4 -3
- data/ext/enterprise_script_service/mruby/src/proc.c +48 -56
- data/ext/enterprise_script_service/mruby/src/range.c +45 -21
- data/ext/enterprise_script_service/mruby/src/state.c +25 -32
- data/ext/enterprise_script_service/mruby/src/string.c +59 -101
- data/ext/enterprise_script_service/mruby/src/symbol.c +121 -56
- data/ext/enterprise_script_service/mruby/src/value_array.h +1 -0
- data/ext/enterprise_script_service/mruby/src/variable.c +158 -158
- data/ext/enterprise_script_service/mruby/src/vm.c +617 -602
- data/ext/enterprise_script_service/mruby/tasks/benchmark.rake +6 -6
- data/ext/enterprise_script_service/mruby/tasks/bin.rake +23 -0
- data/ext/enterprise_script_service/mruby/tasks/core.rake +12 -0
- data/ext/enterprise_script_service/mruby/tasks/doc.rake +50 -38
- data/ext/enterprise_script_service/mruby/tasks/gitlab.rake +83 -77
- data/ext/enterprise_script_service/mruby/tasks/libmruby.rake +10 -1
- data/ext/enterprise_script_service/mruby/tasks/mrbgems.rake +13 -1
- data/ext/enterprise_script_service/mruby/tasks/mrblib.rake +40 -0
- data/ext/enterprise_script_service/mruby/tasks/presym.rake +44 -0
- data/ext/enterprise_script_service/mruby/tasks/test.rake +68 -0
- data/ext/enterprise_script_service/mruby/tasks/toolchains/gcc.rake +6 -5
- data/ext/enterprise_script_service/mruby/tasks/toolchains/openwrt.rake +10 -14
- data/ext/enterprise_script_service/mruby/tasks/toolchains/visualcpp.rake +17 -21
- data/ext/enterprise_script_service/mruby/test/bintest.rb +5 -5
- data/ext/enterprise_script_service/mruby/test/t/argumenterror.rb +16 -0
- data/ext/enterprise_script_service/mruby/test/t/array.rb +7 -3
- data/ext/enterprise_script_service/mruby/test/t/bs_literal.rb +1 -1
- data/ext/enterprise_script_service/mruby/test/t/float.rb +18 -8
- data/ext/enterprise_script_service/mruby/test/t/hash.rb +903 -281
- data/ext/enterprise_script_service/mruby/test/t/integer.rb +10 -38
- data/ext/enterprise_script_service/mruby/test/t/kernel.rb +1 -1
- data/ext/enterprise_script_service/mruby/test/t/literals.rb +50 -0
- data/ext/enterprise_script_service/mruby/test/t/module.rb +2 -2
- data/ext/enterprise_script_service/mruby/test/t/numeric.rb +1 -1
- data/ext/enterprise_script_service/mruby/test/t/range.rb +83 -1
- data/ext/enterprise_script_service/mruby/test/t/string.rb +4 -0
- data/ext/enterprise_script_service/mruby/test/t/superclass.rb +10 -10
- data/ext/enterprise_script_service/mruby/test/t/syntax.rb +24 -0
- data/ext/enterprise_script_service/mruby/test/t/vformat.rb +3 -3
- data/ext/enterprise_script_service/mruby_config.rb +2 -5
- data/ext/enterprise_script_service/mruby_engine.cpp +1 -1
- data/lib/script_core/version.rb +1 -1
- data/spec/script_core_spec.rb +13 -0
- metadata +61 -23
- data/ext/enterprise_script_service/mruby/.github/workflows/main.yml +0 -24
- data/ext/enterprise_script_service/mruby/TODO +0 -8
- data/ext/enterprise_script_service/mruby/appveyor_config.rb +0 -46
- data/ext/enterprise_script_service/mruby/benchmark/build_config_boxing.rb +0 -28
- data/ext/enterprise_script_service/mruby/examples/targets/build_config_android_arm64-v8a.rb +0 -26
- data/ext/enterprise_script_service/mruby/examples/targets/build_config_android_armeabi.rb +0 -26
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-sprintf/src/kernel.c +0 -30
- data/ext/enterprise_script_service/mruby/mrblib/mrblib.rake +0 -18
- data/ext/enterprise_script_service/mruby/src/crc.c +0 -39
- data/ext/enterprise_script_service/mruby/src/mruby_core.rake +0 -19
@@ -38,7 +38,7 @@ To confirm mrdb was installed properly, run mrdb with the `--version` option:
|
|
38
38
|
|
39
39
|
```bash
|
40
40
|
$ mrdb --version
|
41
|
-
mruby
|
41
|
+
mruby 3.0.0 (2021-03-05)
|
42
42
|
```
|
43
43
|
|
44
44
|
## 2.2 Basic Operation
|
@@ -220,6 +220,7 @@ Example:
|
|
220
220
|
```
|
221
221
|
|
222
222
|
Enabling all breakpoints
|
223
|
+
|
223
224
|
```
|
224
225
|
(foo.rb:1) enable 1 3
|
225
226
|
```
|
@@ -263,7 +264,7 @@ Example:
|
|
263
264
|
|
264
265
|
```
|
265
266
|
(sample.rb:1) info breakpoints
|
266
|
-
Num Type Enb What
|
267
|
+
Num Type Enb What
|
267
268
|
1 breakpoint y at sample.rb:3 -> file name,line number
|
268
269
|
2 breakpoint n in Sample_class:sample_class_method -> [class:]method name
|
269
270
|
3 breakpoint y in sample_global_method
|
@@ -273,8 +274,8 @@ Displaying the specified breakpoint number:
|
|
273
274
|
|
274
275
|
```
|
275
276
|
(foo.rb:1) info breakpoints 1 3
|
276
|
-
Num Type Enb What
|
277
|
-
1 breakpoint y at sample.rb:3
|
277
|
+
Num Type Enb What
|
278
|
+
1 breakpoint y at sample.rb:3
|
278
279
|
3 breakpoint y in sample_global_method
|
279
280
|
```
|
280
281
|
|
@@ -3,7 +3,7 @@
|
|
3
3
|
_This is an English translation of [Matz's blog post][matz blog post]
|
4
4
|
written in Japanese._
|
5
5
|
_Some parts are updated to reflect recent changes._
|
6
|
-
[matz blog post]:
|
6
|
+
[matz blog post]: https://www.rubyist.net/~matz/20130731.html
|
7
7
|
|
8
8
|
When you are extending mruby using C language, you may encounter
|
9
9
|
mysterious "arena overflow error" or memory leak or very slow
|
@@ -1,7 +1,9 @@
|
|
1
1
|
# mruby configuration macros.
|
2
2
|
|
3
3
|
## How to use these macros.
|
4
|
+
|
4
5
|
You can use mrbconfs with following ways:
|
6
|
+
|
5
7
|
* Write them in `mrbconf.h`.
|
6
8
|
* Using compiler flags is preferred when building a cross binaries or multiple mruby binaries
|
7
9
|
since it's easier to use different mrbconf per each `MRuby::Build`.
|
@@ -11,7 +13,9 @@ You can use mrbconfs with following ways:
|
|
11
13
|
changes `struct` layout and cause memory access error when C and other language(e.g., C++) is mixed.
|
12
14
|
|
13
15
|
## stdio setting.
|
14
|
-
|
16
|
+
|
17
|
+
`MRB_NO_STDIO`
|
18
|
+
|
15
19
|
* When defined `<stdio.h>` functions won't be used.
|
16
20
|
* Some features will be disabled when this is enabled:
|
17
21
|
* `mrb_irep` load/dump from/to file.
|
@@ -19,80 +23,97 @@ You can use mrbconfs with following ways:
|
|
19
23
|
* Printing features in **src/print.c**.
|
20
24
|
|
21
25
|
## Debug macros.
|
22
|
-
|
26
|
+
|
27
|
+
`MRB_USE_DEBUG_HOOK`
|
28
|
+
|
23
29
|
* When defined code fetch hook and debug OP hook will be enabled.
|
24
30
|
* When using any of the hook set function pointer `code_fetch_hook` and/or `debug_op_hook` of `mrb_state`.
|
25
31
|
* Fetch hook will be called before any OP.
|
26
32
|
* Debug OP hook will be called when dispatching `OP_DEBUG`.
|
27
33
|
|
28
34
|
`MRB_DEBUG`
|
35
|
+
|
29
36
|
* When defined `mrb_assert*` macro will be defined with macros from `<assert.h>`.
|
30
37
|
* Could be enabled via `enable_debug` method of `MRuby::Build`.
|
31
38
|
|
32
39
|
## Stack configuration
|
33
40
|
|
34
41
|
`MRB_STACK_EXTEND_DOUBLING`
|
42
|
+
|
35
43
|
* If defined doubles the stack size when extending it.
|
36
44
|
* Else extends stack with `MRB_STACK_GROWTH`.
|
37
45
|
|
38
46
|
`MRB_STACK_GROWTH`
|
47
|
+
|
39
48
|
* Default value is `128`.
|
40
49
|
* Used in stack extending.
|
41
50
|
* Ignored when `MRB_STACK_EXTEND_DOUBLING` is defined.
|
42
51
|
|
43
52
|
`MRB_STACK_MAX`
|
53
|
+
|
44
54
|
* Default value is `0x40000 - MRB_STACK_GROWTH`.
|
45
55
|
* Raises `RuntimeError` when stack size exceeds this value.
|
46
56
|
|
47
57
|
## Primitive type configuration.
|
48
58
|
|
49
|
-
`
|
59
|
+
`MRB_USE_FLOAT32`
|
60
|
+
|
50
61
|
* When defined single precision floating point type(C type `float`) is used as `mrb_float`.
|
51
|
-
*
|
62
|
+
* Otherwise double precision floating point type(C type `double`) is used as `mrb_float`.
|
63
|
+
|
64
|
+
`MRB_NO_FLOAT`
|
52
65
|
|
53
|
-
`MRB_WITHOUT_FLOAT`
|
54
66
|
* When defined removes floating point numbers from mruby.
|
55
67
|
* It makes mruby easier to handle in "Microcontroller without FPU" and "Kernel Space".
|
56
68
|
|
57
69
|
`MRB_INT32`
|
70
|
+
|
58
71
|
* When defined, or `MRB_INT64` are not defined on 32-bit CPU mode, `mrb_int` will be defined as `int32_t`.
|
59
72
|
* Conflicts with `MRB_INT64`.
|
60
73
|
|
61
74
|
`MRB_INT64`
|
75
|
+
|
62
76
|
* When defined, or `MRB_INT32` are not defined on 64-bit CPU mode, `mrb_int` will be defined as `int64_t`.
|
63
77
|
* Conflicts with `MRB_INT32`.
|
64
78
|
|
65
79
|
## Garbage collector configuration.
|
66
80
|
|
67
81
|
`MRB_GC_STRESS`
|
82
|
+
|
68
83
|
* When defined full GC is emitted per each `RBasic` allocation.
|
69
84
|
* Mainly used in memory manager debugging.
|
70
85
|
|
71
86
|
`MRB_GC_TURN_OFF_GENERATIONAL`
|
87
|
+
|
72
88
|
* When defined turns generational GC by default.
|
73
89
|
|
74
90
|
`MRB_GC_FIXED_ARENA`
|
91
|
+
|
75
92
|
* When defined used fixed size GC arena.
|
76
93
|
* Raises `RuntimeError` when this is defined and GC arena size exceeds `MRB_GC_ARENA_SIZE`.
|
77
94
|
* Useful tracking unnecessary mruby object allocation.
|
78
95
|
|
79
96
|
`MRB_GC_ARENA_SIZE`
|
97
|
+
|
80
98
|
* Default value is `100`.
|
81
99
|
* Ignored when `MRB_GC_FIXED_ARENA` isn't defined.
|
82
100
|
* Defines fixed GC arena size.
|
83
101
|
|
84
102
|
`MRB_HEAP_PAGE_SIZE`
|
103
|
+
|
85
104
|
* Defines value is `1024`.
|
86
105
|
* Specifies number of `RBasic` per each heap page.
|
87
106
|
|
88
107
|
## Memory pool configuration.
|
89
108
|
|
90
109
|
`POOL_ALIGNMENT`
|
110
|
+
|
91
111
|
* Default value is `4`.
|
92
112
|
* If you're allocating data types that requires alignment more than default value define the
|
93
113
|
largest value of required alignment.
|
94
114
|
|
95
115
|
`POOL_PAGE_SIZE`
|
116
|
+
|
96
117
|
* Default value is `16000`.
|
97
118
|
* Specifies page size of pool page.
|
98
119
|
* Smaller the value is increases memory overhead.
|
@@ -100,37 +121,38 @@ largest value of required alignment.
|
|
100
121
|
## State atexit configuration.
|
101
122
|
|
102
123
|
`MRB_FIXED_STATE_ATEXIT_STACK`
|
124
|
+
|
103
125
|
* If defined enables fixed size `mrb_state` atexit stack.
|
104
126
|
* Raises `RuntimeError` when `mrb_state_atexit` call count to same `mrb_state` exceeds
|
105
127
|
`MRB_FIXED_STATE_ATEXIT_STACK_SIZE`'s value.
|
106
128
|
|
107
129
|
`MRB_FIXED_STATE_ATEXIT_STACK_SIZE`
|
130
|
+
|
108
131
|
* Default value is `5`.
|
109
132
|
* If `MRB_FIXED_STATE_ATEXIT_STACK` isn't defined this macro is ignored.
|
110
133
|
|
111
134
|
## `mrb_value` configuration.
|
112
135
|
|
113
136
|
`MRB_ENDIAN_BIG`
|
137
|
+
|
114
138
|
* If defined compiles mruby for big endian machines.
|
115
139
|
* Used in `MRB_NAN_BOXING`.
|
116
140
|
* Some mrbgem use this mrbconf.
|
117
141
|
|
118
142
|
`MRB_NAN_BOXING`
|
143
|
+
|
119
144
|
* If defined represent `mrb_value` in boxed `double`.
|
120
|
-
* Conflicts with `
|
145
|
+
* Conflicts with `MRB_USE_FLOAT32` and `MRB_NO_FLOAT`.
|
121
146
|
|
122
147
|
`MRB_WORD_BOXING`
|
148
|
+
|
123
149
|
* If defined represent `mrb_value` as a word.
|
124
150
|
* If defined `Float` will be a mruby object with `RBasic`.
|
125
151
|
|
126
|
-
## Instance variable configuration.
|
127
|
-
`MRB_IV_SEGMENT_SIZE`
|
128
|
-
* Default value is `4`.
|
129
|
-
* Specifies size of each segment in segment list.
|
130
|
-
|
131
152
|
## Reduce heap memory configuration.
|
132
153
|
|
133
154
|
`MRB_USE_LINK_TIME_RO_DATA_P`
|
155
|
+
|
134
156
|
* Only available on ELF platforms.
|
135
157
|
* If you specify the address of a read-only section when creating a symbol or string, that string will be used as it is.
|
136
158
|
* Heap memory can be saved.
|
@@ -138,6 +160,7 @@ largest value of required alignment.
|
|
138
160
|
* It must be `__ehdr_start < data_addr < __init_array_start`.
|
139
161
|
|
140
162
|
`MRB_USE_CUSTOM_RO_DATA_P`
|
163
|
+
|
141
164
|
* Takes precedence over `MRB_USE_LINK_TIME_RO_DATA_P`.
|
142
165
|
* Please try if `MRB_USE_LINK_TIME_RO_DATA_P` is not available.
|
143
166
|
* The `mrb_ro_data_p()` function is implemented by the user in an arbitrary file.
|
@@ -145,37 +168,41 @@ largest value of required alignment.
|
|
145
168
|
* Return `TRUE` if `ptr` is in read-only section, otherwise return `FALSE`.
|
146
169
|
|
147
170
|
## Other configuration.
|
171
|
+
|
148
172
|
`MRB_UTF8_STRING`
|
173
|
+
|
149
174
|
* Adds UTF-8 encoding support to character-oriented String instance methods.
|
150
175
|
* If it isn't defined, they only support the US-ASCII encoding.
|
151
176
|
|
152
177
|
`MRB_FUNCALL_ARGC_MAX`
|
178
|
+
|
153
179
|
* Default value is `16`.
|
154
180
|
* Specifies 4th argument(`argc`) max value of `mrb_funcall`.
|
155
181
|
* Raises `ArgumentError` when the `argc` argument is bigger then this value `mrb_funcall`.
|
156
182
|
|
157
183
|
`KHASH_DEFAULT_SIZE`
|
184
|
+
|
158
185
|
* Default value is `32`.
|
159
186
|
* Specifies default size of khash table bucket.
|
160
187
|
* Used in `kh_init_ ## name` function.
|
161
188
|
|
162
|
-
`
|
163
|
-
* Default value is `128`.
|
164
|
-
* Specifies initial capacity of `RString` created by `mrb_str_buf_new` function..
|
189
|
+
`MRB_NO_METHOD_CACHE`
|
165
190
|
|
166
|
-
|
167
|
-
* Improve performance for method dispatch.
|
191
|
+
* Disable method cache to save memory.
|
168
192
|
|
169
193
|
`MRB_METHOD_CACHE_SIZE`
|
170
|
-
|
171
|
-
*
|
194
|
+
|
195
|
+
* Default value is `256`.
|
196
|
+
* Ignored if `MRB_NO_METHOD_CACHE` is defined.
|
172
197
|
* Need to be the power of 2.
|
173
198
|
|
174
|
-
`
|
199
|
+
`MRB_USE_METHOD_T_STRUCT`
|
200
|
+
|
175
201
|
* Use C struct to represent `mrb_method_t`
|
176
|
-
* No `
|
202
|
+
* No `MRB_USE_METHOD_T_STRUCT` requires highest 2 bits of function pointers to be zero
|
177
203
|
* Define this macro on machines that use higher bits of pointers
|
178
204
|
|
179
|
-
`
|
180
|
-
|
205
|
+
`MRB_USE_ALL_SYMBOLS`
|
206
|
+
|
207
|
+
* Make it available `Symbol.all_symbols` in `mrbgems/mruby-symbol-ext`
|
181
208
|
* Increase heap memory usage.
|
@@ -5,21 +5,27 @@ standardised way into mruby.
|
|
5
5
|
|
6
6
|
## Usage
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
extension integrated.
|
8
|
+
You have to activate mrbgems explicitly in your build configuration. To add
|
9
|
+
a GEM, add the following line to your build configuration file, for example:
|
11
10
|
|
12
|
-
To add a GEM into the *build_config.rb* add the following line for example:
|
13
11
|
```ruby
|
14
12
|
conf.gem '/path/to/your/gem/dir'
|
15
13
|
```
|
16
14
|
|
17
|
-
You can also use a relative path
|
15
|
+
You can also use a relative path to specify a gem.
|
16
|
+
|
18
17
|
```ruby
|
19
18
|
conf.gem 'examples/mrbgems/ruby_extension_example'
|
20
19
|
```
|
21
20
|
|
21
|
+
In that case,
|
22
|
+
|
23
|
+
* if your build configuration file is in the `build_config` directory, it's
|
24
|
+
relative from `MRUBY_ROOT`.
|
25
|
+
* otherwise, it is relative from the directory where your build configuration is.
|
26
|
+
|
22
27
|
A remote GIT repository location for a GEM is also supported:
|
28
|
+
|
23
29
|
```ruby
|
24
30
|
conf.gem :git => 'https://github.com/masuidrive/mrbgems-example.git', :branch => 'master'
|
25
31
|
conf.gem :github => 'masuidrive/mrbgems-example', :branch => 'master'
|
@@ -27,17 +33,20 @@ conf.gem :bitbucket => 'mruby/mrbgems-example', :branch => 'master'
|
|
27
33
|
```
|
28
34
|
|
29
35
|
You can specify the sub directory of the repository with `:path` option:
|
36
|
+
|
30
37
|
```ruby
|
31
38
|
conf.gem github: 'mruby/mruby', path: 'mrbgems/mruby-socket'
|
32
39
|
```
|
33
40
|
|
34
41
|
To use mrbgem from [mgem-list](https://github.com/mruby/mgem-list) use `:mgem` option:
|
42
|
+
|
35
43
|
```ruby
|
36
44
|
conf.gem :mgem => 'mruby-yaml'
|
37
45
|
conf.gem :mgem => 'yaml' # 'mruby-' prefix could be omitted
|
38
46
|
```
|
39
47
|
|
40
48
|
For specifying commit hash to checkout use `:checksum_hash` option:
|
49
|
+
|
41
50
|
```ruby
|
42
51
|
conf.gem mgem: 'mruby-redis', checksum_hash: '3446d19fc4a3f9697b5ddbf2a904f301c42f2f4e'
|
43
52
|
```
|
@@ -54,13 +63,14 @@ NOTE: `:bitbucket` option supports only git. Hg is unsupported in this version.
|
|
54
63
|
|
55
64
|
There are instances when you wish to add a collection of mrbgems into mruby at
|
56
65
|
once, or be able to substitute mrbgems based on configuration, without having to
|
57
|
-
add each gem to
|
66
|
+
add each gem to your build configuration file. A packaged collection of mrbgems
|
58
67
|
is called a GemBox. A GemBox is a file that contains a list of mrbgems to load
|
59
|
-
into mruby, in the same format as if you were adding them to
|
68
|
+
into mruby, in the same format as if you were adding them to the build config
|
60
69
|
via `config.gem`, but wrapped in an `MRuby::GemBox` object. GemBoxes are
|
61
70
|
loaded into mruby via `config.gembox 'boxname'`.
|
62
71
|
|
63
72
|
Below we have created a GemBox containing *mruby-time* and *mrbgems-example*:
|
73
|
+
|
64
74
|
```ruby
|
65
75
|
MRuby::GemBox.new do |conf|
|
66
76
|
conf.gem "#{root}/mrbgems/mruby-time"
|
@@ -73,16 +83,19 @@ must be saved with a *.gembox* extension inside the *mrbgems* directory to to be
|
|
73
83
|
picked up by mruby.
|
74
84
|
|
75
85
|
To use this example GemBox, we save it as `custom.gembox` inside the *mrbgems*
|
76
|
-
directory in mruby, and add the following to
|
86
|
+
directory in mruby, and add the following to your build configuration file inside
|
77
87
|
the build block:
|
88
|
+
|
78
89
|
```ruby
|
79
90
|
conf.gembox 'custom'
|
80
91
|
```
|
92
|
+
|
81
93
|
This will cause the *custom* GemBox to be read in during the build process,
|
82
94
|
adding *mruby-time* and *mrbgems-example* to the build.
|
83
95
|
|
84
96
|
If you want, you can put GemBox outside of mruby directory. In that case you must
|
85
97
|
specify an absolute path like below.
|
98
|
+
|
86
99
|
```ruby
|
87
100
|
conf.gembox "#{ENV["HOME"]}/mygemboxes/custom"
|
88
101
|
```
|
@@ -120,6 +133,7 @@ to compile C and Ruby files. *README.md* is a short description of your GEM.
|
|
120
133
|
|
121
134
|
mrbgems expects a specification file called *mrbgem.rake* inside of your
|
122
135
|
GEM directory. A typical GEM specification could look like this for example:
|
136
|
+
|
123
137
|
```ruby
|
124
138
|
MRuby::Gem::Specification.new('c_and_ruby_extension_example') do |spec|
|
125
139
|
spec.license = 'MIT'
|
@@ -149,6 +163,7 @@ The `license` and `author` properties are required in every GEM!
|
|
149
163
|
|
150
164
|
In case your GEM is depending on other GEMs please use
|
151
165
|
`spec.add_dependency(gem, *requirements[, default_get_info])` like:
|
166
|
+
|
152
167
|
```ruby
|
153
168
|
MRuby::Gem::Specification.new('c_and_ruby_extension_example') do |spec|
|
154
169
|
spec.license = 'MIT'
|
@@ -158,10 +173,10 @@ MRuby::Gem::Specification.new('c_and_ruby_extension_example') do |spec|
|
|
158
173
|
# The version must be between 1.0.0 and 1.5.2 .
|
159
174
|
spec.add_dependency('mruby-parser', '>= 1.0.0', '<= 1.5.2')
|
160
175
|
|
161
|
-
# Use any version of mruby-uv from
|
176
|
+
# Use any version of mruby-uv from GitHub.
|
162
177
|
spec.add_dependency('mruby-uv', '>= 0.0.0', :github => 'mattn/mruby-uv')
|
163
178
|
|
164
|
-
# Use latest mruby-onig-regexp from
|
179
|
+
# Use latest mruby-onig-regexp from GitHub. (version requirements can be omitted)
|
165
180
|
spec.add_dependency('mruby-onig-regexp', :github => 'mattn/mruby-onig-regexp')
|
166
181
|
|
167
182
|
# You can add extra mgems active only on test
|
@@ -172,6 +187,7 @@ end
|
|
172
187
|
The version requirements and default gem information are optional.
|
173
188
|
|
174
189
|
Version requirement supports following operators:
|
190
|
+
|
175
191
|
* '=': is equal
|
176
192
|
* '!=': is not equal
|
177
193
|
* '>': is greater
|
@@ -184,18 +200,20 @@ Version requirement supports following operators:
|
|
184
200
|
|
185
201
|
When more than one version requirements is passed, the dependency must satisfy all of it.
|
186
202
|
|
187
|
-
You can have default gem to use as dependency when it's not defined in
|
203
|
+
You can have default gem to use as dependency when it's not defined in your build configuration.
|
188
204
|
When the last argument of `add_dependency` call is `Hash`, it will be treated as default gem information.
|
189
205
|
Its format is same as argument of method `MRuby::Build#gem`, expect that it can't be treated as path gem location.
|
190
206
|
|
191
207
|
When a special version of dependency is required,
|
192
|
-
use `MRuby::Build#gem` in
|
208
|
+
use `MRuby::Build#gem` in the build configuration to override default gem.
|
193
209
|
|
194
210
|
If you have conflicting GEMs use the following method:
|
211
|
+
|
195
212
|
* `spec.add_conflict(gem, *requirements)`
|
196
213
|
* The `requirements` argument is same as in `add_dependency` method.
|
197
214
|
|
198
215
|
like following code:
|
216
|
+
|
199
217
|
```ruby
|
200
218
|
MRuby::Gem::Specification.new 'some-regexp-binding' do |spec|
|
201
219
|
spec.license = 'BSD'
|
@@ -238,7 +256,6 @@ For example: when B depends to C and A depends to B, A will get include paths ex
|
|
238
256
|
Exported include_paths are automatically appended to GEM local include_paths by rake.
|
239
257
|
You can use `spec.export_include_paths` accessor if you want more complex build.
|
240
258
|
|
241
|
-
|
242
259
|
## C Extension
|
243
260
|
|
244
261
|
mruby can be extended with C. This is possible by using the C API to
|
@@ -250,6 +267,7 @@ mrbgems expects that you have implemented a C method called
|
|
250
267
|
`mrb_YOURGEMNAME_gem_init(mrb_state)`. `YOURGEMNAME` will be replaced
|
251
268
|
by the name of your GEM. If you call your GEM *c_extension_example*, your
|
252
269
|
initialisation method could look like this:
|
270
|
+
|
253
271
|
```C
|
254
272
|
void
|
255
273
|
mrb_c_extension_example_gem_init(mrb_state* mrb) {
|
@@ -294,7 +312,6 @@ mruby can be extended with pure Ruby. It is possible to override existing
|
|
294
312
|
classes or add new ones in this way. Put all Ruby files into the *mrblib*
|
295
313
|
folder.
|
296
314
|
|
297
|
-
|
298
315
|
### Pre-Conditions
|
299
316
|
|
300
317
|
none
|
@@ -0,0 +1,83 @@
|
|
1
|
+
# Symbols
|
2
|
+
|
3
|
+
Symbols in `mruby` C source code is represented by `mrb_sym` which is alias of
|
4
|
+
`uint32_t`. Lower 30 bits are used for symbols so that higher 2 bits can be
|
5
|
+
used as flags, e.g. `struct mt_elem` in `class.c`.
|
6
|
+
|
7
|
+
```C
|
8
|
+
struct mt_elem {
|
9
|
+
union mt_ptr ptr;
|
10
|
+
size_t func_p:1;
|
11
|
+
size_t noarg_p:1;
|
12
|
+
mrb_sym key:sizeof(mrb_sym)*8-2;
|
13
|
+
};
|
14
|
+
```
|
15
|
+
|
16
|
+
## C API
|
17
|
+
|
18
|
+
We provide following C API for symbols.
|
19
|
+
|
20
|
+
### Generate Symbols
|
21
|
+
|
22
|
+
#### `mrb_sym mrb_intern(mrb_state*,const char*,size_t)`
|
23
|
+
|
24
|
+
Get a symbol from a string.
|
25
|
+
|
26
|
+
#### `mrb_sym mrb_intern_check_cstr(mrb_state*,const char*)`
|
27
|
+
|
28
|
+
Get a symbol from a NULL terminated (C) string.
|
29
|
+
|
30
|
+
#### `mrb_sym mrb_intern_str(mrb_state*,mrb_value)`
|
31
|
+
|
32
|
+
Get a symbol from a Ruby string object.
|
33
|
+
|
34
|
+
#### `mrb_intern_lit(mrb_state*,const char*)`
|
35
|
+
|
36
|
+
Get a symbol from a C string literal. The second argument should be a C string
|
37
|
+
literal, otherwise you will get a compilation error. It does not copy C string
|
38
|
+
given the fact it's a literal.
|
39
|
+
|
40
|
+
#### `mrb_sym mrb_intern_check(mrb_state*,const char*,size_t)`
|
41
|
+
|
42
|
+
Get a symbol from a string if the string has been already registered as a
|
43
|
+
symbol, otherwise return `0`. We also provide variants `mrb_intern_check_str()`
|
44
|
+
(from Ruby string) and `mrb_intern_check_cstr()` (from C string).
|
45
|
+
|
46
|
+
#### `const char *mrb_sym_name(mrb_state*,mrb_sym)`
|
47
|
+
|
48
|
+
Get a string representation of a symbol as a C string.
|
49
|
+
|
50
|
+
#### `const char *mrb_sym_name_len(mrb_state*,mrb_sym,mrb_int*)`
|
51
|
+
|
52
|
+
Get a string representation of a symbol, and its length.
|
53
|
+
|
54
|
+
## Preallocate Symbols
|
55
|
+
|
56
|
+
To save RAM, `mruby` can use compile-time allocation of some symbols. You can
|
57
|
+
use following macros to get preallocated symbols by including `mruby/presym.h`
|
58
|
+
header.
|
59
|
+
|
60
|
+
* `MRB_SYM(xor)` //=> xor (Word characters)
|
61
|
+
* `MRB_SYM_B(xor)` //=> xor! (Method with Bang)
|
62
|
+
* `MRB_SYM_Q(xor)` //=> xor? (Method with Question mark)
|
63
|
+
* `MRB_SYM_E(xor)` //=> xor= (Method with Equal)
|
64
|
+
* `MRB_CVSYM(xor)` //=> @@xor (Class Variable)
|
65
|
+
* `MRB_IVSYM(xor)` //=> @xor (Instance Variable)
|
66
|
+
* `MRB_OPSYM(xor)` //=> ^ (Operator)
|
67
|
+
|
68
|
+
For `MRB_OPSYM()`, specify the names corresponding to operators (see
|
69
|
+
`MRuby::Presym::OPERATORS` in `lib/mruby/presym.rb` for the names that
|
70
|
+
can be specified for it). Other than that, describe only word characters
|
71
|
+
excluding leading and ending punctuations.
|
72
|
+
|
73
|
+
These macros are converted to static symbol IDs at compile time, unless
|
74
|
+
preallocate symbols are disabled by `conf.disable_presym`. In that case,
|
75
|
+
these macros are expanded to `mrb_intern_lit` calls, therefore the mruby state
|
76
|
+
variable is required. The above macros assume the variable name is `mrb`. If
|
77
|
+
its name is not `mrb`, you need to use macros with `_2` suffix, such as
|
78
|
+
`MRB_SYM_2` to specify `mrb_state*` variable.
|
79
|
+
|
80
|
+
### Disabling Preallocated Symbols
|
81
|
+
|
82
|
+
You can disable preallocated symbols by specifying `conf.disable_presym` in the
|
83
|
+
configuration file.
|