script_core 0.2.2 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +41 -45
- data/.travis.yml +2 -1
- data/Gemfile +3 -3
- data/README.md +7 -1
- data/bootstrap.sh +2 -2
- data/ext/enterprise_script_service/libseccomp/.travis.yml +24 -12
- data/ext/enterprise_script_service/libseccomp/CHANGELOG +32 -0
- data/ext/enterprise_script_service/libseccomp/CONTRIBUTING.md +37 -26
- data/ext/enterprise_script_service/libseccomp/CREDITS +11 -0
- data/ext/enterprise_script_service/libseccomp/README.md +21 -1
- data/ext/enterprise_script_service/libseccomp/configure.ac +13 -8
- data/ext/enterprise_script_service/libseccomp/doc/Makefile.am +6 -0
- data/ext/enterprise_script_service/libseccomp/doc/man/man3/seccomp_api_get.3 +12 -2
- data/ext/enterprise_script_service/libseccomp/doc/man/man3/seccomp_arch_add.3 +38 -6
- data/ext/enterprise_script_service/libseccomp/doc/man/man3/seccomp_attr_set.3 +53 -2
- data/ext/enterprise_script_service/libseccomp/doc/man/man3/seccomp_export_bpf.3 +20 -2
- data/ext/enterprise_script_service/libseccomp/doc/man/man3/seccomp_init.3 +9 -2
- data/ext/enterprise_script_service/libseccomp/doc/man/man3/seccomp_load.3 +32 -2
- data/ext/enterprise_script_service/libseccomp/doc/man/man3/seccomp_merge.3 +16 -2
- data/ext/enterprise_script_service/libseccomp/doc/man/man3/seccomp_notify_alloc.3 +113 -0
- data/ext/enterprise_script_service/libseccomp/doc/man/man3/seccomp_notify_fd.3 +1 -0
- data/ext/enterprise_script_service/libseccomp/doc/man/man3/seccomp_notify_free.3 +1 -0
- data/ext/enterprise_script_service/libseccomp/doc/man/man3/seccomp_notify_id_valid.3 +1 -0
- data/ext/enterprise_script_service/libseccomp/doc/man/man3/seccomp_notify_receive.3 +1 -0
- data/ext/enterprise_script_service/libseccomp/doc/man/man3/seccomp_notify_respond.3 +1 -0
- data/ext/enterprise_script_service/libseccomp/doc/man/man3/seccomp_rule_add.3 +64 -3
- data/ext/enterprise_script_service/libseccomp/doc/man/man3/seccomp_syscall_priority.3 +18 -3
- data/ext/enterprise_script_service/libseccomp/include/seccomp-syscalls.h +19 -0
- data/ext/enterprise_script_service/libseccomp/include/seccomp.h.in +116 -0
- data/ext/enterprise_script_service/libseccomp/src/.gitignore +2 -0
- data/ext/enterprise_script_service/libseccomp/src/Makefile.am +31 -17
- data/ext/enterprise_script_service/libseccomp/src/api.c +254 -58
- data/ext/enterprise_script_service/libseccomp/src/arch-aarch64.h +1 -9
- data/ext/enterprise_script_service/libseccomp/src/arch-arm.c +47 -2
- data/ext/enterprise_script_service/libseccomp/src/arch-arm.h +1 -9
- data/ext/enterprise_script_service/libseccomp/src/arch-gperf-generate +40 -0
- data/ext/enterprise_script_service/libseccomp/src/arch-mips.c +41 -4
- data/ext/enterprise_script_service/libseccomp/src/arch-mips.h +2 -10
- data/ext/enterprise_script_service/libseccomp/src/arch-mips64.c +41 -4
- data/ext/enterprise_script_service/libseccomp/src/arch-mips64.h +3 -11
- data/ext/enterprise_script_service/libseccomp/src/arch-mips64n32.c +41 -4
- data/ext/enterprise_script_service/libseccomp/src/arch-mips64n32.h +2 -10
- data/ext/enterprise_script_service/libseccomp/src/arch-parisc.h +1 -10
- data/ext/enterprise_script_service/libseccomp/src/arch-parisc64.c +3 -3
- data/ext/enterprise_script_service/libseccomp/src/arch-parisc64.h +29 -0
- data/ext/enterprise_script_service/libseccomp/src/arch-ppc.h +1 -9
- data/ext/enterprise_script_service/libseccomp/src/arch-ppc64.c +606 -8
- data/ext/enterprise_script_service/libseccomp/src/arch-ppc64.h +2 -10
- data/ext/enterprise_script_service/libseccomp/src/arch-riscv64.c +31 -0
- data/ext/enterprise_script_service/libseccomp/src/arch-riscv64.h +22 -0
- data/ext/enterprise_script_service/libseccomp/src/arch-s390.c +171 -12
- data/ext/enterprise_script_service/libseccomp/src/arch-s390.h +1 -17
- data/ext/enterprise_script_service/libseccomp/src/arch-s390x.c +166 -10
- data/ext/enterprise_script_service/libseccomp/src/arch-s390x.h +1 -20
- data/ext/enterprise_script_service/libseccomp/src/arch-syscall-dump.c +8 -1
- data/ext/enterprise_script_service/libseccomp/src/arch-syscall-validate +359 -143
- data/ext/enterprise_script_service/libseccomp/src/arch-x32.c +36 -2
- data/ext/enterprise_script_service/libseccomp/src/arch-x32.h +2 -10
- data/ext/enterprise_script_service/libseccomp/src/arch-x86.c +172 -10
- data/ext/enterprise_script_service/libseccomp/src/arch-x86.h +1 -14
- data/ext/enterprise_script_service/libseccomp/src/arch-x86_64.h +1 -9
- data/ext/enterprise_script_service/libseccomp/src/arch.c +11 -3
- data/ext/enterprise_script_service/libseccomp/src/arch.h +7 -0
- data/ext/enterprise_script_service/libseccomp/src/db.c +268 -57
- data/ext/enterprise_script_service/libseccomp/src/db.h +16 -2
- data/ext/enterprise_script_service/libseccomp/src/gen_bpf.c +503 -148
- data/ext/enterprise_script_service/libseccomp/src/gen_bpf.h +2 -1
- data/ext/enterprise_script_service/libseccomp/src/gen_pfc.c +165 -37
- data/ext/enterprise_script_service/libseccomp/src/python/libseccomp.pxd +37 -1
- data/ext/enterprise_script_service/libseccomp/src/python/seccomp.pyx +295 -5
- data/ext/enterprise_script_service/libseccomp/src/syscalls.c +56 -0
- data/ext/enterprise_script_service/libseccomp/src/syscalls.csv +470 -0
- data/ext/enterprise_script_service/libseccomp/src/syscalls.h +62 -0
- data/ext/enterprise_script_service/libseccomp/src/syscalls.perf.template +82 -0
- data/ext/enterprise_script_service/libseccomp/src/system.c +196 -16
- data/ext/enterprise_script_service/libseccomp/src/system.h +68 -13
- data/ext/enterprise_script_service/libseccomp/tests/.gitignore +10 -2
- data/ext/enterprise_script_service/libseccomp/tests/06-sim-actions.tests +1 -1
- data/ext/enterprise_script_service/libseccomp/tests/11-basic-basic_errors.c +5 -5
- data/ext/enterprise_script_service/libseccomp/tests/13-basic-attrs.c +35 -1
- data/ext/enterprise_script_service/libseccomp/tests/13-basic-attrs.py +10 -1
- data/ext/enterprise_script_service/libseccomp/tests/15-basic-resolver.c +4 -3
- data/ext/enterprise_script_service/libseccomp/tests/16-sim-arch_basic.c +12 -0
- data/ext/enterprise_script_service/libseccomp/tests/16-sim-arch_basic.py +1 -0
- data/ext/enterprise_script_service/libseccomp/tests/{18-sim-basic_whitelist.c → 18-sim-basic_allowlist.c} +0 -0
- data/ext/enterprise_script_service/libseccomp/tests/{18-sim-basic_whitelist.py → 18-sim-basic_allowlist.py} +0 -0
- data/ext/enterprise_script_service/libseccomp/tests/18-sim-basic_allowlist.tests +32 -0
- data/ext/enterprise_script_service/libseccomp/tests/23-sim-arch_all_le_basic.c +3 -0
- data/ext/enterprise_script_service/libseccomp/tests/23-sim-arch_all_le_basic.py +1 -0
- data/ext/enterprise_script_service/libseccomp/tests/30-sim-socket_syscalls.c +3 -0
- data/ext/enterprise_script_service/libseccomp/tests/30-sim-socket_syscalls.py +1 -0
- data/ext/enterprise_script_service/libseccomp/tests/30-sim-socket_syscalls.tests +33 -17
- data/ext/enterprise_script_service/libseccomp/tests/{34-sim-basic_blacklist.c → 34-sim-basic_denylist.c} +0 -0
- data/ext/enterprise_script_service/libseccomp/tests/{34-sim-basic_blacklist.py → 34-sim-basic_denylist.py} +0 -0
- data/ext/enterprise_script_service/libseccomp/tests/34-sim-basic_denylist.tests +32 -0
- data/ext/enterprise_script_service/libseccomp/tests/36-sim-ipc_syscalls.c +3 -0
- data/ext/enterprise_script_service/libseccomp/tests/36-sim-ipc_syscalls.py +1 -0
- data/ext/enterprise_script_service/libseccomp/tests/36-sim-ipc_syscalls.tests +25 -25
- data/ext/enterprise_script_service/libseccomp/tests/39-basic-api_level.c +24 -3
- data/ext/enterprise_script_service/libseccomp/tests/39-basic-api_level.py +16 -1
- data/ext/enterprise_script_service/libseccomp/tests/47-live-kill_process.c +3 -3
- data/ext/enterprise_script_service/libseccomp/tests/51-live-user_notification.c +112 -0
- data/ext/enterprise_script_service/libseccomp/tests/51-live-user_notification.py +60 -0
- data/ext/enterprise_script_service/libseccomp/tests/51-live-user_notification.tests +11 -0
- data/ext/enterprise_script_service/libseccomp/tests/52-basic-load.c +48 -0
- data/ext/enterprise_script_service/libseccomp/tests/52-basic-load.py +38 -0
- data/ext/enterprise_script_service/libseccomp/tests/52-basic-load.tests +11 -0
- data/ext/enterprise_script_service/libseccomp/tests/53-sim-binary_tree.c +156 -0
- data/ext/enterprise_script_service/libseccomp/tests/53-sim-binary_tree.py +95 -0
- data/ext/enterprise_script_service/libseccomp/tests/53-sim-binary_tree.tests +65 -0
- data/ext/enterprise_script_service/libseccomp/tests/54-live-binary_tree.c +128 -0
- data/ext/enterprise_script_service/libseccomp/tests/54-live-binary_tree.py +95 -0
- data/ext/enterprise_script_service/libseccomp/tests/54-live-binary_tree.tests +11 -0
- data/ext/enterprise_script_service/libseccomp/tests/55-basic-pfc_binary_tree.c +134 -0
- data/ext/enterprise_script_service/libseccomp/tests/55-basic-pfc_binary_tree.sh +46 -0
- data/ext/enterprise_script_service/libseccomp/tests/55-basic-pfc_binary_tree.tests +11 -0
- data/ext/enterprise_script_service/libseccomp/tests/56-basic-iterate_syscalls.c +90 -0
- data/ext/enterprise_script_service/libseccomp/tests/56-basic-iterate_syscalls.py +65 -0
- data/ext/enterprise_script_service/libseccomp/tests/56-basic-iterate_syscalls.tests +11 -0
- data/ext/enterprise_script_service/libseccomp/tests/57-basic-rawsysrc.c +64 -0
- data/ext/enterprise_script_service/libseccomp/tests/57-basic-rawsysrc.py +46 -0
- data/ext/enterprise_script_service/libseccomp/tests/57-basic-rawsysrc.tests +11 -0
- data/ext/enterprise_script_service/libseccomp/tests/58-live-tsync_notify.c +116 -0
- data/ext/enterprise_script_service/libseccomp/tests/58-live-tsync_notify.py +61 -0
- data/ext/enterprise_script_service/libseccomp/tests/58-live-tsync_notify.tests +11 -0
- data/ext/enterprise_script_service/libseccomp/tests/Makefile.am +34 -10
- data/ext/enterprise_script_service/libseccomp/tests/regression +10 -3
- data/ext/enterprise_script_service/libseccomp/tests/util.c +3 -3
- data/ext/enterprise_script_service/libseccomp/tools/Makefile.am +0 -3
- data/ext/enterprise_script_service/libseccomp/tools/check-syntax +1 -1
- data/ext/enterprise_script_service/libseccomp/tools/scmp_arch_detect.c +3 -0
- data/ext/enterprise_script_service/libseccomp/tools/scmp_bpf_disasm.c +4 -2
- data/ext/enterprise_script_service/libseccomp/tools/scmp_bpf_sim.c +4 -0
- data/ext/enterprise_script_service/libseccomp/tools/util.c +14 -12
- data/ext/enterprise_script_service/libseccomp/tools/util.h +7 -0
- data/ext/enterprise_script_service/mruby/.github/workflows/build.yml +106 -0
- data/ext/enterprise_script_service/mruby/.github/workflows/codeql-analysis.yml +51 -0
- data/ext/enterprise_script_service/mruby/.github/workflows/main.yml +24 -0
- data/ext/enterprise_script_service/mruby/.gitignore +3 -0
- data/ext/enterprise_script_service/mruby/.travis.yml +6 -9
- data/ext/enterprise_script_service/mruby/AUTHORS +1 -0
- data/ext/enterprise_script_service/mruby/Doxyfile +1 -1
- data/ext/enterprise_script_service/mruby/LICENSE +1 -1
- data/ext/enterprise_script_service/mruby/README.md +6 -2
- data/ext/enterprise_script_service/mruby/appveyor.yml +9 -12
- data/ext/enterprise_script_service/mruby/appveyor_config.rb +9 -0
- data/ext/enterprise_script_service/mruby/build_config.rb +6 -6
- data/ext/enterprise_script_service/mruby/doc/guides/compile.md +6 -2
- data/ext/enterprise_script_service/mruby/doc/guides/debugger.md +1 -1
- data/ext/enterprise_script_service/mruby/doc/guides/mrbconf.md +4 -8
- data/ext/enterprise_script_service/mruby/doc/limitations.md +10 -10
- data/ext/enterprise_script_service/mruby/doc/opcode.md +108 -95
- data/ext/enterprise_script_service/mruby/examples/targets/build_config_ArduinoDue.rb +2 -2
- data/ext/enterprise_script_service/mruby/examples/targets/build_config_IntelEdison.rb +2 -2
- data/ext/enterprise_script_service/mruby/examples/targets/build_config_IntelGalileo.rb +2 -2
- data/ext/enterprise_script_service/mruby/examples/targets/build_config_RX630.rb +2 -2
- data/ext/enterprise_script_service/mruby/examples/targets/build_config_chipKITMax32.rb +2 -2
- data/ext/enterprise_script_service/mruby/examples/targets/build_config_dreamcast_shelf.rb +108 -0
- data/ext/enterprise_script_service/mruby/include/mrbconf.h +10 -7
- data/ext/enterprise_script_service/mruby/include/mruby.h +24 -9
- data/ext/enterprise_script_service/mruby/include/mruby/array.h +4 -0
- data/ext/enterprise_script_service/mruby/include/mruby/boxing_nan.h +11 -2
- data/ext/enterprise_script_service/mruby/include/mruby/boxing_word.h +0 -10
- data/ext/enterprise_script_service/mruby/include/mruby/common.h +10 -0
- data/ext/enterprise_script_service/mruby/include/mruby/compile.h +11 -3
- data/ext/enterprise_script_service/mruby/include/mruby/dump.h +1 -17
- data/ext/enterprise_script_service/mruby/include/mruby/irep.h +10 -0
- data/ext/enterprise_script_service/mruby/include/mruby/istruct.h +4 -1
- data/ext/enterprise_script_service/mruby/include/mruby/khash.h +23 -5
- data/ext/enterprise_script_service/mruby/include/mruby/numeric.h +1 -0
- data/ext/enterprise_script_service/mruby/include/mruby/ops.h +3 -2
- data/ext/enterprise_script_service/mruby/include/mruby/proc.h +13 -8
- data/ext/enterprise_script_service/mruby/include/mruby/string.h +2 -1
- data/ext/enterprise_script_service/mruby/include/mruby/value.h +32 -41
- data/ext/enterprise_script_service/mruby/include/mruby/version.h +4 -4
- data/ext/enterprise_script_service/mruby/lib/mruby/build.rb +2 -30
- data/ext/enterprise_script_service/mruby/lib/mruby/build/command.rb +21 -46
- data/ext/enterprise_script_service/mruby/lib/mruby/gem.rb +9 -0
- data/ext/enterprise_script_service/mruby/lib/mruby/source.rb +3 -1
- data/ext/enterprise_script_service/mruby/mrbgems/default.gembox +7 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-array-ext/mrblib/array.rb +0 -31
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-array-ext/src/array.c +5 -8
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-array-ext/test/array.rb +0 -13
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-config/mrbgem.rake +5 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.c +0 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/mrdbconf.h +5 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mirb/tools/mirb/mirb.c +7 -3
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mrbc/tools/mrbc/mrbc.c +24 -21
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mruby/mrbgem.rake +0 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c +6 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-strip/tools/mruby-strip/mruby-strip.c +6 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-class-ext/src/class.c +6 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/codegen.c +76 -48
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/parse.y +107 -32
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/y.tab.c +13153 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/mrbgem.rake +13 -15
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-complex/mrblib/complex.rb +1 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-complex/src/complex.c +1 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-error/src/exception.c +3 -3
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-eval/src/eval.c +3 -214
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-eval/test/eval.rb +21 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-fiber/src/fiber.c +1 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-hash-ext/src/hash-ext.c +1 -3
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-inline-struct/test/inline.c +3 -4
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/include/mruby/ext/io.h +39 -7
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/mrbgem.rake +2 -8
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/mrblib/file_constants.rb +0 -16
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/mrblib/io.rb +7 -12
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/src/file.c +77 -32
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/src/file_test.c +18 -36
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/src/io.c +324 -122
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/test/file.rb +18 -12
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/test/io.rb +32 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/test/mruby_io_test.c +57 -49
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-kernel-ext/src/kernel.c +6 -8
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-metaprog/src/metaprog.c +15 -17
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-metaprog/test/metaprog.rb +9 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-method/src/method.c +4 -5
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-object-ext/src/object.c +3 -12
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-objectspace/src/mruby_objectspace.c +0 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/src/pack.c +113 -10
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-print/src/print.c +6 -3
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-proc-ext/src/proc.c +2 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-range-ext/src/range.c +1 -3
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-rational/mrblib/rational.rb +1 -3
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-rational/src/rational.c +9 -9
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-sleep/src/mrb_sleep.c +1 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-socket/mrbgem.rake +1 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-socket/test/sockettest.c +3 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-sprintf/src/sprintf.c +62 -25
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-sprintf/test/sprintf.rb +5 -23
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/src/string.c +4 -5
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-struct/src/struct.c +5 -11
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-symbol-ext/src/symbol.c +1 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-test/mrbgem.rake +1 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-time/src/time.c +11 -15
- data/ext/enterprise_script_service/mruby/mrblib/00class.rb +10 -0
- data/ext/enterprise_script_service/mruby/mrblib/hash.rb +3 -3
- data/ext/enterprise_script_service/mruby/src/array.c +25 -11
- data/ext/enterprise_script_service/mruby/src/backtrace.c +2 -2
- data/ext/enterprise_script_service/mruby/src/class.c +48 -32
- data/ext/enterprise_script_service/mruby/src/codedump.c +4 -0
- data/ext/enterprise_script_service/mruby/src/debug.c +8 -5
- data/ext/enterprise_script_service/mruby/src/dump.c +3 -65
- data/ext/enterprise_script_service/mruby/src/error.c +58 -7
- data/ext/enterprise_script_service/mruby/src/etc.c +13 -5
- data/ext/enterprise_script_service/mruby/src/fmt_fp.c +98 -21
- data/ext/enterprise_script_service/mruby/src/gc.c +15 -280
- data/ext/enterprise_script_service/mruby/src/hash.c +13 -21
- data/ext/enterprise_script_service/mruby/src/kernel.c +6 -9
- data/ext/enterprise_script_service/mruby/src/load.c +56 -30
- data/ext/enterprise_script_service/mruby/src/numeric.c +50 -70
- data/ext/enterprise_script_service/mruby/src/object.c +23 -5
- data/ext/enterprise_script_service/mruby/src/print.c +27 -3
- data/ext/enterprise_script_service/mruby/src/proc.c +26 -7
- data/ext/enterprise_script_service/mruby/src/range.c +4 -12
- data/ext/enterprise_script_service/mruby/src/state.c +34 -11
- data/ext/enterprise_script_service/mruby/src/string.c +93 -56
- data/ext/enterprise_script_service/mruby/src/symbol.c +13 -12
- data/ext/enterprise_script_service/mruby/src/vm.c +48 -53
- data/ext/enterprise_script_service/mruby/tasks/gitlab.rake +19 -22
- data/ext/enterprise_script_service/mruby/tasks/mrbgems.rake +1 -1
- data/ext/enterprise_script_service/mruby/tasks/toolchains/android.rake +46 -1
- data/ext/enterprise_script_service/mruby/tasks/toolchains/gcc.rake +3 -3
- data/ext/enterprise_script_service/mruby/tasks/toolchains/openwrt.rake +6 -6
- data/ext/enterprise_script_service/mruby/tasks/toolchains/visualcpp.rake +8 -8
- data/ext/enterprise_script_service/mruby/test/assert.rb +5 -4
- data/ext/enterprise_script_service/mruby/test/t/ensure.rb +8 -26
- data/ext/enterprise_script_service/mruby/test/t/exception.rb +2 -2
- data/ext/enterprise_script_service/mruby/test/t/kernel.rb +15 -24
- data/ext/enterprise_script_service/mruby/travis_config.rb +0 -14
- data/ext/enterprise_script_service/msgpack/.github/depends/boost.sh +56 -0
- data/ext/enterprise_script_service/msgpack/.github/workflows/coverage.yml +62 -0
- data/ext/enterprise_script_service/msgpack/.github/workflows/gha.yml +304 -0
- data/ext/enterprise_script_service/msgpack/CHANGELOG.md +11 -0
- data/ext/enterprise_script_service/msgpack/CMakeLists.txt +82 -39
- data/ext/enterprise_script_service/msgpack/Files.cmake +22 -12
- data/ext/enterprise_script_service/msgpack/QUICKSTART-C.md +26 -29
- data/ext/enterprise_script_service/msgpack/README.md +3 -2
- data/ext/enterprise_script_service/msgpack/appveyor.yml +6 -2
- data/ext/enterprise_script_service/msgpack/ci/build_cmake.sh +3 -1
- data/ext/enterprise_script_service/msgpack/cmake/CodeCoverage.cmake +55 -0
- data/ext/enterprise_script_service/msgpack/codecov.yml +36 -0
- data/ext/enterprise_script_service/msgpack/example/CMakeLists.txt +9 -5
- data/ext/enterprise_script_service/msgpack/example/boost/CMakeLists.txt +1 -1
- data/ext/enterprise_script_service/msgpack/example/c/CMakeLists.txt +17 -6
- data/ext/enterprise_script_service/msgpack/example/c/boundary.c +296 -0
- data/ext/enterprise_script_service/msgpack/example/c/jsonconv.c +419 -0
- data/ext/enterprise_script_service/msgpack/example/c/simple_c.c +1 -1
- data/ext/enterprise_script_service/msgpack/example/cpp03/CMakeLists.txt +3 -3
- data/ext/enterprise_script_service/msgpack/example/cpp11/CMakeLists.txt +2 -2
- data/ext/enterprise_script_service/msgpack/example/x3/CMakeLists.txt +2 -2
- data/ext/enterprise_script_service/msgpack/include/msgpack/pack.h +24 -1
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/array_ref.hpp +5 -4
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/boost/optional.hpp +4 -4
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/cpp17/vector_byte.hpp +8 -8
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/map.hpp +4 -4
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/vector.hpp +4 -4
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/vector_char.hpp +8 -8
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/vector_unsigned_char.hpp +8 -8
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/wstring.hpp +4 -4
- data/ext/enterprise_script_service/msgpack/include/msgpack/v3/unpack.hpp +6 -6
- data/ext/enterprise_script_service/msgpack/include/msgpack/version_master.h +2 -2
- data/ext/enterprise_script_service/msgpack/include/msgpack/zbuffer.h +4 -4
- data/ext/enterprise_script_service/msgpack/make_file_list.sh +38 -11
- data/ext/enterprise_script_service/msgpack/src/vrefbuffer.c +6 -0
- data/ext/enterprise_script_service/msgpack/test/CMakeLists.txt +86 -64
- data/ext/enterprise_script_service/msgpack/test/array_ref.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/boost_fusion.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/boost_optional.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/boost_string_ref.cpp +4 -1
- data/ext/enterprise_script_service/msgpack/test/boost_string_view.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/boost_variant.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/buffer.cpp +4 -47
- data/ext/enterprise_script_service/msgpack/test/buffer_c.cpp +148 -0
- data/ext/enterprise_script_service/msgpack/test/carray.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/cases.cpp +8 -4
- data/ext/enterprise_script_service/msgpack/test/convert.cpp +8 -4
- data/ext/enterprise_script_service/msgpack/test/fixint.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/fixint_c.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/fuzz_unpack_pack_fuzzer_cpp11.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/iterator_cpp11.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/json.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/limit.cpp +8 -4
- data/ext/enterprise_script_service/msgpack/test/msgpack_basic.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/msgpack_c.cpp +159 -0
- data/ext/enterprise_script_service/msgpack/test/msgpack_container.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/msgpack_cpp11.cpp +32 -27
- data/ext/enterprise_script_service/msgpack/test/msgpack_cpp17.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/msgpack_stream.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/msgpack_tuple.cpp +4 -1
- data/ext/enterprise_script_service/msgpack/test/msgpack_vref.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/msgpack_x3_parse.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/object.cpp +4 -1
- data/ext/enterprise_script_service/msgpack/test/object_with_zone.cpp +12 -8
- data/ext/enterprise_script_service/msgpack/test/pack_unpack.cpp +30 -26
- data/ext/enterprise_script_service/msgpack/test/pack_unpack_c.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/raw.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/reference.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/reference_cpp11.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/reference_wrapper_cpp11.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/shared_ptr_cpp11.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/size_equal_only.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/streaming.cpp +8 -4
- data/ext/enterprise_script_service/msgpack/test/streaming_c.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/unique_ptr_cpp11.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/user_class.cpp +16 -12
- data/ext/enterprise_script_service/msgpack/test/version.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/visitor.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/zone.cpp +4 -0
- data/lib/script_core/engine.rb +24 -5
- data/lib/script_core/executable.rb +4 -3
- data/lib/script_core/result.rb +1 -5
- data/lib/script_core/service_channel.rb +1 -0
- data/lib/script_core/version.rb +1 -1
- data/lib/tasks/script_core.rake +3 -1
- data/script_core.gemspec +2 -2
- data/spec/dummy/app/lib/script_engine.rb +64 -5
- metadata +68 -30
- data/ext/enterprise_script_service/libseccomp/src/arch-aarch64-syscalls.c +0 -559
- data/ext/enterprise_script_service/libseccomp/src/arch-arm-syscalls.c +0 -570
- data/ext/enterprise_script_service/libseccomp/src/arch-mips-syscalls.c +0 -562
- data/ext/enterprise_script_service/libseccomp/src/arch-mips64-syscalls.c +0 -562
- data/ext/enterprise_script_service/libseccomp/src/arch-mips64n32-syscalls.c +0 -562
- data/ext/enterprise_script_service/libseccomp/src/arch-parisc-syscalls.c +0 -542
- data/ext/enterprise_script_service/libseccomp/src/arch-ppc-syscalls.c +0 -559
- data/ext/enterprise_script_service/libseccomp/src/arch-ppc64-syscalls.c +0 -559
- data/ext/enterprise_script_service/libseccomp/src/arch-s390-syscalls.c +0 -626
- data/ext/enterprise_script_service/libseccomp/src/arch-s390x-syscalls.c +0 -626
- data/ext/enterprise_script_service/libseccomp/src/arch-x32-syscalls.c +0 -558
- data/ext/enterprise_script_service/libseccomp/src/arch-x86-syscalls.c +0 -692
- data/ext/enterprise_script_service/libseccomp/src/arch-x86_64-syscalls.c +0 -559
- data/ext/enterprise_script_service/libseccomp/tests/18-sim-basic_whitelist.tests +0 -32
- data/ext/enterprise_script_service/libseccomp/tests/34-sim-basic_blacklist.tests +0 -32
- data/ext/enterprise_script_service/msgpack/.travis.yml +0 -258
@@ -8,6 +8,11 @@
|
|
8
8
|
assert_equal 15, ("%b" % (1<<14)).size
|
9
9
|
skip unless Object.const_defined?(:Float)
|
10
10
|
assert_equal "1.0", "%3.1f" % 1.01
|
11
|
+
assert_equal " 123456789.12", "% 4.2f" % 123456789.123456789
|
12
|
+
assert_equal "123456789.12", "%-4.2f" % 123456789.123456789
|
13
|
+
assert_equal "+123456789.12", "%+4.2f" % 123456789.123456789
|
14
|
+
assert_equal "123456789.12", "%04.2f" % 123456789.123456789
|
15
|
+
assert_equal "00000000123456789.12", "%020.2f" % 123456789.123456789
|
11
16
|
end
|
12
17
|
|
13
18
|
assert('String#% with inf') do
|
@@ -68,29 +73,6 @@
|
|
68
73
|
assert_equal " NaN", "% 5f" % nan
|
69
74
|
end
|
70
75
|
|
71
|
-
assert("String#% with invalid chr") do
|
72
|
-
begin
|
73
|
-
class Fixnum
|
74
|
-
alias_method :chr_, :chr if method_defined?(:chr)
|
75
|
-
|
76
|
-
def chr
|
77
|
-
nil
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
assert_raise TypeError do
|
82
|
-
"%c" % 0x80
|
83
|
-
end
|
84
|
-
ensure
|
85
|
-
class Fixnum
|
86
|
-
if method_defined?(:chr_)
|
87
|
-
alias_method :chr, :chr_
|
88
|
-
remove_method :chr_
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
76
|
assert("String#% %b") do
|
95
77
|
assert_equal("..10115", "%0b5" % -5)
|
96
78
|
end
|
@@ -164,9 +164,8 @@ mrb_str_swapcase(mrb_state *mrb, mrb_value self)
|
|
164
164
|
static mrb_value
|
165
165
|
mrb_str_concat_m(mrb_state *mrb, mrb_value self)
|
166
166
|
{
|
167
|
-
mrb_value str;
|
167
|
+
mrb_value str = mrb_get_arg1(mrb);
|
168
168
|
|
169
|
-
mrb_get_args(mrb, "o", &str);
|
170
169
|
if (mrb_fixnum_p(str) || mrb_float_p(str))
|
171
170
|
#ifdef MRB_UTF8_STRING
|
172
171
|
str = int_chr_utf8(mrb, str);
|
@@ -335,7 +334,7 @@ tr_parse_pattern(mrb_state *mrb, struct tr_pattern *ret, const mrb_value v_patte
|
|
335
334
|
|
336
335
|
len = i - start_pos;
|
337
336
|
if (len > UINT16_MAX) {
|
338
|
-
mrb_raise(mrb, E_ARGUMENT_ERROR, "tr pattern too long (max
|
337
|
+
mrb_raise(mrb, E_ARGUMENT_ERROR, "tr pattern too long (max 65535)");
|
339
338
|
}
|
340
339
|
if (pat1 == NULL && ret) {
|
341
340
|
goto nomem;
|
@@ -343,9 +342,9 @@ tr_parse_pattern(mrb_state *mrb, struct tr_pattern *ret, const mrb_value v_patte
|
|
343
342
|
pat1->type = TR_IN_ORDER;
|
344
343
|
pat1->flag_reverse = flag_reverse;
|
345
344
|
pat1->flag_on_heap = !ret_uninit;
|
346
|
-
pat1->n = len;
|
345
|
+
pat1->n = (uint16_t)len;
|
347
346
|
pat1->next = NULL;
|
348
|
-
pat1->val.start_pos = start_pos;
|
347
|
+
pat1->val.start_pos = (uint16_t)start_pos;
|
349
348
|
}
|
350
349
|
|
351
350
|
if (ret == NULL || ret_uninit) {
|
@@ -154,9 +154,8 @@ mrb_struct_set_m(mrb_state *mrb, mrb_value obj)
|
|
154
154
|
{
|
155
155
|
mrb_int i = mrb_fixnum(mrb_proc_cfunc_env_get(mrb, 0));
|
156
156
|
mrb_value *ptr;
|
157
|
-
mrb_value val;
|
157
|
+
mrb_value val = mrb_get_arg1(mrb);
|
158
158
|
|
159
|
-
mrb_get_args(mrb, "o", &val);
|
160
159
|
mrb_struct_modify(mrb, obj);
|
161
160
|
ptr = RSTRUCT_PTR(obj);
|
162
161
|
if (ptr == NULL || i >= RSTRUCT_LEN(obj)) {
|
@@ -356,9 +355,7 @@ mrb_struct_initialize(mrb_state *mrb, mrb_value self)
|
|
356
355
|
static mrb_value
|
357
356
|
mrb_struct_init_copy(mrb_state *mrb, mrb_value copy)
|
358
357
|
{
|
359
|
-
mrb_value s;
|
360
|
-
|
361
|
-
mrb_get_args(mrb, "o", &s);
|
358
|
+
mrb_value s = mrb_get_arg1(mrb);
|
362
359
|
|
363
360
|
if (mrb_obj_equal(mrb, copy, s)) return copy;
|
364
361
|
if (!mrb_obj_is_instance_of(mrb, s, mrb_obj_class(mrb, copy))) {
|
@@ -428,9 +425,8 @@ struct_aref_int(mrb_state *mrb, mrb_value s, mrb_int i)
|
|
428
425
|
static mrb_value
|
429
426
|
mrb_struct_aref(mrb_state *mrb, mrb_value s)
|
430
427
|
{
|
431
|
-
mrb_value idx;
|
428
|
+
mrb_value idx = mrb_get_arg1(mrb);
|
432
429
|
|
433
|
-
mrb_get_args(mrb, "o", &idx);
|
434
430
|
if (mrb_string_p(idx)) {
|
435
431
|
mrb_value sym = mrb_check_intern_str(mrb, idx);
|
436
432
|
|
@@ -545,11 +541,10 @@ mrb_struct_aset(mrb_state *mrb, mrb_value s)
|
|
545
541
|
static mrb_value
|
546
542
|
mrb_struct_equal(mrb_state *mrb, mrb_value s)
|
547
543
|
{
|
548
|
-
mrb_value s2;
|
544
|
+
mrb_value s2 = mrb_get_arg1(mrb);
|
549
545
|
mrb_value *ptr, *ptr2;
|
550
546
|
mrb_int i, len;
|
551
547
|
|
552
|
-
mrb_get_args(mrb, "o", &s2);
|
553
548
|
if (mrb_obj_equal(mrb, s, s2)) {
|
554
549
|
return mrb_true_value();
|
555
550
|
}
|
@@ -582,11 +577,10 @@ mrb_struct_equal(mrb_state *mrb, mrb_value s)
|
|
582
577
|
static mrb_value
|
583
578
|
mrb_struct_eql(mrb_state *mrb, mrb_value s)
|
584
579
|
{
|
585
|
-
mrb_value s2;
|
580
|
+
mrb_value s2 = mrb_get_arg1(mrb);
|
586
581
|
mrb_value *ptr, *ptr2;
|
587
582
|
mrb_int i, len;
|
588
583
|
|
589
|
-
mrb_get_args(mrb, "o", &s2);
|
590
584
|
if (mrb_obj_equal(mrb, s, s2)) {
|
591
585
|
return mrb_true_value();
|
592
586
|
}
|
@@ -47,7 +47,7 @@ mrb_sym_length(mrb_state *mrb, mrb_value self)
|
|
47
47
|
#ifdef MRB_UTF8_STRING
|
48
48
|
mrb_int byte_len;
|
49
49
|
const char *name = mrb_sym_name_len(mrb, mrb_symbol(self), &byte_len);
|
50
|
-
len =
|
50
|
+
len = mrb_utf8_strlen(name, byte_len);
|
51
51
|
#else
|
52
52
|
mrb_sym_name_len(mrb, mrb_symbol(self), &len);
|
53
53
|
#endif
|
@@ -13,10 +13,9 @@
|
|
13
13
|
#include <mruby/data.h>
|
14
14
|
#include <mruby/numeric.h>
|
15
15
|
#include <mruby/time.h>
|
16
|
+
#include <mruby/string.h>
|
16
17
|
|
17
|
-
#
|
18
|
-
#include <stdio.h>
|
19
|
-
#else
|
18
|
+
#ifdef MRB_DISABLE_STDIO
|
20
19
|
#include <string.h>
|
21
20
|
#endif
|
22
21
|
|
@@ -238,7 +237,7 @@ mrb_to_time_t(mrb_state *mrb, mrb_value obj, time_t *usec)
|
|
238
237
|
mrb_float f = mrb_float(obj);
|
239
238
|
|
240
239
|
mrb_check_num_exact(mrb, f);
|
241
|
-
if (f
|
240
|
+
if (f >= ((mrb_float)MRB_TIME_MAX-1.0) || f < ((mrb_float)MRB_TIME_MIN+1.0)) {
|
242
241
|
goto out_of_range;
|
243
242
|
}
|
244
243
|
|
@@ -516,11 +515,10 @@ time_get_ptr(mrb_state *mrb, mrb_value time)
|
|
516
515
|
static mrb_value
|
517
516
|
mrb_time_eq(mrb_state *mrb, mrb_value self)
|
518
517
|
{
|
519
|
-
mrb_value other;
|
518
|
+
mrb_value other = mrb_get_arg1(mrb);
|
520
519
|
struct mrb_time *tm1, *tm2;
|
521
520
|
mrb_bool eq_p;
|
522
521
|
|
523
|
-
mrb_get_args(mrb, "o", &other);
|
524
522
|
tm1 = DATA_GET_PTR(mrb, self, &mrb_time_type, struct mrb_time);
|
525
523
|
tm2 = DATA_CHECK_GET_PTR(mrb, other, &mrb_time_type, struct mrb_time);
|
526
524
|
eq_p = tm1 && tm2 && tm1->sec == tm2->sec && tm1->usec == tm2->usec;
|
@@ -531,10 +529,9 @@ mrb_time_eq(mrb_state *mrb, mrb_value self)
|
|
531
529
|
static mrb_value
|
532
530
|
mrb_time_cmp(mrb_state *mrb, mrb_value self)
|
533
531
|
{
|
534
|
-
mrb_value other;
|
532
|
+
mrb_value other = mrb_get_arg1(mrb);
|
535
533
|
struct mrb_time *tm1, *tm2;
|
536
534
|
|
537
|
-
mrb_get_args(mrb, "o", &other);
|
538
535
|
tm1 = DATA_GET_PTR(mrb, self, &mrb_time_type, struct mrb_time);
|
539
536
|
tm2 = DATA_CHECK_GET_PTR(mrb, other, &mrb_time_type, struct mrb_time);
|
540
537
|
if (!tm1 || !tm2) return mrb_nil_value();
|
@@ -557,11 +554,10 @@ mrb_time_cmp(mrb_state *mrb, mrb_value self)
|
|
557
554
|
static mrb_value
|
558
555
|
mrb_time_plus(mrb_state *mrb, mrb_value self)
|
559
556
|
{
|
560
|
-
mrb_value o;
|
557
|
+
mrb_value o = mrb_get_arg1(mrb);
|
561
558
|
struct mrb_time *tm;
|
562
559
|
time_t sec, usec;
|
563
560
|
|
564
|
-
mrb_get_args(mrb, "o", &o);
|
565
561
|
tm = time_get_ptr(mrb, self);
|
566
562
|
sec = mrb_to_time_t(mrb, o, &usec);
|
567
563
|
return mrb_time_make_time(mrb, mrb_obj_class(mrb, self), tm->sec+sec, tm->usec+usec, tm->timezone);
|
@@ -570,10 +566,9 @@ mrb_time_plus(mrb_state *mrb, mrb_value self)
|
|
570
566
|
static mrb_value
|
571
567
|
mrb_time_minus(mrb_state *mrb, mrb_value self)
|
572
568
|
{
|
573
|
-
mrb_value other;
|
569
|
+
mrb_value other = mrb_get_arg1(mrb);
|
574
570
|
struct mrb_time *tm, *tm2;
|
575
571
|
|
576
|
-
mrb_get_args(mrb, "o", &other);
|
577
572
|
tm = time_get_ptr(mrb, self);
|
578
573
|
tm2 = DATA_CHECK_GET_PTR(mrb, other, &mrb_time_type, struct mrb_time);
|
579
574
|
if (tm2) {
|
@@ -771,10 +766,9 @@ mrb_time_initialize(mrb_state *mrb, mrb_value self)
|
|
771
766
|
static mrb_value
|
772
767
|
mrb_time_initialize_copy(mrb_state *mrb, mrb_value copy)
|
773
768
|
{
|
774
|
-
mrb_value src;
|
769
|
+
mrb_value src = mrb_get_arg1(mrb);
|
775
770
|
struct mrb_time *t1, *t2;
|
776
771
|
|
777
|
-
mrb_get_args(mrb, "o", &src);
|
778
772
|
if (mrb_obj_equal(mrb, copy, src)) return copy;
|
779
773
|
if (!mrb_obj_is_instance_of(mrb, src, mrb_obj_class(mrb, copy))) {
|
780
774
|
mrb_raise(mrb, E_TYPE_ERROR, "wrong argument class");
|
@@ -956,7 +950,9 @@ mrb_time_to_s(mrb_state *mrb, mrb_value self)
|
|
956
950
|
struct mrb_time *tm = time_get_ptr(mrb, self);
|
957
951
|
mrb_bool utc = tm->timezone == MRB_TIMEZONE_UTC;
|
958
952
|
size_t len = (utc ? time_to_s_utc : time_to_s_local)(mrb, tm, buf, sizeof(buf));
|
959
|
-
|
953
|
+
mrb_value str = mrb_str_new(mrb, buf, len);
|
954
|
+
RSTR_SET_ASCII_FLAG(mrb_str_ptr(str));
|
955
|
+
return str;
|
960
956
|
}
|
961
957
|
|
962
958
|
void
|
@@ -140,7 +140,7 @@ def each_key(&block)
|
|
140
140
|
def each_value(&block)
|
141
141
|
return to_enum :each_value unless block
|
142
142
|
|
143
|
-
self.
|
143
|
+
self.values.each{|v| block.call(v)}
|
144
144
|
self
|
145
145
|
end
|
146
146
|
|
@@ -192,11 +192,11 @@ def _inspect(recur_list)
|
|
192
192
|
recur_list[self.object_id] = true
|
193
193
|
ary=[]
|
194
194
|
keys=self.keys
|
195
|
+
vals=self.values
|
195
196
|
size=keys.size
|
196
197
|
i=0
|
197
198
|
while i<size
|
198
|
-
|
199
|
-
ary<<(k._inspect(recur_list) + "=>" + self[k]._inspect(recur_list))
|
199
|
+
ary<<(keys[i]._inspect(recur_list) + "=>" + vals[i]._inspect(recur_list))
|
200
200
|
i+=1
|
201
201
|
end
|
202
202
|
"{"+ary.join(", ")+"}"
|
@@ -732,6 +732,10 @@ mrb_ary_splice(mrb_state *mrb, mrb_value ary, mrb_int head, mrb_int len, mrb_val
|
|
732
732
|
argv = ARY_PTR(r);
|
733
733
|
}
|
734
734
|
}
|
735
|
+
else if (mrb_undef_p(rpl)) {
|
736
|
+
argc = 0;
|
737
|
+
argv = NULL;
|
738
|
+
}
|
735
739
|
else {
|
736
740
|
argc = 1;
|
737
741
|
argv = &rpl;
|
@@ -804,6 +808,13 @@ ary_subseq(mrb_state *mrb, struct RArray *a, mrb_int beg, mrb_int len)
|
|
804
808
|
return mrb_obj_value(b);
|
805
809
|
}
|
806
810
|
|
811
|
+
mrb_value
|
812
|
+
mrb_ary_subseq(mrb_state *mrb, mrb_value ary, mrb_int beg, mrb_int len)
|
813
|
+
{
|
814
|
+
struct RArray *a = mrb_ary_ptr(ary);
|
815
|
+
return ary_subseq(mrb, a, beg, len);
|
816
|
+
}
|
817
|
+
|
807
818
|
static mrb_int
|
808
819
|
aget_index(mrb_state *mrb, mrb_value index)
|
809
820
|
{
|
@@ -855,10 +866,12 @@ static mrb_value
|
|
855
866
|
mrb_ary_aget(mrb_state *mrb, mrb_value self)
|
856
867
|
{
|
857
868
|
struct RArray *a = mrb_ary_ptr(self);
|
858
|
-
mrb_int i
|
869
|
+
mrb_int i;
|
870
|
+
mrb_int len, alen;
|
859
871
|
mrb_value index;
|
860
872
|
|
861
|
-
if (
|
873
|
+
if (mrb_get_argc(mrb) == 1) {
|
874
|
+
index = mrb_get_arg1(mrb);
|
862
875
|
switch (mrb_type(index)) {
|
863
876
|
/* a[n..m] */
|
864
877
|
case MRB_TT_RANGE:
|
@@ -875,6 +888,7 @@ mrb_ary_aget(mrb_state *mrb, mrb_value self)
|
|
875
888
|
}
|
876
889
|
}
|
877
890
|
|
891
|
+
mrb_get_args(mrb, "oi", &index, &len);
|
878
892
|
i = aget_index(mrb, index);
|
879
893
|
alen = ARY_LEN(a);
|
880
894
|
if (i < 0) i += alen;
|
@@ -928,7 +942,10 @@ mrb_ary_aset(mrb_state *mrb, mrb_value self)
|
|
928
942
|
mrb_int i, len;
|
929
943
|
|
930
944
|
mrb_ary_modify(mrb, mrb_ary_ptr(self));
|
931
|
-
if (
|
945
|
+
if (mrb_get_argc(mrb) == 2) {
|
946
|
+
mrb_value *vs = mrb_get_argv(mrb);
|
947
|
+
v1 = vs[0]; v2 = vs[1];
|
948
|
+
|
932
949
|
/* a[n..m] = v */
|
933
950
|
switch (mrb_range_beg_len(mrb, v1, &i, &len, RARRAY_LEN(self), FALSE)) {
|
934
951
|
case MRB_RANGE_TYPE_MISMATCH:
|
@@ -944,6 +961,7 @@ mrb_ary_aset(mrb_state *mrb, mrb_value self)
|
|
944
961
|
return v2;
|
945
962
|
}
|
946
963
|
|
964
|
+
mrb_get_args(mrb, "ooo", &v1, &v2, &v3);
|
947
965
|
/* a[n,m] = v */
|
948
966
|
mrb_ary_splice(mrb, self, aget_index(mrb, v1), aget_index(mrb, v2), v3);
|
949
967
|
return v3;
|
@@ -1027,10 +1045,9 @@ mrb_ary_last(mrb_state *mrb, mrb_value self)
|
|
1027
1045
|
static mrb_value
|
1028
1046
|
mrb_ary_index_m(mrb_state *mrb, mrb_value self)
|
1029
1047
|
{
|
1030
|
-
mrb_value obj;
|
1048
|
+
mrb_value obj = mrb_get_arg1(mrb);
|
1031
1049
|
mrb_int i;
|
1032
1050
|
|
1033
|
-
mrb_get_args(mrb, "o", &obj);
|
1034
1051
|
for (i = 0; i < RARRAY_LEN(self); i++) {
|
1035
1052
|
if (mrb_equal(mrb, RARRAY_PTR(self)[i], obj)) {
|
1036
1053
|
return mrb_fixnum_value(i);
|
@@ -1042,10 +1059,9 @@ mrb_ary_index_m(mrb_state *mrb, mrb_value self)
|
|
1042
1059
|
static mrb_value
|
1043
1060
|
mrb_ary_rindex_m(mrb_state *mrb, mrb_value self)
|
1044
1061
|
{
|
1045
|
-
mrb_value obj;
|
1062
|
+
mrb_value obj = mrb_get_arg1(mrb);
|
1046
1063
|
mrb_int i, len;
|
1047
1064
|
|
1048
|
-
mrb_get_args(mrb, "o", &obj);
|
1049
1065
|
for (i = RARRAY_LEN(self) - 1; i >= 0; i--) {
|
1050
1066
|
if (mrb_equal(mrb, RARRAY_PTR(self)[i], obj)) {
|
1051
1067
|
return mrb_fixnum_value(i);
|
@@ -1219,9 +1235,8 @@ mrb_ary_join_m(mrb_state *mrb, mrb_value ary)
|
|
1219
1235
|
static mrb_value
|
1220
1236
|
mrb_ary_eq(mrb_state *mrb, mrb_value ary1)
|
1221
1237
|
{
|
1222
|
-
mrb_value ary2;
|
1238
|
+
mrb_value ary2 = mrb_get_arg1(mrb);
|
1223
1239
|
|
1224
|
-
mrb_get_args(mrb, "o", &ary2);
|
1225
1240
|
if (mrb_obj_equal(mrb, ary1, ary2)) return mrb_true_value();
|
1226
1241
|
if (!mrb_array_p(ary2)) {
|
1227
1242
|
return mrb_false_value();
|
@@ -1234,9 +1249,8 @@ mrb_ary_eq(mrb_state *mrb, mrb_value ary1)
|
|
1234
1249
|
static mrb_value
|
1235
1250
|
mrb_ary_cmp(mrb_state *mrb, mrb_value ary1)
|
1236
1251
|
{
|
1237
|
-
mrb_value ary2;
|
1252
|
+
mrb_value ary2 = mrb_get_arg1(mrb);
|
1238
1253
|
|
1239
|
-
mrb_get_args(mrb, "o", &ary2);
|
1240
1254
|
if (mrb_obj_equal(mrb, ary1, ary2)) return mrb_fixnum_value(0);
|
1241
1255
|
if (!mrb_array_p(ary2)) {
|
1242
1256
|
return mrb_nil_value();
|
@@ -79,7 +79,7 @@ each_backtrace(mrb_state *mrb, ptrdiff_t ciidx, const mrb_code *pc0, each_backtr
|
|
79
79
|
static void
|
80
80
|
print_backtrace(mrb_state *mrb, struct RObject *exc, mrb_value backtrace)
|
81
81
|
{
|
82
|
-
|
82
|
+
mrb_int i;
|
83
83
|
mrb_int n = RARRAY_LEN(backtrace);
|
84
84
|
mrb_value *loc, mesg;
|
85
85
|
FILE *stream = stderr;
|
@@ -89,7 +89,7 @@ print_backtrace(mrb_state *mrb, struct RObject *exc, mrb_value backtrace)
|
|
89
89
|
for (i=n-1,loc=&RARRAY_PTR(backtrace)[i]; i>0; i--,loc--) {
|
90
90
|
if (mrb_string_p(*loc)) {
|
91
91
|
fprintf(stream, "\t[%d] %.*s\n",
|
92
|
-
i, (int)RSTRING_LEN(*loc), RSTRING_PTR(*loc));
|
92
|
+
(int)i, (int)RSTRING_LEN(*loc), RSTRING_PTR(*loc));
|
93
93
|
}
|
94
94
|
}
|
95
95
|
if (mrb_string_p(*loc)) {
|
@@ -549,6 +549,23 @@ mrb_get_argv(mrb_state *mrb)
|
|
549
549
|
return array_argv;
|
550
550
|
}
|
551
551
|
|
552
|
+
MRB_API mrb_value
|
553
|
+
mrb_get_arg1(mrb_state *mrb)
|
554
|
+
{
|
555
|
+
mrb_int argc = mrb->c->ci->argc;
|
556
|
+
mrb_value *array_argv = mrb->c->stack + 1;
|
557
|
+
if (argc < 0) {
|
558
|
+
struct RArray *a = mrb_ary_ptr(*array_argv);
|
559
|
+
|
560
|
+
argc = ARY_LEN(a);
|
561
|
+
array_argv = ARY_PTR(a);
|
562
|
+
}
|
563
|
+
if (argc != 1) {
|
564
|
+
mrb_raise(mrb, E_ARGUMENT_ERROR, "wrong number of arguments");
|
565
|
+
}
|
566
|
+
return array_argv[0];
|
567
|
+
}
|
568
|
+
|
552
569
|
void mrb_hash_check_kdict(mrb_state *mrb, mrb_value self);
|
553
570
|
|
554
571
|
/*
|
@@ -913,7 +930,7 @@ mrb_get_args(mrb_state *mrb, const char *format, ...)
|
|
913
930
|
{
|
914
931
|
mrb_value **var;
|
915
932
|
mrb_int *pl;
|
916
|
-
mrb_bool nocopy = altmode || argv_on_stack ? TRUE : FALSE;
|
933
|
+
mrb_bool nocopy = (altmode || !argv_on_stack) ? TRUE : FALSE;
|
917
934
|
|
918
935
|
var = va_arg(ap, mrb_value**);
|
919
936
|
pl = va_arg(ap, mrb_int*);
|
@@ -1212,10 +1229,9 @@ mrb_mod_ancestors(mrb_state *mrb, mrb_value self)
|
|
1212
1229
|
static mrb_value
|
1213
1230
|
mrb_mod_extend_object(mrb_state *mrb, mrb_value mod)
|
1214
1231
|
{
|
1215
|
-
mrb_value obj;
|
1232
|
+
mrb_value obj = mrb_get_arg1(mrb);
|
1216
1233
|
|
1217
1234
|
mrb_check_type(mrb, mod, MRB_TT_MODULE);
|
1218
|
-
mrb_get_args(mrb, "o", &obj);
|
1219
1235
|
mrb_include_module(mrb, mrb_class_ptr(mrb_singleton_class(mrb, obj)), mrb_class_ptr(mod));
|
1220
1236
|
return mod;
|
1221
1237
|
}
|
@@ -1242,33 +1258,45 @@ mrb_mod_dummy_visibility(mrb_state *mrb, mrb_value mod)
|
|
1242
1258
|
return mod;
|
1243
1259
|
}
|
1244
1260
|
|
1245
|
-
|
1246
|
-
|
1261
|
+
/* returns mrb_class_ptr(mrb_singleton_class()) */
|
1262
|
+
/* except that it return NULL for immediate values */
|
1263
|
+
MRB_API struct RClass*
|
1264
|
+
mrb_singleton_class_ptr(mrb_state *mrb, mrb_value v)
|
1247
1265
|
{
|
1248
1266
|
struct RBasic *obj;
|
1249
1267
|
|
1250
1268
|
switch (mrb_type(v)) {
|
1251
1269
|
case MRB_TT_FALSE:
|
1252
1270
|
if (mrb_nil_p(v))
|
1253
|
-
return
|
1254
|
-
return
|
1271
|
+
return mrb->nil_class;
|
1272
|
+
return mrb->false_class;
|
1255
1273
|
case MRB_TT_TRUE:
|
1256
|
-
return
|
1274
|
+
return mrb->true_class;
|
1257
1275
|
case MRB_TT_CPTR:
|
1258
|
-
return
|
1276
|
+
return mrb->object_class;
|
1259
1277
|
case MRB_TT_SYMBOL:
|
1260
1278
|
case MRB_TT_FIXNUM:
|
1261
1279
|
#ifndef MRB_WITHOUT_FLOAT
|
1262
1280
|
case MRB_TT_FLOAT:
|
1263
1281
|
#endif
|
1264
|
-
|
1265
|
-
return mrb_nil_value(); /* not reached */
|
1282
|
+
return NULL;
|
1266
1283
|
default:
|
1267
1284
|
break;
|
1268
1285
|
}
|
1269
1286
|
obj = mrb_basic_ptr(v);
|
1270
1287
|
prepare_singleton_class(mrb, obj);
|
1271
|
-
return
|
1288
|
+
return obj->c;
|
1289
|
+
}
|
1290
|
+
|
1291
|
+
MRB_API mrb_value
|
1292
|
+
mrb_singleton_class(mrb_state *mrb, mrb_value v)
|
1293
|
+
{
|
1294
|
+
struct RClass *c = mrb_singleton_class_ptr(mrb, v);
|
1295
|
+
|
1296
|
+
if (c == NULL) {
|
1297
|
+
mrb_raise(mrb, E_TYPE_ERROR, "can't define singleton");
|
1298
|
+
}
|
1299
|
+
return mrb_obj_value(c);
|
1272
1300
|
}
|
1273
1301
|
|
1274
1302
|
MRB_API void
|
@@ -1481,9 +1509,8 @@ static mrb_value
|
|
1481
1509
|
attr_writer(mrb_state *mrb, mrb_value obj)
|
1482
1510
|
{
|
1483
1511
|
mrb_value name = mrb_proc_cfunc_env_get(mrb, 0);
|
1484
|
-
mrb_value val;
|
1512
|
+
mrb_value val = mrb_get_arg1(mrb);
|
1485
1513
|
|
1486
|
-
mrb_get_args(mrb, "o", &val);
|
1487
1514
|
mrb_iv_set(mrb, obj, to_sym(mrb, name), val);
|
1488
1515
|
return val;
|
1489
1516
|
}
|
@@ -1651,21 +1678,11 @@ mrb_bob_not(mrb_state *mrb, mrb_value cv)
|
|
1651
1678
|
mrb_value
|
1652
1679
|
mrb_obj_equal_m(mrb_state *mrb, mrb_value self)
|
1653
1680
|
{
|
1654
|
-
mrb_value arg;
|
1681
|
+
mrb_value arg = mrb_get_arg1(mrb);
|
1655
1682
|
|
1656
|
-
mrb_get_args(mrb, "o", &arg);
|
1657
1683
|
return mrb_bool_value(mrb_obj_equal(mrb, self, arg));
|
1658
1684
|
}
|
1659
1685
|
|
1660
|
-
static mrb_value
|
1661
|
-
mrb_obj_not_equal_m(mrb_state *mrb, mrb_value self)
|
1662
|
-
{
|
1663
|
-
mrb_value arg;
|
1664
|
-
|
1665
|
-
mrb_get_args(mrb, "o", &arg);
|
1666
|
-
return mrb_bool_value(!mrb_equal(mrb, self, arg));
|
1667
|
-
}
|
1668
|
-
|
1669
1686
|
MRB_API mrb_bool
|
1670
1687
|
mrb_obj_respond_to(mrb_state *mrb, struct RClass* c, mrb_sym mid)
|
1671
1688
|
{
|
@@ -1716,7 +1733,10 @@ mrb_class_real(struct RClass* cl)
|
|
1716
1733
|
MRB_API const char*
|
1717
1734
|
mrb_class_name(mrb_state *mrb, struct RClass* c)
|
1718
1735
|
{
|
1719
|
-
mrb_value name
|
1736
|
+
mrb_value name;
|
1737
|
+
|
1738
|
+
if (c == NULL) return NULL;
|
1739
|
+
name = class_name_str(mrb, c);
|
1720
1740
|
return RSTRING_PTR(name);
|
1721
1741
|
}
|
1722
1742
|
|
@@ -1960,13 +1980,11 @@ mrb_const_get_sym(mrb_state *mrb, mrb_value mod, mrb_sym id)
|
|
1960
1980
|
static mrb_value
|
1961
1981
|
mrb_mod_const_get(mrb_state *mrb, mrb_value mod)
|
1962
1982
|
{
|
1963
|
-
mrb_value path;
|
1983
|
+
mrb_value path = mrb_get_arg1(mrb);
|
1964
1984
|
mrb_sym id;
|
1965
1985
|
char *ptr;
|
1966
1986
|
mrb_int off, end, len;
|
1967
1987
|
|
1968
|
-
mrb_get_args(mrb, "o", &path);
|
1969
|
-
|
1970
1988
|
if (mrb_symbol_p(path)) {
|
1971
1989
|
/* const get with symbol */
|
1972
1990
|
id = mrb_symbol(path);
|
@@ -2119,10 +2137,9 @@ top_define_method(mrb_state *mrb, mrb_value self)
|
|
2119
2137
|
static mrb_value
|
2120
2138
|
mrb_mod_eqq(mrb_state *mrb, mrb_value mod)
|
2121
2139
|
{
|
2122
|
-
mrb_value obj;
|
2140
|
+
mrb_value obj = mrb_get_arg1(mrb);
|
2123
2141
|
mrb_bool eqq;
|
2124
2142
|
|
2125
|
-
mrb_get_args(mrb, "o", &obj);
|
2126
2143
|
eqq = mrb_obj_is_kind_of(mrb, obj, mrb_class_ptr(mod));
|
2127
2144
|
|
2128
2145
|
return mrb_bool_value(eqq);
|
@@ -2257,7 +2274,6 @@ mrb_init_class(mrb_state *mrb)
|
|
2257
2274
|
mrb_define_method(mrb, bob, "initialize", mrb_bob_init, MRB_ARGS_NONE());
|
2258
2275
|
mrb_define_method(mrb, bob, "!", mrb_bob_not, MRB_ARGS_NONE());
|
2259
2276
|
mrb_define_method(mrb, bob, "==", mrb_obj_equal_m, MRB_ARGS_REQ(1)); /* 15.3.1.3.1 */
|
2260
|
-
mrb_define_method(mrb, bob, "!=", mrb_obj_not_equal_m, MRB_ARGS_REQ(1));
|
2261
2277
|
mrb_define_method(mrb, bob, "__id__", mrb_obj_id_m, MRB_ARGS_NONE()); /* 15.3.1.3.4 */
|
2262
2278
|
mrb_define_method(mrb, bob, "__send__", mrb_f_send, MRB_ARGS_REQ(1)|MRB_ARGS_REST()|MRB_ARGS_BLOCK()); /* 15.3.1.3.5 */
|
2263
2279
|
mrb_define_method(mrb, bob, "equal?", mrb_obj_equal_m, MRB_ARGS_REQ(1)); /* 15.3.1.3.11 */
|