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
@@ -83,13 +83,13 @@ mrb_true(mrb_state *mrb, mrb_value obj)
|
|
83
83
|
static mrb_value
|
84
84
|
nil_to_s(mrb_state *mrb, mrb_value obj)
|
85
85
|
{
|
86
|
-
return
|
86
|
+
return mrb_str_new_frozen(mrb, 0, 0);
|
87
87
|
}
|
88
88
|
|
89
89
|
static mrb_value
|
90
90
|
nil_inspect(mrb_state *mrb, mrb_value obj)
|
91
91
|
{
|
92
|
-
return
|
92
|
+
return mrb_str_new_lit_frozen(mrb, "nil");
|
93
93
|
}
|
94
94
|
|
95
95
|
/***********************************************************************
|
@@ -150,7 +150,7 @@ true_xor(mrb_state *mrb, mrb_value obj)
|
|
150
150
|
static mrb_value
|
151
151
|
true_to_s(mrb_state *mrb, mrb_value obj)
|
152
152
|
{
|
153
|
-
return
|
153
|
+
return mrb_str_new_lit_frozen(mrb, "true");
|
154
154
|
}
|
155
155
|
|
156
156
|
/* 15.2.5.3.4 */
|
@@ -257,7 +257,7 @@ false_or(mrb_state *mrb, mrb_value obj)
|
|
257
257
|
static mrb_value
|
258
258
|
false_to_s(mrb_state *mrb, mrb_value obj)
|
259
259
|
{
|
260
|
-
return
|
260
|
+
return mrb_str_new_lit_frozen(mrb, "false");
|
261
261
|
}
|
262
262
|
|
263
263
|
void
|
@@ -296,17 +296,6 @@ mrb_init_object(mrb_state *mrb)
|
|
296
296
|
mrb_define_method(mrb, f, "inspect", false_to_s, MRB_ARGS_NONE());
|
297
297
|
}
|
298
298
|
|
299
|
-
static mrb_value
|
300
|
-
inspect_type(mrb_state *mrb, mrb_value val)
|
301
|
-
{
|
302
|
-
if (mrb_type(val) == MRB_TT_FALSE || mrb_type(val) == MRB_TT_TRUE) {
|
303
|
-
return mrb_inspect(mrb, val);
|
304
|
-
}
|
305
|
-
else {
|
306
|
-
return mrb_str_new_cstr(mrb, mrb_obj_classname(mrb, val));
|
307
|
-
}
|
308
|
-
}
|
309
|
-
|
310
299
|
static mrb_value
|
311
300
|
convert_type(mrb_state *mrb, mrb_value val, const char *tname, const char *method, mrb_bool raise)
|
312
301
|
{
|
@@ -315,7 +304,7 @@ convert_type(mrb_state *mrb, mrb_value val, const char *tname, const char *metho
|
|
315
304
|
m = mrb_intern_cstr(mrb, method);
|
316
305
|
if (!mrb_respond_to(mrb, val, m)) {
|
317
306
|
if (raise) {
|
318
|
-
mrb_raisef(mrb, E_TYPE_ERROR, "can't convert %
|
307
|
+
mrb_raisef(mrb, E_TYPE_ERROR, "can't convert %Y into %s", val, tname);
|
319
308
|
}
|
320
309
|
return mrb_nil_value();
|
321
310
|
}
|
@@ -330,8 +319,7 @@ mrb_convert_type(mrb_state *mrb, mrb_value val, enum mrb_vtype type, const char
|
|
330
319
|
if (mrb_type(val) == type) return val;
|
331
320
|
v = convert_type(mrb, val, tname, method, TRUE);
|
332
321
|
if (mrb_type(v) != type) {
|
333
|
-
mrb_raisef(mrb, E_TYPE_ERROR, "%
|
334
|
-
mrb_str_new_cstr(mrb, tname), mrb_str_new_cstr(mrb, method));
|
322
|
+
mrb_raisef(mrb, E_TYPE_ERROR, "%v cannot be converted to %s by #%s", val, tname, method);
|
335
323
|
}
|
336
324
|
return v;
|
337
325
|
}
|
@@ -396,7 +384,7 @@ mrb_check_type(mrb_state *mrb, mrb_value x, enum mrb_vtype t)
|
|
396
384
|
else if (mrb_fixnum_p(x)) {
|
397
385
|
etype = "Fixnum";
|
398
386
|
}
|
399
|
-
else if (
|
387
|
+
else if (mrb_symbol_p(x)) {
|
400
388
|
etype = "Symbol";
|
401
389
|
}
|
402
390
|
else if (mrb_immediate_p(x)) {
|
@@ -405,13 +393,12 @@ mrb_check_type(mrb_state *mrb, mrb_value x, enum mrb_vtype t)
|
|
405
393
|
else {
|
406
394
|
etype = mrb_obj_classname(mrb, x);
|
407
395
|
}
|
408
|
-
mrb_raisef(mrb, E_TYPE_ERROR, "wrong argument type %
|
409
|
-
|
396
|
+
mrb_raisef(mrb, E_TYPE_ERROR, "wrong argument type %s (expected %s)",
|
397
|
+
etype, type->name);
|
410
398
|
}
|
411
399
|
type++;
|
412
400
|
}
|
413
|
-
mrb_raisef(mrb, E_TYPE_ERROR, "unknown type %
|
414
|
-
mrb_fixnum_value(t), mrb_fixnum_value(mrb_type(x)));
|
401
|
+
mrb_raisef(mrb, E_TYPE_ERROR, "unknown type %d (%d given)", t, mrb_type(x));
|
415
402
|
}
|
416
403
|
}
|
417
404
|
|
@@ -436,7 +423,7 @@ mrb_any_to_s(mrb_state *mrb, mrb_value obj)
|
|
436
423
|
mrb_str_cat_cstr(mrb, str, cname);
|
437
424
|
if (!mrb_immediate_p(obj)) {
|
438
425
|
mrb_str_cat_lit(mrb, str, ":");
|
439
|
-
|
426
|
+
mrb_str_cat_str(mrb, str, mrb_ptr_to_str(mrb, mrb_ptr(obj)));
|
440
427
|
}
|
441
428
|
mrb_str_cat_lit(mrb, str, ">");
|
442
429
|
|
@@ -499,15 +486,12 @@ mrb_to_int(mrb_state *mrb, mrb_value val)
|
|
499
486
|
{
|
500
487
|
|
501
488
|
if (!mrb_fixnum_p(val)) {
|
502
|
-
mrb_value type;
|
503
|
-
|
504
489
|
#ifndef MRB_WITHOUT_FLOAT
|
505
490
|
if (mrb_float_p(val)) {
|
506
491
|
return mrb_flo_to_fixnum(mrb, val);
|
507
492
|
}
|
508
493
|
#endif
|
509
|
-
|
510
|
-
mrb_raisef(mrb, E_TYPE_ERROR, "can't convert %S to Integer", type);
|
494
|
+
mrb_raisef(mrb, E_TYPE_ERROR, "can't convert %Y to Integer", val);
|
511
495
|
}
|
512
496
|
return val;
|
513
497
|
}
|
@@ -584,11 +568,7 @@ mrb_Float(mrb_state *mrb, mrb_value val)
|
|
584
568
|
MRB_API mrb_value
|
585
569
|
mrb_to_str(mrb_state *mrb, mrb_value val)
|
586
570
|
{
|
587
|
-
|
588
|
-
mrb_value type = inspect_type(mrb, val);
|
589
|
-
mrb_raisef(mrb, E_TYPE_ERROR, "can't convert %S to String", type);
|
590
|
-
}
|
591
|
-
return val;
|
571
|
+
return mrb_ensure_string_type(mrb, val);
|
592
572
|
}
|
593
573
|
|
594
574
|
/* obsolete: use mrb_ensure_string_type() instead */
|
@@ -602,8 +582,7 @@ MRB_API mrb_value
|
|
602
582
|
mrb_ensure_string_type(mrb_state *mrb, mrb_value str)
|
603
583
|
{
|
604
584
|
if (!mrb_string_p(str)) {
|
605
|
-
mrb_raisef(mrb, E_TYPE_ERROR, "%
|
606
|
-
inspect_type(mrb, str));
|
585
|
+
mrb_raisef(mrb, E_TYPE_ERROR, "%Y cannot be converted to String", str);
|
607
586
|
}
|
608
587
|
return str;
|
609
588
|
}
|
@@ -619,8 +598,7 @@ MRB_API mrb_value
|
|
619
598
|
mrb_ensure_array_type(mrb_state *mrb, mrb_value ary)
|
620
599
|
{
|
621
600
|
if (!mrb_array_p(ary)) {
|
622
|
-
mrb_raisef(mrb, E_TYPE_ERROR, "%
|
623
|
-
inspect_type(mrb, ary));
|
601
|
+
mrb_raisef(mrb, E_TYPE_ERROR, "%Y cannot be converted to Array", ary);
|
624
602
|
}
|
625
603
|
return ary;
|
626
604
|
}
|
@@ -636,8 +614,7 @@ MRB_API mrb_value
|
|
636
614
|
mrb_ensure_hash_type(mrb_state *mrb, mrb_value hash)
|
637
615
|
{
|
638
616
|
if (!mrb_hash_p(hash)) {
|
639
|
-
mrb_raisef(mrb, E_TYPE_ERROR, "%
|
640
|
-
inspect_type(mrb, hash));
|
617
|
+
mrb_raisef(mrb, E_TYPE_ERROR, "%Y cannot be converted to Hash", hash);
|
641
618
|
}
|
642
619
|
return hash;
|
643
620
|
}
|
@@ -9,7 +9,7 @@
|
|
9
9
|
#include <mruby/proc.h>
|
10
10
|
#include <mruby/opcode.h>
|
11
11
|
|
12
|
-
static mrb_code call_iseq[] = {
|
12
|
+
static const mrb_code call_iseq[] = {
|
13
13
|
OP_CALL,
|
14
14
|
};
|
15
15
|
|
@@ -77,6 +77,9 @@ closure_setup(mrb_state *mrb, struct RProc *p)
|
|
77
77
|
e->c = tc;
|
78
78
|
mrb_field_write_barrier(mrb, (struct RBasic*)e, (struct RBasic*)tc);
|
79
79
|
}
|
80
|
+
if (MRB_PROC_ENV_P(up) && MRB_PROC_ENV(up)->cxt == NULL) {
|
81
|
+
e->mid = MRB_PROC_ENV(up)->mid;
|
82
|
+
}
|
80
83
|
}
|
81
84
|
if (e) {
|
82
85
|
p->e.env = e;
|
@@ -153,8 +156,8 @@ mrb_proc_cfunc_env_get(mrb_state *mrb, mrb_int idx)
|
|
153
156
|
mrb_raise(mrb, E_TYPE_ERROR, "Can't get cfunc env from cfunc Proc without REnv.");
|
154
157
|
}
|
155
158
|
if (idx < 0 || MRB_ENV_STACK_LEN(e) <= idx) {
|
156
|
-
mrb_raisef(mrb, E_INDEX_ERROR, "Env index out of range: %
|
157
|
-
|
159
|
+
mrb_raisef(mrb, E_INDEX_ERROR, "Env index out of range: %i (expected: 0 <= index < %i)",
|
160
|
+
idx, MRB_ENV_STACK_LEN(e));
|
158
161
|
}
|
159
162
|
|
160
163
|
return e->stack[idx];
|
@@ -184,11 +187,8 @@ mrb_proc_s_new(mrb_state *mrb, mrb_value proc_class)
|
|
184
187
|
mrb_value proc;
|
185
188
|
struct RProc *p;
|
186
189
|
|
187
|
-
|
188
|
-
|
189
|
-
/* Calling Proc.new without a block is not implemented yet */
|
190
|
-
mrb_raise(mrb, E_ARGUMENT_ERROR, "tried to create Proc object without a block");
|
191
|
-
}
|
190
|
+
/* Calling Proc.new without a block is not implemented yet */
|
191
|
+
mrb_get_args(mrb, "&!", &blk);
|
192
192
|
p = (struct RProc *)mrb_obj_alloc(mrb, MRB_TT_PROC, mrb_class_ptr(proc_class));
|
193
193
|
mrb_proc_copy(p, mrb_proc_ptr(blk));
|
194
194
|
proc = mrb_obj_value(p);
|
@@ -206,53 +206,18 @@ mrb_proc_init_copy(mrb_state *mrb, mrb_value self)
|
|
206
206
|
mrb_value proc;
|
207
207
|
|
208
208
|
mrb_get_args(mrb, "o", &proc);
|
209
|
-
if (
|
209
|
+
if (!mrb_proc_p(proc)) {
|
210
210
|
mrb_raise(mrb, E_ARGUMENT_ERROR, "not a proc");
|
211
211
|
}
|
212
212
|
mrb_proc_copy(mrb_proc_ptr(self), mrb_proc_ptr(proc));
|
213
213
|
return self;
|
214
214
|
}
|
215
215
|
|
216
|
-
int
|
217
|
-
mrb_proc_cfunc_p(struct RProc *p)
|
218
|
-
{
|
219
|
-
return MRB_PROC_CFUNC_P(p);
|
220
|
-
}
|
221
|
-
|
222
216
|
/* 15.2.17.4.2 */
|
223
217
|
static mrb_value
|
224
|
-
|
218
|
+
proc_arity(mrb_state *mrb, mrb_value self)
|
225
219
|
{
|
226
|
-
|
227
|
-
struct mrb_irep *irep;
|
228
|
-
mrb_code *pc;
|
229
|
-
mrb_aspec aspec;
|
230
|
-
int ma, op, ra, pa, arity;
|
231
|
-
|
232
|
-
if (MRB_PROC_CFUNC_P(p)) {
|
233
|
-
/* TODO cfunc aspec not implemented yet */
|
234
|
-
return mrb_fixnum_value(-1);
|
235
|
-
}
|
236
|
-
|
237
|
-
irep = p->body.irep;
|
238
|
-
if (!irep) {
|
239
|
-
return mrb_fixnum_value(0);
|
240
|
-
}
|
241
|
-
|
242
|
-
pc = irep->iseq;
|
243
|
-
/* arity is depend on OP_ENTER */
|
244
|
-
if (*pc != OP_ENTER) {
|
245
|
-
return mrb_fixnum_value(0);
|
246
|
-
}
|
247
|
-
|
248
|
-
aspec = PEEK_W(pc+1);
|
249
|
-
ma = MRB_ASPEC_REQ(aspec);
|
250
|
-
op = MRB_ASPEC_OPT(aspec);
|
251
|
-
ra = MRB_ASPEC_REST(aspec);
|
252
|
-
pa = MRB_ASPEC_POST(aspec);
|
253
|
-
arity = ra || (MRB_PROC_STRICT_P(p) && op) ? -(ma + pa + 1) : ma + pa;
|
254
|
-
|
255
|
-
return mrb_fixnum_value(arity);
|
220
|
+
return mrb_fixnum_value(mrb_proc_arity(mrb_proc_ptr(self)));
|
256
221
|
}
|
257
222
|
|
258
223
|
/* 15.3.1.2.6 */
|
@@ -274,7 +239,7 @@ proc_lambda(mrb_state *mrb, mrb_value self)
|
|
274
239
|
if (mrb_nil_p(blk)) {
|
275
240
|
mrb_raise(mrb, E_ARGUMENT_ERROR, "tried to create Proc object without a block");
|
276
241
|
}
|
277
|
-
if (
|
242
|
+
if (!mrb_proc_p(blk)) {
|
278
243
|
mrb_raise(mrb, E_ARGUMENT_ERROR, "not a proc");
|
279
244
|
}
|
280
245
|
p = mrb_proc_ptr(blk);
|
@@ -287,6 +252,40 @@ proc_lambda(mrb_state *mrb, mrb_value self)
|
|
287
252
|
return blk;
|
288
253
|
}
|
289
254
|
|
255
|
+
mrb_int
|
256
|
+
mrb_proc_arity(const struct RProc *p)
|
257
|
+
{
|
258
|
+
struct mrb_irep *irep;
|
259
|
+
const mrb_code *pc;
|
260
|
+
mrb_aspec aspec;
|
261
|
+
int ma, op, ra, pa, arity;
|
262
|
+
|
263
|
+
if (MRB_PROC_CFUNC_P(p)) {
|
264
|
+
/* TODO cfunc aspec not implemented yet */
|
265
|
+
return -1;
|
266
|
+
}
|
267
|
+
|
268
|
+
irep = p->body.irep;
|
269
|
+
if (!irep) {
|
270
|
+
return 0;
|
271
|
+
}
|
272
|
+
|
273
|
+
pc = irep->iseq;
|
274
|
+
/* arity is depend on OP_ENTER */
|
275
|
+
if (*pc != OP_ENTER) {
|
276
|
+
return 0;
|
277
|
+
}
|
278
|
+
|
279
|
+
aspec = PEEK_W(pc+1);
|
280
|
+
ma = MRB_ASPEC_REQ(aspec);
|
281
|
+
op = MRB_ASPEC_OPT(aspec);
|
282
|
+
ra = MRB_ASPEC_REST(aspec);
|
283
|
+
pa = MRB_ASPEC_POST(aspec);
|
284
|
+
arity = ra || (MRB_PROC_STRICT_P(p) && op) ? -(ma + pa + 1) : ma + pa;
|
285
|
+
|
286
|
+
return arity;
|
287
|
+
}
|
288
|
+
|
290
289
|
void
|
291
290
|
mrb_init_proc(mrb_state *mrb)
|
292
291
|
{
|
@@ -303,7 +302,7 @@ mrb_init_proc(mrb_state *mrb)
|
|
303
302
|
|
304
303
|
mrb_define_class_method(mrb, mrb->proc_class, "new", mrb_proc_s_new, MRB_ARGS_NONE()|MRB_ARGS_BLOCK());
|
305
304
|
mrb_define_method(mrb, mrb->proc_class, "initialize_copy", mrb_proc_init_copy, MRB_ARGS_REQ(1));
|
306
|
-
mrb_define_method(mrb, mrb->proc_class, "arity",
|
305
|
+
mrb_define_method(mrb, mrb->proc_class, "arity", proc_arity, MRB_ARGS_NONE());
|
307
306
|
|
308
307
|
p = mrb_proc_new(mrb, call_irep);
|
309
308
|
MRB_METHOD_FROM_PROC(m, p);
|
@@ -17,9 +17,9 @@
|
|
17
17
|
static void
|
18
18
|
r_check(mrb_state *mrb, mrb_value a, mrb_value b)
|
19
19
|
{
|
20
|
-
mrb_value ans;
|
21
20
|
enum mrb_vtype ta;
|
22
21
|
enum mrb_vtype tb;
|
22
|
+
mrb_int n;
|
23
23
|
|
24
24
|
ta = mrb_type(a);
|
25
25
|
tb = mrb_type(b);
|
@@ -32,9 +32,8 @@ r_check(mrb_state *mrb, mrb_value a, mrb_value b)
|
|
32
32
|
return;
|
33
33
|
}
|
34
34
|
|
35
|
-
|
36
|
-
if (
|
37
|
-
/* can not be compared */
|
35
|
+
n = mrb_cmp(mrb, a, b);
|
36
|
+
if (n == -2) { /* can not be compared */
|
38
37
|
mrb_raise(mrb, E_ARGUMENT_ERROR, "bad value for range");
|
39
38
|
}
|
40
39
|
}
|
@@ -42,37 +41,24 @@ r_check(mrb_state *mrb, mrb_value a, mrb_value b)
|
|
42
41
|
static mrb_bool
|
43
42
|
r_le(mrb_state *mrb, mrb_value a, mrb_value b)
|
44
43
|
{
|
45
|
-
|
46
|
-
/* output :a < b => -1, a = b => 0, a > b => +1 */
|
47
|
-
|
48
|
-
if (mrb_fixnum_p(r)) {
|
49
|
-
mrb_int c = mrb_fixnum(r);
|
50
|
-
if (c == 0 || c == -1) return TRUE;
|
51
|
-
}
|
44
|
+
mrb_int n = mrb_cmp(mrb, a, b);
|
52
45
|
|
46
|
+
if (n == 0 || n == -1) return TRUE;
|
53
47
|
return FALSE;
|
54
48
|
}
|
55
49
|
|
56
50
|
static mrb_bool
|
57
51
|
r_gt(mrb_state *mrb, mrb_value a, mrb_value b)
|
58
52
|
{
|
59
|
-
|
60
|
-
/* output :a < b => -1, a = b => 0, a > b => +1 */
|
61
|
-
|
62
|
-
return mrb_fixnum_p(r) && mrb_fixnum(r) == 1;
|
53
|
+
return mrb_cmp(mrb, a, b) == 1;
|
63
54
|
}
|
64
55
|
|
65
56
|
static mrb_bool
|
66
57
|
r_ge(mrb_state *mrb, mrb_value a, mrb_value b)
|
67
58
|
{
|
68
|
-
|
69
|
-
/* output :a < b => -1, a = b => 0, a > b => +1 */
|
70
|
-
|
71
|
-
if (mrb_fixnum_p(r)) {
|
72
|
-
mrb_int c = mrb_fixnum(r);
|
73
|
-
if (c == 0 || c == 1) return TRUE;
|
74
|
-
}
|
59
|
+
mrb_int n = mrb_cmp(mrb, a, b);
|
75
60
|
|
61
|
+
if (n == 0 || n == 1) return TRUE;
|
76
62
|
return FALSE;
|
77
63
|
}
|
78
64
|
|
@@ -92,7 +78,7 @@ range_ptr_init(mrb_state *mrb, struct RRange *r, mrb_value beg, mrb_value end, m
|
|
92
78
|
if (r) {
|
93
79
|
if (RANGE_INITIALIZED_P(r)) {
|
94
80
|
/* Ranges are immutable, so that they should be initialized only once. */
|
95
|
-
mrb_name_error(mrb, mrb_intern_lit(mrb, "initialize"), "
|
81
|
+
mrb_name_error(mrb, mrb_intern_lit(mrb, "initialize"), "'initialize' called twice");
|
96
82
|
}
|
97
83
|
else {
|
98
84
|
range_ptr_alloc_edges(mrb, r);
|
@@ -196,7 +182,8 @@ range_eq(mrb_state *mrb, mrb_value range)
|
|
196
182
|
{
|
197
183
|
struct RRange *rr;
|
198
184
|
struct RRange *ro;
|
199
|
-
mrb_value obj
|
185
|
+
mrb_value obj;
|
186
|
+
mrb_bool v1, v2;
|
200
187
|
|
201
188
|
mrb_get_args(mrb, "o", &obj);
|
202
189
|
|
@@ -207,9 +194,9 @@ range_eq(mrb_state *mrb, mrb_value range)
|
|
207
194
|
|
208
195
|
rr = mrb_range_ptr(mrb, range);
|
209
196
|
ro = mrb_range_ptr(mrb, obj);
|
210
|
-
v1 =
|
211
|
-
v2 =
|
212
|
-
if (!
|
197
|
+
v1 = mrb_equal(mrb, RANGE_BEG(rr), RANGE_BEG(ro));
|
198
|
+
v2 = mrb_equal(mrb, RANGE_END(rr), RANGE_END(ro));
|
199
|
+
if (!v1 || !v2 || RANGE_EXCL(rr) != RANGE_EXCL(ro)) {
|
213
200
|
return mrb_false_value();
|
214
201
|
}
|
215
202
|
return mrb_true_value();
|
@@ -309,7 +296,7 @@ range_eql(mrb_state *mrb, mrb_value range)
|
|
309
296
|
|
310
297
|
if (mrb_obj_equal(mrb, range, obj)) return mrb_true_value();
|
311
298
|
if (!mrb_obj_is_kind_of(mrb, obj, mrb->range_class)) return mrb_false_value();
|
312
|
-
if (
|
299
|
+
if (!mrb_range_p(obj)) return mrb_false_value();
|
313
300
|
|
314
301
|
r = mrb_range_ptr(mrb, range);
|
315
302
|
o = mrb_range_ptr(mrb, obj);
|
@@ -352,7 +339,7 @@ mrb_get_values_at(mrb_state *mrb, mrb_value obj, mrb_int olen, mrb_int argc, con
|
|
352
339
|
if (mrb_fixnum_p(argv[i])) {
|
353
340
|
mrb_ary_push(mrb, result, func(mrb, obj, mrb_fixnum(argv[i])));
|
354
341
|
}
|
355
|
-
else if (mrb_range_beg_len(mrb, argv[i], &beg, &len, olen, FALSE) ==
|
342
|
+
else if (mrb_range_beg_len(mrb, argv[i], &beg, &len, olen, FALSE) == MRB_RANGE_OK) {
|
356
343
|
mrb_int const end = olen < beg + len ? olen : beg + len;
|
357
344
|
for (j = beg; j < end; ++j) {
|
358
345
|
mrb_ary_push(mrb, result, func(mrb, obj, j));
|
@@ -363,7 +350,7 @@ mrb_get_values_at(mrb_state *mrb, mrb_value obj, mrb_int olen, mrb_int argc, con
|
|
363
350
|
}
|
364
351
|
}
|
365
352
|
else {
|
366
|
-
mrb_raisef(mrb, E_TYPE_ERROR, "invalid values selector: %
|
353
|
+
mrb_raisef(mrb, E_TYPE_ERROR, "invalid values selector: %v", argv[i]);
|
367
354
|
}
|
368
355
|
}
|
369
356
|
|
@@ -398,13 +385,13 @@ mrb_range_new(mrb_state *mrb, mrb_value beg, mrb_value end, mrb_bool excl)
|
|
398
385
|
return mrb_range_value(r);
|
399
386
|
}
|
400
387
|
|
401
|
-
MRB_API
|
388
|
+
MRB_API enum mrb_range_beg_len
|
402
389
|
mrb_range_beg_len(mrb_state *mrb, mrb_value range, mrb_int *begp, mrb_int *lenp, mrb_int len, mrb_bool trunc)
|
403
390
|
{
|
404
391
|
mrb_int beg, end;
|
405
392
|
struct RRange *r;
|
406
393
|
|
407
|
-
if (
|
394
|
+
if (!mrb_range_p(range)) return MRB_RANGE_TYPE_MISMATCH;
|
408
395
|
r = mrb_range_ptr(mrb, range);
|
409
396
|
|
410
397
|
beg = mrb_int(mrb, RANGE_BEG(r));
|
@@ -412,11 +399,11 @@ mrb_range_beg_len(mrb_state *mrb, mrb_value range, mrb_int *begp, mrb_int *lenp,
|
|
412
399
|
|
413
400
|
if (beg < 0) {
|
414
401
|
beg += len;
|
415
|
-
if (beg < 0) return
|
402
|
+
if (beg < 0) return MRB_RANGE_OUT;
|
416
403
|
}
|
417
404
|
|
418
405
|
if (trunc) {
|
419
|
-
if (beg > len) return
|
406
|
+
if (beg > len) return MRB_RANGE_OUT;
|
420
407
|
if (end > len) end = len;
|
421
408
|
}
|
422
409
|
|
@@ -427,7 +414,7 @@ mrb_range_beg_len(mrb_state *mrb, mrb_value range, mrb_int *begp, mrb_int *lenp,
|
|
427
414
|
|
428
415
|
*begp = beg;
|
429
416
|
*lenp = len;
|
430
|
-
return
|
417
|
+
return MRB_RANGE_OK;
|
431
418
|
}
|
432
419
|
|
433
420
|
void
|