script_core 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.rubocop.yml +8 -6
- data/.ruby-version +1 -1
- data/Gemfile +2 -1
- data/bin/sandbox +1 -1
- data/ext/enterprise_script_service/Rakefile +1 -1
- data/ext/enterprise_script_service/flags.rb +5 -0
- data/ext/enterprise_script_service/libseccomp/CHANGELOG +15 -0
- data/ext/enterprise_script_service/libseccomp/CREDITS +3 -0
- data/ext/enterprise_script_service/libseccomp/Makefile.am +1 -1
- data/ext/enterprise_script_service/libseccomp/README.md +1 -1
- data/ext/enterprise_script_service/libseccomp/SECURITY.md +45 -0
- data/ext/enterprise_script_service/libseccomp/configure.ac +3 -3
- data/ext/enterprise_script_service/libseccomp/doc/admin/MAINTAINER_PROCESS.md +95 -0
- data/ext/enterprise_script_service/libseccomp/{RELEASE_PROCESS.md → doc/admin/RELEASE_PROCESS.md} +9 -1
- data/ext/enterprise_script_service/libseccomp/include/Makefile.am +1 -1
- data/ext/enterprise_script_service/libseccomp/include/seccomp-syscalls.h +2292 -0
- data/ext/enterprise_script_service/libseccomp/include/seccomp.h.in +3 -1065
- data/ext/enterprise_script_service/libseccomp/src/arch-aarch64-syscalls.c +35 -3
- data/ext/enterprise_script_service/libseccomp/src/arch-arm-syscalls.c +35 -3
- data/ext/enterprise_script_service/libseccomp/src/arch-mips-syscalls.c +43 -11
- data/ext/enterprise_script_service/libseccomp/src/arch-mips64-syscalls.c +33 -1
- data/ext/enterprise_script_service/libseccomp/src/arch-mips64n32-syscalls.c +33 -1
- data/ext/enterprise_script_service/libseccomp/src/arch-parisc-syscalls.c +34 -2
- data/ext/enterprise_script_service/libseccomp/src/arch-ppc-syscalls.c +43 -11
- data/ext/enterprise_script_service/libseccomp/src/arch-ppc64-syscalls.c +44 -12
- data/ext/enterprise_script_service/libseccomp/src/arch-s390-syscalls.c +46 -14
- data/ext/enterprise_script_service/libseccomp/src/arch-s390.c +142 -18
- data/ext/enterprise_script_service/libseccomp/src/arch-s390x-syscalls.c +47 -15
- data/ext/enterprise_script_service/libseccomp/src/arch-s390x.c +143 -17
- data/ext/enterprise_script_service/libseccomp/src/arch-x32-syscalls.c +33 -1
- data/ext/enterprise_script_service/libseccomp/src/arch-x86-syscalls.c +94 -12
- data/ext/enterprise_script_service/libseccomp/src/arch-x86.c +142 -19
- data/ext/enterprise_script_service/libseccomp/src/arch-x86_64-syscalls.c +33 -1
- data/ext/enterprise_script_service/libseccomp/src/db.c +1 -0
- data/ext/enterprise_script_service/libseccomp/src/gen_bpf.c +10 -3
- data/ext/enterprise_script_service/libseccomp/src/python/Makefile.am +4 -4
- data/ext/enterprise_script_service/libseccomp/src/python/seccomp.pyx +2 -0
- data/ext/enterprise_script_service/libseccomp/tests/.gitignore +1 -0
- data/ext/enterprise_script_service/libseccomp/tests/50-sim-hash_collision.c +98 -0
- data/ext/enterprise_script_service/libseccomp/tests/50-sim-hash_collision.py +61 -0
- data/ext/enterprise_script_service/libseccomp/tests/50-sim-hash_collision.tests +18 -0
- data/ext/enterprise_script_service/libseccomp/tests/Makefile.am +6 -3
- data/ext/enterprise_script_service/libseccomp/tools/Makefile.am +0 -2
- data/ext/enterprise_script_service/libseccomp/tools/check-syntax +1 -0
- data/ext/enterprise_script_service/libseccomp/tools/scmp_bpf_sim.c +2 -0
- data/ext/enterprise_script_service/mruby-mpdecimal/src/ext.c +1 -1
- data/ext/enterprise_script_service/mruby/.gitignore +2 -2
- data/ext/enterprise_script_service/mruby/CONTRIBUTING.md +10 -3
- data/ext/enterprise_script_service/mruby/Doxyfile +2408 -0
- data/ext/enterprise_script_service/mruby/README.md +21 -8
- data/ext/enterprise_script_service/mruby/Rakefile +4 -13
- data/ext/enterprise_script_service/mruby/appveyor_config.rb +1 -1
- data/ext/enterprise_script_service/mruby/build_config.rb +3 -3
- data/ext/enterprise_script_service/mruby/doc/guides/compile.md +42 -42
- data/ext/enterprise_script_service/mruby/doc/guides/debugger.md +1 -1
- data/ext/enterprise_script_service/mruby/doc/guides/mrbconf.md +45 -6
- data/ext/enterprise_script_service/mruby/doc/guides/mrbgems.md +5 -0
- data/ext/enterprise_script_service/mruby/doc/limitations.md +88 -38
- data/ext/enterprise_script_service/mruby/doc/mruby_logo_red_icon.png +0 -0
- data/ext/enterprise_script_service/mruby/doc/opcode.md +94 -94
- data/ext/enterprise_script_service/mruby/include/mrbconf.h +74 -11
- data/ext/enterprise_script_service/mruby/include/mruby.h +242 -146
- data/ext/enterprise_script_service/mruby/include/mruby/array.h +7 -7
- data/ext/enterprise_script_service/mruby/include/mruby/boxing_nan.h +2 -9
- data/ext/enterprise_script_service/mruby/include/mruby/boxing_no.h +11 -10
- data/ext/enterprise_script_service/mruby/include/mruby/boxing_word.h +104 -69
- data/ext/enterprise_script_service/mruby/include/mruby/class.h +7 -5
- data/ext/enterprise_script_service/mruby/include/mruby/common.h +9 -7
- data/ext/enterprise_script_service/mruby/include/mruby/compile.h +6 -6
- data/ext/enterprise_script_service/mruby/include/mruby/data.h +5 -5
- data/ext/enterprise_script_service/mruby/include/mruby/debug.h +2 -2
- data/ext/enterprise_script_service/mruby/include/mruby/dump.h +3 -7
- data/ext/enterprise_script_service/mruby/include/mruby/error.h +34 -6
- data/ext/enterprise_script_service/mruby/include/mruby/gc.h +2 -2
- data/ext/enterprise_script_service/mruby/include/mruby/hash.h +4 -11
- data/ext/enterprise_script_service/mruby/include/mruby/irep.h +16 -4
- data/ext/enterprise_script_service/mruby/include/mruby/istruct.h +4 -4
- data/ext/enterprise_script_service/mruby/include/mruby/khash.h +2 -2
- data/ext/enterprise_script_service/mruby/include/mruby/numeric.h +41 -7
- data/ext/enterprise_script_service/mruby/include/mruby/object.h +8 -9
- data/ext/enterprise_script_service/mruby/include/mruby/opcode.h +2 -2
- data/ext/enterprise_script_service/mruby/include/mruby/ops.h +6 -6
- data/ext/enterprise_script_service/mruby/include/mruby/proc.h +19 -13
- data/ext/enterprise_script_service/mruby/include/mruby/range.h +10 -4
- data/ext/enterprise_script_service/mruby/include/mruby/re.h +2 -2
- data/ext/enterprise_script_service/mruby/include/mruby/string.h +130 -107
- data/ext/enterprise_script_service/mruby/include/mruby/throw.h +2 -2
- data/ext/enterprise_script_service/mruby/include/mruby/value.h +137 -49
- data/ext/enterprise_script_service/mruby/include/mruby/variable.h +3 -5
- data/ext/enterprise_script_service/mruby/include/mruby/version.h +24 -10
- data/ext/enterprise_script_service/mruby/lib/mruby-core-ext.rb +2 -39
- data/ext/enterprise_script_service/mruby/lib/mruby/build.rb +32 -15
- data/ext/enterprise_script_service/mruby/lib/mruby/build/command.rb +63 -17
- data/ext/enterprise_script_service/mruby/lib/mruby/build/load_gems.rb +24 -10
- data/ext/enterprise_script_service/mruby/lib/mruby/gem.rb +11 -7
- data/ext/enterprise_script_service/mruby/lib/mruby/lockfile.rb +81 -0
- data/ext/enterprise_script_service/mruby/minirake +27 -11
- data/ext/enterprise_script_service/mruby/mrbgems/default.gembox +3 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-array-ext/mrbgem.rake +0 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-array-ext/mrblib/array.rb +47 -9
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-array-ext/src/array.c +3 -3
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-array-ext/test/array.rb +50 -29
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.c +3 -3
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/apiprint.c +2 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/cmdprint.c +3 -3
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.c +2 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.h +1 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/mrdbconf.h +4 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mirb/tools/mirb/mirb.c +28 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mrbc/tools/mrbc/mrbc.c +1 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mruby/bintest/mruby.rb +75 -8
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c +134 -90
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-class-ext/src/class.c +7 -8
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/codegen.c +69 -46
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/keywords +0 -3
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/lex.def +51 -59
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/parse.y +430 -241
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-complex/mrbgem.rake +10 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-complex/mrblib/complex.rb +122 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-complex/src/complex.c +249 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-complex/test/complex.rb +153 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-enum-chain/mrblib/chain.rb +19 -17
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-enum-chain/test/enum_chain.rb +41 -9
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-enum-ext/mrblib/enum.rb +30 -4
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-enum-ext/test/enum.rb +8 -3
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-enumerator/mrbgem.rake +0 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-enumerator/mrblib/enumerator.rb +46 -14
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-enumerator/test/enumerator.rb +51 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-error/src/exception.c +10 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-eval/src/eval.c +47 -44
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-eval/test/eval.rb +2 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-exit/src/mruby-exit.c +9 -4
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-fiber/src/fiber.c +16 -12
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-fiber/test/fiber.rb +1 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-hash-ext/mrbgem.rake +0 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-hash-ext/mrblib/hash.rb +3 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-hash-ext/test/hash.rb +3 -7
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/README.md +1 -3
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/mrbgem.rake +1 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/mrblib/file.rb +0 -5
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/mrblib/io.rb +24 -38
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/mrblib/kernel.rb +16 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/src/file.c +19 -18
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/src/file_test.c +5 -16
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/src/io.c +54 -42
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/test/file.rb +24 -20
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/test/file_test.rb +4 -9
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/test/io.rb +41 -35
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/test/mruby_io_test.c +9 -36
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-kernel-ext/mrbgem.rake +1 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-kernel-ext/src/kernel.c +9 -27
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-kernel-ext/test/kernel.rb +2 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-math/src/math.c +5 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-metaprog/src/metaprog.c +39 -24
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-metaprog/test/metaprog.rb +48 -17
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-method/mrblib/method.rb +0 -12
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-method/src/method.c +134 -101
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-method/test/method.rb +9 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-numeric-ext/mrblib/numeric_ext.rb +1 -5
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-numeric-ext/src/numeric_ext.c +17 -37
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-numeric-ext/test/numeric.rb +0 -8
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-object-ext/mrbgem.rake +1 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-object-ext/mrblib/object.rb +15 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-object-ext/src/object.c +35 -6
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-object-ext/test/nil.rb +4 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-objectspace/src/mruby_objectspace.c +1 -5
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-objectspace/test/objectspace.rb +1 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/src/pack.c +28 -23
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/test/pack.rb +43 -49
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-print/mrblib/print.rb +3 -9
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-proc-ext/src/proc.c +6 -9
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-proc-ext/test/proc.rb +21 -5
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-random/src/random.c +157 -124
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-random/test/random.rb +72 -26
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-range-ext/mrblib/range.rb +38 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-range-ext/src/range.c +26 -11
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-range-ext/test/range.rb +111 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-rational/mrbgem.rake +5 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-rational/mrblib/rational.rb +117 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-rational/src/rational.c +209 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-rational/test/rational.rb +308 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-socket/README.md +1 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-socket/src/socket.c +10 -9
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-sprintf/src/kernel.c +2 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-sprintf/src/sprintf.c +22 -24
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/mrbgem.rake +0 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/mrblib/string.rb +8 -4
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/src/string.c +116 -117
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/test/numeric.rb +29 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/test/range.rb +26 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/test/string.rb +32 -50
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-struct/mrblib/struct.rb +5 -7
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-struct/src/struct.c +43 -57
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-struct/test/struct.rb +16 -11
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-symbol-ext/src/symbol.c +2 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-symbol-ext/test/symbol.rb +1 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-test/driver.c +152 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-test/mrbgem.rake +4 -3
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-test/vformat.c +200 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-time/include/mruby/time.h +2 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-time/src/time.c +199 -68
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-time/test/time.rb +81 -46
- data/ext/enterprise_script_service/mruby/mrblib/array.rb +14 -16
- data/ext/enterprise_script_service/mruby/mrblib/enum.rb +13 -9
- data/ext/enterprise_script_service/mruby/mrblib/hash.rb +5 -7
- data/ext/enterprise_script_service/mruby/mrblib/kernel.rb +1 -1
- data/ext/enterprise_script_service/mruby/mrblib/numeric.rb +4 -4
- data/ext/enterprise_script_service/mruby/mrblib/range.rb +1 -1
- data/ext/enterprise_script_service/mruby/mrblib/string.rb +55 -112
- data/ext/enterprise_script_service/mruby/mruby-source.gemspec +1 -1
- data/ext/enterprise_script_service/mruby/oss-fuzz/config/mruby.dict +105 -0
- data/ext/enterprise_script_service/mruby/oss-fuzz/config/mruby_fuzzer.options +5 -0
- data/ext/enterprise_script_service/mruby/oss-fuzz/config/mruby_proto_fuzzer.options +4 -0
- data/ext/enterprise_script_service/mruby/oss-fuzz/mruby_fuzzer.c +18 -0
- data/ext/enterprise_script_service/mruby/oss-fuzz/mruby_proto_fuzzer.cpp +44 -0
- data/ext/enterprise_script_service/mruby/oss-fuzz/proto_to_ruby.cpp +455 -0
- data/ext/enterprise_script_service/mruby/oss-fuzz/proto_to_ruby.h +55 -0
- data/ext/enterprise_script_service/mruby/oss-fuzz/ruby.proto +201 -0
- data/ext/enterprise_script_service/mruby/src/array.c +95 -46
- data/ext/enterprise_script_service/mruby/src/backtrace.c +6 -8
- data/ext/enterprise_script_service/mruby/src/class.c +370 -278
- data/ext/enterprise_script_service/mruby/src/codedump.c +34 -34
- data/ext/enterprise_script_service/mruby/src/debug.c +2 -2
- data/ext/enterprise_script_service/mruby/src/dump.c +8 -6
- data/ext/enterprise_script_service/mruby/src/enum.c +1 -1
- data/ext/enterprise_script_service/mruby/src/error.c +157 -55
- data/ext/enterprise_script_service/mruby/src/etc.c +13 -46
- data/ext/enterprise_script_service/mruby/src/fmt_fp.c +2 -2
- data/ext/enterprise_script_service/mruby/src/gc.c +30 -11
- data/ext/enterprise_script_service/mruby/src/hash.c +23 -14
- data/ext/enterprise_script_service/mruby/src/kernel.c +16 -54
- data/ext/enterprise_script_service/mruby/src/load.c +40 -76
- data/ext/enterprise_script_service/mruby/src/numeric.c +164 -94
- data/ext/enterprise_script_service/mruby/src/object.c +16 -39
- data/ext/enterprise_script_service/mruby/src/pool.c +0 -2
- data/ext/enterprise_script_service/mruby/src/proc.c +47 -48
- data/ext/enterprise_script_service/mruby/src/range.c +22 -35
- data/ext/enterprise_script_service/mruby/src/state.c +5 -94
- data/ext/enterprise_script_service/mruby/src/string.c +874 -710
- data/ext/enterprise_script_service/mruby/src/symbol.c +73 -48
- data/ext/enterprise_script_service/mruby/src/variable.c +58 -38
- data/ext/enterprise_script_service/mruby/src/vm.c +133 -304
- data/ext/enterprise_script_service/mruby/tasks/doc.rake +48 -0
- data/ext/enterprise_script_service/mruby/tasks/toolchains/clang.rake +3 -4
- data/ext/enterprise_script_service/mruby/tasks/toolchains/gcc.rake +20 -19
- data/ext/enterprise_script_service/mruby/tasks/toolchains/visualcpp.rake +0 -12
- data/ext/enterprise_script_service/mruby/test/assert.rb +186 -25
- data/ext/enterprise_script_service/mruby/test/t/array.rb +34 -6
- data/ext/enterprise_script_service/mruby/test/t/class.rb +26 -0
- data/ext/enterprise_script_service/mruby/test/t/enumerable.rb +2 -2
- data/ext/enterprise_script_service/mruby/test/t/float.rb +17 -17
- data/ext/enterprise_script_service/mruby/test/t/hash.rb +2 -0
- data/ext/enterprise_script_service/mruby/test/t/integer.rb +14 -6
- data/ext/enterprise_script_service/mruby/test/t/kernel.rb +38 -19
- data/ext/enterprise_script_service/mruby/test/t/module.rb +87 -14
- data/ext/enterprise_script_service/mruby/test/t/numeric.rb +65 -23
- data/ext/enterprise_script_service/mruby/test/t/range.rb +4 -4
- data/ext/enterprise_script_service/mruby/test/t/string.rb +211 -49
- data/ext/enterprise_script_service/mruby/test/t/syntax.rb +19 -2
- data/ext/enterprise_script_service/mruby/test/t/vformat.rb +92 -0
- data/ext/enterprise_script_service/mruby/travis_config.rb +2 -2
- data/ext/enterprise_script_service/mruby_config.rb +10 -0
- data/ext/enterprise_script_service/mruby_engine.cpp +2 -2
- data/ext/enterprise_script_service/mruby_engine.gembox +1 -0
- data/ext/enterprise_script_service/msgpack/CHANGELOG.md +14 -0
- data/ext/enterprise_script_service/msgpack/Files.cmake +4 -0
- data/ext/enterprise_script_service/msgpack/README.md +1 -1
- data/ext/enterprise_script_service/msgpack/appveyor.yml +1 -1
- data/ext/enterprise_script_service/msgpack/erb/v1/cpp03_msgpack_tuple.hpp.erb +1 -1
- data/ext/enterprise_script_service/msgpack/erb/v1/cpp03_msgpack_tuple_decl.hpp.erb +1 -1
- data/ext/enterprise_script_service/msgpack/erb/v1/cpp03_zone.hpp.erb +3 -3
- data/ext/enterprise_script_service/msgpack/example/boost/asio_send_recv.cpp +1 -1
- data/ext/enterprise_script_service/msgpack/include/msgpack/adaptor/cpp11/timespec.hpp +16 -0
- data/ext/enterprise_script_service/msgpack/include/msgpack/adaptor/wstring.hpp +15 -0
- data/ext/enterprise_script_service/msgpack/include/msgpack/object.h +2 -0
- data/ext/enterprise_script_service/msgpack/include/msgpack/pack_template.h +17 -9
- data/ext/enterprise_script_service/msgpack/include/msgpack/sysdep.h +27 -16
- data/ext/enterprise_script_service/msgpack/include/msgpack/type.hpp +2 -0
- data/ext/enterprise_script_service/msgpack/include/msgpack/unpack_template.h +5 -0
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/array_ref.hpp +0 -1
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/check_container_size.hpp +1 -1
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/cpp11/chrono.hpp +5 -5
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/cpp11/timespec.hpp +140 -0
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/detail/cpp03_msgpack_tuple.hpp +32 -32
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/detail/cpp03_msgpack_tuple_decl.hpp +32 -32
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/detail/cpp11_msgpack_tuple.hpp +6 -6
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/detail/cpp11_msgpack_tuple_decl.hpp +10 -10
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/ext.hpp +1 -1
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/fixint.hpp +5 -4
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/int.hpp +40 -13
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/int_decl.hpp +3 -2
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/wstring.hpp +121 -0
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/detail/cpp03_zone.hpp +3 -3
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/detail/cpp11_zone.hpp +3 -3
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/object.hpp +6 -6
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/object_fwd.hpp +1 -1
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/pack.hpp +40 -5
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/unpack.hpp +11 -11
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/vrefbuffer.hpp +7 -7
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/zbuffer.hpp +5 -5
- data/ext/enterprise_script_service/msgpack/include/msgpack/v2/adaptor/int_decl.hpp +1 -1
- data/ext/enterprise_script_service/msgpack/include/msgpack/v2/create_object_visitor.hpp +1 -1
- data/ext/enterprise_script_service/msgpack/include/msgpack/v2/parse.hpp +13 -13
- data/ext/enterprise_script_service/msgpack/include/msgpack/v2/x3_parse.hpp +28 -26
- data/ext/enterprise_script_service/msgpack/include/msgpack/v3/adaptor/int_decl.hpp +1 -1
- data/ext/enterprise_script_service/msgpack/include/msgpack/v3/parse.hpp +13 -13
- data/ext/enterprise_script_service/msgpack/include/msgpack/version_master.h +2 -2
- data/ext/enterprise_script_service/msgpack/include/msgpack/zbuffer.h +6 -6
- data/ext/enterprise_script_service/msgpack/include/msgpack/zone.h +1 -1
- data/ext/enterprise_script_service/msgpack/src/objectc.c +83 -148
- data/ext/enterprise_script_service/msgpack/src/unpack.c +73 -47
- data/ext/enterprise_script_service/msgpack/test/CMakeLists.txt +1 -1
- data/ext/enterprise_script_service/msgpack/test/array_ref.cpp +5 -0
- data/ext/enterprise_script_service/msgpack/test/boost_fusion.cpp +5 -0
- data/ext/enterprise_script_service/msgpack/test/boost_optional.cpp +7 -0
- data/ext/enterprise_script_service/msgpack/test/boost_string_ref.cpp +7 -0
- data/ext/enterprise_script_service/msgpack/test/boost_string_view.cpp +6 -0
- data/ext/enterprise_script_service/msgpack/test/boost_variant.cpp +15 -9
- data/ext/enterprise_script_service/msgpack/test/buffer.cpp +7 -0
- data/ext/enterprise_script_service/msgpack/test/carray.cpp +7 -0
- data/ext/enterprise_script_service/msgpack/test/cases.cpp +7 -1
- data/ext/enterprise_script_service/msgpack/test/convert.cpp +6 -0
- data/ext/enterprise_script_service/msgpack/test/fixint.cpp +7 -1
- data/ext/enterprise_script_service/msgpack/test/fixint_c.cpp +6 -1
- data/ext/enterprise_script_service/msgpack/test/fuzz_unpack_pack_fuzzer_cpp11.cpp +5 -0
- data/ext/enterprise_script_service/msgpack/test/iterator_cpp11.cpp +8 -2
- data/ext/enterprise_script_service/msgpack/test/json.cpp +6 -0
- data/ext/enterprise_script_service/msgpack/test/limit.cpp +7 -0
- data/ext/enterprise_script_service/msgpack/test/msgpack_basic.cpp +128 -6
- data/ext/enterprise_script_service/msgpack/test/msgpack_c.cpp +7 -2
- data/ext/enterprise_script_service/msgpack/test/msgpack_container.cpp +20 -3
- data/ext/enterprise_script_service/msgpack/test/msgpack_cpp11.cpp +159 -0
- data/ext/enterprise_script_service/msgpack/test/msgpack_cpp17.cpp +5 -0
- data/ext/enterprise_script_service/msgpack/test/msgpack_stream.cpp +8 -3
- data/ext/enterprise_script_service/msgpack/test/msgpack_tuple.cpp +6 -0
- data/ext/enterprise_script_service/msgpack/test/msgpack_vref.cpp +5 -0
- data/ext/enterprise_script_service/msgpack/test/msgpack_x3_parse.cpp +23 -18
- data/ext/enterprise_script_service/msgpack/test/object.cpp +77 -45
- data/ext/enterprise_script_service/msgpack/test/object_with_zone.cpp +28 -10
- data/ext/enterprise_script_service/msgpack/test/pack_unpack.cpp +25 -18
- data/ext/enterprise_script_service/msgpack/test/pack_unpack_c.cpp +7 -0
- data/ext/enterprise_script_service/msgpack/test/raw.cpp +17 -12
- data/ext/enterprise_script_service/msgpack/test/reference.cpp +6 -0
- data/ext/enterprise_script_service/msgpack/test/reference_cpp11.cpp +6 -0
- data/ext/enterprise_script_service/msgpack/test/reference_wrapper_cpp11.cpp +6 -0
- data/ext/enterprise_script_service/msgpack/test/shared_ptr_cpp11.cpp +6 -0
- data/ext/enterprise_script_service/msgpack/test/size_equal_only.cpp +6 -2
- data/ext/enterprise_script_service/msgpack/test/streaming.cpp +10 -3
- data/ext/enterprise_script_service/msgpack/test/streaming_c.cpp +7 -0
- data/ext/enterprise_script_service/msgpack/test/unique_ptr_cpp11.cpp +6 -0
- data/ext/enterprise_script_service/msgpack/test/user_class.cpp +5 -0
- data/ext/enterprise_script_service/msgpack/test/version.cpp +6 -0
- data/ext/enterprise_script_service/msgpack/test/visitor.cpp +7 -0
- data/ext/enterprise_script_service/msgpack/test/zone.cpp +6 -0
- data/lib/script_core/version.rb +1 -1
- data/lib/tasks/mruby/engine.gembox.example +1 -0
- data/lib/tasks/script_core.rake +21 -3
- data/spec/dummy/app/helpers/fields_helper.rb +2 -2
- data/spec/dummy/mruby/engine.gembox +1 -0
- data/spec/script_core_spec.rb +1 -1
- metadata +38 -22
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/.gitignore +0 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/.travis.yml +0 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/run_test.rb +0 -26
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-kernel-ext/mrblib/kernel.rb +0 -15
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-method/mrblib/unbound_method.rb +0 -9
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/.gitignore +0 -5
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/.travis.yml +0 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/packtest.rb +0 -157
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/run_test.rb +0 -26
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-random/src/mt19937ar.c +0 -224
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-random/src/mt19937ar.h +0 -80
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-random/src/random.h +0 -12
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-sleep/.gitignore +0 -4
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-sleep/.travis.yml +0 -29
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-sleep/.travis_build_config.rb +0 -6
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-sleep/Rakefile +0 -29
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-socket/.travis.yml +0 -4
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-socket/run_test.rb +0 -28
@@ -25,6 +25,10 @@
|
|
25
25
|
** [ MIT license: http://www.opensource.org/licenses/mit-license.php ]
|
26
26
|
*/
|
27
27
|
|
28
|
+
/**
|
29
|
+
* @file mruby.h
|
30
|
+
*/
|
31
|
+
|
28
32
|
#ifndef MRUBY_H
|
29
33
|
#define MRUBY_H
|
30
34
|
|
@@ -84,7 +88,7 @@
|
|
84
88
|
#endif
|
85
89
|
#endif
|
86
90
|
|
87
|
-
#include
|
91
|
+
#include <mruby/common.h>
|
88
92
|
#include <mruby/value.h>
|
89
93
|
#include <mruby/gc.h>
|
90
94
|
#include <mruby/version.h>
|
@@ -97,11 +101,14 @@ MRB_BEGIN_DECL
|
|
97
101
|
typedef uint8_t mrb_code;
|
98
102
|
|
99
103
|
/**
|
100
|
-
*
|
104
|
+
* \class mrb_aspec
|
105
|
+
*
|
106
|
+
* Specifies the number of arguments a function takes
|
107
|
+
*
|
108
|
+
* Example: `MRB_ARGS_REQ(2) | MRB_ARGS_OPT(1)` for a method that expects 2..3 arguments
|
101
109
|
*/
|
102
110
|
typedef uint32_t mrb_aspec;
|
103
111
|
|
104
|
-
|
105
112
|
struct mrb_irep;
|
106
113
|
struct mrb_state;
|
107
114
|
|
@@ -127,8 +134,8 @@ typedef struct {
|
|
127
134
|
uint16_t ridx;
|
128
135
|
uint16_t epos;
|
129
136
|
struct REnv *env;
|
130
|
-
mrb_code *pc;
|
131
|
-
mrb_code *err;
|
137
|
+
const mrb_code *pc; /* return address */
|
138
|
+
const mrb_code *err; /* error position */
|
132
139
|
int argc;
|
133
140
|
int acc;
|
134
141
|
struct RClass *target_class;
|
@@ -170,13 +177,22 @@ struct mrb_context {
|
|
170
177
|
# define MRB_METHOD_CACHE_SIZE (1<<7)
|
171
178
|
#endif
|
172
179
|
|
173
|
-
|
180
|
+
/**
|
181
|
+
* Function pointer type for a function callable by mruby.
|
182
|
+
*
|
183
|
+
* The arguments to the function are stored on the mrb_state. To get them see mrb_get_args
|
184
|
+
*
|
185
|
+
* @param mrb The mruby state
|
186
|
+
* @param self The self object
|
187
|
+
* @return [mrb_value] The function's return value
|
188
|
+
*/
|
189
|
+
typedef mrb_value (*mrb_func_t)(struct mrb_state *mrb, mrb_value self);
|
174
190
|
|
175
|
-
#
|
191
|
+
#ifndef MRB_METHOD_T_STRUCT
|
176
192
|
typedef uintptr_t mrb_method_t;
|
177
193
|
#else
|
178
194
|
typedef struct {
|
179
|
-
|
195
|
+
uint8_t flags;
|
180
196
|
union {
|
181
197
|
struct RProc *proc;
|
182
198
|
mrb_func_t func;
|
@@ -196,13 +212,9 @@ struct mrb_jmpbuf;
|
|
196
212
|
|
197
213
|
typedef void (*mrb_atexit_func)(struct mrb_state*);
|
198
214
|
|
199
|
-
#define MRB_STATE_NO_REGEXP 1
|
200
|
-
#define MRB_STATE_REGEXP 2
|
201
|
-
|
202
215
|
typedef struct mrb_state {
|
203
216
|
struct mrb_jmpbuf *jmp;
|
204
217
|
|
205
|
-
uint32_t flags;
|
206
218
|
mrb_allocf allocf; /* memory allocation function */
|
207
219
|
void *allocf_ud; /* auxiliary data of allocf */
|
208
220
|
|
@@ -232,7 +244,6 @@ typedef struct mrb_state {
|
|
232
244
|
struct RClass *symbol_class;
|
233
245
|
struct RClass *kernel_module;
|
234
246
|
|
235
|
-
struct alloca_header *mems;
|
236
247
|
mrb_gc gc;
|
237
248
|
|
238
249
|
#ifdef MRB_METHOD_CACHE
|
@@ -248,8 +259,8 @@ typedef struct mrb_state {
|
|
248
259
|
#endif
|
249
260
|
|
250
261
|
#ifdef MRB_ENABLE_DEBUG_HOOK
|
251
|
-
void (*code_fetch_hook)(struct mrb_state* mrb, struct mrb_irep *irep, mrb_code *pc, mrb_value *regs);
|
252
|
-
void (*debug_op_hook)(struct mrb_state* mrb, struct mrb_irep *irep, mrb_code *pc, mrb_value *regs);
|
262
|
+
void (*code_fetch_hook)(struct mrb_state* mrb, struct mrb_irep *irep, const mrb_code *pc, mrb_value *regs);
|
263
|
+
void (*debug_op_hook)(struct mrb_state* mrb, struct mrb_irep *irep, const mrb_code *pc, mrb_value *regs);
|
253
264
|
#endif
|
254
265
|
|
255
266
|
#ifdef MRB_BYTECODE_DECODE_OPTION
|
@@ -290,9 +301,9 @@ typedef struct mrb_state {
|
|
290
301
|
* //free(TheAnimals);
|
291
302
|
* }
|
292
303
|
*
|
293
|
-
* @param
|
294
|
-
* @param
|
295
|
-
* @param
|
304
|
+
* @param mrb The current mruby state.
|
305
|
+
* @param name The name of the defined class.
|
306
|
+
* @param super The new class parent.
|
296
307
|
* @return [struct RClass *] Reference to the newly defined class.
|
297
308
|
* @see mrb_define_class_under
|
298
309
|
*/
|
@@ -301,12 +312,12 @@ MRB_API struct RClass *mrb_define_class(mrb_state *mrb, const char *name, struct
|
|
301
312
|
/**
|
302
313
|
* Defines a new module.
|
303
314
|
*
|
304
|
-
* @param
|
305
|
-
* @param
|
315
|
+
* @param mrb The current mruby state.
|
316
|
+
* @param name The name of the module.
|
306
317
|
* @return [struct RClass *] Reference to the newly defined module.
|
307
318
|
*/
|
308
|
-
MRB_API struct RClass *mrb_define_module(mrb_state
|
309
|
-
MRB_API mrb_value mrb_singleton_class(mrb_state
|
319
|
+
MRB_API struct RClass *mrb_define_module(mrb_state *mrb, const char *name);
|
320
|
+
MRB_API mrb_value mrb_singleton_class(mrb_state *mrb, mrb_value val);
|
310
321
|
|
311
322
|
/**
|
312
323
|
* Include a module in another class or module.
|
@@ -315,11 +326,11 @@ MRB_API mrb_value mrb_singleton_class(mrb_state*, mrb_value);
|
|
315
326
|
* module B
|
316
327
|
* include A
|
317
328
|
* end
|
318
|
-
* @param
|
319
|
-
* @param
|
320
|
-
* @param
|
329
|
+
* @param mrb The current mruby state.
|
330
|
+
* @param cla A reference to module or a class.
|
331
|
+
* @param included A reference to the module to be included.
|
321
332
|
*/
|
322
|
-
MRB_API void mrb_include_module(mrb_state
|
333
|
+
MRB_API void mrb_include_module(mrb_state *mrb, struct RClass *cla, struct RClass *included);
|
323
334
|
|
324
335
|
/**
|
325
336
|
* Prepends a module in another class or module.
|
@@ -328,11 +339,11 @@ MRB_API void mrb_include_module(mrb_state*, struct RClass*, struct RClass*);
|
|
328
339
|
* module B
|
329
340
|
* prepend A
|
330
341
|
* end
|
331
|
-
* @param
|
332
|
-
* @param
|
333
|
-
* @param
|
342
|
+
* @param mrb The current mruby state.
|
343
|
+
* @param cla A reference to module or a class.
|
344
|
+
* @param prepended A reference to the module to be prepended.
|
334
345
|
*/
|
335
|
-
MRB_API void mrb_prepend_module(mrb_state
|
346
|
+
MRB_API void mrb_prepend_module(mrb_state *mrb, struct RClass *cla, struct RClass *prepended);
|
336
347
|
|
337
348
|
/**
|
338
349
|
* Defines a global function in ruby.
|
@@ -341,7 +352,6 @@ MRB_API void mrb_prepend_module(mrb_state*, struct RClass*, struct RClass*);
|
|
341
352
|
*
|
342
353
|
* Example:
|
343
354
|
*
|
344
|
-
* !!!c
|
345
355
|
* mrb_value example_method(mrb_state* mrb, mrb_value self)
|
346
356
|
* {
|
347
357
|
* puts("Executing example command!");
|
@@ -353,11 +363,11 @@ MRB_API void mrb_prepend_module(mrb_state*, struct RClass*, struct RClass*);
|
|
353
363
|
* mrb_define_method(mrb, mrb->kernel_module, "example_method", example_method, MRB_ARGS_NONE());
|
354
364
|
* }
|
355
365
|
*
|
356
|
-
* @param
|
357
|
-
* @param
|
358
|
-
* @param
|
359
|
-
* @param
|
360
|
-
* @param
|
366
|
+
* @param mrb The MRuby state reference.
|
367
|
+
* @param cla The class pointer where the method will be defined.
|
368
|
+
* @param name The name of the method being defined.
|
369
|
+
* @param func The function pointer to the method definition.
|
370
|
+
* @param aspec The method parameters declaration.
|
361
371
|
*/
|
362
372
|
MRB_API void mrb_define_method(mrb_state *mrb, struct RClass *cla, const char *name, mrb_func_t func, mrb_aspec aspec);
|
363
373
|
|
@@ -380,14 +390,20 @@ MRB_API void mrb_define_method(mrb_state *mrb, struct RClass *cla, const char *n
|
|
380
390
|
* foo = mrb_define_class(mrb, "Foo", mrb->object_class);
|
381
391
|
* mrb_define_class_method(mrb, foo, "bar", bar_method, MRB_ARGS_NONE());
|
382
392
|
* }
|
383
|
-
* @param
|
384
|
-
* @param
|
385
|
-
* @param
|
386
|
-
* @param
|
387
|
-
* @param
|
393
|
+
* @param mrb The MRuby state reference.
|
394
|
+
* @param cla The class where the class method will be defined.
|
395
|
+
* @param name The name of the class method being defined.
|
396
|
+
* @param fun The function pointer to the class method definition.
|
397
|
+
* @param aspec The method parameters declaration.
|
398
|
+
*/
|
399
|
+
MRB_API void mrb_define_class_method(mrb_state *mrb, struct RClass *cla, const char *name, mrb_func_t fun, mrb_aspec aspec);
|
400
|
+
|
401
|
+
/**
|
402
|
+
* Defines a singleton method
|
403
|
+
*
|
404
|
+
* @see mrb_define_class_method
|
388
405
|
*/
|
389
|
-
MRB_API void
|
390
|
-
MRB_API void mrb_define_singleton_method(mrb_state*, struct RObject*, const char*, mrb_func_t, mrb_aspec);
|
406
|
+
MRB_API void mrb_define_singleton_method(mrb_state *mrb, struct RObject *cla, const char *name, mrb_func_t fun, mrb_aspec aspec);
|
391
407
|
|
392
408
|
/**
|
393
409
|
* Defines a module function.
|
@@ -408,13 +424,13 @@ MRB_API void mrb_define_singleton_method(mrb_state*, struct RObject*, const char
|
|
408
424
|
* foo = mrb_define_module(mrb, "Foo");
|
409
425
|
* mrb_define_module_function(mrb, foo, "bar", bar_method, MRB_ARGS_NONE());
|
410
426
|
* }
|
411
|
-
* @param
|
412
|
-
* @param
|
413
|
-
* @param
|
414
|
-
* @param
|
415
|
-
* @param
|
427
|
+
* @param mrb The MRuby state reference.
|
428
|
+
* @param cla The module where the module function will be defined.
|
429
|
+
* @param name The name of the module function being defined.
|
430
|
+
* @param fun The function pointer to the module function definition.
|
431
|
+
* @param aspec The method parameters declaration.
|
416
432
|
*/
|
417
|
-
MRB_API void mrb_define_module_function(mrb_state
|
433
|
+
MRB_API void mrb_define_module_function(mrb_state *mrb, struct RClass *cla, const char *name, mrb_func_t fun, mrb_aspec aspec);
|
418
434
|
|
419
435
|
/**
|
420
436
|
* Defines a constant.
|
@@ -437,12 +453,12 @@ MRB_API void mrb_define_module_function(mrb_state*, struct RClass*, const char*,
|
|
437
453
|
* mrb_value
|
438
454
|
* mrb_example_gem_final(mrb_state* mrb){
|
439
455
|
* }
|
440
|
-
* @param
|
441
|
-
* @param
|
442
|
-
* @param
|
443
|
-
* @param
|
456
|
+
* @param mrb The MRuby state reference.
|
457
|
+
* @param cla A class or module the constant is defined in.
|
458
|
+
* @param name The name of the constant being defined.
|
459
|
+
* @param val The value for the constant.
|
444
460
|
*/
|
445
|
-
MRB_API void mrb_define_const(mrb_state
|
461
|
+
MRB_API void mrb_define_const(mrb_state* mrb, struct RClass* cla, const char *name, mrb_value val);
|
446
462
|
|
447
463
|
/**
|
448
464
|
* Undefines a method.
|
@@ -488,11 +504,11 @@ MRB_API void mrb_define_const(mrb_state*, struct RClass*, const char *name, mrb_
|
|
488
504
|
*
|
489
505
|
* mrb_example_gem_final(mrb_state* mrb){
|
490
506
|
* }
|
491
|
-
* @param
|
492
|
-
* @param
|
493
|
-
* @param
|
507
|
+
* @param mrb The mruby state reference.
|
508
|
+
* @param cla The class the method will be undefined from.
|
509
|
+
* @param name The name of the method to be undefined.
|
494
510
|
*/
|
495
|
-
MRB_API void mrb_undef_method(mrb_state
|
511
|
+
MRB_API void mrb_undef_method(mrb_state *mrb, struct RClass *cla, const char *name);
|
496
512
|
MRB_API void mrb_undef_method_id(mrb_state*, struct RClass*, mrb_sym);
|
497
513
|
|
498
514
|
/**
|
@@ -528,11 +544,11 @@ MRB_API void mrb_undef_method_id(mrb_state*, struct RClass*, mrb_sym);
|
|
528
544
|
* void
|
529
545
|
* mrb_example_gem_final(mrb_state* mrb){
|
530
546
|
* }
|
531
|
-
* @param
|
532
|
-
* @param
|
533
|
-
* @param
|
547
|
+
* @param mrb The mruby state reference.
|
548
|
+
* @param cls A class the class method will be undefined from.
|
549
|
+
* @param name The name of the class method to be undefined.
|
534
550
|
*/
|
535
|
-
MRB_API void mrb_undef_class_method(mrb_state
|
551
|
+
MRB_API void mrb_undef_class_method(mrb_state *mrb, struct RClass *cls, const char *name);
|
536
552
|
|
537
553
|
/**
|
538
554
|
* Initialize a new object instance of c class.
|
@@ -556,10 +572,10 @@ MRB_API void mrb_undef_class_method(mrb_state*, struct RClass*, const char*);
|
|
556
572
|
* obj = mrb_obj_new(mrb, example_class, 0, NULL); # => ExampleClass.new
|
557
573
|
* mrb_p(mrb, obj); // => Kernel#p
|
558
574
|
* }
|
559
|
-
* @param
|
560
|
-
* @param
|
561
|
-
* @param
|
562
|
-
* @param
|
575
|
+
* @param mrb The current mruby state.
|
576
|
+
* @param c Reference to the class of the new object.
|
577
|
+
* @param argc Number of arguments in argv
|
578
|
+
* @param argv Array of mrb_value to initialize the object
|
563
579
|
* @return [mrb_value] The newly initialized object
|
564
580
|
*/
|
565
581
|
MRB_API mrb_value mrb_obj_new(mrb_state *mrb, struct RClass *c, mrb_int argc, const mrb_value *argv);
|
@@ -570,8 +586,6 @@ MRB_INLINE mrb_value mrb_class_new_instance(mrb_state *mrb, mrb_int argc, const
|
|
570
586
|
return mrb_obj_new(mrb,c,argc,argv);
|
571
587
|
}
|
572
588
|
|
573
|
-
MRB_API mrb_value mrb_instance_new(mrb_state *mrb, mrb_value cv);
|
574
|
-
|
575
589
|
/**
|
576
590
|
* Creates a new instance of Class, Class.
|
577
591
|
*
|
@@ -587,8 +601,8 @@ MRB_API mrb_value mrb_instance_new(mrb_state *mrb, mrb_value cv);
|
|
587
601
|
* mrb_p(mrb, obj); // => Kernel#p
|
588
602
|
* }
|
589
603
|
*
|
590
|
-
* @param
|
591
|
-
* @param
|
604
|
+
* @param mrb The current mruby state.
|
605
|
+
* @param super The super class or parent.
|
592
606
|
* @return [struct RClass *] Reference to the new class.
|
593
607
|
*/
|
594
608
|
MRB_API struct RClass * mrb_class_new(mrb_state *mrb, struct RClass *super);
|
@@ -604,7 +618,7 @@ MRB_API struct RClass * mrb_class_new(mrb_state *mrb, struct RClass *super);
|
|
604
618
|
* example_module = mrb_module_new(mrb);
|
605
619
|
* }
|
606
620
|
*
|
607
|
-
* @param
|
621
|
+
* @param mrb The current mruby state.
|
608
622
|
* @return [struct RClass *] Reference to the new module.
|
609
623
|
*/
|
610
624
|
MRB_API struct RClass * mrb_module_new(mrb_state *mrb);
|
@@ -631,24 +645,24 @@ MRB_API struct RClass * mrb_module_new(mrb_state *mrb);
|
|
631
645
|
* }
|
632
646
|
* }
|
633
647
|
*
|
634
|
-
* @param
|
635
|
-
* @param
|
648
|
+
* @param mrb The current mruby state.
|
649
|
+
* @param name A string representing the name of the class.
|
636
650
|
* @return [mrb_bool] A boolean value.
|
637
651
|
*/
|
638
652
|
MRB_API mrb_bool mrb_class_defined(mrb_state *mrb, const char *name);
|
639
653
|
|
640
654
|
/**
|
641
655
|
* Gets a class.
|
642
|
-
* @param
|
643
|
-
* @param
|
656
|
+
* @param mrb The current mruby state.
|
657
|
+
* @param name The name of the class.
|
644
658
|
* @return [struct RClass *] A reference to the class.
|
645
659
|
*/
|
646
660
|
MRB_API struct RClass * mrb_class_get(mrb_state *mrb, const char *name);
|
647
661
|
|
648
662
|
/**
|
649
663
|
* Gets a exception class.
|
650
|
-
* @param
|
651
|
-
* @param
|
664
|
+
* @param mrb The current mruby state.
|
665
|
+
* @param name The name of the class.
|
652
666
|
* @return [struct RClass *] A reference to the class.
|
653
667
|
*/
|
654
668
|
MRB_API struct RClass * mrb_exc_get(mrb_state *mrb, const char *name);
|
@@ -677,35 +691,35 @@ MRB_API struct RClass * mrb_exc_get(mrb_state *mrb, const char *name);
|
|
677
691
|
* }
|
678
692
|
* }
|
679
693
|
*
|
680
|
-
* @param
|
681
|
-
* @param
|
682
|
-
* @param
|
694
|
+
* @param mrb The current mruby state.
|
695
|
+
* @param outer The name of the outer class.
|
696
|
+
* @param name A string representing the name of the inner class.
|
683
697
|
* @return [mrb_bool] A boolean value.
|
684
698
|
*/
|
685
699
|
MRB_API mrb_bool mrb_class_defined_under(mrb_state *mrb, struct RClass *outer, const char *name);
|
686
700
|
|
687
701
|
/**
|
688
702
|
* Gets a child class.
|
689
|
-
* @param
|
690
|
-
* @param
|
691
|
-
* @param
|
703
|
+
* @param mrb The current mruby state.
|
704
|
+
* @param outer The name of the parent class.
|
705
|
+
* @param name The name of the class.
|
692
706
|
* @return [struct RClass *] A reference to the class.
|
693
707
|
*/
|
694
708
|
MRB_API struct RClass * mrb_class_get_under(mrb_state *mrb, struct RClass *outer, const char *name);
|
695
709
|
|
696
710
|
/**
|
697
711
|
* Gets a module.
|
698
|
-
* @param
|
699
|
-
* @param
|
712
|
+
* @param mrb The current mruby state.
|
713
|
+
* @param name The name of the module.
|
700
714
|
* @return [struct RClass *] A reference to the module.
|
701
715
|
*/
|
702
716
|
MRB_API struct RClass * mrb_module_get(mrb_state *mrb, const char *name);
|
703
717
|
|
704
718
|
/**
|
705
719
|
* Gets a module defined under another module.
|
706
|
-
* @param
|
707
|
-
* @param
|
708
|
-
* @param
|
720
|
+
* @param mrb The current mruby state.
|
721
|
+
* @param outer The name of the outer module.
|
722
|
+
* @param name The name of the module.
|
709
723
|
* @return [struct RClass *] A reference to the module.
|
710
724
|
*/
|
711
725
|
MRB_API struct RClass * mrb_module_get_under(mrb_state *mrb, struct RClass *outer, const char *name);
|
@@ -719,8 +733,8 @@ MRB_API mrb_value mrb_notimplement_m(mrb_state*, mrb_value);
|
|
719
733
|
*
|
720
734
|
* Equivalent to:
|
721
735
|
* Object#dup
|
722
|
-
* @param
|
723
|
-
* @param
|
736
|
+
* @param mrb The current mruby state.
|
737
|
+
* @param obj Object to be duplicate.
|
724
738
|
* @return [mrb_value] The newly duplicated object.
|
725
739
|
*/
|
726
740
|
MRB_API mrb_value mrb_obj_dup(mrb_state *mrb, mrb_value obj);
|
@@ -760,9 +774,9 @@ MRB_API mrb_value mrb_obj_dup(mrb_state *mrb, mrb_value obj);
|
|
760
774
|
* }
|
761
775
|
* }
|
762
776
|
*
|
763
|
-
* @param
|
764
|
-
* @param
|
765
|
-
* @param
|
777
|
+
* @param mrb The current mruby state.
|
778
|
+
* @param c A reference to a class.
|
779
|
+
* @param mid A symbol referencing a method id.
|
766
780
|
* @return [mrb_bool] A boolean value.
|
767
781
|
*/
|
768
782
|
MRB_API mrb_bool mrb_obj_respond_to(mrb_state *mrb, struct RClass* c, mrb_sym mid);
|
@@ -770,10 +784,10 @@ MRB_API mrb_bool mrb_obj_respond_to(mrb_state *mrb, struct RClass* c, mrb_sym mi
|
|
770
784
|
/**
|
771
785
|
* Defines a new class under a given module
|
772
786
|
*
|
773
|
-
* @param
|
774
|
-
* @param
|
775
|
-
* @param
|
776
|
-
* @param
|
787
|
+
* @param mrb The current mruby state.
|
788
|
+
* @param outer Reference to the module under which the new class will be defined
|
789
|
+
* @param name The name of the defined class
|
790
|
+
* @param super The new class parent
|
777
791
|
* @return [struct RClass *] Reference to the newly defined class
|
778
792
|
* @see mrb_define_class
|
779
793
|
*/
|
@@ -843,34 +857,93 @@ MRB_API struct RClass * mrb_define_module_under(mrb_state *mrb, struct RClass *o
|
|
843
857
|
* | `S` | {String} | {mrb_value} | when `!` follows, the value may be `nil` |
|
844
858
|
* | `A` | {Array} | {mrb_value} | when `!` follows, the value may be `nil` |
|
845
859
|
* | `H` | {Hash} | {mrb_value} | when `!` follows, the value may be `nil` |
|
846
|
-
* | `s` | {String} | char *, {mrb_int} | Receive two arguments; `s!` gives (`NULL`,`0`) for `nil`
|
860
|
+
* | `s` | {String} | char *, {mrb_int} | Receive two arguments; `s!` gives (`NULL`,`0`) for `nil` |
|
847
861
|
* | `z` | {String} | char * | `NULL` terminated string; `z!` gives `NULL` for `nil` |
|
848
862
|
* | `a` | {Array} | {mrb_value} *, {mrb_int} | Receive two arguments; `a!` gives (`NULL`,`0`) for `nil` |
|
849
|
-
* | `f` | {Float}
|
850
|
-
* | `i` | {
|
863
|
+
* | `f` | {Fixnum}/{Float} | {mrb_float} | |
|
864
|
+
* | `i` | {Fixnum}/{Float} | {mrb_int} | |
|
851
865
|
* | `b` | boolean | {mrb_bool} | |
|
852
|
-
* | `n` | {Symbol}
|
866
|
+
* | `n` | {String}/{Symbol} | {mrb_sym} | |
|
867
|
+
* | `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` |
|
868
|
+
* | `I` | inline struct | void * | |
|
853
869
|
* | `&` | block | {mrb_value} | &! raises exception if no block given. |
|
854
|
-
* | `*` | rest arguments | {mrb_value} *, {mrb_int} | Receive the rest of arguments as an array;
|
855
|
-
* |
|
870
|
+
* | `*` | rest arguments | {mrb_value} *, {mrb_int} | Receive the rest of arguments as an array; `*!` avoid copy of the stack. |
|
871
|
+
* | <code>\|</code> | optional | | After this spec following specs would be optional. |
|
856
872
|
* | `?` | optional given | {mrb_bool} | `TRUE` if preceding argument is given. Used to check optional argument is given. |
|
873
|
+
* | `:` | keyword args | {mrb_kwargs} const | Get keyword arguments. @see mrb_kwargs |
|
857
874
|
*
|
858
875
|
* @see mrb_get_args
|
859
876
|
*/
|
860
877
|
typedef const char *mrb_args_format;
|
861
878
|
|
879
|
+
/**
|
880
|
+
* Get keyword arguments by `mrb_get_args()` with `:` specifier.
|
881
|
+
*
|
882
|
+
* `mrb_kwargs::num` indicates that the number of keyword values.
|
883
|
+
*
|
884
|
+
* `mrb_kwargs::values` is an object array, and the keyword argument corresponding to the string array is assigned.
|
885
|
+
* Note that `undef` is assigned if there is no keyword argument corresponding to `mrb_kwargs::optional`.
|
886
|
+
*
|
887
|
+
* `mrb_kwargs::table` accepts a string array.
|
888
|
+
*
|
889
|
+
* `mrb_kwargs::required` indicates that the specified number of keywords starting from the beginning of the string array are required.
|
890
|
+
*
|
891
|
+
* `mrb_kwargs::rest` is the remaining keyword argument that can be accepted as `**rest` in Ruby.
|
892
|
+
* If `NULL` is specified, `ArgumentError` is raised when there is an undefined keyword.
|
893
|
+
*
|
894
|
+
* Examples:
|
895
|
+
*
|
896
|
+
* // def method(a: 1, b: 2)
|
897
|
+
*
|
898
|
+
* uint32_t kw_num = 2;
|
899
|
+
* const char *kw_names[kw_num] = { "a", "b" };
|
900
|
+
* uint32_t kw_required = 0;
|
901
|
+
* mrb_value kw_values[kw_num];
|
902
|
+
* const mrb_kwargs kwargs = { kw_num, kw_values, kw_names, kw_required, NULL };
|
903
|
+
*
|
904
|
+
* mrb_get_args(mrb, ":", &kwargs);
|
905
|
+
* if (mrb_undef_p(kw_values[0])) { kw_values[0] = mrb_fixnum_value(1); }
|
906
|
+
* if (mrb_undef_p(kw_values[1])) { kw_values[1] = mrb_fixnum_value(2); }
|
907
|
+
*
|
908
|
+
*
|
909
|
+
* // def method(str, x:, y: 2, z: "default string", **opts)
|
910
|
+
*
|
911
|
+
* mrb_value str, kw_rest;
|
912
|
+
* uint32_t kw_num = 3;
|
913
|
+
* const char *kw_names[kw_num] = { "x", "y", "z" };
|
914
|
+
* uint32_t kw_required = 1;
|
915
|
+
* mrb_value kw_values[kw_num];
|
916
|
+
* const mrb_kwargs kwargs = { kw_num, kw_values, kw_names, kw_required, &kw_rest };
|
917
|
+
*
|
918
|
+
* mrb_get_args(mrb, "S:", &str, &kwargs);
|
919
|
+
* // or: mrb_get_args(mrb, ":S", &kwargs, &str);
|
920
|
+
* if (mrb_undef_p(kw_values[1])) { kw_values[1] = mrb_fixnum_value(2); }
|
921
|
+
* if (mrb_undef_p(kw_values[2])) { kw_values[2] = mrb_str_new_cstr(mrb, "default string"); }
|
922
|
+
*/
|
923
|
+
typedef struct mrb_kwargs mrb_kwargs;
|
924
|
+
|
925
|
+
struct mrb_kwargs
|
926
|
+
{
|
927
|
+
uint32_t num;
|
928
|
+
mrb_value *values;
|
929
|
+
const char *const *table;
|
930
|
+
uint32_t required;
|
931
|
+
mrb_value *rest;
|
932
|
+
};
|
933
|
+
|
862
934
|
/**
|
863
935
|
* Retrieve arguments from mrb_state.
|
864
936
|
*
|
865
937
|
* @param mrb The current MRuby state.
|
866
|
-
* @param format
|
938
|
+
* @param format is a list of format specifiers
|
867
939
|
* @param ... The passing variadic arguments must be a pointer of retrieving type.
|
868
940
|
* @return the number of arguments retrieved.
|
869
941
|
* @see mrb_args_format
|
942
|
+
* @see mrb_kwargs
|
870
943
|
*/
|
871
944
|
MRB_API mrb_int mrb_get_args(mrb_state *mrb, mrb_args_format format, ...);
|
872
945
|
|
873
|
-
|
946
|
+
MRB_INLINE mrb_sym
|
874
947
|
mrb_get_mid(mrb_state *mrb) /* get method symbol */
|
875
948
|
{
|
876
949
|
return mrb->c->ci->mid;
|
@@ -896,6 +969,8 @@ MRB_API mrb_value* mrb_get_argv(mrb_state *mrb);
|
|
896
969
|
/**
|
897
970
|
* Call existing ruby functions.
|
898
971
|
*
|
972
|
+
* Example:
|
973
|
+
*
|
899
974
|
* #include <stdio.h>
|
900
975
|
* #include <mruby.h>
|
901
976
|
* #include "mruby/compile.h"
|
@@ -912,15 +987,16 @@ MRB_API mrb_value* mrb_get_argv(mrb_state *mrb);
|
|
912
987
|
* mrb_funcall(mrb, obj, "method_name", 1, mrb_fixnum_value(i));
|
913
988
|
* fclose(fp);
|
914
989
|
* mrb_close(mrb);
|
915
|
-
*
|
916
|
-
*
|
917
|
-
* @param
|
918
|
-
* @param
|
919
|
-
* @param
|
920
|
-
* @param
|
921
|
-
* @
|
990
|
+
* }
|
991
|
+
*
|
992
|
+
* @param mrb The current mruby state.
|
993
|
+
* @param val A reference to an mruby value.
|
994
|
+
* @param name The name of the method.
|
995
|
+
* @param argc The number of arguments the method has.
|
996
|
+
* @param ... Variadic values(not type safe!).
|
997
|
+
* @return [mrb_value] mruby function value.
|
922
998
|
*/
|
923
|
-
MRB_API mrb_value mrb_funcall(mrb_state
|
999
|
+
MRB_API mrb_value mrb_funcall(mrb_state *mrb, mrb_value val, const char *name, mrb_int argc, ...);
|
924
1000
|
/**
|
925
1001
|
* Call existing ruby functions. This is basically the type safe version of mrb_funcall.
|
926
1002
|
*
|
@@ -942,32 +1018,35 @@ MRB_API mrb_value mrb_funcall(mrb_state*, mrb_value, const char*, mrb_int,...);
|
|
942
1018
|
* fclose(fp);
|
943
1019
|
* mrb_close(mrb);
|
944
1020
|
* }
|
945
|
-
* @param
|
946
|
-
* @param
|
947
|
-
* @param
|
948
|
-
* @param
|
949
|
-
* @param
|
1021
|
+
* @param mrb The current mruby state.
|
1022
|
+
* @param val A reference to an mruby value.
|
1023
|
+
* @param name_sym The symbol representing the method.
|
1024
|
+
* @param argc The number of arguments the method has.
|
1025
|
+
* @param obj Pointer to the object.
|
950
1026
|
* @return [mrb_value] mrb_value mruby function value.
|
951
1027
|
* @see mrb_funcall
|
952
1028
|
*/
|
953
|
-
MRB_API mrb_value mrb_funcall_argv(mrb_state
|
1029
|
+
MRB_API mrb_value mrb_funcall_argv(mrb_state *mrb, mrb_value val, mrb_sym name, mrb_int argc, const mrb_value *argv);
|
954
1030
|
/**
|
955
1031
|
* Call existing ruby functions with a block.
|
956
1032
|
*/
|
957
|
-
MRB_API mrb_value mrb_funcall_with_block(mrb_state
|
1033
|
+
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);
|
958
1034
|
/**
|
959
1035
|
* Create a symbol
|
960
1036
|
*
|
1037
|
+
* Example:
|
1038
|
+
*
|
961
1039
|
* # Ruby style:
|
962
1040
|
* :pizza # => :pizza
|
963
1041
|
*
|
964
1042
|
* // C style:
|
965
1043
|
* mrb_sym m_sym = mrb_intern_lit(mrb, "pizza"); // => :pizza
|
966
|
-
*
|
967
|
-
* @param
|
1044
|
+
*
|
1045
|
+
* @param mrb The current mruby state.
|
1046
|
+
* @param str The string to be symbolized
|
968
1047
|
* @return [mrb_sym] mrb_sym A symbol.
|
969
1048
|
*/
|
970
|
-
MRB_API mrb_sym mrb_intern_cstr(mrb_state
|
1049
|
+
MRB_API mrb_sym mrb_intern_cstr(mrb_state *mrb, const char* str);
|
971
1050
|
MRB_API mrb_sym mrb_intern(mrb_state*,const char*,size_t);
|
972
1051
|
MRB_API mrb_sym mrb_intern_static(mrb_state*,const char*,size_t);
|
973
1052
|
#define mrb_intern_lit(mrb, lit) mrb_intern_static(mrb, lit, mrb_strlen_lit(lit))
|
@@ -975,9 +1054,13 @@ MRB_API mrb_sym mrb_intern_str(mrb_state*,mrb_value);
|
|
975
1054
|
MRB_API mrb_value mrb_check_intern_cstr(mrb_state*,const char*);
|
976
1055
|
MRB_API mrb_value mrb_check_intern(mrb_state*,const char*,size_t);
|
977
1056
|
MRB_API mrb_value mrb_check_intern_str(mrb_state*,mrb_value);
|
978
|
-
MRB_API const char *
|
979
|
-
MRB_API const char *
|
980
|
-
MRB_API
|
1057
|
+
MRB_API const char *mrb_sym_name(mrb_state*,mrb_sym);
|
1058
|
+
MRB_API const char *mrb_sym_name_len(mrb_state*,mrb_sym,mrb_int*);
|
1059
|
+
MRB_API const char *mrb_sym_dump(mrb_state*,mrb_sym);
|
1060
|
+
MRB_API mrb_value mrb_sym_str(mrb_state*,mrb_sym);
|
1061
|
+
#define mrb_sym2name(mrb,sym) mrb_sym_name(mrb,sym)
|
1062
|
+
#define mrb_sym2name_len(mrb,sym,len) mrb_sym_name_len(mrb,sym,len)
|
1063
|
+
#define mrb_sym2str(mrb,sym) mrb_sym_str(mrb,sym)
|
981
1064
|
|
982
1065
|
MRB_API void *mrb_malloc(mrb_state*, size_t); /* raise RuntimeError if no mem */
|
983
1066
|
MRB_API void *mrb_calloc(mrb_state*, size_t, size_t); /* ditto */
|
@@ -996,6 +1079,12 @@ MRB_API mrb_value mrb_str_new_cstr(mrb_state*, const char*);
|
|
996
1079
|
MRB_API mrb_value mrb_str_new_static(mrb_state *mrb, const char *p, size_t len);
|
997
1080
|
#define mrb_str_new_lit(mrb, lit) mrb_str_new_static(mrb, (lit), mrb_strlen_lit(lit))
|
998
1081
|
|
1082
|
+
MRB_API mrb_value mrb_obj_freeze(mrb_state*, mrb_value);
|
1083
|
+
#define mrb_str_new_frozen(mrb,p,len) mrb_obj_freeze(mrb,mrb_str_new(mrb,p,len))
|
1084
|
+
#define mrb_str_new_cstr_frozen(mrb,p) mrb_obj_freeze(mrb,mrb_str_new_cstr(mrb,p))
|
1085
|
+
#define mrb_str_new_static_frozen(mrb,p,len) mrb_obj_freeze(mrb,mrb_str_new_static(mrb,p,len))
|
1086
|
+
#define mrb_str_new_lit_frozen(mrb,lit) mrb_obj_freeze(mrb,mrb_str_new_lit(mrb,lit))
|
1087
|
+
|
999
1088
|
#ifdef _WIN32
|
1000
1089
|
MRB_API char* mrb_utf8_from_locale(const char *p, int len);
|
1001
1090
|
MRB_API char* mrb_locale_from_utf8(const char *p, int len);
|
@@ -1058,11 +1147,11 @@ MRB_API void mrb_close(mrb_state *mrb);
|
|
1058
1147
|
*/
|
1059
1148
|
MRB_API void* mrb_default_allocf(mrb_state*, void*, size_t, void*);
|
1060
1149
|
|
1061
|
-
MRB_API mrb_value mrb_top_self(mrb_state *);
|
1062
|
-
MRB_API mrb_value mrb_run(mrb_state
|
1063
|
-
MRB_API mrb_value mrb_top_run(mrb_state
|
1064
|
-
MRB_API mrb_value mrb_vm_run(mrb_state
|
1065
|
-
MRB_API mrb_value mrb_vm_exec(mrb_state
|
1150
|
+
MRB_API mrb_value mrb_top_self(mrb_state *mrb);
|
1151
|
+
MRB_API mrb_value mrb_run(mrb_state *mrb, struct RProc* proc, mrb_value self);
|
1152
|
+
MRB_API mrb_value mrb_top_run(mrb_state *mrb, struct RProc *proc, mrb_value self, unsigned int stack_keep);
|
1153
|
+
MRB_API mrb_value mrb_vm_run(mrb_state *mrb, struct RProc *proc, mrb_value self, unsigned int stack_keep);
|
1154
|
+
MRB_API mrb_value mrb_vm_exec(mrb_state *mrb, struct RProc *proc, const mrb_code *iseq);
|
1066
1155
|
/* compatibility macros */
|
1067
1156
|
#define mrb_toplevel_run_keep(m,p,k) mrb_top_run((m),(p),mrb_top_self(m),(k))
|
1068
1157
|
#define mrb_toplevel_run(m,p) mrb_toplevel_run_keep((m),(p),0)
|
@@ -1072,8 +1161,8 @@ MRB_API void mrb_p(mrb_state*, mrb_value);
|
|
1072
1161
|
MRB_API mrb_int mrb_obj_id(mrb_value obj);
|
1073
1162
|
MRB_API mrb_sym mrb_obj_to_sym(mrb_state *mrb, mrb_value name);
|
1074
1163
|
|
1075
|
-
MRB_API mrb_bool mrb_obj_eq(mrb_state
|
1076
|
-
MRB_API mrb_bool mrb_obj_equal(mrb_state
|
1164
|
+
MRB_API mrb_bool mrb_obj_eq(mrb_state *mrb, mrb_value a, mrb_value b);
|
1165
|
+
MRB_API mrb_bool mrb_obj_equal(mrb_state *mrb, mrb_value a, mrb_value b);
|
1077
1166
|
MRB_API mrb_bool mrb_equal(mrb_state *mrb, mrb_value obj1, mrb_value obj2);
|
1078
1167
|
MRB_API mrb_value mrb_convert_to_integer(mrb_state *mrb, mrb_value val, mrb_int base);
|
1079
1168
|
MRB_API mrb_value mrb_Integer(mrb_state *mrb, mrb_value val);
|
@@ -1082,17 +1171,16 @@ MRB_API mrb_value mrb_Float(mrb_state *mrb, mrb_value val);
|
|
1082
1171
|
#endif
|
1083
1172
|
MRB_API mrb_value mrb_inspect(mrb_state *mrb, mrb_value obj);
|
1084
1173
|
MRB_API mrb_bool mrb_eql(mrb_state *mrb, mrb_value obj1, mrb_value obj2);
|
1174
|
+
/* mrb_cmp(mrb, obj1, obj2): 1:0:-1; -2 for error */
|
1175
|
+
MRB_API mrb_int mrb_cmp(mrb_state *mrb, mrb_value obj1, mrb_value obj2);
|
1085
1176
|
|
1086
|
-
|
1087
|
-
static inline void mrb_gc_arena_restore(mrb_state*,int);
|
1088
|
-
|
1089
|
-
static inline int
|
1177
|
+
MRB_INLINE int
|
1090
1178
|
mrb_gc_arena_save(mrb_state *mrb)
|
1091
1179
|
{
|
1092
1180
|
return mrb->gc.arena_idx;
|
1093
1181
|
}
|
1094
1182
|
|
1095
|
-
|
1183
|
+
MRB_INLINE void
|
1096
1184
|
mrb_gc_arena_restore(mrb_state *mrb, int idx)
|
1097
1185
|
{
|
1098
1186
|
mrb->gc.arena_idx = idx;
|
@@ -1143,6 +1231,7 @@ MRB_API mrb_noreturn void mrb_exc_raise(mrb_state *mrb, mrb_value exc);
|
|
1143
1231
|
MRB_API mrb_noreturn void mrb_raise(mrb_state *mrb, struct RClass *c, const char *msg);
|
1144
1232
|
MRB_API mrb_noreturn void mrb_raisef(mrb_state *mrb, struct RClass *c, const char *fmt, ...);
|
1145
1233
|
MRB_API mrb_noreturn void mrb_name_error(mrb_state *mrb, mrb_sym id, const char *fmt, ...);
|
1234
|
+
MRB_API mrb_noreturn void mrb_frozen_error(mrb_state *mrb, void *frozen_obj);
|
1146
1235
|
MRB_API void mrb_warn(mrb_state *mrb, const char *fmt, ...);
|
1147
1236
|
MRB_API mrb_noreturn void mrb_bug(mrb_state *mrb, const char *fmt, ...);
|
1148
1237
|
MRB_API void mrb_print_backtrace(mrb_state *mrb);
|
@@ -1193,9 +1282,15 @@ MRB_API void mrb_gc_unregister(mrb_state *mrb, mrb_value obj);
|
|
1193
1282
|
|
1194
1283
|
MRB_API mrb_value mrb_to_int(mrb_state *mrb, mrb_value val);
|
1195
1284
|
#define mrb_int(mrb, val) mrb_fixnum(mrb_to_int(mrb, val))
|
1285
|
+
/* string type checking (contrary to the name, it doesn't convert) */
|
1196
1286
|
MRB_API mrb_value mrb_to_str(mrb_state *mrb, mrb_value val);
|
1197
1287
|
MRB_API void mrb_check_type(mrb_state *mrb, mrb_value x, enum mrb_vtype t);
|
1198
1288
|
|
1289
|
+
MRB_INLINE void mrb_check_frozen(mrb_state *mrb, void *o)
|
1290
|
+
{
|
1291
|
+
if (mrb_frozen_p((struct RBasic*)o)) mrb_frozen_error(mrb, o);
|
1292
|
+
}
|
1293
|
+
|
1199
1294
|
typedef enum call_type {
|
1200
1295
|
CALL_PUBLIC,
|
1201
1296
|
CALL_FCALL,
|
@@ -1214,31 +1309,31 @@ MRB_API mrb_bool mrb_obj_is_instance_of(mrb_state *mrb, mrb_value obj, struct RC
|
|
1214
1309
|
MRB_API mrb_bool mrb_func_basic_p(mrb_state *mrb, mrb_value obj, mrb_sym mid, mrb_func_t func);
|
1215
1310
|
|
1216
1311
|
|
1217
|
-
|
1312
|
+
/**
|
1218
1313
|
* Resume a Fiber
|
1219
1314
|
*
|
1220
|
-
*
|
1315
|
+
* Implemented in mruby-fiber
|
1221
1316
|
*/
|
1222
1317
|
MRB_API mrb_value mrb_fiber_resume(mrb_state *mrb, mrb_value fib, mrb_int argc, const mrb_value *argv);
|
1223
1318
|
|
1224
|
-
|
1319
|
+
/**
|
1225
1320
|
* Yield a Fiber
|
1226
1321
|
*
|
1227
|
-
*
|
1322
|
+
* Implemented in mruby-fiber
|
1228
1323
|
*/
|
1229
1324
|
MRB_API mrb_value mrb_fiber_yield(mrb_state *mrb, mrb_int argc, const mrb_value *argv);
|
1230
1325
|
|
1231
|
-
|
1326
|
+
/**
|
1232
1327
|
* Check if a Fiber is alive
|
1233
1328
|
*
|
1234
|
-
*
|
1329
|
+
* Implemented in mruby-fiber
|
1235
1330
|
*/
|
1236
1331
|
MRB_API mrb_value mrb_fiber_alive_p(mrb_state *mrb, mrb_value fib);
|
1237
1332
|
|
1238
|
-
|
1333
|
+
/**
|
1239
1334
|
* FiberError reference
|
1240
1335
|
*
|
1241
|
-
*
|
1336
|
+
* Implemented in mruby-fiber
|
1242
1337
|
*/
|
1243
1338
|
#define E_FIBER_ERROR (mrb_exc_get(mrb, "FiberError"))
|
1244
1339
|
MRB_API void mrb_stack_extend(mrb_state*, mrb_int);
|
@@ -1250,6 +1345,7 @@ MRB_API void mrb_pool_close(struct mrb_pool*);
|
|
1250
1345
|
MRB_API void* mrb_pool_alloc(struct mrb_pool*, size_t);
|
1251
1346
|
MRB_API void* mrb_pool_realloc(struct mrb_pool*, void*, size_t oldlen, size_t newlen);
|
1252
1347
|
MRB_API mrb_bool mrb_pool_can_realloc(struct mrb_pool*, void*, size_t);
|
1348
|
+
/* temporary memory allocation, only effective while GC arena is kept */
|
1253
1349
|
MRB_API void* mrb_alloca(mrb_state *mrb, size_t);
|
1254
1350
|
|
1255
1351
|
MRB_API void mrb_state_atexit(mrb_state *mrb, mrb_atexit_func func);
|