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
@@ -20,7 +20,7 @@ Date: Tue, 21 May 2013 04:31:30 GMT
|
|
20
20
|
```
|
21
21
|
|
22
22
|
## Requirement
|
23
|
-
- [
|
23
|
+
- [mruby-io](https://github.com/mruby/mruby/tree/master/mrbgems/mruby-io) mrbgem
|
24
24
|
- [iij/mruby-mtest](https://github.com/iij/mruby-mtest) mrgbem to run tests
|
25
25
|
- system must have RFC3493 basic socket interface
|
26
26
|
- and some POSIX API...
|
@@ -38,9 +38,10 @@
|
|
38
38
|
#include "mruby/array.h"
|
39
39
|
#include "mruby/class.h"
|
40
40
|
#include "mruby/data.h"
|
41
|
+
#include "mruby/numeric.h"
|
41
42
|
#include "mruby/string.h"
|
42
43
|
#include "mruby/variable.h"
|
43
|
-
#include "error.h"
|
44
|
+
#include "mruby/error.h"
|
44
45
|
|
45
46
|
#include "mruby/ext/io.h"
|
46
47
|
|
@@ -130,7 +131,7 @@ mrb_addrinfo_getaddrinfo(mrb_state *mrb, mrb_value klass)
|
|
130
131
|
mrb_get_args(mrb, "oo|oooi", &nodename, &service, &family, &socktype, &protocol, &flags);
|
131
132
|
|
132
133
|
if (mrb_string_p(nodename)) {
|
133
|
-
hostname =
|
134
|
+
hostname = RSTRING_CSTR(mrb, nodename);
|
134
135
|
} else if (mrb_nil_p(nodename)) {
|
135
136
|
hostname = NULL;
|
136
137
|
} else {
|
@@ -138,9 +139,9 @@ mrb_addrinfo_getaddrinfo(mrb_state *mrb, mrb_value klass)
|
|
138
139
|
}
|
139
140
|
|
140
141
|
if (mrb_string_p(service)) {
|
141
|
-
servname =
|
142
|
+
servname = RSTRING_CSTR(mrb, service);
|
142
143
|
} else if (mrb_fixnum_p(service)) {
|
143
|
-
servname =
|
144
|
+
servname = RSTRING_PTR(mrb_fixnum_to_str(mrb, service, 10));
|
144
145
|
} else if (mrb_nil_p(service)) {
|
145
146
|
servname = NULL;
|
146
147
|
} else {
|
@@ -170,7 +171,7 @@ mrb_addrinfo_getaddrinfo(mrb_state *mrb, mrb_value klass)
|
|
170
171
|
|
171
172
|
error = getaddrinfo(hostname, servname, &hints, &res0);
|
172
173
|
if (error) {
|
173
|
-
mrb_raisef(mrb, E_SOCKET_ERROR, "getaddrinfo: %
|
174
|
+
mrb_raisef(mrb, E_SOCKET_ERROR, "getaddrinfo: %s", gai_strerror(error));
|
174
175
|
}
|
175
176
|
mrb_cv_set(mrb, klass, mrb_intern_lit(mrb, "_lastai"), mrb_cptr_value(mrb, res0));
|
176
177
|
|
@@ -205,7 +206,7 @@ mrb_addrinfo_getnameinfo(mrb_state *mrb, mrb_value self)
|
|
205
206
|
}
|
206
207
|
error = getnameinfo((struct sockaddr *)RSTRING_PTR(sastr), (socklen_t)RSTRING_LEN(sastr), RSTRING_PTR(host), NI_MAXHOST, RSTRING_PTR(serv), NI_MAXSERV, (int)flags);
|
207
208
|
if (error) {
|
208
|
-
mrb_raisef(mrb, E_SOCKET_ERROR, "getnameinfo: %
|
209
|
+
mrb_raisef(mrb, E_SOCKET_ERROR, "getnameinfo: %s", gai_strerror(error));
|
209
210
|
}
|
210
211
|
ary = mrb_ary_new_capa(mrb, 2);
|
211
212
|
mrb_str_resize(mrb, host, strlen(RSTRING_PTR(host)));
|
@@ -454,7 +455,7 @@ mrb_basicsocket_setsockopt(mrb_state *mrb, mrb_value self)
|
|
454
455
|
level = mrb_fixnum(so);
|
455
456
|
if (mrb_string_p(optval)) {
|
456
457
|
/* that's good */
|
457
|
-
} else if (
|
458
|
+
} else if (mrb_true_p(optval) || mrb_false_p(optval)) {
|
458
459
|
mrb_int i = mrb_test(optval) ? 1 : 0;
|
459
460
|
optval = mrb_str_new(mrb, (char*)&i, sizeof(i));
|
460
461
|
} else if (mrb_fixnum_p(optval)) {
|
@@ -475,7 +476,7 @@ mrb_basicsocket_setsockopt(mrb_state *mrb, mrb_value self)
|
|
475
476
|
optname = mrb_fixnum(mrb_funcall(mrb, so, "optname", 0));
|
476
477
|
optval = mrb_funcall(mrb, so, "data", 0);
|
477
478
|
} else {
|
478
|
-
mrb_raisef(mrb, E_ARGUMENT_ERROR, "wrong number of arguments (%
|
479
|
+
mrb_raisef(mrb, E_ARGUMENT_ERROR, "wrong number of arguments (%i for 3)", argc);
|
479
480
|
}
|
480
481
|
|
481
482
|
s = socket_fd(mrb, self);
|
@@ -701,7 +702,7 @@ mrb_socket_sockaddr_un(mrb_state *mrb, mrb_value klass)
|
|
701
702
|
|
702
703
|
mrb_get_args(mrb, "S", &path);
|
703
704
|
if ((size_t)RSTRING_LEN(path) > sizeof(sunp->sun_path) - 1) {
|
704
|
-
mrb_raisef(mrb, E_ARGUMENT_ERROR, "too long unix socket path (max: %
|
705
|
+
mrb_raisef(mrb, E_ARGUMENT_ERROR, "too long unix socket path (max: %d bytes)", (int)sizeof(sunp->sun_path) - 1);
|
705
706
|
}
|
706
707
|
s = mrb_str_buf_new(mrb, sizeof(struct sockaddr_un));
|
707
708
|
sunp = (struct sockaddr_un *)RSTRING_PTR(s);
|
@@ -18,8 +18,8 @@ mrb_mruby_sprintf_gem_init(mrb_state* mrb)
|
|
18
18
|
}
|
19
19
|
krn = mrb->kernel_module;
|
20
20
|
|
21
|
-
mrb_define_method(mrb, krn, "sprintf", mrb_f_sprintf,
|
22
|
-
mrb_define_method(mrb, krn, "format", mrb_f_sprintf,
|
21
|
+
mrb_define_method(mrb, krn, "sprintf", mrb_f_sprintf, MRB_ARGS_REQ(1)|MRB_ARGS_REST());
|
22
|
+
mrb_define_method(mrb, krn, "format", mrb_f_sprintf, MRB_ARGS_REQ(1)|MRB_ARGS_REST());
|
23
23
|
}
|
24
24
|
|
25
25
|
void
|
@@ -81,7 +81,7 @@ mrb_fix2binstr(mrb_state *mrb, mrb_value x, int base)
|
|
81
81
|
char d;
|
82
82
|
|
83
83
|
if (base != 2) {
|
84
|
-
mrb_raisef(mrb, E_ARGUMENT_ERROR, "invalid radix %
|
84
|
+
mrb_raisef(mrb, E_ARGUMENT_ERROR, "invalid radix %d", base);
|
85
85
|
}
|
86
86
|
if (val == 0) {
|
87
87
|
return mrb_str_new_lit(mrb, "0");
|
@@ -144,10 +144,10 @@ check_next_arg(mrb_state *mrb, int posarg, int nextarg)
|
|
144
144
|
{
|
145
145
|
switch (posarg) {
|
146
146
|
case -1:
|
147
|
-
mrb_raisef(mrb, E_ARGUMENT_ERROR, "unnumbered(%
|
147
|
+
mrb_raisef(mrb, E_ARGUMENT_ERROR, "unnumbered(%d) mixed with numbered", nextarg);
|
148
148
|
break;
|
149
149
|
case -2:
|
150
|
-
mrb_raisef(mrb, E_ARGUMENT_ERROR, "unnumbered(%
|
150
|
+
mrb_raisef(mrb, E_ARGUMENT_ERROR, "unnumbered(%d) mixed with named", nextarg);
|
151
151
|
break;
|
152
152
|
default:
|
153
153
|
break;
|
@@ -155,29 +155,29 @@ check_next_arg(mrb_state *mrb, int posarg, int nextarg)
|
|
155
155
|
}
|
156
156
|
|
157
157
|
static void
|
158
|
-
check_pos_arg(mrb_state *mrb,
|
158
|
+
check_pos_arg(mrb_state *mrb, int posarg, mrb_int n)
|
159
159
|
{
|
160
160
|
if (posarg > 0) {
|
161
|
-
mrb_raisef(mrb, E_ARGUMENT_ERROR, "numbered(%
|
162
|
-
|
161
|
+
mrb_raisef(mrb, E_ARGUMENT_ERROR, "numbered(%i) after unnumbered(%d)",
|
162
|
+
n, posarg);
|
163
163
|
}
|
164
164
|
if (posarg == -2) {
|
165
|
-
mrb_raisef(mrb, E_ARGUMENT_ERROR, "numbered(%
|
165
|
+
mrb_raisef(mrb, E_ARGUMENT_ERROR, "numbered(%i) after named", n);
|
166
166
|
}
|
167
167
|
if (n < 1) {
|
168
|
-
mrb_raisef(mrb, E_ARGUMENT_ERROR, "invalid index - %
|
168
|
+
mrb_raisef(mrb, E_ARGUMENT_ERROR, "invalid index - %i$", n);
|
169
169
|
}
|
170
170
|
}
|
171
171
|
|
172
172
|
static void
|
173
|
-
check_name_arg(mrb_state *mrb, int posarg, const char *name,
|
173
|
+
check_name_arg(mrb_state *mrb, int posarg, const char *name, size_t len)
|
174
174
|
{
|
175
175
|
if (posarg > 0) {
|
176
|
-
mrb_raisef(mrb, E_ARGUMENT_ERROR, "named%
|
177
|
-
|
176
|
+
mrb_raisef(mrb, E_ARGUMENT_ERROR, "named%l after unnumbered(%d)",
|
177
|
+
name, len, posarg);
|
178
178
|
}
|
179
179
|
if (posarg == -1) {
|
180
|
-
mrb_raisef(mrb, E_ARGUMENT_ERROR, "named%
|
180
|
+
mrb_raisef(mrb, E_ARGUMENT_ERROR, "named%l after numbered", name, len);
|
181
181
|
}
|
182
182
|
}
|
183
183
|
|
@@ -580,7 +580,7 @@ mrb_str_format(mrb_state *mrb, mrb_int argc, const mrb_value *argv, mrb_value fm
|
|
580
580
|
retry:
|
581
581
|
switch (*p) {
|
582
582
|
default:
|
583
|
-
mrb_raisef(mrb, E_ARGUMENT_ERROR, "malformed format string -
|
583
|
+
mrb_raisef(mrb, E_ARGUMENT_ERROR, "malformed format string - %%%c", *p);
|
584
584
|
break;
|
585
585
|
|
586
586
|
case ' ':
|
@@ -619,7 +619,7 @@ retry:
|
|
619
619
|
GETNUM(n, width);
|
620
620
|
if (*p == '$') {
|
621
621
|
if (!mrb_undef_p(nextvalue)) {
|
622
|
-
mrb_raisef(mrb, E_ARGUMENT_ERROR, "value given twice - %
|
622
|
+
mrb_raisef(mrb, E_ARGUMENT_ERROR, "value given twice - %i$", n);
|
623
623
|
}
|
624
624
|
nextvalue = GETPOSARG(n);
|
625
625
|
p++;
|
@@ -639,14 +639,14 @@ retry:
|
|
639
639
|
for (; p < end && *p != term; )
|
640
640
|
p++;
|
641
641
|
if (id) {
|
642
|
-
mrb_raisef(mrb, E_ARGUMENT_ERROR, "name%
|
643
|
-
|
642
|
+
mrb_raisef(mrb, E_ARGUMENT_ERROR, "name%l after <%n>",
|
643
|
+
start, p - start + 1, id);
|
644
644
|
}
|
645
645
|
symname = mrb_str_new(mrb, start + 1, p - start - 1);
|
646
646
|
id = mrb_intern_str(mrb, symname);
|
647
|
-
nextvalue = GETNAMEARG(mrb_symbol_value(id), start,
|
647
|
+
nextvalue = GETNAMEARG(mrb_symbol_value(id), start, p - start + 1);
|
648
648
|
if (mrb_undef_p(nextvalue)) {
|
649
|
-
mrb_raisef(mrb, E_KEY_ERROR, "key%
|
649
|
+
mrb_raisef(mrb, E_KEY_ERROR, "key%l not found", start, p - start + 1);
|
650
650
|
}
|
651
651
|
if (term == '}') goto format_s;
|
652
652
|
p++;
|
@@ -845,6 +845,7 @@ retry:
|
|
845
845
|
case 'd':
|
846
846
|
case 'i':
|
847
847
|
sign = 1;
|
848
|
+
/* fall through */
|
848
849
|
default:
|
849
850
|
base = 10; break;
|
850
851
|
}
|
@@ -1003,10 +1004,8 @@ retry:
|
|
1003
1004
|
case 'A': {
|
1004
1005
|
mrb_value val = GETARG();
|
1005
1006
|
double fval;
|
1006
|
-
mrb_int i;
|
1007
1007
|
mrb_int need = 6;
|
1008
1008
|
char fbuf[32];
|
1009
|
-
int frexp_result;
|
1010
1009
|
|
1011
1010
|
fval = mrb_float(mrb_Float(mrb, val));
|
1012
1011
|
if (!isfinite(fval)) {
|
@@ -1050,9 +1049,8 @@ retry:
|
|
1050
1049
|
fmt_setup(fbuf, sizeof(fbuf), *p, flags, width, prec);
|
1051
1050
|
need = 0;
|
1052
1051
|
if (*p != 'e' && *p != 'E') {
|
1053
|
-
i
|
1054
|
-
frexp(fval, &
|
1055
|
-
i = (mrb_int)frexp_result;
|
1052
|
+
int i;
|
1053
|
+
frexp(fval, &i);
|
1056
1054
|
if (i > 0)
|
1057
1055
|
need = BIT_DIGITS(i);
|
1058
1056
|
}
|
@@ -1089,7 +1087,7 @@ retry:
|
|
1089
1087
|
if (posarg >= 0 && nextarg < argc) {
|
1090
1088
|
const char *mesg = "too many arguments for format string";
|
1091
1089
|
if (mrb_test(ruby_debug)) mrb_raise(mrb, E_ARGUMENT_ERROR, mesg);
|
1092
|
-
if (mrb_test(ruby_verbose)) mrb_warn(mrb, "%
|
1090
|
+
if (mrb_test(ruby_verbose)) mrb_warn(mrb, "%s", mesg);
|
1093
1091
|
}
|
1094
1092
|
#endif
|
1095
1093
|
mrb_str_resize(mrb, result, blen);
|
@@ -310,11 +310,15 @@ def chars(&block)
|
|
310
310
|
end
|
311
311
|
end
|
312
312
|
|
313
|
+
##
|
314
|
+
# Call the given block for each character of
|
315
|
+
# +self+.
|
313
316
|
def each_char(&block)
|
314
317
|
return to_enum :each_char unless block
|
315
|
-
|
316
|
-
|
317
|
-
block.call(
|
318
|
+
pos = 0
|
319
|
+
while pos < self.size
|
320
|
+
block.call(self[pos])
|
321
|
+
pos += 1
|
318
322
|
end
|
319
323
|
self
|
320
324
|
end
|
@@ -410,7 +414,7 @@ def upto(max, exclusive=false, &block)
|
|
410
414
|
e = max.ord
|
411
415
|
while c <= e
|
412
416
|
break if exclusive and c == e
|
413
|
-
yield c.chr
|
417
|
+
yield c.chr(__ENCODING__)
|
414
418
|
c += 1
|
415
419
|
end
|
416
420
|
return self
|
@@ -5,82 +5,90 @@
|
|
5
5
|
#include <mruby/string.h>
|
6
6
|
#include <mruby/range.h>
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
mrb_int pos;
|
12
|
-
mrb_get_args(mrb, "i", &pos);
|
8
|
+
#define ENC_ASCII_8BIT "ASCII-8BIT"
|
9
|
+
#define ENC_BINARY "BINARY"
|
10
|
+
#define ENC_UTF8 "UTF-8"
|
13
11
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
12
|
+
#define ENC_COMP_P(enc, enc_lit) \
|
13
|
+
str_casecmp_p(RSTRING_PTR(enc), RSTRING_LEN(enc), enc_lit, sizeof(enc_lit"")-1)
|
14
|
+
|
15
|
+
#ifdef MRB_WITHOUT_FLOAT
|
16
|
+
# define mrb_float_p(o) FALSE
|
17
|
+
#endif
|
18
18
|
|
19
|
-
|
19
|
+
static mrb_bool
|
20
|
+
str_casecmp_p(const char *s1, mrb_int len1, const char *s2, mrb_int len2)
|
21
|
+
{
|
22
|
+
const char *e1, *e2;
|
23
|
+
|
24
|
+
if (len1 != len2) return FALSE;
|
25
|
+
e1 = s1 + len1;
|
26
|
+
e2 = s2 + len2;
|
27
|
+
while (s1 < e1 && s2 < e2) {
|
28
|
+
if (*s1 != *s2 && TOUPPER(*s1) != TOUPPER(*s2)) return FALSE;
|
29
|
+
++s1;
|
30
|
+
++s2;
|
31
|
+
}
|
32
|
+
return TRUE;
|
20
33
|
}
|
21
34
|
|
22
35
|
static mrb_value
|
23
|
-
|
36
|
+
int_chr_binary(mrb_state *mrb, mrb_value num)
|
24
37
|
{
|
25
|
-
mrb_int
|
26
|
-
|
27
|
-
|
28
|
-
mrb_get_args(mrb, "ii", &pos, &byte);
|
29
|
-
|
30
|
-
len = RSTRING_LEN(str);
|
31
|
-
if (pos < -len || len <= pos)
|
32
|
-
mrb_raisef(mrb, E_INDEX_ERROR, "index %S is out of array", mrb_fixnum_value(pos));
|
33
|
-
if (pos < 0)
|
34
|
-
pos += len;
|
38
|
+
mrb_int cp = mrb_int(mrb, num);
|
39
|
+
char c;
|
40
|
+
mrb_value str;
|
35
41
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
42
|
+
if (cp < 0 || 0xff < cp) {
|
43
|
+
mrb_raisef(mrb, E_RANGE_ERROR, "%v out of char range", num);
|
44
|
+
}
|
45
|
+
c = (char)cp;
|
46
|
+
str = mrb_str_new(mrb, &c, 1);
|
47
|
+
RSTR_SET_ASCII_FLAG(mrb_str_ptr(str));
|
48
|
+
return str;
|
40
49
|
}
|
41
50
|
|
51
|
+
#ifdef MRB_UTF8_STRING
|
42
52
|
static mrb_value
|
43
|
-
|
53
|
+
int_chr_utf8(mrb_state *mrb, mrb_value num)
|
44
54
|
{
|
45
|
-
|
55
|
+
mrb_int cp = mrb_int(mrb, num);
|
56
|
+
char utf8[4];
|
46
57
|
mrb_int len;
|
58
|
+
mrb_value str;
|
59
|
+
uint32_t ascii_flag = 0;
|
47
60
|
|
48
|
-
if (
|
49
|
-
|
50
|
-
mrb_get_args(mrb, "ii", &pos, &len);
|
51
|
-
return mrb_str_substr(mrb, str, pos, len);
|
61
|
+
if (cp < 0 || 0x10FFFF < cp) {
|
62
|
+
mrb_raisef(mrb, E_RANGE_ERROR, "%v out of char range", num);
|
52
63
|
}
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
mrb_int beg;
|
58
|
-
|
59
|
-
len = RSTRING_LEN(str);
|
60
|
-
switch (mrb_range_beg_len(mrb, a1, &beg, &len, len, TRUE)) {
|
61
|
-
case 0: /* not range */
|
62
|
-
break;
|
63
|
-
case 1: /* range */
|
64
|
-
return mrb_str_substr(mrb, str, beg, len);
|
65
|
-
case 2: /* out of range */
|
66
|
-
mrb_raisef(mrb, E_RANGE_ERROR, "%S out of range", a1);
|
67
|
-
break;
|
68
|
-
}
|
69
|
-
return mrb_nil_value();
|
70
|
-
}
|
71
|
-
#ifndef MRB_WITHOUT_FLOAT
|
72
|
-
case MRB_TT_FLOAT:
|
73
|
-
a1 = mrb_fixnum_value((mrb_int)mrb_float(a1));
|
74
|
-
/* fall through */
|
75
|
-
#endif
|
76
|
-
case MRB_TT_FIXNUM:
|
77
|
-
return mrb_str_substr(mrb, str, mrb_fixnum(a1), 1);
|
78
|
-
default:
|
79
|
-
mrb_raise(mrb, E_TYPE_ERROR, "wrong type of argument");
|
64
|
+
if (cp < 0x80) {
|
65
|
+
utf8[0] = (char)cp;
|
66
|
+
len = 1;
|
67
|
+
ascii_flag = MRB_STR_ASCII;
|
80
68
|
}
|
81
|
-
|
82
|
-
|
69
|
+
else if (cp < 0x800) {
|
70
|
+
utf8[0] = (char)(0xC0 | (cp >> 6));
|
71
|
+
utf8[1] = (char)(0x80 | (cp & 0x3F));
|
72
|
+
len = 2;
|
73
|
+
}
|
74
|
+
else if (cp < 0x10000) {
|
75
|
+
utf8[0] = (char)(0xE0 | (cp >> 12));
|
76
|
+
utf8[1] = (char)(0x80 | ((cp >> 6) & 0x3F));
|
77
|
+
utf8[2] = (char)(0x80 | ( cp & 0x3F));
|
78
|
+
len = 3;
|
79
|
+
}
|
80
|
+
else {
|
81
|
+
utf8[0] = (char)(0xF0 | (cp >> 18));
|
82
|
+
utf8[1] = (char)(0x80 | ((cp >> 12) & 0x3F));
|
83
|
+
utf8[2] = (char)(0x80 | ((cp >> 6) & 0x3F));
|
84
|
+
utf8[3] = (char)(0x80 | ( cp & 0x3F));
|
85
|
+
len = 4;
|
86
|
+
}
|
87
|
+
str = mrb_str_new(mrb, utf8, len);
|
88
|
+
mrb_str_ptr(str)->flags |= ascii_flag;
|
89
|
+
return str;
|
83
90
|
}
|
91
|
+
#endif
|
84
92
|
|
85
93
|
/*
|
86
94
|
* call-seq:
|
@@ -137,8 +145,6 @@ mrb_str_swapcase(mrb_state *mrb, mrb_value self)
|
|
137
145
|
return str;
|
138
146
|
}
|
139
147
|
|
140
|
-
static mrb_value mrb_fixnum_chr(mrb_state *mrb, mrb_value num);
|
141
|
-
|
142
148
|
/*
|
143
149
|
* call-seq:
|
144
150
|
* str << integer -> str
|
@@ -148,7 +154,8 @@ static mrb_value mrb_fixnum_chr(mrb_state *mrb, mrb_value num);
|
|
148
154
|
*
|
149
155
|
* Append---Concatenates the given object to <i>str</i>. If the object is a
|
150
156
|
* <code>Integer</code>, it is considered as a codepoint, and is converted
|
151
|
-
* to a character before concatenation
|
157
|
+
* to a character before concatenation
|
158
|
+
* (equivalent to <code>str.concat(integer.chr(__ENCODING__))</code>).
|
152
159
|
*
|
153
160
|
* a = "hello "
|
154
161
|
* a << "world" #=> "hello world"
|
@@ -160,11 +167,15 @@ mrb_str_concat_m(mrb_state *mrb, mrb_value self)
|
|
160
167
|
mrb_value str;
|
161
168
|
|
162
169
|
mrb_get_args(mrb, "o", &str);
|
163
|
-
if (mrb_fixnum_p(str))
|
164
|
-
|
170
|
+
if (mrb_fixnum_p(str) || mrb_float_p(str))
|
171
|
+
#ifdef MRB_UTF8_STRING
|
172
|
+
str = int_chr_utf8(mrb, str);
|
173
|
+
#else
|
174
|
+
str = int_chr_binary(mrb, str);
|
175
|
+
#endif
|
165
176
|
else
|
166
|
-
|
167
|
-
|
177
|
+
mrb_ensure_string_type(mrb, str);
|
178
|
+
mrb_str_cat_str(mrb, self, str);
|
168
179
|
return self;
|
169
180
|
}
|
170
181
|
|
@@ -507,8 +518,7 @@ str_tr(mrb_state *mrb, mrb_value str, mrb_value p1, mrb_value p2, mrb_bool squee
|
|
507
518
|
continue;
|
508
519
|
}
|
509
520
|
if (c > 0x80) {
|
510
|
-
mrb_raisef(mrb, E_ARGUMENT_ERROR, "character (%
|
511
|
-
mrb_fixnum_value((mrb_int)c));
|
521
|
+
mrb_raisef(mrb, E_ARGUMENT_ERROR, "character (%i) out of range", c);
|
512
522
|
}
|
513
523
|
lastch = c;
|
514
524
|
s[i] = (char)c;
|
@@ -812,7 +822,7 @@ mrb_str_count(mrb_state *mrb, mrb_value str)
|
|
812
822
|
tr_parse_pattern(mrb, &pat, v_pat, TRUE);
|
813
823
|
tr_compile_pattern(&pat, v_pat, bitmap);
|
814
824
|
tr_free_pattern(mrb, &pat);
|
815
|
-
|
825
|
+
|
816
826
|
s = RSTRING_PTR(str);
|
817
827
|
len = RSTRING_LEN(str);
|
818
828
|
for (i = 0; i < len; i++) {
|
@@ -848,49 +858,42 @@ mrb_str_chr(mrb_state *mrb, mrb_value self)
|
|
848
858
|
return mrb_str_substr(mrb, self, 0, 1);
|
849
859
|
}
|
850
860
|
|
861
|
+
/*
|
862
|
+
* call-seq:
|
863
|
+
* int.chr([encoding]) -> string
|
864
|
+
*
|
865
|
+
* Returns a string containing the character represented by the +int+'s value
|
866
|
+
* according to +encoding+. +"ASCII-8BIT"+ (+"BINARY"+) and +"UTF-8"+ (only
|
867
|
+
* with +MRB_UTF8_STRING+) can be specified as +encoding+ (default is
|
868
|
+
* +"ASCII-8BIT"+).
|
869
|
+
*
|
870
|
+
* 65.chr #=> "A"
|
871
|
+
* 230.chr #=> "\xE6"
|
872
|
+
* 230.chr("ASCII-8BIT") #=> "\xE6"
|
873
|
+
* 230.chr("UTF-8") #=> "\u00E6"
|
874
|
+
*/
|
851
875
|
static mrb_value
|
852
|
-
|
876
|
+
mrb_int_chr(mrb_state *mrb, mrb_value num)
|
853
877
|
{
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
|
861
|
-
|
862
|
-
if (cp < 0x80) {
|
863
|
-
utf8[0] = (char)cp;
|
864
|
-
len = 1;
|
878
|
+
mrb_value enc;
|
879
|
+
mrb_bool enc_given;
|
880
|
+
|
881
|
+
mrb_get_args(mrb, "|S?", &enc, &enc_given);
|
882
|
+
if (!enc_given ||
|
883
|
+
ENC_COMP_P(enc, ENC_ASCII_8BIT) ||
|
884
|
+
ENC_COMP_P(enc, ENC_BINARY)) {
|
885
|
+
return int_chr_binary(mrb, num);
|
865
886
|
}
|
866
|
-
|
867
|
-
|
868
|
-
|
869
|
-
len = 2;
|
870
|
-
}
|
871
|
-
else if (cp < 0x10000) {
|
872
|
-
utf8[0] = (char)(0xE0 | (cp >> 12));
|
873
|
-
utf8[1] = (char)(0x80 | ((cp >> 6) & 0x3F));
|
874
|
-
utf8[2] = (char)(0x80 | ( cp & 0x3F));
|
875
|
-
len = 3;
|
887
|
+
#ifdef MRB_UTF8_STRING
|
888
|
+
else if (ENC_COMP_P(enc, ENC_UTF8)) {
|
889
|
+
return int_chr_utf8(mrb, num);
|
876
890
|
}
|
891
|
+
#endif
|
877
892
|
else {
|
878
|
-
|
879
|
-
utf8[1] = (char)(0x80 | ((cp >> 12) & 0x3F));
|
880
|
-
utf8[2] = (char)(0x80 | ((cp >> 6) & 0x3F));
|
881
|
-
utf8[3] = (char)(0x80 | ( cp & 0x3F));
|
882
|
-
len = 4;
|
883
|
-
}
|
884
|
-
return mrb_str_new(mrb, utf8, len);
|
885
|
-
#else
|
886
|
-
char c;
|
887
|
-
|
888
|
-
if (cp < 0 || 0xff < cp) {
|
889
|
-
mrb_raisef(mrb, E_RANGE_ERROR, "%S out of char range", num);
|
893
|
+
mrb_raisef(mrb, E_ARGUMENT_ERROR, "unknown encoding name - %v", enc);
|
890
894
|
}
|
891
|
-
|
892
|
-
return
|
893
|
-
#endif
|
895
|
+
/* not reached */
|
896
|
+
return mrb_nil_value();
|
894
897
|
}
|
895
898
|
|
896
899
|
/*
|
@@ -1078,7 +1081,7 @@ mrb_str_del_prefix_bang(mrb_state *mrb, mrb_value self)
|
|
1078
1081
|
if (plen > slen) return mrb_nil_value();
|
1079
1082
|
s = RSTR_PTR(str);
|
1080
1083
|
if (memcmp(s, ptr, plen) != 0) return mrb_nil_value();
|
1081
|
-
if (!
|
1084
|
+
if (!mrb_frozen_p(str) && (RSTR_SHARED_P(str) || RSTR_FSHARED_P(str))) {
|
1082
1085
|
str->as.heap.ptr += plen;
|
1083
1086
|
}
|
1084
1087
|
else {
|
@@ -1135,7 +1138,7 @@ mrb_str_del_suffix_bang(mrb_state *mrb, mrb_value self)
|
|
1135
1138
|
if (plen > slen) return mrb_nil_value();
|
1136
1139
|
s = RSTR_PTR(str);
|
1137
1140
|
if (memcmp(s+slen-plen, ptr, plen) != 0) return mrb_nil_value();
|
1138
|
-
if (!
|
1141
|
+
if (!mrb_frozen_p(str) && (RSTR_SHARED_P(str) || RSTR_FSHARED_P(str))) {
|
1139
1142
|
/* no need to modify string */
|
1140
1143
|
}
|
1141
1144
|
else {
|
@@ -1178,8 +1181,6 @@ mrb_str_lines(mrb_state *mrb, mrb_value self)
|
|
1178
1181
|
char *p = b, *t;
|
1179
1182
|
char *e = b + RSTRING_LEN(self);
|
1180
1183
|
|
1181
|
-
mrb_get_args(mrb, "");
|
1182
|
-
|
1183
1184
|
result = mrb_ary_new(mrb);
|
1184
1185
|
ai = mrb_gc_arena_save(mrb);
|
1185
1186
|
while (p < e) {
|
@@ -1199,9 +1200,6 @@ mrb_mruby_string_ext_gem_init(mrb_state* mrb)
|
|
1199
1200
|
struct RClass * s = mrb->string_class;
|
1200
1201
|
|
1201
1202
|
mrb_define_method(mrb, s, "dump", mrb_str_dump, MRB_ARGS_NONE());
|
1202
|
-
mrb_define_method(mrb, s, "getbyte", mrb_str_getbyte, MRB_ARGS_REQ(1));
|
1203
|
-
mrb_define_method(mrb, s, "setbyte", mrb_str_setbyte, MRB_ARGS_REQ(2));
|
1204
|
-
mrb_define_method(mrb, s, "byteslice", mrb_str_byteslice, MRB_ARGS_REQ(1)|MRB_ARGS_OPT(1));
|
1205
1203
|
mrb_define_method(mrb, s, "swapcase!", mrb_str_swapcase_bang, MRB_ARGS_NONE());
|
1206
1204
|
mrb_define_method(mrb, s, "swapcase", mrb_str_swapcase, MRB_ARGS_NONE());
|
1207
1205
|
mrb_define_method(mrb, s, "concat", mrb_str_concat_m, MRB_ARGS_REQ(1));
|
@@ -1222,8 +1220,8 @@ mrb_mruby_string_ext_gem_init(mrb_state* mrb)
|
|
1222
1220
|
mrb_define_method(mrb, s, "chr", mrb_str_chr, MRB_ARGS_NONE());
|
1223
1221
|
mrb_define_method(mrb, s, "succ", mrb_str_succ, MRB_ARGS_NONE());
|
1224
1222
|
mrb_define_method(mrb, s, "succ!", mrb_str_succ_bang, MRB_ARGS_NONE());
|
1225
|
-
|
1226
|
-
|
1223
|
+
mrb_define_method(mrb, s, "next", mrb_str_succ, MRB_ARGS_NONE());
|
1224
|
+
mrb_define_method(mrb, s, "next!", mrb_str_succ_bang, MRB_ARGS_NONE());
|
1227
1225
|
mrb_define_method(mrb, s, "ord", mrb_str_ord, MRB_ARGS_NONE());
|
1228
1226
|
mrb_define_method(mrb, s, "delete_prefix!", mrb_str_del_prefix_bang, MRB_ARGS_REQ(1));
|
1229
1227
|
mrb_define_method(mrb, s, "delete_prefix", mrb_str_del_prefix, MRB_ARGS_REQ(1));
|
@@ -1231,7 +1229,8 @@ mrb_mruby_string_ext_gem_init(mrb_state* mrb)
|
|
1231
1229
|
mrb_define_method(mrb, s, "delete_suffix", mrb_str_del_suffix, MRB_ARGS_REQ(1));
|
1232
1230
|
|
1233
1231
|
mrb_define_method(mrb, s, "__lines", mrb_str_lines, MRB_ARGS_NONE());
|
1234
|
-
|
1232
|
+
|
1233
|
+
mrb_define_method(mrb, mrb_module_get(mrb, "Integral"), "chr", mrb_int_chr, MRB_ARGS_OPT(1));
|
1235
1234
|
}
|
1236
1235
|
|
1237
1236
|
void
|