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
@@ -21,7 +21,7 @@ def do_v() @ret += "Dave"; end
|
|
21
21
|
}
|
22
22
|
def interpret(string)
|
23
23
|
@ret = ""
|
24
|
-
string.
|
24
|
+
string.split("").each {|b| Dispatcher[b].bind(self).call }
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
@@ -441,3 +441,11 @@ def foo
|
|
441
441
|
assert_raise(TypeError) { Array.instance_method(:each).bind(1) }
|
442
442
|
assert_kind_of Method, Object.instance_method(:object_id).bind(Object.new)
|
443
443
|
end
|
444
|
+
|
445
|
+
assert 'UnboundMethod#bind_call' do
|
446
|
+
m = Array.instance_method(:size)
|
447
|
+
assert_equal(:size, m.name)
|
448
|
+
assert_equal(0, m.bind_call([]))
|
449
|
+
assert_equal(1, m.bind_call([1]))
|
450
|
+
assert_equal(2, m.bind_call([1,2]))
|
451
|
+
end
|
@@ -1,38 +1,6 @@
|
|
1
1
|
#include <limits.h>
|
2
2
|
#include <mruby.h>
|
3
|
-
|
4
|
-
static inline mrb_int
|
5
|
-
to_int(mrb_state *mrb, mrb_value x)
|
6
|
-
{
|
7
|
-
x = mrb_to_int(mrb, x);
|
8
|
-
return mrb_fixnum(x);
|
9
|
-
}
|
10
|
-
|
11
|
-
/*
|
12
|
-
* Document-method: Integer#chr
|
13
|
-
* call-seq:
|
14
|
-
* int.chr -> string
|
15
|
-
*
|
16
|
-
* Returns a string containing the character represented by the +int+'s value
|
17
|
-
* according to +encoding+.
|
18
|
-
*
|
19
|
-
* 65.chr #=> "A"
|
20
|
-
* 230.chr #=> "\xE6"
|
21
|
-
*/
|
22
|
-
static mrb_value
|
23
|
-
mrb_int_chr(mrb_state *mrb, mrb_value x)
|
24
|
-
{
|
25
|
-
mrb_int chr;
|
26
|
-
char c;
|
27
|
-
|
28
|
-
chr = to_int(mrb, x);
|
29
|
-
if (chr >= (1 << CHAR_BIT)) {
|
30
|
-
mrb_raisef(mrb, E_RANGE_ERROR, "%S out of char range", x);
|
31
|
-
}
|
32
|
-
c = (char)chr;
|
33
|
-
|
34
|
-
return mrb_str_new(mrb, &c, 1);
|
35
|
-
}
|
3
|
+
#include <mruby/numeric.h>
|
36
4
|
|
37
5
|
/*
|
38
6
|
* call-seq:
|
@@ -46,7 +14,7 @@ mrb_int_allbits(mrb_state *mrb, mrb_value self)
|
|
46
14
|
mrb_int n, m;
|
47
15
|
|
48
16
|
mrb_get_args(mrb, "i", &m);
|
49
|
-
n =
|
17
|
+
n = mrb_int(mrb, self);
|
50
18
|
return mrb_bool_value((n & m) == m);
|
51
19
|
}
|
52
20
|
|
@@ -62,7 +30,7 @@ mrb_int_anybits(mrb_state *mrb, mrb_value self)
|
|
62
30
|
mrb_int n, m;
|
63
31
|
|
64
32
|
mrb_get_args(mrb, "i", &m);
|
65
|
-
n =
|
33
|
+
n = mrb_int(mrb, self);
|
66
34
|
return mrb_bool_value((n & m) != 0);
|
67
35
|
}
|
68
36
|
|
@@ -78,7 +46,7 @@ mrb_int_nobits(mrb_state *mrb, mrb_value self)
|
|
78
46
|
mrb_int n, m;
|
79
47
|
|
80
48
|
mrb_get_args(mrb, "i", &m);
|
81
|
-
n =
|
49
|
+
n = mrb_int(mrb, self);
|
82
50
|
return mrb_bool_value((n & m) == 0);
|
83
51
|
}
|
84
52
|
|
@@ -87,10 +55,22 @@ mrb_mruby_numeric_ext_gem_init(mrb_state* mrb)
|
|
87
55
|
{
|
88
56
|
struct RClass *i = mrb_module_get(mrb, "Integral");
|
89
57
|
|
90
|
-
mrb_define_method(mrb, i, "chr", mrb_int_chr, MRB_ARGS_NONE());
|
91
58
|
mrb_define_method(mrb, i, "allbits?", mrb_int_allbits, MRB_ARGS_REQ(1));
|
92
59
|
mrb_define_method(mrb, i, "anybits?", mrb_int_anybits, MRB_ARGS_REQ(1));
|
93
60
|
mrb_define_method(mrb, i, "nobits?", mrb_int_nobits, MRB_ARGS_REQ(1));
|
61
|
+
|
62
|
+
#ifndef MRB_WITHOUT_FLOAT
|
63
|
+
mrb_define_const(mrb, mrb->float_class, "RADIX", mrb_fixnum_value(MRB_FLT_RADIX));
|
64
|
+
mrb_define_const(mrb, mrb->float_class, "MANT_DIG", mrb_fixnum_value(MRB_FLT_MANT_DIG));
|
65
|
+
mrb_define_const(mrb, mrb->float_class, "EPSILON", mrb_float_value(mrb, MRB_FLT_EPSILON));
|
66
|
+
mrb_define_const(mrb, mrb->float_class, "DIG", mrb_fixnum_value(MRB_FLT_DIG));
|
67
|
+
mrb_define_const(mrb, mrb->float_class, "MIN_EXP", mrb_fixnum_value(MRB_FLT_MIN_EXP));
|
68
|
+
mrb_define_const(mrb, mrb->float_class, "MIN", mrb_float_value(mrb, MRB_FLT_MIN));
|
69
|
+
mrb_define_const(mrb, mrb->float_class, "MIN_10_EXP", mrb_fixnum_value(MRB_FLT_MIN_10_EXP));
|
70
|
+
mrb_define_const(mrb, mrb->float_class, "MAX_EXP", mrb_fixnum_value(MRB_FLT_MAX_EXP));
|
71
|
+
mrb_define_const(mrb, mrb->float_class, "MAX", mrb_float_value(mrb, MRB_FLT_MAX));
|
72
|
+
mrb_define_const(mrb, mrb->float_class, "MAX_10_EXP", mrb_fixnum_value(MRB_FLT_MAX_10_EXP));
|
73
|
+
#endif /* MRB_WITHOUT_FLOAT */
|
94
74
|
}
|
95
75
|
|
96
76
|
void
|
@@ -1,14 +1,6 @@
|
|
1
1
|
##
|
2
2
|
# Numeric(Ext) Test
|
3
3
|
|
4
|
-
assert('Integer#chr') do
|
5
|
-
assert_equal("A", 65.chr)
|
6
|
-
assert_equal("B", 0x42.chr)
|
7
|
-
|
8
|
-
# multibyte encoding (not support yet)
|
9
|
-
assert_raise(RangeError) { 256.chr }
|
10
|
-
end
|
11
|
-
|
12
4
|
assert('Integer#div') do
|
13
5
|
assert_equal 52, 365.div(7)
|
14
6
|
end
|
@@ -1,4 +1,18 @@
|
|
1
|
-
|
1
|
+
module Kernel
|
2
|
+
# call-seq:
|
3
|
+
# obj.yield_self {|_obj|...} -> an_object
|
4
|
+
# obj.then {|_obj|...} -> an_object
|
5
|
+
#
|
6
|
+
# Yields <i>obj</i> and returns the result.
|
7
|
+
#
|
8
|
+
# 'my string'.yield_self {|s|s.upcase} #=> "MY STRING"
|
9
|
+
#
|
10
|
+
def yield_self(&block)
|
11
|
+
return to_enum :yield_self unless block
|
12
|
+
block.call(self)
|
13
|
+
end
|
14
|
+
alias then yield_self
|
15
|
+
|
2
16
|
##
|
3
17
|
# call-seq:
|
4
18
|
# obj.tap{|x|...} -> obj
|
@@ -1,6 +1,7 @@
|
|
1
1
|
#include <mruby.h>
|
2
2
|
#include <mruby/array.h>
|
3
3
|
#include <mruby/class.h>
|
4
|
+
#include <mruby/hash.h>
|
4
5
|
#include <mruby/proc.h>
|
5
6
|
|
6
7
|
/*
|
@@ -31,6 +32,19 @@ nil_to_f(mrb_state *mrb, mrb_value obj)
|
|
31
32
|
}
|
32
33
|
#endif
|
33
34
|
|
35
|
+
/*
|
36
|
+
* call-seq:
|
37
|
+
* nil.to_h -> {}
|
38
|
+
*
|
39
|
+
* Always returns an empty hash.
|
40
|
+
*/
|
41
|
+
|
42
|
+
static mrb_value
|
43
|
+
nil_to_h(mrb_state *mrb, mrb_value obj)
|
44
|
+
{
|
45
|
+
return mrb_hash_new(mrb);
|
46
|
+
}
|
47
|
+
|
34
48
|
/*
|
35
49
|
* call-seq:
|
36
50
|
* nil.to_i -> 0
|
@@ -44,6 +58,22 @@ nil_to_i(mrb_state *mrb, mrb_value obj)
|
|
44
58
|
return mrb_fixnum_value(0);
|
45
59
|
}
|
46
60
|
|
61
|
+
/*
|
62
|
+
* call-seq:
|
63
|
+
* obj.itself -> an_object
|
64
|
+
*
|
65
|
+
* Returns <i>obj</i>.
|
66
|
+
*
|
67
|
+
* string = 'my string' #=> "my string"
|
68
|
+
* string.itself.object_id == string.object_id #=> true
|
69
|
+
*
|
70
|
+
*/
|
71
|
+
static mrb_value
|
72
|
+
mrb_f_itself(mrb_state *mrb, mrb_value self)
|
73
|
+
{
|
74
|
+
return self;
|
75
|
+
}
|
76
|
+
|
47
77
|
/*
|
48
78
|
* call-seq:
|
49
79
|
* obj.instance_exec(arg...) {|var...| block } -> obj
|
@@ -70,11 +100,7 @@ mrb_obj_instance_exec(mrb_state *mrb, mrb_value self)
|
|
70
100
|
mrb_value blk;
|
71
101
|
struct RClass *c;
|
72
102
|
|
73
|
-
mrb_get_args(mrb, "
|
74
|
-
|
75
|
-
if (mrb_nil_p(blk)) {
|
76
|
-
mrb_raise(mrb, E_ARGUMENT_ERROR, "no block given");
|
77
|
-
}
|
103
|
+
mrb_get_args(mrb, "*&!", &argv, &argc, &blk);
|
78
104
|
|
79
105
|
switch (mrb_type(self)) {
|
80
106
|
case MRB_TT_SYMBOL:
|
@@ -101,9 +127,12 @@ mrb_mruby_object_ext_gem_init(mrb_state* mrb)
|
|
101
127
|
#ifndef MRB_WITHOUT_FLOAT
|
102
128
|
mrb_define_method(mrb, n, "to_f", nil_to_f, MRB_ARGS_NONE());
|
103
129
|
#endif
|
130
|
+
mrb_define_method(mrb, n, "to_h", nil_to_h, MRB_ARGS_NONE());
|
104
131
|
mrb_define_method(mrb, n, "to_i", nil_to_i, MRB_ARGS_NONE());
|
105
132
|
|
106
|
-
mrb_define_method(mrb, mrb->kernel_module, "
|
133
|
+
mrb_define_method(mrb, mrb->kernel_module, "itself", mrb_f_itself, MRB_ARGS_NONE());
|
134
|
+
|
135
|
+
mrb_define_method(mrb, mrb_class_get(mrb, "BasicObject"), "instance_exec", mrb_obj_instance_exec, MRB_ARGS_ANY() | MRB_ARGS_BLOCK());
|
107
136
|
}
|
108
137
|
|
109
138
|
void
|
@@ -161,11 +161,7 @@ os_each_object(mrb_state *mrb, mrb_value self)
|
|
161
161
|
{
|
162
162
|
mrb_value cls = mrb_nil_value();
|
163
163
|
struct os_each_object_data d;
|
164
|
-
mrb_get_args(mrb, "
|
165
|
-
|
166
|
-
if (mrb_nil_p(d.block)) {
|
167
|
-
mrb_raise(mrb, E_ARGUMENT_ERROR, "Expected block in ObjectSpace.each_object.");
|
168
|
-
}
|
164
|
+
mrb_get_args(mrb, "&!|C", &d.block, &cls);
|
169
165
|
|
170
166
|
d.target_module = mrb_nil_p(cls) ? NULL : mrb_class_ptr(cls);
|
171
167
|
d.count = 0;
|
@@ -3,7 +3,7 @@
|
|
3
3
|
*/
|
4
4
|
|
5
5
|
#include "mruby.h"
|
6
|
-
#include "error.h"
|
6
|
+
#include "mruby/error.h"
|
7
7
|
#include "mruby/array.h"
|
8
8
|
#include "mruby/class.h"
|
9
9
|
#include "mruby/numeric.h"
|
@@ -118,9 +118,9 @@ make_base64_dec_tab(void)
|
|
118
118
|
base64_dec_tab['a' + i] = i + 26;
|
119
119
|
for (i = 0; i < 10; i++)
|
120
120
|
base64_dec_tab['0' + i] = i + 52;
|
121
|
-
base64_dec_tab['+'] = 62;
|
122
|
-
base64_dec_tab['/'] = 63;
|
123
|
-
base64_dec_tab['='] = PACK_BASE64_PADDING;
|
121
|
+
base64_dec_tab['+'+0] = 62;
|
122
|
+
base64_dec_tab['/'+0] = 63;
|
123
|
+
base64_dec_tab['='+0] = PACK_BASE64_PADDING;
|
124
124
|
}
|
125
125
|
|
126
126
|
static mrb_value
|
@@ -237,7 +237,7 @@ unpack_l(mrb_state *mrb, const unsigned char *src, int srclen, mrb_value ary, un
|
|
237
237
|
int32_t sl = ul;
|
238
238
|
#ifndef MRB_INT64
|
239
239
|
if (!FIXABLE(sl)) {
|
240
|
-
snprintf(msg, sizeof(msg), "cannot unpack to Fixnum: %
|
240
|
+
snprintf(msg, sizeof(msg), "cannot unpack to Fixnum: %" PRId32, sl);
|
241
241
|
mrb_raise(mrb, E_RANGE_ERROR, msg);
|
242
242
|
}
|
243
243
|
#endif
|
@@ -245,7 +245,7 @@ unpack_l(mrb_state *mrb, const unsigned char *src, int srclen, mrb_value ary, un
|
|
245
245
|
} else {
|
246
246
|
#ifndef MRB_INT64
|
247
247
|
if (!POSFIXABLE(ul)) {
|
248
|
-
snprintf(msg, sizeof(msg), "cannot unpack to Fixnum: %
|
248
|
+
snprintf(msg, sizeof(msg), "cannot unpack to Fixnum: %" PRIu32, ul);
|
249
249
|
mrb_raise(mrb, E_RANGE_ERROR, msg);
|
250
250
|
}
|
251
251
|
#endif
|
@@ -307,13 +307,13 @@ unpack_q(mrb_state *mrb, const unsigned char *src, int srclen, mrb_value ary, un
|
|
307
307
|
if (flags & PACK_FLAG_SIGNED) {
|
308
308
|
int64_t sll = ull;
|
309
309
|
if (!FIXABLE(sll)) {
|
310
|
-
snprintf(msg, sizeof(msg), "cannot unpack to Fixnum: %
|
310
|
+
snprintf(msg, sizeof(msg), "cannot unpack to Fixnum: %" PRId64, sll);
|
311
311
|
mrb_raise(mrb, E_RANGE_ERROR, msg);
|
312
312
|
}
|
313
313
|
n = sll;
|
314
314
|
} else {
|
315
315
|
if (!POSFIXABLE(ull)) {
|
316
|
-
snprintf(msg, sizeof(msg), "cannot unpack to Fixnum: %
|
316
|
+
snprintf(msg, sizeof(msg), "cannot unpack to Fixnum: %" PRIu64, ull);
|
317
317
|
mrb_raise(mrb, E_RANGE_ERROR, msg);
|
318
318
|
}
|
319
319
|
n = ull;
|
@@ -529,8 +529,8 @@ utf8_to_uv(mrb_state *mrb, const char *p, long *lenp)
|
|
529
529
|
mrb_raise(mrb, E_ARGUMENT_ERROR, "malformed UTF-8 character");
|
530
530
|
}
|
531
531
|
if (n > *lenp) {
|
532
|
-
mrb_raisef(mrb, E_ARGUMENT_ERROR, "malformed UTF-8 character (expected %
|
533
|
-
|
532
|
+
mrb_raisef(mrb, E_ARGUMENT_ERROR, "malformed UTF-8 character (expected %d bytes, given %d bytes)",
|
533
|
+
n, *lenp);
|
534
534
|
}
|
535
535
|
*lenp = n--;
|
536
536
|
if (n != 0) {
|
@@ -976,7 +976,7 @@ alias:
|
|
976
976
|
case 4: t = 'L'; goto alias;
|
977
977
|
case 8: t = 'Q'; goto alias;
|
978
978
|
default:
|
979
|
-
mrb_raisef(mrb, E_RUNTIME_ERROR, "mruby-pack does not support sizeof(int) == %
|
979
|
+
mrb_raisef(mrb, E_RUNTIME_ERROR, "mruby-pack does not support sizeof(int) == %d", (int)sizeof(int));
|
980
980
|
}
|
981
981
|
break;
|
982
982
|
case 'i':
|
@@ -985,7 +985,7 @@ alias:
|
|
985
985
|
case 4: t = 'l'; goto alias;
|
986
986
|
case 8: t = 'q'; goto alias;
|
987
987
|
default:
|
988
|
-
mrb_raisef(mrb, E_RUNTIME_ERROR, "mruby-pack does not support sizeof(int) == %
|
988
|
+
mrb_raisef(mrb, E_RUNTIME_ERROR, "mruby-pack does not support sizeof(int) == %d", (int)sizeof(int));
|
989
989
|
}
|
990
990
|
break;
|
991
991
|
case 'L':
|
@@ -1002,7 +1002,7 @@ alias:
|
|
1002
1002
|
case 'm':
|
1003
1003
|
dir = PACK_DIR_BASE64;
|
1004
1004
|
type = PACK_TYPE_STRING;
|
1005
|
-
flags |= PACK_FLAG_WIDTH;
|
1005
|
+
flags |= PACK_FLAG_WIDTH | PACK_FLAG_COUNT2;
|
1006
1006
|
break;
|
1007
1007
|
case 'N': /* = "L>" */
|
1008
1008
|
dir = PACK_DIR_LONG;
|
@@ -1075,18 +1075,18 @@ alias:
|
|
1075
1075
|
if (ISDIGIT(ch)) {
|
1076
1076
|
count = ch - '0';
|
1077
1077
|
while (tmpl->idx < tlen && ISDIGIT(tptr[tmpl->idx])) {
|
1078
|
-
|
1079
|
-
if (count
|
1078
|
+
int ch = tptr[tmpl->idx++] - '0';
|
1079
|
+
if (count+ch > INT_MAX/10) {
|
1080
1080
|
mrb_raise(mrb, E_RUNTIME_ERROR, "too big template length");
|
1081
1081
|
}
|
1082
|
+
count = count * 10 + ch;
|
1082
1083
|
}
|
1083
1084
|
continue; /* special case */
|
1084
1085
|
} else if (ch == '*') {
|
1085
1086
|
count = -1;
|
1086
1087
|
} else if (ch == '_' || ch == '!' || ch == '<' || ch == '>') {
|
1087
1088
|
if (strchr("sSiIlLqQ", (int)t) == NULL) {
|
1088
|
-
|
1089
|
-
mrb_raisef(mrb, E_ARGUMENT_ERROR, "'%S' allowed only after types sSiIlLqQ", mrb_str_new(mrb, &ch_str, 1));
|
1089
|
+
mrb_raisef(mrb, E_ARGUMENT_ERROR, "'%c' allowed only after types sSiIlLqQ", ch);
|
1090
1090
|
}
|
1091
1091
|
if (ch == '_' || ch == '!') {
|
1092
1092
|
flags |= PACK_FLAG_s;
|
@@ -1155,7 +1155,7 @@ mrb_pack_pack(mrb_state *mrb, mrb_value ary)
|
|
1155
1155
|
#endif
|
1156
1156
|
else if (type == PACK_TYPE_STRING) {
|
1157
1157
|
if (!mrb_string_p(o)) {
|
1158
|
-
mrb_raisef(mrb, E_TYPE_ERROR, "can't convert %
|
1158
|
+
mrb_raisef(mrb, E_TYPE_ERROR, "can't convert %T into String", o);
|
1159
1159
|
}
|
1160
1160
|
}
|
1161
1161
|
|
@@ -1195,7 +1195,7 @@ mrb_pack_pack(mrb_state *mrb, mrb_value ary)
|
|
1195
1195
|
default:
|
1196
1196
|
break;
|
1197
1197
|
}
|
1198
|
-
if (dir == PACK_DIR_STR) { /* always consumes 1 entry */
|
1198
|
+
if (dir == PACK_DIR_STR || dir == PACK_DIR_BASE64) { /* always consumes 1 entry */
|
1199
1199
|
aidx++;
|
1200
1200
|
break;
|
1201
1201
|
}
|
@@ -1248,6 +1248,9 @@ pack_unpack(mrb_state *mrb, mrb_value str, int single)
|
|
1248
1248
|
case PACK_DIR_STR:
|
1249
1249
|
srcidx += unpack_a(mrb, sptr, srclen - srcidx, result, count, flags);
|
1250
1250
|
break;
|
1251
|
+
case PACK_DIR_BASE64:
|
1252
|
+
srcidx += unpack_m(mrb, sptr, srclen - srcidx, result, flags);
|
1253
|
+
break;
|
1251
1254
|
}
|
1252
1255
|
continue;
|
1253
1256
|
}
|
@@ -1274,9 +1277,6 @@ pack_unpack(mrb_state *mrb, mrb_value str, int single)
|
|
1274
1277
|
case PACK_DIR_QUAD:
|
1275
1278
|
srcidx += unpack_q(mrb, sptr, srclen - srcidx, result, flags);
|
1276
1279
|
break;
|
1277
|
-
case PACK_DIR_BASE64:
|
1278
|
-
srcidx += unpack_m(mrb, sptr, srclen - srcidx, result, flags);
|
1279
|
-
break;
|
1280
1280
|
#ifndef MRB_WITHOUT_FLOAT
|
1281
1281
|
case PACK_DIR_FLOAT:
|
1282
1282
|
srcidx += unpack_float(mrb, sptr, srclen - srcidx, result, flags);
|
@@ -1298,7 +1298,12 @@ pack_unpack(mrb_state *mrb, mrb_value str, int single)
|
|
1298
1298
|
if (single) break;
|
1299
1299
|
}
|
1300
1300
|
|
1301
|
-
if (single)
|
1301
|
+
if (single) {
|
1302
|
+
if (RARRAY_LEN(result) > 0) {
|
1303
|
+
return RARRAY_PTR(result)[0];
|
1304
|
+
}
|
1305
|
+
return mrb_nil_value();
|
1306
|
+
}
|
1302
1307
|
return result;
|
1303
1308
|
}
|
1304
1309
|
|
@@ -1,101 +1,95 @@
|
|
1
|
+
PACK_IS_LITTLE_ENDIAN = "\x01\00".unpack('S')[0] == 0x01
|
2
|
+
|
3
|
+
def assert_pack tmpl, packed, unpacked
|
4
|
+
t = tmpl.inspect
|
5
|
+
assert "assert_pack" do
|
6
|
+
assert_equal packed, unpacked.pack(tmpl), "#{unpacked.inspect}.pack(#{t})"
|
7
|
+
assert_equal unpacked, packed.unpack(tmpl), "#{packed.inspect}.unpack(#{t})"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
1
11
|
# pack & unpack 'm' (base64)
|
2
12
|
assert('[""].pack("m")') do
|
3
|
-
|
4
|
-
str = ""
|
5
|
-
[ary].pack("m") == str and
|
6
|
-
str.unpack("m") == [ary]
|
13
|
+
assert_pack "m", "", [""]
|
7
14
|
end
|
8
15
|
|
9
16
|
assert('["\0"].pack("m")') do
|
10
|
-
|
11
|
-
str = "AA==\n"
|
12
|
-
[ary].pack("m") == str and
|
13
|
-
str.unpack("m") == [ary]
|
17
|
+
assert_pack "m", "AA==\n", ["\0"]
|
14
18
|
end
|
15
19
|
|
16
20
|
assert('["\0\0"].pack("m")') do
|
17
|
-
|
18
|
-
str = "AAA=\n"
|
19
|
-
[ary].pack("m") == str and
|
20
|
-
str.unpack("m") == [ary]
|
21
|
+
assert_pack "m", "AAA=\n", ["\0\0"]
|
21
22
|
end
|
22
23
|
|
23
24
|
assert('["\0\0\0"].pack("m")') do
|
24
|
-
|
25
|
-
str = "AAAA\n"
|
26
|
-
[ary].pack("m") == str and
|
27
|
-
str.unpack("m") == [ary]
|
25
|
+
assert_pack "m", "AAAA\n", ["\0\0\0"]
|
28
26
|
end
|
29
27
|
|
30
28
|
assert('["abc..xyzABC..XYZ"].pack("m")') do
|
31
|
-
|
29
|
+
assert_pack "m", "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNERUZHSElKS0xNTk9QUVJT\nVFVWV1hZWg==\n", ["abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"]
|
32
30
|
end
|
33
31
|
|
34
32
|
assert('"YWJ...".unpack("m") should "abc..xyzABC..XYZ"') do
|
35
|
-
|
36
|
-
"YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNERUZHSElKS0xNTk9QUVJT\nVFVWV1hZWg==\n".unpack("m")
|
37
|
-
"YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWg==\n".unpack("m")
|
33
|
+
ary = ["abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"]
|
34
|
+
assert_equal ary, "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNERUZHSElKS0xNTk9QUVJT\nVFVWV1hZWg==\n".unpack("m")
|
35
|
+
assert_equal ary, "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWg==\n".unpack("m")
|
36
|
+
end
|
37
|
+
|
38
|
+
assert('["A", "B"].pack') do
|
39
|
+
assert_equal "QQ==\n", ["A", "B"].pack("m50")
|
40
|
+
assert_equal ["A"], "QQ==\n".unpack("m50")
|
41
|
+
assert_equal "QQ==Qg==", ["A", "B"].pack("m0 m0")
|
42
|
+
assert_equal ["A", "B"], "QQ==Qg==".unpack("m10 m10")
|
43
|
+
end
|
44
|
+
|
45
|
+
assert('["abc..xyzABC..XYZ"].pack("m0")') do
|
46
|
+
assert_pack "m0", "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWg==", ["abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"]
|
38
47
|
end
|
39
48
|
|
40
49
|
# pack & unpack 'H'
|
41
50
|
assert('["3031"].pack("H*")') do
|
42
|
-
|
43
|
-
str = "01"
|
44
|
-
[ary].pack("H*") == str and
|
45
|
-
str.unpack("H*") == [ary]
|
51
|
+
assert_pack "H*", "01", ["3031"]
|
46
52
|
end
|
47
53
|
|
48
54
|
assert('["10"].pack("H*")') do
|
49
|
-
|
50
|
-
str = "\020"
|
51
|
-
[ary].pack("H*") == str and
|
52
|
-
str.unpack("H*") == [ary]
|
55
|
+
assert_pack "H*", "\020", ["10"]
|
53
56
|
end
|
54
57
|
|
55
58
|
assert('[0,1,127,128,255].pack("C*")') do
|
56
|
-
|
57
|
-
str = "\x00\x01\x7F\x80\xFF"
|
58
|
-
ary.pack("C*") == str and str.unpack("C*") == ary
|
59
|
+
assert_pack "C*", "\x00\x01\x7F\x80\xFF", [0, 1, 127, 128, 255]
|
59
60
|
end
|
60
61
|
|
61
62
|
# pack "a"
|
62
63
|
assert('["abc"].pack("a")') do
|
63
|
-
["abc"].pack("a")
|
64
|
-
["abc"].pack("a*")
|
65
|
-
["abc"].pack("a4")
|
64
|
+
assert_equal "a", ["abc"].pack("a")
|
65
|
+
assert_equal "abc", ["abc"].pack("a*")
|
66
|
+
assert_equal "abc\0", ["abc"].pack("a4")
|
66
67
|
end
|
67
68
|
|
68
69
|
# upack "a"
|
69
70
|
assert('["abc"].pack("a")') do
|
70
|
-
"abc\0".unpack("a4")
|
71
|
-
"abc ".unpack("a4")
|
71
|
+
assert_equal ["abc\0"], "abc\0".unpack("a4")
|
72
|
+
assert_equal ["abc "], "abc ".unpack("a4")
|
72
73
|
end
|
73
74
|
|
74
75
|
# pack "A"
|
75
76
|
assert('["abc"].pack("A")') do
|
76
|
-
["abc"].pack("A")
|
77
|
-
["abc"].pack("A*")
|
78
|
-
["abc"].pack("A4")
|
77
|
+
assert_equal "a", ["abc"].pack("A")
|
78
|
+
assert_equal "abc", ["abc"].pack("A*")
|
79
|
+
assert_equal "abc ", ["abc"].pack("A4")
|
79
80
|
end
|
80
81
|
|
81
82
|
# upack "A"
|
82
83
|
assert('["abc"].pack("A")') do
|
83
|
-
"abc\0".unpack("A4")
|
84
|
-
"abc ".unpack("A4")
|
84
|
+
assert_equal ["abc"], "abc\0".unpack("A4")
|
85
|
+
assert_equal ["abc"], "abc ".unpack("A4")
|
85
86
|
end
|
86
87
|
|
87
88
|
# regression tests
|
88
89
|
assert('issue #1') do
|
89
|
-
[1, 2].pack("nn")
|
90
|
+
assert_equal "\000\001\000\002", [1, 2].pack("nn")
|
90
91
|
end
|
91
92
|
|
92
|
-
def assert_pack tmpl, packed, unpacked
|
93
|
-
assert_equal packed, unpacked.pack(tmpl)
|
94
|
-
assert_equal unpacked, packed.unpack(tmpl)
|
95
|
-
end
|
96
|
-
|
97
|
-
PACK_IS_LITTLE_ENDIAN = "\x01\00".unpack('S')[0] == 0x01
|
98
|
-
|
99
93
|
assert 'pack float' do
|
100
94
|
assert_pack 'e', "\x00\x00@@", [3.0]
|
101
95
|
assert_pack 'g', "@@\x00\x00", [3.0]
|