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,6 +20,22 @@ typedef struct symbol_name {
|
|
20
20
|
const char *name;
|
21
21
|
} symbol_name;
|
22
22
|
|
23
|
+
#define SYMBOL_INLINE_BIT_POS 1
|
24
|
+
#define SYMBOL_INLINE_LOWER_BIT_POS 2
|
25
|
+
#define SYMBOL_INLINE (1 << (SYMBOL_INLINE_BIT_POS - 1))
|
26
|
+
#define SYMBOL_INLINE_LOWER (1 << (SYMBOL_INLINE_LOWER_BIT_POS - 1))
|
27
|
+
#define SYMBOL_NORMAL_SHIFT SYMBOL_INLINE_BIT_POS
|
28
|
+
#define SYMBOL_INLINE_SHIFT SYMBOL_INLINE_LOWER_BIT_POS
|
29
|
+
#ifdef MRB_ENABLE_ALL_SYMBOLS
|
30
|
+
# define SYMBOL_INLINE_P(sym) FALSE
|
31
|
+
# define SYMBOL_INLINE_LOWER_P(sym) FALSE
|
32
|
+
# define sym_inline_pack(name, len) 0
|
33
|
+
# define sym_inline_unpack(sym, buf, lenp) NULL
|
34
|
+
#else
|
35
|
+
# define SYMBOL_INLINE_P(sym) ((sym) & SYMBOL_INLINE)
|
36
|
+
# define SYMBOL_INLINE_LOWER_P(sym) ((sym) & SYMBOL_INLINE_LOWER)
|
37
|
+
#endif
|
38
|
+
|
23
39
|
static void
|
24
40
|
sym_validate_len(mrb_state *mrb, size_t len)
|
25
41
|
{
|
@@ -34,14 +50,14 @@ static const char pack_table[] = "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRS
|
|
34
50
|
static mrb_sym
|
35
51
|
sym_inline_pack(const char *name, uint16_t len)
|
36
52
|
{
|
37
|
-
const int lower_length_max = (
|
38
|
-
const int mix_length_max = (
|
53
|
+
const int lower_length_max = (MRB_SYMBOL_BIT - 2) / 5;
|
54
|
+
const int mix_length_max = (MRB_SYMBOL_BIT - 2) / 6;
|
39
55
|
|
40
56
|
char c;
|
41
57
|
const char *p;
|
42
58
|
int i;
|
43
59
|
mrb_sym sym = 0;
|
44
|
-
|
60
|
+
mrb_bool lower = TRUE;
|
45
61
|
|
46
62
|
if (len > lower_length_max) return 0; /* too long */
|
47
63
|
for (i=0; i<len; i++) {
|
@@ -52,9 +68,9 @@ sym_inline_pack(const char *name, uint16_t len)
|
|
52
68
|
p = strchr(pack_table, (int)c);
|
53
69
|
if (p == 0) return 0; /* non alnum char */
|
54
70
|
bits = (uint32_t)(p - pack_table)+1;
|
55
|
-
if (bits > 27) lower =
|
71
|
+
if (bits > 27) lower = FALSE;
|
56
72
|
if (i >= mix_length_max) break;
|
57
|
-
sym |= bits<<(i*6+
|
73
|
+
sym |= bits<<(i*6+SYMBOL_INLINE_SHIFT);
|
58
74
|
}
|
59
75
|
if (lower) {
|
60
76
|
sym = 0;
|
@@ -64,24 +80,24 @@ sym_inline_pack(const char *name, uint16_t len)
|
|
64
80
|
c = name[i];
|
65
81
|
p = strchr(pack_table, (int)c);
|
66
82
|
bits = (uint32_t)(p - pack_table)+1;
|
67
|
-
sym |= bits<<(i*5+
|
83
|
+
sym |= bits<<(i*5+SYMBOL_INLINE_SHIFT);
|
68
84
|
}
|
69
|
-
return sym |
|
85
|
+
return sym | SYMBOL_INLINE | SYMBOL_INLINE_LOWER;
|
70
86
|
}
|
71
87
|
if (len > mix_length_max) return 0;
|
72
|
-
return sym |
|
88
|
+
return sym | SYMBOL_INLINE;
|
73
89
|
}
|
74
90
|
|
75
91
|
static const char*
|
76
92
|
sym_inline_unpack(mrb_sym sym, char *buf, mrb_int *lenp)
|
77
93
|
{
|
78
|
-
int bit_per_char = sym
|
94
|
+
int bit_per_char = SYMBOL_INLINE_LOWER_P(sym) ? 5 : 6;
|
79
95
|
int i;
|
80
96
|
|
81
|
-
mrb_assert(sym
|
97
|
+
mrb_assert(SYMBOL_INLINE_P(sym));
|
82
98
|
|
83
99
|
for (i=0; i<30/bit_per_char; i++) {
|
84
|
-
uint32_t bits = sym>>(i*bit_per_char+
|
100
|
+
uint32_t bits = sym>>(i*bit_per_char+SYMBOL_INLINE_SHIFT) & ((1<<bit_per_char)-1);
|
85
101
|
if (bits == 0) break;
|
86
102
|
buf[i] = pack_table[bits-1];;
|
87
103
|
}
|
@@ -91,7 +107,7 @@ sym_inline_unpack(mrb_sym sym, char *buf, mrb_int *lenp)
|
|
91
107
|
}
|
92
108
|
#endif
|
93
109
|
|
94
|
-
uint8_t
|
110
|
+
static uint8_t
|
95
111
|
symhash(const char *key, size_t len)
|
96
112
|
{
|
97
113
|
uint32_t hash, i;
|
@@ -108,30 +124,32 @@ symhash(const char *key, size_t len)
|
|
108
124
|
}
|
109
125
|
|
110
126
|
static mrb_sym
|
111
|
-
find_symbol(mrb_state *mrb, const char *name, uint16_t len, uint8_t
|
127
|
+
find_symbol(mrb_state *mrb, const char *name, uint16_t len, uint8_t *hashp)
|
112
128
|
{
|
113
129
|
mrb_sym i;
|
114
130
|
symbol_name *sname;
|
131
|
+
uint8_t hash;
|
115
132
|
|
116
|
-
#ifndef MRB_ENABLE_ALL_SYMBOLS
|
117
133
|
/* inline symbol */
|
118
134
|
i = sym_inline_pack(name, len);
|
119
135
|
if (i > 0) return i;
|
120
|
-
|
136
|
+
|
137
|
+
hash = symhash(name, len);
|
138
|
+
if (hashp) *hashp = hash;
|
121
139
|
|
122
140
|
i = mrb->symhash[hash];
|
123
141
|
if (i == 0) return 0;
|
124
142
|
do {
|
125
143
|
sname = &mrb->symtbl[i];
|
126
144
|
if (sname->len == len && memcmp(sname->name, name, len) == 0) {
|
127
|
-
return i<<
|
145
|
+
return i<<SYMBOL_NORMAL_SHIFT;
|
128
146
|
}
|
129
147
|
if (sname->prev == 0xff) {
|
130
148
|
i -= 0xff;
|
131
149
|
sname = &mrb->symtbl[i];
|
132
150
|
while (mrb->symtbl < sname) {
|
133
151
|
if (sname->len == len && memcmp(sname->name, name, len) == 0) {
|
134
|
-
return (mrb_sym)(sname - mrb->symtbl)<<
|
152
|
+
return (mrb_sym)(sname - mrb->symtbl)<<SYMBOL_NORMAL_SHIFT;
|
135
153
|
}
|
136
154
|
sname--;
|
137
155
|
}
|
@@ -150,8 +168,7 @@ sym_intern(mrb_state *mrb, const char *name, size_t len, mrb_bool lit)
|
|
150
168
|
uint8_t hash;
|
151
169
|
|
152
170
|
sym_validate_len(mrb, len);
|
153
|
-
|
154
|
-
sym = find_symbol(mrb, name, len, hash);
|
171
|
+
sym = find_symbol(mrb, name, len, &hash);
|
155
172
|
if (sym > 0) return sym;
|
156
173
|
|
157
174
|
/* registering a new symbol */
|
@@ -186,7 +203,7 @@ sym_intern(mrb_state *mrb, const char *name, size_t len, mrb_bool lit)
|
|
186
203
|
}
|
187
204
|
mrb->symhash[hash] = sym;
|
188
205
|
|
189
|
-
return sym<<
|
206
|
+
return sym<<SYMBOL_NORMAL_SHIFT;
|
190
207
|
}
|
191
208
|
|
192
209
|
MRB_API mrb_sym
|
@@ -219,7 +236,7 @@ mrb_check_intern(mrb_state *mrb, const char *name, size_t len)
|
|
219
236
|
mrb_sym sym;
|
220
237
|
|
221
238
|
sym_validate_len(mrb, len);
|
222
|
-
sym = find_symbol(mrb, name, len,
|
239
|
+
sym = find_symbol(mrb, name, len, NULL);
|
223
240
|
if (sym > 0) return mrb_symbol_value(sym);
|
224
241
|
return mrb_nil_value();
|
225
242
|
}
|
@@ -239,13 +256,9 @@ mrb_check_intern_str(mrb_state *mrb, mrb_value str)
|
|
239
256
|
static const char*
|
240
257
|
sym2name_len(mrb_state *mrb, mrb_sym sym, char *buf, mrb_int *lenp)
|
241
258
|
{
|
242
|
-
|
243
|
-
if (sym & 1) { /* inline packed symbol */
|
244
|
-
return sym_inline_unpack(sym, buf, lenp);
|
245
|
-
}
|
246
|
-
#endif
|
259
|
+
if (SYMBOL_INLINE_P(sym)) return sym_inline_unpack(sym, buf, lenp);
|
247
260
|
|
248
|
-
sym >>=
|
261
|
+
sym >>= SYMBOL_NORMAL_SHIFT;
|
249
262
|
if (sym == 0 || mrb->symidx < sym) {
|
250
263
|
if (lenp) *lenp = 0;
|
251
264
|
return NULL;
|
@@ -256,7 +269,7 @@ sym2name_len(mrb_state *mrb, mrb_sym sym, char *buf, mrb_int *lenp)
|
|
256
269
|
}
|
257
270
|
|
258
271
|
MRB_API const char*
|
259
|
-
|
272
|
+
mrb_sym_name_len(mrb_state *mrb, mrb_sym sym, mrb_int *lenp)
|
260
273
|
{
|
261
274
|
return sym2name_len(mrb, sym, mrb->symbuf, lenp);
|
262
275
|
}
|
@@ -326,7 +339,7 @@ mrb_init_symtbl(mrb_state *mrb)
|
|
326
339
|
static mrb_value
|
327
340
|
sym_to_s(mrb_state *mrb, mrb_value sym)
|
328
341
|
{
|
329
|
-
return
|
342
|
+
return mrb_sym_str(mrb, mrb_symbol(sym));
|
330
343
|
}
|
331
344
|
|
332
345
|
/* 15.2.11.3.4 */
|
@@ -481,57 +494,69 @@ sym_inspect(mrb_state *mrb, mrb_value sym)
|
|
481
494
|
mrb_sym id = mrb_symbol(sym);
|
482
495
|
char *sp;
|
483
496
|
|
484
|
-
name =
|
497
|
+
name = mrb_sym_name_len(mrb, id, &len);
|
485
498
|
str = mrb_str_new(mrb, 0, len+1);
|
486
499
|
sp = RSTRING_PTR(str);
|
487
|
-
|
500
|
+
sp[0] = ':';
|
488
501
|
memcpy(sp+1, name, len);
|
489
502
|
mrb_assert_int_fit(mrb_int, len, size_t, SIZE_MAX);
|
490
503
|
if (!symname_p(name) || strlen(name) != (size_t)len) {
|
491
|
-
str =
|
504
|
+
str = mrb_str_inspect(mrb, str);
|
492
505
|
sp = RSTRING_PTR(str);
|
493
506
|
sp[0] = ':';
|
494
507
|
sp[1] = '"';
|
495
508
|
}
|
509
|
+
#ifdef MRB_UTF8_STRING
|
510
|
+
if (SYMBOL_INLINE_P(id)) RSTR_SET_ASCII_FLAG(mrb_str_ptr(str));
|
511
|
+
#endif
|
496
512
|
return str;
|
497
513
|
}
|
498
514
|
|
499
515
|
MRB_API mrb_value
|
500
|
-
|
516
|
+
mrb_sym_str(mrb_state *mrb, mrb_sym sym)
|
501
517
|
{
|
502
518
|
mrb_int len;
|
503
|
-
const char *name =
|
519
|
+
const char *name = mrb_sym_name_len(mrb, sym, &len);
|
504
520
|
|
505
521
|
if (!name) return mrb_undef_value(); /* can't happen */
|
506
|
-
if (sym
|
507
|
-
|
522
|
+
if (SYMBOL_INLINE_P(sym)) {
|
523
|
+
mrb_value str = mrb_str_new(mrb, name, len);
|
524
|
+
RSTR_SET_ASCII_FLAG(mrb_str_ptr(str));
|
525
|
+
return str;
|
508
526
|
}
|
509
527
|
return mrb_str_new_static(mrb, name, len);
|
510
528
|
}
|
511
529
|
|
512
|
-
|
513
|
-
|
530
|
+
static const char*
|
531
|
+
sym_name(mrb_state *mrb, mrb_sym sym, mrb_bool dump)
|
514
532
|
{
|
515
533
|
mrb_int len;
|
516
|
-
const char *name =
|
534
|
+
const char *name = mrb_sym_name_len(mrb, sym, &len);
|
517
535
|
|
518
536
|
if (!name) return NULL;
|
519
|
-
if (
|
537
|
+
if (strlen(name) == (size_t)len && (!dump || symname_p(name))) {
|
520
538
|
return name;
|
521
539
|
}
|
522
540
|
else {
|
523
|
-
mrb_value str
|
524
|
-
|
525
|
-
str = mrb_str_new(mrb, name, len);
|
526
|
-
}
|
527
|
-
else {
|
528
|
-
str = mrb_str_new_static(mrb, name, len);
|
529
|
-
}
|
541
|
+
mrb_value str = SYMBOL_INLINE_P(sym) ?
|
542
|
+
mrb_str_new(mrb, name, len) : mrb_str_new_static(mrb, name, len);
|
530
543
|
str = mrb_str_dump(mrb, str);
|
531
544
|
return RSTRING_PTR(str);
|
532
545
|
}
|
533
546
|
}
|
534
547
|
|
548
|
+
MRB_API const char*
|
549
|
+
mrb_sym_name(mrb_state *mrb, mrb_sym sym)
|
550
|
+
{
|
551
|
+
return sym_name(mrb, sym, FALSE);
|
552
|
+
}
|
553
|
+
|
554
|
+
MRB_API const char*
|
555
|
+
mrb_sym_dump(mrb_state *mrb, mrb_sym sym)
|
556
|
+
{
|
557
|
+
return sym_name(mrb, sym, TRUE);
|
558
|
+
}
|
559
|
+
|
535
560
|
#define lesser(a,b) (((a)>(b))?(b):(a))
|
536
561
|
|
537
562
|
static mrb_value
|
@@ -541,7 +566,7 @@ sym_cmp(mrb_state *mrb, mrb_value s1)
|
|
541
566
|
mrb_sym sym1, sym2;
|
542
567
|
|
543
568
|
mrb_get_args(mrb, "o", &s2);
|
544
|
-
if (
|
569
|
+
if (!mrb_symbol_p(s2)) return mrb_nil_value();
|
545
570
|
sym1 = mrb_symbol(s1);
|
546
571
|
sym2 = mrb_symbol(s2);
|
547
572
|
if (sym1 == sym2) return mrb_fixnum_value(0);
|
@@ -79,19 +79,19 @@ iv_put(mrb_state *mrb, iv_tbl *t, mrb_sym sym, mrb_value val)
|
|
79
79
|
}
|
80
80
|
|
81
81
|
/* Not found */
|
82
|
-
t->size++;
|
83
82
|
if (matched_seg) {
|
84
83
|
matched_seg->key[matched_idx] = sym;
|
85
84
|
matched_seg->val[matched_idx] = val;
|
85
|
+
t->size++;
|
86
86
|
return;
|
87
87
|
}
|
88
88
|
|
89
89
|
seg = (segment*)mrb_malloc(mrb, sizeof(segment));
|
90
|
-
if (!seg) return;
|
91
90
|
seg->next = NULL;
|
92
91
|
seg->key[0] = sym;
|
93
92
|
seg->val[0] = val;
|
94
93
|
t->last_len = 1;
|
94
|
+
t->size++;
|
95
95
|
if (prev) {
|
96
96
|
prev->next = seg;
|
97
97
|
}
|
@@ -341,23 +341,24 @@ mrb_iv_get(mrb_state *mrb, mrb_value obj, mrb_sym sym)
|
|
341
341
|
|
342
342
|
static inline void assign_class_name(mrb_state *mrb, struct RObject *obj, mrb_sym sym, mrb_value v);
|
343
343
|
|
344
|
-
|
345
|
-
|
344
|
+
void
|
345
|
+
mrb_obj_iv_set_force(mrb_state *mrb, struct RObject *obj, mrb_sym sym, mrb_value v)
|
346
346
|
{
|
347
|
-
iv_tbl *t;
|
348
|
-
|
349
|
-
if (MRB_FROZEN_P(obj)) {
|
350
|
-
mrb_raisef(mrb, E_FROZEN_ERROR, "can't modify frozen %S", mrb_obj_value(obj));
|
351
|
-
}
|
352
347
|
assign_class_name(mrb, obj, sym, v);
|
353
348
|
if (!obj->iv) {
|
354
349
|
obj->iv = iv_new(mrb);
|
355
350
|
}
|
356
|
-
|
357
|
-
iv_put(mrb, t, sym, v);
|
351
|
+
iv_put(mrb, obj->iv, sym, v);
|
358
352
|
mrb_write_barrier(mrb, (struct RBasic*)obj);
|
359
353
|
}
|
360
354
|
|
355
|
+
MRB_API void
|
356
|
+
mrb_obj_iv_set(mrb_state *mrb, struct RObject *obj, mrb_sym sym, mrb_value v)
|
357
|
+
{
|
358
|
+
mrb_check_frozen(mrb, obj);
|
359
|
+
mrb_obj_iv_set_force(mrb, obj, sym, v);
|
360
|
+
}
|
361
|
+
|
361
362
|
/* Iterates over the instance variable table. */
|
362
363
|
MRB_API void
|
363
364
|
mrb_iv_foreach(mrb_state *mrb, mrb_value obj, mrb_iv_foreach_func *func, void *p)
|
@@ -377,7 +378,7 @@ assign_class_name(mrb_state *mrb, struct RObject *obj, mrb_sym sym, mrb_value v)
|
|
377
378
|
{
|
378
379
|
if (namespace_p(obj->tt) && namespace_p(mrb_type(v))) {
|
379
380
|
struct RObject *c = mrb_obj_ptr(v);
|
380
|
-
if (obj != c && ISUPPER(
|
381
|
+
if (obj != c && ISUPPER(mrb_sym_name_len(mrb, sym, NULL)[0])) {
|
381
382
|
mrb_sym id_classname = mrb_intern_lit(mrb, "__classname__");
|
382
383
|
mrb_value o = mrb_obj_iv_get(mrb, c, id_classname);
|
383
384
|
|
@@ -387,10 +388,10 @@ assign_class_name(mrb_state *mrb, struct RObject *obj, mrb_sym sym, mrb_value v)
|
|
387
388
|
|
388
389
|
if (mrb_nil_p(o)) {
|
389
390
|
if ((struct RClass *)obj == mrb->object_class) {
|
390
|
-
|
391
|
+
mrb_obj_iv_set_force(mrb, c, id_classname, mrb_symbol_value(sym));
|
391
392
|
}
|
392
393
|
else {
|
393
|
-
|
394
|
+
mrb_obj_iv_set_force(mrb, c, id_outer, mrb_obj_value(obj));
|
394
395
|
}
|
395
396
|
}
|
396
397
|
}
|
@@ -434,7 +435,7 @@ mrb_iv_name_sym_p(mrb_state *mrb, mrb_sym iv_name)
|
|
434
435
|
const char *s;
|
435
436
|
mrb_int len;
|
436
437
|
|
437
|
-
s =
|
438
|
+
s = mrb_sym_name_len(mrb, iv_name, &len);
|
438
439
|
if (len < 2) return FALSE;
|
439
440
|
if (s[0] != '@') return FALSE;
|
440
441
|
if (ISDIGIT(s[1])) return FALSE;
|
@@ -445,7 +446,7 @@ MRB_API void
|
|
445
446
|
mrb_iv_name_sym_check(mrb_state *mrb, mrb_sym iv_name)
|
446
447
|
{
|
447
448
|
if (!mrb_iv_name_sym_p(mrb, iv_name)) {
|
448
|
-
mrb_name_error(mrb, iv_name, "'%
|
449
|
+
mrb_name_error(mrb, iv_name, "'%n' is not allowed as an instance variable name", iv_name);
|
449
450
|
}
|
450
451
|
}
|
451
452
|
|
@@ -482,10 +483,10 @@ inspect_i(mrb_state *mrb, mrb_sym sym, mrb_value v, void *p)
|
|
482
483
|
else {
|
483
484
|
mrb_str_cat_lit(mrb, str, ", ");
|
484
485
|
}
|
485
|
-
s =
|
486
|
+
s = mrb_sym_name_len(mrb, sym, &len);
|
486
487
|
mrb_str_cat(mrb, str, s, len);
|
487
488
|
mrb_str_cat_lit(mrb, str, "=");
|
488
|
-
if (
|
489
|
+
if (mrb_object_p(v)) {
|
489
490
|
ins = mrb_any_to_s(mrb, v);
|
490
491
|
}
|
491
492
|
else {
|
@@ -508,7 +509,7 @@ mrb_obj_iv_inspect(mrb_state *mrb, struct RObject *obj)
|
|
508
509
|
mrb_str_cat_lit(mrb, str, "-<");
|
509
510
|
mrb_str_cat_cstr(mrb, str, cn);
|
510
511
|
mrb_str_cat_lit(mrb, str, ":");
|
511
|
-
|
512
|
+
mrb_str_cat_str(mrb, str, mrb_ptr_to_str(mrb, obj));
|
512
513
|
|
513
514
|
iv_foreach(mrb, t, inspect_i, &str);
|
514
515
|
mrb_str_cat_lit(mrb, str, ">");
|
@@ -524,6 +525,7 @@ mrb_iv_remove(mrb_state *mrb, mrb_value obj, mrb_sym sym)
|
|
524
525
|
iv_tbl *t = mrb_obj_ptr(obj)->iv;
|
525
526
|
mrb_value val;
|
526
527
|
|
528
|
+
mrb_check_frozen(mrb, mrb_obj_ptr(obj));
|
527
529
|
if (iv_del(mrb, t, sym, &val)) {
|
528
530
|
return val;
|
529
531
|
}
|
@@ -539,7 +541,7 @@ iv_i(mrb_state *mrb, mrb_sym sym, mrb_value v, void *p)
|
|
539
541
|
mrb_int len;
|
540
542
|
|
541
543
|
ary = *(mrb_value*)p;
|
542
|
-
s =
|
544
|
+
s = mrb_sym_name_len(mrb, sym, &len);
|
543
545
|
if (len > 1 && s[0] == '@' && s[1] != '@') {
|
544
546
|
mrb_ary_push(mrb, ary, mrb_symbol_value(sym));
|
545
547
|
}
|
@@ -583,7 +585,7 @@ cv_i(mrb_state *mrb, mrb_sym sym, mrb_value v, void *p)
|
|
583
585
|
mrb_int len;
|
584
586
|
|
585
587
|
ary = *(mrb_value*)p;
|
586
|
-
s =
|
588
|
+
s = mrb_sym_name_len(mrb, sym, &len);
|
587
589
|
if (len > 2 && s[0] == '@' && s[1] == '@') {
|
588
590
|
mrb_ary_push(mrb, ary, mrb_symbol_value(sym));
|
589
591
|
}
|
@@ -593,7 +595,7 @@ cv_i(mrb_state *mrb, mrb_sym sym, mrb_value v, void *p)
|
|
593
595
|
/* 15.2.2.4.19 */
|
594
596
|
/*
|
595
597
|
* call-seq:
|
596
|
-
* mod.class_variables -> array
|
598
|
+
* mod.class_variables(inherit=true) -> array
|
597
599
|
*
|
598
600
|
* Returns an array of the names of class variables in <i>mod</i>.
|
599
601
|
*
|
@@ -611,11 +613,14 @@ mrb_mod_class_variables(mrb_state *mrb, mrb_value mod)
|
|
611
613
|
{
|
612
614
|
mrb_value ary;
|
613
615
|
struct RClass *c;
|
616
|
+
mrb_bool inherit = TRUE;
|
614
617
|
|
618
|
+
mrb_get_args(mrb, "|b", &inherit);
|
615
619
|
ary = mrb_ary_new(mrb);
|
616
620
|
c = mrb_class_ptr(mod);
|
617
621
|
while (c) {
|
618
622
|
iv_foreach(mrb, c->iv, cv_i, &ary);
|
623
|
+
if (!inherit) break;
|
619
624
|
c = c->super;
|
620
625
|
}
|
621
626
|
return ary;
|
@@ -652,8 +657,7 @@ mrb_mod_cv_get(mrb_state *mrb, struct RClass *c, mrb_sym sym)
|
|
652
657
|
if (given) return v;
|
653
658
|
}
|
654
659
|
}
|
655
|
-
mrb_name_error(mrb, sym, "uninitialized class variable %
|
656
|
-
mrb_sym2str(mrb, sym), mrb_obj_value(cls));
|
660
|
+
mrb_name_error(mrb, sym, "uninitialized class variable %n in %C", sym, cls);
|
657
661
|
/* not reached */
|
658
662
|
return mrb_nil_value();
|
659
663
|
}
|
@@ -673,6 +677,7 @@ mrb_mod_cv_set(mrb_state *mrb, struct RClass *c, mrb_sym sym, mrb_value v)
|
|
673
677
|
iv_tbl *t = c->iv;
|
674
678
|
|
675
679
|
if (iv_get(mrb, t, sym, NULL)) {
|
680
|
+
mrb_check_frozen(mrb, c);
|
676
681
|
iv_put(mrb, t, sym, v);
|
677
682
|
mrb_write_barrier(mrb, (struct RBasic*)c);
|
678
683
|
return;
|
@@ -700,6 +705,7 @@ mrb_mod_cv_set(mrb_state *mrb, struct RClass *c, mrb_sym sym, mrb_value v)
|
|
700
705
|
c = cls;
|
701
706
|
}
|
702
707
|
|
708
|
+
mrb_check_frozen(mrb, c);
|
703
709
|
if (!c->iv) {
|
704
710
|
c->iv = iv_new(mrb);
|
705
711
|
}
|
@@ -737,7 +743,13 @@ mrb_vm_cv_get(mrb_state *mrb, mrb_sym sym)
|
|
737
743
|
{
|
738
744
|
struct RClass *c;
|
739
745
|
|
740
|
-
|
746
|
+
struct RProc *p = mrb->c->ci->proc;
|
747
|
+
|
748
|
+
for (;;) {
|
749
|
+
c = MRB_PROC_TARGET_CLASS(p);
|
750
|
+
if (c->tt != MRB_TT_SCLASS) break;
|
751
|
+
p = p->upper;
|
752
|
+
}
|
741
753
|
return mrb_mod_cv_get(mrb, c, sym);
|
742
754
|
}
|
743
755
|
|
@@ -745,8 +757,13 @@ void
|
|
745
757
|
mrb_vm_cv_set(mrb_state *mrb, mrb_sym sym, mrb_value v)
|
746
758
|
{
|
747
759
|
struct RClass *c;
|
760
|
+
struct RProc *p = mrb->c->ci->proc;
|
748
761
|
|
749
|
-
|
762
|
+
for (;;) {
|
763
|
+
c = MRB_PROC_TARGET_CLASS(p);
|
764
|
+
if (c->tt != MRB_TT_SCLASS) break;
|
765
|
+
p = p->upper;
|
766
|
+
}
|
750
767
|
mrb_mod_cv_set(mrb, c, sym, v);
|
751
768
|
}
|
752
769
|
|
@@ -877,9 +894,17 @@ const_i(mrb_state *mrb, mrb_sym sym, mrb_value v, void *p)
|
|
877
894
|
mrb_int len;
|
878
895
|
|
879
896
|
ary = *(mrb_value*)p;
|
880
|
-
s =
|
897
|
+
s = mrb_sym_name_len(mrb, sym, &len);
|
881
898
|
if (len >= 1 && ISUPPER(s[0])) {
|
882
|
-
|
899
|
+
mrb_int i, alen = RARRAY_LEN(ary);
|
900
|
+
|
901
|
+
for (i=0; i<alen; i++) {
|
902
|
+
if (mrb_symbol(RARRAY_PTR(ary)[i]) == sym)
|
903
|
+
break;
|
904
|
+
}
|
905
|
+
if (i==alen) {
|
906
|
+
mrb_ary_push(mrb, ary, mrb_symbol_value(sym));
|
907
|
+
}
|
883
908
|
}
|
884
909
|
return 0;
|
885
910
|
}
|
@@ -962,16 +987,8 @@ mrb_f_global_variables(mrb_state *mrb, mrb_value self)
|
|
962
987
|
{
|
963
988
|
iv_tbl *t = mrb->globals;
|
964
989
|
mrb_value ary = mrb_ary_new(mrb);
|
965
|
-
size_t i;
|
966
|
-
char buf[3];
|
967
990
|
|
968
991
|
iv_foreach(mrb, t, gv_i, &ary);
|
969
|
-
buf[0] = '$';
|
970
|
-
buf[2] = 0;
|
971
|
-
for (i = 1; i <= 9; ++i) {
|
972
|
-
buf[1] = (char)(i + '0');
|
973
|
-
mrb_ary_push(mrb, ary, mrb_symbol_value(mrb_intern(mrb, buf, 2)));
|
974
|
-
}
|
975
992
|
return ary;
|
976
993
|
}
|
977
994
|
|
@@ -1100,12 +1117,13 @@ mrb_class_find_path(mrb_state *mrb, struct RClass *c)
|
|
1100
1117
|
mrb_str_cat_cstr(mrb, path, str);
|
1101
1118
|
mrb_str_cat_cstr(mrb, path, "::");
|
1102
1119
|
|
1103
|
-
str =
|
1120
|
+
str = mrb_sym_name_len(mrb, name, &len);
|
1104
1121
|
mrb_str_cat(mrb, path, str, len);
|
1105
1122
|
if (RSTRING_PTR(path)[0] != '#') {
|
1106
1123
|
iv_del(mrb, c->iv, mrb_intern_lit(mrb, "__outer__"), NULL);
|
1107
1124
|
iv_put(mrb, c->iv, mrb_intern_lit(mrb, "__classname__"), path);
|
1108
1125
|
mrb_field_write_barrier_value(mrb, (struct RBasic*)c, path);
|
1126
|
+
path = mrb_str_dup(mrb, path);
|
1109
1127
|
}
|
1110
1128
|
return path;
|
1111
1129
|
}
|
@@ -1115,7 +1133,9 @@ mrb_class_find_path(mrb_state *mrb, struct RClass *c)
|
|
1115
1133
|
mrb_bool
|
1116
1134
|
mrb_ident_p(const char *s, mrb_int len)
|
1117
1135
|
{
|
1118
|
-
|
1136
|
+
mrb_int i;
|
1137
|
+
|
1138
|
+
for (i = 0; i < len; i++) {
|
1119
1139
|
if (!identchar(s[i])) return FALSE;
|
1120
1140
|
}
|
1121
1141
|
return TRUE;
|