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
@@ -71,9 +71,8 @@ mrb_obj_inspect(mrb_state *mrb, mrb_value obj)
|
|
71
71
|
static mrb_value
|
72
72
|
mrb_equal_m(mrb_state *mrb, mrb_value self)
|
73
73
|
{
|
74
|
-
mrb_value arg;
|
74
|
+
mrb_value arg = mrb_get_arg1(mrb);
|
75
75
|
|
76
|
-
mrb_get_args(mrb, "o", &arg);
|
77
76
|
return mrb_bool_value(mrb_equal(mrb, self, arg));
|
78
77
|
}
|
79
78
|
|
@@ -161,7 +160,7 @@ mrb_f_block_given_p_m(mrb_state *mrb, mrb_value self)
|
|
161
160
|
/* use saved block arg position */
|
162
161
|
bidx = MRB_ENV_BIDX(e);
|
163
162
|
/* bidx may be useless (e.g. define_method) */
|
164
|
-
if (bidx >=
|
163
|
+
if (bidx >= MRB_ENV_LEN(e))
|
165
164
|
return mrb_false_value();
|
166
165
|
bp = &e->stack[bidx];
|
167
166
|
}
|
@@ -325,7 +324,7 @@ mrb_obj_clone(mrb_state *mrb, mrb_value self)
|
|
325
324
|
mrb_value clone;
|
326
325
|
|
327
326
|
if (mrb_immediate_p(self)) {
|
328
|
-
|
327
|
+
return self;
|
329
328
|
}
|
330
329
|
if (mrb_sclass_p(self)) {
|
331
330
|
mrb_raise(mrb, E_TYPE_ERROR, "can't clone singleton class");
|
@@ -366,7 +365,7 @@ mrb_obj_dup(mrb_state *mrb, mrb_value obj)
|
|
366
365
|
mrb_value dup;
|
367
366
|
|
368
367
|
if (mrb_immediate_p(obj)) {
|
369
|
-
|
368
|
+
return obj;
|
370
369
|
}
|
371
370
|
if (mrb_sclass_p(obj)) {
|
372
371
|
mrb_raise(mrb, E_TYPE_ERROR, "can't dup singleton class");
|
@@ -471,9 +470,8 @@ mrb_obj_hash(mrb_state *mrb, mrb_value self)
|
|
471
470
|
static mrb_value
|
472
471
|
mrb_obj_init_copy(mrb_state *mrb, mrb_value self)
|
473
472
|
{
|
474
|
-
mrb_value orig;
|
473
|
+
mrb_value orig = mrb_get_arg1(mrb);
|
475
474
|
|
476
|
-
mrb_get_args(mrb, "o", &orig);
|
477
475
|
if (mrb_obj_equal(mrb, self, orig)) return self;
|
478
476
|
if ((mrb_type(self) != mrb_type(orig)) || (mrb_obj_class(mrb, self) != mrb_obj_class(mrb, orig))) {
|
479
477
|
mrb_raise(mrb, E_TYPE_ERROR, "initialize_copy should take same class object");
|
@@ -744,12 +742,11 @@ obj_respond_to(mrb_state *mrb, mrb_value self)
|
|
744
742
|
static mrb_value
|
745
743
|
mrb_obj_ceqq(mrb_state *mrb, mrb_value self)
|
746
744
|
{
|
747
|
-
mrb_value v;
|
745
|
+
mrb_value v = mrb_get_arg1(mrb);
|
748
746
|
mrb_int i, len;
|
749
747
|
mrb_sym eqq = mrb_intern_lit(mrb, "===");
|
750
748
|
mrb_value ary = mrb_ary_splat(mrb, self);
|
751
749
|
|
752
|
-
mrb_get_args(mrb, "o", &v);
|
753
750
|
len = RARRAY_LEN(ary);
|
754
751
|
for (i=0; i<len; i++) {
|
755
752
|
mrb_value c = mrb_funcall_argv(mrb, mrb_ary_entry(ary, i), eqq, 1, &v);
|
@@ -14,14 +14,12 @@
|
|
14
14
|
#include <mruby/string.h>
|
15
15
|
#include <mruby/debug.h>
|
16
16
|
#include <mruby/error.h>
|
17
|
+
#include <mruby/data.h>
|
17
18
|
|
18
19
|
#if SIZE_MAX < UINT32_MAX
|
19
20
|
# error size_t must be at least 32 bits wide
|
20
21
|
#endif
|
21
22
|
|
22
|
-
#define FLAG_BYTEORDER_BIG 2
|
23
|
-
#define FLAG_BYTEORDER_LIL 4
|
24
|
-
#define FLAG_BYTEORDER_NATIVE 8
|
25
23
|
#define FLAG_SRC_MALLOC 1
|
26
24
|
#define FLAG_SRC_STATIC 0
|
27
25
|
|
@@ -58,6 +56,14 @@ str_to_double(mrb_state *mrb, const char *p, size_t len)
|
|
58
56
|
|
59
57
|
mrb_value mrb_str_len_to_inum(mrb_state *mrb, const char *str, mrb_int len, mrb_int base, int badcheck);
|
60
58
|
|
59
|
+
static void
|
60
|
+
tempirep_free(mrb_state *mrb, void *p)
|
61
|
+
{
|
62
|
+
if (p) mrb_irep_decref(mrb, (mrb_irep *)p);
|
63
|
+
}
|
64
|
+
|
65
|
+
static const mrb_data_type tempirep_type = { "temporary irep", tempirep_free };
|
66
|
+
|
61
67
|
static mrb_irep*
|
62
68
|
read_irep_record_1(mrb_state *mrb, const uint8_t *bin, size_t *len, uint8_t flags)
|
63
69
|
{
|
@@ -66,8 +72,11 @@ read_irep_record_1(mrb_state *mrb, const uint8_t *bin, size_t *len, uint8_t flag
|
|
66
72
|
ptrdiff_t diff;
|
67
73
|
uint16_t tt, pool_data_len, snl;
|
68
74
|
int plen;
|
69
|
-
|
75
|
+
struct RData *irep_obj = mrb_data_object_alloc(mrb, mrb->object_class, NULL, &tempirep_type);
|
70
76
|
mrb_irep *irep = mrb_add_irep(mrb);
|
77
|
+
int ai = mrb_gc_arena_save(mrb);
|
78
|
+
|
79
|
+
irep_obj->data = irep;
|
71
80
|
|
72
81
|
/* skip record size */
|
73
82
|
src += sizeof(uint32_t);
|
@@ -94,8 +103,7 @@ read_irep_record_1(mrb_state *mrb, const uint8_t *bin, size_t *len, uint8_t flag
|
|
94
103
|
if (SIZE_ERROR_MUL(irep->ilen, sizeof(mrb_code))) {
|
95
104
|
return NULL;
|
96
105
|
}
|
97
|
-
if ((flags & FLAG_SRC_MALLOC) == 0
|
98
|
-
(flags & FLAG_BYTEORDER_NATIVE)) {
|
106
|
+
if ((flags & FLAG_SRC_MALLOC) == 0) {
|
99
107
|
irep->iseq = (mrb_code*)src;
|
100
108
|
src += sizeof(mrb_code) * irep->ilen;
|
101
109
|
irep->flags |= MRB_ISEQ_NO_FREE;
|
@@ -188,36 +196,47 @@ read_irep_record_1(mrb_state *mrb, const uint8_t *bin, size_t *len, uint8_t flag
|
|
188
196
|
}
|
189
197
|
}
|
190
198
|
|
191
|
-
irep->reps = (mrb_irep**)
|
199
|
+
irep->reps = (mrb_irep**)mrb_calloc(mrb, irep->rlen, sizeof(mrb_irep*));
|
192
200
|
|
193
201
|
diff = src - bin;
|
194
202
|
mrb_assert_int_fit(ptrdiff_t, diff, size_t, SIZE_MAX);
|
195
203
|
*len = (size_t)diff;
|
196
204
|
|
205
|
+
irep_obj->data = NULL;
|
206
|
+
|
197
207
|
return irep;
|
198
208
|
}
|
199
209
|
|
200
210
|
static mrb_irep*
|
201
211
|
read_irep_record(mrb_state *mrb, const uint8_t *bin, size_t *len, uint8_t flags)
|
202
212
|
{
|
213
|
+
struct RData *irep_obj = mrb_data_object_alloc(mrb, mrb->object_class, NULL, &tempirep_type);
|
214
|
+
int ai = mrb_gc_arena_save(mrb);
|
203
215
|
mrb_irep *irep = read_irep_record_1(mrb, bin, len, flags);
|
204
216
|
int i;
|
205
217
|
|
218
|
+
mrb_gc_arena_restore(mrb, ai);
|
206
219
|
if (irep == NULL) {
|
207
220
|
return NULL;
|
208
221
|
}
|
209
222
|
|
223
|
+
irep_obj->data = irep;
|
224
|
+
|
210
225
|
bin += *len;
|
211
226
|
for (i=0; i<irep->rlen; i++) {
|
212
227
|
size_t rlen;
|
213
228
|
|
214
229
|
irep->reps[i] = read_irep_record(mrb, bin, &rlen, flags);
|
230
|
+
mrb_gc_arena_restore(mrb, ai);
|
215
231
|
if (irep->reps[i] == NULL) {
|
216
232
|
return NULL;
|
217
233
|
}
|
218
234
|
bin += rlen;
|
219
235
|
*len += rlen;
|
220
236
|
}
|
237
|
+
|
238
|
+
irep_obj->data = NULL;
|
239
|
+
|
221
240
|
return irep;
|
222
241
|
}
|
223
242
|
|
@@ -241,21 +260,21 @@ read_debug_record(mrb_state *mrb, const uint8_t *start, mrb_irep* irep, size_t *
|
|
241
260
|
|
242
261
|
if (irep->debug_info) { return MRB_DUMP_INVALID_IREP; }
|
243
262
|
|
244
|
-
irep->debug_info = (mrb_irep_debug_info*)
|
263
|
+
irep->debug_info = (mrb_irep_debug_info*)mrb_calloc(mrb, 1, sizeof(mrb_irep_debug_info));
|
245
264
|
irep->debug_info->pc_count = (uint32_t)irep->ilen;
|
246
265
|
|
247
266
|
record_size = (size_t)bin_to_uint32(bin);
|
248
267
|
bin += sizeof(uint32_t);
|
249
268
|
|
250
269
|
irep->debug_info->flen = bin_to_uint16(bin);
|
251
|
-
irep->debug_info->files = (mrb_irep_debug_info_file**)
|
270
|
+
irep->debug_info->files = (mrb_irep_debug_info_file**)mrb_calloc(mrb, irep->debug_info->flen, sizeof(mrb_irep_debug_info*));
|
252
271
|
bin += sizeof(uint16_t);
|
253
272
|
|
254
273
|
for (f_idx = 0; f_idx < irep->debug_info->flen; ++f_idx) {
|
255
274
|
mrb_irep_debug_info_file *file;
|
256
275
|
uint16_t filename_idx;
|
257
276
|
|
258
|
-
file = (mrb_irep_debug_info_file *)
|
277
|
+
file = (mrb_irep_debug_info_file *)mrb_calloc(mrb, 1, sizeof(*file));
|
259
278
|
irep->debug_info->files[f_idx] = file;
|
260
279
|
|
261
280
|
file->start_pos = bin_to_uint32(bin);
|
@@ -285,8 +304,8 @@ read_debug_record(mrb_state *mrb, const uint8_t *start, mrb_irep* irep, size_t *
|
|
285
304
|
case mrb_debug_line_flat_map: {
|
286
305
|
uint32_t l;
|
287
306
|
|
288
|
-
file->lines.flat_map = (mrb_irep_debug_info_line*)
|
289
|
-
mrb,
|
307
|
+
file->lines.flat_map = (mrb_irep_debug_info_line*)mrb_calloc(
|
308
|
+
mrb, (size_t)(file->line_entry_count), sizeof(mrb_irep_debug_info_line));
|
290
309
|
for (l = 0; l < file->line_entry_count; ++l) {
|
291
310
|
file->lines.flat_map[l].start_pos = bin_to_uint32(bin);
|
292
311
|
bin += sizeof(uint32_t);
|
@@ -333,6 +352,7 @@ read_section_debug(mrb_state *mrb, const uint8_t *start, mrb_irep *irep, uint8_t
|
|
333
352
|
int result;
|
334
353
|
uint16_t filenames_len;
|
335
354
|
mrb_sym *filenames;
|
355
|
+
mrb_value filenames_obj;
|
336
356
|
|
337
357
|
bin = start;
|
338
358
|
header = (struct rite_section_debug_header *)bin;
|
@@ -340,7 +360,8 @@ read_section_debug(mrb_state *mrb, const uint8_t *start, mrb_irep *irep, uint8_t
|
|
340
360
|
|
341
361
|
filenames_len = bin_to_uint16(bin);
|
342
362
|
bin += sizeof(uint16_t);
|
343
|
-
|
363
|
+
filenames_obj = mrb_str_new(mrb, NULL, sizeof(mrb_sym) * (size_t)filenames_len);
|
364
|
+
filenames = (mrb_sym*)RSTRING_PTR(filenames_obj);
|
344
365
|
for (i = 0; i < filenames_len; ++i) {
|
345
366
|
uint16_t f_len = bin_to_uint16(bin);
|
346
367
|
bin += sizeof(uint16_t);
|
@@ -364,7 +385,7 @@ read_section_debug(mrb_state *mrb, const uint8_t *start, mrb_irep *irep, uint8_t
|
|
364
385
|
}
|
365
386
|
|
366
387
|
debug_exit:
|
367
|
-
|
388
|
+
mrb_str_resize(mrb, filenames_obj, 0);
|
368
389
|
return result;
|
369
390
|
}
|
370
391
|
|
@@ -422,6 +443,7 @@ read_section_lv(mrb_state *mrb, const uint8_t *start, mrb_irep *irep, uint8_t fl
|
|
422
443
|
int result;
|
423
444
|
uint32_t syms_len;
|
424
445
|
mrb_sym *syms;
|
446
|
+
mrb_value syms_obj;
|
425
447
|
mrb_sym (*intern_func)(mrb_state*, const char*, size_t) =
|
426
448
|
(flags & FLAG_SRC_MALLOC)? mrb_intern : mrb_intern_static;
|
427
449
|
|
@@ -431,7 +453,8 @@ read_section_lv(mrb_state *mrb, const uint8_t *start, mrb_irep *irep, uint8_t fl
|
|
431
453
|
|
432
454
|
syms_len = bin_to_uint32(bin);
|
433
455
|
bin += sizeof(uint32_t);
|
434
|
-
|
456
|
+
syms_obj = mrb_str_new(mrb, NULL, sizeof(mrb_sym) * (size_t)syms_len);
|
457
|
+
syms = (mrb_sym*)RSTRING_PTR(syms_obj);
|
435
458
|
for (i = 0; i < syms_len; ++i) {
|
436
459
|
uint16_t const str_len = bin_to_uint16(bin);
|
437
460
|
bin += sizeof(uint16_t);
|
@@ -451,7 +474,7 @@ read_section_lv(mrb_state *mrb, const uint8_t *start, mrb_irep *irep, uint8_t fl
|
|
451
474
|
}
|
452
475
|
|
453
476
|
lv_exit:
|
454
|
-
|
477
|
+
mrb_str_resize(mrb, syms_obj, 0);
|
455
478
|
return result;
|
456
479
|
}
|
457
480
|
|
@@ -464,19 +487,7 @@ read_binary_header(const uint8_t *bin, size_t bufsize, size_t *bin_size, uint16_
|
|
464
487
|
return MRB_DUMP_READ_FAULT;
|
465
488
|
}
|
466
489
|
|
467
|
-
if (memcmp(header->binary_ident, RITE_BINARY_IDENT, sizeof(header->binary_ident))
|
468
|
-
if (bigendian_p())
|
469
|
-
*flags |= FLAG_BYTEORDER_NATIVE;
|
470
|
-
else
|
471
|
-
*flags |= FLAG_BYTEORDER_BIG;
|
472
|
-
}
|
473
|
-
else if (memcmp(header->binary_ident, RITE_BINARY_IDENT_LIL, sizeof(header->binary_ident)) == 0) {
|
474
|
-
if (bigendian_p())
|
475
|
-
*flags |= FLAG_BYTEORDER_LIL;
|
476
|
-
else
|
477
|
-
*flags |= FLAG_BYTEORDER_NATIVE;
|
478
|
-
}
|
479
|
-
else {
|
490
|
+
if (memcmp(header->binary_ident, RITE_BINARY_IDENT, sizeof(header->binary_ident)) != 0) {
|
480
491
|
return MRB_DUMP_INVALID_FILE_HEADER;
|
481
492
|
}
|
482
493
|
|
@@ -500,6 +511,7 @@ static mrb_irep*
|
|
500
511
|
read_irep(mrb_state *mrb, const uint8_t *bin, size_t bufsize, uint8_t flags)
|
501
512
|
{
|
502
513
|
int result;
|
514
|
+
struct RData *irep_obj = NULL;
|
503
515
|
mrb_irep *irep = NULL;
|
504
516
|
const struct rite_section_header *section_header;
|
505
517
|
uint16_t crc;
|
@@ -520,12 +532,15 @@ read_irep(mrb_state *mrb, const uint8_t *bin, size_t bufsize, uint8_t flags)
|
|
520
532
|
return NULL;
|
521
533
|
}
|
522
534
|
|
535
|
+
irep_obj = mrb_data_object_alloc(mrb, mrb->object_class, NULL, &tempirep_type);
|
536
|
+
|
523
537
|
bin += sizeof(struct rite_binary_header);
|
524
538
|
do {
|
525
539
|
section_header = (const struct rite_section_header *)bin;
|
526
540
|
if (memcmp(section_header->section_ident, RITE_SECTION_IREP_IDENT, sizeof(section_header->section_ident)) == 0) {
|
527
541
|
irep = read_section_irep(mrb, bin, flags);
|
528
542
|
if (!irep) return NULL;
|
543
|
+
irep_obj->data = irep;
|
529
544
|
}
|
530
545
|
else if (memcmp(section_header->section_ident, RITE_SECTION_DEBUG_IDENT, sizeof(section_header->section_ident)) == 0) {
|
531
546
|
if (!irep) return NULL; /* corrupted data */
|
@@ -544,6 +559,8 @@ read_irep(mrb_state *mrb, const uint8_t *bin, size_t bufsize, uint8_t flags)
|
|
544
559
|
bin += bin_to_uint32(section_header->section_size);
|
545
560
|
} while (memcmp(section_header->section_ident, RITE_BINARY_EOF, sizeof(section_header->section_ident)) != 0);
|
546
561
|
|
562
|
+
irep_obj->data = NULL;
|
563
|
+
|
547
564
|
return irep;
|
548
565
|
}
|
549
566
|
|
@@ -595,7 +612,16 @@ load_irep(mrb_state *mrb, mrb_irep *irep, mrbc_context *c)
|
|
595
612
|
MRB_API mrb_value
|
596
613
|
mrb_load_irep_cxt(mrb_state *mrb, const uint8_t *bin, mrbc_context *c)
|
597
614
|
{
|
598
|
-
|
615
|
+
struct RData *irep_obj = mrb_data_object_alloc(mrb, mrb->object_class, NULL, &tempirep_type);
|
616
|
+
mrb_irep *irep = mrb_read_irep(mrb, bin);
|
617
|
+
mrb_value ret;
|
618
|
+
|
619
|
+
irep_obj->data = irep;
|
620
|
+
mrb_irep_incref(mrb, irep);
|
621
|
+
ret = load_irep(mrb, irep, c);
|
622
|
+
irep_obj->data = NULL;
|
623
|
+
mrb_irep_decref(mrb, irep);
|
624
|
+
return ret;
|
599
625
|
}
|
600
626
|
|
601
627
|
MRB_API mrb_value
|
@@ -67,12 +67,11 @@ mrb_int_value(mrb_state *mrb, mrb_float f)
|
|
67
67
|
static mrb_value
|
68
68
|
integral_pow(mrb_state *mrb, mrb_value x)
|
69
69
|
{
|
70
|
-
mrb_value y;
|
70
|
+
mrb_value y = mrb_get_arg1(mrb);
|
71
71
|
#ifndef MRB_WITHOUT_FLOAT
|
72
72
|
mrb_float d;
|
73
73
|
#endif
|
74
74
|
|
75
|
-
mrb_get_args(mrb, "o", &y);
|
76
75
|
if (mrb_fixnum_p(x) && mrb_fixnum_p(y)) {
|
77
76
|
/* try ipow() */
|
78
77
|
mrb_int base = mrb_fixnum(x);
|
@@ -116,9 +115,8 @@ static mrb_value
|
|
116
115
|
integral_idiv(mrb_state *mrb, mrb_value x)
|
117
116
|
{
|
118
117
|
#ifdef MRB_WITHOUT_FLOAT
|
119
|
-
mrb_value y;
|
118
|
+
mrb_value y = mrb_get_arg1(mrb);
|
120
119
|
|
121
|
-
mrb_get_args(mrb, "o", &y);
|
122
120
|
if (!mrb_fixnum_p(y)) {
|
123
121
|
mrb_raise(mrb, E_TYPE_ERROR, "non fixnum value");
|
124
122
|
}
|
@@ -154,9 +152,8 @@ static mrb_value
|
|
154
152
|
integral_div(mrb_state *mrb, mrb_value x)
|
155
153
|
{
|
156
154
|
#ifdef MRB_WITHOUT_FLOAT
|
157
|
-
mrb_value y;
|
155
|
+
mrb_value y = mrb_get_arg1(mrb);
|
158
156
|
|
159
|
-
mrb_get_args(mrb, "o", &y);
|
160
157
|
if (!mrb_fixnum_p(y)) {
|
161
158
|
mrb_raise(mrb, E_TYPE_ERROR, "non fixnum value");
|
162
159
|
}
|
@@ -210,26 +207,30 @@ static mrb_value
|
|
210
207
|
flo_to_s(mrb_state *mrb, mrb_value flt)
|
211
208
|
{
|
212
209
|
mrb_float f = mrb_float(flt);
|
210
|
+
mrb_value str;
|
213
211
|
|
214
212
|
if (isinf(f)) {
|
215
|
-
|
216
|
-
|
213
|
+
str = f < 0 ? mrb_str_new_lit(mrb, "-Infinity")
|
214
|
+
: mrb_str_new_lit(mrb, "Infinity");
|
215
|
+
goto exit;
|
217
216
|
}
|
218
217
|
else if (isnan(f)) {
|
219
|
-
|
218
|
+
str = mrb_str_new_lit(mrb, "NaN");
|
219
|
+
goto exit;
|
220
220
|
}
|
221
221
|
else {
|
222
222
|
char fmt[] = "%." MRB_STRINGIZE(FLO_TO_STR_PREC) "g";
|
223
|
-
mrb_value str = mrb_float_to_str(mrb, flt, fmt);
|
224
223
|
mrb_int len;
|
225
224
|
char *begp, *p, *endp;
|
226
225
|
|
226
|
+
str = mrb_float_to_str(mrb, flt, fmt);
|
227
|
+
|
227
228
|
insert_dot_zero:
|
228
229
|
begp = RSTRING_PTR(str);
|
229
230
|
len = RSTRING_LEN(str);
|
230
231
|
for (p = begp, endp = p + len; p < endp; ++p) {
|
231
232
|
if (*p == '.') {
|
232
|
-
|
233
|
+
goto exit;
|
233
234
|
}
|
234
235
|
else if (*p == 'e') {
|
235
236
|
ptrdiff_t e_pos = p - begp;
|
@@ -237,7 +238,7 @@ flo_to_s(mrb_state *mrb, mrb_value flt)
|
|
237
238
|
p = RSTRING_PTR(str) + e_pos;
|
238
239
|
memmove(p + 2, p, len - e_pos);
|
239
240
|
memcpy(p, ".0", 2);
|
240
|
-
|
241
|
+
goto exit;
|
241
242
|
}
|
242
243
|
}
|
243
244
|
|
@@ -247,8 +248,12 @@ flo_to_s(mrb_state *mrb, mrb_value flt)
|
|
247
248
|
goto insert_dot_zero;
|
248
249
|
}
|
249
250
|
|
250
|
-
|
251
|
+
goto exit;
|
251
252
|
}
|
253
|
+
|
254
|
+
exit:
|
255
|
+
RSTR_SET_ASCII_FLAG(mrb_str_ptr(str));
|
256
|
+
return str;
|
252
257
|
}
|
253
258
|
|
254
259
|
/* 15.2.9.3.2 */
|
@@ -263,9 +268,8 @@ flo_to_s(mrb_state *mrb, mrb_value flt)
|
|
263
268
|
static mrb_value
|
264
269
|
flo_minus(mrb_state *mrb, mrb_value x)
|
265
270
|
{
|
266
|
-
mrb_value y;
|
271
|
+
mrb_value y = mrb_get_arg1(mrb);
|
267
272
|
|
268
|
-
mrb_get_args(mrb, "o", &y);
|
269
273
|
return mrb_float_value(mrb, mrb_float(x) - mrb_to_flo(mrb, y));
|
270
274
|
}
|
271
275
|
|
@@ -281,9 +285,8 @@ flo_minus(mrb_state *mrb, mrb_value x)
|
|
281
285
|
static mrb_value
|
282
286
|
flo_mul(mrb_state *mrb, mrb_value x)
|
283
287
|
{
|
284
|
-
mrb_value y;
|
288
|
+
mrb_value y = mrb_get_arg1(mrb);
|
285
289
|
|
286
|
-
mrb_get_args(mrb, "o", &y);
|
287
290
|
return mrb_float_value(mrb, mrb_float(x) * mrb_to_flo(mrb, y));
|
288
291
|
}
|
289
292
|
|
@@ -343,11 +346,9 @@ flodivmod(mrb_state *mrb, double x, double y, mrb_float *divp, mrb_float *modp)
|
|
343
346
|
static mrb_value
|
344
347
|
flo_mod(mrb_state *mrb, mrb_value x)
|
345
348
|
{
|
346
|
-
mrb_value y;
|
349
|
+
mrb_value y = mrb_get_arg1(mrb);
|
347
350
|
mrb_float mod;
|
348
351
|
|
349
|
-
mrb_get_args(mrb, "o", &y);
|
350
|
-
|
351
352
|
flodivmod(mrb, mrb_float(x), mrb_to_flo(mrb, y), 0, &mod);
|
352
353
|
return mrb_float_value(mrb, mod);
|
353
354
|
}
|
@@ -368,9 +369,8 @@ flo_mod(mrb_state *mrb, mrb_value x)
|
|
368
369
|
static mrb_value
|
369
370
|
fix_eql(mrb_state *mrb, mrb_value x)
|
370
371
|
{
|
371
|
-
mrb_value y;
|
372
|
+
mrb_value y = mrb_get_arg1(mrb);
|
372
373
|
|
373
|
-
mrb_get_args(mrb, "o", &y);
|
374
374
|
if (!mrb_fixnum_p(y)) return mrb_false_value();
|
375
375
|
return mrb_bool_value(mrb_fixnum(x) == mrb_fixnum(y));
|
376
376
|
}
|
@@ -379,9 +379,8 @@ fix_eql(mrb_state *mrb, mrb_value x)
|
|
379
379
|
static mrb_value
|
380
380
|
flo_eql(mrb_state *mrb, mrb_value x)
|
381
381
|
{
|
382
|
-
mrb_value y;
|
382
|
+
mrb_value y = mrb_get_arg1(mrb);
|
383
383
|
|
384
|
-
mrb_get_args(mrb, "o", &y);
|
385
384
|
if (!mrb_float_p(y)) return mrb_false_value();
|
386
385
|
return mrb_bool_value(mrb_float(x) == mrb_float(y));
|
387
386
|
}
|
@@ -402,8 +401,7 @@ flo_eql(mrb_state *mrb, mrb_value x)
|
|
402
401
|
static mrb_value
|
403
402
|
flo_eq(mrb_state *mrb, mrb_value x)
|
404
403
|
{
|
405
|
-
mrb_value y;
|
406
|
-
mrb_get_args(mrb, "o", &y);
|
404
|
+
mrb_value y = mrb_get_arg1(mrb);
|
407
405
|
|
408
406
|
switch (mrb_type(y)) {
|
409
407
|
case MRB_TT_FIXNUM:
|
@@ -421,7 +419,6 @@ value_int64(mrb_state *mrb, mrb_value x)
|
|
421
419
|
switch (mrb_type(x)) {
|
422
420
|
case MRB_TT_FIXNUM:
|
423
421
|
return (int64_t)mrb_fixnum(x);
|
424
|
-
break;
|
425
422
|
case MRB_TT_FLOAT:
|
426
423
|
return (int64_t)mrb_float(x);
|
427
424
|
default:
|
@@ -452,9 +449,8 @@ flo_rev(mrb_state *mrb, mrb_value x)
|
|
452
449
|
static mrb_value
|
453
450
|
flo_and(mrb_state *mrb, mrb_value x)
|
454
451
|
{
|
455
|
-
mrb_value y;
|
452
|
+
mrb_value y = mrb_get_arg1(mrb);
|
456
453
|
int64_t v1, v2;
|
457
|
-
mrb_get_args(mrb, "o", &y);
|
458
454
|
|
459
455
|
v1 = (int64_t)mrb_float(x);
|
460
456
|
v2 = value_int64(mrb, y);
|
@@ -464,9 +460,8 @@ flo_and(mrb_state *mrb, mrb_value x)
|
|
464
460
|
static mrb_value
|
465
461
|
flo_or(mrb_state *mrb, mrb_value x)
|
466
462
|
{
|
467
|
-
mrb_value y;
|
463
|
+
mrb_value y = mrb_get_arg1(mrb);
|
468
464
|
int64_t v1, v2;
|
469
|
-
mrb_get_args(mrb, "o", &y);
|
470
465
|
|
471
466
|
v1 = (int64_t)mrb_float(x);
|
472
467
|
v2 = value_int64(mrb, y);
|
@@ -476,9 +471,8 @@ flo_or(mrb_state *mrb, mrb_value x)
|
|
476
471
|
static mrb_value
|
477
472
|
flo_xor(mrb_state *mrb, mrb_value x)
|
478
473
|
{
|
479
|
-
mrb_value y;
|
474
|
+
mrb_value y = mrb_get_arg1(mrb);
|
480
475
|
int64_t v1, v2;
|
481
|
-
mrb_get_args(mrb, "o", &y);
|
482
476
|
|
483
477
|
v1 = (int64_t)mrb_float(x);
|
484
478
|
v2 = value_int64(mrb, y);
|
@@ -839,9 +833,8 @@ mrb_num_mul(mrb_state *mrb, mrb_value x, mrb_value y)
|
|
839
833
|
static mrb_value
|
840
834
|
fix_mul(mrb_state *mrb, mrb_value x)
|
841
835
|
{
|
842
|
-
mrb_value y;
|
836
|
+
mrb_value y = mrb_get_arg1(mrb);
|
843
837
|
|
844
|
-
mrb_get_args(mrb, "o", &y);
|
845
838
|
return fixnum_mul(mrb, x, y);
|
846
839
|
}
|
847
840
|
|
@@ -886,10 +879,9 @@ fixdivmod(mrb_state *mrb, mrb_int x, mrb_int y, mrb_int *divp, mrb_int *modp)
|
|
886
879
|
static mrb_value
|
887
880
|
fix_mod(mrb_state *mrb, mrb_value x)
|
888
881
|
{
|
889
|
-
mrb_value y;
|
882
|
+
mrb_value y = mrb_get_arg1(mrb);
|
890
883
|
mrb_int a, b;
|
891
884
|
|
892
|
-
mrb_get_args(mrb, "o", &y);
|
893
885
|
a = mrb_fixnum(x);
|
894
886
|
if (mrb_fixnum_p(y) && a != MRB_INT_MIN && (b=mrb_fixnum(y)) != MRB_INT_MIN) {
|
895
887
|
mrb_int mod;
|
@@ -928,9 +920,7 @@ fix_mod(mrb_state *mrb, mrb_value x)
|
|
928
920
|
static mrb_value
|
929
921
|
fix_divmod(mrb_state *mrb, mrb_value x)
|
930
922
|
{
|
931
|
-
mrb_value y;
|
932
|
-
|
933
|
-
mrb_get_args(mrb, "o", &y);
|
923
|
+
mrb_value y = mrb_get_arg1(mrb);
|
934
924
|
|
935
925
|
if (mrb_fixnum_p(y)) {
|
936
926
|
mrb_int div, mod;
|
@@ -967,12 +957,10 @@ fix_divmod(mrb_state *mrb, mrb_value x)
|
|
967
957
|
static mrb_value
|
968
958
|
flo_divmod(mrb_state *mrb, mrb_value x)
|
969
959
|
{
|
970
|
-
mrb_value y;
|
960
|
+
mrb_value y = mrb_get_arg1(mrb);
|
971
961
|
mrb_float div, mod;
|
972
962
|
mrb_value a, b;
|
973
963
|
|
974
|
-
mrb_get_args(mrb, "o", &y);
|
975
|
-
|
976
964
|
flodivmod(mrb, mrb_float(x), mrb_to_flo(mrb, y), &div, &mod);
|
977
965
|
a = mrb_int_value(mrb, div);
|
978
966
|
b = mrb_float_value(mrb, mod);
|
@@ -995,9 +983,8 @@ flo_divmod(mrb_state *mrb, mrb_value x)
|
|
995
983
|
static mrb_value
|
996
984
|
fix_equal(mrb_state *mrb, mrb_value x)
|
997
985
|
{
|
998
|
-
mrb_value y;
|
986
|
+
mrb_value y = mrb_get_arg1(mrb);
|
999
987
|
|
1000
|
-
mrb_get_args(mrb, "o", &y);
|
1001
988
|
switch (mrb_type(y)) {
|
1002
989
|
case MRB_TT_FIXNUM:
|
1003
990
|
return mrb_bool_value(mrb_fixnum(x) == mrb_fixnum(y));
|
@@ -1054,9 +1041,8 @@ static mrb_value flo_xor(mrb_state *mrb, mrb_value x);
|
|
1054
1041
|
static mrb_value
|
1055
1042
|
fix_and(mrb_state *mrb, mrb_value x)
|
1056
1043
|
{
|
1057
|
-
mrb_value y;
|
1044
|
+
mrb_value y = mrb_get_arg1(mrb);
|
1058
1045
|
|
1059
|
-
mrb_get_args(mrb, "o", &y);
|
1060
1046
|
bit_op(x, y, and, &);
|
1061
1047
|
}
|
1062
1048
|
|
@@ -1071,9 +1057,8 @@ fix_and(mrb_state *mrb, mrb_value x)
|
|
1071
1057
|
static mrb_value
|
1072
1058
|
fix_or(mrb_state *mrb, mrb_value x)
|
1073
1059
|
{
|
1074
|
-
mrb_value y;
|
1060
|
+
mrb_value y = mrb_get_arg1(mrb);
|
1075
1061
|
|
1076
|
-
mrb_get_args(mrb, "o", &y);
|
1077
1062
|
bit_op(x, y, or, |);
|
1078
1063
|
}
|
1079
1064
|
|
@@ -1088,9 +1073,8 @@ fix_or(mrb_state *mrb, mrb_value x)
|
|
1088
1073
|
static mrb_value
|
1089
1074
|
fix_xor(mrb_state *mrb, mrb_value x)
|
1090
1075
|
{
|
1091
|
-
mrb_value y;
|
1076
|
+
mrb_value y = mrb_get_arg1(mrb);
|
1092
1077
|
|
1093
|
-
mrb_get_args(mrb, "o", &y);
|
1094
1078
|
bit_op(x, y, or, ^);
|
1095
1079
|
}
|
1096
1080
|
|
@@ -1312,9 +1296,8 @@ mrb_num_plus(mrb_state *mrb, mrb_value x, mrb_value y)
|
|
1312
1296
|
static mrb_value
|
1313
1297
|
fix_plus(mrb_state *mrb, mrb_value self)
|
1314
1298
|
{
|
1315
|
-
mrb_value other;
|
1299
|
+
mrb_value other = mrb_get_arg1(mrb);
|
1316
1300
|
|
1317
|
-
mrb_get_args(mrb, "o", &other);
|
1318
1301
|
return fixnum_plus(mrb, self, other);
|
1319
1302
|
}
|
1320
1303
|
|
@@ -1370,9 +1353,8 @@ mrb_num_minus(mrb_state *mrb, mrb_value x, mrb_value y)
|
|
1370
1353
|
static mrb_value
|
1371
1354
|
fix_minus(mrb_state *mrb, mrb_value self)
|
1372
1355
|
{
|
1373
|
-
mrb_value other;
|
1356
|
+
mrb_value other = mrb_get_arg1(mrb);
|
1374
1357
|
|
1375
|
-
mrb_get_args(mrb, "o", &other);
|
1376
1358
|
return fixnum_minus(mrb, self, other);
|
1377
1359
|
}
|
1378
1360
|
|
@@ -1383,6 +1365,7 @@ mrb_fixnum_to_str(mrb_state *mrb, mrb_value x, mrb_int base)
|
|
1383
1365
|
char buf[MRB_INT_BIT+1];
|
1384
1366
|
char *b = buf + sizeof buf;
|
1385
1367
|
mrb_int val = mrb_fixnum(x);
|
1368
|
+
mrb_value str;
|
1386
1369
|
|
1387
1370
|
if (base < 2 || 36 < base) {
|
1388
1371
|
mrb_raisef(mrb, E_ARGUMENT_ERROR, "invalid radix %i", base);
|
@@ -1403,7 +1386,9 @@ mrb_fixnum_to_str(mrb_state *mrb, mrb_value x, mrb_int base)
|
|
1403
1386
|
} while (val /= base);
|
1404
1387
|
}
|
1405
1388
|
|
1406
|
-
|
1389
|
+
str = mrb_str_new(mrb, b, buf + sizeof(buf) - b);
|
1390
|
+
RSTR_SET_ASCII_FLAG(mrb_str_ptr(str));
|
1391
|
+
return str;
|
1407
1392
|
}
|
1408
1393
|
|
1409
1394
|
/* 15.2.8.3.25 */
|
@@ -1474,21 +1459,21 @@ cmpnum(mrb_state *mrb, mrb_value v1, mrb_value v2)
|
|
1474
1459
|
/* 15.2.9.3.6 */
|
1475
1460
|
/*
|
1476
1461
|
* call-seq:
|
1477
|
-
* self.f <=> other.f => -1, 0, +1
|
1462
|
+
* self.f <=> other.f => -1, 0, +1, or nil
|
1478
1463
|
* < => -1
|
1479
1464
|
* = => 0
|
1480
1465
|
* > => +1
|
1481
1466
|
* Comparison---Returns -1, 0, or +1 depending on whether <i>fix</i> is
|
1482
1467
|
* less than, equal to, or greater than <i>numeric</i>. This is the
|
1483
|
-
* basis for the tests in <code>Comparable</code>.
|
1468
|
+
* basis for the tests in <code>Comparable</code>. When the operands are
|
1469
|
+
* not comparable, it returns nil instead of raising an exception.
|
1484
1470
|
*/
|
1485
1471
|
static mrb_value
|
1486
1472
|
integral_cmp(mrb_state *mrb, mrb_value self)
|
1487
1473
|
{
|
1488
|
-
mrb_value other;
|
1474
|
+
mrb_value other = mrb_get_arg1(mrb);
|
1489
1475
|
mrb_int n;
|
1490
1476
|
|
1491
|
-
mrb_get_args(mrb, "o", &other);
|
1492
1477
|
n = cmpnum(mrb, self, other);
|
1493
1478
|
if (n == -2) return mrb_nil_value();
|
1494
1479
|
return mrb_fixnum_value(n);
|
@@ -1503,10 +1488,9 @@ cmperr(mrb_state *mrb, mrb_value v1, mrb_value v2)
|
|
1503
1488
|
static mrb_value
|
1504
1489
|
integral_lt(mrb_state *mrb, mrb_value self)
|
1505
1490
|
{
|
1506
|
-
mrb_value other;
|
1491
|
+
mrb_value other = mrb_get_arg1(mrb);
|
1507
1492
|
mrb_int n;
|
1508
1493
|
|
1509
|
-
mrb_get_args(mrb, "o", &other);
|
1510
1494
|
n = cmpnum(mrb, self, other);
|
1511
1495
|
if (n == -2) cmperr(mrb, self, other);
|
1512
1496
|
if (n < 0) return mrb_true_value();
|
@@ -1516,10 +1500,9 @@ integral_lt(mrb_state *mrb, mrb_value self)
|
|
1516
1500
|
static mrb_value
|
1517
1501
|
integral_le(mrb_state *mrb, mrb_value self)
|
1518
1502
|
{
|
1519
|
-
mrb_value other;
|
1503
|
+
mrb_value other = mrb_get_arg1(mrb);
|
1520
1504
|
mrb_int n;
|
1521
1505
|
|
1522
|
-
mrb_get_args(mrb, "o", &other);
|
1523
1506
|
n = cmpnum(mrb, self, other);
|
1524
1507
|
if (n == -2) cmperr(mrb, self, other);
|
1525
1508
|
if (n <= 0) return mrb_true_value();
|
@@ -1529,10 +1512,9 @@ integral_le(mrb_state *mrb, mrb_value self)
|
|
1529
1512
|
static mrb_value
|
1530
1513
|
integral_gt(mrb_state *mrb, mrb_value self)
|
1531
1514
|
{
|
1532
|
-
mrb_value other;
|
1515
|
+
mrb_value other = mrb_get_arg1(mrb);
|
1533
1516
|
mrb_int n;
|
1534
1517
|
|
1535
|
-
mrb_get_args(mrb, "o", &other);
|
1536
1518
|
n = cmpnum(mrb, self, other);
|
1537
1519
|
if (n == -2) cmperr(mrb, self, other);
|
1538
1520
|
if (n > 0) return mrb_true_value();
|
@@ -1542,10 +1524,9 @@ integral_gt(mrb_state *mrb, mrb_value self)
|
|
1542
1524
|
static mrb_value
|
1543
1525
|
integral_ge(mrb_state *mrb, mrb_value self)
|
1544
1526
|
{
|
1545
|
-
mrb_value other;
|
1527
|
+
mrb_value other = mrb_get_arg1(mrb);
|
1546
1528
|
mrb_int n;
|
1547
1529
|
|
1548
|
-
mrb_get_args(mrb, "o", &other);
|
1549
1530
|
n = cmpnum(mrb, self, other);
|
1550
1531
|
if (n == -2) cmperr(mrb, self, other);
|
1551
1532
|
if (n >= 0) return mrb_true_value();
|
@@ -1597,9 +1578,8 @@ num_infinite_p(mrb_state *mrb, mrb_value self)
|
|
1597
1578
|
static mrb_value
|
1598
1579
|
flo_plus(mrb_state *mrb, mrb_value x)
|
1599
1580
|
{
|
1600
|
-
mrb_value y;
|
1581
|
+
mrb_value y = mrb_get_arg1(mrb);
|
1601
1582
|
|
1602
|
-
mrb_get_args(mrb, "o", &y);
|
1603
1583
|
return mrb_float_value(mrb, mrb_float(x) + mrb_to_flo(mrb, y));
|
1604
1584
|
}
|
1605
1585
|
#endif
|