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,17 +1,3 @@
|
|
1
|
-
assert('Kernel#__send__', '15.3.1.3.4') do
|
2
|
-
# test with block
|
3
|
-
l = __send__(:lambda) do
|
4
|
-
true
|
5
|
-
end
|
6
|
-
|
7
|
-
assert_true l.call
|
8
|
-
assert_equal Proc, l.class
|
9
|
-
# test with argument
|
10
|
-
assert_true __send__(:respond_to?, :nil?)
|
11
|
-
# test without argument and without block
|
12
|
-
assert_equal String, __send__(:to_s).class
|
13
|
-
end
|
14
|
-
|
15
1
|
assert('Kernel#send', '15.3.1.3.44') do
|
16
2
|
# test with block
|
17
3
|
l = send(:lambda) do
|
@@ -58,6 +44,8 @@
|
|
58
44
|
%w[@6 @% @@a @ a].each do |n|
|
59
45
|
assert_raise(NameError) { o.instance_variable_set(n, 1) }
|
60
46
|
end
|
47
|
+
assert_raise(FrozenError) { o.freeze.instance_variable_set(:@a, 2) }
|
48
|
+
assert_raise(FrozenError, ArgumentError) { nil.instance_variable_set(:@a, 2) }
|
61
49
|
end
|
62
50
|
|
63
51
|
assert('Kernel#instance_variables', '15.3.1.3.23') do
|
@@ -99,6 +87,21 @@ def foo
|
|
99
87
|
assert_equal singleton_methods.class, Array
|
100
88
|
end
|
101
89
|
|
90
|
+
assert('Kernel.global_variables', '15.3.1.2.4') do
|
91
|
+
assert_equal Array, Kernel.global_variables.class
|
92
|
+
end
|
93
|
+
|
94
|
+
assert('Kernel#global_variables', '15.3.1.3.14') do
|
95
|
+
variables1 = global_variables
|
96
|
+
assert_equal Array, variables1.class
|
97
|
+
assert_not_include(variables1, :$kernel_global_variables_test)
|
98
|
+
|
99
|
+
$kernel_global_variables_test = nil
|
100
|
+
variables2 = global_variables
|
101
|
+
assert_include(variables2, :$kernel_global_variables_test)
|
102
|
+
assert_equal(1, variables2.size - variables1.size)
|
103
|
+
end
|
104
|
+
|
102
105
|
assert('Kernel.local_variables', '15.3.1.2.7') do
|
103
106
|
a, b = 0, 1
|
104
107
|
a += b
|
@@ -120,6 +123,24 @@ def foo
|
|
120
123
|
end
|
121
124
|
assert_equal :test_method, ret
|
122
125
|
assert_equal :singleton_method_ok, o.test_method
|
126
|
+
assert_raise(TypeError) { 2.define_singleton_method(:f){} }
|
127
|
+
assert_raise(FrozenError) { [].freeze.define_singleton_method(:f){} }
|
128
|
+
end
|
129
|
+
|
130
|
+
assert('Kernel#singleton_class') do
|
131
|
+
o1 = Object.new
|
132
|
+
assert_same(o1.singleton_class, class << o1; self end)
|
133
|
+
|
134
|
+
o2 = Object.new
|
135
|
+
sc2 = class << o2; self end
|
136
|
+
assert_same(o2.singleton_class, sc2)
|
137
|
+
|
138
|
+
o3 = Object.new
|
139
|
+
sc3 = o3.singleton_class
|
140
|
+
o3.freeze
|
141
|
+
assert_predicate(sc3, :frozen?)
|
142
|
+
|
143
|
+
assert_predicate(Object.new.freeze.singleton_class, :frozen?)
|
123
144
|
end
|
124
145
|
|
125
146
|
def labeled_module(name, &block)
|
@@ -171,7 +192,6 @@ def foo
|
|
171
192
|
@@foo
|
172
193
|
end
|
173
194
|
end
|
174
|
-
|
175
195
|
assert_equal 99, Test4ClassVariableSet.class_variable_set(:@@cv, 99)
|
176
196
|
assert_equal 101, Test4ClassVariableSet.class_variable_set(:@@foo, 101)
|
177
197
|
assert_true Test4ClassVariableSet.class_variables.include? :@@cv
|
@@ -180,6 +200,13 @@ def foo
|
|
180
200
|
%w[@@ @@1 @@x= @x @ x 1].each do |n|
|
181
201
|
assert_raise(NameError) { Test4ClassVariableSet.class_variable_set(n, 1) }
|
182
202
|
end
|
203
|
+
|
204
|
+
m = Module.new.freeze
|
205
|
+
assert_raise(FrozenError) { m.class_variable_set(:@@cv, 1) }
|
206
|
+
|
207
|
+
parent = Class.new{ class_variable_set(:@@a, nil) }.freeze
|
208
|
+
child = Class.new(parent)
|
209
|
+
assert_raise(FrozenError) { child.class_variable_set(:@@a, 1) }
|
183
210
|
end
|
184
211
|
|
185
212
|
assert('Module#class_variables', '15.2.2.4.19') do
|
@@ -261,6 +288,9 @@ class Test4RemoveClassVariable
|
|
261
288
|
assert_raise(NameError) do
|
262
289
|
Test4RemoveClassVariable.remove_class_variable(:@v)
|
263
290
|
end
|
291
|
+
assert_raise(FrozenError) do
|
292
|
+
Test4RemoveClassVariable.freeze.remove_class_variable(:@@cv)
|
293
|
+
end
|
264
294
|
end
|
265
295
|
|
266
296
|
assert('Module#remove_method', '15.2.2.4.41') do
|
@@ -268,9 +298,9 @@ module Test4RemoveMethod
|
|
268
298
|
class Parent
|
269
299
|
def hello
|
270
300
|
end
|
271
|
-
|
301
|
+
end
|
272
302
|
|
273
|
-
|
303
|
+
class Child < Parent
|
274
304
|
def hello
|
275
305
|
end
|
276
306
|
end
|
@@ -280,6 +310,7 @@ def hello
|
|
280
310
|
assert_same klass, klass.class_eval{ remove_method :hello }
|
281
311
|
assert_true klass.instance_methods.include? :hello
|
282
312
|
assert_false klass.instance_methods(false).include? :hello
|
313
|
+
assert_raise(FrozenError) { klass.freeze.remove_method :m }
|
283
314
|
end
|
284
315
|
|
285
316
|
assert('Module.nesting', '15.2.2.2.2') do
|
@@ -11,34 +11,38 @@ method_object_alloc(mrb_state *mrb, struct RClass *mclass)
|
|
11
11
|
return (struct RObject*)mrb_obj_alloc(mrb, MRB_TT_OBJECT, mclass);
|
12
12
|
}
|
13
13
|
|
14
|
+
static void
|
15
|
+
bind_check(mrb_state *mrb, mrb_value recv, mrb_value owner)
|
16
|
+
{
|
17
|
+
if (!mrb_module_p(owner) &&
|
18
|
+
mrb_class_ptr(owner) != mrb_obj_class(mrb, recv) &&
|
19
|
+
!mrb_obj_is_kind_of(mrb, recv, mrb_class_ptr(owner))) {
|
20
|
+
if (mrb_sclass_p(owner)) {
|
21
|
+
mrb_raise(mrb, E_TYPE_ERROR, "singleton method called for a different object");
|
22
|
+
} else {
|
23
|
+
mrb_raisef(mrb, E_TYPE_ERROR, "bind argument must be an instance of %v", owner);
|
24
|
+
}
|
25
|
+
}
|
26
|
+
}
|
27
|
+
|
14
28
|
static mrb_value
|
15
29
|
unbound_method_bind(mrb_state *mrb, mrb_value self)
|
16
30
|
{
|
17
31
|
struct RObject *me;
|
18
|
-
mrb_value owner = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "
|
19
|
-
mrb_value name = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "
|
20
|
-
mrb_value proc = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "
|
21
|
-
mrb_value klass = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "
|
32
|
+
mrb_value owner = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_owner"));
|
33
|
+
mrb_value name = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_name"));
|
34
|
+
mrb_value proc = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_proc"));
|
35
|
+
mrb_value klass = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_klass"));
|
22
36
|
mrb_value recv;
|
23
37
|
|
24
38
|
mrb_get_args(mrb, "o", &recv);
|
25
|
-
|
26
|
-
if (mrb_type(owner) != MRB_TT_MODULE &&
|
27
|
-
mrb_class_ptr(owner) != mrb_obj_class(mrb, recv) &&
|
28
|
-
!mrb_obj_is_kind_of(mrb, recv, mrb_class_ptr(owner))) {
|
29
|
-
if (mrb_type(owner) == MRB_TT_SCLASS) {
|
30
|
-
mrb_raise(mrb, E_TYPE_ERROR, "singleton method called for a different object");
|
31
|
-
} else {
|
32
|
-
const char *s = mrb_class_name(mrb, mrb_class_ptr(owner));
|
33
|
-
mrb_raisef(mrb, E_TYPE_ERROR, "bind argument must be an instance of %S", mrb_str_new_static(mrb, s, strlen(s)));
|
34
|
-
}
|
35
|
-
}
|
39
|
+
bind_check(mrb, recv, owner);
|
36
40
|
me = method_object_alloc(mrb, mrb_class_get(mrb, "Method"));
|
37
|
-
mrb_obj_iv_set(mrb, me, mrb_intern_lit(mrb, "
|
38
|
-
mrb_obj_iv_set(mrb, me, mrb_intern_lit(mrb, "
|
39
|
-
mrb_obj_iv_set(mrb, me, mrb_intern_lit(mrb, "
|
40
|
-
mrb_obj_iv_set(mrb, me, mrb_intern_lit(mrb, "
|
41
|
-
mrb_obj_iv_set(mrb, me, mrb_intern_lit(mrb, "
|
41
|
+
mrb_obj_iv_set(mrb, me, mrb_intern_lit(mrb, "_owner"), owner);
|
42
|
+
mrb_obj_iv_set(mrb, me, mrb_intern_lit(mrb, "_recv"), recv);
|
43
|
+
mrb_obj_iv_set(mrb, me, mrb_intern_lit(mrb, "_name"), name);
|
44
|
+
mrb_obj_iv_set(mrb, me, mrb_intern_lit(mrb, "_proc"), proc);
|
45
|
+
mrb_obj_iv_set(mrb, me, mrb_intern_lit(mrb, "_klass"), klass);
|
42
46
|
|
43
47
|
return mrb_obj_value(me);
|
44
48
|
}
|
@@ -58,22 +62,22 @@ method_eql(mrb_state *mrb, mrb_value self)
|
|
58
62
|
if (mrb_class(mrb, self) != mrb_class(mrb, other))
|
59
63
|
return mrb_false_value();
|
60
64
|
|
61
|
-
klass = mrb_class_ptr(IV_GET(self, "
|
62
|
-
if (klass != mrb_class_ptr(IV_GET(other, "
|
65
|
+
klass = mrb_class_ptr(IV_GET(self, "_klass"));
|
66
|
+
if (klass != mrb_class_ptr(IV_GET(other, "_klass")))
|
63
67
|
return mrb_false_value();
|
64
68
|
|
65
|
-
owner = mrb_class_ptr(IV_GET(self, "
|
66
|
-
if (owner != mrb_class_ptr(IV_GET(other, "
|
69
|
+
owner = mrb_class_ptr(IV_GET(self, "_owner"));
|
70
|
+
if (owner != mrb_class_ptr(IV_GET(other, "_owner")))
|
67
71
|
return mrb_false_value();
|
68
72
|
|
69
|
-
receiver = IV_GET(self, "
|
70
|
-
if (!mrb_obj_equal(mrb, receiver, IV_GET(other, "
|
73
|
+
receiver = IV_GET(self, "_recv");
|
74
|
+
if (!mrb_obj_equal(mrb, receiver, IV_GET(other, "_recv")))
|
71
75
|
return mrb_false_value();
|
72
76
|
|
73
|
-
orig_proc = IV_GET(self, "
|
74
|
-
other_proc = IV_GET(other, "
|
77
|
+
orig_proc = IV_GET(self, "_proc");
|
78
|
+
other_proc = IV_GET(other, "_proc");
|
75
79
|
if (mrb_nil_p(orig_proc) && mrb_nil_p(other_proc)) {
|
76
|
-
if (mrb_symbol(IV_GET(self, "
|
80
|
+
if (mrb_symbol(IV_GET(self, "_name")) == mrb_symbol(IV_GET(other, "_name")))
|
77
81
|
return mrb_true_value();
|
78
82
|
else
|
79
83
|
return mrb_false_value();
|
@@ -105,18 +109,12 @@ method_eql(mrb_state *mrb, mrb_value self)
|
|
105
109
|
#undef IV_GET
|
106
110
|
|
107
111
|
static mrb_value
|
108
|
-
|
112
|
+
mcall(mrb_state *mrb, mrb_value recv, mrb_value proc, mrb_value name, struct RClass *owner,
|
113
|
+
int argc, mrb_value *argv, mrb_value block)
|
109
114
|
{
|
110
|
-
mrb_value
|
111
|
-
|
112
|
-
mrb_value recv = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "@recv"));
|
113
|
-
struct RClass *owner = mrb_class_ptr(mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "@owner")));
|
114
|
-
mrb_int argc;
|
115
|
-
mrb_value *argv, ret, block;
|
116
|
-
mrb_sym orig_mid;
|
115
|
+
mrb_value ret;
|
116
|
+
mrb_sym orig_mid = mrb->c->ci->mid;
|
117
117
|
|
118
|
-
mrb_get_args(mrb, "*&", &argv, &argc, &block);
|
119
|
-
orig_mid = mrb->c->ci->mid;
|
120
118
|
mrb->c->ci->mid = mrb_symbol(name);
|
121
119
|
if (mrb_nil_p(proc)) {
|
122
120
|
mrb_value missing_argv = mrb_ary_new_from_values(mrb, argc, argv);
|
@@ -137,21 +135,50 @@ method_call(mrb_state *mrb, mrb_value self)
|
|
137
135
|
return ret;
|
138
136
|
}
|
139
137
|
|
138
|
+
static mrb_value
|
139
|
+
method_call(mrb_state *mrb, mrb_value self)
|
140
|
+
{
|
141
|
+
mrb_value proc = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_proc"));
|
142
|
+
mrb_value name = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_name"));
|
143
|
+
mrb_value recv = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_recv"));
|
144
|
+
struct RClass *owner = mrb_class_ptr(mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_owner")));
|
145
|
+
mrb_int argc;
|
146
|
+
mrb_value *argv, block;
|
147
|
+
|
148
|
+
mrb_get_args(mrb, "*&", &argv, &argc, &block);
|
149
|
+
return mcall(mrb, recv, proc, name, owner, argc, argv, block);
|
150
|
+
}
|
151
|
+
|
152
|
+
static mrb_value
|
153
|
+
method_bcall(mrb_state *mrb, mrb_value self)
|
154
|
+
{
|
155
|
+
mrb_value proc = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_proc"));
|
156
|
+
mrb_value name = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_name"));
|
157
|
+
mrb_value recv = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_recv"));
|
158
|
+
mrb_value owner = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_owner"));
|
159
|
+
mrb_int argc;
|
160
|
+
mrb_value *argv, block;
|
161
|
+
|
162
|
+
mrb_get_args(mrb, "o*&", &recv, &argv, &argc, &block);
|
163
|
+
bind_check(mrb, recv, owner);
|
164
|
+
return mcall(mrb, recv, proc, name, mrb_class_ptr(owner), argc, argv, block);
|
165
|
+
}
|
166
|
+
|
140
167
|
static mrb_value
|
141
168
|
method_unbind(mrb_state *mrb, mrb_value self)
|
142
169
|
{
|
143
170
|
struct RObject *ume;
|
144
|
-
mrb_value owner = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "
|
145
|
-
mrb_value name = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "
|
146
|
-
mrb_value proc = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "
|
147
|
-
mrb_value klass = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "
|
171
|
+
mrb_value owner = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_owner"));
|
172
|
+
mrb_value name = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_name"));
|
173
|
+
mrb_value proc = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_proc"));
|
174
|
+
mrb_value klass = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_klass"));
|
148
175
|
|
149
176
|
ume = method_object_alloc(mrb, mrb_class_get(mrb, "UnboundMethod"));
|
150
|
-
mrb_obj_iv_set(mrb, ume, mrb_intern_lit(mrb, "
|
151
|
-
mrb_obj_iv_set(mrb, ume, mrb_intern_lit(mrb, "
|
152
|
-
mrb_obj_iv_set(mrb, ume, mrb_intern_lit(mrb, "
|
153
|
-
mrb_obj_iv_set(mrb, ume, mrb_intern_lit(mrb, "
|
154
|
-
mrb_obj_iv_set(mrb, ume, mrb_intern_lit(mrb, "
|
177
|
+
mrb_obj_iv_set(mrb, ume, mrb_intern_lit(mrb, "_owner"), owner);
|
178
|
+
mrb_obj_iv_set(mrb, ume, mrb_intern_lit(mrb, "_recv"), mrb_nil_value());
|
179
|
+
mrb_obj_iv_set(mrb, ume, mrb_intern_lit(mrb, "_name"), name);
|
180
|
+
mrb_obj_iv_set(mrb, ume, mrb_intern_lit(mrb, "_proc"), proc);
|
181
|
+
mrb_obj_iv_set(mrb, ume, mrb_intern_lit(mrb, "_klass"), klass);
|
155
182
|
|
156
183
|
return mrb_obj_value(ume);
|
157
184
|
}
|
@@ -170,10 +197,10 @@ method_search_vm(mrb_state *mrb, struct RClass **cp, mrb_sym mid)
|
|
170
197
|
static mrb_value
|
171
198
|
method_super_method(mrb_state *mrb, mrb_value self)
|
172
199
|
{
|
173
|
-
mrb_value recv = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "
|
174
|
-
mrb_value klass = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "
|
175
|
-
mrb_value owner = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "
|
176
|
-
mrb_value name = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "
|
200
|
+
mrb_value recv = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_recv"));
|
201
|
+
mrb_value klass = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_klass"));
|
202
|
+
mrb_value owner = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_owner"));
|
203
|
+
mrb_value name = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_name"));
|
177
204
|
struct RClass *super, *rklass;
|
178
205
|
struct RProc *proc;
|
179
206
|
struct RObject *me;
|
@@ -199,11 +226,11 @@ method_super_method(mrb_state *mrb, mrb_value self)
|
|
199
226
|
super = super->c;
|
200
227
|
|
201
228
|
me = method_object_alloc(mrb, mrb_obj_class(mrb, self));
|
202
|
-
mrb_obj_iv_set(mrb, me, mrb_intern_lit(mrb, "
|
203
|
-
mrb_obj_iv_set(mrb, me, mrb_intern_lit(mrb, "
|
204
|
-
mrb_obj_iv_set(mrb, me, mrb_intern_lit(mrb, "
|
205
|
-
mrb_obj_iv_set(mrb, me, mrb_intern_lit(mrb, "
|
206
|
-
mrb_obj_iv_set(mrb, me, mrb_intern_lit(mrb, "
|
229
|
+
mrb_obj_iv_set(mrb, me, mrb_intern_lit(mrb, "_owner"), mrb_obj_value(super));
|
230
|
+
mrb_obj_iv_set(mrb, me, mrb_intern_lit(mrb, "_recv"), recv);
|
231
|
+
mrb_obj_iv_set(mrb, me, mrb_intern_lit(mrb, "_name"), name);
|
232
|
+
mrb_obj_iv_set(mrb, me, mrb_intern_lit(mrb, "_proc"), mrb_obj_value(proc));
|
233
|
+
mrb_obj_iv_set(mrb, me, mrb_intern_lit(mrb, "_klass"), mrb_obj_value(rklass));
|
207
234
|
|
208
235
|
return mrb_obj_value(me);
|
209
236
|
}
|
@@ -211,26 +238,15 @@ method_super_method(mrb_state *mrb, mrb_value self)
|
|
211
238
|
static mrb_value
|
212
239
|
method_arity(mrb_state *mrb, mrb_value self)
|
213
240
|
{
|
214
|
-
mrb_value proc = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "
|
215
|
-
|
216
|
-
|
217
|
-
mrb_value ret;
|
218
|
-
|
219
|
-
if (mrb_nil_p(proc))
|
220
|
-
return mrb_fixnum_value(-1);
|
221
|
-
|
222
|
-
rproc = mrb_proc_ptr(proc);
|
223
|
-
orig = rproc->c;
|
224
|
-
rproc->c = mrb->proc_class;
|
225
|
-
ret = mrb_funcall(mrb, proc, "arity", 0);
|
226
|
-
rproc->c = orig;
|
227
|
-
return ret;
|
241
|
+
mrb_value proc = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_proc"));
|
242
|
+
mrb_int arity = mrb_nil_p(proc) ? -1 : mrb_proc_arity(mrb_proc_ptr(proc));
|
243
|
+
return mrb_fixnum_value(arity);
|
228
244
|
}
|
229
245
|
|
230
246
|
static mrb_value
|
231
247
|
method_source_location(mrb_state *mrb, mrb_value self)
|
232
248
|
{
|
233
|
-
mrb_value proc = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "
|
249
|
+
mrb_value proc = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_proc"));
|
234
250
|
struct RProc *rproc;
|
235
251
|
struct RClass *orig;
|
236
252
|
mrb_value ret;
|
@@ -249,7 +265,7 @@ method_source_location(mrb_state *mrb, mrb_value self)
|
|
249
265
|
static mrb_value
|
250
266
|
method_parameters(mrb_state *mrb, mrb_value self)
|
251
267
|
{
|
252
|
-
mrb_value proc = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "
|
268
|
+
mrb_value proc = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_proc"));
|
253
269
|
struct RProc *rproc;
|
254
270
|
struct RClass *orig;
|
255
271
|
mrb_value ret;
|
@@ -271,9 +287,9 @@ method_parameters(mrb_state *mrb, mrb_value self)
|
|
271
287
|
static mrb_value
|
272
288
|
method_to_s(mrb_state *mrb, mrb_value self)
|
273
289
|
{
|
274
|
-
mrb_value owner = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "
|
275
|
-
mrb_value klass = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "
|
276
|
-
mrb_value name = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "
|
290
|
+
mrb_value owner = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_owner"));
|
291
|
+
mrb_value klass = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_klass"));
|
292
|
+
mrb_value name = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_name"));
|
277
293
|
mrb_value str = mrb_str_new_lit(mrb, "#<");
|
278
294
|
struct RClass *rklass;
|
279
295
|
|
@@ -281,16 +297,16 @@ method_to_s(mrb_state *mrb, mrb_value self)
|
|
281
297
|
mrb_str_cat_lit(mrb, str, ": ");
|
282
298
|
rklass = mrb_class_ptr(klass);
|
283
299
|
if (mrb_class_ptr(owner) == rklass) {
|
284
|
-
|
300
|
+
mrb_str_concat(mrb, str, owner);
|
285
301
|
mrb_str_cat_lit(mrb, str, "#");
|
286
|
-
|
302
|
+
mrb_str_concat(mrb, str, name);
|
287
303
|
}
|
288
304
|
else {
|
289
305
|
mrb_str_cat_cstr(mrb, str, mrb_class_name(mrb, rklass));
|
290
306
|
mrb_str_cat_lit(mrb, str, "(");
|
291
|
-
|
307
|
+
mrb_str_concat(mrb, str, owner);
|
292
308
|
mrb_str_cat_lit(mrb, str, ")#");
|
293
|
-
|
309
|
+
mrb_str_concat(mrb, str, name);
|
294
310
|
}
|
295
311
|
mrb_str_cat_lit(mrb, str, ">");
|
296
312
|
return str;
|
@@ -300,7 +316,6 @@ static void
|
|
300
316
|
mrb_search_method_owner(mrb_state *mrb, struct RClass *c, mrb_value obj, mrb_sym name, struct RClass **owner, struct RProc **proc, mrb_bool unbound)
|
301
317
|
{
|
302
318
|
mrb_value ret;
|
303
|
-
const char *s;
|
304
319
|
|
305
320
|
*owner = c;
|
306
321
|
*proc = method_search_vm(mrb, owner, name);
|
@@ -324,13 +339,7 @@ mrb_search_method_owner(mrb_state *mrb, struct RClass *c, mrb_value obj, mrb_sym
|
|
324
339
|
return;
|
325
340
|
|
326
341
|
name_error:
|
327
|
-
|
328
|
-
mrb_raisef(
|
329
|
-
mrb, E_NAME_ERROR,
|
330
|
-
"undefined method '%S' for class '%S'",
|
331
|
-
mrb_sym2str(mrb, name),
|
332
|
-
mrb_str_new_static(mrb, s, strlen(s))
|
333
|
-
);
|
342
|
+
mrb_raisef(mrb, E_NAME_ERROR, "undefined method '%n' for class '%C'", name, c);
|
334
343
|
}
|
335
344
|
|
336
345
|
static mrb_value
|
@@ -346,11 +355,11 @@ mrb_kernel_method(mrb_state *mrb, mrb_value self)
|
|
346
355
|
mrb_search_method_owner(mrb, mrb_class(mrb, self), self, name, &owner, &proc, FALSE);
|
347
356
|
|
348
357
|
me = method_object_alloc(mrb, mrb_class_get(mrb, "Method"));
|
349
|
-
mrb_obj_iv_set(mrb, me, mrb_intern_lit(mrb, "
|
350
|
-
mrb_obj_iv_set(mrb, me, mrb_intern_lit(mrb, "
|
351
|
-
mrb_obj_iv_set(mrb, me, mrb_intern_lit(mrb, "
|
352
|
-
mrb_obj_iv_set(mrb, me, mrb_intern_lit(mrb, "
|
353
|
-
mrb_obj_iv_set(mrb, me, mrb_intern_lit(mrb, "
|
358
|
+
mrb_obj_iv_set(mrb, me, mrb_intern_lit(mrb, "_owner"), mrb_obj_value(owner));
|
359
|
+
mrb_obj_iv_set(mrb, me, mrb_intern_lit(mrb, "_recv"), self);
|
360
|
+
mrb_obj_iv_set(mrb, me, mrb_intern_lit(mrb, "_name"), mrb_symbol_value(name));
|
361
|
+
mrb_obj_iv_set(mrb, me, mrb_intern_lit(mrb, "_proc"), proc ? mrb_obj_value(proc) : mrb_nil_value());
|
362
|
+
mrb_obj_iv_set(mrb, me, mrb_intern_lit(mrb, "_klass"), mrb_obj_value(mrb_class(mrb, self)));
|
354
363
|
|
355
364
|
return mrb_obj_value(me);
|
356
365
|
}
|
@@ -368,15 +377,33 @@ mrb_module_instance_method(mrb_state *mrb, mrb_value self)
|
|
368
377
|
mrb_search_method_owner(mrb, mrb_class_ptr(self), self, name, &owner, &proc, TRUE);
|
369
378
|
|
370
379
|
ume = method_object_alloc(mrb, mrb_class_get(mrb, "UnboundMethod"));
|
371
|
-
mrb_obj_iv_set(mrb, ume, mrb_intern_lit(mrb, "
|
372
|
-
mrb_obj_iv_set(mrb, ume, mrb_intern_lit(mrb, "
|
373
|
-
mrb_obj_iv_set(mrb, ume, mrb_intern_lit(mrb, "
|
374
|
-
mrb_obj_iv_set(mrb, ume, mrb_intern_lit(mrb, "
|
375
|
-
mrb_obj_iv_set(mrb, ume, mrb_intern_lit(mrb, "
|
380
|
+
mrb_obj_iv_set(mrb, ume, mrb_intern_lit(mrb, "_owner"), mrb_obj_value(owner));
|
381
|
+
mrb_obj_iv_set(mrb, ume, mrb_intern_lit(mrb, "_recv"), mrb_nil_value());
|
382
|
+
mrb_obj_iv_set(mrb, ume, mrb_intern_lit(mrb, "_name"), mrb_symbol_value(name));
|
383
|
+
mrb_obj_iv_set(mrb, ume, mrb_intern_lit(mrb, "_proc"), proc ? mrb_obj_value(proc) : mrb_nil_value());
|
384
|
+
mrb_obj_iv_set(mrb, ume, mrb_intern_lit(mrb, "_klass"), self);
|
376
385
|
|
377
386
|
return mrb_obj_value(ume);
|
378
387
|
}
|
379
388
|
|
389
|
+
static mrb_value
|
390
|
+
method_owner(mrb_state *mrb, mrb_value self)
|
391
|
+
{
|
392
|
+
return mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_owner"));
|
393
|
+
}
|
394
|
+
|
395
|
+
static mrb_value
|
396
|
+
method_receiver(mrb_state *mrb, mrb_value self)
|
397
|
+
{
|
398
|
+
return mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_recv"));
|
399
|
+
}
|
400
|
+
|
401
|
+
static mrb_value
|
402
|
+
method_name(mrb_state *mrb, mrb_value self)
|
403
|
+
{
|
404
|
+
return mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "_name"));
|
405
|
+
}
|
406
|
+
|
380
407
|
void
|
381
408
|
mrb_mruby_method_gem_init(mrb_state* mrb)
|
382
409
|
{
|
@@ -387,25 +414,31 @@ mrb_mruby_method_gem_init(mrb_state* mrb)
|
|
387
414
|
mrb_define_method(mrb, unbound_method, "bind", unbound_method_bind, MRB_ARGS_REQ(1));
|
388
415
|
mrb_define_method(mrb, unbound_method, "super_method", method_super_method, MRB_ARGS_NONE());
|
389
416
|
mrb_define_method(mrb, unbound_method, "==", method_eql, MRB_ARGS_REQ(1));
|
390
|
-
|
417
|
+
mrb_define_method(mrb, unbound_method, "eql?", method_eql, MRB_ARGS_REQ(1));
|
391
418
|
mrb_define_method(mrb, unbound_method, "to_s", method_to_s, MRB_ARGS_NONE());
|
392
419
|
mrb_define_method(mrb, unbound_method, "inspect", method_to_s, MRB_ARGS_NONE());
|
393
420
|
mrb_define_method(mrb, unbound_method, "arity", method_arity, MRB_ARGS_NONE());
|
394
421
|
mrb_define_method(mrb, unbound_method, "source_location", method_source_location, MRB_ARGS_NONE());
|
395
422
|
mrb_define_method(mrb, unbound_method, "parameters", method_parameters, MRB_ARGS_NONE());
|
423
|
+
mrb_define_method(mrb, unbound_method, "bind_call", method_bcall, MRB_ARGS_REQ(1)|MRB_ARGS_ANY());
|
424
|
+
mrb_define_method(mrb, unbound_method, "owner", method_owner, MRB_ARGS_NONE());
|
425
|
+
mrb_define_method(mrb, unbound_method, "name", method_name, MRB_ARGS_NONE());
|
396
426
|
|
397
427
|
mrb_undef_class_method(mrb, method, "new");
|
398
428
|
mrb_define_method(mrb, method, "==", method_eql, MRB_ARGS_REQ(1));
|
399
|
-
|
429
|
+
mrb_define_method(mrb, method, "eql?", method_eql, MRB_ARGS_REQ(1));
|
400
430
|
mrb_define_method(mrb, method, "to_s", method_to_s, MRB_ARGS_NONE());
|
401
431
|
mrb_define_method(mrb, method, "inspect", method_to_s, MRB_ARGS_NONE());
|
402
432
|
mrb_define_method(mrb, method, "call", method_call, MRB_ARGS_ANY());
|
403
|
-
|
433
|
+
mrb_define_method(mrb, method, "[]", method_call, MRB_ARGS_ANY());
|
404
434
|
mrb_define_method(mrb, method, "unbind", method_unbind, MRB_ARGS_NONE());
|
405
435
|
mrb_define_method(mrb, method, "super_method", method_super_method, MRB_ARGS_NONE());
|
406
436
|
mrb_define_method(mrb, method, "arity", method_arity, MRB_ARGS_NONE());
|
407
437
|
mrb_define_method(mrb, method, "source_location", method_source_location, MRB_ARGS_NONE());
|
408
438
|
mrb_define_method(mrb, method, "parameters", method_parameters, MRB_ARGS_NONE());
|
439
|
+
mrb_define_method(mrb, method, "owner", method_owner, MRB_ARGS_NONE());
|
440
|
+
mrb_define_method(mrb, method, "receiver", method_receiver, MRB_ARGS_NONE());
|
441
|
+
mrb_define_method(mrb, method, "name", method_name, MRB_ARGS_NONE());
|
409
442
|
|
410
443
|
mrb_define_method(mrb, mrb->kernel_module, "method", mrb_kernel_method, MRB_ARGS_REQ(1));
|
411
444
|
|