script_core 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (224) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +7 -1
  3. data/ext/enterprise_script_service/libseccomp/.travis.yml +3 -5
  4. data/ext/enterprise_script_service/libseccomp/CHANGELOG +10 -0
  5. data/ext/enterprise_script_service/libseccomp/CREDITS +3 -0
  6. data/ext/enterprise_script_service/libseccomp/README.md +18 -0
  7. data/ext/enterprise_script_service/libseccomp/configure.ac +1 -1
  8. data/ext/enterprise_script_service/libseccomp/include/seccomp-syscalls.h +7 -0
  9. data/ext/enterprise_script_service/libseccomp/src/arch-s390-syscalls.c +16 -0
  10. data/ext/enterprise_script_service/libseccomp/src/arch-s390x-syscalls.c +16 -0
  11. data/ext/enterprise_script_service/libseccomp/tests/.gitignore +1 -0
  12. data/ext/enterprise_script_service/libseccomp/tests/15-basic-resolver.c +3 -3
  13. data/ext/enterprise_script_service/libseccomp/tests/52-basic-load.c +48 -0
  14. data/ext/enterprise_script_service/libseccomp/tests/52-basic-load.py +38 -0
  15. data/ext/enterprise_script_service/libseccomp/tests/52-basic-load.tests +11 -0
  16. data/ext/enterprise_script_service/libseccomp/tests/Makefile.am +6 -3
  17. data/ext/enterprise_script_service/libseccomp/tests/regression +4 -0
  18. data/ext/enterprise_script_service/libseccomp/tools/Makefile.am +0 -3
  19. data/ext/enterprise_script_service/libseccomp/tools/scmp_bpf_sim.c +2 -0
  20. data/ext/enterprise_script_service/mruby/.github/workflows/build.yml +106 -0
  21. data/ext/enterprise_script_service/mruby/.github/workflows/main.yml +24 -0
  22. data/ext/enterprise_script_service/mruby/.gitignore +3 -0
  23. data/ext/enterprise_script_service/mruby/.travis.yml +6 -9
  24. data/ext/enterprise_script_service/mruby/AUTHORS +1 -0
  25. data/ext/enterprise_script_service/mruby/Doxyfile +1 -1
  26. data/ext/enterprise_script_service/mruby/LICENSE +1 -1
  27. data/ext/enterprise_script_service/mruby/README.md +6 -2
  28. data/ext/enterprise_script_service/mruby/appveyor.yml +9 -12
  29. data/ext/enterprise_script_service/mruby/appveyor_config.rb +9 -0
  30. data/ext/enterprise_script_service/mruby/build_config.rb +6 -6
  31. data/ext/enterprise_script_service/mruby/doc/guides/compile.md +6 -2
  32. data/ext/enterprise_script_service/mruby/doc/guides/debugger.md +1 -1
  33. data/ext/enterprise_script_service/mruby/doc/guides/mrbconf.md +4 -8
  34. data/ext/enterprise_script_service/mruby/doc/limitations.md +10 -10
  35. data/ext/enterprise_script_service/mruby/doc/opcode.md +108 -95
  36. data/ext/enterprise_script_service/mruby/examples/targets/build_config_ArduinoDue.rb +2 -2
  37. data/ext/enterprise_script_service/mruby/examples/targets/build_config_IntelEdison.rb +2 -2
  38. data/ext/enterprise_script_service/mruby/examples/targets/build_config_IntelGalileo.rb +2 -2
  39. data/ext/enterprise_script_service/mruby/examples/targets/build_config_RX630.rb +2 -2
  40. data/ext/enterprise_script_service/mruby/examples/targets/build_config_chipKITMax32.rb +2 -2
  41. data/ext/enterprise_script_service/mruby/examples/targets/build_config_dreamcast_shelf.rb +108 -0
  42. data/ext/enterprise_script_service/mruby/include/mrbconf.h +10 -7
  43. data/ext/enterprise_script_service/mruby/include/mruby.h +11 -9
  44. data/ext/enterprise_script_service/mruby/include/mruby/array.h +4 -0
  45. data/ext/enterprise_script_service/mruby/include/mruby/boxing_nan.h +11 -2
  46. data/ext/enterprise_script_service/mruby/include/mruby/boxing_word.h +0 -9
  47. data/ext/enterprise_script_service/mruby/include/mruby/common.h +10 -0
  48. data/ext/enterprise_script_service/mruby/include/mruby/compile.h +11 -3
  49. data/ext/enterprise_script_service/mruby/include/mruby/dump.h +1 -17
  50. data/ext/enterprise_script_service/mruby/include/mruby/irep.h +10 -0
  51. data/ext/enterprise_script_service/mruby/include/mruby/istruct.h +4 -1
  52. data/ext/enterprise_script_service/mruby/include/mruby/khash.h +23 -5
  53. data/ext/enterprise_script_service/mruby/include/mruby/numeric.h +1 -0
  54. data/ext/enterprise_script_service/mruby/include/mruby/ops.h +3 -2
  55. data/ext/enterprise_script_service/mruby/include/mruby/string.h +2 -1
  56. data/ext/enterprise_script_service/mruby/include/mruby/value.h +7 -12
  57. data/ext/enterprise_script_service/mruby/include/mruby/version.h +4 -4
  58. data/ext/enterprise_script_service/mruby/lib/mruby/build.rb +2 -30
  59. data/ext/enterprise_script_service/mruby/lib/mruby/build/command.rb +21 -46
  60. data/ext/enterprise_script_service/mruby/lib/mruby/gem.rb +9 -0
  61. data/ext/enterprise_script_service/mruby/lib/mruby/source.rb +3 -1
  62. data/ext/enterprise_script_service/mruby/mrbgems/default.gembox +7 -0
  63. data/ext/enterprise_script_service/mruby/mrbgems/mruby-array-ext/mrblib/array.rb +0 -31
  64. data/ext/enterprise_script_service/mruby/mrbgems/mruby-array-ext/test/array.rb +0 -13
  65. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-config/mrbgem.rake +5 -2
  66. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.c +0 -1
  67. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/mrdbconf.h +5 -1
  68. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mirb/tools/mirb/mirb.c +5 -1
  69. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mrbc/tools/mrbc/mrbc.c +7 -11
  70. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mruby/mrbgem.rake +0 -1
  71. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c +6 -2
  72. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-strip/tools/mruby-strip/mruby-strip.c +6 -2
  73. data/ext/enterprise_script_service/mruby/mrbgems/mruby-class-ext/src/class.c +6 -1
  74. data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/codegen.c +76 -48
  75. data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/parse.y +107 -32
  76. data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/y.tab.c +13153 -0
  77. data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/mrbgem.rake +13 -15
  78. data/ext/enterprise_script_service/mruby/mrbgems/mruby-error/src/exception.c +3 -3
  79. data/ext/enterprise_script_service/mruby/mrbgems/mruby-eval/src/eval.c +2 -213
  80. data/ext/enterprise_script_service/mruby/mrbgems/mruby-eval/test/eval.rb +21 -0
  81. data/ext/enterprise_script_service/mruby/mrbgems/mruby-hash-ext/src/hash-ext.c +1 -3
  82. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/include/mruby/ext/io.h +39 -7
  83. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/mrbgem.rake +2 -8
  84. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/mrblib/file_constants.rb +0 -16
  85. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/mrblib/io.rb +7 -12
  86. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/src/file.c +76 -30
  87. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/src/file_test.c +9 -10
  88. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/src/io.c +323 -120
  89. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/test/file.rb +18 -12
  90. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/test/io.rb +32 -0
  91. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/test/mruby_io_test.c +57 -49
  92. data/ext/enterprise_script_service/mruby/mrbgems/mruby-metaprog/src/metaprog.c +15 -17
  93. data/ext/enterprise_script_service/mruby/mrbgems/mruby-metaprog/test/metaprog.rb +9 -0
  94. data/ext/enterprise_script_service/mruby/mrbgems/mruby-method/src/method.c +1 -1
  95. data/ext/enterprise_script_service/mruby/mrbgems/mruby-object-ext/src/object.c +3 -12
  96. data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/src/pack.c +113 -10
  97. data/ext/enterprise_script_service/mruby/mrbgems/mruby-print/src/print.c +5 -1
  98. data/ext/enterprise_script_service/mruby/mrbgems/mruby-proc-ext/src/proc.c +2 -2
  99. data/ext/enterprise_script_service/mruby/mrbgems/mruby-rational/src/rational.c +9 -9
  100. data/ext/enterprise_script_service/mruby/mrbgems/mruby-sleep/src/mrb_sleep.c +1 -1
  101. data/ext/enterprise_script_service/mruby/mrbgems/mruby-socket/mrbgem.rake +1 -1
  102. data/ext/enterprise_script_service/mruby/mrbgems/mruby-socket/test/sockettest.c +3 -2
  103. data/ext/enterprise_script_service/mruby/mrbgems/mruby-sprintf/src/sprintf.c +61 -24
  104. data/ext/enterprise_script_service/mruby/mrbgems/mruby-sprintf/test/sprintf.rb +5 -23
  105. data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/src/string.c +3 -3
  106. data/ext/enterprise_script_service/mruby/mrbgems/mruby-symbol-ext/src/symbol.c +1 -1
  107. data/ext/enterprise_script_service/mruby/mrbgems/mruby-test/mrbgem.rake +1 -0
  108. data/ext/enterprise_script_service/mruby/mrbgems/mruby-time/src/time.c +6 -5
  109. data/ext/enterprise_script_service/mruby/mrblib/hash.rb +3 -3
  110. data/ext/enterprise_script_service/mruby/src/array.c +11 -0
  111. data/ext/enterprise_script_service/mruby/src/backtrace.c +2 -2
  112. data/ext/enterprise_script_service/mruby/src/class.c +26 -11
  113. data/ext/enterprise_script_service/mruby/src/codedump.c +4 -0
  114. data/ext/enterprise_script_service/mruby/src/debug.c +8 -5
  115. data/ext/enterprise_script_service/mruby/src/dump.c +3 -65
  116. data/ext/enterprise_script_service/mruby/src/error.c +57 -5
  117. data/ext/enterprise_script_service/mruby/src/etc.c +13 -4
  118. data/ext/enterprise_script_service/mruby/src/fmt_fp.c +98 -21
  119. data/ext/enterprise_script_service/mruby/src/gc.c +10 -275
  120. data/ext/enterprise_script_service/mruby/src/hash.c +5 -6
  121. data/ext/enterprise_script_service/mruby/src/kernel.c +2 -2
  122. data/ext/enterprise_script_service/mruby/src/load.c +56 -30
  123. data/ext/enterprise_script_service/mruby/src/numeric.c +22 -10
  124. data/ext/enterprise_script_service/mruby/src/object.c +12 -4
  125. data/ext/enterprise_script_service/mruby/src/print.c +27 -3
  126. data/ext/enterprise_script_service/mruby/src/proc.c +21 -1
  127. data/ext/enterprise_script_service/mruby/src/state.c +34 -11
  128. data/ext/enterprise_script_service/mruby/src/string.c +69 -35
  129. data/ext/enterprise_script_service/mruby/src/symbol.c +12 -10
  130. data/ext/enterprise_script_service/mruby/src/vm.c +21 -30
  131. data/ext/enterprise_script_service/mruby/tasks/gitlab.rake +19 -22
  132. data/ext/enterprise_script_service/mruby/tasks/mrbgems.rake +1 -1
  133. data/ext/enterprise_script_service/mruby/tasks/toolchains/android.rake +46 -1
  134. data/ext/enterprise_script_service/mruby/tasks/toolchains/gcc.rake +3 -3
  135. data/ext/enterprise_script_service/mruby/tasks/toolchains/openwrt.rake +6 -6
  136. data/ext/enterprise_script_service/mruby/tasks/toolchains/visualcpp.rake +8 -8
  137. data/ext/enterprise_script_service/mruby/test/assert.rb +5 -4
  138. data/ext/enterprise_script_service/mruby/test/t/ensure.rb +8 -26
  139. data/ext/enterprise_script_service/mruby/test/t/exception.rb +2 -2
  140. data/ext/enterprise_script_service/mruby/test/t/kernel.rb +8 -24
  141. data/ext/enterprise_script_service/mruby/travis_config.rb +0 -14
  142. data/ext/enterprise_script_service/msgpack/.github/depends/boost.sh +56 -0
  143. data/ext/enterprise_script_service/msgpack/.github/workflows/coverage.yml +62 -0
  144. data/ext/enterprise_script_service/msgpack/.github/workflows/gha.yml +304 -0
  145. data/ext/enterprise_script_service/msgpack/CHANGELOG.md +11 -0
  146. data/ext/enterprise_script_service/msgpack/CMakeLists.txt +82 -39
  147. data/ext/enterprise_script_service/msgpack/Files.cmake +22 -12
  148. data/ext/enterprise_script_service/msgpack/QUICKSTART-C.md +26 -29
  149. data/ext/enterprise_script_service/msgpack/README.md +3 -2
  150. data/ext/enterprise_script_service/msgpack/appveyor.yml +6 -2
  151. data/ext/enterprise_script_service/msgpack/ci/build_cmake.sh +3 -1
  152. data/ext/enterprise_script_service/msgpack/cmake/CodeCoverage.cmake +55 -0
  153. data/ext/enterprise_script_service/msgpack/codecov.yml +36 -0
  154. data/ext/enterprise_script_service/msgpack/example/CMakeLists.txt +9 -5
  155. data/ext/enterprise_script_service/msgpack/example/boost/CMakeLists.txt +1 -1
  156. data/ext/enterprise_script_service/msgpack/example/c/CMakeLists.txt +17 -6
  157. data/ext/enterprise_script_service/msgpack/example/c/boundary.c +296 -0
  158. data/ext/enterprise_script_service/msgpack/example/c/jsonconv.c +419 -0
  159. data/ext/enterprise_script_service/msgpack/example/c/simple_c.c +1 -1
  160. data/ext/enterprise_script_service/msgpack/example/cpp03/CMakeLists.txt +3 -3
  161. data/ext/enterprise_script_service/msgpack/example/cpp11/CMakeLists.txt +2 -2
  162. data/ext/enterprise_script_service/msgpack/example/x3/CMakeLists.txt +2 -2
  163. data/ext/enterprise_script_service/msgpack/include/msgpack/pack.h +24 -1
  164. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/array_ref.hpp +5 -4
  165. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/boost/optional.hpp +4 -4
  166. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/cpp17/vector_byte.hpp +8 -8
  167. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/map.hpp +4 -4
  168. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/vector.hpp +4 -4
  169. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/vector_char.hpp +8 -8
  170. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/vector_unsigned_char.hpp +8 -8
  171. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/wstring.hpp +4 -4
  172. data/ext/enterprise_script_service/msgpack/include/msgpack/v3/unpack.hpp +6 -6
  173. data/ext/enterprise_script_service/msgpack/include/msgpack/version_master.h +2 -2
  174. data/ext/enterprise_script_service/msgpack/include/msgpack/zbuffer.h +4 -4
  175. data/ext/enterprise_script_service/msgpack/make_file_list.sh +38 -11
  176. data/ext/enterprise_script_service/msgpack/src/vrefbuffer.c +6 -0
  177. data/ext/enterprise_script_service/msgpack/test/CMakeLists.txt +86 -64
  178. data/ext/enterprise_script_service/msgpack/test/array_ref.cpp +4 -0
  179. data/ext/enterprise_script_service/msgpack/test/boost_fusion.cpp +4 -0
  180. data/ext/enterprise_script_service/msgpack/test/boost_optional.cpp +4 -0
  181. data/ext/enterprise_script_service/msgpack/test/boost_string_ref.cpp +4 -1
  182. data/ext/enterprise_script_service/msgpack/test/boost_string_view.cpp +4 -0
  183. data/ext/enterprise_script_service/msgpack/test/boost_variant.cpp +4 -0
  184. data/ext/enterprise_script_service/msgpack/test/buffer.cpp +4 -47
  185. data/ext/enterprise_script_service/msgpack/test/buffer_c.cpp +148 -0
  186. data/ext/enterprise_script_service/msgpack/test/carray.cpp +4 -0
  187. data/ext/enterprise_script_service/msgpack/test/cases.cpp +8 -4
  188. data/ext/enterprise_script_service/msgpack/test/convert.cpp +8 -4
  189. data/ext/enterprise_script_service/msgpack/test/fixint.cpp +4 -0
  190. data/ext/enterprise_script_service/msgpack/test/fixint_c.cpp +4 -0
  191. data/ext/enterprise_script_service/msgpack/test/fuzz_unpack_pack_fuzzer_cpp11.cpp +4 -0
  192. data/ext/enterprise_script_service/msgpack/test/iterator_cpp11.cpp +4 -0
  193. data/ext/enterprise_script_service/msgpack/test/json.cpp +4 -0
  194. data/ext/enterprise_script_service/msgpack/test/limit.cpp +8 -4
  195. data/ext/enterprise_script_service/msgpack/test/msgpack_basic.cpp +4 -0
  196. data/ext/enterprise_script_service/msgpack/test/msgpack_c.cpp +159 -0
  197. data/ext/enterprise_script_service/msgpack/test/msgpack_container.cpp +4 -0
  198. data/ext/enterprise_script_service/msgpack/test/msgpack_cpp11.cpp +32 -27
  199. data/ext/enterprise_script_service/msgpack/test/msgpack_cpp17.cpp +4 -0
  200. data/ext/enterprise_script_service/msgpack/test/msgpack_stream.cpp +4 -0
  201. data/ext/enterprise_script_service/msgpack/test/msgpack_tuple.cpp +4 -1
  202. data/ext/enterprise_script_service/msgpack/test/msgpack_vref.cpp +4 -0
  203. data/ext/enterprise_script_service/msgpack/test/msgpack_x3_parse.cpp +4 -0
  204. data/ext/enterprise_script_service/msgpack/test/object.cpp +4 -1
  205. data/ext/enterprise_script_service/msgpack/test/object_with_zone.cpp +12 -8
  206. data/ext/enterprise_script_service/msgpack/test/pack_unpack.cpp +30 -26
  207. data/ext/enterprise_script_service/msgpack/test/pack_unpack_c.cpp +4 -0
  208. data/ext/enterprise_script_service/msgpack/test/raw.cpp +4 -0
  209. data/ext/enterprise_script_service/msgpack/test/reference.cpp +4 -0
  210. data/ext/enterprise_script_service/msgpack/test/reference_cpp11.cpp +4 -0
  211. data/ext/enterprise_script_service/msgpack/test/reference_wrapper_cpp11.cpp +4 -0
  212. data/ext/enterprise_script_service/msgpack/test/shared_ptr_cpp11.cpp +4 -0
  213. data/ext/enterprise_script_service/msgpack/test/size_equal_only.cpp +4 -0
  214. data/ext/enterprise_script_service/msgpack/test/streaming.cpp +8 -4
  215. data/ext/enterprise_script_service/msgpack/test/streaming_c.cpp +4 -0
  216. data/ext/enterprise_script_service/msgpack/test/unique_ptr_cpp11.cpp +4 -0
  217. data/ext/enterprise_script_service/msgpack/test/user_class.cpp +16 -12
  218. data/ext/enterprise_script_service/msgpack/test/version.cpp +4 -0
  219. data/ext/enterprise_script_service/msgpack/test/visitor.cpp +4 -0
  220. data/ext/enterprise_script_service/msgpack/test/zone.cpp +4 -0
  221. data/lib/script_core/version.rb +1 -1
  222. data/script_core.gemspec +1 -1
  223. metadata +23 -9
  224. data/ext/enterprise_script_service/msgpack/.travis.yml +0 -258
@@ -48,14 +48,14 @@ sym_validate_len(mrb_state *mrb, size_t len)
48
48
  static const char pack_table[] = "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
49
49
 
50
50
  static mrb_sym
51
- sym_inline_pack(const char *name, uint16_t len)
51
+ sym_inline_pack(const char *name, size_t len)
52
52
  {
53
- const int lower_length_max = (MRB_SYMBOL_BIT - 2) / 5;
54
- const int mix_length_max = (MRB_SYMBOL_BIT - 2) / 6;
53
+ const size_t lower_length_max = (MRB_SYMBOL_BIT - 2) / 5;
54
+ const size_t mix_length_max = (MRB_SYMBOL_BIT - 2) / 6;
55
55
 
56
56
  char c;
57
57
  const char *p;
58
- int i;
58
+ size_t i;
59
59
  mrb_sym sym = 0;
60
60
  mrb_bool lower = TRUE;
61
61
 
@@ -124,7 +124,7 @@ symhash(const char *key, size_t len)
124
124
  }
125
125
 
126
126
  static mrb_sym
127
- find_symbol(mrb_state *mrb, const char *name, uint16_t len, uint8_t *hashp)
127
+ find_symbol(mrb_state *mrb, const char *name, size_t len, uint8_t *hashp)
128
128
  {
129
129
  mrb_sym i;
130
130
  symbol_name *sname;
@@ -172,11 +172,13 @@ sym_intern(mrb_state *mrb, const char *name, size_t len, mrb_bool lit)
172
172
  if (sym > 0) return sym;
173
173
 
174
174
  /* registering a new symbol */
175
- sym = ++mrb->symidx;
175
+ sym = mrb->symidx + 1;
176
176
  if (mrb->symcapa < sym) {
177
- if (mrb->symcapa == 0) mrb->symcapa = 100;
178
- else mrb->symcapa = (size_t)(mrb->symcapa * 6 / 5);
179
- mrb->symtbl = (symbol_name*)mrb_realloc(mrb, mrb->symtbl, sizeof(symbol_name)*(mrb->symcapa+1));
177
+ size_t symcapa = mrb->symcapa;
178
+ if (symcapa == 0) symcapa = 100;
179
+ else symcapa = (size_t)(symcapa * 6 / 5);
180
+ mrb->symtbl = (symbol_name*)mrb_realloc(mrb, mrb->symtbl, sizeof(symbol_name)*(symcapa+1));
181
+ mrb->symcapa = symcapa;
180
182
  }
181
183
  sname = &mrb->symtbl[sym];
182
184
  sname->len = (uint16_t)len;
@@ -201,7 +203,7 @@ sym_intern(mrb_state *mrb, const char *name, size_t len, mrb_bool lit)
201
203
  else {
202
204
  sname->prev = 0;
203
205
  }
204
- mrb->symhash[hash] = sym;
206
+ mrb->symhash[hash] = mrb->symidx = sym;
205
207
 
206
208
  return sym<<SYMBOL_NORMAL_SHIFT;
207
209
  }
@@ -6,7 +6,9 @@
6
6
 
7
7
  #include <stddef.h>
8
8
  #include <stdarg.h>
9
+ #ifndef MRB_WITHOUT_FLOAT
9
10
  #include <math.h>
11
+ #endif
10
12
  #include <mruby.h>
11
13
  #include <mruby/array.h>
12
14
  #include <mruby/class.h>
@@ -322,6 +324,7 @@ cipop(mrb_state *mrb)
322
324
  }
323
325
 
324
326
  void mrb_exc_set(mrb_state *mrb, mrb_value exc);
327
+ static mrb_value mrb_run(mrb_state *mrb, struct RProc* proc, mrb_value self);
325
328
 
326
329
  static void
327
330
  ecall(mrb_state *mrb)
@@ -333,10 +336,12 @@ ecall(mrb_state *mrb)
333
336
  struct REnv *env;
334
337
  ptrdiff_t cioff;
335
338
  int ai = mrb_gc_arena_save(mrb);
336
- uint16_t i = --c->eidx;
339
+ uint16_t i;
337
340
  int nregs;
338
341
 
339
- if (i<0) return;
342
+ if (c->eidx == 0) return;
343
+ i = --c->eidx;
344
+
340
345
  /* restrict total call depth of ecall() */
341
346
  if (++mrb->ecall_nest > MRB_ECALL_DEPTH_MAX) {
342
347
  mrb_exc_raise(mrb, mrb_obj_value(mrb->stack_err));
@@ -428,6 +433,7 @@ MRB_API mrb_value
428
433
  mrb_funcall_with_block(mrb_state *mrb, mrb_value self, mrb_sym mid, mrb_int argc, const mrb_value *argv, mrb_value blk)
429
434
  {
430
435
  mrb_value val;
436
+ int ai = mrb_gc_arena_save(mrb);
431
437
 
432
438
  if (!mrb->jmp) {
433
439
  struct mrb_jmpbuf c_jmp;
@@ -516,19 +522,17 @@ mrb_funcall_with_block(mrb_state *mrb, mrb_value self, mrb_sym mid, mrb_int argc
516
522
  mrb->c->stack[argc+1] = blk;
517
523
 
518
524
  if (MRB_METHOD_CFUNC_P(m)) {
519
- int ai = mrb_gc_arena_save(mrb);
520
-
521
525
  ci->acc = CI_ACC_DIRECT;
522
526
  val = MRB_METHOD_CFUNC(m)(mrb, self);
523
527
  mrb->c->stack = mrb->c->ci->stackent;
524
528
  cipop(mrb);
525
- mrb_gc_arena_restore(mrb, ai);
526
529
  }
527
530
  else {
528
531
  ci->acc = CI_ACC_SKIP;
529
532
  val = mrb_run(mrb, MRB_METHOD_PROC(m), self);
530
533
  }
531
534
  }
535
+ mrb_gc_arena_restore(mrb, ai);
532
536
  mrb_gc_protect(mrb, val);
533
537
  return val;
534
538
  }
@@ -623,7 +627,7 @@ mrb_f_send(mrb_state *mrb, mrb_value self)
623
627
  ci->argc--;
624
628
  }
625
629
  else { /* variable length arguments */
626
- mrb_ary_shift(mrb, regs[0]);
630
+ regs[0] = mrb_ary_subseq(mrb, regs[0], 1, RARRAY_LEN(regs[0]) - 1);
627
631
  }
628
632
 
629
633
  if (MRB_METHOD_CFUNC_P(m)) {
@@ -647,8 +651,7 @@ eval_under(mrb_state *mrb, mrb_value self, mrb_value blk, struct RClass *c)
647
651
  }
648
652
  ci = mrb->c->ci;
649
653
  if (ci->acc == CI_ACC_DIRECT) {
650
- ci->target_class = c;
651
- return mrb_yield_cont(mrb, blk, self, 1, &self);
654
+ return mrb_yield_with_class(mrb, blk, 1, &self, self, c);
652
655
  }
653
656
  ci->target_class = c;
654
657
  p = mrb_proc_ptr(blk);
@@ -723,26 +726,11 @@ mrb_value
723
726
  mrb_obj_instance_eval(mrb_state *mrb, mrb_value self)
724
727
  {
725
728
  mrb_value a, b;
726
- mrb_value cv;
727
- struct RClass *c;
728
729
 
729
730
  if (mrb_get_args(mrb, "|S&", &a, &b) == 1) {
730
731
  mrb_raise(mrb, E_NOTIMP_ERROR, "instance_eval with string not implemented");
731
732
  }
732
- switch (mrb_type(self)) {
733
- case MRB_TT_SYMBOL:
734
- case MRB_TT_FIXNUM:
735
- #ifndef MRB_WITHOUT_FLOAT
736
- case MRB_TT_FLOAT:
737
- #endif
738
- c = 0;
739
- break;
740
- default:
741
- cv = mrb_singleton_class(mrb, self);
742
- c = mrb_class_ptr(cv);
743
- break;
744
- }
745
- return eval_under(mrb, self, b, c);
733
+ return eval_under(mrb, self, b, mrb_singleton_class_ptr(mrb, self));
746
734
  }
747
735
 
748
736
  MRB_API mrb_value
@@ -1061,6 +1049,11 @@ RETRY_TRY_BLOCK:
1061
1049
  NEXT;
1062
1050
  }
1063
1051
 
1052
+ CASE(OP_LOADI16, BS) {
1053
+ SET_INT_VALUE(regs[a], (mrb_int)(int16_t)b);
1054
+ NEXT;
1055
+ }
1056
+
1064
1057
  CASE(OP_LOADSYM, BB) {
1065
1058
  SET_SYM_VALUE(regs[a], syms[b]);
1066
1059
  NEXT;
@@ -1098,13 +1091,13 @@ RETRY_TRY_BLOCK:
1098
1091
  }
1099
1092
 
1100
1093
  CASE(OP_GETSV, BB) {
1101
- mrb_value val = mrb_vm_special_get(mrb, b);
1094
+ mrb_value val = mrb_vm_special_get(mrb, syms[b]);
1102
1095
  regs[a] = val;
1103
1096
  NEXT;
1104
1097
  }
1105
1098
 
1106
1099
  CASE(OP_SETSV, BB) {
1107
- mrb_vm_special_set(mrb, b, regs[a]);
1100
+ mrb_vm_special_set(mrb, syms[b], regs[a]);
1108
1101
  NEXT;
1109
1102
  }
1110
1103
 
@@ -1495,11 +1488,9 @@ RETRY_TRY_BLOCK:
1495
1488
  ci->target_class = MRB_PROC_TARGET_CLASS(m);
1496
1489
  ci->proc = m;
1497
1490
  if (MRB_PROC_ENV_P(m)) {
1498
- mrb_sym mid;
1499
1491
  struct REnv *e = MRB_PROC_ENV(m);
1500
1492
 
1501
- mid = e->mid;
1502
- if (mid) ci->mid = mid;
1493
+ ci->mid = e->mid;
1503
1494
  if (!e->stack) {
1504
1495
  e->stack = mrb->c->stack;
1505
1496
  }
@@ -2825,7 +2816,7 @@ RETRY_TRY_BLOCK:
2825
2816
  MRB_END_EXC(&c_jmp);
2826
2817
  }
2827
2818
 
2828
- MRB_API mrb_value
2819
+ static mrb_value
2829
2820
  mrb_run(mrb_state *mrb, struct RProc *proc, mrb_value self)
2830
2821
  {
2831
2822
  if (mrb->c->ci->argc < 0) {
@@ -63,28 +63,25 @@ def run_cmd(cmd)
63
63
  configs = []
64
64
  [true, false].each do |mode_32|
65
65
  ['', 'MRB_USE_FLOAT'].each do |float_conf|
66
- ['', 'MRB_INT16', 'MRB_INT64'].each do |int_conf|
67
- ['', 'MRB_NAN_BOXING', 'MRB_WORD_BOXING'].each do |boxing_conf|
68
- ['', 'MRB_UTF8_STRING'].each do |utf8_conf|
69
- next if (float_conf == 'MRB_USE_FLOAT') && (boxing_conf == 'MRB_NAN_BOXING')
70
- next if (int_conf == 'MRB_INT64') && (boxing_conf == 'MRB_NAN_BOXING')
71
- next if (int_conf == 'MRB_INT16') && (boxing_conf == 'MRB_WORD_BOXING')
72
- next if (int_conf == 'MRB_INT64') && (boxing_conf == 'MRB_WORD_BOXING') && mode_32
73
- env = [float_conf, int_conf, boxing_conf, utf8_conf].map do |conf|
74
- conf == '' ? nil : "-D#{conf}=1"
75
- end.compact.join(' ')
76
- bit = mode_32 ? '-m32 ' : ''
77
- _info = ''
78
- _info += mode_32 ? '32bit ' : '64bit '
79
- _info += float_conf['USE'] ? 'float ' : ''
80
- _info += int_conf['16'] ? 'int16 ' : ''
81
- _info += int_conf['64'] ? 'int64 ' : ''
82
- _info += boxing_conf['NAN'] ? 'nan ' : ''
83
- _info += boxing_conf['WORD'] ? 'word ' : ''
84
- _info += utf8_conf['UTF8'] ? 'utf8 ' : ''
85
- _info = _info.gsub(/ +/, ' ').strip.tr(' ', '_')
86
- configs << { '_info' => _info, 'CFLAGS' => "#{bit}#{env}", 'LDFLAGS' => bit.strip.to_s }
87
- end
66
+ ['', 'MRB_NAN_BOXING', 'MRB_WORD_BOXING'].each do |boxing_conf|
67
+ ['', 'MRB_UTF8_STRING'].each do |utf8_conf|
68
+ next if (float_conf == 'MRB_USE_FLOAT') && (boxing_conf == 'MRB_NAN_BOXING')
69
+ next if (int_conf == 'MRB_INT64') && (boxing_conf == 'MRB_NAN_BOXING')
70
+ next if (int_conf == 'MRB_INT64') && (boxing_conf == 'MRB_WORD_BOXING') && mode_32
71
+ env = [float_conf, int_conf, boxing_conf, utf8_conf].map do |conf|
72
+ conf == '' ? nil : "-D#{conf}=1"
73
+ end.compact.join(' ')
74
+ bit = mode_32 ? '-m32 ' : ''
75
+ _info = ''
76
+ _info += mode_32 ? '32bit ' : '64bit '
77
+ _info += float_conf['USE'] ? 'float ' : ''
78
+ _info += int_conf['16'] ? 'int16 ' : ''
79
+ _info += int_conf['64'] ? 'int64 ' : ''
80
+ _info += boxing_conf['NAN'] ? 'nan ' : ''
81
+ _info += boxing_conf['WORD'] ? 'word ' : ''
82
+ _info += utf8_conf['UTF8'] ? 'utf8 ' : ''
83
+ _info = _info.gsub(/ +/, ' ').strip.tr(' ', '_')
84
+ configs << { '_info' => _info, 'CFLAGS' => "#{bit}#{env}", 'LDFLAGS' => bit.strip.to_s }
88
85
  end
89
86
  end
90
87
  end
@@ -7,7 +7,7 @@
7
7
  # loader all gems
8
8
  self.libmruby_objs << objfile("#{build_dir}/mrbgems/gem_init")
9
9
  file objfile("#{build_dir}/mrbgems/gem_init") => ["#{build_dir}/mrbgems/gem_init.c", "#{build_dir}/LEGAL"]
10
- file "#{build_dir}/mrbgems/gem_init.c" => [MRUBY_CONFIG, __FILE__] do |t|
10
+ file "#{build_dir}/mrbgems/gem_init.c" => [MRUBY_CONFIG, __FILE__, *Dir.glob("#{build_dir}/mrbgems/mruby-*/*.c")] do |t|
11
11
  mkdir_p "#{build_dir}/mrbgems"
12
12
  open(t.name, 'w') do |f|
13
13
  gem_func_gems = gems.select { |g| g.generate_functions }
@@ -10,6 +10,7 @@ class MRuby::Toolchain::Android
10
10
  ~/Android/Sdk/ndk-bundle
11
11
  %LOCALAPPDATA%/Android/android-sdk/ndk-bundle
12
12
  %LOCALAPPDATA%/Android/android-ndk
13
+ %LOCALAPPDATA%/Android/Sdk/ndk/*
13
14
  ~/Library/Android/sdk/ndk-bundle
14
15
  ~/Library/Android/ndk
15
16
  }
@@ -40,6 +41,19 @@ def message
40
41
  end
41
42
  end
42
43
 
44
+ class SysrootNotReady < StandardError
45
+ def message
46
+ <<-EOM
47
+ Couldn't find standard header files
48
+ Please Move/Copy important file inside
49
+ <NDK_HOME>/sysroot/usr/include/
50
+ to
51
+ <NDK_HOME>/platforms/<ANDROID_VERSION>/<ARCH>/usr/include/
52
+ Higher NDK version will be use.
53
+ EOM
54
+ end
55
+ end
56
+
43
57
  attr_reader :params
44
58
 
45
59
  def initialize(params)
@@ -74,6 +88,25 @@ def home_path
74
88
  path.gsub! '%LOCALAPPDATA%', ENV['LOCALAPPDATA'] || '%LOCALAPPDATA%'
75
89
  path.gsub! '\\', '/'
76
90
  path.gsub! '~', Dir.home || '~'
91
+ path.gsub!('*') do
92
+ next nil unless path[-1] == "*"
93
+ dirs = Dir.glob(path).collect do |d|
94
+ m = d.match(/(\d+)\.(\d+)\.(\d+)$/)
95
+ m ? [m[1], m[2], m[3]].collect { |v| v.to_i } : nil
96
+ end
97
+ dirs.compact!
98
+ dirs.sort! do |before, after|
99
+ f = 0
100
+ if (f = (after.first <=> before.first)) != 0
101
+ next f
102
+ elsif (f = (after[1] <=> before[1])) != 0
103
+ next f
104
+ else
105
+ next after.last <=> before.last
106
+ end
107
+ end
108
+ dirs.empty? ? nil.to_s : dirs.first.join(".")
109
+ end
77
110
  File.directory?(path)
78
111
  } || raise(AndroidNDKHomeNotFound)
79
112
  )
@@ -146,7 +179,8 @@ def arch
146
179
  end
147
180
 
148
181
  def sysroot
149
- @sysroot ||= home_path.join('platforms', platform,
182
+ return @sysroot if @sysroot
183
+ sysroot_path = home_path.join('platforms', platform,
150
184
  case arch
151
185
  when /armeabi/ then 'arch-arm'
152
186
  when /arm64-v8a/ then 'arch-arm64'
@@ -156,6 +190,11 @@ def sysroot
156
190
  when /mips/ then 'arch-mips'
157
191
  end
158
192
  ).to_s
193
+ if Dir.exist?(File.join(sysroot_path, "usr", "include"))
194
+ return @sysroot = sysroot_path
195
+ else
196
+ raise(SysrootNotReady)
197
+ end
159
198
  end
160
199
 
161
200
  def platform
@@ -259,6 +298,12 @@ def ctarget
259
298
  def cflags
260
299
  flags = []
261
300
 
301
+ case RUBY_PLATFORM
302
+ when /mswin|mingw|win32/
303
+ # Build for Android dont need window flag
304
+ flags += %W(-U_WIN32 -U_WIN64)
305
+ end
306
+
262
307
  flags += %W(-MMD -MP -D__android__ -DANDROID --sysroot="#{sysroot}")
263
308
  flags += ctarget
264
309
  case toolchain
@@ -12,9 +12,9 @@
12
12
  compiler.command = ENV['CC'] || default_command
13
13
  compiler.flags = [c_mandatory_flags, ENV['CFLAGS'] || [compiler_flags, cxx_invalid_flags, %w(-Wwrite-strings)]]
14
14
  end
15
- compiler.option_include_path = '-I%s'
15
+ compiler.option_include_path = %q[-I"%s"]
16
16
  compiler.option_define = '-D%s'
17
- compiler.compile_options = '%{flags} -MMD -o %{outfile} -c %{infile}'
17
+ compiler.compile_options = %q[%{flags} -MMD -o "%{outfile}" -c "%{infile}"]
18
18
  compiler.cxx_compile_flag = '-x c++ -std=gnu++03'
19
19
  compiler.cxx_exception_flag = '-fexceptions'
20
20
  compiler.cxx_invalid_flags = c_mandatory_flags + cxx_invalid_flags
@@ -27,7 +27,7 @@
27
27
  linker.library_paths = []
28
28
  linker.option_library = '-l%s'
29
29
  linker.option_library_path = '-L%s'
30
- linker.link_options = '%{flags} -o %{outfile} %{objs} %{flags_before_libraries} %{libs} %{flags_after_libraries}'
30
+ linker.link_options = '%{flags} -o "%{outfile}" %{objs} %{flags_before_libraries} %{libs} %{flags_after_libraries}'
31
31
  end
32
32
 
33
33
  [[conf.cc, 'c'], [conf.cxx, 'c++']].each do |cc, lang|
@@ -5,18 +5,18 @@
5
5
  cc.command = ENV['TARGET_CC']
6
6
  cc.flags = ENV['TARGET_CFLAGS']
7
7
  cc.include_paths = ["#{MRUBY_ROOT}/include"]
8
- cc.option_include_path = '-I%s'
8
+ cc.option_include_path = %q[-I"%s"]
9
9
  cc.option_define = '-D%s'
10
- cc.compile_options = '%{flags} -MMD -o %{outfile} -c %{infile}'
10
+ cc.compile_options = %q[%{flags} -MMD -o "%{outfile}" -c "%{infile}"]
11
11
  end
12
12
 
13
13
  [conf.cxx].each do |cxx|
14
14
  cxx.command = ENV['TARGET_CXX']
15
15
  cxx.flags = ENV['TARGET_CXXFLAGS']
16
16
  cxx.include_paths = ["#{MRUBY_ROOT}/include"]
17
- cxx.option_include_path = '-I%s'
17
+ cxx.option_include_path = %q[-I"%s"]
18
18
  cxx.option_define = '-D%s'
19
- cxx.compile_options = '%{flags} -MMD -o %{outfile} -c %{infile}'
19
+ cxx.compile_options = %q[%{flags} -MMD -o "%{outfile}" -c "%{infile}"]
20
20
  end
21
21
 
22
22
  conf.linker do |linker|
@@ -26,11 +26,11 @@
26
26
  linker.library_paths = []
27
27
  linker.option_library = '-l%s'
28
28
  linker.option_library_path = '-L%s'
29
- linker.link_options = '%{flags} -o %{outfile} %{objs} %{flags_before_libraries} %{libs} %{flags_after_libraries}'
29
+ linker.link_options = '%{flags} -o "%{outfile}" %{objs} %{flags_before_libraries} %{libs} %{flags_after_libraries}'
30
30
  end
31
31
 
32
32
  conf.archiver do |archiver|
33
33
  archiver.command = ENV['TARGET_AR']
34
- archiver.archive_options = 'rs %{outfile} %{objs}'
34
+ archiver.archive_options = 'rs "%{outfile}" %{objs}'
35
35
  end
36
36
  end
@@ -4,9 +4,9 @@
4
4
  # C4013: implicit function declaration
5
5
  cc.flags = [ENV['CFLAGS'] || %w(/c /nologo /W3 /we4013 /Zi /MD /O2 /D_CRT_SECURE_NO_WARNINGS)]
6
6
  cc.defines = %w(MRB_STACK_EXTEND_DOUBLING)
7
- cc.option_include_path = '/I%s'
7
+ cc.option_include_path = %q[/I"%s"]
8
8
  cc.option_define = '/D%s'
9
- cc.compile_options = "%{flags} /Fo%{outfile} %{infile}"
9
+ cc.compile_options = %Q[%{flags} /Fo"%{outfile}" "%{infile}"]
10
10
  cc.cxx_compile_flag = '/TP'
11
11
  cc.cxx_exception_flag = '/EHs'
12
12
  end
@@ -15,9 +15,9 @@
15
15
  cxx.command = ENV['CXX'] || 'cl.exe'
16
16
  cxx.flags = [ENV['CXXFLAGS'] || ENV['CFLAGS'] || %w(/c /nologo /W3 /Zi /MD /O2 /EHs /D_CRT_SECURE_NO_WARNINGS)]
17
17
  cxx.defines = %w(MRB_STACK_EXTEND_DOUBLING)
18
- cxx.option_include_path = '/I%s'
18
+ cxx.option_include_path = %q[/I"%s"]
19
19
  cxx.option_define = '/D%s'
20
- cxx.compile_options = "%{flags} /Fo%{outfile} %{infile}"
20
+ cxx.compile_options = %Q[%{flags} /Fo"%{outfile}" "%{infile}"]
21
21
  cxx.cxx_compile_flag = '/TP'
22
22
  cxx.cxx_exception_flag = '/EHs'
23
23
  end
@@ -29,22 +29,22 @@
29
29
  linker.library_paths = %w()
30
30
  linker.option_library = '%s.lib'
31
31
  linker.option_library_path = '/LIBPATH:%s'
32
- linker.link_options = "%{flags} /OUT:%{outfile} %{objs} %{flags_before_libraries} %{libs} %{flags_after_libraries}"
32
+ linker.link_options = %Q[%{flags} /OUT:"%{outfile}" %{objs} %{flags_before_libraries} %{libs} %{flags_after_libraries}]
33
33
  end
34
34
 
35
35
  conf.archiver do |archiver|
36
36
  archiver.command = ENV['AR'] || 'lib.exe'
37
- archiver.archive_options = '/nologo /OUT:%{outfile} %{objs}'
37
+ archiver.archive_options = '/nologo /OUT:"%{outfile}" %{objs}'
38
38
  end
39
39
 
40
40
  conf.yacc do |yacc|
41
41
  yacc.command = ENV['YACC'] || 'bison.exe'
42
- yacc.compile_options = '-o %{outfile} %{infile}'
42
+ yacc.compile_options = %q[-o "%{outfile}" "%{infile}"]
43
43
  end
44
44
 
45
45
  conf.gperf do |gperf|
46
46
  gperf.command = 'gperf.exe'
47
- gperf.compile_options = '-L ANSI-C -C -p -j1 -i 1 -g -o -t -N mrb_reserved_word -k"1,3,$" %{infile} > %{outfile}'
47
+ gperf.compile_options = %q[-L ANSI-C -C -p -j1 -i 1 -g -o -t -N mrb_reserved_word -k"1,3,$" "%{infile}" > "%{outfile}"]
48
48
  end
49
49
 
50
50
  conf.exts do |exts|