script_core 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.rubocop.yml +8 -6
- data/.ruby-version +1 -1
- data/Gemfile +2 -1
- data/bin/sandbox +1 -1
- data/ext/enterprise_script_service/Rakefile +1 -1
- data/ext/enterprise_script_service/flags.rb +5 -0
- data/ext/enterprise_script_service/libseccomp/CHANGELOG +15 -0
- data/ext/enterprise_script_service/libseccomp/CREDITS +3 -0
- data/ext/enterprise_script_service/libseccomp/Makefile.am +1 -1
- data/ext/enterprise_script_service/libseccomp/README.md +1 -1
- data/ext/enterprise_script_service/libseccomp/SECURITY.md +45 -0
- data/ext/enterprise_script_service/libseccomp/configure.ac +3 -3
- data/ext/enterprise_script_service/libseccomp/doc/admin/MAINTAINER_PROCESS.md +95 -0
- data/ext/enterprise_script_service/libseccomp/{RELEASE_PROCESS.md → doc/admin/RELEASE_PROCESS.md} +9 -1
- data/ext/enterprise_script_service/libseccomp/include/Makefile.am +1 -1
- data/ext/enterprise_script_service/libseccomp/include/seccomp-syscalls.h +2292 -0
- data/ext/enterprise_script_service/libseccomp/include/seccomp.h.in +3 -1065
- data/ext/enterprise_script_service/libseccomp/src/arch-aarch64-syscalls.c +35 -3
- data/ext/enterprise_script_service/libseccomp/src/arch-arm-syscalls.c +35 -3
- data/ext/enterprise_script_service/libseccomp/src/arch-mips-syscalls.c +43 -11
- data/ext/enterprise_script_service/libseccomp/src/arch-mips64-syscalls.c +33 -1
- data/ext/enterprise_script_service/libseccomp/src/arch-mips64n32-syscalls.c +33 -1
- data/ext/enterprise_script_service/libseccomp/src/arch-parisc-syscalls.c +34 -2
- data/ext/enterprise_script_service/libseccomp/src/arch-ppc-syscalls.c +43 -11
- data/ext/enterprise_script_service/libseccomp/src/arch-ppc64-syscalls.c +44 -12
- data/ext/enterprise_script_service/libseccomp/src/arch-s390-syscalls.c +46 -14
- data/ext/enterprise_script_service/libseccomp/src/arch-s390.c +142 -18
- data/ext/enterprise_script_service/libseccomp/src/arch-s390x-syscalls.c +47 -15
- data/ext/enterprise_script_service/libseccomp/src/arch-s390x.c +143 -17
- data/ext/enterprise_script_service/libseccomp/src/arch-x32-syscalls.c +33 -1
- data/ext/enterprise_script_service/libseccomp/src/arch-x86-syscalls.c +94 -12
- data/ext/enterprise_script_service/libseccomp/src/arch-x86.c +142 -19
- data/ext/enterprise_script_service/libseccomp/src/arch-x86_64-syscalls.c +33 -1
- data/ext/enterprise_script_service/libseccomp/src/db.c +1 -0
- data/ext/enterprise_script_service/libseccomp/src/gen_bpf.c +10 -3
- data/ext/enterprise_script_service/libseccomp/src/python/Makefile.am +4 -4
- data/ext/enterprise_script_service/libseccomp/src/python/seccomp.pyx +2 -0
- data/ext/enterprise_script_service/libseccomp/tests/.gitignore +1 -0
- data/ext/enterprise_script_service/libseccomp/tests/50-sim-hash_collision.c +98 -0
- data/ext/enterprise_script_service/libseccomp/tests/50-sim-hash_collision.py +61 -0
- data/ext/enterprise_script_service/libseccomp/tests/50-sim-hash_collision.tests +18 -0
- data/ext/enterprise_script_service/libseccomp/tests/Makefile.am +6 -3
- data/ext/enterprise_script_service/libseccomp/tools/Makefile.am +0 -2
- data/ext/enterprise_script_service/libseccomp/tools/check-syntax +1 -0
- data/ext/enterprise_script_service/libseccomp/tools/scmp_bpf_sim.c +2 -0
- data/ext/enterprise_script_service/mruby-mpdecimal/src/ext.c +1 -1
- data/ext/enterprise_script_service/mruby/.gitignore +2 -2
- data/ext/enterprise_script_service/mruby/CONTRIBUTING.md +10 -3
- data/ext/enterprise_script_service/mruby/Doxyfile +2408 -0
- data/ext/enterprise_script_service/mruby/README.md +21 -8
- data/ext/enterprise_script_service/mruby/Rakefile +4 -13
- data/ext/enterprise_script_service/mruby/appveyor_config.rb +1 -1
- data/ext/enterprise_script_service/mruby/build_config.rb +3 -3
- data/ext/enterprise_script_service/mruby/doc/guides/compile.md +42 -42
- data/ext/enterprise_script_service/mruby/doc/guides/debugger.md +1 -1
- data/ext/enterprise_script_service/mruby/doc/guides/mrbconf.md +45 -6
- data/ext/enterprise_script_service/mruby/doc/guides/mrbgems.md +5 -0
- data/ext/enterprise_script_service/mruby/doc/limitations.md +88 -38
- data/ext/enterprise_script_service/mruby/doc/mruby_logo_red_icon.png +0 -0
- data/ext/enterprise_script_service/mruby/doc/opcode.md +94 -94
- data/ext/enterprise_script_service/mruby/include/mrbconf.h +74 -11
- data/ext/enterprise_script_service/mruby/include/mruby.h +242 -146
- data/ext/enterprise_script_service/mruby/include/mruby/array.h +7 -7
- data/ext/enterprise_script_service/mruby/include/mruby/boxing_nan.h +2 -9
- data/ext/enterprise_script_service/mruby/include/mruby/boxing_no.h +11 -10
- data/ext/enterprise_script_service/mruby/include/mruby/boxing_word.h +104 -69
- data/ext/enterprise_script_service/mruby/include/mruby/class.h +7 -5
- data/ext/enterprise_script_service/mruby/include/mruby/common.h +9 -7
- data/ext/enterprise_script_service/mruby/include/mruby/compile.h +6 -6
- data/ext/enterprise_script_service/mruby/include/mruby/data.h +5 -5
- data/ext/enterprise_script_service/mruby/include/mruby/debug.h +2 -2
- data/ext/enterprise_script_service/mruby/include/mruby/dump.h +3 -7
- data/ext/enterprise_script_service/mruby/include/mruby/error.h +34 -6
- data/ext/enterprise_script_service/mruby/include/mruby/gc.h +2 -2
- data/ext/enterprise_script_service/mruby/include/mruby/hash.h +4 -11
- data/ext/enterprise_script_service/mruby/include/mruby/irep.h +16 -4
- data/ext/enterprise_script_service/mruby/include/mruby/istruct.h +4 -4
- data/ext/enterprise_script_service/mruby/include/mruby/khash.h +2 -2
- data/ext/enterprise_script_service/mruby/include/mruby/numeric.h +41 -7
- data/ext/enterprise_script_service/mruby/include/mruby/object.h +8 -9
- data/ext/enterprise_script_service/mruby/include/mruby/opcode.h +2 -2
- data/ext/enterprise_script_service/mruby/include/mruby/ops.h +6 -6
- data/ext/enterprise_script_service/mruby/include/mruby/proc.h +19 -13
- data/ext/enterprise_script_service/mruby/include/mruby/range.h +10 -4
- data/ext/enterprise_script_service/mruby/include/mruby/re.h +2 -2
- data/ext/enterprise_script_service/mruby/include/mruby/string.h +130 -107
- data/ext/enterprise_script_service/mruby/include/mruby/throw.h +2 -2
- data/ext/enterprise_script_service/mruby/include/mruby/value.h +137 -49
- data/ext/enterprise_script_service/mruby/include/mruby/variable.h +3 -5
- data/ext/enterprise_script_service/mruby/include/mruby/version.h +24 -10
- data/ext/enterprise_script_service/mruby/lib/mruby-core-ext.rb +2 -39
- data/ext/enterprise_script_service/mruby/lib/mruby/build.rb +32 -15
- data/ext/enterprise_script_service/mruby/lib/mruby/build/command.rb +63 -17
- data/ext/enterprise_script_service/mruby/lib/mruby/build/load_gems.rb +24 -10
- data/ext/enterprise_script_service/mruby/lib/mruby/gem.rb +11 -7
- data/ext/enterprise_script_service/mruby/lib/mruby/lockfile.rb +81 -0
- data/ext/enterprise_script_service/mruby/minirake +27 -11
- data/ext/enterprise_script_service/mruby/mrbgems/default.gembox +3 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-array-ext/mrbgem.rake +0 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-array-ext/mrblib/array.rb +47 -9
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-array-ext/src/array.c +3 -3
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-array-ext/test/array.rb +50 -29
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.c +3 -3
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/apiprint.c +2 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/cmdprint.c +3 -3
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.c +2 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.h +1 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/mrdbconf.h +4 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mirb/tools/mirb/mirb.c +28 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mrbc/tools/mrbc/mrbc.c +1 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mruby/bintest/mruby.rb +75 -8
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c +134 -90
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-class-ext/src/class.c +7 -8
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/codegen.c +69 -46
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/keywords +0 -3
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/lex.def +51 -59
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/parse.y +430 -241
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-complex/mrbgem.rake +10 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-complex/mrblib/complex.rb +122 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-complex/src/complex.c +249 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-complex/test/complex.rb +153 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-enum-chain/mrblib/chain.rb +19 -17
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-enum-chain/test/enum_chain.rb +41 -9
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-enum-ext/mrblib/enum.rb +30 -4
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-enum-ext/test/enum.rb +8 -3
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-enumerator/mrbgem.rake +0 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-enumerator/mrblib/enumerator.rb +46 -14
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-enumerator/test/enumerator.rb +51 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-error/src/exception.c +10 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-eval/src/eval.c +47 -44
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-eval/test/eval.rb +2 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-exit/src/mruby-exit.c +9 -4
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-fiber/src/fiber.c +16 -12
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-fiber/test/fiber.rb +1 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-hash-ext/mrbgem.rake +0 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-hash-ext/mrblib/hash.rb +3 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-hash-ext/test/hash.rb +3 -7
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/README.md +1 -3
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/mrbgem.rake +1 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/mrblib/file.rb +0 -5
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/mrblib/io.rb +24 -38
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/mrblib/kernel.rb +16 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/src/file.c +19 -18
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/src/file_test.c +5 -16
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/src/io.c +54 -42
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/test/file.rb +24 -20
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/test/file_test.rb +4 -9
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/test/io.rb +41 -35
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/test/mruby_io_test.c +9 -36
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-kernel-ext/mrbgem.rake +1 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-kernel-ext/src/kernel.c +9 -27
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-kernel-ext/test/kernel.rb +2 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-math/src/math.c +5 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-metaprog/src/metaprog.c +39 -24
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-metaprog/test/metaprog.rb +48 -17
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-method/mrblib/method.rb +0 -12
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-method/src/method.c +134 -101
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-method/test/method.rb +9 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-numeric-ext/mrblib/numeric_ext.rb +1 -5
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-numeric-ext/src/numeric_ext.c +17 -37
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-numeric-ext/test/numeric.rb +0 -8
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-object-ext/mrbgem.rake +1 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-object-ext/mrblib/object.rb +15 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-object-ext/src/object.c +35 -6
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-object-ext/test/nil.rb +4 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-objectspace/src/mruby_objectspace.c +1 -5
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-objectspace/test/objectspace.rb +1 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/src/pack.c +28 -23
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/test/pack.rb +43 -49
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-print/mrblib/print.rb +3 -9
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-proc-ext/src/proc.c +6 -9
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-proc-ext/test/proc.rb +21 -5
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-random/src/random.c +157 -124
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-random/test/random.rb +72 -26
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-range-ext/mrblib/range.rb +38 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-range-ext/src/range.c +26 -11
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-range-ext/test/range.rb +111 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-rational/mrbgem.rake +5 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-rational/mrblib/rational.rb +117 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-rational/src/rational.c +209 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-rational/test/rational.rb +308 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-socket/README.md +1 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-socket/src/socket.c +10 -9
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-sprintf/src/kernel.c +2 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-sprintf/src/sprintf.c +22 -24
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/mrbgem.rake +0 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/mrblib/string.rb +8 -4
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/src/string.c +116 -117
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/test/numeric.rb +29 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/test/range.rb +26 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/test/string.rb +32 -50
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-struct/mrblib/struct.rb +5 -7
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-struct/src/struct.c +43 -57
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-struct/test/struct.rb +16 -11
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-symbol-ext/src/symbol.c +2 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-symbol-ext/test/symbol.rb +1 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-test/driver.c +152 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-test/mrbgem.rake +4 -3
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-test/vformat.c +200 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-time/include/mruby/time.h +2 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-time/src/time.c +199 -68
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-time/test/time.rb +81 -46
- data/ext/enterprise_script_service/mruby/mrblib/array.rb +14 -16
- data/ext/enterprise_script_service/mruby/mrblib/enum.rb +13 -9
- data/ext/enterprise_script_service/mruby/mrblib/hash.rb +5 -7
- data/ext/enterprise_script_service/mruby/mrblib/kernel.rb +1 -1
- data/ext/enterprise_script_service/mruby/mrblib/numeric.rb +4 -4
- data/ext/enterprise_script_service/mruby/mrblib/range.rb +1 -1
- data/ext/enterprise_script_service/mruby/mrblib/string.rb +55 -112
- data/ext/enterprise_script_service/mruby/mruby-source.gemspec +1 -1
- data/ext/enterprise_script_service/mruby/oss-fuzz/config/mruby.dict +105 -0
- data/ext/enterprise_script_service/mruby/oss-fuzz/config/mruby_fuzzer.options +5 -0
- data/ext/enterprise_script_service/mruby/oss-fuzz/config/mruby_proto_fuzzer.options +4 -0
- data/ext/enterprise_script_service/mruby/oss-fuzz/mruby_fuzzer.c +18 -0
- data/ext/enterprise_script_service/mruby/oss-fuzz/mruby_proto_fuzzer.cpp +44 -0
- data/ext/enterprise_script_service/mruby/oss-fuzz/proto_to_ruby.cpp +455 -0
- data/ext/enterprise_script_service/mruby/oss-fuzz/proto_to_ruby.h +55 -0
- data/ext/enterprise_script_service/mruby/oss-fuzz/ruby.proto +201 -0
- data/ext/enterprise_script_service/mruby/src/array.c +95 -46
- data/ext/enterprise_script_service/mruby/src/backtrace.c +6 -8
- data/ext/enterprise_script_service/mruby/src/class.c +370 -278
- data/ext/enterprise_script_service/mruby/src/codedump.c +34 -34
- data/ext/enterprise_script_service/mruby/src/debug.c +2 -2
- data/ext/enterprise_script_service/mruby/src/dump.c +8 -6
- data/ext/enterprise_script_service/mruby/src/enum.c +1 -1
- data/ext/enterprise_script_service/mruby/src/error.c +157 -55
- data/ext/enterprise_script_service/mruby/src/etc.c +13 -46
- data/ext/enterprise_script_service/mruby/src/fmt_fp.c +2 -2
- data/ext/enterprise_script_service/mruby/src/gc.c +30 -11
- data/ext/enterprise_script_service/mruby/src/hash.c +23 -14
- data/ext/enterprise_script_service/mruby/src/kernel.c +16 -54
- data/ext/enterprise_script_service/mruby/src/load.c +40 -76
- data/ext/enterprise_script_service/mruby/src/numeric.c +164 -94
- data/ext/enterprise_script_service/mruby/src/object.c +16 -39
- data/ext/enterprise_script_service/mruby/src/pool.c +0 -2
- data/ext/enterprise_script_service/mruby/src/proc.c +47 -48
- data/ext/enterprise_script_service/mruby/src/range.c +22 -35
- data/ext/enterprise_script_service/mruby/src/state.c +5 -94
- data/ext/enterprise_script_service/mruby/src/string.c +874 -710
- data/ext/enterprise_script_service/mruby/src/symbol.c +73 -48
- data/ext/enterprise_script_service/mruby/src/variable.c +58 -38
- data/ext/enterprise_script_service/mruby/src/vm.c +133 -304
- data/ext/enterprise_script_service/mruby/tasks/doc.rake +48 -0
- data/ext/enterprise_script_service/mruby/tasks/toolchains/clang.rake +3 -4
- data/ext/enterprise_script_service/mruby/tasks/toolchains/gcc.rake +20 -19
- data/ext/enterprise_script_service/mruby/tasks/toolchains/visualcpp.rake +0 -12
- data/ext/enterprise_script_service/mruby/test/assert.rb +186 -25
- data/ext/enterprise_script_service/mruby/test/t/array.rb +34 -6
- data/ext/enterprise_script_service/mruby/test/t/class.rb +26 -0
- data/ext/enterprise_script_service/mruby/test/t/enumerable.rb +2 -2
- data/ext/enterprise_script_service/mruby/test/t/float.rb +17 -17
- data/ext/enterprise_script_service/mruby/test/t/hash.rb +2 -0
- data/ext/enterprise_script_service/mruby/test/t/integer.rb +14 -6
- data/ext/enterprise_script_service/mruby/test/t/kernel.rb +38 -19
- data/ext/enterprise_script_service/mruby/test/t/module.rb +87 -14
- data/ext/enterprise_script_service/mruby/test/t/numeric.rb +65 -23
- data/ext/enterprise_script_service/mruby/test/t/range.rb +4 -4
- data/ext/enterprise_script_service/mruby/test/t/string.rb +211 -49
- data/ext/enterprise_script_service/mruby/test/t/syntax.rb +19 -2
- data/ext/enterprise_script_service/mruby/test/t/vformat.rb +92 -0
- data/ext/enterprise_script_service/mruby/travis_config.rb +2 -2
- data/ext/enterprise_script_service/mruby_config.rb +10 -0
- data/ext/enterprise_script_service/mruby_engine.cpp +2 -2
- data/ext/enterprise_script_service/mruby_engine.gembox +1 -0
- data/ext/enterprise_script_service/msgpack/CHANGELOG.md +14 -0
- data/ext/enterprise_script_service/msgpack/Files.cmake +4 -0
- data/ext/enterprise_script_service/msgpack/README.md +1 -1
- data/ext/enterprise_script_service/msgpack/appveyor.yml +1 -1
- data/ext/enterprise_script_service/msgpack/erb/v1/cpp03_msgpack_tuple.hpp.erb +1 -1
- data/ext/enterprise_script_service/msgpack/erb/v1/cpp03_msgpack_tuple_decl.hpp.erb +1 -1
- data/ext/enterprise_script_service/msgpack/erb/v1/cpp03_zone.hpp.erb +3 -3
- data/ext/enterprise_script_service/msgpack/example/boost/asio_send_recv.cpp +1 -1
- data/ext/enterprise_script_service/msgpack/include/msgpack/adaptor/cpp11/timespec.hpp +16 -0
- data/ext/enterprise_script_service/msgpack/include/msgpack/adaptor/wstring.hpp +15 -0
- data/ext/enterprise_script_service/msgpack/include/msgpack/object.h +2 -0
- data/ext/enterprise_script_service/msgpack/include/msgpack/pack_template.h +17 -9
- data/ext/enterprise_script_service/msgpack/include/msgpack/sysdep.h +27 -16
- data/ext/enterprise_script_service/msgpack/include/msgpack/type.hpp +2 -0
- data/ext/enterprise_script_service/msgpack/include/msgpack/unpack_template.h +5 -0
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/array_ref.hpp +0 -1
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/check_container_size.hpp +1 -1
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/cpp11/chrono.hpp +5 -5
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/cpp11/timespec.hpp +140 -0
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/detail/cpp03_msgpack_tuple.hpp +32 -32
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/detail/cpp03_msgpack_tuple_decl.hpp +32 -32
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/detail/cpp11_msgpack_tuple.hpp +6 -6
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/detail/cpp11_msgpack_tuple_decl.hpp +10 -10
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/ext.hpp +1 -1
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/fixint.hpp +5 -4
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/int.hpp +40 -13
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/int_decl.hpp +3 -2
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/wstring.hpp +121 -0
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/detail/cpp03_zone.hpp +3 -3
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/detail/cpp11_zone.hpp +3 -3
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/object.hpp +6 -6
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/object_fwd.hpp +1 -1
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/pack.hpp +40 -5
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/unpack.hpp +11 -11
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/vrefbuffer.hpp +7 -7
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/zbuffer.hpp +5 -5
- data/ext/enterprise_script_service/msgpack/include/msgpack/v2/adaptor/int_decl.hpp +1 -1
- data/ext/enterprise_script_service/msgpack/include/msgpack/v2/create_object_visitor.hpp +1 -1
- data/ext/enterprise_script_service/msgpack/include/msgpack/v2/parse.hpp +13 -13
- data/ext/enterprise_script_service/msgpack/include/msgpack/v2/x3_parse.hpp +28 -26
- data/ext/enterprise_script_service/msgpack/include/msgpack/v3/adaptor/int_decl.hpp +1 -1
- data/ext/enterprise_script_service/msgpack/include/msgpack/v3/parse.hpp +13 -13
- data/ext/enterprise_script_service/msgpack/include/msgpack/version_master.h +2 -2
- data/ext/enterprise_script_service/msgpack/include/msgpack/zbuffer.h +6 -6
- data/ext/enterprise_script_service/msgpack/include/msgpack/zone.h +1 -1
- data/ext/enterprise_script_service/msgpack/src/objectc.c +83 -148
- data/ext/enterprise_script_service/msgpack/src/unpack.c +73 -47
- data/ext/enterprise_script_service/msgpack/test/CMakeLists.txt +1 -1
- data/ext/enterprise_script_service/msgpack/test/array_ref.cpp +5 -0
- data/ext/enterprise_script_service/msgpack/test/boost_fusion.cpp +5 -0
- data/ext/enterprise_script_service/msgpack/test/boost_optional.cpp +7 -0
- data/ext/enterprise_script_service/msgpack/test/boost_string_ref.cpp +7 -0
- data/ext/enterprise_script_service/msgpack/test/boost_string_view.cpp +6 -0
- data/ext/enterprise_script_service/msgpack/test/boost_variant.cpp +15 -9
- data/ext/enterprise_script_service/msgpack/test/buffer.cpp +7 -0
- data/ext/enterprise_script_service/msgpack/test/carray.cpp +7 -0
- data/ext/enterprise_script_service/msgpack/test/cases.cpp +7 -1
- data/ext/enterprise_script_service/msgpack/test/convert.cpp +6 -0
- data/ext/enterprise_script_service/msgpack/test/fixint.cpp +7 -1
- data/ext/enterprise_script_service/msgpack/test/fixint_c.cpp +6 -1
- data/ext/enterprise_script_service/msgpack/test/fuzz_unpack_pack_fuzzer_cpp11.cpp +5 -0
- data/ext/enterprise_script_service/msgpack/test/iterator_cpp11.cpp +8 -2
- data/ext/enterprise_script_service/msgpack/test/json.cpp +6 -0
- data/ext/enterprise_script_service/msgpack/test/limit.cpp +7 -0
- data/ext/enterprise_script_service/msgpack/test/msgpack_basic.cpp +128 -6
- data/ext/enterprise_script_service/msgpack/test/msgpack_c.cpp +7 -2
- data/ext/enterprise_script_service/msgpack/test/msgpack_container.cpp +20 -3
- data/ext/enterprise_script_service/msgpack/test/msgpack_cpp11.cpp +159 -0
- data/ext/enterprise_script_service/msgpack/test/msgpack_cpp17.cpp +5 -0
- data/ext/enterprise_script_service/msgpack/test/msgpack_stream.cpp +8 -3
- data/ext/enterprise_script_service/msgpack/test/msgpack_tuple.cpp +6 -0
- data/ext/enterprise_script_service/msgpack/test/msgpack_vref.cpp +5 -0
- data/ext/enterprise_script_service/msgpack/test/msgpack_x3_parse.cpp +23 -18
- data/ext/enterprise_script_service/msgpack/test/object.cpp +77 -45
- data/ext/enterprise_script_service/msgpack/test/object_with_zone.cpp +28 -10
- data/ext/enterprise_script_service/msgpack/test/pack_unpack.cpp +25 -18
- data/ext/enterprise_script_service/msgpack/test/pack_unpack_c.cpp +7 -0
- data/ext/enterprise_script_service/msgpack/test/raw.cpp +17 -12
- data/ext/enterprise_script_service/msgpack/test/reference.cpp +6 -0
- data/ext/enterprise_script_service/msgpack/test/reference_cpp11.cpp +6 -0
- data/ext/enterprise_script_service/msgpack/test/reference_wrapper_cpp11.cpp +6 -0
- data/ext/enterprise_script_service/msgpack/test/shared_ptr_cpp11.cpp +6 -0
- data/ext/enterprise_script_service/msgpack/test/size_equal_only.cpp +6 -2
- data/ext/enterprise_script_service/msgpack/test/streaming.cpp +10 -3
- data/ext/enterprise_script_service/msgpack/test/streaming_c.cpp +7 -0
- data/ext/enterprise_script_service/msgpack/test/unique_ptr_cpp11.cpp +6 -0
- data/ext/enterprise_script_service/msgpack/test/user_class.cpp +5 -0
- data/ext/enterprise_script_service/msgpack/test/version.cpp +6 -0
- data/ext/enterprise_script_service/msgpack/test/visitor.cpp +7 -0
- data/ext/enterprise_script_service/msgpack/test/zone.cpp +6 -0
- data/lib/script_core/version.rb +1 -1
- data/lib/tasks/mruby/engine.gembox.example +1 -0
- data/lib/tasks/script_core.rake +21 -3
- data/spec/dummy/app/helpers/fields_helper.rb +2 -2
- data/spec/dummy/mruby/engine.gembox +1 -0
- data/spec/script_core_spec.rb +1 -1
- metadata +38 -22
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/.gitignore +0 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/.travis.yml +0 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/run_test.rb +0 -26
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-kernel-ext/mrblib/kernel.rb +0 -15
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-method/mrblib/unbound_method.rb +0 -9
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/.gitignore +0 -5
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/.travis.yml +0 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/packtest.rb +0 -157
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/run_test.rb +0 -26
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-random/src/mt19937ar.c +0 -224
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-random/src/mt19937ar.h +0 -80
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-random/src/random.h +0 -12
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-sleep/.gitignore +0 -4
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-sleep/.travis.yml +0 -29
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-sleep/.travis_build_config.rb +0 -6
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-sleep/Rakefile +0 -29
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-socket/.travis.yml +0 -4
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-socket/run_test.rb +0 -28
@@ -71,7 +71,6 @@ get_outfilename(mrb_state *mrb, char *infile, const char *ext)
|
|
71
71
|
static int
|
72
72
|
parse_args(mrb_state *mrb, int argc, char **argv, struct mrbc_args *args)
|
73
73
|
{
|
74
|
-
char *outfile = NULL;
|
75
74
|
static const struct mrbc_args args_zero = { 0 };
|
76
75
|
int i;
|
77
76
|
|
@@ -86,7 +85,7 @@ parse_args(mrb_state *mrb, int argc, char **argv, struct mrbc_args *args)
|
|
86
85
|
case 'o':
|
87
86
|
if (args->outfile) {
|
88
87
|
fprintf(stderr, "%s: an output file is already specified. (%s)\n",
|
89
|
-
args->prog, outfile);
|
88
|
+
args->prog, args->outfile);
|
90
89
|
return -1;
|
91
90
|
}
|
92
91
|
if (argv[i][2] == '\0' && argv[i+1]) {
|
@@ -1,10 +1,18 @@
|
|
1
1
|
require 'tempfile'
|
2
|
+
require 'open3'
|
3
|
+
|
4
|
+
def assert_mruby(exp_out, exp_err, exp_success, args)
|
5
|
+
out, err, stat = Open3.capture3(cmd("mruby"), *args)
|
6
|
+
assert "assert_mruby" do
|
7
|
+
assert_operator(exp_out, :===, out, "standard output")
|
8
|
+
assert_operator(exp_err, :===, err, "standard error")
|
9
|
+
assert_equal(exp_success, stat.success?, "exit success?")
|
10
|
+
end
|
11
|
+
end
|
2
12
|
|
3
13
|
assert('regression for #1564') do
|
4
|
-
|
5
|
-
|
6
|
-
o = `#{cmd('mruby')} -e #{shellquote('<<-')} 2>&1`
|
7
|
-
assert_include o, "-e:1:3: syntax error"
|
14
|
+
assert_mruby("", /\A-e:1:2: syntax error, .*\n\z/, false, %w[-e <<])
|
15
|
+
assert_mruby("", /\A-e:1:3: syntax error, .*\n\z/, false, %w[-e <<-])
|
8
16
|
end
|
9
17
|
|
10
18
|
assert('regression for #1572') do
|
@@ -31,6 +39,11 @@
|
|
31
39
|
assert_equal '"-e"', `#{cmd('mruby')} -e #{shellquote('p $0')}`.chomp
|
32
40
|
end
|
33
41
|
|
42
|
+
assert 'ARGV value' do
|
43
|
+
assert_mruby(%{["ab", "cde"]\n}, "", true, %w[-e p(ARGV) ab cde])
|
44
|
+
assert_mruby("[]\n", "", true, %w[-e p(ARGV)])
|
45
|
+
end
|
46
|
+
|
34
47
|
assert('float literal') do
|
35
48
|
script, bin = Tempfile.new('test.rb'), Tempfile.new('test.mrb')
|
36
49
|
File.write script.path, 'p [3.21, 2e308.infinite?, -2e308.infinite?]'
|
@@ -66,11 +79,22 @@
|
|
66
79
|
assert_equal 0, $?.exitstatus
|
67
80
|
end
|
68
81
|
|
82
|
+
assert('mruby -c option') do
|
83
|
+
assert_mruby("Syntax OK\n", "", true, ["-c", "-e", "p 1"])
|
84
|
+
assert_mruby("", /\A-e:1:7: syntax error, .*\n\z/, false, ["-c", "-e", "p 1; 1."])
|
85
|
+
end
|
86
|
+
|
69
87
|
assert('mruby -d option') do
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
88
|
+
assert_mruby("false\n", "", true, ["-e", "p $DEBUG"])
|
89
|
+
assert_mruby("true\n", "", true, ["-dep $DEBUG"])
|
90
|
+
end
|
91
|
+
|
92
|
+
assert('mruby -e option (no code specified)') do
|
93
|
+
assert_mruby("", /\A.*: No code specified for -e\n\z/, false, %w[-e])
|
94
|
+
end
|
95
|
+
|
96
|
+
assert('mruby -h option') do
|
97
|
+
assert_mruby(/\AUsage: #{Regexp.escape cmd("mruby")} .*/m, "", true, %w[-h])
|
74
98
|
end
|
75
99
|
|
76
100
|
assert('mruby -r option') do
|
@@ -95,3 +119,46 @@ def hoge
|
|
95
119
|
assert_equal 'hogeClass', `#{cmd('mruby')} -r #{lib.path} -r #{script.path} -e #{shellquote('print Hoge.class')}`
|
96
120
|
assert_equal 0, $?.exitstatus
|
97
121
|
end
|
122
|
+
|
123
|
+
assert('mruby -r option (no library specified)') do
|
124
|
+
assert_mruby("", /\A.*: No library specified for -r\n\z/, false, %w[-r])
|
125
|
+
end
|
126
|
+
|
127
|
+
assert('mruby -r option (file not found)') do
|
128
|
+
assert_mruby("", /\A.*: Cannot open library file: .*\n\z/, false, %w[-r _no_exists_])
|
129
|
+
end
|
130
|
+
|
131
|
+
assert('mruby -v option') do
|
132
|
+
ver_re = '\Amruby \d+\.\d+\.\d+ \(\d+-\d+-\d+\)\n'
|
133
|
+
assert_mruby(/#{ver_re}\z/, "", true, %w[-v])
|
134
|
+
assert_mruby(/#{ver_re}^[^\n]*NODE.*\n:end\n\z/m, "", true, %w[-v -e p(:end)])
|
135
|
+
end
|
136
|
+
|
137
|
+
assert('mruby --verbose option') do
|
138
|
+
assert_mruby(/\A[^\n]*NODE.*\n:end\n\z/m, "", true, %w[--verbose -e p(:end)])
|
139
|
+
end
|
140
|
+
|
141
|
+
assert('mruby --') do
|
142
|
+
assert_mruby(%{["-x", "1"]\n}, "", true, %w[-e p(ARGV) -- -x 1])
|
143
|
+
end
|
144
|
+
|
145
|
+
assert('mruby invalid short option') do
|
146
|
+
assert_mruby("", /\A.*: invalid option -1 .*\n\z/, false, %w[-1])
|
147
|
+
end
|
148
|
+
|
149
|
+
assert('mruby invalid long option') do
|
150
|
+
assert_mruby("", /\A.*: invalid option --longopt .*\n\z/, false, %w[--longopt])
|
151
|
+
end
|
152
|
+
|
153
|
+
assert('unhandled exception') do
|
154
|
+
assert_mruby("", /\bEXCEPTION\b.*\n\z/, false, %w[-e raise("EXCEPTION")])
|
155
|
+
end
|
156
|
+
|
157
|
+
assert('program file not found') do
|
158
|
+
assert_mruby("", /\A.*: Cannot open program file: .*\n\z/, false, %w[_no_exists_])
|
159
|
+
end
|
160
|
+
|
161
|
+
assert('codegen error') do
|
162
|
+
code = "def f(#{(1..100).map{|n| "a#{n}"} * ","}); end"
|
163
|
+
assert_mruby("", /\Acodegen error:.*\n\z/, false, ["-e", code])
|
164
|
+
end
|
@@ -7,33 +7,29 @@
|
|
7
7
|
#include <mruby/dump.h>
|
8
8
|
#include <mruby/variable.h>
|
9
9
|
|
10
|
-
#ifdef MRB_DISABLE_STDIO
|
11
|
-
static void
|
12
|
-
p(mrb_state *mrb, mrb_value obj)
|
13
|
-
{
|
14
|
-
mrb_value val = mrb_inspect(mrb, obj);
|
15
|
-
|
16
|
-
fwrite(RSTRING_PTR(val), RSTRING_LEN(val), 1, stdout);
|
17
|
-
putc('\n', stdout);
|
18
|
-
}
|
19
|
-
#else
|
20
|
-
#define p(mrb,obj) mrb_p(mrb,obj)
|
21
|
-
#endif
|
22
|
-
|
23
10
|
struct _args {
|
24
11
|
FILE *rfp;
|
25
|
-
char*
|
12
|
+
char *cmdline;
|
26
13
|
mrb_bool fname : 1;
|
27
14
|
mrb_bool mrbfile : 1;
|
28
15
|
mrb_bool check_syntax : 1;
|
29
16
|
mrb_bool verbose : 1;
|
17
|
+
mrb_bool version : 1;
|
30
18
|
mrb_bool debug : 1;
|
31
19
|
int argc;
|
32
|
-
char**
|
20
|
+
char **argv;
|
33
21
|
int libc;
|
34
22
|
char **libv;
|
35
23
|
};
|
36
24
|
|
25
|
+
struct options {
|
26
|
+
int argc;
|
27
|
+
char **argv;
|
28
|
+
char *program;
|
29
|
+
char *opt;
|
30
|
+
char short_opt[2];
|
31
|
+
};
|
32
|
+
|
37
33
|
static void
|
38
34
|
usage(const char *name)
|
39
35
|
{
|
@@ -52,11 +48,69 @@ usage(const char *name)
|
|
52
48
|
};
|
53
49
|
const char *const *p = usage_msg;
|
54
50
|
|
55
|
-
printf("Usage: %s [switches] programfile\n", name);
|
51
|
+
printf("Usage: %s [switches] [programfile] [arguments]\n", name);
|
56
52
|
while (*p)
|
57
53
|
printf(" %s\n", *p++);
|
58
54
|
}
|
59
55
|
|
56
|
+
static void
|
57
|
+
options_init(struct options *opts, int argc, char **argv)
|
58
|
+
{
|
59
|
+
opts->argc = argc;
|
60
|
+
opts->argv = argv;
|
61
|
+
opts->program = *argv;
|
62
|
+
*opts->short_opt = 0;
|
63
|
+
}
|
64
|
+
|
65
|
+
static const char *
|
66
|
+
options_opt(struct options *opts)
|
67
|
+
{
|
68
|
+
/* concatenated short options (e.g. `-cv`) */
|
69
|
+
if (*opts->short_opt && *++opts->opt) {
|
70
|
+
short_opt:
|
71
|
+
opts->short_opt[0] = *opts->opt;
|
72
|
+
opts->short_opt[1] = 0;
|
73
|
+
return opts->short_opt;
|
74
|
+
}
|
75
|
+
|
76
|
+
while (++opts->argv, --opts->argc) {
|
77
|
+
opts->opt = *opts->argv;
|
78
|
+
|
79
|
+
/* empty || not start with `-` || `-` */
|
80
|
+
if (!opts->opt[0] || opts->opt[0] != '-' || !opts->opt[1]) return NULL;
|
81
|
+
|
82
|
+
if (opts->opt[1] == '-') {
|
83
|
+
/* `--` */
|
84
|
+
if (!opts->opt[2]) {
|
85
|
+
++opts->argv, --opts->argc;
|
86
|
+
return NULL;
|
87
|
+
}
|
88
|
+
/* long option */
|
89
|
+
opts->opt += 2;
|
90
|
+
*opts->short_opt = 0;
|
91
|
+
return opts->opt;
|
92
|
+
}
|
93
|
+
else {
|
94
|
+
/* short option */
|
95
|
+
++opts->opt;
|
96
|
+
goto short_opt;
|
97
|
+
}
|
98
|
+
}
|
99
|
+
return NULL;
|
100
|
+
}
|
101
|
+
|
102
|
+
static const char *
|
103
|
+
options_arg(struct options *opts)
|
104
|
+
{
|
105
|
+
if (*opts->short_opt && opts->opt[1]) {
|
106
|
+
/* concatenated short option and option argument (e.g. `-rLIBRARY`) */
|
107
|
+
*opts->short_opt = 0;
|
108
|
+
return opts->opt + 1;
|
109
|
+
}
|
110
|
+
--opts->argc, ++opts->argv;
|
111
|
+
return opts->argc ? *opts->argv : NULL;
|
112
|
+
}
|
113
|
+
|
60
114
|
static char *
|
61
115
|
dup_arg_item(mrb_state *mrb, const char *item)
|
62
116
|
{
|
@@ -69,40 +123,24 @@ dup_arg_item(mrb_state *mrb, const char *item)
|
|
69
123
|
static int
|
70
124
|
parse_args(mrb_state *mrb, int argc, char **argv, struct _args *args)
|
71
125
|
{
|
72
|
-
char **origargv = argv;
|
73
126
|
static const struct _args args_zero = { 0 };
|
127
|
+
struct options opts[1];
|
128
|
+
const char *opt, *item;
|
74
129
|
|
75
130
|
*args = args_zero;
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
if (argv[0][0] != '-') break;
|
80
|
-
|
81
|
-
if (strlen(*argv) <= 1) {
|
82
|
-
argc--; argv++;
|
83
|
-
args->rfp = stdin;
|
84
|
-
break;
|
85
|
-
}
|
86
|
-
|
87
|
-
item = argv[0] + 1;
|
88
|
-
switch (*item++) {
|
89
|
-
case 'b':
|
131
|
+
options_init(opts, argc, argv);
|
132
|
+
while ((opt = options_opt(opts))) {
|
133
|
+
if (strcmp(opt, "b") == 0) {
|
90
134
|
args->mrbfile = TRUE;
|
91
|
-
|
92
|
-
|
135
|
+
}
|
136
|
+
else if (strcmp(opt, "c") == 0) {
|
93
137
|
args->check_syntax = TRUE;
|
94
|
-
|
95
|
-
|
138
|
+
}
|
139
|
+
else if (strcmp(opt, "d") == 0) {
|
96
140
|
args->debug = TRUE;
|
97
|
-
|
98
|
-
|
99
|
-
if (item
|
100
|
-
goto append_cmdline;
|
101
|
-
}
|
102
|
-
else if (argc > 1) {
|
103
|
-
argc--; argv++;
|
104
|
-
item = argv[0];
|
105
|
-
append_cmdline:
|
141
|
+
}
|
142
|
+
else if (strcmp(opt, "e") == 0) {
|
143
|
+
if ((item = options_arg(opts))) {
|
106
144
|
if (!args->cmdline) {
|
107
145
|
args->cmdline = dup_arg_item(mrb, item);
|
108
146
|
}
|
@@ -119,55 +157,65 @@ append_cmdline:
|
|
119
157
|
}
|
120
158
|
}
|
121
159
|
else {
|
122
|
-
|
123
|
-
return
|
160
|
+
fprintf(stderr, "%s: No code specified for -e\n", opts->program);
|
161
|
+
return EXIT_FAILURE;
|
124
162
|
}
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
163
|
+
}
|
164
|
+
else if (strcmp(opt, "h") == 0) {
|
165
|
+
usage(opts->program);
|
166
|
+
exit(EXIT_SUCCESS);
|
167
|
+
}
|
168
|
+
else if (strcmp(opt, "r") == 0) {
|
169
|
+
if ((item = options_arg(opts))) {
|
170
|
+
if (args->libc == 0) {
|
171
|
+
args->libv = (char**)mrb_malloc(mrb, sizeof(char*));
|
131
172
|
}
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
args->libv = (char**)mrb_malloc(mrb, sizeof(char*));
|
173
|
+
else {
|
174
|
+
args->libv = (char**)mrb_realloc(mrb, args->libv, sizeof(char*) * (args->libc + 1));
|
175
|
+
}
|
176
|
+
args->libv[args->libc++] = dup_arg_item(mrb, item);
|
137
177
|
}
|
138
178
|
else {
|
139
|
-
|
179
|
+
fprintf(stderr, "%s: No library specified for -r\n", opts->program);
|
180
|
+
return EXIT_FAILURE;
|
140
181
|
}
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
if (!args->verbose) mrb_show_version(mrb);
|
145
|
-
args->verbose = TRUE;
|
146
|
-
break;
|
147
|
-
case '-':
|
148
|
-
if (strcmp((*argv) + 2, "version") == 0) {
|
182
|
+
}
|
183
|
+
else if (strcmp(opt, "v") == 0) {
|
184
|
+
if (!args->verbose) {
|
149
185
|
mrb_show_version(mrb);
|
150
|
-
|
151
|
-
}
|
152
|
-
else if (strcmp((*argv) + 2, "verbose") == 0) {
|
153
|
-
args->verbose = TRUE;
|
154
|
-
break;
|
155
|
-
}
|
156
|
-
else if (strcmp((*argv) + 2, "copyright") == 0) {
|
157
|
-
mrb_show_copyright(mrb);
|
158
|
-
exit(EXIT_SUCCESS);
|
186
|
+
args->version = TRUE;
|
159
187
|
}
|
160
|
-
|
188
|
+
args->verbose = TRUE;
|
189
|
+
}
|
190
|
+
else if (strcmp(opt, "version") == 0) {
|
191
|
+
mrb_show_version(mrb);
|
192
|
+
exit(EXIT_SUCCESS);
|
193
|
+
}
|
194
|
+
else if (strcmp(opt, "verbose") == 0) {
|
195
|
+
args->verbose = TRUE;
|
196
|
+
}
|
197
|
+
else if (strcmp(opt, "copyright") == 0) {
|
198
|
+
mrb_show_copyright(mrb);
|
199
|
+
exit(EXIT_SUCCESS);
|
200
|
+
}
|
201
|
+
else {
|
202
|
+
fprintf(stderr, "%s: invalid option %s%s (-h will show valid options)\n",
|
203
|
+
opts->program, opt[1] ? "--" : "-", opt);
|
161
204
|
return EXIT_FAILURE;
|
162
205
|
}
|
163
206
|
}
|
164
207
|
|
165
|
-
|
166
|
-
|
208
|
+
argc = opts->argc; argv = opts->argv;
|
209
|
+
if (args->cmdline == NULL) {
|
210
|
+
if (*argv == NULL) {
|
211
|
+
if (args->version) exit(EXIT_SUCCESS);
|
212
|
+
args->rfp = stdin;
|
213
|
+
}
|
167
214
|
else {
|
168
|
-
args->rfp =
|
215
|
+
args->rfp = strcmp(argv[0], "-") == 0 ?
|
216
|
+
stdin : fopen(argv[0], args->mrbfile ? "rb" : "r");
|
169
217
|
if (args->rfp == NULL) {
|
170
|
-
|
218
|
+
fprintf(stderr, "%s: Cannot open program file: %s\n", opts->program, argv[0]);
|
171
219
|
return EXIT_FAILURE;
|
172
220
|
}
|
173
221
|
args->fname = TRUE;
|
@@ -212,14 +260,13 @@ main(int argc, char **argv)
|
|
212
260
|
mrb_sym zero_sym;
|
213
261
|
|
214
262
|
if (mrb == NULL) {
|
215
|
-
|
263
|
+
fprintf(stderr, "%s: Invalid mrb_state, exiting mruby\n", *argv);
|
216
264
|
return EXIT_FAILURE;
|
217
265
|
}
|
218
266
|
|
219
267
|
n = parse_args(mrb, argc, argv, &args);
|
220
268
|
if (n == EXIT_FAILURE || (args.cmdline == NULL && args.rfp == NULL)) {
|
221
269
|
cleanup(mrb, &args);
|
222
|
-
usage(argv[0]);
|
223
270
|
return n;
|
224
271
|
}
|
225
272
|
else {
|
@@ -258,7 +305,7 @@ main(int argc, char **argv)
|
|
258
305
|
for (i = 0; i < args.libc; i++) {
|
259
306
|
FILE *lfp = fopen(args.libv[i], args.mrbfile ? "rb" : "r");
|
260
307
|
if (lfp == NULL) {
|
261
|
-
|
308
|
+
fprintf(stderr, "%s: Cannot open library file: %s\n", *argv, args.libv[i]);
|
262
309
|
mrbc_context_free(mrb, c);
|
263
310
|
cleanup(mrb, &args);
|
264
311
|
return EXIT_FAILURE;
|
@@ -289,19 +336,16 @@ main(int argc, char **argv)
|
|
289
336
|
mrb_gc_arena_restore(mrb, ai);
|
290
337
|
mrbc_context_free(mrb, c);
|
291
338
|
if (mrb->exc) {
|
292
|
-
if (mrb_undef_p(v)) {
|
293
|
-
mrb_p(mrb, mrb_obj_value(mrb->exc));
|
294
|
-
}
|
295
|
-
else {
|
339
|
+
if (!mrb_undef_p(v)) {
|
296
340
|
mrb_print_error(mrb);
|
297
341
|
}
|
298
|
-
n =
|
342
|
+
n = EXIT_FAILURE;
|
299
343
|
}
|
300
344
|
else if (args.check_syntax) {
|
301
|
-
|
345
|
+
puts("Syntax OK");
|
302
346
|
}
|
303
347
|
}
|
304
348
|
cleanup(mrb, &args);
|
305
349
|
|
306
|
-
return n
|
350
|
+
return n;
|
307
351
|
}
|
@@ -5,14 +5,17 @@
|
|
5
5
|
static mrb_value
|
6
6
|
mrb_mod_name(mrb_state *mrb, mrb_value self)
|
7
7
|
{
|
8
|
-
mrb_value name =
|
9
|
-
|
8
|
+
mrb_value name = mrb_class_path(mrb, mrb_class_ptr(self));
|
9
|
+
if (mrb_string_p(name)) {
|
10
|
+
MRB_SET_FROZEN_FLAG(mrb_basic_ptr(name));
|
11
|
+
}
|
12
|
+
return name;
|
10
13
|
}
|
11
14
|
|
12
15
|
static mrb_value
|
13
16
|
mrb_mod_singleton_class_p(mrb_state *mrb, mrb_value self)
|
14
17
|
{
|
15
|
-
return mrb_bool_value(
|
18
|
+
return mrb_bool_value(mrb_sclass_p(self));
|
16
19
|
}
|
17
20
|
|
18
21
|
/*
|
@@ -41,11 +44,7 @@ mrb_mod_module_exec(mrb_state *mrb, mrb_value self)
|
|
41
44
|
mrb_int argc;
|
42
45
|
mrb_value blk;
|
43
46
|
|
44
|
-
mrb_get_args(mrb, "
|
45
|
-
|
46
|
-
if (mrb_nil_p(blk)) {
|
47
|
-
mrb_raise(mrb, E_ARGUMENT_ERROR, "no block given");
|
48
|
-
}
|
47
|
+
mrb_get_args(mrb, "*&!", &argv, &argc, &blk);
|
49
48
|
|
50
49
|
mrb->c->ci->target_class = mrb_class_ptr(self);
|
51
50
|
return mrb_yield_cont(mrb, blk, self, argc, argv);
|