ruby2d 0.11.3 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (221) hide show
  1. checksums.yaml +4 -4
  2. data/assets/include/GLES2/gl2.h +656 -0
  3. data/assets/include/GLES2/gl2ext.h +3949 -0
  4. data/assets/include/GLES2/gl2ext_angle.h +701 -0
  5. data/assets/include/GLES2/gl2platform.h +27 -0
  6. data/assets/include/GLES3/gl3.h +1192 -0
  7. data/assets/include/GLES3/gl31.h +1507 -0
  8. data/assets/include/GLES3/gl32.h +1808 -0
  9. data/assets/include/GLES3/gl3platform.h +27 -0
  10. data/assets/include/KHR/khrplatform.h +290 -0
  11. data/assets/include/SDL2/SDL.h +1 -0
  12. data/assets/include/SDL2/SDL_assert.h +4 -2
  13. data/assets/include/SDL2/SDL_atomic.h +20 -0
  14. data/assets/include/SDL2/SDL_audio.h +40 -4
  15. data/assets/include/SDL2/SDL_blendmode.h +4 -6
  16. data/assets/include/SDL2/SDL_clipboard.h +47 -0
  17. data/assets/include/SDL2/SDL_config.h +6 -2
  18. data/assets/include/SDL2/SDL_config_android.h +2 -0
  19. data/assets/include/SDL2/SDL_config_emscripten.h +2 -0
  20. data/assets/include/SDL2/SDL_config_iphoneos.h +3 -1
  21. data/assets/include/SDL2/SDL_config_macosx.h +3 -6
  22. data/assets/include/SDL2/SDL_config_minimal.h +18 -11
  23. data/assets/include/SDL2/SDL_config_ngage.h +89 -0
  24. data/assets/include/SDL2/SDL_config_os2.h +5 -3
  25. data/assets/include/SDL2/SDL_config_pandora.h +1 -0
  26. data/assets/include/SDL2/SDL_config_windows.h +71 -45
  27. data/assets/include/SDL2/SDL_config_wingdk.h +253 -0
  28. data/assets/include/SDL2/SDL_config_winrt.h +11 -49
  29. data/assets/include/SDL2/SDL_config_xbox.h +235 -0
  30. data/assets/include/SDL2/SDL_cpuinfo.h +39 -4
  31. data/assets/include/SDL2/SDL_egl.h +59 -9
  32. data/assets/include/SDL2/SDL_endian.h +34 -3
  33. data/assets/include/SDL2/SDL_events.h +32 -1
  34. data/assets/include/SDL2/SDL_filesystem.h +5 -1
  35. data/assets/include/SDL2/SDL_gamecontroller.h +78 -5
  36. data/assets/include/SDL2/SDL_guid.h +100 -0
  37. data/assets/include/SDL2/SDL_hints.h +645 -43
  38. data/assets/include/SDL2/SDL_image.h +2045 -33
  39. data/assets/include/SDL2/SDL_joystick.h +127 -7
  40. data/assets/include/SDL2/SDL_keyboard.h +38 -1
  41. data/assets/include/SDL2/SDL_keycode.h +6 -1
  42. data/assets/include/SDL2/SDL_log.h +2 -2
  43. data/assets/include/SDL2/SDL_main.h +42 -2
  44. data/assets/include/SDL2/SDL_metal.h +2 -1
  45. data/assets/include/SDL2/SDL_mixer.h +2529 -396
  46. data/assets/include/SDL2/SDL_mouse.h +12 -1
  47. data/assets/include/SDL2/SDL_opengl.h +0 -51
  48. data/assets/include/SDL2/SDL_opengl_glext.h +2260 -231
  49. data/assets/include/SDL2/SDL_opengles2_gl2.h +374 -339
  50. data/assets/include/SDL2/SDL_opengles2_gl2ext.h +3479 -1496
  51. data/assets/include/SDL2/SDL_opengles2_gl2platform.h +6 -9
  52. data/assets/include/SDL2/SDL_opengles2_khrplatform.h +43 -14
  53. data/assets/include/SDL2/SDL_platform.h +32 -6
  54. data/assets/include/SDL2/SDL_rect.h +154 -2
  55. data/assets/include/SDL2/SDL_render.h +46 -17
  56. data/assets/include/SDL2/SDL_revision.h +4 -0
  57. data/assets/include/SDL2/SDL_rwops.h +1 -15
  58. data/assets/include/SDL2/SDL_scancode.h +46 -21
  59. data/assets/include/SDL2/SDL_sensor.h +24 -3
  60. data/assets/include/SDL2/SDL_stdinc.h +119 -8
  61. data/assets/include/SDL2/SDL_surface.h +3 -1
  62. data/assets/include/SDL2/SDL_system.h +66 -6
  63. data/assets/include/SDL2/SDL_syswm.h +2 -0
  64. data/assets/include/SDL2/SDL_test_common.h +1 -0
  65. data/assets/include/SDL2/SDL_test_font.h +90 -3
  66. data/assets/include/SDL2/SDL_thread.h +3 -3
  67. data/assets/include/SDL2/SDL_touch.h +8 -0
  68. data/assets/include/SDL2/SDL_ttf.h +2084 -155
  69. data/assets/include/SDL2/SDL_version.h +19 -3
  70. data/assets/include/SDL2/SDL_video.h +71 -9
  71. data/assets/include/SDL2/begin_code.h +4 -4
  72. data/assets/include/mrbconf.h +15 -17
  73. data/assets/include/mruby/array.h +8 -21
  74. data/assets/include/mruby/boxing_nan.h +115 -86
  75. data/assets/include/mruby/boxing_word.h +104 -78
  76. data/assets/include/mruby/common.h +6 -0
  77. data/assets/include/mruby/compile.h +3 -4
  78. data/assets/include/mruby/debug.h +4 -2
  79. data/assets/include/mruby/dump.h +5 -2
  80. data/assets/include/mruby/error.h +12 -2
  81. data/assets/include/mruby/gc.h +2 -0
  82. data/assets/include/mruby/hash.h +1 -3
  83. data/assets/include/mruby/irep.h +4 -4
  84. data/assets/include/mruby/numeric.h +21 -13
  85. data/assets/include/mruby/opcode.h +30 -0
  86. data/assets/include/mruby/ops.h +99 -101
  87. data/assets/include/mruby/presym/scanning.h +15 -9
  88. data/assets/include/mruby/proc.h +4 -2
  89. data/assets/include/mruby/string.h +3 -24
  90. data/assets/include/mruby/value.h +80 -40
  91. data/assets/include/mruby/variable.h +0 -15
  92. data/assets/include/mruby/version.h +5 -5
  93. data/assets/include/mruby.h +86 -16
  94. data/assets/macos/universal/bin/mrbc +0 -0
  95. data/assets/macos/universal/lib/libFLAC.a +0 -0
  96. data/assets/macos/universal/lib/libSDL2.a +0 -0
  97. data/assets/macos/universal/lib/libSDL2_image.a +0 -0
  98. data/assets/macos/universal/lib/libSDL2_mixer.a +0 -0
  99. data/assets/macos/universal/lib/libSDL2_ttf.a +0 -0
  100. data/assets/macos/universal/lib/libavif.a +0 -0
  101. data/assets/macos/universal/lib/libbrotlicommon-static.a +0 -0
  102. data/assets/macos/universal/lib/libbrotlidec-static.a +0 -0
  103. data/assets/macos/universal/lib/libfreetype.a +0 -0
  104. data/assets/macos/universal/lib/libgraphite2.a +0 -0
  105. data/assets/macos/universal/lib/libharfbuzz.a +0 -0
  106. data/assets/macos/universal/lib/libhwy.a +0 -0
  107. data/assets/macos/universal/lib/libjpeg.a +0 -0
  108. data/assets/macos/universal/lib/libjxl.a +0 -0
  109. data/assets/macos/universal/lib/libmodplug.a +0 -0
  110. data/assets/macos/universal/lib/libmpg123.a +0 -0
  111. data/assets/macos/universal/lib/libmruby.a +0 -0
  112. data/assets/macos/universal/lib/libogg.a +0 -0
  113. data/assets/macos/universal/lib/libpng.a +0 -0
  114. data/assets/macos/universal/lib/libtiff.a +0 -0
  115. data/assets/macos/universal/lib/libvorbis.a +0 -0
  116. data/assets/macos/universal/lib/libvorbisfile.a +0 -0
  117. data/assets/macos/universal/lib/libwebp.a +0 -0
  118. data/assets/macos/universal/lib/libzstd.a +0 -0
  119. data/assets/wasm/template.html +2 -1
  120. data/assets/windows/mingw-w64-ucrt-x86_64/bin/mrbc.exe +0 -0
  121. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libFLAC.a +0 -0
  122. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libLerc.a +0 -0
  123. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libSDL2.a +0 -0
  124. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libSDL2_image.a +0 -0
  125. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libSDL2_mixer.a +0 -0
  126. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libSDL2_ttf.a +0 -0
  127. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libbrotlicommon.a +0 -0
  128. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libbrotlidec.a +0 -0
  129. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libdeflate.a +0 -0
  130. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libfreetype.a +0 -0
  131. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libglew32.a +0 -0
  132. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libharfbuzz.a +0 -0
  133. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libhwy.a +0 -0
  134. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libjpeg.a +0 -0
  135. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libjxl.a +0 -0
  136. data/assets/windows/mingw-w64-ucrt-x86_64/lib/liblzma.a +0 -0
  137. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libmpg123.a +0 -0
  138. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libmruby.a +0 -0
  139. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libopus.a +0 -0
  140. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libpng.a +0 -0
  141. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libsndfile.a +0 -0
  142. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libssp.a +0 -0
  143. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libstdc++.a +0 -0
  144. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libtiff.a +0 -0
  145. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libwebp.a +0 -0
  146. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libz.a +0 -0
  147. data/assets/windows/mingw-w64-x86_64/bin/mrbc.exe +0 -0
  148. data/assets/windows/mingw-w64-x86_64/lib/libFLAC.a +0 -0
  149. data/assets/windows/mingw-w64-x86_64/lib/libLerc.a +0 -0
  150. data/assets/windows/mingw-w64-x86_64/lib/libSDL2.a +0 -0
  151. data/assets/windows/mingw-w64-x86_64/lib/libSDL2_image.a +0 -0
  152. data/assets/windows/mingw-w64-x86_64/lib/libSDL2_mixer.a +0 -0
  153. data/assets/windows/mingw-w64-x86_64/lib/libSDL2_ttf.a +0 -0
  154. data/assets/windows/mingw-w64-x86_64/lib/libbrotlicommon.a +0 -0
  155. data/assets/windows/mingw-w64-x86_64/lib/libbrotlidec.a +0 -0
  156. data/assets/windows/mingw-w64-x86_64/lib/libdeflate.a +0 -0
  157. data/assets/windows/mingw-w64-x86_64/lib/libfreetype.a +0 -0
  158. data/assets/windows/mingw-w64-x86_64/lib/libglew32.a +0 -0
  159. data/assets/windows/mingw-w64-x86_64/lib/libharfbuzz.a +0 -0
  160. data/assets/windows/mingw-w64-x86_64/lib/libhwy.a +0 -0
  161. data/assets/windows/mingw-w64-x86_64/lib/libjpeg.a +0 -0
  162. data/assets/windows/mingw-w64-x86_64/lib/libjxl.a +0 -0
  163. data/assets/windows/mingw-w64-x86_64/lib/liblzma.a +0 -0
  164. data/assets/windows/mingw-w64-x86_64/lib/libmpg123.a +0 -0
  165. data/assets/windows/mingw-w64-x86_64/lib/libmruby.a +0 -0
  166. data/assets/windows/mingw-w64-x86_64/lib/libopus.a +0 -0
  167. data/assets/windows/mingw-w64-x86_64/lib/libpng.a +0 -0
  168. data/assets/windows/mingw-w64-x86_64/lib/libsndfile.a +0 -0
  169. data/assets/windows/mingw-w64-x86_64/lib/libssp.a +0 -0
  170. data/assets/windows/mingw-w64-x86_64/lib/libstdc++.a +0 -0
  171. data/assets/windows/mingw-w64-x86_64/lib/libtiff.a +0 -0
  172. data/assets/windows/mingw-w64-x86_64/lib/libwebp.a +0 -0
  173. data/assets/windows/mingw-w64-x86_64/lib/libz.a +0 -0
  174. data/assets/windows/mingw-w64-x86_64/lib/libzstd.a +0 -0
  175. data/ext/ruby2d/canvas.c +540 -0
  176. data/ext/ruby2d/extconf.rb +33 -20
  177. data/ext/ruby2d/gl.c +3 -3
  178. data/ext/ruby2d/image.c +7 -7
  179. data/ext/ruby2d/ruby2d.c +741 -24
  180. data/ext/ruby2d/ruby2d.h +66 -3
  181. data/ext/ruby2d/sound.c +16 -2
  182. data/lib/ruby2d/canvas.rb +315 -0
  183. data/lib/ruby2d/circle.rb +30 -15
  184. data/lib/ruby2d/cli/build.rb +5 -3
  185. data/lib/ruby2d/cli/enable_console.rb +3 -1
  186. data/lib/ruby2d/color.rb +133 -77
  187. data/lib/ruby2d/core.rb +32 -0
  188. data/lib/ruby2d/dsl.rb +38 -32
  189. data/lib/ruby2d/exceptions.rb +2 -1
  190. data/lib/ruby2d/font.rb +97 -62
  191. data/lib/ruby2d/image.rb +48 -27
  192. data/lib/ruby2d/line.rb +84 -45
  193. data/lib/ruby2d/music.rb +33 -23
  194. data/lib/ruby2d/pixel.rb +10 -9
  195. data/lib/ruby2d/pixmap.rb +39 -0
  196. data/lib/ruby2d/pixmap_atlas.rb +56 -0
  197. data/lib/ruby2d/quad.rb +98 -49
  198. data/lib/ruby2d/rectangle.rb +35 -36
  199. data/lib/ruby2d/renderable.rb +7 -6
  200. data/lib/ruby2d/sound.rb +23 -17
  201. data/lib/ruby2d/sprite.rb +181 -140
  202. data/lib/ruby2d/square.rb +21 -20
  203. data/lib/ruby2d/text.rb +47 -19
  204. data/lib/ruby2d/texture.rb +13 -3
  205. data/lib/ruby2d/tileset.rb +97 -44
  206. data/lib/ruby2d/triangle.rb +91 -42
  207. data/lib/ruby2d/version.rb +3 -1
  208. data/lib/ruby2d/vertices.rb +81 -45
  209. data/lib/ruby2d/window.rb +508 -371
  210. data/lib/ruby2d.rb +11 -29
  211. metadata +51 -16
  212. data/assets/include/SDL2/SDL_config_psp.h +0 -165
  213. data/assets/include/SDL2/SDL_config_wiz.h +0 -154
  214. data/assets/include/glew.h +0 -23686
  215. data/assets/macos/universal/lib/libpng16.a +0 -0
  216. data/assets/windows/glew/README.md +0 -10
  217. data/assets/windows/glew/glew.h +0 -23686
  218. data/assets/windows/glew/libglew32.a +0 -0
  219. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libpng16.a +0 -0
  220. data/assets/windows/mingw-w64-x86_64/lib/libpng16.a +0 -0
  221. data/lib/ruby2d/entity.rb +0 -17
@@ -7,7 +7,11 @@
7
7
  #ifndef MRUBY_BOXING_WORD_H
8
8
  #define MRUBY_BOXING_WORD_H
9
9
 
10
- #ifndef MRB_NO_FLOAT
10
+ #if defined(MRB_32BIT) && !defined(MRB_USE_FLOAT32) && !defined(MRB_WORDBOX_NO_FLOAT_TRUNCATE)
11
+ # define MRB_WORDBOX_NO_FLOAT_TRUNCATE
12
+ #endif
13
+
14
+ #if !defined(MRB_NO_FLOAT) && defined(MRB_WORDBOX_NO_FLOAT_TRUNCATE)
11
15
  struct RFloat {
12
16
  MRB_OBJECT_HEADER;
13
17
  mrb_float f;
@@ -29,9 +33,9 @@ enum mrb_special_consts {
29
33
  #if defined(MRB_64BIT) && defined(MRB_INT32)
30
34
  #define MRB_FIXNUM_SHIFT 0
31
35
  #else
32
- #define MRB_FIXNUM_SHIFT BOXWORD_FIXNUM_SHIFT
36
+ #define MRB_FIXNUM_SHIFT WORDBOX_FIXNUM_SHIFT
33
37
  #endif
34
- #define MRB_SYMBOL_SHIFT BOXWORD_SYMBOL_SHIFT
38
+ #define MRB_SYMBOL_SHIFT WORDBOX_SYMBOL_SHIFT
35
39
 
36
40
  #if defined(MRB_64BIT) && defined(MRB_INT64)
37
41
  # define MRB_FIXNUM_MIN (INT64_MIN>>MRB_FIXNUM_SHIFT)
@@ -41,36 +45,68 @@ enum mrb_special_consts {
41
45
  # define MRB_FIXNUM_MAX (INT32_MAX>>MRB_FIXNUM_SHIFT)
42
46
  #endif
43
47
 
44
- #define BOXWORD_FIXNUM_BIT_POS 1
45
- #define BOXWORD_SYMBOL_BIT_POS 2
46
- #define BOXWORD_FIXNUM_SHIFT BOXWORD_FIXNUM_BIT_POS
47
- #ifdef MRB_64BIT
48
- #define BOXWORD_SYMBOL_SHIFT 0
48
+ #define WORDBOX_FIXNUM_BIT_POS 1
49
+ #define WORDBOX_FIXNUM_SHIFT WORDBOX_FIXNUM_BIT_POS
50
+ #define WORDBOX_FIXNUM_FLAG (1 << (WORDBOX_FIXNUM_BIT_POS - 1))
51
+ #define WORDBOX_FIXNUM_MASK ((1 << WORDBOX_FIXNUM_BIT_POS) - 1)
52
+
53
+ #if defined(MRB_WORDBOX_NO_FLOAT_TRUNCATE)
54
+ /* floats are allocated in heaps */
55
+ #define WORDBOX_SYMBOL_BIT_POS 2
56
+ #define WORDBOX_SYMBOL_SHIFT WORDBOX_SYMBOL_BIT_POS
57
+ #define WORDBOX_SYMBOL_FLAG (1 << (WORDBOX_SYMBOL_BIT_POS - 1))
58
+ #define WORDBOX_SYMBOL_MASK ((1 << WORDBOX_SYMBOL_BIT_POS) - 1)
49
59
  #else
50
- #define BOXWORD_SYMBOL_SHIFT BOXWORD_SYMBOL_BIT_POS
60
+ #define WORDBOX_FLOAT_FLAG 2
61
+ #define WORDBOX_FLOAT_MASK 3
62
+ #if defined(MRB_64BIT)
63
+ #define WORDBOX_SYMBOL_SHIFT 32
64
+ #else /* MRB_32BIT */
65
+ #define WORDBOX_SYMBOL_SHIFT 5
51
66
  #endif
52
- #define BOXWORD_FIXNUM_FLAG (1 << (BOXWORD_FIXNUM_BIT_POS - 1))
53
- #define BOXWORD_SYMBOL_FLAG (1 << (BOXWORD_SYMBOL_BIT_POS - 1))
54
- #define BOXWORD_FIXNUM_MASK ((1 << BOXWORD_FIXNUM_BIT_POS) - 1)
55
- #define BOXWORD_SYMBOL_MASK ((1 << BOXWORD_SYMBOL_BIT_POS) - 1)
56
- #define BOXWORD_IMMEDIATE_MASK 0x07
57
-
58
- #define BOXWORD_SET_SHIFT_VALUE(o,n,v) \
59
- ((o).w = (((uintptr_t)(v)) << BOXWORD_##n##_SHIFT) | BOXWORD_##n##_FLAG)
60
- #define BOXWORD_SHIFT_VALUE_P(o,n) \
61
- (((o).w & BOXWORD_##n##_MASK) == BOXWORD_##n##_FLAG)
62
- #define BOXWORD_OBJ_TYPE_P(o,n) \
67
+ #define WORDBOX_SYMBOL_FLAG 0x1c
68
+ #define WORDBOX_SYMBOL_MASK 0x1f
69
+ #endif
70
+
71
+ #define WORDBOX_IMMEDIATE_MASK 0x07
72
+
73
+ #define WORDBOX_SET_SHIFT_VALUE(o,n,v) \
74
+ ((o).w = (((uintptr_t)(v)) << WORDBOX_##n##_SHIFT) | WORDBOX_##n##_FLAG)
75
+ #define WORDBOX_SHIFT_VALUE_P(o,n) \
76
+ (((o).w & WORDBOX_##n##_MASK) == WORDBOX_##n##_FLAG)
77
+ #define WORDBOX_OBJ_TYPE_P(o,n) \
63
78
  (!mrb_immediate_p(o) && mrb_val_union(o).bp->tt == MRB_TT_##n)
64
79
 
65
80
  /*
66
81
  * mrb_value representation:
67
82
  *
83
+ * 64bit word with inline float:
84
+ * nil : ...0000 0000 (all bits are 0)
85
+ * false : ...0000 0100 (mrb_fixnum(v) != 0)
86
+ * true : ...0000 1100
87
+ * undef : ...0001 0100
88
+ * symbol: ...0001 1100 (use only upper 32-bit as symbol value with MRB_64BIT)
89
+ * fixnum: ...IIII III1
90
+ * float : ...FFFF FF10 (51 bit significands; require MRB_64BIT)
91
+ * object: ...PPPP P000
92
+ *
93
+ * 32bit word with inline float:
94
+ * nil : ...0000 0000 (all bits are 0)
95
+ * false : ...0000 0100 (mrb_fixnum(v) != 0)
96
+ * true : ...0000 1100
97
+ * undef : ...0001 0100
98
+ * symbol: ...SSS1 0100 (symbol occupies 20bits)
99
+ * fixnum: ...IIII III1
100
+ * float : ...FFFF FF10 (22 bit significands; require MRB_64BIT)
101
+ * object: ...PPPP P000
102
+ *
103
+ * and word boxing without inline float (MRB_WORDBOX_NO_FLOAT_TRUNCATE):
68
104
  * nil : ...0000 0000 (all bits are 0)
69
105
  * false : ...0000 0100 (mrb_fixnum(v) != 0)
70
106
  * true : ...0000 1100
71
107
  * undef : ...0001 0100
72
108
  * fixnum: ...IIII III1
73
- * symbol: ...SSSS SS10 (use only upper 32-bit as symbol value on 64-bit CPU)
109
+ * symbol: ...SSSS SS10
74
110
  * object: ...PPPP P000 (any bits are 1)
75
111
  */
76
112
  typedef struct mrb_value {
@@ -79,18 +115,13 @@ typedef struct mrb_value {
79
115
 
80
116
  union mrb_value_ {
81
117
  void *p;
82
- #ifdef MRB_64BIT
83
- /* use struct to avoid bit shift. */
84
- struct {
85
- MRB_ENDIAN_LOHI(
86
- mrb_sym sym;
87
- ,uint32_t sym_flag;
88
- )
89
- };
90
- #endif
91
118
  struct RBasic *bp;
92
119
  #ifndef MRB_NO_FLOAT
120
+ #ifndef MRB_WORDBOX_NO_FLOAT_TRUNCATE
121
+ mrb_float f;
122
+ #else
93
123
  struct RFloat *fp;
124
+ #endif
94
125
  #endif
95
126
  struct RInteger *ip;
96
127
  struct RCptr *vp;
@@ -98,7 +129,7 @@ union mrb_value_ {
98
129
  mrb_value value;
99
130
  };
100
131
 
101
- mrb_static_assert1(sizeof(mrb_value) == sizeof(union mrb_value_));
132
+ mrb_static_assert(sizeof(mrb_value) == sizeof(union mrb_value_));
102
133
 
103
134
  static inline union mrb_value_
104
135
  mrb_val_union(mrb_value v)
@@ -112,61 +143,62 @@ MRB_API mrb_value mrb_word_boxing_cptr_value(struct mrb_state*, void*);
112
143
  #ifndef MRB_NO_FLOAT
113
144
  MRB_API mrb_value mrb_word_boxing_float_value(struct mrb_state*, mrb_float);
114
145
  #endif
115
- MRB_API mrb_value mrb_word_boxing_int_value(struct mrb_state*, mrb_int);
146
+ MRB_API mrb_value mrb_boxing_int_value(struct mrb_state*, mrb_int);
116
147
 
117
- #define mrb_immediate_p(o) ((o).w & BOXWORD_IMMEDIATE_MASK || (o).w == MRB_Qnil)
148
+ #define mrb_immediate_p(o) ((o).w & WORDBOX_IMMEDIATE_MASK || (o).w == MRB_Qnil)
118
149
 
119
150
  #define mrb_ptr(o) mrb_val_union(o).p
120
151
  #define mrb_cptr(o) mrb_val_union(o).vp->p
121
152
  #ifndef MRB_NO_FLOAT
122
- #define mrb_float(o) mrb_val_union(o).fp->f
153
+ #ifndef MRB_WORDBOX_NO_FLOAT_TRUNCATE
154
+ MRB_API mrb_float mrb_word_boxing_value_float(mrb_value v);
155
+ #define mrb_float(o) mrb_word_boxing_value_float(o)
156
+ #else
157
+ #define mrb_float(o) mrb_val_union(o).fp->f
158
+ #endif
123
159
  #endif
124
- #define mrb_fixnum(o) (mrb_int)(((intptr_t)(o).w) >> BOXWORD_FIXNUM_SHIFT)
160
+ #define mrb_fixnum(o) (mrb_int)(((intptr_t)(o).w) >> WORDBOX_FIXNUM_SHIFT)
125
161
  MRB_INLINE mrb_int
126
162
  mrb_integer_func(mrb_value o) {
127
163
  if (mrb_immediate_p(o)) return mrb_fixnum(o);
128
164
  return mrb_val_union(o).ip->i;
129
165
  }
130
166
  #define mrb_integer(o) mrb_integer_func(o)
131
- #ifdef MRB_64BIT
132
- #define mrb_symbol(o) mrb_val_union(o).sym
133
- #else
134
- #define mrb_symbol(o) (mrb_sym)(((o).w) >> BOXWORD_SYMBOL_SHIFT)
135
- #endif
167
+ #define mrb_symbol(o) (mrb_sym)(((o).w) >> WORDBOX_SYMBOL_SHIFT)
136
168
  #define mrb_bool(o) (((o).w & ~(uintptr_t)MRB_Qfalse) != 0)
137
169
 
138
- #define mrb_fixnum_p(o) BOXWORD_SHIFT_VALUE_P(o, FIXNUM)
139
- #define mrb_integer_p(o) (BOXWORD_SHIFT_VALUE_P(o, FIXNUM)||BOXWORD_OBJ_TYPE_P(o, INTEGER))
140
- #ifdef MRB_64BIT
141
- #define mrb_symbol_p(o) (mrb_val_union(o).sym_flag == BOXWORD_SYMBOL_FLAG)
142
- #else
143
- #define mrb_symbol_p(o) BOXWORD_SHIFT_VALUE_P(o, SYMBOL)
144
- #endif
170
+ #define mrb_fixnum_p(o) WORDBOX_SHIFT_VALUE_P(o, FIXNUM)
171
+ #define mrb_integer_p(o) (WORDBOX_SHIFT_VALUE_P(o, FIXNUM)||WORDBOX_OBJ_TYPE_P(o, INTEGER))
172
+ #define mrb_symbol_p(o) WORDBOX_SHIFT_VALUE_P(o, SYMBOL)
145
173
  #define mrb_undef_p(o) ((o).w == MRB_Qundef)
146
174
  #define mrb_nil_p(o) ((o).w == MRB_Qnil)
147
175
  #define mrb_false_p(o) ((o).w == MRB_Qfalse)
148
176
  #define mrb_true_p(o) ((o).w == MRB_Qtrue)
149
177
  #ifndef MRB_NO_FLOAT
150
- #define mrb_float_p(o) BOXWORD_OBJ_TYPE_P(o, FLOAT)
178
+ #ifndef MRB_WORDBOX_NO_FLOAT_TRUNCATE
179
+ #define mrb_float_p(o) WORDBOX_SHIFT_VALUE_P(o, FLOAT)
180
+ #else
181
+ #define mrb_float_p(o) WORDBOX_OBJ_TYPE_P(o, FLOAT)
182
+ #endif
151
183
  #endif
152
- #define mrb_array_p(o) BOXWORD_OBJ_TYPE_P(o, ARRAY)
153
- #define mrb_string_p(o) BOXWORD_OBJ_TYPE_P(o, STRING)
154
- #define mrb_hash_p(o) BOXWORD_OBJ_TYPE_P(o, HASH)
155
- #define mrb_cptr_p(o) BOXWORD_OBJ_TYPE_P(o, CPTR)
156
- #define mrb_exception_p(o) BOXWORD_OBJ_TYPE_P(o, EXCEPTION)
157
- #define mrb_free_p(o) BOXWORD_OBJ_TYPE_P(o, FREE)
158
- #define mrb_object_p(o) BOXWORD_OBJ_TYPE_P(o, OBJECT)
159
- #define mrb_class_p(o) BOXWORD_OBJ_TYPE_P(o, CLASS)
160
- #define mrb_module_p(o) BOXWORD_OBJ_TYPE_P(o, MODULE)
161
- #define mrb_iclass_p(o) BOXWORD_OBJ_TYPE_P(o, ICLASS)
162
- #define mrb_sclass_p(o) BOXWORD_OBJ_TYPE_P(o, SCLASS)
163
- #define mrb_proc_p(o) BOXWORD_OBJ_TYPE_P(o, PROC)
164
- #define mrb_range_p(o) BOXWORD_OBJ_TYPE_P(o, RANGE)
165
- #define mrb_env_p(o) BOXWORD_OBJ_TYPE_P(o, ENV)
166
- #define mrb_data_p(o) BOXWORD_OBJ_TYPE_P(o, DATA)
167
- #define mrb_fiber_p(o) BOXWORD_OBJ_TYPE_P(o, FIBER)
168
- #define mrb_istruct_p(o) BOXWORD_OBJ_TYPE_P(o, ISTRUCT)
169
- #define mrb_break_p(o) BOXWORD_OBJ_TYPE_P(o, BREAK)
184
+ #define mrb_array_p(o) WORDBOX_OBJ_TYPE_P(o, ARRAY)
185
+ #define mrb_string_p(o) WORDBOX_OBJ_TYPE_P(o, STRING)
186
+ #define mrb_hash_p(o) WORDBOX_OBJ_TYPE_P(o, HASH)
187
+ #define mrb_cptr_p(o) WORDBOX_OBJ_TYPE_P(o, CPTR)
188
+ #define mrb_exception_p(o) WORDBOX_OBJ_TYPE_P(o, EXCEPTION)
189
+ #define mrb_free_p(o) WORDBOX_OBJ_TYPE_P(o, FREE)
190
+ #define mrb_object_p(o) WORDBOX_OBJ_TYPE_P(o, OBJECT)
191
+ #define mrb_class_p(o) WORDBOX_OBJ_TYPE_P(o, CLASS)
192
+ #define mrb_module_p(o) WORDBOX_OBJ_TYPE_P(o, MODULE)
193
+ #define mrb_iclass_p(o) WORDBOX_OBJ_TYPE_P(o, ICLASS)
194
+ #define mrb_sclass_p(o) WORDBOX_OBJ_TYPE_P(o, SCLASS)
195
+ #define mrb_proc_p(o) WORDBOX_OBJ_TYPE_P(o, PROC)
196
+ #define mrb_range_p(o) WORDBOX_OBJ_TYPE_P(o, RANGE)
197
+ #define mrb_env_p(o) WORDBOX_OBJ_TYPE_P(o, ENV)
198
+ #define mrb_data_p(o) WORDBOX_OBJ_TYPE_P(o, DATA)
199
+ #define mrb_fiber_p(o) WORDBOX_OBJ_TYPE_P(o, FIBER)
200
+ #define mrb_istruct_p(o) WORDBOX_OBJ_TYPE_P(o, ISTRUCT)
201
+ #define mrb_break_p(o) WORDBOX_OBJ_TYPE_P(o, BREAK)
170
202
 
171
203
  #ifndef MRB_NO_FLOAT
172
204
  #define SET_FLOAT_VALUE(mrb,r,v) ((r) = mrb_word_boxing_float_value(mrb, v))
@@ -177,18 +209,9 @@ mrb_integer_func(mrb_value o) {
177
209
  #define SET_FALSE_VALUE(r) ((r).w = MRB_Qfalse)
178
210
  #define SET_TRUE_VALUE(r) ((r).w = MRB_Qtrue)
179
211
  #define SET_BOOL_VALUE(r,b) ((b) ? SET_TRUE_VALUE(r) : SET_FALSE_VALUE(r))
180
- #define SET_INT_VALUE(mrb,r,n) ((r) = mrb_word_boxing_int_value(mrb, n))
181
- #define SET_FIXNUM_VALUE(r,n) BOXWORD_SET_SHIFT_VALUE(r, FIXNUM, n)
182
- #ifdef MRB_64BIT
183
- #define SET_SYM_VALUE(r,v) do {\
184
- union mrb_value_ mrb_value_union_variable;\
185
- mrb_value_union_variable.sym = v;\
186
- mrb_value_union_variable.sym_flag = BOXWORD_SYMBOL_FLAG;\
187
- (r) = mrb_value_union_variable.value;\
188
- } while (0)
189
- #else
190
- #define SET_SYM_VALUE(r,n) BOXWORD_SET_SHIFT_VALUE(r, SYMBOL, n)
191
- #endif
212
+ #define SET_INT_VALUE(mrb,r,n) ((r) = mrb_boxing_int_value(mrb, n))
213
+ #define SET_FIXNUM_VALUE(r,n) WORDBOX_SET_SHIFT_VALUE(r, FIXNUM, n)
214
+ #define SET_SYM_VALUE(r,n) WORDBOX_SET_SHIFT_VALUE(r, SYMBOL, n)
192
215
  #define SET_OBJ_VALUE(r,v) ((r).w = (uintptr_t)(v))
193
216
 
194
217
  MRB_INLINE enum mrb_vtype
@@ -199,6 +222,9 @@ mrb_type(mrb_value o)
199
222
  mrb_fixnum_p(o) ? MRB_TT_INTEGER :
200
223
  mrb_symbol_p(o) ? MRB_TT_SYMBOL :
201
224
  mrb_undef_p(o) ? MRB_TT_UNDEF :
225
+ #ifndef MRB_NO_FLOAT
226
+ mrb_float_p(o) ? MRB_TT_FLOAT :
227
+ #endif
202
228
  mrb_val_union(o).bp->tt;
203
229
  }
204
230
 
@@ -28,6 +28,12 @@
28
28
  # define MRB_END_DECL
29
29
  #endif
30
30
 
31
+ #include <sys/types.h>
32
+ #if defined _MSC_VER
33
+ #include <BaseTsd.h>
34
+ typedef SSIZE_T ssize_t;
35
+ #endif
36
+
31
37
  /**
32
38
  * Shared compiler macros
33
39
  */
@@ -16,8 +16,6 @@ MRB_BEGIN_DECL
16
16
 
17
17
  #include <mruby.h>
18
18
 
19
- struct mrb_jmpbuf;
20
-
21
19
  struct mrb_parser_state;
22
20
  /* load context */
23
21
  typedef struct mrbc_context {
@@ -33,6 +31,7 @@ typedef struct mrbc_context {
33
31
  mrb_bool no_exec:1;
34
32
  mrb_bool keep_lv:1;
35
33
  mrb_bool no_optimize:1;
34
+ mrb_bool no_ext_ops:1;
36
35
  const struct RProc *upper;
37
36
 
38
37
  size_t parser_nerr;
@@ -58,7 +57,7 @@ enum mrb_lex_state_enum {
58
57
  EXPR_ENDFN, /* ditto, and unbound braces. */
59
58
  EXPR_ARG, /* newline significant, +/- is an operator. */
60
59
  EXPR_CMDARG, /* newline significant, +/- is an operator. */
61
- EXPR_MID, /* newline significant, +/- is an operator. */
60
+ EXPR_MID, /* newline significant, +/- is a sign. */
62
61
  EXPR_FNAME, /* ignore newline, no reserved words. */
63
62
  EXPR_DOT, /* right after '.' or '::', no reserved words. */
64
63
  EXPR_CLASS, /* immediate after 'class', no here document. */
@@ -157,6 +156,7 @@ struct mrb_parser_state {
157
156
 
158
157
  mrb_bool no_optimize:1;
159
158
  mrb_bool capture_errors:1;
159
+ mrb_bool no_ext_ops:1;
160
160
  const struct RProc *upper;
161
161
  struct mrb_parser_message error_buffer[10];
162
162
  struct mrb_parser_message warn_buffer[10];
@@ -165,7 +165,6 @@ struct mrb_parser_state {
165
165
  uint16_t filename_table_length;
166
166
  uint16_t current_filename_index;
167
167
 
168
- struct mrb_jmpbuf* jmp;
169
168
  mrb_ast_node *nvars;
170
169
  };
171
170
 
@@ -16,7 +16,8 @@ MRB_BEGIN_DECL
16
16
 
17
17
  typedef enum mrb_debug_line_type {
18
18
  mrb_debug_line_ary = 0,
19
- mrb_debug_line_flat_map = 1
19
+ mrb_debug_line_flat_map,
20
+ mrb_debug_line_packed_map
20
21
  } mrb_debug_line_type;
21
22
 
22
23
  typedef struct mrb_irep_debug_info_line {
@@ -31,8 +32,9 @@ typedef struct mrb_irep_debug_info_file {
31
32
  mrb_debug_line_type line_type;
32
33
  union {
33
34
  void *ptr;
34
- mrb_irep_debug_info_line *flat_map;
35
35
  uint16_t *ary;
36
+ mrb_irep_debug_info_line *flat_map;
37
+ uint8_t *packed_map;
36
38
  } lines;
37
39
  } mrb_irep_debug_info_file;
38
40
 
@@ -16,7 +16,10 @@
16
16
  */
17
17
  MRB_BEGIN_DECL
18
18
 
19
- #define DUMP_DEBUG_INFO 1
19
+ /* flags for mrb_dump_irep{,_binary,_cfunc,_cstruct} */
20
+ #define MRB_DUMP_DEBUG_INFO 1
21
+ #define MRB_DUMP_STATIC 2
22
+ #define DUMP_DEBUG_INFO MRB_DUMP_DEBUG_INFO /* deprecated */
20
23
 
21
24
  int mrb_dump_irep(mrb_state *mrb, const mrb_irep *irep, uint8_t flags, uint8_t **bin, size_t *bin_size);
22
25
  #ifndef MRB_NO_STDIO
@@ -51,7 +54,7 @@ MRB_API mrb_irep *mrb_read_irep_buf(mrb_state*, const void*, size_t);
51
54
  /* Binary Format Version Major:Minor */
52
55
  /* Major: Incompatible to prior versions */
53
56
  /* Minor: Upper-compatible to prior versions */
54
- #define RITE_BINARY_MAJOR_VER "02"
57
+ #define RITE_BINARY_MAJOR_VER "03"
55
58
  #define RITE_BINARY_MINOR_VER "00"
56
59
  #define RITE_BINARY_FORMAT_VER RITE_BINARY_MAJOR_VER RITE_BINARY_MINOR_VER
57
60
  #define RITE_COMPILER_NAME "MATZ"
@@ -17,17 +17,20 @@ MRB_BEGIN_DECL
17
17
  struct RException {
18
18
  MRB_OBJECT_HEADER;
19
19
  struct iv_tbl *iv;
20
+ struct RString *mesg;
20
21
  };
21
22
 
22
23
  #define mrb_exc_ptr(v) ((struct RException*)mrb_ptr(v))
24
+ #define MRB_EXC_MESG_STRING_FLAG 0x100
23
25
 
24
26
  MRB_API void mrb_sys_fail(mrb_state *mrb, const char *mesg);
25
27
  MRB_API mrb_value mrb_exc_new_str(mrb_state *mrb, struct RClass* c, mrb_value str);
26
28
  #define mrb_exc_new_lit(mrb, c, lit) mrb_exc_new_str(mrb, c, mrb_str_new_lit(mrb, lit))
27
29
  #define mrb_exc_new_str_lit(mrb, c, lit) mrb_exc_new_lit(mrb, c, lit)
28
30
  MRB_API mrb_value mrb_make_exception(mrb_state *mrb, mrb_int argc, const mrb_value *argv);
29
- MRB_API mrb_value mrb_exc_backtrace(mrb_state *mrb, mrb_value exc);
30
- MRB_API mrb_value mrb_get_backtrace(mrb_state *mrb);
31
+ mrb_value mrb_exc_backtrace(mrb_state *mrb, mrb_value exc);
32
+ mrb_value mrb_get_backtrace(mrb_state *mrb);
33
+
31
34
  MRB_API mrb_noreturn void mrb_no_method_error(mrb_state *mrb, mrb_sym id, mrb_value args, const char *fmt, ...);
32
35
 
33
36
  /* declaration for `fail` method */
@@ -103,6 +106,13 @@ mrb_break_tag_set(struct RBreak *brk, uint32_t tag)
103
106
  /**
104
107
  * Protect
105
108
  *
109
+ */
110
+ typedef mrb_value mrb_protect_error_func(mrb_state *mrb, void *userdata);
111
+ MRB_API mrb_value mrb_protect_error(mrb_state *mrb, mrb_protect_error_func *body, void *userdata, mrb_bool *error);
112
+
113
+ /**
114
+ * Protect (takes mrb_value for body argument)
115
+ *
106
116
  * Implemented in the mruby-error mrbgem
107
117
  */
108
118
  MRB_API mrb_value mrb_protect(mrb_state *mrb, mrb_func_t body, mrb_value data, mrb_bool *state);
@@ -87,6 +87,8 @@ typedef struct mrb_gc {
87
87
  MRB_API mrb_bool
88
88
  mrb_object_dead_p(struct mrb_state *mrb, struct RBasic *object);
89
89
 
90
+ #define MRB_GC_RED 7
91
+
90
92
  MRB_END_DECL
91
93
 
92
94
  #endif /* MRUBY_GC_H */
@@ -29,7 +29,7 @@ struct RHash {
29
29
  union {
30
30
  struct hash_entry *ea;
31
31
  struct hash_table *ht;
32
- };
32
+ } hsh;
33
33
  };
34
34
 
35
35
  #define mrb_hash_ptr(v) ((struct RHash*)(mrb_ptr(v)))
@@ -37,8 +37,6 @@ struct RHash {
37
37
 
38
38
  size_t mrb_hash_memsize(mrb_value obj);
39
39
  MRB_API mrb_value mrb_hash_new_capa(mrb_state *mrb, mrb_int capa);
40
- MRB_API mrb_value mrb_ensure_hash_type(mrb_state *mrb, mrb_value hash);
41
- MRB_API mrb_value mrb_check_hash_type(mrb_state *mrb, mrb_value hash);
42
40
 
43
41
  /*
44
42
  * Initializes a new hash.
@@ -20,6 +20,7 @@ enum irep_pool_type {
20
20
  IREP_TT_SSTR = 2, /* string (static) */
21
21
  IREP_TT_INT32 = 1, /* 32bit integer */
22
22
  IREP_TT_INT64 = 3, /* 64bit integer */
23
+ IREP_TT_BIGINT = 7, /* big integer (not yet supported) */
23
24
  IREP_TT_FLOAT = 5, /* float (double/float) */
24
25
  };
25
26
 
@@ -31,9 +32,7 @@ typedef struct mrb_pool_value {
31
32
  union {
32
33
  const char *str;
33
34
  int32_t i32;
34
- #if defined(MRB_64BIT) || defined(MRB_INT64)
35
35
  int64_t i64;
36
- #endif
37
36
  #ifndef MRB_NO_FLOAT
38
37
  mrb_float f;
39
38
  #endif
@@ -47,8 +46,8 @@ enum mrb_catch_type {
47
46
 
48
47
  struct mrb_irep_catch_handler {
49
48
  uint8_t type; /* enum mrb_catch_type */
50
- uint8_t begin[4]; /* The starting address to match the hander. Includes this. */
51
- uint8_t end[4]; /* The endpoint address that matches the hander. Not Includes this. */
49
+ uint8_t begin[4]; /* The starting address to match the handler. Includes this. */
50
+ uint8_t end[4]; /* The endpoint address that matches the handler. Not Includes this. */
52
51
  uint8_t target[4]; /* The address to jump to if a match is made. */
53
52
  };
54
53
 
@@ -124,6 +123,7 @@ struct mrb_insn_data {
124
123
  uint16_t a;
125
124
  uint16_t b;
126
125
  uint16_t c;
126
+ const mrb_code *addr;
127
127
  };
128
128
 
129
129
  struct mrb_insn_data mrb_decode_insn(const mrb_code *pc);
@@ -30,21 +30,19 @@ MRB_BEGIN_DECL
30
30
  #endif
31
31
  #endif
32
32
 
33
- #ifndef MRB_NO_FLOAT
34
- MRB_API mrb_value mrb_flo_to_fixnum(mrb_state *mrb, mrb_value val);
35
- #endif
36
- MRB_API mrb_value mrb_fixnum_to_str(mrb_state *mrb, mrb_value x, mrb_int base);
37
- /* ArgumentError if format string doesn't match /%(\.[0-9]+)?[aAeEfFgG]/ */
38
- #ifndef MRB_NO_FLOAT
39
- MRB_API mrb_value mrb_float_to_str(mrb_state *mrb, mrb_value x, const char *fmt);
40
- MRB_API int mrb_float_to_cstr(mrb_state *mrb, char *buf, size_t len, const char *fmt, mrb_float f);
41
- MRB_API mrb_float mrb_to_flo(mrb_state *mrb, mrb_value x);
42
- #endif
43
-
44
33
  MRB_API mrb_value mrb_num_plus(mrb_state *mrb, mrb_value x, mrb_value y);
45
34
  MRB_API mrb_value mrb_num_minus(mrb_state *mrb, mrb_value x, mrb_value y);
46
35
  MRB_API mrb_value mrb_num_mul(mrb_state *mrb, mrb_value x, mrb_value y);
47
36
 
37
+ MRB_API mrb_value mrb_integer_to_str(mrb_state *mrb, mrb_value x, mrb_int base);
38
+ MRB_API char *mrb_int_to_cstr(char *buf, size_t len, mrb_int n, mrb_int base);
39
+
40
+ /* internal function(s) */
41
+ mrb_int mrb_div_int(mrb_state *mrb, mrb_int x, mrb_int y);
42
+
43
+ /* obsolete function(s); will be removed */
44
+ #define mrb_fixnum_to_str(mrb, x, base) mrb_integer_to_str(mrb, x, base)
45
+
48
46
  #ifndef __has_builtin
49
47
  #define __has_builtin(x) 0
50
48
  #endif
@@ -135,8 +133,6 @@ mrb_int_mul_overflow(mrb_int a, mrb_int b, mrb_int *c)
135
133
  #endif
136
134
 
137
135
  #ifndef MRB_NO_FLOAT
138
- # include <stdint.h>
139
- # include <float.h>
140
136
 
141
137
  # define MRB_FLT_RADIX FLT_RADIX
142
138
 
@@ -162,6 +158,18 @@ mrb_int_mul_overflow(mrb_int a, mrb_int b, mrb_int *c)
162
158
  # define MRB_FLT_MAX DBL_MAX
163
159
  # define MRB_FLT_MAX_10_EXP DBL_MAX_10_EXP
164
160
  # endif /* MRB_USE_FLOAT32 */
161
+
162
+ MRB_API mrb_value mrb_float_to_integer(mrb_state *mrb, mrb_value val);
163
+
164
+ /* internal functions */
165
+ mrb_float mrb_div_float(mrb_float x, mrb_float y);
166
+ mrb_value mrb_float_to_str(mrb_state *mrb, mrb_value x, const char *fmt);
167
+ int mrb_format_float(mrb_float f, char *buf, size_t buf_size, char fmt, int prec, char sign);
168
+
169
+ /* obsolete functions; will be removed */
170
+ #define mrb_flo_to_fixnum(mrb, val) mrb_float_to_integer(mrb, val)
171
+ #define mrb_to_flo(mrb, x) mrb_as_float(mrb, x)
172
+
165
173
  #endif /* MRB_NO_FLOAT */
166
174
 
167
175
  MRB_END_DECL
@@ -40,4 +40,34 @@ enum mrb_insn {
40
40
  #define FETCH_S() do {a=READ_S();} while (0)
41
41
  #define FETCH_W() do {a=READ_W();} while (0)
42
42
 
43
+ /* with OP_EXT1 (1st 16bit) */
44
+ #define FETCH_Z_1() FETCH_Z()
45
+ #define FETCH_B_1() FETCH_S()
46
+ #define FETCH_BB_1() do {a=READ_S(); b=READ_B();} while (0)
47
+ #define FETCH_BBB_1() do {a=READ_S(); b=READ_B(); c=READ_B();} while (0)
48
+ #define FETCH_BS_1() do {a=READ_S(); b=READ_S();} while (0)
49
+ #define FETCH_BSS_1() do {a=READ_S(); b=READ_S();c=READ_S();} while (0)
50
+ #define FETCH_S_1() FETCH_S()
51
+ #define FETCH_W_1() FETCH_W()
52
+
53
+ /* with OP_EXT2 (2nd 16bit) */
54
+ #define FETCH_Z_2() FETCH_Z()
55
+ #define FETCH_B_2() FETCH_B()
56
+ #define FETCH_BB_2() do {a=READ_B(); b=READ_S();} while (0)
57
+ #define FETCH_BBB_2() do {a=READ_B(); b=READ_S(); c=READ_B();} while (0)
58
+ #define FETCH_BS_2() FETCH_BS()
59
+ #define FETCH_BSS_2() FETCH_BSS()
60
+ #define FETCH_S_2() FETCH_S()
61
+ #define FETCH_W_2() FETCH_W()
62
+
63
+ /* with OP_EXT3 (1st & 2nd 16bit) */
64
+ #define FETCH_Z_3() FETCH_Z()
65
+ #define FETCH_B_3() FETCH_B()
66
+ #define FETCH_BB_3() do {a=READ_S(); b=READ_S();} while (0)
67
+ #define FETCH_BBB_3() do {a=READ_S(); b=READ_S(); c=READ_B();} while (0)
68
+ #define FETCH_BS_3() do {a=READ_S(); b=READ_S();} while (0)
69
+ #define FETCH_BSS_3() FETCH_BSS_1()
70
+ #define FETCH_S_3() FETCH_S()
71
+ #define FETCH_W_3() FETCH_W()
72
+
43
73
  #endif /* MRUBY_OPCODE_H */