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
@@ -0,0 +1,55 @@
|
|
1
|
+
#include <cstdint>
|
2
|
+
#include <cstddef>
|
3
|
+
#include <string>
|
4
|
+
#include <ostream>
|
5
|
+
#include <sstream>
|
6
|
+
#include <stack>
|
7
|
+
#include "ruby.pb.h"
|
8
|
+
|
9
|
+
namespace ruby_fuzzer {
|
10
|
+
class protoConverter
|
11
|
+
{
|
12
|
+
public:
|
13
|
+
protoConverter() {
|
14
|
+
m_numLiveVars = 1;
|
15
|
+
m_numVarsPerScope.push(m_numLiveVars);
|
16
|
+
}
|
17
|
+
protoConverter(protoConverter const& x) {
|
18
|
+
m_numLiveVars = x.m_numLiveVars;
|
19
|
+
m_numVarsPerScope = x.m_numVarsPerScope;
|
20
|
+
}
|
21
|
+
~protoConverter() {}
|
22
|
+
std::string FunctionToString(Function const& _input);
|
23
|
+
|
24
|
+
private:
|
25
|
+
void visit(ArrType const&);
|
26
|
+
void visit(Array const&);
|
27
|
+
void visit(AssignmentStatement const&);
|
28
|
+
void visit(BinaryOp const&);
|
29
|
+
void visit(BuiltinFuncs const&);
|
30
|
+
void visit(Const const&);
|
31
|
+
void visit(Function const&);
|
32
|
+
void visit(HashType const&);
|
33
|
+
void visit(IfElse const&);
|
34
|
+
void visit(KVPair const&);
|
35
|
+
void visit(MathConst const&);
|
36
|
+
void visit(MathOps const&);
|
37
|
+
void visit(MathType const&);
|
38
|
+
void visit(ObjectSpace const&);
|
39
|
+
void visit(Rvalue const&);
|
40
|
+
void visit(Statement const&);
|
41
|
+
void visit(StatementSeq const&);
|
42
|
+
void visit(StringExtNoArg const&);
|
43
|
+
void visit(Ternary const&);
|
44
|
+
void visit(Time const&);
|
45
|
+
void visit(VarRef const&);
|
46
|
+
template <class T>
|
47
|
+
void visit(google::protobuf::RepeatedPtrField<T> const& _repeated_field);
|
48
|
+
|
49
|
+
std::string removeSpecial(const std::string &x);
|
50
|
+
|
51
|
+
std::ostringstream m_output;
|
52
|
+
std::stack<uint8_t> m_numVarsPerScope;
|
53
|
+
int32_t m_numLiveVars;
|
54
|
+
};
|
55
|
+
}
|
@@ -0,0 +1,201 @@
|
|
1
|
+
syntax = "proto2";
|
2
|
+
|
3
|
+
message VarRef {
|
4
|
+
required int32 varnum = 1;
|
5
|
+
}
|
6
|
+
|
7
|
+
message ArrType {
|
8
|
+
repeated Const elements = 1;
|
9
|
+
}
|
10
|
+
|
11
|
+
message KVPair {
|
12
|
+
required string key = 1;
|
13
|
+
required string val = 2;
|
14
|
+
}
|
15
|
+
|
16
|
+
message HashType {
|
17
|
+
repeated KVPair keyval = 1;
|
18
|
+
}
|
19
|
+
|
20
|
+
message StringExtNoArg {
|
21
|
+
enum StrExtOp {
|
22
|
+
DUMP = 0;
|
23
|
+
STRIP = 1;
|
24
|
+
LSTRIP = 2;
|
25
|
+
RSTRIP = 3;
|
26
|
+
STRIPE = 4;
|
27
|
+
LSTRIPE = 5;
|
28
|
+
RSTRIPE = 6;
|
29
|
+
SWAPCASE = 7;
|
30
|
+
SWAPCASEE = 8;
|
31
|
+
SQUEEZE = 9;
|
32
|
+
}
|
33
|
+
required StrExtOp str_op = 1;
|
34
|
+
required string str_arg = 2;
|
35
|
+
}
|
36
|
+
|
37
|
+
message MathConst {
|
38
|
+
enum MathConstLit {
|
39
|
+
PI = 0;
|
40
|
+
E = 1;
|
41
|
+
}
|
42
|
+
required MathConstLit math_const = 1;
|
43
|
+
}
|
44
|
+
|
45
|
+
message Const {
|
46
|
+
oneof const_oneof {
|
47
|
+
uint32 int_lit = 1;
|
48
|
+
bool bool_val = 4;
|
49
|
+
}
|
50
|
+
}
|
51
|
+
|
52
|
+
message BinaryOp {
|
53
|
+
enum Op {
|
54
|
+
ADD = 0;
|
55
|
+
SUB = 1;
|
56
|
+
MUL = 2;
|
57
|
+
DIV = 3;
|
58
|
+
MOD = 4;
|
59
|
+
XOR = 5;
|
60
|
+
AND = 6;
|
61
|
+
OR = 7;
|
62
|
+
EQ = 8;
|
63
|
+
NE = 9;
|
64
|
+
LE = 10;
|
65
|
+
GE = 11;
|
66
|
+
LT = 12;
|
67
|
+
GT = 13;
|
68
|
+
RS = 14;
|
69
|
+
};
|
70
|
+
required Op op = 1;
|
71
|
+
required Rvalue left = 2;
|
72
|
+
required Rvalue right = 3;
|
73
|
+
}
|
74
|
+
|
75
|
+
message Rvalue {
|
76
|
+
oneof rvalue_oneof {
|
77
|
+
VarRef varref = 1;
|
78
|
+
Const cons = 2;
|
79
|
+
BinaryOp binop = 3;
|
80
|
+
}
|
81
|
+
}
|
82
|
+
|
83
|
+
message AssignmentStatement {
|
84
|
+
required Rvalue rvalue = 2;
|
85
|
+
}
|
86
|
+
|
87
|
+
|
88
|
+
message IfElse {
|
89
|
+
required Rvalue cond = 1;
|
90
|
+
required StatementSeq if_body = 2;
|
91
|
+
required StatementSeq else_body = 3;
|
92
|
+
}
|
93
|
+
|
94
|
+
//TODO: Add Switch statement
|
95
|
+
//message Switch {
|
96
|
+
// required Rvalue switch_var = 1;
|
97
|
+
// repeated Rvalue cond = 2;
|
98
|
+
//}
|
99
|
+
|
100
|
+
message Ternary {
|
101
|
+
required Rvalue tern_cond = 1;
|
102
|
+
required Rvalue t_branch = 2;
|
103
|
+
required Rvalue f_branch = 3;
|
104
|
+
}
|
105
|
+
|
106
|
+
message ObjectSpace {
|
107
|
+
enum OS_methods {
|
108
|
+
COUNT = 1;
|
109
|
+
}
|
110
|
+
required OS_methods os_func = 1;
|
111
|
+
required HashType os_arg = 2;
|
112
|
+
}
|
113
|
+
|
114
|
+
message Time {
|
115
|
+
enum T_methods {
|
116
|
+
AT = 1;
|
117
|
+
GM = 2;
|
118
|
+
}
|
119
|
+
required T_methods t_func = 1;
|
120
|
+
required uint32 t_arg = 2;
|
121
|
+
}
|
122
|
+
|
123
|
+
message Array {
|
124
|
+
enum Arr_methods {
|
125
|
+
FLATTEN = 1;
|
126
|
+
COMPACT = 2;
|
127
|
+
FETCH = 3;
|
128
|
+
FILL = 4;
|
129
|
+
ROTATE = 5;
|
130
|
+
ROTATE_E = 6;
|
131
|
+
DELETEIF = 7;
|
132
|
+
INSERT = 8;
|
133
|
+
BSEARCH = 9;
|
134
|
+
KEEPIF = 10;
|
135
|
+
SELECT = 11;
|
136
|
+
VALUES_AT = 12;
|
137
|
+
BLOCK = 13;
|
138
|
+
DIG = 14;
|
139
|
+
SLICE = 15;
|
140
|
+
PERM = 16;
|
141
|
+
COMB = 17;
|
142
|
+
ASSOC = 18;
|
143
|
+
RASSOC = 19;
|
144
|
+
}
|
145
|
+
required Arr_methods arr_func = 1;
|
146
|
+
required ArrType arr_arg = 2;
|
147
|
+
required Rvalue val_arg = 3;
|
148
|
+
}
|
149
|
+
|
150
|
+
message MathType {
|
151
|
+
oneof math_arg_oneof {
|
152
|
+
Rvalue math_rval = 2;
|
153
|
+
MathConst math_const = 3;
|
154
|
+
}
|
155
|
+
}
|
156
|
+
|
157
|
+
message MathOps {
|
158
|
+
enum Mops {
|
159
|
+
CBRT = 1;
|
160
|
+
COS = 2;
|
161
|
+
ERF = 3;
|
162
|
+
ERFC = 4;
|
163
|
+
LOG = 5;
|
164
|
+
LOG10 = 6;
|
165
|
+
LOG2 = 7;
|
166
|
+
SIN = 8;
|
167
|
+
SQRT = 9;
|
168
|
+
TAN = 10;
|
169
|
+
}
|
170
|
+
required Mops math_op = 1;
|
171
|
+
required MathType math_arg = 2;
|
172
|
+
}
|
173
|
+
|
174
|
+
message BuiltinFuncs {
|
175
|
+
oneof bifunc_oneof {
|
176
|
+
ObjectSpace os = 1;
|
177
|
+
Time time = 2;
|
178
|
+
Array arr = 3;
|
179
|
+
MathOps mops = 4;
|
180
|
+
}
|
181
|
+
}
|
182
|
+
|
183
|
+
message Statement {
|
184
|
+
oneof stmt_oneof {
|
185
|
+
AssignmentStatement assignment = 1;
|
186
|
+
IfElse ifelse = 2;
|
187
|
+
Ternary ternary_stmt = 3;
|
188
|
+
BuiltinFuncs builtins = 4;
|
189
|
+
StatementSeq blockstmt = 5;
|
190
|
+
}
|
191
|
+
}
|
192
|
+
|
193
|
+
message StatementSeq {
|
194
|
+
repeated Statement statements = 1;
|
195
|
+
}
|
196
|
+
|
197
|
+
message Function {
|
198
|
+
required StatementSeq statements = 1;
|
199
|
+
}
|
200
|
+
|
201
|
+
package ruby_fuzzer;
|
@@ -9,6 +9,8 @@
|
|
9
9
|
#include <mruby/class.h>
|
10
10
|
#include <mruby/string.h>
|
11
11
|
#include <mruby/range.h>
|
12
|
+
#include <mruby/proc.h>
|
13
|
+
#include <mruby/opcode.h>
|
12
14
|
#include "value_array.h"
|
13
15
|
|
14
16
|
#define ARY_DEFAULT_LEN 4
|
@@ -120,9 +122,7 @@ ary_fill_with_nil(mrb_value *ptr, mrb_int size)
|
|
120
122
|
static void
|
121
123
|
ary_modify_check(mrb_state *mrb, struct RArray *a)
|
122
124
|
{
|
123
|
-
|
124
|
-
mrb_raise(mrb, E_FROZEN_ERROR, "can't modify frozen array");
|
125
|
-
}
|
125
|
+
mrb_check_frozen(mrb, a);
|
126
126
|
}
|
127
127
|
|
128
128
|
static void
|
@@ -388,7 +388,7 @@ ary_replace(mrb_state *mrb, struct RArray *a, struct RArray *b)
|
|
388
388
|
mrb_write_barrier(mrb, (struct RBasic*)a);
|
389
389
|
return;
|
390
390
|
}
|
391
|
-
if (!
|
391
|
+
if (!mrb_frozen_p(b) && len > ARY_REPLACE_SHARED_MIN) {
|
392
392
|
ary_make_shared(mrb, b);
|
393
393
|
goto shared_b;
|
394
394
|
}
|
@@ -631,11 +631,13 @@ mrb_ary_unshift_m(mrb_state *mrb, mrb_value self)
|
|
631
631
|
ptr = a->as.heap.ptr;
|
632
632
|
}
|
633
633
|
else {
|
634
|
+
mrb_bool same = vals == ARY_PTR(a);
|
634
635
|
ary_modify(mrb, a);
|
635
636
|
if (ARY_CAPA(a) < len + alen)
|
636
637
|
ary_expand_capa(mrb, a, len + alen);
|
637
638
|
ptr = ARY_PTR(a);
|
638
639
|
value_move(ptr + alen, ptr, len);
|
640
|
+
if (same) vals = ptr;
|
639
641
|
}
|
640
642
|
array_copy(ptr, vals, alen);
|
641
643
|
ARY_SET_LEN(a, len+alen);
|
@@ -670,7 +672,7 @@ mrb_ary_set(mrb_state *mrb, mrb_value ary, mrb_int n, mrb_value val)
|
|
670
672
|
if (n < 0) {
|
671
673
|
n += len;
|
672
674
|
if (n < 0) {
|
673
|
-
mrb_raisef(mrb, E_INDEX_ERROR, "index %
|
675
|
+
mrb_raisef(mrb, E_INDEX_ERROR, "index %i out of array", n - len);
|
674
676
|
}
|
675
677
|
}
|
676
678
|
if (len <= n) {
|
@@ -702,7 +704,7 @@ mrb_ary_splice(mrb_state *mrb, mrb_value ary, mrb_int head, mrb_int len, mrb_val
|
|
702
704
|
ary_modify(mrb, a);
|
703
705
|
|
704
706
|
/* len check */
|
705
|
-
if (len < 0) mrb_raisef(mrb, E_INDEX_ERROR, "negative length (%
|
707
|
+
if (len < 0) mrb_raisef(mrb, E_INDEX_ERROR, "negative length (%i)", len);
|
706
708
|
|
707
709
|
/* range check */
|
708
710
|
if (head < 0) {
|
@@ -736,7 +738,7 @@ mrb_ary_splice(mrb_state *mrb, mrb_value ary, mrb_int head, mrb_int len, mrb_val
|
|
736
738
|
}
|
737
739
|
if (head >= alen) {
|
738
740
|
if (head > ARY_MAX_SIZE - argc) {
|
739
|
-
mrb_raisef(mrb, E_INDEX_ERROR, "index %
|
741
|
+
mrb_raisef(mrb, E_INDEX_ERROR, "index %i too big", head);
|
740
742
|
}
|
741
743
|
len = head + argc;
|
742
744
|
if (len > ARY_CAPA(a)) {
|
@@ -752,7 +754,7 @@ mrb_ary_splice(mrb_state *mrb, mrb_value ary, mrb_int head, mrb_int len, mrb_val
|
|
752
754
|
mrb_int newlen;
|
753
755
|
|
754
756
|
if (alen - len > ARY_MAX_SIZE - argc) {
|
755
|
-
mrb_raisef(mrb, E_INDEX_ERROR, "index %
|
757
|
+
mrb_raisef(mrb, E_INDEX_ERROR, "index %i too big", alen + argc - len);
|
756
758
|
}
|
757
759
|
newlen = alen + argc - len;
|
758
760
|
if (newlen > ARY_CAPA(a)) {
|
@@ -860,7 +862,7 @@ mrb_ary_aget(mrb_state *mrb, mrb_value self)
|
|
860
862
|
switch (mrb_type(index)) {
|
861
863
|
/* a[n..m] */
|
862
864
|
case MRB_TT_RANGE:
|
863
|
-
if (mrb_range_beg_len(mrb, index, &i, &len, ARY_LEN(a), TRUE) ==
|
865
|
+
if (mrb_range_beg_len(mrb, index, &i, &len, ARY_LEN(a), TRUE) == MRB_RANGE_OK) {
|
864
866
|
return ary_subseq(mrb, a, i, len);
|
865
867
|
}
|
866
868
|
else {
|
@@ -929,14 +931,14 @@ mrb_ary_aset(mrb_state *mrb, mrb_value self)
|
|
929
931
|
if (mrb_get_args(mrb, "oo|o", &v1, &v2, &v3) == 2) {
|
930
932
|
/* a[n..m] = v */
|
931
933
|
switch (mrb_range_beg_len(mrb, v1, &i, &len, RARRAY_LEN(self), FALSE)) {
|
932
|
-
case
|
934
|
+
case MRB_RANGE_TYPE_MISMATCH:
|
933
935
|
mrb_ary_set(mrb, self, aget_index(mrb, v1), v2);
|
934
936
|
break;
|
935
|
-
case
|
937
|
+
case MRB_RANGE_OK:
|
936
938
|
mrb_ary_splice(mrb, self, i, len, v2);
|
937
939
|
break;
|
938
|
-
case
|
939
|
-
mrb_raisef(mrb, E_RANGE_ERROR, "%
|
940
|
+
case MRB_RANGE_OUT:
|
941
|
+
mrb_raisef(mrb, E_RANGE_ERROR, "%v out of range", v1);
|
940
942
|
break;
|
941
943
|
}
|
942
944
|
return v2;
|
@@ -1105,7 +1107,6 @@ mrb_ary_clear(mrb_state *mrb, mrb_value self)
|
|
1105
1107
|
static mrb_value
|
1106
1108
|
mrb_ary_clear_m(mrb_state *mrb, mrb_value self)
|
1107
1109
|
{
|
1108
|
-
mrb_get_args(mrb, "");
|
1109
1110
|
return mrb_ary_clear(mrb, self);
|
1110
1111
|
}
|
1111
1112
|
|
@@ -1248,7 +1249,6 @@ mrb_ary_cmp(mrb_state *mrb, mrb_value ary1)
|
|
1248
1249
|
static mrb_value
|
1249
1250
|
mrb_ary_svalue(mrb_state *mrb, mrb_value ary)
|
1250
1251
|
{
|
1251
|
-
mrb_get_args(mrb, "");
|
1252
1252
|
switch (RARRAY_LEN(ary)) {
|
1253
1253
|
case 0:
|
1254
1254
|
return mrb_nil_value();
|
@@ -1259,46 +1259,95 @@ mrb_ary_svalue(mrb_state *mrb, mrb_value ary)
|
|
1259
1259
|
}
|
1260
1260
|
}
|
1261
1261
|
|
1262
|
+
static const mrb_code each_iseq[] = {
|
1263
|
+
OP_ENTER, 0x0, 0x00, 0x1, /* OP_ENTER 0:0:0:0:0:0:1 */
|
1264
|
+
OP_JMPIF, 0x1, 0x0, 19, /* OP_JMPIF R1 19 */
|
1265
|
+
OP_LOADSELF, 0x3, /* OP_LOADSELF R3 */
|
1266
|
+
OP_LOADSYM, 0x4, 0x0, /* OP_LOADSYM R4 :each*/
|
1267
|
+
OP_SEND, 0x3, 0x1, 0x1, /* OP_SEND R3 :to_enum 1 */
|
1268
|
+
OP_RETURN, 0x3, /* OP_RETURN R3 */
|
1269
|
+
OP_LOADI_0, 0x2, /* OP_LOADI_0 R2 */
|
1270
|
+
OP_JMP, 0x0, 43, /* OP_JMP 49 */
|
1271
|
+
OP_MOVE, 0x3, 0x1, /* OP_MOVE R3 R1 */
|
1272
|
+
OP_LOADSELF, 0x4, /* OP_LOADSELF R4 */
|
1273
|
+
OP_MOVE, 0x5, 0x2, /* OP_MOVE R5 R2 */
|
1274
|
+
OP_SEND, 0x4, 0x2, 0x1, /* OP_SEND R4 :[] 1 */
|
1275
|
+
OP_SEND, 0x3, 0x3, 0x1, /* OP_SEND R3 :call 1 */
|
1276
|
+
OP_ADDI, 0x2, 1, /* OP_ADDI R3 1 */
|
1277
|
+
OP_MOVE, 0x3, 0x2, /* OP_MOVE R3 R2 */
|
1278
|
+
OP_LOADSELF, 0x4, /* OP_LOADSELF R4 */
|
1279
|
+
OP_SEND, 0x4, 0x4, 0x0, /* OP_SEND R4 :length 0 */
|
1280
|
+
OP_LT, 0x3, /* OP_LT R3 */
|
1281
|
+
OP_JMPIF, 0x3, 0x0, 24, /* OP_JMPIF R3 24 */
|
1282
|
+
OP_RETURN, 0x0 /* OP_RETURN R3 */
|
1283
|
+
};
|
1284
|
+
|
1285
|
+
static void
|
1286
|
+
init_ary_each(mrb_state *mrb, struct RClass *ary)
|
1287
|
+
{
|
1288
|
+
struct RProc *p;
|
1289
|
+
mrb_method_t m;
|
1290
|
+
mrb_irep *each_irep = (mrb_irep*)mrb_malloc(mrb, sizeof(mrb_irep));
|
1291
|
+
static const mrb_irep mrb_irep_zero = { 0 };
|
1292
|
+
|
1293
|
+
*each_irep = mrb_irep_zero;
|
1294
|
+
each_irep->syms = (mrb_sym*)mrb_malloc(mrb, sizeof(mrb_sym)*5);
|
1295
|
+
each_irep->syms[0] = mrb_intern_lit(mrb, "each");
|
1296
|
+
each_irep->syms[1] = mrb_intern_lit(mrb, "to_enum");
|
1297
|
+
each_irep->syms[2] = mrb_intern_lit(mrb, "[]");
|
1298
|
+
each_irep->syms[3] = mrb_intern_lit(mrb, "call");
|
1299
|
+
each_irep->syms[4] = mrb_intern_lit(mrb, "length");
|
1300
|
+
each_irep->slen = 5;
|
1301
|
+
each_irep->flags = MRB_ISEQ_NO_FREE;
|
1302
|
+
each_irep->iseq = each_iseq;
|
1303
|
+
each_irep->ilen = sizeof(each_iseq);
|
1304
|
+
each_irep->nregs = 7;
|
1305
|
+
each_irep->nlocals = 3;
|
1306
|
+
p = mrb_proc_new(mrb, each_irep);
|
1307
|
+
MRB_METHOD_FROM_PROC(m, p);
|
1308
|
+
mrb_define_method_raw(mrb, ary, mrb_intern_lit(mrb, "each"), m);
|
1309
|
+
}
|
1310
|
+
|
1262
1311
|
void
|
1263
1312
|
mrb_init_array(mrb_state *mrb)
|
1264
1313
|
{
|
1265
1314
|
struct RClass *a;
|
1266
1315
|
|
1267
|
-
mrb->array_class = a = mrb_define_class(mrb, "Array", mrb->object_class);
|
1316
|
+
mrb->array_class = a = mrb_define_class(mrb, "Array", mrb->object_class); /* 15.2.12 */
|
1268
1317
|
MRB_SET_INSTANCE_TT(a, MRB_TT_ARRAY);
|
1269
1318
|
|
1270
|
-
mrb_define_class_method(mrb, a, "[]", mrb_ary_s_create, MRB_ARGS_ANY());
|
1271
|
-
|
1272
|
-
mrb_define_method(mrb, a, "+", mrb_ary_plus, MRB_ARGS_REQ(1));
|
1273
|
-
mrb_define_method(mrb, a, "*", mrb_ary_times, MRB_ARGS_REQ(1));
|
1274
|
-
mrb_define_method(mrb, a, "<<", mrb_ary_push_m, MRB_ARGS_REQ(1));
|
1275
|
-
mrb_define_method(mrb, a, "[]", mrb_ary_aget,
|
1276
|
-
mrb_define_method(mrb, a, "[]=", mrb_ary_aset,
|
1277
|
-
mrb_define_method(mrb, a, "clear", mrb_ary_clear_m, MRB_ARGS_NONE());
|
1278
|
-
mrb_define_method(mrb, a, "concat", mrb_ary_concat_m, MRB_ARGS_REQ(1));
|
1279
|
-
mrb_define_method(mrb, a, "delete_at", mrb_ary_delete_at, MRB_ARGS_REQ(1));
|
1280
|
-
mrb_define_method(mrb, a, "empty?", mrb_ary_empty_p, MRB_ARGS_NONE());
|
1281
|
-
mrb_define_method(mrb, a, "first", mrb_ary_first, MRB_ARGS_OPT(1));
|
1282
|
-
mrb_define_method(mrb, a, "index", mrb_ary_index_m, MRB_ARGS_REQ(1));
|
1283
|
-
mrb_define_method(mrb, a, "initialize_copy", mrb_ary_replace_m, MRB_ARGS_REQ(1));
|
1284
|
-
mrb_define_method(mrb, a, "join", mrb_ary_join_m,
|
1285
|
-
mrb_define_method(mrb, a, "last", mrb_ary_last,
|
1286
|
-
mrb_define_method(mrb, a, "length", mrb_ary_size, MRB_ARGS_NONE());
|
1287
|
-
mrb_define_method(mrb, a, "pop", mrb_ary_pop, MRB_ARGS_NONE());
|
1288
|
-
mrb_define_method(mrb, a, "push", mrb_ary_push_m, MRB_ARGS_ANY());
|
1289
|
-
mrb_define_method(mrb, a, "
|
1290
|
-
mrb_define_method(mrb, a, "
|
1291
|
-
mrb_define_method(mrb, a, "reverse",
|
1292
|
-
mrb_define_method(mrb, a, "
|
1293
|
-
mrb_define_method(mrb, a, "
|
1294
|
-
mrb_define_method(mrb, a, "
|
1295
|
-
mrb_define_method(mrb, a, "
|
1296
|
-
mrb_define_method(mrb, a, "
|
1297
|
-
mrb_define_method(mrb, a, "unshift", mrb_ary_unshift_m, MRB_ARGS_ANY()); /* 15.2.12.5.30 */
|
1298
|
-
mrb_define_method(mrb, a, "prepend", mrb_ary_unshift_m, MRB_ARGS_ANY());
|
1319
|
+
mrb_define_class_method(mrb, a, "[]", mrb_ary_s_create, MRB_ARGS_ANY()); /* 15.2.12.4.1 */
|
1320
|
+
|
1321
|
+
mrb_define_method(mrb, a, "+", mrb_ary_plus, MRB_ARGS_REQ(1)); /* 15.2.12.5.1 */
|
1322
|
+
mrb_define_method(mrb, a, "*", mrb_ary_times, MRB_ARGS_REQ(1)); /* 15.2.12.5.2 */
|
1323
|
+
mrb_define_method(mrb, a, "<<", mrb_ary_push_m, MRB_ARGS_REQ(1)); /* 15.2.12.5.3 */
|
1324
|
+
mrb_define_method(mrb, a, "[]", mrb_ary_aget, MRB_ARGS_ARG(1,1)); /* 15.2.12.5.4 */
|
1325
|
+
mrb_define_method(mrb, a, "[]=", mrb_ary_aset, MRB_ARGS_ARG(2,1)); /* 15.2.12.5.5 */
|
1326
|
+
mrb_define_method(mrb, a, "clear", mrb_ary_clear_m, MRB_ARGS_NONE()); /* 15.2.12.5.6 */
|
1327
|
+
mrb_define_method(mrb, a, "concat", mrb_ary_concat_m, MRB_ARGS_REQ(1)); /* 15.2.12.5.8 */
|
1328
|
+
mrb_define_method(mrb, a, "delete_at", mrb_ary_delete_at, MRB_ARGS_REQ(1)); /* 15.2.12.5.9 */
|
1329
|
+
mrb_define_method(mrb, a, "empty?", mrb_ary_empty_p, MRB_ARGS_NONE()); /* 15.2.12.5.12 */
|
1330
|
+
mrb_define_method(mrb, a, "first", mrb_ary_first, MRB_ARGS_OPT(1)); /* 15.2.12.5.13 */
|
1331
|
+
mrb_define_method(mrb, a, "index", mrb_ary_index_m, MRB_ARGS_REQ(1)); /* 15.2.12.5.14 */
|
1332
|
+
mrb_define_method(mrb, a, "initialize_copy", mrb_ary_replace_m, MRB_ARGS_REQ(1)); /* 15.2.12.5.16 */
|
1333
|
+
mrb_define_method(mrb, a, "join", mrb_ary_join_m, MRB_ARGS_OPT(1)); /* 15.2.12.5.17 */
|
1334
|
+
mrb_define_method(mrb, a, "last", mrb_ary_last, MRB_ARGS_OPT(1)); /* 15.2.12.5.18 */
|
1335
|
+
mrb_define_method(mrb, a, "length", mrb_ary_size, MRB_ARGS_NONE()); /* 15.2.12.5.19 */
|
1336
|
+
mrb_define_method(mrb, a, "pop", mrb_ary_pop, MRB_ARGS_NONE()); /* 15.2.12.5.21 */
|
1337
|
+
mrb_define_method(mrb, a, "push", mrb_ary_push_m, MRB_ARGS_ANY()); /* 15.2.12.5.22 */
|
1338
|
+
mrb_define_method(mrb, a, "replace", mrb_ary_replace_m, MRB_ARGS_REQ(1)); /* 15.2.12.5.23 */
|
1339
|
+
mrb_define_method(mrb, a, "reverse", mrb_ary_reverse, MRB_ARGS_NONE()); /* 15.2.12.5.24 */
|
1340
|
+
mrb_define_method(mrb, a, "reverse!", mrb_ary_reverse_bang, MRB_ARGS_NONE()); /* 15.2.12.5.25 */
|
1341
|
+
mrb_define_method(mrb, a, "rindex", mrb_ary_rindex_m, MRB_ARGS_REQ(1)); /* 15.2.12.5.26 */
|
1342
|
+
mrb_define_method(mrb, a, "shift", mrb_ary_shift, MRB_ARGS_NONE()); /* 15.2.12.5.27 */
|
1343
|
+
mrb_define_method(mrb, a, "size", mrb_ary_size, MRB_ARGS_NONE()); /* 15.2.12.5.28 */
|
1344
|
+
mrb_define_method(mrb, a, "slice", mrb_ary_aget, MRB_ARGS_ARG(1,1)); /* 15.2.12.5.29 */
|
1345
|
+
mrb_define_method(mrb, a, "unshift", mrb_ary_unshift_m, MRB_ARGS_ANY()); /* 15.2.12.5.30 */
|
1299
1346
|
|
1300
1347
|
mrb_define_method(mrb, a, "__ary_eq", mrb_ary_eq, MRB_ARGS_REQ(1));
|
1301
1348
|
mrb_define_method(mrb, a, "__ary_cmp", mrb_ary_cmp, MRB_ARGS_REQ(1));
|
1302
|
-
mrb_define_method(mrb, a, "__ary_index", mrb_ary_index_m, MRB_ARGS_REQ(1));
|
1349
|
+
mrb_define_method(mrb, a, "__ary_index", mrb_ary_index_m, MRB_ARGS_REQ(1)); /* kept for mruby-array-ext */
|
1303
1350
|
mrb_define_method(mrb, a, "__svalue", mrb_ary_svalue, MRB_ARGS_NONE());
|
1351
|
+
|
1352
|
+
init_ary_each(mrb, a);
|
1304
1353
|
}
|