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
@@ -1,15 +0,0 @@
|
|
1
|
-
module Kernel
|
2
|
-
# call-seq:
|
3
|
-
# obj.yield_self {|_obj|...} -> an_object
|
4
|
-
# obj.then {|_obj|...} -> an_object
|
5
|
-
#
|
6
|
-
# Yields <i>obj</i> and returns the result.
|
7
|
-
#
|
8
|
-
# 'my string'.yield_self {|s|s.upcase} #=> "MY STRING"
|
9
|
-
#
|
10
|
-
def yield_self(&block)
|
11
|
-
return to_enum :yield_self unless block
|
12
|
-
block.call(self)
|
13
|
-
end
|
14
|
-
alias then yield_self
|
15
|
-
end
|
@@ -1,157 +0,0 @@
|
|
1
|
-
# encoding: ascii
|
2
|
-
|
3
|
-
# a = Array, s = String, t = Template
|
4
|
-
|
5
|
-
def packtest(a, s, t)
|
6
|
-
begin
|
7
|
-
r = a.pack(t)
|
8
|
-
return if r == s
|
9
|
-
puts "#{a.inspect}.pack(#{t.inspect}) -> #{r.inspect} should be #{s.inspect}"
|
10
|
-
rescue => r
|
11
|
-
unless r.is_a? s
|
12
|
-
puts "#{a.inspect}.pack(#{t.inspect}) -> #{r.inspect} should be #{s.inspect}"
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def unpacktest(a, s, t)
|
18
|
-
r = s.unpack(t)
|
19
|
-
return if r == a
|
20
|
-
puts "#{s.inspect}.unpack(#{t.inspect}) -> #{r.inspect} should be #{a.inspect}"
|
21
|
-
end
|
22
|
-
|
23
|
-
def pptest(a, s, t)
|
24
|
-
packtest(a, s, t)
|
25
|
-
unpacktest(a, s, t)
|
26
|
-
end
|
27
|
-
|
28
|
-
pptest [1], "\x01", "C"
|
29
|
-
|
30
|
-
packtest [1.1], "\x01", "C"
|
31
|
-
packtest [-1], "\xff", "C"
|
32
|
-
packtest [1,2], "\x01\x02", "C2"
|
33
|
-
#packtest [1], "X", ArgumentError
|
34
|
-
|
35
|
-
unpacktest [48, nil], "0", "CC"
|
36
|
-
unpacktest [160, -96], "\xa0\xa0", "Cc"
|
37
|
-
unpacktest [49, 50, 51], "123", "C*"
|
38
|
-
|
39
|
-
pptest [12849], "12", "S"
|
40
|
-
unpacktest [nil], "0", "S"
|
41
|
-
unpacktest [12849, nil], "123", "SS"
|
42
|
-
unpacktest [12849], "123", "S*"
|
43
|
-
|
44
|
-
pptest [10000], "\x27\x10", "s>"
|
45
|
-
pptest [-10000], "\xd8\xf0", "s>"
|
46
|
-
pptest [50000], "\xc3\x50", "S>"
|
47
|
-
|
48
|
-
pptest [10000], "\x10\x27", "s<"
|
49
|
-
pptest [-10000], "\xf0\xd8", "s<"
|
50
|
-
pptest [50000], "\x50\xc3", "S<"
|
51
|
-
|
52
|
-
pptest [1000000000], "\x3b\x9a\xca\x00", "l>"
|
53
|
-
pptest [-1000000000], "\xc4\x65\x36\x00", "l>"
|
54
|
-
|
55
|
-
pptest [1], "\x01\x00\x00\x00", "L<"
|
56
|
-
pptest [258], "\x02\x01\x00\x00", "L<"
|
57
|
-
pptest [66051], "\x03\x02\x01\x00", "L<"
|
58
|
-
pptest [16909060], "\x04\x03\x02\x01", "L<"
|
59
|
-
pptest [16909060], "\x01\x02\x03\x04", "L>"
|
60
|
-
|
61
|
-
packtest [-1], "\xff\xff\xff\xff", "L<"
|
62
|
-
|
63
|
-
pptest [1000000000], "\x00\x00\x00\x00\x3b\x9a\xca\x00", "q>"
|
64
|
-
pptest [-1000000000], "\xff\xff\xff\xff\xc4\x65\x36\x00", "q>"
|
65
|
-
|
66
|
-
if (2**33).is_a? Fixnum
|
67
|
-
pptest [81985529216486895], "\x01\x23\x45\x67\x89\xab\xcd\xef", "q>"
|
68
|
-
pptest [-1167088121787636991], "\x01\x23\x45\x67\x89\xab\xcd\xef", "q<"
|
69
|
-
end
|
70
|
-
|
71
|
-
pptest [16909060], "\x01\x02\x03\x04", "N"
|
72
|
-
pptest [258], "\x01\x02", "n"
|
73
|
-
pptest [32769], "\x80\x01", "n"
|
74
|
-
|
75
|
-
pptest [16909060], "\x04\x03\x02\x01", "V"
|
76
|
-
pptest [258], "\x02\x01", "v"
|
77
|
-
|
78
|
-
packtest [""], "", "m"
|
79
|
-
packtest ["a"], "YQ==\n", "m"
|
80
|
-
packtest ["ab"], "YWI=\n", "m"
|
81
|
-
packtest ["abc"], "YWJj\n", "m"
|
82
|
-
packtest ["abcd"], "YWJjZA==\n", "m"
|
83
|
-
|
84
|
-
unpacktest [""], "", "m"
|
85
|
-
unpacktest ["a"], "YQ==\n", "m"
|
86
|
-
unpacktest ["ab"], "YWI=\n", "m"
|
87
|
-
unpacktest ["abc"], "YWJj\n", "m"
|
88
|
-
unpacktest ["abcd"], "YWJjZA==\n", "m"
|
89
|
-
|
90
|
-
packtest [""], "\0", "H"
|
91
|
-
packtest ["3"], "0", "H"
|
92
|
-
packtest ["34"], "", "H0"
|
93
|
-
packtest ["34"], "0", "H"
|
94
|
-
packtest ["34"], "4", "H2"
|
95
|
-
packtest ["34"], "4\0", "H3"
|
96
|
-
packtest ["3456"], "4P", "H3"
|
97
|
-
packtest ["34563"], "4V0", "H*"
|
98
|
-
packtest ["5a"], "Z", "H*"
|
99
|
-
packtest ["5A"], "Z", "H*"
|
100
|
-
|
101
|
-
unpacktest [""], "", "H"
|
102
|
-
unpacktest [""], "0", "H0"
|
103
|
-
unpacktest ["3"], "0", "H"
|
104
|
-
unpacktest ["30"], "0", "H2"
|
105
|
-
unpacktest ["30"], "0", "H3"
|
106
|
-
unpacktest ["303"], "01", "H3"
|
107
|
-
unpacktest ["303132"], "012", "H*"
|
108
|
-
unpacktest ["3031", 50], "012", "H4C"
|
109
|
-
unpacktest ["5a"], "Z", "H*"
|
110
|
-
|
111
|
-
packtest [""], "\0", "h"
|
112
|
-
packtest ["3"], "\03", "h"
|
113
|
-
packtest ["34"], "", "h0"
|
114
|
-
packtest ["34"], "\03", "h"
|
115
|
-
packtest ["34"], "C", "h2"
|
116
|
-
packtest ["34"], "C\0", "h3"
|
117
|
-
packtest ["3456"], "C\05", "h3"
|
118
|
-
packtest ["34563"], "Ce\03", "h*"
|
119
|
-
|
120
|
-
packtest [""], " ", "A"
|
121
|
-
unpacktest [""], "", "A"
|
122
|
-
pptest ["1"], "1", "A"
|
123
|
-
pptest ["1"], "1 ", "A2"
|
124
|
-
unpacktest ["1"], "1", "A2"
|
125
|
-
unpacktest ["1"], "1 ", "A2"
|
126
|
-
unpacktest ["1"], "1\0", "A2"
|
127
|
-
packtest ["12"], "1", "A"
|
128
|
-
unpacktest ["1"], "12", "A"
|
129
|
-
pptest ["123"], "123", "A*"
|
130
|
-
packtest ["1","2"], "2", "A0A"
|
131
|
-
unpacktest ["","2"], "2", "A0A"
|
132
|
-
|
133
|
-
packtest [""], "\0", "a"
|
134
|
-
unpacktest [""], "", "a"
|
135
|
-
pptest ["1"], "1", "a"
|
136
|
-
pptest ["1 "], "1 ", "a2"
|
137
|
-
pptest ["1\0"], "1\0", "a2"
|
138
|
-
packtest ["1"], "1\0", "a2"
|
139
|
-
pptest ["123"], "123", "a*"
|
140
|
-
|
141
|
-
packtest [""], "\0", "Z"
|
142
|
-
unpacktest [""], "", "Z"
|
143
|
-
pptest ["1"], "1", "Z"
|
144
|
-
pptest ["1"], "1\0", "Z2"
|
145
|
-
pptest ["1 "], "1 ", "Z2"
|
146
|
-
pptest ["123"], "123\0", "Z*"
|
147
|
-
pptest ["1","2"], "12", "ZZ"
|
148
|
-
pptest ["1","2"], "1\0002", "Z*Z"
|
149
|
-
unpacktest ["1","3"], "1\00023", "Z3Z"
|
150
|
-
|
151
|
-
packtest [1, 2], "\x01\x02", "CyC"
|
152
|
-
|
153
|
-
packtest [65], "A", 'U'
|
154
|
-
packtest [59411], "\xEE\xA0\x93", 'U'
|
155
|
-
|
156
|
-
pptest [1], "\x00\x01", "xC"
|
157
|
-
unpacktest [2], "\xcc\x02", "xC"
|
@@ -1,26 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
#
|
3
|
-
# mrbgems test runner
|
4
|
-
#
|
5
|
-
|
6
|
-
gemname = File.basename(File.dirname(File.expand_path __FILE__))
|
7
|
-
|
8
|
-
if __FILE__ == $0
|
9
|
-
repository, dir = 'https://github.com/mruby/mruby.git', 'tmp/mruby'
|
10
|
-
build_args = ARGV
|
11
|
-
build_args = ['all', 'test'] if build_args.nil? or build_args.empty?
|
12
|
-
|
13
|
-
Dir.mkdir 'tmp' unless File.exist?('tmp')
|
14
|
-
unless File.exist?(dir)
|
15
|
-
system "git clone #{repository} #{dir}"
|
16
|
-
end
|
17
|
-
|
18
|
-
exit system(%Q[cd #{dir}; MRUBY_CONFIG=#{File.expand_path __FILE__} ruby minirake #{build_args.join(' ')}])
|
19
|
-
end
|
20
|
-
|
21
|
-
MRuby::Build.new do |conf|
|
22
|
-
toolchain :gcc
|
23
|
-
conf.gembox 'default'
|
24
|
-
|
25
|
-
conf.gem File.expand_path(File.dirname(__FILE__))
|
26
|
-
end
|
@@ -1,224 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
** mt19937ar.c - MT Random functions
|
3
|
-
**
|
4
|
-
** Copyright (C) 1997 - 2016, Makoto Matsumoto and Takuji Nishimura,
|
5
|
-
** All rights reserved.
|
6
|
-
**
|
7
|
-
** Permission is hereby granted, free of charge, to any person obtaining
|
8
|
-
** a copy of this software and associated documentation files (the
|
9
|
-
** "Software"), to deal in the Software without restriction, including
|
10
|
-
** without limitation the rights to use, copy, modify, merge, publish,
|
11
|
-
** distribute, sublicense, and/or sell copies of the Software, and to
|
12
|
-
** permit persons to whom the Software is furnished to do so, subject to
|
13
|
-
** the following conditions:
|
14
|
-
**
|
15
|
-
** The above copyright notice and this permission notice shall be
|
16
|
-
** included in all copies or substantial portions of the Software.
|
17
|
-
**
|
18
|
-
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
19
|
-
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
20
|
-
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
21
|
-
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
22
|
-
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
23
|
-
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
24
|
-
** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
25
|
-
**
|
26
|
-
** [ MIT license: http://www.opensource.org/licenses/mit-license.php ]
|
27
|
-
**
|
28
|
-
** Any feedback is very welcome.
|
29
|
-
** http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html
|
30
|
-
** email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space)
|
31
|
-
**
|
32
|
-
** This version is modified by mruby developers. If you see any problem,
|
33
|
-
** contact us first at https://github.com/mruby/mruby/issues
|
34
|
-
*/
|
35
|
-
|
36
|
-
#include <mruby.h>
|
37
|
-
#include "mt19937ar.h"
|
38
|
-
|
39
|
-
/* Period parameters */
|
40
|
-
/* #define N 624 */
|
41
|
-
#define M 397
|
42
|
-
#define MATRIX_A 0x9908b0dfUL /* constant vector a */
|
43
|
-
#define UPPER_MASK 0x80000000UL /* most significant w-r bits */
|
44
|
-
#define LOWER_MASK 0x7fffffffUL /* least significant r bits */
|
45
|
-
|
46
|
-
#if 0 /* dead_code */
|
47
|
-
static unsigned long mt[N]; /* the array for the state vector */
|
48
|
-
static int mti=N+1; /* mti==N+1 means mt[N] is not initialized */
|
49
|
-
#endif /* dead_code */
|
50
|
-
|
51
|
-
void mrb_random_init_genrand(mt_state *t, unsigned long s)
|
52
|
-
{
|
53
|
-
t->mt[0]= s & 0xffffffffUL;
|
54
|
-
for (t->mti=1; t->mti<N; t->mti++) {
|
55
|
-
t->mt[t->mti] = (1812433253UL * (t->mt[t->mti-1] ^ (t->mt[t->mti-1] >> 30)) + t->mti);
|
56
|
-
t->mt[t->mti] &= 0xffffffffUL;
|
57
|
-
}
|
58
|
-
}
|
59
|
-
|
60
|
-
unsigned long mrb_random_genrand_int32(mt_state *t)
|
61
|
-
{
|
62
|
-
unsigned long y;
|
63
|
-
static const unsigned long mag01[2]={0x0UL, MATRIX_A};
|
64
|
-
/* mag01[x] = x * MATRIX_A for x=0,1 */
|
65
|
-
|
66
|
-
if (t->mti >= N) { /* generate N words at one time */
|
67
|
-
int kk;
|
68
|
-
|
69
|
-
if (t->mti == N+1) /* if init_genrand() has not been called, */
|
70
|
-
mrb_random_init_genrand(t, 5489UL); /* a default initial seed is used */
|
71
|
-
|
72
|
-
for (kk=0;kk<N-M;kk++) {
|
73
|
-
y = (t->mt[kk]&UPPER_MASK)|(t->mt[kk+1]&LOWER_MASK);
|
74
|
-
t->mt[kk] = t->mt[kk+M] ^ (y >> 1) ^ mag01[y & 0x1UL];
|
75
|
-
}
|
76
|
-
for (;kk<N-1;kk++) {
|
77
|
-
y = (t->mt[kk]&UPPER_MASK)|(t->mt[kk+1]&LOWER_MASK);
|
78
|
-
t->mt[kk] = t->mt[kk+(M-N)] ^ (y >> 1) ^ mag01[y & 0x1UL];
|
79
|
-
}
|
80
|
-
y = (t->mt[N-1]&UPPER_MASK)|(t->mt[0]&LOWER_MASK);
|
81
|
-
t->mt[N-1] = t->mt[M-1] ^ (y >> 1) ^ mag01[y & 0x1UL];
|
82
|
-
|
83
|
-
t->mti = 0;
|
84
|
-
}
|
85
|
-
|
86
|
-
y = t->mt[t->mti++];
|
87
|
-
|
88
|
-
/* Tempering */
|
89
|
-
y ^= (y >> 11);
|
90
|
-
y ^= (y << 7) & 0x9d2c5680UL;
|
91
|
-
y ^= (y << 15) & 0xefc60000UL;
|
92
|
-
y ^= (y >> 18);
|
93
|
-
|
94
|
-
t->gen.int_ = y;
|
95
|
-
|
96
|
-
return y;
|
97
|
-
}
|
98
|
-
|
99
|
-
double mrb_random_genrand_real1(mt_state *t)
|
100
|
-
{
|
101
|
-
mrb_random_genrand_int32(t);
|
102
|
-
t->gen.double_ = t->gen.int_*(1.0/4294967295.0);
|
103
|
-
return t->gen.double_;
|
104
|
-
/* divided by 2^32-1 */
|
105
|
-
}
|
106
|
-
|
107
|
-
#if 0 /* dead_code */
|
108
|
-
/* initializes mt[N] with a seed */
|
109
|
-
void init_genrand(unsigned long s)
|
110
|
-
{
|
111
|
-
mt[0]= s & 0xffffffffUL;
|
112
|
-
for (mti=1; mti<N; mti++) {
|
113
|
-
mt[mti] = (1812433253UL * (mt[mti-1] ^ (mt[mti-1] >> 30)) + mti);
|
114
|
-
/* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */
|
115
|
-
/* In the previous versions, MSBs of the seed affect */
|
116
|
-
/* only MSBs of the array mt[]. */
|
117
|
-
/* 2002/01/09 modified by Makoto Matsumoto */
|
118
|
-
mt[mti] &= 0xffffffffUL;
|
119
|
-
/* for >32 bit machines */
|
120
|
-
}
|
121
|
-
}
|
122
|
-
|
123
|
-
/* initialize by an array with array-length */
|
124
|
-
/* init_key is the array for initializing keys */
|
125
|
-
/* key_length is its length */
|
126
|
-
/* slight change for C++, 2004/2/26 */
|
127
|
-
void init_by_array(unsigned long init_key[], int key_length)
|
128
|
-
{
|
129
|
-
int i, j, k;
|
130
|
-
init_genrand(19650218UL);
|
131
|
-
i=1; j=0;
|
132
|
-
k = (N>key_length ? N : key_length);
|
133
|
-
for (; k; k--) {
|
134
|
-
mt[i] = (mt[i] ^ ((mt[i-1] ^ (mt[i-1] >> 30)) * 1664525UL))
|
135
|
-
+ init_key[j] + j; /* non linear */
|
136
|
-
mt[i] &= 0xffffffffUL; /* for WORDSIZE > 32 machines */
|
137
|
-
i++; j++;
|
138
|
-
if (i>=N) { mt[0] = mt[N-1]; i=1; }
|
139
|
-
if (j>=key_length) j=0;
|
140
|
-
}
|
141
|
-
for (k=N-1; k; k--) {
|
142
|
-
mt[i] = (mt[i] ^ ((mt[i-1] ^ (mt[i-1] >> 30)) * 1566083941UL))
|
143
|
-
- i; /* non linear */
|
144
|
-
mt[i] &= 0xffffffffUL; /* for WORDSIZE > 32 machines */
|
145
|
-
i++;
|
146
|
-
if (i>=N) { mt[0] = mt[N-1]; i=1; }
|
147
|
-
}
|
148
|
-
|
149
|
-
mt[0] = 0x80000000UL; /* MSB is 1; assuring non-zero initial array */
|
150
|
-
}
|
151
|
-
|
152
|
-
/* generates a random number on [0,0xffffffff]-interval */
|
153
|
-
unsigned long genrand_int32(void)
|
154
|
-
{
|
155
|
-
unsigned long y;
|
156
|
-
static const unsigned long mag01[2]={0x0UL, MATRIX_A};
|
157
|
-
/* mag01[x] = x * MATRIX_A for x=0,1 */
|
158
|
-
|
159
|
-
if (mti >= N) { /* generate N words at one time */
|
160
|
-
int kk;
|
161
|
-
|
162
|
-
if (mti == N+1) /* if init_genrand() has not been called, */
|
163
|
-
init_genrand(5489UL); /* a default initial seed is used */
|
164
|
-
|
165
|
-
for (kk=0;kk<N-M;kk++) {
|
166
|
-
y = (mt[kk]&UPPER_MASK)|(mt[kk+1]&LOWER_MASK);
|
167
|
-
mt[kk] = mt[kk+M] ^ (y >> 1) ^ mag01[y & 0x1UL];
|
168
|
-
}
|
169
|
-
for (;kk<N-1;kk++) {
|
170
|
-
y = (mt[kk]&UPPER_MASK)|(mt[kk+1]&LOWER_MASK);
|
171
|
-
mt[kk] = mt[kk+(M-N)] ^ (y >> 1) ^ mag01[y & 0x1UL];
|
172
|
-
}
|
173
|
-
y = (mt[N-1]&UPPER_MASK)|(mt[0]&LOWER_MASK);
|
174
|
-
mt[N-1] = mt[M-1] ^ (y >> 1) ^ mag01[y & 0x1UL];
|
175
|
-
|
176
|
-
mti = 0;
|
177
|
-
}
|
178
|
-
|
179
|
-
y = mt[mti++];
|
180
|
-
|
181
|
-
/* Tempering */
|
182
|
-
y ^= (y >> 11);
|
183
|
-
y ^= (y << 7) & 0x9d2c5680UL;
|
184
|
-
y ^= (y << 15) & 0xefc60000UL;
|
185
|
-
y ^= (y >> 18);
|
186
|
-
|
187
|
-
return y;
|
188
|
-
}
|
189
|
-
|
190
|
-
/* generates a random number on [0,0x7fffffff]-interval */
|
191
|
-
long genrand_int31(void)
|
192
|
-
{
|
193
|
-
return (long)(genrand_int32()>>1);
|
194
|
-
}
|
195
|
-
|
196
|
-
/* generates a random number on [0,1]-real-interval */
|
197
|
-
double genrand_real1(void)
|
198
|
-
{
|
199
|
-
return genrand_int32()*(1.0/4294967295.0);
|
200
|
-
/* divided by 2^32-1 */
|
201
|
-
}
|
202
|
-
|
203
|
-
/* generates a random number on [0,1)-real-interval */
|
204
|
-
double genrand_real2(void)
|
205
|
-
{
|
206
|
-
return genrand_int32()*(1.0/4294967296.0);
|
207
|
-
/* divided by 2^32 */
|
208
|
-
}
|
209
|
-
|
210
|
-
/* generates a random number on (0,1)-real-interval */
|
211
|
-
double genrand_real3(void)
|
212
|
-
{
|
213
|
-
return (((double)genrand_int32()) + 0.5)*(1.0/4294967296.0);
|
214
|
-
/* divided by 2^32 */
|
215
|
-
}
|
216
|
-
|
217
|
-
/* generates a random number on [0,1) with 53-bit resolution*/
|
218
|
-
double genrand_res53(void)
|
219
|
-
{
|
220
|
-
unsigned long a=genrand_int32()>>5, b=genrand_int32()>>6;
|
221
|
-
return(a*67108864.0+b)*(1.0/9007199254740992.0);
|
222
|
-
}
|
223
|
-
/* These real versions are due to Isaku Wada, 2002/01/09 added */
|
224
|
-
#endif /* dead_code */
|
@@ -1,80 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
** mt19937ar.h - MT Random functions
|
3
|
-
**
|
4
|
-
** Copyright (C) 1997 - 2016, Makoto Matsumoto and Takuji Nishimura,
|
5
|
-
** All rights reserved.
|
6
|
-
**
|
7
|
-
** Permission is hereby granted, free of charge, to any person obtaining
|
8
|
-
** a copy of this software and associated documentation files (the
|
9
|
-
** "Software"), to deal in the Software without restriction, including
|
10
|
-
** without limitation the rights to use, copy, modify, merge, publish,
|
11
|
-
** distribute, sublicense, and/or sell copies of the Software, and to
|
12
|
-
** permit persons to whom the Software is furnished to do so, subject to
|
13
|
-
** the following conditions:
|
14
|
-
**
|
15
|
-
** The above copyright notice and this permission notice shall be
|
16
|
-
** included in all copies or substantial portions of the Software.
|
17
|
-
**
|
18
|
-
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
19
|
-
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
20
|
-
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
21
|
-
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
22
|
-
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
23
|
-
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
24
|
-
** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
25
|
-
**
|
26
|
-
** [ MIT license: http://www.opensource.org/licenses/mit-license.php ]
|
27
|
-
**
|
28
|
-
** Any feedback is very welcome.
|
29
|
-
** http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html
|
30
|
-
** email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space)
|
31
|
-
**
|
32
|
-
** This version is modified by mruby developers. If you see any problem,
|
33
|
-
** contact us first at https://github.com/mruby/mruby/issues
|
34
|
-
*/
|
35
|
-
|
36
|
-
#define N 624
|
37
|
-
|
38
|
-
typedef struct {
|
39
|
-
unsigned long mt[N];
|
40
|
-
int mti;
|
41
|
-
union {
|
42
|
-
unsigned long int_;
|
43
|
-
double double_;
|
44
|
-
} gen;
|
45
|
-
|
46
|
-
mrb_int seed;
|
47
|
-
mrb_bool has_seed : 1;
|
48
|
-
} mt_state;
|
49
|
-
|
50
|
-
void mrb_random_init_genrand(mt_state *, unsigned long);
|
51
|
-
unsigned long mrb_random_genrand_int32(mt_state *);
|
52
|
-
double mrb_random_genrand_real1(mt_state *t);
|
53
|
-
|
54
|
-
/* initializes mt[N] with a seed */
|
55
|
-
void init_genrand(unsigned long s);
|
56
|
-
|
57
|
-
/* initialize by an array with array-length */
|
58
|
-
/* init_key is the array for initializing keys */
|
59
|
-
/* key_length is its length */
|
60
|
-
/* slight change for C++, 2004/2/26 */
|
61
|
-
void init_by_array(unsigned long init_key[], int key_length);
|
62
|
-
|
63
|
-
/* generates a random number on [0,0xffffffff]-interval */
|
64
|
-
unsigned long genrand_int32(void);
|
65
|
-
|
66
|
-
/* generates a random number on [0,0x7fffffff]-interval */
|
67
|
-
long genrand_int31(void);
|
68
|
-
|
69
|
-
/* These real versions are due to Isaku Wada, 2002/01/09 added */
|
70
|
-
/* generates a random number on [0,1]-real-interval */
|
71
|
-
double genrand_real1(void);
|
72
|
-
|
73
|
-
/* generates a random number on [0,1)-real-interval */
|
74
|
-
double genrand_real2(void);
|
75
|
-
|
76
|
-
/* generates a random number on (0,1)-real-interval */
|
77
|
-
double genrand_real3(void);
|
78
|
-
|
79
|
-
/* generates a random number on [0,1) with 53-bit resolution*/
|
80
|
-
double genrand_res53(void);
|