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.
Files changed (381) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/.rubocop.yml +8 -6
  4. data/.ruby-version +1 -1
  5. data/Gemfile +2 -1
  6. data/bin/sandbox +1 -1
  7. data/ext/enterprise_script_service/Rakefile +1 -1
  8. data/ext/enterprise_script_service/flags.rb +5 -0
  9. data/ext/enterprise_script_service/libseccomp/CHANGELOG +15 -0
  10. data/ext/enterprise_script_service/libseccomp/CREDITS +3 -0
  11. data/ext/enterprise_script_service/libseccomp/Makefile.am +1 -1
  12. data/ext/enterprise_script_service/libseccomp/README.md +1 -1
  13. data/ext/enterprise_script_service/libseccomp/SECURITY.md +45 -0
  14. data/ext/enterprise_script_service/libseccomp/configure.ac +3 -3
  15. data/ext/enterprise_script_service/libseccomp/doc/admin/MAINTAINER_PROCESS.md +95 -0
  16. data/ext/enterprise_script_service/libseccomp/{RELEASE_PROCESS.md → doc/admin/RELEASE_PROCESS.md} +9 -1
  17. data/ext/enterprise_script_service/libseccomp/include/Makefile.am +1 -1
  18. data/ext/enterprise_script_service/libseccomp/include/seccomp-syscalls.h +2292 -0
  19. data/ext/enterprise_script_service/libseccomp/include/seccomp.h.in +3 -1065
  20. data/ext/enterprise_script_service/libseccomp/src/arch-aarch64-syscalls.c +35 -3
  21. data/ext/enterprise_script_service/libseccomp/src/arch-arm-syscalls.c +35 -3
  22. data/ext/enterprise_script_service/libseccomp/src/arch-mips-syscalls.c +43 -11
  23. data/ext/enterprise_script_service/libseccomp/src/arch-mips64-syscalls.c +33 -1
  24. data/ext/enterprise_script_service/libseccomp/src/arch-mips64n32-syscalls.c +33 -1
  25. data/ext/enterprise_script_service/libseccomp/src/arch-parisc-syscalls.c +34 -2
  26. data/ext/enterprise_script_service/libseccomp/src/arch-ppc-syscalls.c +43 -11
  27. data/ext/enterprise_script_service/libseccomp/src/arch-ppc64-syscalls.c +44 -12
  28. data/ext/enterprise_script_service/libseccomp/src/arch-s390-syscalls.c +46 -14
  29. data/ext/enterprise_script_service/libseccomp/src/arch-s390.c +142 -18
  30. data/ext/enterprise_script_service/libseccomp/src/arch-s390x-syscalls.c +47 -15
  31. data/ext/enterprise_script_service/libseccomp/src/arch-s390x.c +143 -17
  32. data/ext/enterprise_script_service/libseccomp/src/arch-x32-syscalls.c +33 -1
  33. data/ext/enterprise_script_service/libseccomp/src/arch-x86-syscalls.c +94 -12
  34. data/ext/enterprise_script_service/libseccomp/src/arch-x86.c +142 -19
  35. data/ext/enterprise_script_service/libseccomp/src/arch-x86_64-syscalls.c +33 -1
  36. data/ext/enterprise_script_service/libseccomp/src/db.c +1 -0
  37. data/ext/enterprise_script_service/libseccomp/src/gen_bpf.c +10 -3
  38. data/ext/enterprise_script_service/libseccomp/src/python/Makefile.am +4 -4
  39. data/ext/enterprise_script_service/libseccomp/src/python/seccomp.pyx +2 -0
  40. data/ext/enterprise_script_service/libseccomp/tests/.gitignore +1 -0
  41. data/ext/enterprise_script_service/libseccomp/tests/50-sim-hash_collision.c +98 -0
  42. data/ext/enterprise_script_service/libseccomp/tests/50-sim-hash_collision.py +61 -0
  43. data/ext/enterprise_script_service/libseccomp/tests/50-sim-hash_collision.tests +18 -0
  44. data/ext/enterprise_script_service/libseccomp/tests/Makefile.am +6 -3
  45. data/ext/enterprise_script_service/libseccomp/tools/Makefile.am +0 -2
  46. data/ext/enterprise_script_service/libseccomp/tools/check-syntax +1 -0
  47. data/ext/enterprise_script_service/libseccomp/tools/scmp_bpf_sim.c +2 -0
  48. data/ext/enterprise_script_service/mruby-mpdecimal/src/ext.c +1 -1
  49. data/ext/enterprise_script_service/mruby/.gitignore +2 -2
  50. data/ext/enterprise_script_service/mruby/CONTRIBUTING.md +10 -3
  51. data/ext/enterprise_script_service/mruby/Doxyfile +2408 -0
  52. data/ext/enterprise_script_service/mruby/README.md +21 -8
  53. data/ext/enterprise_script_service/mruby/Rakefile +4 -13
  54. data/ext/enterprise_script_service/mruby/appveyor_config.rb +1 -1
  55. data/ext/enterprise_script_service/mruby/build_config.rb +3 -3
  56. data/ext/enterprise_script_service/mruby/doc/guides/compile.md +42 -42
  57. data/ext/enterprise_script_service/mruby/doc/guides/debugger.md +1 -1
  58. data/ext/enterprise_script_service/mruby/doc/guides/mrbconf.md +45 -6
  59. data/ext/enterprise_script_service/mruby/doc/guides/mrbgems.md +5 -0
  60. data/ext/enterprise_script_service/mruby/doc/limitations.md +88 -38
  61. data/ext/enterprise_script_service/mruby/doc/mruby_logo_red_icon.png +0 -0
  62. data/ext/enterprise_script_service/mruby/doc/opcode.md +94 -94
  63. data/ext/enterprise_script_service/mruby/include/mrbconf.h +74 -11
  64. data/ext/enterprise_script_service/mruby/include/mruby.h +242 -146
  65. data/ext/enterprise_script_service/mruby/include/mruby/array.h +7 -7
  66. data/ext/enterprise_script_service/mruby/include/mruby/boxing_nan.h +2 -9
  67. data/ext/enterprise_script_service/mruby/include/mruby/boxing_no.h +11 -10
  68. data/ext/enterprise_script_service/mruby/include/mruby/boxing_word.h +104 -69
  69. data/ext/enterprise_script_service/mruby/include/mruby/class.h +7 -5
  70. data/ext/enterprise_script_service/mruby/include/mruby/common.h +9 -7
  71. data/ext/enterprise_script_service/mruby/include/mruby/compile.h +6 -6
  72. data/ext/enterprise_script_service/mruby/include/mruby/data.h +5 -5
  73. data/ext/enterprise_script_service/mruby/include/mruby/debug.h +2 -2
  74. data/ext/enterprise_script_service/mruby/include/mruby/dump.h +3 -7
  75. data/ext/enterprise_script_service/mruby/include/mruby/error.h +34 -6
  76. data/ext/enterprise_script_service/mruby/include/mruby/gc.h +2 -2
  77. data/ext/enterprise_script_service/mruby/include/mruby/hash.h +4 -11
  78. data/ext/enterprise_script_service/mruby/include/mruby/irep.h +16 -4
  79. data/ext/enterprise_script_service/mruby/include/mruby/istruct.h +4 -4
  80. data/ext/enterprise_script_service/mruby/include/mruby/khash.h +2 -2
  81. data/ext/enterprise_script_service/mruby/include/mruby/numeric.h +41 -7
  82. data/ext/enterprise_script_service/mruby/include/mruby/object.h +8 -9
  83. data/ext/enterprise_script_service/mruby/include/mruby/opcode.h +2 -2
  84. data/ext/enterprise_script_service/mruby/include/mruby/ops.h +6 -6
  85. data/ext/enterprise_script_service/mruby/include/mruby/proc.h +19 -13
  86. data/ext/enterprise_script_service/mruby/include/mruby/range.h +10 -4
  87. data/ext/enterprise_script_service/mruby/include/mruby/re.h +2 -2
  88. data/ext/enterprise_script_service/mruby/include/mruby/string.h +130 -107
  89. data/ext/enterprise_script_service/mruby/include/mruby/throw.h +2 -2
  90. data/ext/enterprise_script_service/mruby/include/mruby/value.h +137 -49
  91. data/ext/enterprise_script_service/mruby/include/mruby/variable.h +3 -5
  92. data/ext/enterprise_script_service/mruby/include/mruby/version.h +24 -10
  93. data/ext/enterprise_script_service/mruby/lib/mruby-core-ext.rb +2 -39
  94. data/ext/enterprise_script_service/mruby/lib/mruby/build.rb +32 -15
  95. data/ext/enterprise_script_service/mruby/lib/mruby/build/command.rb +63 -17
  96. data/ext/enterprise_script_service/mruby/lib/mruby/build/load_gems.rb +24 -10
  97. data/ext/enterprise_script_service/mruby/lib/mruby/gem.rb +11 -7
  98. data/ext/enterprise_script_service/mruby/lib/mruby/lockfile.rb +81 -0
  99. data/ext/enterprise_script_service/mruby/minirake +27 -11
  100. data/ext/enterprise_script_service/mruby/mrbgems/default.gembox +3 -0
  101. data/ext/enterprise_script_service/mruby/mrbgems/mruby-array-ext/mrbgem.rake +0 -1
  102. data/ext/enterprise_script_service/mruby/mrbgems/mruby-array-ext/mrblib/array.rb +47 -9
  103. data/ext/enterprise_script_service/mruby/mrbgems/mruby-array-ext/src/array.c +3 -3
  104. data/ext/enterprise_script_service/mruby/mrbgems/mruby-array-ext/test/array.rb +50 -29
  105. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.c +3 -3
  106. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/apiprint.c +2 -2
  107. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/cmdprint.c +3 -3
  108. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.c +2 -2
  109. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.h +1 -1
  110. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/mrdbconf.h +4 -0
  111. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mirb/tools/mirb/mirb.c +28 -1
  112. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mrbc/tools/mrbc/mrbc.c +1 -2
  113. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mruby/bintest/mruby.rb +75 -8
  114. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c +134 -90
  115. data/ext/enterprise_script_service/mruby/mrbgems/mruby-class-ext/src/class.c +7 -8
  116. data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/codegen.c +69 -46
  117. data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/keywords +0 -3
  118. data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/lex.def +51 -59
  119. data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/parse.y +430 -241
  120. data/ext/enterprise_script_service/mruby/mrbgems/mruby-complex/mrbgem.rake +10 -0
  121. data/ext/enterprise_script_service/mruby/mrbgems/mruby-complex/mrblib/complex.rb +122 -0
  122. data/ext/enterprise_script_service/mruby/mrbgems/mruby-complex/src/complex.c +249 -0
  123. data/ext/enterprise_script_service/mruby/mrbgems/mruby-complex/test/complex.rb +153 -0
  124. data/ext/enterprise_script_service/mruby/mrbgems/mruby-enum-chain/mrblib/chain.rb +19 -17
  125. data/ext/enterprise_script_service/mruby/mrbgems/mruby-enum-chain/test/enum_chain.rb +41 -9
  126. data/ext/enterprise_script_service/mruby/mrbgems/mruby-enum-ext/mrblib/enum.rb +30 -4
  127. data/ext/enterprise_script_service/mruby/mrbgems/mruby-enum-ext/test/enum.rb +8 -3
  128. data/ext/enterprise_script_service/mruby/mrbgems/mruby-enumerator/mrbgem.rake +0 -1
  129. data/ext/enterprise_script_service/mruby/mrbgems/mruby-enumerator/mrblib/enumerator.rb +46 -14
  130. data/ext/enterprise_script_service/mruby/mrbgems/mruby-enumerator/test/enumerator.rb +51 -2
  131. data/ext/enterprise_script_service/mruby/mrbgems/mruby-error/src/exception.c +10 -0
  132. data/ext/enterprise_script_service/mruby/mrbgems/mruby-eval/src/eval.c +47 -44
  133. data/ext/enterprise_script_service/mruby/mrbgems/mruby-eval/test/eval.rb +2 -2
  134. data/ext/enterprise_script_service/mruby/mrbgems/mruby-exit/src/mruby-exit.c +9 -4
  135. data/ext/enterprise_script_service/mruby/mrbgems/mruby-fiber/src/fiber.c +16 -12
  136. data/ext/enterprise_script_service/mruby/mrbgems/mruby-fiber/test/fiber.rb +1 -1
  137. data/ext/enterprise_script_service/mruby/mrbgems/mruby-hash-ext/mrbgem.rake +0 -2
  138. data/ext/enterprise_script_service/mruby/mrbgems/mruby-hash-ext/mrblib/hash.rb +3 -0
  139. data/ext/enterprise_script_service/mruby/mrbgems/mruby-hash-ext/test/hash.rb +3 -7
  140. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/README.md +1 -3
  141. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/mrbgem.rake +1 -1
  142. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/mrblib/file.rb +0 -5
  143. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/mrblib/io.rb +24 -38
  144. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/mrblib/kernel.rb +16 -0
  145. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/src/file.c +19 -18
  146. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/src/file_test.c +5 -16
  147. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/src/io.c +54 -42
  148. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/test/file.rb +24 -20
  149. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/test/file_test.rb +4 -9
  150. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/test/io.rb +41 -35
  151. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/test/mruby_io_test.c +9 -36
  152. data/ext/enterprise_script_service/mruby/mrbgems/mruby-kernel-ext/mrbgem.rake +1 -1
  153. data/ext/enterprise_script_service/mruby/mrbgems/mruby-kernel-ext/src/kernel.c +9 -27
  154. data/ext/enterprise_script_service/mruby/mrbgems/mruby-kernel-ext/test/kernel.rb +2 -0
  155. data/ext/enterprise_script_service/mruby/mrbgems/mruby-math/src/math.c +5 -2
  156. data/ext/enterprise_script_service/mruby/mrbgems/mruby-metaprog/src/metaprog.c +39 -24
  157. data/ext/enterprise_script_service/mruby/mrbgems/mruby-metaprog/test/metaprog.rb +48 -17
  158. data/ext/enterprise_script_service/mruby/mrbgems/mruby-method/mrblib/method.rb +0 -12
  159. data/ext/enterprise_script_service/mruby/mrbgems/mruby-method/src/method.c +134 -101
  160. data/ext/enterprise_script_service/mruby/mrbgems/mruby-method/test/method.rb +9 -1
  161. data/ext/enterprise_script_service/mruby/mrbgems/mruby-numeric-ext/mrblib/numeric_ext.rb +1 -5
  162. data/ext/enterprise_script_service/mruby/mrbgems/mruby-numeric-ext/src/numeric_ext.c +17 -37
  163. data/ext/enterprise_script_service/mruby/mrbgems/mruby-numeric-ext/test/numeric.rb +0 -8
  164. data/ext/enterprise_script_service/mruby/mrbgems/mruby-object-ext/mrbgem.rake +1 -1
  165. data/ext/enterprise_script_service/mruby/mrbgems/mruby-object-ext/mrblib/object.rb +15 -1
  166. data/ext/enterprise_script_service/mruby/mrbgems/mruby-object-ext/src/object.c +35 -6
  167. data/ext/enterprise_script_service/mruby/mrbgems/mruby-object-ext/test/nil.rb +4 -0
  168. data/ext/enterprise_script_service/mruby/mrbgems/mruby-objectspace/src/mruby_objectspace.c +1 -5
  169. data/ext/enterprise_script_service/mruby/mrbgems/mruby-objectspace/test/objectspace.rb +1 -1
  170. data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/src/pack.c +28 -23
  171. data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/test/pack.rb +43 -49
  172. data/ext/enterprise_script_service/mruby/mrbgems/mruby-print/mrblib/print.rb +3 -9
  173. data/ext/enterprise_script_service/mruby/mrbgems/mruby-proc-ext/src/proc.c +6 -9
  174. data/ext/enterprise_script_service/mruby/mrbgems/mruby-proc-ext/test/proc.rb +21 -5
  175. data/ext/enterprise_script_service/mruby/mrbgems/mruby-random/src/random.c +157 -124
  176. data/ext/enterprise_script_service/mruby/mrbgems/mruby-random/test/random.rb +72 -26
  177. data/ext/enterprise_script_service/mruby/mrbgems/mruby-range-ext/mrblib/range.rb +38 -0
  178. data/ext/enterprise_script_service/mruby/mrbgems/mruby-range-ext/src/range.c +26 -11
  179. data/ext/enterprise_script_service/mruby/mrbgems/mruby-range-ext/test/range.rb +111 -1
  180. data/ext/enterprise_script_service/mruby/mrbgems/mruby-rational/mrbgem.rake +5 -0
  181. data/ext/enterprise_script_service/mruby/mrbgems/mruby-rational/mrblib/rational.rb +117 -0
  182. data/ext/enterprise_script_service/mruby/mrbgems/mruby-rational/src/rational.c +209 -0
  183. data/ext/enterprise_script_service/mruby/mrbgems/mruby-rational/test/rational.rb +308 -0
  184. data/ext/enterprise_script_service/mruby/mrbgems/mruby-socket/README.md +1 -1
  185. data/ext/enterprise_script_service/mruby/mrbgems/mruby-socket/src/socket.c +10 -9
  186. data/ext/enterprise_script_service/mruby/mrbgems/mruby-sprintf/src/kernel.c +2 -2
  187. data/ext/enterprise_script_service/mruby/mrbgems/mruby-sprintf/src/sprintf.c +22 -24
  188. data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/mrbgem.rake +0 -1
  189. data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/mrblib/string.rb +8 -4
  190. data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/src/string.c +116 -117
  191. data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/test/numeric.rb +29 -0
  192. data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/test/range.rb +26 -0
  193. data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/test/string.rb +32 -50
  194. data/ext/enterprise_script_service/mruby/mrbgems/mruby-struct/mrblib/struct.rb +5 -7
  195. data/ext/enterprise_script_service/mruby/mrbgems/mruby-struct/src/struct.c +43 -57
  196. data/ext/enterprise_script_service/mruby/mrbgems/mruby-struct/test/struct.rb +16 -11
  197. data/ext/enterprise_script_service/mruby/mrbgems/mruby-symbol-ext/src/symbol.c +2 -2
  198. data/ext/enterprise_script_service/mruby/mrbgems/mruby-symbol-ext/test/symbol.rb +1 -1
  199. data/ext/enterprise_script_service/mruby/mrbgems/mruby-test/driver.c +152 -1
  200. data/ext/enterprise_script_service/mruby/mrbgems/mruby-test/mrbgem.rake +4 -3
  201. data/ext/enterprise_script_service/mruby/mrbgems/mruby-test/vformat.c +200 -0
  202. data/ext/enterprise_script_service/mruby/mrbgems/mruby-time/include/mruby/time.h +2 -1
  203. data/ext/enterprise_script_service/mruby/mrbgems/mruby-time/src/time.c +199 -68
  204. data/ext/enterprise_script_service/mruby/mrbgems/mruby-time/test/time.rb +81 -46
  205. data/ext/enterprise_script_service/mruby/mrblib/array.rb +14 -16
  206. data/ext/enterprise_script_service/mruby/mrblib/enum.rb +13 -9
  207. data/ext/enterprise_script_service/mruby/mrblib/hash.rb +5 -7
  208. data/ext/enterprise_script_service/mruby/mrblib/kernel.rb +1 -1
  209. data/ext/enterprise_script_service/mruby/mrblib/numeric.rb +4 -4
  210. data/ext/enterprise_script_service/mruby/mrblib/range.rb +1 -1
  211. data/ext/enterprise_script_service/mruby/mrblib/string.rb +55 -112
  212. data/ext/enterprise_script_service/mruby/mruby-source.gemspec +1 -1
  213. data/ext/enterprise_script_service/mruby/oss-fuzz/config/mruby.dict +105 -0
  214. data/ext/enterprise_script_service/mruby/oss-fuzz/config/mruby_fuzzer.options +5 -0
  215. data/ext/enterprise_script_service/mruby/oss-fuzz/config/mruby_proto_fuzzer.options +4 -0
  216. data/ext/enterprise_script_service/mruby/oss-fuzz/mruby_fuzzer.c +18 -0
  217. data/ext/enterprise_script_service/mruby/oss-fuzz/mruby_proto_fuzzer.cpp +44 -0
  218. data/ext/enterprise_script_service/mruby/oss-fuzz/proto_to_ruby.cpp +455 -0
  219. data/ext/enterprise_script_service/mruby/oss-fuzz/proto_to_ruby.h +55 -0
  220. data/ext/enterprise_script_service/mruby/oss-fuzz/ruby.proto +201 -0
  221. data/ext/enterprise_script_service/mruby/src/array.c +95 -46
  222. data/ext/enterprise_script_service/mruby/src/backtrace.c +6 -8
  223. data/ext/enterprise_script_service/mruby/src/class.c +370 -278
  224. data/ext/enterprise_script_service/mruby/src/codedump.c +34 -34
  225. data/ext/enterprise_script_service/mruby/src/debug.c +2 -2
  226. data/ext/enterprise_script_service/mruby/src/dump.c +8 -6
  227. data/ext/enterprise_script_service/mruby/src/enum.c +1 -1
  228. data/ext/enterprise_script_service/mruby/src/error.c +157 -55
  229. data/ext/enterprise_script_service/mruby/src/etc.c +13 -46
  230. data/ext/enterprise_script_service/mruby/src/fmt_fp.c +2 -2
  231. data/ext/enterprise_script_service/mruby/src/gc.c +30 -11
  232. data/ext/enterprise_script_service/mruby/src/hash.c +23 -14
  233. data/ext/enterprise_script_service/mruby/src/kernel.c +16 -54
  234. data/ext/enterprise_script_service/mruby/src/load.c +40 -76
  235. data/ext/enterprise_script_service/mruby/src/numeric.c +164 -94
  236. data/ext/enterprise_script_service/mruby/src/object.c +16 -39
  237. data/ext/enterprise_script_service/mruby/src/pool.c +0 -2
  238. data/ext/enterprise_script_service/mruby/src/proc.c +47 -48
  239. data/ext/enterprise_script_service/mruby/src/range.c +22 -35
  240. data/ext/enterprise_script_service/mruby/src/state.c +5 -94
  241. data/ext/enterprise_script_service/mruby/src/string.c +874 -710
  242. data/ext/enterprise_script_service/mruby/src/symbol.c +73 -48
  243. data/ext/enterprise_script_service/mruby/src/variable.c +58 -38
  244. data/ext/enterprise_script_service/mruby/src/vm.c +133 -304
  245. data/ext/enterprise_script_service/mruby/tasks/doc.rake +48 -0
  246. data/ext/enterprise_script_service/mruby/tasks/toolchains/clang.rake +3 -4
  247. data/ext/enterprise_script_service/mruby/tasks/toolchains/gcc.rake +20 -19
  248. data/ext/enterprise_script_service/mruby/tasks/toolchains/visualcpp.rake +0 -12
  249. data/ext/enterprise_script_service/mruby/test/assert.rb +186 -25
  250. data/ext/enterprise_script_service/mruby/test/t/array.rb +34 -6
  251. data/ext/enterprise_script_service/mruby/test/t/class.rb +26 -0
  252. data/ext/enterprise_script_service/mruby/test/t/enumerable.rb +2 -2
  253. data/ext/enterprise_script_service/mruby/test/t/float.rb +17 -17
  254. data/ext/enterprise_script_service/mruby/test/t/hash.rb +2 -0
  255. data/ext/enterprise_script_service/mruby/test/t/integer.rb +14 -6
  256. data/ext/enterprise_script_service/mruby/test/t/kernel.rb +38 -19
  257. data/ext/enterprise_script_service/mruby/test/t/module.rb +87 -14
  258. data/ext/enterprise_script_service/mruby/test/t/numeric.rb +65 -23
  259. data/ext/enterprise_script_service/mruby/test/t/range.rb +4 -4
  260. data/ext/enterprise_script_service/mruby/test/t/string.rb +211 -49
  261. data/ext/enterprise_script_service/mruby/test/t/syntax.rb +19 -2
  262. data/ext/enterprise_script_service/mruby/test/t/vformat.rb +92 -0
  263. data/ext/enterprise_script_service/mruby/travis_config.rb +2 -2
  264. data/ext/enterprise_script_service/mruby_config.rb +10 -0
  265. data/ext/enterprise_script_service/mruby_engine.cpp +2 -2
  266. data/ext/enterprise_script_service/mruby_engine.gembox +1 -0
  267. data/ext/enterprise_script_service/msgpack/CHANGELOG.md +14 -0
  268. data/ext/enterprise_script_service/msgpack/Files.cmake +4 -0
  269. data/ext/enterprise_script_service/msgpack/README.md +1 -1
  270. data/ext/enterprise_script_service/msgpack/appveyor.yml +1 -1
  271. data/ext/enterprise_script_service/msgpack/erb/v1/cpp03_msgpack_tuple.hpp.erb +1 -1
  272. data/ext/enterprise_script_service/msgpack/erb/v1/cpp03_msgpack_tuple_decl.hpp.erb +1 -1
  273. data/ext/enterprise_script_service/msgpack/erb/v1/cpp03_zone.hpp.erb +3 -3
  274. data/ext/enterprise_script_service/msgpack/example/boost/asio_send_recv.cpp +1 -1
  275. data/ext/enterprise_script_service/msgpack/include/msgpack/adaptor/cpp11/timespec.hpp +16 -0
  276. data/ext/enterprise_script_service/msgpack/include/msgpack/adaptor/wstring.hpp +15 -0
  277. data/ext/enterprise_script_service/msgpack/include/msgpack/object.h +2 -0
  278. data/ext/enterprise_script_service/msgpack/include/msgpack/pack_template.h +17 -9
  279. data/ext/enterprise_script_service/msgpack/include/msgpack/sysdep.h +27 -16
  280. data/ext/enterprise_script_service/msgpack/include/msgpack/type.hpp +2 -0
  281. data/ext/enterprise_script_service/msgpack/include/msgpack/unpack_template.h +5 -0
  282. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/array_ref.hpp +0 -1
  283. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/check_container_size.hpp +1 -1
  284. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/cpp11/chrono.hpp +5 -5
  285. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/cpp11/timespec.hpp +140 -0
  286. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/detail/cpp03_msgpack_tuple.hpp +32 -32
  287. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/detail/cpp03_msgpack_tuple_decl.hpp +32 -32
  288. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/detail/cpp11_msgpack_tuple.hpp +6 -6
  289. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/detail/cpp11_msgpack_tuple_decl.hpp +10 -10
  290. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/ext.hpp +1 -1
  291. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/fixint.hpp +5 -4
  292. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/int.hpp +40 -13
  293. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/int_decl.hpp +3 -2
  294. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/wstring.hpp +121 -0
  295. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/detail/cpp03_zone.hpp +3 -3
  296. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/detail/cpp11_zone.hpp +3 -3
  297. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/object.hpp +6 -6
  298. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/object_fwd.hpp +1 -1
  299. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/pack.hpp +40 -5
  300. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/unpack.hpp +11 -11
  301. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/vrefbuffer.hpp +7 -7
  302. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/zbuffer.hpp +5 -5
  303. data/ext/enterprise_script_service/msgpack/include/msgpack/v2/adaptor/int_decl.hpp +1 -1
  304. data/ext/enterprise_script_service/msgpack/include/msgpack/v2/create_object_visitor.hpp +1 -1
  305. data/ext/enterprise_script_service/msgpack/include/msgpack/v2/parse.hpp +13 -13
  306. data/ext/enterprise_script_service/msgpack/include/msgpack/v2/x3_parse.hpp +28 -26
  307. data/ext/enterprise_script_service/msgpack/include/msgpack/v3/adaptor/int_decl.hpp +1 -1
  308. data/ext/enterprise_script_service/msgpack/include/msgpack/v3/parse.hpp +13 -13
  309. data/ext/enterprise_script_service/msgpack/include/msgpack/version_master.h +2 -2
  310. data/ext/enterprise_script_service/msgpack/include/msgpack/zbuffer.h +6 -6
  311. data/ext/enterprise_script_service/msgpack/include/msgpack/zone.h +1 -1
  312. data/ext/enterprise_script_service/msgpack/src/objectc.c +83 -148
  313. data/ext/enterprise_script_service/msgpack/src/unpack.c +73 -47
  314. data/ext/enterprise_script_service/msgpack/test/CMakeLists.txt +1 -1
  315. data/ext/enterprise_script_service/msgpack/test/array_ref.cpp +5 -0
  316. data/ext/enterprise_script_service/msgpack/test/boost_fusion.cpp +5 -0
  317. data/ext/enterprise_script_service/msgpack/test/boost_optional.cpp +7 -0
  318. data/ext/enterprise_script_service/msgpack/test/boost_string_ref.cpp +7 -0
  319. data/ext/enterprise_script_service/msgpack/test/boost_string_view.cpp +6 -0
  320. data/ext/enterprise_script_service/msgpack/test/boost_variant.cpp +15 -9
  321. data/ext/enterprise_script_service/msgpack/test/buffer.cpp +7 -0
  322. data/ext/enterprise_script_service/msgpack/test/carray.cpp +7 -0
  323. data/ext/enterprise_script_service/msgpack/test/cases.cpp +7 -1
  324. data/ext/enterprise_script_service/msgpack/test/convert.cpp +6 -0
  325. data/ext/enterprise_script_service/msgpack/test/fixint.cpp +7 -1
  326. data/ext/enterprise_script_service/msgpack/test/fixint_c.cpp +6 -1
  327. data/ext/enterprise_script_service/msgpack/test/fuzz_unpack_pack_fuzzer_cpp11.cpp +5 -0
  328. data/ext/enterprise_script_service/msgpack/test/iterator_cpp11.cpp +8 -2
  329. data/ext/enterprise_script_service/msgpack/test/json.cpp +6 -0
  330. data/ext/enterprise_script_service/msgpack/test/limit.cpp +7 -0
  331. data/ext/enterprise_script_service/msgpack/test/msgpack_basic.cpp +128 -6
  332. data/ext/enterprise_script_service/msgpack/test/msgpack_c.cpp +7 -2
  333. data/ext/enterprise_script_service/msgpack/test/msgpack_container.cpp +20 -3
  334. data/ext/enterprise_script_service/msgpack/test/msgpack_cpp11.cpp +159 -0
  335. data/ext/enterprise_script_service/msgpack/test/msgpack_cpp17.cpp +5 -0
  336. data/ext/enterprise_script_service/msgpack/test/msgpack_stream.cpp +8 -3
  337. data/ext/enterprise_script_service/msgpack/test/msgpack_tuple.cpp +6 -0
  338. data/ext/enterprise_script_service/msgpack/test/msgpack_vref.cpp +5 -0
  339. data/ext/enterprise_script_service/msgpack/test/msgpack_x3_parse.cpp +23 -18
  340. data/ext/enterprise_script_service/msgpack/test/object.cpp +77 -45
  341. data/ext/enterprise_script_service/msgpack/test/object_with_zone.cpp +28 -10
  342. data/ext/enterprise_script_service/msgpack/test/pack_unpack.cpp +25 -18
  343. data/ext/enterprise_script_service/msgpack/test/pack_unpack_c.cpp +7 -0
  344. data/ext/enterprise_script_service/msgpack/test/raw.cpp +17 -12
  345. data/ext/enterprise_script_service/msgpack/test/reference.cpp +6 -0
  346. data/ext/enterprise_script_service/msgpack/test/reference_cpp11.cpp +6 -0
  347. data/ext/enterprise_script_service/msgpack/test/reference_wrapper_cpp11.cpp +6 -0
  348. data/ext/enterprise_script_service/msgpack/test/shared_ptr_cpp11.cpp +6 -0
  349. data/ext/enterprise_script_service/msgpack/test/size_equal_only.cpp +6 -2
  350. data/ext/enterprise_script_service/msgpack/test/streaming.cpp +10 -3
  351. data/ext/enterprise_script_service/msgpack/test/streaming_c.cpp +7 -0
  352. data/ext/enterprise_script_service/msgpack/test/unique_ptr_cpp11.cpp +6 -0
  353. data/ext/enterprise_script_service/msgpack/test/user_class.cpp +5 -0
  354. data/ext/enterprise_script_service/msgpack/test/version.cpp +6 -0
  355. data/ext/enterprise_script_service/msgpack/test/visitor.cpp +7 -0
  356. data/ext/enterprise_script_service/msgpack/test/zone.cpp +6 -0
  357. data/lib/script_core/version.rb +1 -1
  358. data/lib/tasks/mruby/engine.gembox.example +1 -0
  359. data/lib/tasks/script_core.rake +21 -3
  360. data/spec/dummy/app/helpers/fields_helper.rb +2 -2
  361. data/spec/dummy/mruby/engine.gembox +1 -0
  362. data/spec/script_core_spec.rb +1 -1
  363. metadata +38 -22
  364. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/.gitignore +0 -1
  365. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/.travis.yml +0 -2
  366. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/run_test.rb +0 -26
  367. data/ext/enterprise_script_service/mruby/mrbgems/mruby-kernel-ext/mrblib/kernel.rb +0 -15
  368. data/ext/enterprise_script_service/mruby/mrbgems/mruby-method/mrblib/unbound_method.rb +0 -9
  369. data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/.gitignore +0 -5
  370. data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/.travis.yml +0 -2
  371. data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/packtest.rb +0 -157
  372. data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/run_test.rb +0 -26
  373. data/ext/enterprise_script_service/mruby/mrbgems/mruby-random/src/mt19937ar.c +0 -224
  374. data/ext/enterprise_script_service/mruby/mrbgems/mruby-random/src/mt19937ar.h +0 -80
  375. data/ext/enterprise_script_service/mruby/mrbgems/mruby-random/src/random.h +0 -12
  376. data/ext/enterprise_script_service/mruby/mrbgems/mruby-sleep/.gitignore +0 -4
  377. data/ext/enterprise_script_service/mruby/mrbgems/mruby-sleep/.travis.yml +0 -29
  378. data/ext/enterprise_script_service/mruby/mrbgems/mruby-sleep/.travis_build_config.rb +0 -6
  379. data/ext/enterprise_script_service/mruby/mrbgems/mruby-sleep/Rakefile +0 -29
  380. data/ext/enterprise_script_service/mruby/mrbgems/mruby-socket/.travis.yml +0 -4
  381. data/ext/enterprise_script_service/mruby/mrbgems/mruby-socket/run_test.rb +0 -28
@@ -1,9 +1,7 @@
1
1
  ##
2
2
  # FileTest
3
3
 
4
- assert('FileTest TEST SETUP') do
5
- MRubyIOTestUtil.io_test_setup
6
- end
4
+ MRubyIOTestUtil.io_test_setup
7
5
 
8
6
  assert("FileTest.directory?") do
9
7
  dir = MRubyIOTestUtil.mkdtemp("mruby-io-test.XXXXXX")
@@ -22,9 +20,8 @@
22
20
  assert_equal true, FileTest.exist?(io), "io obj - exist"
23
21
  io.close
24
22
  assert_equal true, io.closed?
25
- assert_raise IOError do
26
- FileTest.exist?(io)
27
- end
23
+ assert_raise(IOError) { FileTest.exist?(io) }
24
+ assert_raise(TypeError) { File.exist?($mrbtest_io_rfname.to_sym) }
28
25
  end
29
26
 
30
27
  assert("FileTest.file?") do
@@ -112,6 +109,4 @@
112
109
  assert_true fp2.closed?
113
110
  end
114
111
 
115
- assert('FileTest TEST CLEANUP') do
116
- assert_nil MRubyIOTestUtil.io_test_cleanup
117
- end
112
+ MRubyIOTestUtil.io_test_cleanup
@@ -1,35 +1,46 @@
1
1
  ##
2
2
  # IO Test
3
3
 
4
- assert('IO TEST SETUP') do
5
- MRubyIOTestUtil.io_test_setup
6
- $cr = MRubyIOTestUtil.win? ? 1 : 0 # "\n" include CR or not
4
+ MRubyIOTestUtil.io_test_setup
5
+ $cr, $crlf, $cmd = MRubyIOTestUtil.win? ? [1, "\r\n", "cmd /c "] : [0, "\n", ""]
6
+
7
+ def assert_io_open(meth)
8
+ assert "assert_io_open" do
9
+ fd = IO.sysopen($mrbtest_io_rfname)
10
+ assert_equal Fixnum, fd.class
11
+ io1 = IO.__send__(meth, fd)
12
+ begin
13
+ assert_equal IO, io1.class
14
+ assert_equal $mrbtest_io_msg, io1.read
15
+ ensure
16
+ io1.close
17
+ end
18
+
19
+ io2 = IO.__send__(meth, IO.sysopen($mrbtest_io_rfname))do |io|
20
+ if meth == :open
21
+ assert_equal $mrbtest_io_msg, io.read
22
+ else
23
+ flunk "IO.#{meth} does not take block"
24
+ end
25
+ end
26
+ io2.close unless meth == :open
27
+ end
7
28
  end
8
29
 
9
- assert('IO', '15.2.20') do
30
+ assert('IO.class', '15.2.20') do
10
31
  assert_equal(Class, IO.class)
11
32
  end
12
33
 
13
- assert('IO', '15.2.20.2') do
34
+ assert('IO.superclass', '15.2.20.2') do
14
35
  assert_equal(Object, IO.superclass)
15
36
  end
16
37
 
17
- assert('IO', '15.2.20.3') do
38
+ assert('IO.ancestors', '15.2.20.3') do
18
39
  assert_include(IO.ancestors, Enumerable)
19
40
  end
20
41
 
21
42
  assert('IO.open', '15.2.20.4.1') do
22
- fd = IO.sysopen $mrbtest_io_rfname
23
- assert_equal Fixnum, fd.class
24
- io = IO.open fd
25
- assert_equal IO, io.class
26
- assert_equal $mrbtest_io_msg, io.read
27
- io.close
28
-
29
- fd = IO.sysopen $mrbtest_io_rfname
30
- IO.open(fd) do |io|
31
- assert_equal $mrbtest_io_msg, io.read
32
- end
43
+ assert_io_open(:open)
33
44
  end
34
45
 
35
46
  assert('IO#close', '15.2.20.5.1') do
@@ -84,7 +95,7 @@
84
95
 
85
96
  assert('IO#getc', '15.2.20.5.8') do
86
97
  io = IO.new(IO.sysopen($mrbtest_io_rfname))
87
- $mrbtest_io_msg.each_char { |ch|
98
+ $mrbtest_io_msg.split("").each { |ch|
88
99
  assert_equal ch, io.getc
89
100
  }
90
101
  assert_equal nil, io.getc
@@ -118,16 +129,17 @@
118
129
 
119
130
  assert "IO#read(n) with n > IO::BUF_SIZE" do
120
131
  skip "pipe is not supported on this platform" if MRubyIOTestUtil.win?
121
- r,w = IO.pipe
122
- n = IO::BUF_SIZE+1
123
- w.write 'a'*n
124
- assert_equal r.read(n), 'a'*n
132
+ IO.pipe do |r,w|
133
+ n = IO::BUF_SIZE+1
134
+ w.write 'a'*n
135
+ assert_equal 'a'*n, r.read(n)
136
+ end
125
137
  end
126
138
 
127
139
  assert('IO#readchar', '15.2.20.5.15') do
128
140
  # almost same as IO#getc
129
141
  IO.open(IO.sysopen($mrbtest_io_rfname)) do |io|
130
- $mrbtest_io_msg.each_char { |ch|
142
+ $mrbtest_io_msg.split("").each { |ch|
131
143
  assert_equal ch, io.readchar
132
144
  }
133
145
  assert_raise(EOFError) do
@@ -215,19 +227,15 @@
215
227
  end
216
228
 
217
229
  assert('IO.for_fd') do
218
- fd = IO.sysopen($mrbtest_io_rfname)
219
- io = IO.for_fd(fd)
220
- assert_equal $mrbtest_io_msg, io.read
221
- io.close
230
+ assert_io_open(:for_fd)
222
231
  end
223
232
 
224
233
  assert('IO.new') do
225
- io = IO.new(0)
226
- io.close
234
+ assert_io_open(:new)
227
235
  end
228
236
 
229
237
  assert('IO gc check') do
230
- 100.times { IO.new(0) }
238
+ assert_nothing_raised { 100.times { IO.new(0) } }
231
239
  end
232
240
 
233
241
  assert('IO.sysopen("./nonexistent")') do
@@ -419,7 +427,7 @@ def io._buf
419
427
  assert('IO.popen') do
420
428
  begin
421
429
  $? = nil
422
- io = IO.popen("echo mruby-io")
430
+ io = IO.popen("#{$cmd}echo mruby-io")
423
431
  assert_true io.close_on_exec?
424
432
  assert_equal Fixnum, io.pid.class
425
433
 
@@ -598,12 +606,10 @@ def io._buf
598
606
 
599
607
  assert('`cmd`') do
600
608
  begin
601
- assert_equal `echo foo`, "foo\n"
609
+ assert_equal `#{$cmd}echo foo`, "foo#{$crlf}"
602
610
  rescue NotImplementedError => e
603
611
  skip e.message
604
612
  end
605
613
  end
606
614
 
607
- assert('IO TEST CLEANUP') do
608
- assert_nil MRubyIOTestUtil.io_test_cleanup
609
- end
615
+ MRubyIOTestUtil.io_test_cleanup
@@ -136,9 +136,9 @@ mrb_io_test_io_setup(mrb_state *mrb, mrb_value self)
136
136
  sun0.sun_family = AF_UNIX;
137
137
  snprintf(sun0.sun_path, sizeof(sun0.sun_path), "%s", socketname);
138
138
  if (bind(fd3, (struct sockaddr *)&sun0, sizeof(sun0)) == -1) {
139
- mrb_raisef(mrb, E_RUNTIME_ERROR, "can't bind AF_UNIX socket to %S: %S",
140
- mrb_str_new_cstr(mrb, sun0.sun_path),
141
- mrb_fixnum_value(errno));
139
+ mrb_raisef(mrb, E_RUNTIME_ERROR, "can't bind AF_UNIX socket to %s: %d",
140
+ sun0.sun_path,
141
+ errno);
142
142
  }
143
143
  close(fd3);
144
144
  #endif
@@ -154,16 +154,16 @@ mrb_io_test_io_cleanup(mrb_state *mrb, mrb_value self)
154
154
  mrb_value symlinkname = mrb_gv_get(mrb, mrb_intern_cstr(mrb, "$mrbtest_io_symlinkname"));
155
155
  mrb_value socketname = mrb_gv_get(mrb, mrb_intern_cstr(mrb, "$mrbtest_io_socketname"));
156
156
 
157
- if (mrb_type(rfname) == MRB_TT_STRING) {
157
+ if (mrb_string_p(rfname)) {
158
158
  remove(RSTRING_PTR(rfname));
159
159
  }
160
- if (mrb_type(wfname) == MRB_TT_STRING) {
160
+ if (mrb_string_p(wfname)) {
161
161
  remove(RSTRING_PTR(wfname));
162
162
  }
163
- if (mrb_type(symlinkname) == MRB_TT_STRING) {
163
+ if (mrb_string_p(symlinkname)) {
164
164
  remove(RSTRING_PTR(symlinkname));
165
165
  }
166
- if (mrb_type(socketname) == MRB_TT_STRING) {
166
+ if (mrb_string_p(socketname)) {
167
167
  remove(RSTRING_PTR(socketname));
168
168
  }
169
169
 
@@ -176,28 +176,6 @@ mrb_io_test_io_cleanup(mrb_state *mrb, mrb_value self)
176
176
  return mrb_nil_value();
177
177
  }
178
178
 
179
- static mrb_value
180
- mrb_io_test_file_setup(mrb_state *mrb, mrb_value self)
181
- {
182
- mrb_value ary = mrb_io_test_io_setup(mrb, self);
183
- #if !defined(_WIN32) && !defined(_WIN64)
184
- if (symlink("/usr/bin", "test-bin") == -1) {
185
- mrb_raise(mrb, E_RUNTIME_ERROR, "can't make a symbolic link");
186
- }
187
- #endif
188
-
189
- return ary;
190
- }
191
-
192
- static mrb_value
193
- mrb_io_test_file_cleanup(mrb_state *mrb, mrb_value self)
194
- {
195
- mrb_io_test_io_cleanup(mrb, self);
196
- remove("test-bin");
197
-
198
- return mrb_nil_value();
199
- }
200
-
201
179
  static mrb_value
202
180
  mrb_io_test_mkdtemp(mrb_state *mrb, mrb_value klass)
203
181
  {
@@ -215,11 +193,9 @@ mrb_io_test_mkdtemp(mrb_state *mrb, mrb_value klass)
215
193
  static mrb_value
216
194
  mrb_io_test_rmdir(mrb_state *mrb, mrb_value klass)
217
195
  {
218
- mrb_value str;
219
- char *cp;
196
+ const char *cp;
220
197
 
221
- mrb_get_args(mrb, "S", &str);
222
- cp = mrb_str_to_cstr(mrb, str);
198
+ mrb_get_args(mrb, "z", &cp);
223
199
  if (rmdir(cp) == -1) {
224
200
  mrb_sys_fail(mrb, "rmdir");
225
201
  }
@@ -247,9 +223,6 @@ mrb_mruby_io_gem_test(mrb_state* mrb)
247
223
  mrb_define_class_method(mrb, io_test, "io_test_setup", mrb_io_test_io_setup, MRB_ARGS_NONE());
248
224
  mrb_define_class_method(mrb, io_test, "io_test_cleanup", mrb_io_test_io_cleanup, MRB_ARGS_NONE());
249
225
 
250
- mrb_define_class_method(mrb, io_test, "file_test_setup", mrb_io_test_file_setup, MRB_ARGS_NONE());
251
- mrb_define_class_method(mrb, io_test, "file_test_cleanup", mrb_io_test_file_cleanup, MRB_ARGS_NONE());
252
-
253
226
  mrb_define_class_method(mrb, io_test, "mkdtemp", mrb_io_test_mkdtemp, MRB_ARGS_REQ(1));
254
227
  mrb_define_class_method(mrb, io_test, "rmdir", mrb_io_test_rmdir, MRB_ARGS_REQ(1));
255
228
  mrb_define_class_method(mrb, io_test, "win?", mrb_io_win_p, MRB_ARGS_NONE());
@@ -1,5 +1,5 @@
1
1
  MRuby::Gem::Specification.new('mruby-kernel-ext') do |spec|
2
2
  spec.license = 'MIT'
3
3
  spec.author = 'mruby developers'
4
- spec.summary = 'Kernel module extension'
4
+ spec.summary = 'extensional function-like methods'
5
5
  end
@@ -20,9 +20,9 @@ mrb_f_caller(mrb_state *mrb, mrb_value self)
20
20
  n = bt_len - lev;
21
21
  break;
22
22
  case 1:
23
- if (mrb_type(v) == MRB_TT_RANGE) {
23
+ if (mrb_range_p(v)) {
24
24
  mrb_int beg, len;
25
- if (mrb_range_beg_len(mrb, v, &beg, &len, bt_len, TRUE) == 1) {
25
+ if (mrb_range_beg_len(mrb, v, &beg, &len, bt_len, TRUE) == MRB_RANGE_OK) {
26
26
  lev = beg;
27
27
  n = len;
28
28
  }
@@ -31,22 +31,21 @@ mrb_f_caller(mrb_state *mrb, mrb_value self)
31
31
  }
32
32
  }
33
33
  else {
34
- v = mrb_to_int(mrb, v);
35
- lev = mrb_fixnum(v);
34
+ lev = mrb_int(mrb, v);
36
35
  if (lev < 0) {
37
- mrb_raisef(mrb, E_ARGUMENT_ERROR, "negative level (%S)", v);
36
+ mrb_raisef(mrb, E_ARGUMENT_ERROR, "negative level (%v)", v);
38
37
  }
39
38
  n = bt_len - lev;
40
39
  }
41
40
  break;
42
41
  case 2:
43
- lev = mrb_fixnum(mrb_to_int(mrb, v));
44
- n = mrb_fixnum(mrb_to_int(mrb, length));
42
+ lev = mrb_int(mrb, v);
43
+ n = mrb_int(mrb, length);
45
44
  if (lev < 0) {
46
- mrb_raisef(mrb, E_ARGUMENT_ERROR, "negative level (%S)", v);
45
+ mrb_raisef(mrb, E_ARGUMENT_ERROR, "negative level (%v)", v);
47
46
  }
48
47
  if (n < 0) {
49
- mrb_raisef(mrb, E_ARGUMENT_ERROR, "negative size (%S)", length);
48
+ mrb_raisef(mrb, E_ARGUMENT_ERROR, "negative size (%v)", length);
50
49
  }
51
50
  break;
52
51
  default:
@@ -206,22 +205,6 @@ mrb_f_hash(mrb_state *mrb, mrb_value self)
206
205
  return mrb_ensure_hash_type(mrb, arg);
207
206
  }
208
207
 
209
- /*
210
- * call-seq:
211
- * obj.itself -> an_object
212
- *
213
- * Returns <i>obj</i>.
214
- *
215
- * string = 'my string' #=> "my string"
216
- * string.itself.object_id == string.object_id #=> true
217
- *
218
- */
219
- static mrb_value
220
- mrb_f_itself(mrb_state *mrb, mrb_value self)
221
- {
222
- return self;
223
- }
224
-
225
208
  void
226
209
  mrb_mruby_kernel_ext_gem_init(mrb_state *mrb)
227
210
  {
@@ -230,14 +213,13 @@ mrb_mruby_kernel_ext_gem_init(mrb_state *mrb)
230
213
  mrb_define_module_function(mrb, krn, "fail", mrb_f_raise, MRB_ARGS_OPT(2));
231
214
  mrb_define_module_function(mrb, krn, "caller", mrb_f_caller, MRB_ARGS_OPT(2));
232
215
  mrb_define_method(mrb, krn, "__method__", mrb_f_method, MRB_ARGS_NONE());
233
- mrb_define_module_function(mrb, krn, "Integer", mrb_f_integer, MRB_ARGS_ANY());
216
+ mrb_define_module_function(mrb, krn, "Integer", mrb_f_integer, MRB_ARGS_ARG(1,1));
234
217
  #ifndef MRB_WITHOUT_FLOAT
235
218
  mrb_define_module_function(mrb, krn, "Float", mrb_f_float, MRB_ARGS_REQ(1));
236
219
  #endif
237
220
  mrb_define_module_function(mrb, krn, "String", mrb_f_string, MRB_ARGS_REQ(1));
238
221
  mrb_define_module_function(mrb, krn, "Array", mrb_f_array, MRB_ARGS_REQ(1));
239
222
  mrb_define_module_function(mrb, krn, "Hash", mrb_f_hash, MRB_ARGS_REQ(1));
240
- mrb_define_module_function(mrb, krn, "itself", mrb_f_itself, MRB_ARGS_NONE());
241
223
  }
242
224
 
243
225
  void
@@ -65,6 +65,8 @@ def baz(*args)
65
65
  assert_equal(123.456, Float(123.456))
66
66
  assert_equal(123.456, Float("123.456"))
67
67
  assert_raise(TypeError) { Float(nil) }
68
+ assert_raise(ArgumentError) { Float("1.5a") }
69
+ assert_raise(ArgumentError) { Float("1.5\0") }
68
70
  end
69
71
 
70
72
  assert('Kernel#String') do
@@ -4,6 +4,10 @@
4
4
  ** See Copyright Notice in mruby.h
5
5
  */
6
6
 
7
+ #ifdef MRB_WITHOUT_FLOAT
8
+ # error Math conflicts 'MRB_WITHOUT_FLOAT' configuration in your 'build_config.rb'
9
+ #endif
10
+
7
11
  #include <mruby.h>
8
12
  #include <mruby/array.h>
9
13
 
@@ -14,8 +18,7 @@ domain_error(mrb_state *mrb, const char *func)
14
18
  {
15
19
  struct RClass *math = mrb_module_get(mrb, "Math");
16
20
  struct RClass *domainerror = mrb_class_get_under(mrb, math, "DomainError");
17
- mrb_value str = mrb_str_new_cstr(mrb, func);
18
- mrb_raisef(mrb, domainerror, "Numerical argument is out of domain - %S", str);
21
+ mrb_raisef(mrb, domainerror, "Numerical argument is out of domain - %s", func);
19
22
  }
20
23
 
21
24
  /* math functions not provided by Microsoft Visual C++ 2012 or older */
@@ -117,6 +117,7 @@ mrb_obj_ivar_set(mrb_state *mrb, mrb_value self)
117
117
  }
118
118
 
119
119
  /* 15.3.1.2.7 */
120
+ /* 15.3.1.3.28 */
120
121
  /*
121
122
  * call-seq:
122
123
  * local_variables -> array
@@ -149,7 +150,7 @@ mrb_local_variables(mrb_state *mrb, mrb_value self)
149
150
  for (i = 0; i + 1 < irep->nlocals; ++i) {
150
151
  if (irep->lv[i].name) {
151
152
  mrb_sym sym = irep->lv[i].name;
152
- const char *name = mrb_sym2name(mrb, sym);
153
+ const char *name = mrb_sym_name(mrb, sym);
153
154
  switch (name[0]) {
154
155
  case '*': case '&':
155
156
  break;
@@ -186,7 +187,7 @@ method_entry_loop(mrb_state *mrb, struct RClass* klass, khash_t(st)* set)
186
187
  }
187
188
  }
188
189
 
189
- mrb_value
190
+ static mrb_value
190
191
  mrb_class_instance_method_list(mrb_state *mrb, mrb_bool recur, struct RClass* klass, int obj)
191
192
  {
192
193
  khint_t i;
@@ -388,10 +389,7 @@ mod_define_singleton_method(mrb_state *mrb, mrb_value self)
388
389
  mrb_sym mid;
389
390
  mrb_value blk = mrb_nil_value();
390
391
 
391
- mrb_get_args(mrb, "n&", &mid, &blk);
392
- if (mrb_nil_p(blk)) {
393
- mrb_raise(mrb, E_ARGUMENT_ERROR, "no block given");
394
- }
392
+ mrb_get_args(mrb, "n&!", &mid, &blk);
395
393
  p = (struct RProc*)mrb_obj_alloc(mrb, MRB_TT_PROC, mrb->proc_class);
396
394
  mrb_proc_copy(p, mrb_proc_ptr(blk));
397
395
  p->flags |= MRB_PROC_STRICT;
@@ -411,9 +409,9 @@ static void
411
409
  check_cv_name_sym(mrb_state *mrb, mrb_sym id)
412
410
  {
413
411
  mrb_int len;
414
- const char *name = mrb_sym2name_len(mrb, id, &len);
412
+ const char *name = mrb_sym_name_len(mrb, id, &len);
415
413
  if (!cv_name_p(mrb, name, len)) {
416
- mrb_name_error(mrb, id, "'%S' is not allowed as a class variable name", mrb_sym2str(mrb, id));
414
+ mrb_name_error(mrb, id, "'%n' is not allowed as a class variable name", id);
417
415
  }
418
416
  }
419
417
 
@@ -453,12 +451,10 @@ mrb_mod_remove_cvar(mrb_state *mrb, mrb_value mod)
453
451
  if (!mrb_undef_p(val)) return val;
454
452
 
455
453
  if (mrb_cv_defined(mrb, mod, id)) {
456
- mrb_name_error(mrb, id, "cannot remove %S for %S",
457
- mrb_sym2str(mrb, id), mod);
454
+ mrb_name_error(mrb, id, "cannot remove %n for %v", id, mod);
458
455
  }
459
456
 
460
- mrb_name_error(mrb, id, "class variable %S not defined for %S",
461
- mrb_sym2str(mrb, id), mod);
457
+ mrb_name_error(mrb, id, "class variable %n not defined for %v", id, mod);
462
458
 
463
459
  /* not reached */
464
460
  return mrb_nil_value();
@@ -565,8 +561,6 @@ mrb_mod_included_modules(mrb_state *mrb, mrb_value self)
565
561
  return result;
566
562
  }
567
563
 
568
- mrb_value mrb_class_instance_method_list(mrb_state*, mrb_bool, struct RClass*, int);
569
-
570
564
  /* 15.2.2.4.33 */
571
565
  /*
572
566
  * call-seq:
@@ -623,8 +617,7 @@ remove_method(mrb_state *mrb, mrb_value mod, mrb_sym mid)
623
617
  }
624
618
  }
625
619
 
626
- mrb_name_error(mrb, mid, "method '%S' not defined in %S",
627
- mrb_sym2str(mrb, mid), mod);
620
+ mrb_name_error(mrb, mid, "method '%n' not defined in %v", mid, mod);
628
621
  }
629
622
 
630
623
  /* 15.2.2.4.41 */
@@ -643,6 +636,7 @@ mrb_mod_remove_method(mrb_state *mrb, mrb_value mod)
643
636
  mrb_value *argv;
644
637
 
645
638
  mrb_get_args(mrb, "*", &argv, &argc);
639
+ mrb_check_frozen(mrb, mrb_obj_ptr(mod));
646
640
  while (argc--) {
647
641
  remove_method(mrb, mod, mrb_obj_to_sym(mrb, *argv));
648
642
  argv++;
@@ -657,8 +651,29 @@ mrb_mod_s_constants(mrb_state *mrb, mrb_value mod)
657
651
  return mrb_nil_value(); /* not reached */
658
652
  }
659
653
 
660
- /* implementation of Module.nesting */
661
- mrb_value mrb_mod_s_nesting(mrb_state*, mrb_value);
654
+ static mrb_value
655
+ mrb_mod_s_nesting(mrb_state *mrb, mrb_value mod)
656
+ {
657
+ struct RProc *proc;
658
+ mrb_value ary;
659
+ struct RClass *c = NULL;
660
+
661
+ ary = mrb_ary_new(mrb);
662
+ proc = mrb->c->ci[-1].proc; /* callee proc */
663
+ mrb_assert(!MRB_PROC_CFUNC_P(proc));
664
+ while (proc) {
665
+ if (MRB_PROC_SCOPE_P(proc)) {
666
+ struct RClass *c2 = MRB_PROC_TARGET_CLASS(proc);
667
+
668
+ if (c2 != c) {
669
+ c = c2;
670
+ mrb_ary_push(mrb, ary, mrb_obj_value(c));
671
+ }
672
+ }
673
+ proc = proc->upper;
674
+ }
675
+ return ary;
676
+ }
662
677
 
663
678
  void
664
679
  mrb_mruby_metaprog_gem_init(mrb_state* mrb)
@@ -666,8 +681,8 @@ mrb_mruby_metaprog_gem_init(mrb_state* mrb)
666
681
  struct RClass *krn = mrb->kernel_module;
667
682
  struct RClass *mod = mrb->module_class;
668
683
 
669
- mrb_define_method(mrb, krn, "global_variables", mrb_f_global_variables, MRB_ARGS_NONE()); /* 15.3.1.2.4 */
670
- mrb_define_method(mrb, krn, "local_variables", mrb_local_variables, MRB_ARGS_NONE()); /* 15.3.1.3.28 */
684
+ mrb_define_method(mrb, krn, "global_variables", mrb_f_global_variables, MRB_ARGS_NONE()); /* 15.3.1.3.14 (15.3.1.2.4) */
685
+ mrb_define_method(mrb, krn, "local_variables", mrb_local_variables, MRB_ARGS_NONE()); /* 15.3.1.3.28 (15.3.1.2.7) */
671
686
 
672
687
  mrb_define_method(mrb, krn, "singleton_class", mrb_singleton_class, MRB_ARGS_NONE());
673
688
  mrb_define_method(mrb, krn, "instance_variable_defined?", mrb_obj_ivar_defined, MRB_ARGS_REQ(1)); /* 15.3.1.3.20 */
@@ -679,10 +694,10 @@ mrb_mruby_metaprog_gem_init(mrb_state* mrb)
679
694
  mrb_define_method(mrb, krn, "protected_methods", mrb_obj_protected_methods, MRB_ARGS_OPT(1)); /* 15.3.1.3.37 */
680
695
  mrb_define_method(mrb, krn, "public_methods", mrb_obj_public_methods, MRB_ARGS_OPT(1)); /* 15.3.1.3.38 */
681
696
  mrb_define_method(mrb, krn, "singleton_methods", mrb_obj_singleton_methods_m, MRB_ARGS_OPT(1)); /* 15.3.1.3.45 */
682
- mrb_define_method(mrb, krn, "define_singleton_method", mod_define_singleton_method, MRB_ARGS_ANY());
683
- mrb_define_method(mrb, krn, "send", mrb_f_send, MRB_ARGS_ANY()); /* 15.3.1.3.44 */
697
+ mrb_define_method(mrb, krn, "define_singleton_method", mod_define_singleton_method, MRB_ARGS_REQ(1)|MRB_ARGS_BLOCK());
698
+ mrb_define_method(mrb, krn, "send", mrb_f_send, MRB_ARGS_REQ(1)|MRB_ARGS_REST()|MRB_ARGS_BLOCK()); /* 15.3.1.3.44 */
684
699
 
685
- mrb_define_method(mrb, mod, "class_variables", mrb_mod_class_variables, MRB_ARGS_NONE()); /* 15.2.2.4.19 */
700
+ mrb_define_method(mrb, mod, "class_variables", mrb_mod_class_variables, MRB_ARGS_OPT(1)); /* 15.2.2.4.19 */
686
701
  mrb_define_method(mrb, mod, "remove_class_variable", mrb_mod_remove_cvar, MRB_ARGS_REQ(1)); /* 15.2.2.4.39 */
687
702
  mrb_define_method(mrb, mod, "class_variable_defined?", mrb_mod_cvar_defined, MRB_ARGS_REQ(1)); /* 15.2.2.4.16 */
688
703
  mrb_define_method(mrb, mod, "class_variable_get", mrb_mod_cvar_get, MRB_ARGS_REQ(1)); /* 15.2.2.4.17 */
@@ -693,7 +708,7 @@ mrb_mruby_metaprog_gem_init(mrb_state* mrb)
693
708
  mrb_define_method(mrb, mod, "method_removed", mrb_f_nil, MRB_ARGS_REQ(1));
694
709
  mrb_define_method(mrb, mod, "constants", mrb_mod_constants, MRB_ARGS_OPT(1)); /* 15.2.2.4.24 */
695
710
  mrb_define_class_method(mrb, mod, "constants", mrb_mod_s_constants, MRB_ARGS_ANY()); /* 15.2.2.3.1 */
696
- mrb_define_class_method(mrb, mod, "nesting", mrb_mod_s_nesting, MRB_ARGS_REQ(0)); /* 15.2.2.3.2 */
711
+ mrb_define_class_method(mrb, mod, "nesting", mrb_mod_s_nesting, MRB_ARGS_NONE()); /* 15.2.2.3.2 */
697
712
  }
698
713
 
699
714
  void