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
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
** etc.c
|
2
|
+
** etc.c
|
3
3
|
**
|
4
4
|
** See Copyright Notice in mruby.h
|
5
5
|
*/
|
@@ -8,8 +8,6 @@
|
|
8
8
|
#include <mruby/string.h>
|
9
9
|
#include <mruby/data.h>
|
10
10
|
#include <mruby/class.h>
|
11
|
-
#include <mruby/re.h>
|
12
|
-
#include <mruby/irep.h>
|
13
11
|
|
14
12
|
MRB_API struct RData*
|
15
13
|
mrb_data_object_alloc(mrb_state *mrb, struct RClass *klass, void *ptr, const mrb_data_type *type)
|
@@ -26,21 +24,19 @@ mrb_data_object_alloc(mrb_state *mrb, struct RClass *klass, void *ptr, const mrb
|
|
26
24
|
MRB_API void
|
27
25
|
mrb_data_check_type(mrb_state *mrb, mrb_value obj, const mrb_data_type *type)
|
28
26
|
{
|
29
|
-
if (
|
27
|
+
if (!mrb_data_p(obj)) {
|
30
28
|
mrb_check_type(mrb, obj, MRB_TT_DATA);
|
31
29
|
}
|
32
30
|
if (DATA_TYPE(obj) != type) {
|
33
31
|
const mrb_data_type *t2 = DATA_TYPE(obj);
|
34
32
|
|
35
33
|
if (t2) {
|
36
|
-
mrb_raisef(mrb, E_TYPE_ERROR, "wrong argument type %
|
37
|
-
|
34
|
+
mrb_raisef(mrb, E_TYPE_ERROR, "wrong argument type %s (expected %s)",
|
35
|
+
t2->struct_name, type->struct_name);
|
38
36
|
}
|
39
37
|
else {
|
40
|
-
|
41
|
-
|
42
|
-
mrb_raisef(mrb, E_TYPE_ERROR, "uninitialized %S (expected %S)",
|
43
|
-
mrb_obj_value(c), mrb_str_new_cstr(mrb, type->struct_name));
|
38
|
+
mrb_raisef(mrb, E_TYPE_ERROR, "uninitialized %t (expected %s)",
|
39
|
+
obj, type->struct_name);
|
44
40
|
}
|
45
41
|
}
|
46
42
|
}
|
@@ -48,7 +44,7 @@ mrb_data_check_type(mrb_state *mrb, mrb_value obj, const mrb_data_type *type)
|
|
48
44
|
MRB_API void*
|
49
45
|
mrb_data_check_get_ptr(mrb_state *mrb, mrb_value obj, const mrb_data_type *type)
|
50
46
|
{
|
51
|
-
if (
|
47
|
+
if (!mrb_data_p(obj)) {
|
52
48
|
return NULL;
|
53
49
|
}
|
54
50
|
if (DATA_TYPE(obj) != type) {
|
@@ -67,24 +63,10 @@ mrb_data_get_ptr(mrb_state *mrb, mrb_value obj, const mrb_data_type *type)
|
|
67
63
|
MRB_API mrb_sym
|
68
64
|
mrb_obj_to_sym(mrb_state *mrb, mrb_value name)
|
69
65
|
{
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
name = mrb_check_string_type(mrb, name);
|
75
|
-
if (mrb_nil_p(name)) {
|
76
|
-
name = mrb_inspect(mrb, name);
|
77
|
-
mrb_raisef(mrb, E_TYPE_ERROR, "%S is not a symbol", name);
|
78
|
-
/* not reached */
|
79
|
-
}
|
80
|
-
/* fall through */
|
81
|
-
case MRB_TT_STRING:
|
82
|
-
name = mrb_str_intern(mrb, name);
|
83
|
-
/* fall through */
|
84
|
-
case MRB_TT_SYMBOL:
|
85
|
-
id = mrb_symbol(name);
|
86
|
-
}
|
87
|
-
return id;
|
66
|
+
if (mrb_symbol_p(name)) return mrb_symbol(name);
|
67
|
+
if (mrb_string_p(name)) return mrb_intern_str(mrb, name);
|
68
|
+
mrb_raisef(mrb, E_TYPE_ERROR, "%!v is not a symbol nor a string", name);
|
69
|
+
return 0; /* not reached */
|
88
70
|
}
|
89
71
|
|
90
72
|
MRB_API mrb_int
|
@@ -167,6 +149,7 @@ mrb_word_boxing_float_value(mrb_state *mrb, mrb_float f)
|
|
167
149
|
|
168
150
|
v.value.p = mrb_obj_alloc(mrb, MRB_TT_FLOAT, mrb->float_class);
|
169
151
|
v.value.fp->f = f;
|
152
|
+
MRB_SET_FROZEN_FLAG(v.value.bp);
|
170
153
|
return v;
|
171
154
|
}
|
172
155
|
|
@@ -177,6 +160,7 @@ mrb_word_boxing_float_pool(mrb_state *mrb, mrb_float f)
|
|
177
160
|
nf->tt = MRB_TT_FLOAT;
|
178
161
|
nf->c = mrb->float_class;
|
179
162
|
nf->f = f;
|
163
|
+
MRB_SET_FROZEN_FLAG(nf);
|
180
164
|
return mrb_obj_value(nf);
|
181
165
|
}
|
182
166
|
#endif /* MRB_WITHOUT_FLOAT */
|
@@ -192,23 +176,6 @@ mrb_word_boxing_cptr_value(mrb_state *mrb, void *p)
|
|
192
176
|
}
|
193
177
|
#endif /* MRB_WORD_BOXING */
|
194
178
|
|
195
|
-
MRB_API mrb_bool
|
196
|
-
mrb_regexp_p(mrb_state *mrb, mrb_value v)
|
197
|
-
{
|
198
|
-
if (mrb->flags & MRB_STATE_NO_REGEXP) {
|
199
|
-
return FALSE;
|
200
|
-
}
|
201
|
-
if ((mrb->flags & MRB_STATE_REGEXP) || mrb_class_defined(mrb, REGEXP_CLASS)) {
|
202
|
-
mrb->flags |= MRB_STATE_REGEXP;
|
203
|
-
return mrb_obj_is_kind_of(mrb, v, mrb_class_get(mrb, REGEXP_CLASS));
|
204
|
-
}
|
205
|
-
else {
|
206
|
-
mrb->flags |= MRB_STATE_REGEXP;
|
207
|
-
mrb->flags |= MRB_STATE_NO_REGEXP;
|
208
|
-
}
|
209
|
-
return FALSE;
|
210
|
-
}
|
211
|
-
|
212
179
|
#if defined _MSC_VER && _MSC_VER < 1900
|
213
180
|
|
214
181
|
#ifndef va_copy
|
@@ -372,7 +372,7 @@ mrb_float_to_str(mrb_state *mrb, mrb_value flo, const char *fmt)
|
|
372
372
|
}
|
373
373
|
return f.str;
|
374
374
|
}
|
375
|
-
#else /* MRB_DISABLE_STDIO */
|
375
|
+
#else /* MRB_DISABLE_STDIO || _WIN32 || _WIN64 */
|
376
376
|
#include <mruby.h>
|
377
377
|
#include <stdio.h>
|
378
378
|
|
@@ -384,5 +384,5 @@ mrb_float_to_str(mrb_state *mrb, mrb_value flo, const char *fmt)
|
|
384
384
|
snprintf(buf, sizeof(buf), fmt, mrb_float(flo));
|
385
385
|
return mrb_str_new_cstr(mrb, buf);
|
386
386
|
}
|
387
|
-
#endif /* MRB_DISABLE_STDIO */
|
387
|
+
#endif /* MRB_DISABLE_STDIO || _WIN32 || _WIN64 */
|
388
388
|
#endif
|
@@ -10,6 +10,7 @@
|
|
10
10
|
#include <mruby/array.h>
|
11
11
|
#include <mruby/class.h>
|
12
12
|
#include <mruby/data.h>
|
13
|
+
#include <mruby/istruct.h>
|
13
14
|
#include <mruby/hash.h>
|
14
15
|
#include <mruby/proc.h>
|
15
16
|
#include <mruby/range.h>
|
@@ -109,8 +110,10 @@ typedef struct {
|
|
109
110
|
struct RHash hash;
|
110
111
|
struct RRange range;
|
111
112
|
struct RData data;
|
113
|
+
struct RIStruct istruct;
|
112
114
|
struct RProc proc;
|
113
115
|
struct REnv env;
|
116
|
+
struct RFiber fiber;
|
114
117
|
struct RException exc;
|
115
118
|
struct RBreak brk;
|
116
119
|
#ifdef MRB_WORD_BOXING
|
@@ -274,6 +277,13 @@ mrb_free(mrb_state *mrb, void *p)
|
|
274
277
|
(mrb->allocf)(mrb, p, 0, mrb->allocf_ud);
|
275
278
|
}
|
276
279
|
|
280
|
+
MRB_API void*
|
281
|
+
mrb_alloca(mrb_state *mrb, size_t size)
|
282
|
+
{
|
283
|
+
mrb_value str = mrb_str_new(mrb, NULL, size);
|
284
|
+
return RSTRING_PTR(str);
|
285
|
+
}
|
286
|
+
|
277
287
|
static mrb_bool
|
278
288
|
heap_p(mrb_gc *gc, struct RBasic *object)
|
279
289
|
{
|
@@ -396,7 +406,7 @@ mrb_gc_init(mrb_state *mrb, mrb_gc *gc)
|
|
396
406
|
|
397
407
|
static void obj_free(mrb_state *mrb, struct RBasic *obj, int end);
|
398
408
|
|
399
|
-
void
|
409
|
+
static void
|
400
410
|
free_heap(mrb_state *mrb, mrb_gc *gc)
|
401
411
|
{
|
402
412
|
mrb_heap_page *page = gc->heaps;
|
@@ -463,10 +473,13 @@ mrb_gc_protect(mrb_state *mrb, mrb_value obj)
|
|
463
473
|
MRB_API void
|
464
474
|
mrb_gc_register(mrb_state *mrb, mrb_value obj)
|
465
475
|
{
|
466
|
-
mrb_sym root
|
467
|
-
mrb_value table
|
476
|
+
mrb_sym root;
|
477
|
+
mrb_value table;
|
468
478
|
|
469
|
-
if (
|
479
|
+
if (mrb_immediate_p(obj)) return;
|
480
|
+
root = mrb_intern_lit(mrb, GC_ROOT_NAME);
|
481
|
+
table = mrb_gv_get(mrb, root);
|
482
|
+
if (mrb_nil_p(table) || !mrb_array_p(table)) {
|
470
483
|
table = mrb_ary_new(mrb);
|
471
484
|
mrb_gv_set(mrb, root, table);
|
472
485
|
}
|
@@ -477,20 +490,23 @@ mrb_gc_register(mrb_state *mrb, mrb_value obj)
|
|
477
490
|
MRB_API void
|
478
491
|
mrb_gc_unregister(mrb_state *mrb, mrb_value obj)
|
479
492
|
{
|
480
|
-
mrb_sym root
|
481
|
-
mrb_value table
|
493
|
+
mrb_sym root;
|
494
|
+
mrb_value table;
|
482
495
|
struct RArray *a;
|
483
496
|
mrb_int i;
|
484
497
|
|
498
|
+
if (mrb_immediate_p(obj)) return;
|
499
|
+
root = mrb_intern_lit(mrb, GC_ROOT_NAME);
|
500
|
+
table = mrb_gv_get(mrb, root);
|
485
501
|
if (mrb_nil_p(table)) return;
|
486
|
-
if (
|
502
|
+
if (!mrb_array_p(table)) {
|
487
503
|
mrb_gv_set(mrb, root, mrb_nil_value());
|
488
504
|
return;
|
489
505
|
}
|
490
506
|
a = mrb_ary_ptr(table);
|
491
507
|
mrb_ary_modify(mrb, a);
|
492
508
|
for (i = 0; i < ARY_LEN(a); i++) {
|
493
|
-
if (
|
509
|
+
if (mrb_ptr(ARY_PTR(a)[i]) == mrb_ptr(obj)) {
|
494
510
|
mrb_int len = ARY_LEN(a)-1;
|
495
511
|
mrb_value *ptr = ARY_PTR(a);
|
496
512
|
|
@@ -505,7 +521,7 @@ MRB_API struct RBasic*
|
|
505
521
|
mrb_obj_alloc(mrb_state *mrb, enum mrb_vtype ttype, struct RClass *cls)
|
506
522
|
{
|
507
523
|
struct RBasic *p;
|
508
|
-
static const RVALUE RVALUE_zero = { { { MRB_TT_FALSE } } };
|
524
|
+
static const RVALUE RVALUE_zero = { { { NULL, NULL, MRB_TT_FALSE } } };
|
509
525
|
mrb_gc *gc = &mrb->gc;
|
510
526
|
|
511
527
|
if (cls) {
|
@@ -526,7 +542,7 @@ mrb_obj_alloc(mrb_state *mrb, enum mrb_vtype ttype, struct RClass *cls)
|
|
526
542
|
ttype != MRB_TT_ICLASS &&
|
527
543
|
ttype != MRB_TT_ENV &&
|
528
544
|
ttype != tt) {
|
529
|
-
mrb_raisef(mrb, E_TYPE_ERROR, "allocation failure of %
|
545
|
+
mrb_raisef(mrb, E_TYPE_ERROR, "allocation failure of %C", cls);
|
530
546
|
}
|
531
547
|
}
|
532
548
|
|
@@ -732,7 +748,7 @@ gc_mark_children(mrb_state *mrb, mrb_gc *gc, struct RBasic *obj)
|
|
732
748
|
break;
|
733
749
|
|
734
750
|
case MRB_TT_STRING:
|
735
|
-
if (RSTR_FSHARED_P(obj)
|
751
|
+
if (RSTR_FSHARED_P(obj)) {
|
736
752
|
struct RString *s = (struct RString*)obj;
|
737
753
|
mrb_gc_mark(mrb, (struct RBasic*)s->as.heap.aux.fshared);
|
738
754
|
}
|
@@ -1593,6 +1609,9 @@ mrb_init_gc(mrb_state *mrb)
|
|
1593
1609
|
{
|
1594
1610
|
struct RClass *gc;
|
1595
1611
|
|
1612
|
+
mrb_static_assert(sizeof(RVALUE) <= sizeof(void*) * 6,
|
1613
|
+
"RVALUE size must be within 6 words");
|
1614
|
+
|
1596
1615
|
gc = mrb_define_module(mrb, "GC");
|
1597
1616
|
|
1598
1617
|
mrb_define_class_method(mrb, gc, "start", gc_start, MRB_ARGS_NONE());
|
@@ -92,7 +92,7 @@ ht_hash_equal(mrb_state *mrb, htable *t, mrb_value a, mrb_value b)
|
|
92
92
|
return mrb_str_equal(mrb, a, b);
|
93
93
|
|
94
94
|
case MRB_TT_SYMBOL:
|
95
|
-
if (
|
95
|
+
if (!mrb_symbol_p(b)) return FALSE;
|
96
96
|
return mrb_symbol(a) == mrb_symbol(b);
|
97
97
|
|
98
98
|
case MRB_TT_FIXNUM:
|
@@ -182,7 +182,7 @@ ht_index(mrb_state *mrb, htable *t)
|
|
182
182
|
if (!index || index->capa < size) {
|
183
183
|
index = (segindex*)mrb_realloc_simple(mrb, index, sizeof(segindex)+sizeof(struct segkv*)*size);
|
184
184
|
if (index == NULL) {
|
185
|
-
mrb_free(mrb, index);
|
185
|
+
mrb_free(mrb, t->index);
|
186
186
|
t->index = NULL;
|
187
187
|
return;
|
188
188
|
}
|
@@ -240,7 +240,7 @@ ht_compact(mrb_state *mrb, htable *t)
|
|
240
240
|
if (!seg->next && i >= t->last_len) {
|
241
241
|
goto exit;
|
242
242
|
}
|
243
|
-
if (mrb_undef_p(k)) { /* found
|
243
|
+
if (mrb_undef_p(k)) { /* found deleted key */
|
244
244
|
if (seg2 == NULL) {
|
245
245
|
seg2 = seg;
|
246
246
|
i2 = i;
|
@@ -546,6 +546,7 @@ ht_copy(mrb_state *mrb, htable *t)
|
|
546
546
|
if ((seg->next == NULL) && (i >= t->last_len)) {
|
547
547
|
return t2;
|
548
548
|
}
|
549
|
+
if (mrb_undef_p(key)) continue; /* skip deleted key */
|
549
550
|
ht_put(mrb, t2, key, val);
|
550
551
|
}
|
551
552
|
seg = seg->next;
|
@@ -575,7 +576,7 @@ static void mrb_hash_modify(mrb_state *mrb, mrb_value hash);
|
|
575
576
|
static inline mrb_value
|
576
577
|
ht_key(mrb_state *mrb, mrb_value key)
|
577
578
|
{
|
578
|
-
if (mrb_string_p(key) && !
|
579
|
+
if (mrb_string_p(key) && !mrb_frozen_p(mrb_str_ptr(key))) {
|
579
580
|
key = mrb_str_dup(mrb, key);
|
580
581
|
MRB_SET_FROZEN_FLAG(mrb_str_ptr(key));
|
581
582
|
}
|
@@ -746,10 +747,7 @@ mrb_hash_set(mrb_state *mrb, mrb_value hash, mrb_value key, mrb_value val)
|
|
746
747
|
static void
|
747
748
|
mrb_hash_modify(mrb_state *mrb, mrb_value hash)
|
748
749
|
{
|
749
|
-
|
750
|
-
mrb_raise(mrb, E_FROZEN_ERROR, "can't modify frozen hash");
|
751
|
-
}
|
752
|
-
|
750
|
+
mrb_check_frozen(mrb, mrb_hash_ptr(hash));
|
753
751
|
if (!RHASH_TBL(hash)) {
|
754
752
|
RHASH_TBL(hash) = ht_new(mrb);
|
755
753
|
}
|
@@ -1381,10 +1379,21 @@ mrb_hash_merge(mrb_state *mrb, mrb_value hash1, mrb_value hash2)
|
|
1381
1379
|
* values of key objects have changed since they were inserted, this
|
1382
1380
|
* method will reindex <i>hsh</i>.
|
1383
1381
|
*
|
1384
|
-
*
|
1385
|
-
*
|
1386
|
-
* h
|
1387
|
-
* h[
|
1382
|
+
* keys = (1..17).map{|n| [n]}
|
1383
|
+
* k = keys[0]
|
1384
|
+
* h = {}
|
1385
|
+
* keys.each{|key| h[key] = key[0]}
|
1386
|
+
* h #=> { [1]=> 1, [2]=> 2, [3]=> 3, [4]=> 4, [5]=> 5, [6]=> 6, [7]=> 7,
|
1387
|
+
* [8]=> 8, [9]=> 9,[10]=>10,[11]=>11,[12]=>12,[13]=>13,[14]=>14,
|
1388
|
+
* [15]=>15,[16]=>16,[17]=>17}
|
1389
|
+
* h[k] #=> 1
|
1390
|
+
* k[0] = keys.size + 1
|
1391
|
+
* h #=> {[18]=> 1, [2]=> 2, [3]=> 3, [4]=> 4, [5]=> 5, [6]=> 6, [7]=> 7,
|
1392
|
+
* [8]=> 8, [9]=> 9,[10]=>10,[11]=>11,[12]=>12,[13]=>13,[14]=>14,
|
1393
|
+
* [15]=>15,[16]=>16,[17]=>17}
|
1394
|
+
* h[k] #=> nil
|
1395
|
+
* h.rehash
|
1396
|
+
* h[k] #=> 1
|
1388
1397
|
*/
|
1389
1398
|
static mrb_value
|
1390
1399
|
mrb_hash_rehash(mrb_state *mrb, mrb_value self)
|
@@ -1405,7 +1414,7 @@ mrb_init_hash(mrb_state *mrb)
|
|
1405
1414
|
mrb_define_method(mrb, h, "[]", mrb_hash_aget, MRB_ARGS_REQ(1)); /* 15.2.13.4.2 */
|
1406
1415
|
mrb_define_method(mrb, h, "[]=", mrb_hash_aset, MRB_ARGS_REQ(2)); /* 15.2.13.4.3 */
|
1407
1416
|
mrb_define_method(mrb, h, "clear", mrb_hash_clear, MRB_ARGS_NONE()); /* 15.2.13.4.4 */
|
1408
|
-
mrb_define_method(mrb, h, "default", mrb_hash_default,
|
1417
|
+
mrb_define_method(mrb, h, "default", mrb_hash_default, MRB_ARGS_OPT(1)); /* 15.2.13.4.5 */
|
1409
1418
|
mrb_define_method(mrb, h, "default=", mrb_hash_set_default, MRB_ARGS_REQ(1)); /* 15.2.13.4.6 */
|
1410
1419
|
mrb_define_method(mrb, h, "default_proc", mrb_hash_default_proc,MRB_ARGS_NONE()); /* 15.2.13.4.7 */
|
1411
1420
|
mrb_define_method(mrb, h, "default_proc=", mrb_hash_set_default_proc,MRB_ARGS_REQ(1)); /* 15.2.13.4.7 */
|
@@ -1414,7 +1423,7 @@ mrb_init_hash(mrb_state *mrb)
|
|
1414
1423
|
mrb_define_method(mrb, h, "has_key?", mrb_hash_has_key, MRB_ARGS_REQ(1)); /* 15.2.13.4.13 */
|
1415
1424
|
mrb_define_method(mrb, h, "has_value?", mrb_hash_has_value, MRB_ARGS_REQ(1)); /* 15.2.13.4.14 */
|
1416
1425
|
mrb_define_method(mrb, h, "include?", mrb_hash_has_key, MRB_ARGS_REQ(1)); /* 15.2.13.4.15 */
|
1417
|
-
mrb_define_method(mrb, h, "initialize", mrb_hash_init, MRB_ARGS_OPT(1)); /* 15.2.13.4.16 */
|
1426
|
+
mrb_define_method(mrb, h, "initialize", mrb_hash_init, MRB_ARGS_OPT(1)|MRB_ARGS_BLOCK()); /* 15.2.13.4.16 */
|
1418
1427
|
mrb_define_method(mrb, h, "key?", mrb_hash_has_key, MRB_ARGS_REQ(1)); /* 15.2.13.4.18 */
|
1419
1428
|
mrb_define_method(mrb, h, "keys", mrb_hash_keys, MRB_ARGS_NONE()); /* 15.2.13.4.19 */
|
1420
1429
|
mrb_define_method(mrb, h, "length", mrb_hash_size_m, MRB_ARGS_NONE()); /* 15.2.13.4.20 */
|
@@ -53,7 +53,7 @@ mrb_obj_basic_to_s_p(mrb_state *mrb, mrb_value obj)
|
|
53
53
|
MRB_API mrb_value
|
54
54
|
mrb_obj_inspect(mrb_state *mrb, mrb_value obj)
|
55
55
|
{
|
56
|
-
if ((
|
56
|
+
if (mrb_object_p(obj) && mrb_obj_basic_to_s_p(mrb, obj)) {
|
57
57
|
return mrb_obj_iv_inspect(mrb, mrb_obj_ptr(obj));
|
58
58
|
}
|
59
59
|
return mrb_any_to_s(mrb, obj);
|
@@ -325,9 +325,9 @@ mrb_obj_clone(mrb_state *mrb, mrb_value self)
|
|
325
325
|
mrb_value clone;
|
326
326
|
|
327
327
|
if (mrb_immediate_p(self)) {
|
328
|
-
mrb_raisef(mrb, E_TYPE_ERROR, "can't clone %
|
328
|
+
mrb_raisef(mrb, E_TYPE_ERROR, "can't clone %v", self);
|
329
329
|
}
|
330
|
-
if (
|
330
|
+
if (mrb_sclass_p(self)) {
|
331
331
|
mrb_raise(mrb, E_TYPE_ERROR, "can't clone singleton class");
|
332
332
|
}
|
333
333
|
p = (struct RObject*)mrb_obj_alloc(mrb, mrb_type(self), mrb_obj_class(mrb, self));
|
@@ -366,9 +366,9 @@ mrb_obj_dup(mrb_state *mrb, mrb_value obj)
|
|
366
366
|
mrb_value dup;
|
367
367
|
|
368
368
|
if (mrb_immediate_p(obj)) {
|
369
|
-
mrb_raisef(mrb, E_TYPE_ERROR, "can't dup %
|
369
|
+
mrb_raisef(mrb, E_TYPE_ERROR, "can't dup %v", obj);
|
370
370
|
}
|
371
|
-
if (
|
371
|
+
if (mrb_sclass_p(obj)) {
|
372
372
|
mrb_raise(mrb, E_TYPE_ERROR, "can't dup singleton class");
|
373
373
|
}
|
374
374
|
p = mrb_obj_alloc(mrb, mrb_type(obj), mrb_obj_class(mrb, obj));
|
@@ -431,27 +431,15 @@ mrb_obj_extend_m(mrb_state *mrb, mrb_value self)
|
|
431
431
|
return mrb_obj_extend(mrb, argc, argv, self);
|
432
432
|
}
|
433
433
|
|
434
|
-
|
434
|
+
MRB_API mrb_value
|
435
435
|
mrb_obj_freeze(mrb_state *mrb, mrb_value self)
|
436
436
|
{
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
case MRB_TT_SYMBOL:
|
444
|
-
#ifndef MRB_WITHOUT_FLOAT
|
445
|
-
case MRB_TT_FLOAT:
|
446
|
-
#endif
|
447
|
-
return self;
|
448
|
-
default:
|
449
|
-
break;
|
450
|
-
}
|
451
|
-
|
452
|
-
b = mrb_basic_ptr(self);
|
453
|
-
if (!MRB_FROZEN_P(b)) {
|
454
|
-
MRB_SET_FROZEN_FLAG(b);
|
437
|
+
if (!mrb_immediate_p(self)) {
|
438
|
+
struct RBasic *b = mrb_basic_ptr(self);
|
439
|
+
if (!mrb_frozen_p(b)) {
|
440
|
+
MRB_SET_FROZEN_FLAG(b);
|
441
|
+
if (b->c->tt == MRB_TT_SCLASS) MRB_SET_FROZEN_FLAG(b->c);
|
442
|
+
}
|
455
443
|
}
|
456
444
|
return self;
|
457
445
|
}
|
@@ -459,26 +447,7 @@ mrb_obj_freeze(mrb_state *mrb, mrb_value self)
|
|
459
447
|
static mrb_value
|
460
448
|
mrb_obj_frozen(mrb_state *mrb, mrb_value self)
|
461
449
|
{
|
462
|
-
|
463
|
-
|
464
|
-
switch (mrb_type(self)) {
|
465
|
-
case MRB_TT_FALSE:
|
466
|
-
case MRB_TT_TRUE:
|
467
|
-
case MRB_TT_FIXNUM:
|
468
|
-
case MRB_TT_SYMBOL:
|
469
|
-
#ifndef MRB_WITHOUT_FLOAT
|
470
|
-
case MRB_TT_FLOAT:
|
471
|
-
#endif
|
472
|
-
return mrb_true_value();
|
473
|
-
default:
|
474
|
-
break;
|
475
|
-
}
|
476
|
-
|
477
|
-
b = mrb_basic_ptr(self);
|
478
|
-
if (!MRB_FROZEN_P(b)) {
|
479
|
-
return mrb_false_value();
|
480
|
-
}
|
481
|
-
return mrb_true_value();
|
450
|
+
return mrb_bool_value(mrb_immediate_p(self) || mrb_frozen_p(mrb_basic_ptr(self)));
|
482
451
|
}
|
483
452
|
|
484
453
|
/* 15.3.1.3.15 */
|
@@ -672,7 +641,7 @@ mrb_obj_remove_instance_variable(mrb_state *mrb, mrb_value self)
|
|
672
641
|
mrb_iv_name_sym_check(mrb, sym);
|
673
642
|
val = mrb_iv_remove(mrb, self, sym);
|
674
643
|
if (mrb_undef_p(val)) {
|
675
|
-
mrb_name_error(mrb, sym, "instance variable %
|
644
|
+
mrb_name_error(mrb, sym, "instance variable %n not defined", sym);
|
676
645
|
}
|
677
646
|
return val;
|
678
647
|
}
|
@@ -680,7 +649,7 @@ mrb_obj_remove_instance_variable(mrb_state *mrb, mrb_value self)
|
|
680
649
|
void
|
681
650
|
mrb_method_missing(mrb_state *mrb, mrb_sym name, mrb_value self, mrb_value args)
|
682
651
|
{
|
683
|
-
mrb_no_method_error(mrb, name, args, "undefined method '%
|
652
|
+
mrb_no_method_error(mrb, name, args, "undefined method '%n'", name);
|
684
653
|
}
|
685
654
|
|
686
655
|
/* 15.3.1.3.30 */
|
@@ -716,7 +685,6 @@ mrb_method_missing(mrb_state *mrb, mrb_sym name, mrb_value self, mrb_value args)
|
|
716
685
|
* r.xxiii #=> 23
|
717
686
|
* r.mm #=> 2000
|
718
687
|
*/
|
719
|
-
#ifdef MRB_DEFAULT_METHOD_MISSING
|
720
688
|
static mrb_value
|
721
689
|
mrb_obj_missing(mrb_state *mrb, mrb_value mod)
|
722
690
|
{
|
@@ -729,7 +697,6 @@ mrb_obj_missing(mrb_state *mrb, mrb_value mod)
|
|
729
697
|
/* not reached */
|
730
698
|
return mrb_nil_value();
|
731
699
|
}
|
732
|
-
#endif
|
733
700
|
|
734
701
|
static inline mrb_bool
|
735
702
|
basic_obj_respond_to(mrb_state *mrb, mrb_value obj, mrb_sym id, int pub)
|
@@ -811,11 +778,9 @@ mrb_init_kernel(mrb_state *mrb)
|
|
811
778
|
mrb_define_method(mrb, krn, "clone", mrb_obj_clone, MRB_ARGS_NONE()); /* 15.3.1.3.8 */
|
812
779
|
mrb_define_method(mrb, krn, "dup", mrb_obj_dup, MRB_ARGS_NONE()); /* 15.3.1.3.9 */
|
813
780
|
mrb_define_method(mrb, krn, "eql?", mrb_obj_equal_m, MRB_ARGS_REQ(1)); /* 15.3.1.3.10 */
|
814
|
-
mrb_define_method(mrb, krn, "equal?", mrb_obj_equal_m, MRB_ARGS_REQ(1)); /* 15.3.1.3.11 */
|
815
781
|
mrb_define_method(mrb, krn, "extend", mrb_obj_extend_m, MRB_ARGS_ANY()); /* 15.3.1.3.13 */
|
816
782
|
mrb_define_method(mrb, krn, "freeze", mrb_obj_freeze, MRB_ARGS_NONE());
|
817
783
|
mrb_define_method(mrb, krn, "frozen?", mrb_obj_frozen, MRB_ARGS_NONE());
|
818
|
-
mrb_define_method(mrb, krn, "global_variables", mrb_f_global_variables, MRB_ARGS_NONE()); /* 15.3.1.3.14 */
|
819
784
|
mrb_define_method(mrb, krn, "hash", mrb_obj_hash, MRB_ARGS_NONE()); /* 15.3.1.3.15 */
|
820
785
|
mrb_define_method(mrb, krn, "initialize_copy", mrb_obj_init_copy, MRB_ARGS_REQ(1)); /* 15.3.1.3.16 */
|
821
786
|
mrb_define_method(mrb, krn, "inspect", mrb_obj_inspect, MRB_ARGS_NONE()); /* 15.3.1.3.17 */
|
@@ -824,19 +789,16 @@ mrb_init_kernel(mrb_state *mrb)
|
|
824
789
|
mrb_define_method(mrb, krn, "is_a?", mrb_obj_is_kind_of_m, MRB_ARGS_REQ(1)); /* 15.3.1.3.24 */
|
825
790
|
mrb_define_method(mrb, krn, "iterator?", mrb_f_block_given_p_m, MRB_ARGS_NONE()); /* 15.3.1.3.25 */
|
826
791
|
mrb_define_method(mrb, krn, "kind_of?", mrb_obj_is_kind_of_m, MRB_ARGS_REQ(1)); /* 15.3.1.3.26 */
|
827
|
-
#ifdef MRB_DEFAULT_METHOD_MISSING
|
828
792
|
mrb_define_method(mrb, krn, "method_missing", mrb_obj_missing, MRB_ARGS_ANY()); /* 15.3.1.3.30 */
|
829
|
-
#endif
|
830
793
|
mrb_define_method(mrb, krn, "nil?", mrb_false, MRB_ARGS_NONE()); /* 15.3.1.3.32 */
|
831
794
|
mrb_define_method(mrb, krn, "object_id", mrb_obj_id_m, MRB_ARGS_NONE()); /* 15.3.1.3.33 */
|
832
795
|
mrb_define_method(mrb, krn, "raise", mrb_f_raise, MRB_ARGS_ANY()); /* 15.3.1.3.40 */
|
833
796
|
mrb_define_method(mrb, krn, "remove_instance_variable", mrb_obj_remove_instance_variable,MRB_ARGS_REQ(1)); /* 15.3.1.3.41 */
|
834
|
-
mrb_define_method(mrb, krn, "respond_to?", obj_respond_to,
|
797
|
+
mrb_define_method(mrb, krn, "respond_to?", obj_respond_to, MRB_ARGS_ARG(1,1)); /* 15.3.1.3.43 */
|
835
798
|
mrb_define_method(mrb, krn, "to_s", mrb_any_to_s, MRB_ARGS_NONE()); /* 15.3.1.3.46 */
|
836
799
|
mrb_define_method(mrb, krn, "__case_eqq", mrb_obj_ceqq, MRB_ARGS_REQ(1)); /* internal */
|
837
800
|
mrb_define_method(mrb, krn, "__to_int", mrb_to_int, MRB_ARGS_NONE()); /* internal */
|
838
801
|
mrb_define_method(mrb, krn, "__to_str", mrb_to_str, MRB_ARGS_NONE()); /* internal */
|
839
802
|
|
840
803
|
mrb_include_module(mrb, mrb->object_class, mrb->kernel_module);
|
841
|
-
mrb_define_alias(mrb, mrb->module_class, "dup", "clone"); /* XXX */
|
842
804
|
}
|