ruby2d 0.10.0 → 0.11.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (387) hide show
  1. checksums.yaml +4 -4
  2. data/assets/include/SDL2/SDL.h +108 -14
  3. data/assets/include/SDL2/SDL_assert.h +81 -50
  4. data/assets/include/SDL2/SDL_atomic.h +135 -35
  5. data/assets/include/SDL2/SDL_audio.h +960 -355
  6. data/assets/include/SDL2/SDL_bits.h +11 -6
  7. data/assets/include/SDL2/SDL_blendmode.h +91 -14
  8. data/assets/include/SDL2/SDL_clipboard.h +30 -7
  9. data/assets/include/SDL2/SDL_config.h +3 -1
  10. data/assets/include/SDL2/SDL_config_android.h +11 -1
  11. data/assets/include/SDL2/SDL_config_emscripten.h +216 -0
  12. data/assets/include/SDL2/SDL_config_iphoneos.h +9 -1
  13. data/assets/include/SDL2/SDL_config_macosx.h +16 -2
  14. data/assets/include/SDL2/SDL_config_minimal.h +4 -1
  15. data/assets/include/SDL2/SDL_config_os2.h +37 -20
  16. data/assets/include/SDL2/SDL_config_pandora.h +6 -1
  17. data/assets/include/SDL2/SDL_config_psp.h +8 -8
  18. data/assets/include/SDL2/SDL_config_windows.h +39 -22
  19. data/assets/include/SDL2/SDL_config_winrt.h +23 -8
  20. data/assets/include/SDL2/SDL_config_wiz.h +6 -1
  21. data/assets/include/SDL2/SDL_copying.h +1 -1
  22. data/assets/include/SDL2/SDL_cpuinfo.h +331 -71
  23. data/assets/include/SDL2/SDL_egl.h +906 -280
  24. data/assets/include/SDL2/SDL_endian.h +101 -47
  25. data/assets/include/SDL2/SDL_error.h +70 -19
  26. data/assets/include/SDL2/SDL_events.h +387 -79
  27. data/assets/include/SDL2/SDL_filesystem.h +73 -64
  28. data/assets/include/SDL2/SDL_gamecontroller.h +585 -125
  29. data/assets/include/SDL2/SDL_gesture.h +36 -6
  30. data/assets/include/SDL2/SDL_haptic.h +304 -210
  31. data/assets/include/SDL2/SDL_hidapi.h +451 -0
  32. data/assets/include/SDL2/SDL_hints.h +1286 -897
  33. data/assets/include/SDL2/SDL_joystick.h +577 -130
  34. data/assets/include/SDL2/SDL_keyboard.h +162 -63
  35. data/assets/include/SDL2/SDL_keycode.h +7 -5
  36. data/assets/include/SDL2/SDL_loadso.h +42 -8
  37. data/assets/include/SDL2/SDL_locale.h +34 -32
  38. data/assets/include/SDL2/SDL_log.h +212 -19
  39. data/assets/include/SDL2/SDL_main.h +72 -17
  40. data/assets/include/SDL2/SDL_messagebox.h +70 -23
  41. data/assets/include/SDL2/SDL_metal.h +27 -32
  42. data/assets/include/SDL2/SDL_misc.h +19 -15
  43. data/assets/include/SDL2/SDL_mouse.h +262 -110
  44. data/assets/include/SDL2/SDL_mutex.h +286 -66
  45. data/assets/include/SDL2/SDL_name.h +1 -1
  46. data/assets/include/SDL2/SDL_opengl.h +1 -1
  47. data/assets/include/SDL2/SDL_opengles.h +1 -1
  48. data/assets/include/SDL2/SDL_opengles2.h +2 -2
  49. data/assets/include/SDL2/SDL_pixels.h +199 -34
  50. data/assets/include/SDL2/SDL_platform.h +39 -2
  51. data/assets/include/SDL2/SDL_power.h +23 -10
  52. data/assets/include/SDL2/SDL_quit.h +1 -1
  53. data/assets/include/SDL2/SDL_rect.h +78 -28
  54. data/assets/include/SDL2/SDL_render.h +1204 -472
  55. data/assets/include/SDL2/SDL_revision.h +2 -2
  56. data/assets/include/SDL2/SDL_rwops.h +605 -33
  57. data/assets/include/SDL2/SDL_scancode.h +1 -1
  58. data/assets/include/SDL2/SDL_sensor.h +76 -42
  59. data/assets/include/SDL2/SDL_shape.h +38 -27
  60. data/assets/include/SDL2/SDL_stdinc.h +96 -24
  61. data/assets/include/SDL2/SDL_surface.h +571 -139
  62. data/assets/include/SDL2/SDL_system.h +339 -101
  63. data/assets/include/SDL2/SDL_syswm.h +50 -20
  64. data/assets/include/SDL2/SDL_test.h +1 -1
  65. data/assets/include/SDL2/SDL_test_assert.h +2 -2
  66. data/assets/include/SDL2/SDL_test_common.h +23 -6
  67. data/assets/include/SDL2/SDL_test_compare.h +1 -1
  68. data/assets/include/SDL2/SDL_test_crc32.h +1 -1
  69. data/assets/include/SDL2/SDL_test_font.h +3 -3
  70. data/assets/include/SDL2/SDL_test_fuzzer.h +28 -26
  71. data/assets/include/SDL2/SDL_test_harness.h +6 -6
  72. data/assets/include/SDL2/SDL_test_images.h +1 -1
  73. data/assets/include/SDL2/SDL_test_log.h +1 -1
  74. data/assets/include/SDL2/SDL_test_md5.h +1 -1
  75. data/assets/include/SDL2/SDL_test_memory.h +1 -1
  76. data/assets/include/SDL2/SDL_test_random.h +2 -2
  77. data/assets/include/SDL2/SDL_thread.h +226 -128
  78. data/assets/include/SDL2/SDL_timer.h +129 -22
  79. data/assets/include/SDL2/SDL_touch.h +48 -8
  80. data/assets/include/SDL2/SDL_ttf.h +102 -9
  81. data/assets/include/SDL2/SDL_types.h +1 -1
  82. data/assets/include/SDL2/SDL_version.h +72 -46
  83. data/assets/include/SDL2/SDL_video.h +1266 -460
  84. data/assets/include/SDL2/SDL_vulkan.h +100 -161
  85. data/assets/include/SDL2/begin_code.h +22 -1
  86. data/assets/include/SDL2/close_code.h +1 -1
  87. data/assets/include/mrbconf.h +234 -0
  88. data/assets/include/mruby/array.h +317 -0
  89. data/assets/include/mruby/boxing_nan.h +130 -0
  90. data/assets/include/mruby/boxing_no.h +58 -0
  91. data/assets/include/mruby/boxing_word.h +205 -0
  92. data/assets/include/mruby/class.h +108 -0
  93. data/assets/include/mruby/common.h +92 -0
  94. data/assets/include/mruby/compile.h +210 -0
  95. data/assets/include/mruby/data.h +76 -0
  96. data/assets/include/mruby/debug.h +66 -0
  97. data/assets/include/mruby/dump.h +158 -0
  98. data/assets/include/mruby/endian.h +44 -0
  99. data/assets/include/mruby/error.h +137 -0
  100. data/assets/include/mruby/gc.h +92 -0
  101. data/assets/include/mruby/hash.h +242 -0
  102. data/assets/include/mruby/irep.h +147 -0
  103. data/assets/include/mruby/istruct.h +50 -0
  104. data/assets/include/mruby/khash.h +284 -0
  105. data/assets/include/mruby/numeric.h +169 -0
  106. data/assets/include/mruby/object.h +43 -0
  107. data/assets/include/mruby/opcode.h +43 -0
  108. data/assets/include/mruby/ops.h +122 -0
  109. data/assets/include/mruby/presym/disable.h +70 -0
  110. data/assets/include/mruby/presym/enable.h +37 -0
  111. data/assets/include/mruby/presym/scanning.h +73 -0
  112. data/assets/include/mruby/presym.h +40 -0
  113. data/assets/include/mruby/proc.h +209 -0
  114. data/assets/include/mruby/range.h +79 -0
  115. data/assets/include/mruby/re.h +16 -0
  116. data/assets/include/mruby/string.h +469 -0
  117. data/assets/include/mruby/throw.h +66 -0
  118. data/assets/include/mruby/value.h +400 -0
  119. data/assets/include/mruby/variable.h +140 -0
  120. data/assets/include/mruby/version.h +143 -0
  121. data/assets/include/mruby.h +1444 -0
  122. data/assets/macos/universal/bin/mrbc +0 -0
  123. data/assets/macos/universal/lib/libFLAC.a +0 -0
  124. data/assets/macos/universal/lib/libSDL2.a +0 -0
  125. data/assets/macos/universal/lib/libSDL2_image.a +0 -0
  126. data/assets/macos/{lib → universal/lib}/libSDL2_mixer.a +0 -0
  127. data/assets/macos/universal/lib/libSDL2_ttf.a +0 -0
  128. data/assets/macos/universal/lib/libfreetype.a +0 -0
  129. data/assets/macos/universal/lib/libgraphite2.a +0 -0
  130. data/assets/macos/universal/lib/libharfbuzz.a +0 -0
  131. data/assets/macos/universal/lib/libjpeg.a +0 -0
  132. data/assets/macos/universal/lib/libmodplug.a +0 -0
  133. data/assets/macos/{lib → universal/lib}/libmpg123.a +0 -0
  134. data/assets/{mingw/lib/libSDL2.a → macos/universal/lib/libmruby.a} +0 -0
  135. data/assets/macos/{lib → universal/lib}/libogg.a +0 -0
  136. data/assets/macos/universal/lib/libpng16.a +0 -0
  137. data/assets/macos/universal/lib/libtiff.a +0 -0
  138. data/assets/macos/universal/lib/libvorbis.a +0 -0
  139. data/assets/macos/universal/lib/libvorbisfile.a +0 -0
  140. data/assets/macos/universal/lib/libwebp.a +0 -0
  141. data/assets/test_media/README.md +3 -0
  142. data/assets/test_media/bitstream_vera/COPYRIGHT.txt +124 -0
  143. data/assets/test_media/bitstream_vera/vera.ttf +0 -0
  144. data/assets/test_media/boom.png +0 -0
  145. data/assets/test_media/coin.png +0 -0
  146. data/assets/test_media/colors.png +0 -0
  147. data/assets/test_media/controller.png +0 -0
  148. data/assets/test_media/dial.wav +0 -0
  149. data/assets/test_media/hero.png +0 -0
  150. data/assets/test_media/image.bmp +0 -0
  151. data/assets/test_media/image.jpg +0 -0
  152. data/assets/test_media/image.png +0 -0
  153. data/assets/test_media/music.flac +0 -0
  154. data/assets/test_media/music.mp3 +0 -0
  155. data/assets/test_media/music.ogg +0 -0
  156. data/assets/test_media/music.wav +0 -0
  157. data/assets/test_media/originals/boom.pxm +0 -0
  158. data/assets/test_media/originals/coin.pxm +0 -0
  159. data/assets/test_media/originals/controller.sketch +0 -0
  160. data/assets/test_media/originals/hero.pxm +0 -0
  161. data/assets/test_media/originals/image.pxm +0 -0
  162. data/assets/test_media/originals/music.caf +0 -0
  163. data/assets/test_media/originals/texture_atlas.pxm +0 -0
  164. data/assets/test_media/rondo_alla_turka.ogg +0 -0
  165. data/assets/test_media/sound.flac +0 -0
  166. data/assets/test_media/sound.mp3 +0 -0
  167. data/assets/test_media/sound.ogg +0 -0
  168. data/assets/test_media/sound.wav +0 -0
  169. data/assets/test_media/sprite_sheet.png +0 -0
  170. data/assets/test_media/texture_atlas.png +0 -0
  171. data/assets/wasm/build_config.rb +13 -0
  172. data/assets/wasm/libmruby.a +0 -0
  173. data/assets/wasm/template.html +17 -0
  174. data/assets/windows/glew/README.md +10 -0
  175. data/assets/windows/glew/glew.h +23686 -0
  176. data/assets/{mingw/lib → windows/glew}/libglew32.a +0 -0
  177. data/assets/windows/mingw-w64-x86_64/bin/mrbc.exe +0 -0
  178. data/assets/windows/mingw-w64-x86_64/lib/libFLAC.a +0 -0
  179. data/assets/windows/mingw-w64-x86_64/lib/libLerc.a +0 -0
  180. data/assets/windows/mingw-w64-x86_64/lib/libSDL2.a +0 -0
  181. data/assets/windows/mingw-w64-x86_64/lib/libSDL2_image.a +0 -0
  182. data/assets/windows/mingw-w64-x86_64/lib/libSDL2_mixer.a +0 -0
  183. data/assets/windows/mingw-w64-x86_64/lib/libSDL2_ttf.a +0 -0
  184. data/assets/windows/mingw-w64-x86_64/lib/libbrotlicommon.a +0 -0
  185. data/assets/windows/mingw-w64-x86_64/lib/libbrotlidec.a +0 -0
  186. data/assets/windows/mingw-w64-x86_64/lib/libbz2.a +0 -0
  187. data/assets/windows/mingw-w64-x86_64/lib/libdeflate.a +0 -0
  188. data/assets/windows/mingw-w64-x86_64/lib/libfreetype.a +0 -0
  189. data/assets/windows/mingw-w64-x86_64/lib/libglew32.a +0 -0
  190. data/assets/windows/mingw-w64-x86_64/lib/libgraphite2.a +0 -0
  191. data/assets/windows/mingw-w64-x86_64/lib/libharfbuzz.a +0 -0
  192. data/assets/windows/mingw-w64-x86_64/lib/libjbig.a +0 -0
  193. data/assets/windows/mingw-w64-x86_64/lib/libjpeg.a +0 -0
  194. data/assets/windows/mingw-w64-x86_64/lib/liblzma.a +0 -0
  195. data/assets/windows/mingw-w64-x86_64/lib/libmodplug.a +0 -0
  196. data/assets/windows/mingw-w64-x86_64/lib/libmpg123.a +0 -0
  197. data/assets/windows/mingw-w64-x86_64/lib/libmruby.a +0 -0
  198. data/assets/windows/mingw-w64-x86_64/lib/libogg.a +0 -0
  199. data/assets/windows/mingw-w64-x86_64/lib/libopus.a +0 -0
  200. data/assets/windows/mingw-w64-x86_64/lib/libopusfile.a +0 -0
  201. data/assets/windows/mingw-w64-x86_64/lib/libpng16.a +0 -0
  202. data/assets/windows/mingw-w64-x86_64/lib/libsndfile.a +0 -0
  203. data/assets/windows/mingw-w64-x86_64/lib/libssp.a +0 -0
  204. data/assets/windows/mingw-w64-x86_64/lib/libstdc++.a +0 -0
  205. data/assets/windows/mingw-w64-x86_64/lib/libtiff.a +0 -0
  206. data/assets/windows/mingw-w64-x86_64/lib/libvorbis.a +0 -0
  207. data/assets/windows/mingw-w64-x86_64/lib/libvorbisfile.a +0 -0
  208. data/assets/windows/mingw-w64-x86_64/lib/libwebp.a +0 -0
  209. data/assets/windows/mingw-w64-x86_64/lib/libz.a +0 -0
  210. data/assets/windows/mingw-w64-x86_64/lib/libzstd.a +0 -0
  211. data/assets/{ios → xcode/ios}/Assets.xcassets/AppIcon.appiconset/Contents.json +0 -0
  212. data/assets/{ios → xcode/ios}/Assets.xcassets/Contents.json +0 -0
  213. data/assets/{ios → xcode/ios}/Base.lproj/LaunchScreen.storyboard +0 -0
  214. data/assets/{ios → xcode/ios}/Info.plist +0 -0
  215. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mrbconf.h +0 -0
  216. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/array.h +0 -0
  217. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/boxing_nan.h +0 -0
  218. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/boxing_no.h +0 -0
  219. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/boxing_word.h +0 -0
  220. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/class.h +0 -0
  221. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/common.h +0 -0
  222. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/compile.h +0 -0
  223. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/data.h +0 -0
  224. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/debug.h +0 -0
  225. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/dump.h +0 -0
  226. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/error.h +0 -0
  227. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/gc.h +0 -0
  228. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/hash.h +0 -0
  229. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/irep.h +0 -0
  230. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/istruct.h +0 -0
  231. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/khash.h +0 -0
  232. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/numeric.h +0 -0
  233. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/object.h +0 -0
  234. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/opcode.h +0 -0
  235. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/ops.h +0 -0
  236. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/proc.h +0 -0
  237. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/range.h +0 -0
  238. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/re.h +0 -0
  239. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/string.h +0 -0
  240. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/throw.h +0 -0
  241. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/value.h +0 -0
  242. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/variable.h +0 -0
  243. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/version.h +0 -0
  244. data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby.h +0 -0
  245. data/assets/{ios → xcode/ios}/MRuby.framework/Info.plist +0 -0
  246. data/assets/{ios → xcode/ios}/MRuby.framework/MRuby +0 -0
  247. data/assets/{ios → xcode/ios}/MyApp.xcodeproj/project.pbxproj +0 -0
  248. data/assets/{ios → xcode/ios}/MyApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -0
  249. data/assets/{ios → xcode/ios}/MyApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -0
  250. data/assets/{ios → xcode/ios}/MyApp.xcodeproj/project.xcworkspace/xcshareddata/MyApp.xcscmblueprint +0 -0
  251. data/assets/{ios → xcode/ios}/main.c +0 -0
  252. data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Content.imageset/Contents.json +0 -0
  253. data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Contents.json +0 -0
  254. data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Contents.json +0 -0
  255. data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Content.imageset/Contents.json +0 -0
  256. data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Contents.json +0 -0
  257. data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json +0 -0
  258. data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Middle.imagestacklayer/Contents.json +0 -0
  259. data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Back.imagestacklayer/Content.imageset/Contents.json +0 -0
  260. data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Back.imagestacklayer/Contents.json +0 -0
  261. data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Contents.json +0 -0
  262. data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Front.imagestacklayer/Content.imageset/Contents.json +0 -0
  263. data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Front.imagestacklayer/Contents.json +0 -0
  264. data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json +0 -0
  265. data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Middle.imagestacklayer/Contents.json +0 -0
  266. data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Contents.json +0 -0
  267. data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image Wide.imageset/Contents.json +0 -0
  268. data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/Contents.json +0 -0
  269. data/assets/{tvos → xcode/tvos}/Assets.xcassets/Contents.json +0 -0
  270. data/assets/{tvos → xcode/tvos}/Assets.xcassets/LaunchImage.launchimage/Contents.json +0 -0
  271. data/assets/{tvos → xcode/tvos}/Info.plist +0 -0
  272. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mrbconf.h +0 -0
  273. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/array.h +0 -0
  274. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/boxing_nan.h +0 -0
  275. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/boxing_no.h +0 -0
  276. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/boxing_word.h +0 -0
  277. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/class.h +0 -0
  278. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/common.h +0 -0
  279. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/compile.h +0 -0
  280. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/data.h +0 -0
  281. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/debug.h +0 -0
  282. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/dump.h +0 -0
  283. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/error.h +0 -0
  284. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/gc.h +0 -0
  285. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/hash.h +0 -0
  286. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/irep.h +0 -0
  287. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/istruct.h +0 -0
  288. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/khash.h +0 -0
  289. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/numeric.h +0 -0
  290. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/object.h +0 -0
  291. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/opcode.h +0 -0
  292. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/ops.h +0 -0
  293. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/proc.h +0 -0
  294. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/range.h +0 -0
  295. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/re.h +0 -0
  296. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/string.h +0 -0
  297. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/throw.h +0 -0
  298. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/value.h +0 -0
  299. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/variable.h +0 -0
  300. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/version.h +0 -0
  301. data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby.h +0 -0
  302. data/assets/{tvos → xcode/tvos}/MRuby.framework/Info.plist +0 -0
  303. data/assets/{tvos → xcode/tvos}/MRuby.framework/MRuby +0 -0
  304. data/assets/{tvos → xcode/tvos}/MyApp.xcodeproj/project.pbxproj +0 -0
  305. data/assets/{tvos → xcode/tvos}/MyApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -0
  306. data/assets/{tvos → xcode/tvos}/MyApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -0
  307. data/assets/{tvos → xcode/tvos}/MyApp.xcodeproj/project.xcworkspace/xcshareddata/MyApp.xcscmblueprint +0 -0
  308. data/assets/{tvos → xcode/tvos}/main.c +0 -0
  309. data/bin/ruby2d +3 -4
  310. data/ext/ruby2d/extconf.rb +68 -46
  311. data/ext/ruby2d/font.c +35 -0
  312. data/ext/ruby2d/gl.c +9 -58
  313. data/ext/ruby2d/gl2.c +8 -83
  314. data/ext/ruby2d/gl3.c +57 -116
  315. data/ext/ruby2d/gles.c +130 -151
  316. data/ext/ruby2d/image.c +16 -96
  317. data/ext/ruby2d/ruby2d.c +265 -298
  318. data/ext/ruby2d/ruby2d.h +69 -159
  319. data/ext/ruby2d/sound.c +1 -1
  320. data/ext/ruby2d/text.c +20 -114
  321. data/ext/ruby2d/window.c +257 -219
  322. data/lib/ruby2d/circle.rb +3 -1
  323. data/lib/ruby2d/cli/build.rb +239 -59
  324. data/lib/ruby2d/cli/colorize.rb +5 -4
  325. data/lib/ruby2d/cli/platform.rb +17 -0
  326. data/lib/ruby2d/font.rb +26 -1
  327. data/lib/ruby2d/image.rb +22 -17
  328. data/lib/ruby2d/line.rb +3 -1
  329. data/lib/ruby2d/quad.rb +3 -1
  330. data/lib/ruby2d/rectangle.rb +1 -1
  331. data/lib/ruby2d/renderable.rb +0 -12
  332. data/lib/ruby2d/sound.rb +25 -0
  333. data/lib/ruby2d/sprite.rb +44 -89
  334. data/lib/ruby2d/square.rb +1 -1
  335. data/lib/ruby2d/text.rb +40 -20
  336. data/lib/ruby2d/texture.rb +28 -0
  337. data/lib/ruby2d/tileset.rb +47 -28
  338. data/lib/ruby2d/triangle.rb +3 -1
  339. data/lib/ruby2d/version.rb +1 -1
  340. data/lib/ruby2d/vertices.rb +89 -0
  341. data/lib/ruby2d/window.rb +13 -3
  342. data/lib/ruby2d.rb +16 -20
  343. metadata +249 -153
  344. data/assets/README.md +0 -22
  345. data/assets/Rakefile +0 -85
  346. data/assets/macos/lib/libFLAC.a +0 -0
  347. data/assets/macos/lib/libSDL2.a +0 -0
  348. data/assets/macos/lib/libSDL2_image.a +0 -0
  349. data/assets/macos/lib/libSDL2_ttf.a +0 -0
  350. data/assets/macos/lib/libfreetype.a +0 -0
  351. data/assets/macos/lib/libjpeg.a +0 -0
  352. data/assets/macos/lib/libpng16.a +0 -0
  353. data/assets/macos/lib/libtiff.a +0 -0
  354. data/assets/macos/lib/libvorbis.a +0 -0
  355. data/assets/macos/lib/libvorbisfile.a +0 -0
  356. data/assets/macos/lib/libwebp.a +0 -0
  357. data/assets/mingw/bin/SDL2.dll +0 -0
  358. data/assets/mingw/bin/SDL2_image.dll +0 -0
  359. data/assets/mingw/bin/SDL2_mixer.dll +0 -0
  360. data/assets/mingw/bin/SDL2_ttf.dll +0 -0
  361. data/assets/mingw/bin/glew32.dll +0 -0
  362. data/assets/mingw/bin/libFLAC-8.dll +0 -0
  363. data/assets/mingw/bin/libfreetype-6.dll +0 -0
  364. data/assets/mingw/bin/libjpeg-9.dll +0 -0
  365. data/assets/mingw/bin/libmodplug-1.dll +0 -0
  366. data/assets/mingw/bin/libmpg123-0.dll +0 -0
  367. data/assets/mingw/bin/libogg-0.dll +0 -0
  368. data/assets/mingw/bin/libopus-0.dll +0 -0
  369. data/assets/mingw/bin/libopusfile-0.dll +0 -0
  370. data/assets/mingw/bin/libpng16-16.dll +0 -0
  371. data/assets/mingw/bin/libtiff-5.dll +0 -0
  372. data/assets/mingw/bin/libvorbis-0.dll +0 -0
  373. data/assets/mingw/bin/libvorbisfile-3.dll +0 -0
  374. data/assets/mingw/bin/libwebp-7.dll +0 -0
  375. data/assets/mingw/bin/zlib1.dll +0 -0
  376. data/assets/mingw/lib/libSDL2.dll.a +0 -0
  377. data/assets/mingw/lib/libSDL2_image.a +0 -0
  378. data/assets/mingw/lib/libSDL2_image.dll.a +0 -0
  379. data/assets/mingw/lib/libSDL2_mixer.a +0 -0
  380. data/assets/mingw/lib/libSDL2_mixer.dll.a +0 -0
  381. data/assets/mingw/lib/libSDL2_test.a +0 -0
  382. data/assets/mingw/lib/libSDL2_ttf.a +0 -0
  383. data/assets/mingw/lib/libSDL2_ttf.dll.a +0 -0
  384. data/assets/mingw/lib/libSDL2main.a +0 -0
  385. data/assets/mingw/lib/libglew32.dll.a +0 -0
  386. data/ext/ruby2d/sprite.c +0 -147
  387. data/ext/ruby2d/tileset.c +0 -30
@@ -0,0 +1,44 @@
1
+ /**
2
+ ** @file mruby/endian.h - detect endian-ness
3
+ **
4
+ ** See Copyright Notice in mruby.h
5
+ */
6
+
7
+ #ifndef MRUBY_ENDIAN_H
8
+ #define MRUBY_ENDIAN_H
9
+
10
+ #include <limits.h>
11
+
12
+ MRB_BEGIN_DECL
13
+
14
+ #if !defined(BYTE_ORDER) && defined(__BYTE_ORDER__)
15
+ # define BYTE_ORDER __BYTE_ORDER__
16
+ #endif
17
+ #if !defined(BIG_ENDIAN) && defined(__ORDER_BIG_ENDIAN__)
18
+ # define BIG_ENDIAN __ORDER_BIG_ENDIAN__
19
+ #endif
20
+ #if !defined(LITTLE_ENDIAN) && defined(__ORDER_LITTLE_ENDIAN__)
21
+ # define LITTLE_ENDIAN __ORDER_LITTLE_ENDIAN__
22
+ #endif
23
+
24
+ #ifdef BYTE_ORDER
25
+ # if BYTE_ORDER == BIG_ENDIAN
26
+ # define littleendian 0
27
+ # elif BYTE_ORDER == LITTLE_ENDIAN
28
+ # define littleendian 1
29
+ # endif
30
+ #endif
31
+ #ifndef littleendian
32
+ /* can't distinguish endian in compile time */
33
+ static inline int
34
+ check_little_endian(void)
35
+ {
36
+ unsigned int n = 1;
37
+ return (*(unsigned char *)&n == 1);
38
+ }
39
+ # define littleendian check_little_endian()
40
+ #endif
41
+
42
+ MRB_END_DECL
43
+
44
+ #endif /* MRUBY_ENDIAN_H */
@@ -0,0 +1,137 @@
1
+ /**
2
+ ** @file mruby/error.h - Exception class
3
+ **
4
+ ** See Copyright Notice in mruby.h
5
+ */
6
+
7
+ #ifndef MRUBY_ERROR_H
8
+ #define MRUBY_ERROR_H
9
+
10
+ #include "common.h"
11
+
12
+ /**
13
+ * MRuby error handling.
14
+ */
15
+ MRB_BEGIN_DECL
16
+
17
+ struct RException {
18
+ MRB_OBJECT_HEADER;
19
+ struct iv_tbl *iv;
20
+ };
21
+
22
+ #define mrb_exc_ptr(v) ((struct RException*)mrb_ptr(v))
23
+
24
+ MRB_API void mrb_sys_fail(mrb_state *mrb, const char *mesg);
25
+ MRB_API mrb_value mrb_exc_new_str(mrb_state *mrb, struct RClass* c, mrb_value str);
26
+ #define mrb_exc_new_lit(mrb, c, lit) mrb_exc_new_str(mrb, c, mrb_str_new_lit(mrb, lit))
27
+ #define mrb_exc_new_str_lit(mrb, c, lit) mrb_exc_new_lit(mrb, c, lit)
28
+ 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_API mrb_noreturn void mrb_no_method_error(mrb_state *mrb, mrb_sym id, mrb_value args, const char *fmt, ...);
32
+
33
+ /* declaration for `fail` method */
34
+ MRB_API mrb_value mrb_f_raise(mrb_state*, mrb_value);
35
+
36
+ #if defined(MRB_64BIT) || defined(MRB_USE_FLOAT32) || defined(MRB_NAN_BOXING) || defined(MRB_WORD_BOXING)
37
+ struct RBreak {
38
+ MRB_OBJECT_HEADER;
39
+ const struct RProc *proc;
40
+ mrb_value val;
41
+ };
42
+ #define mrb_break_value_get(brk) ((brk)->val)
43
+ #define mrb_break_value_set(brk, v) ((brk)->val = v)
44
+ #else
45
+ struct RBreak {
46
+ MRB_OBJECT_HEADER;
47
+ const struct RProc *proc;
48
+ union mrb_value_union value;
49
+ };
50
+ #define RBREAK_VALUE_TT_MASK ((1 << 8) - 1)
51
+ static inline mrb_value
52
+ mrb_break_value_get(struct RBreak *brk)
53
+ {
54
+ mrb_value val;
55
+ val.value = brk->value;
56
+ val.tt = (enum mrb_vtype)(brk->flags & RBREAK_VALUE_TT_MASK);
57
+ return val;
58
+ }
59
+ static inline void
60
+ mrb_break_value_set(struct RBreak *brk, mrb_value val)
61
+ {
62
+ brk->value = val.value;
63
+ brk->flags &= ~RBREAK_VALUE_TT_MASK;
64
+ brk->flags |= val.tt;
65
+ }
66
+ #endif /* MRB_64BIT || MRB_USE_FLOAT32 || MRB_NAN_BOXING || MRB_WORD_BOXING */
67
+ #define mrb_break_proc_get(brk) ((brk)->proc)
68
+ #define mrb_break_proc_set(brk, p) ((brk)->proc = p)
69
+
70
+ #define RBREAK_TAG_FOREACH(f) \
71
+ f(RBREAK_TAG_BREAK, 0) \
72
+ f(RBREAK_TAG_BREAK_UPPER, 1) \
73
+ f(RBREAK_TAG_BREAK_INTARGET, 2) \
74
+ f(RBREAK_TAG_RETURN_BLOCK, 3) \
75
+ f(RBREAK_TAG_RETURN, 4) \
76
+ f(RBREAK_TAG_RETURN_TOPLEVEL, 5) \
77
+ f(RBREAK_TAG_JUMP, 6) \
78
+ f(RBREAK_TAG_STOP, 7)
79
+
80
+ #define RBREAK_TAG_DEFINE(tag, i) tag = i,
81
+ enum {
82
+ RBREAK_TAG_FOREACH(RBREAK_TAG_DEFINE)
83
+ };
84
+ #undef RBREAK_TAG_DEFINE
85
+
86
+ #define RBREAK_TAG_BIT 3
87
+ #define RBREAK_TAG_BIT_OFF 8
88
+ #define RBREAK_TAG_MASK (~(~UINT32_C(0) << RBREAK_TAG_BIT))
89
+
90
+ static inline uint32_t
91
+ mrb_break_tag_get(struct RBreak *brk)
92
+ {
93
+ return (brk->flags >> RBREAK_TAG_BIT_OFF) & RBREAK_TAG_MASK;
94
+ }
95
+
96
+ static inline void
97
+ mrb_break_tag_set(struct RBreak *brk, uint32_t tag)
98
+ {
99
+ brk->flags &= ~(RBREAK_TAG_MASK << RBREAK_TAG_BIT_OFF);
100
+ brk->flags |= (tag & RBREAK_TAG_MASK) << RBREAK_TAG_BIT_OFF;
101
+ }
102
+
103
+ /**
104
+ * Protect
105
+ *
106
+ * Implemented in the mruby-error mrbgem
107
+ */
108
+ MRB_API mrb_value mrb_protect(mrb_state *mrb, mrb_func_t body, mrb_value data, mrb_bool *state);
109
+
110
+ /**
111
+ * Ensure
112
+ *
113
+ * Implemented in the mruby-error mrbgem
114
+ */
115
+ MRB_API mrb_value mrb_ensure(mrb_state *mrb, mrb_func_t body, mrb_value b_data,
116
+ mrb_func_t ensure, mrb_value e_data);
117
+
118
+ /**
119
+ * Rescue
120
+ *
121
+ * Implemented in the mruby-error mrbgem
122
+ */
123
+ MRB_API mrb_value mrb_rescue(mrb_state *mrb, mrb_func_t body, mrb_value b_data,
124
+ mrb_func_t rescue, mrb_value r_data);
125
+
126
+ /**
127
+ * Rescue exception
128
+ *
129
+ * Implemented in the mruby-error mrbgem
130
+ */
131
+ MRB_API mrb_value mrb_rescue_exceptions(mrb_state *mrb, mrb_func_t body, mrb_value b_data,
132
+ mrb_func_t rescue, mrb_value r_data,
133
+ mrb_int len, struct RClass **classes);
134
+
135
+ MRB_END_DECL
136
+
137
+ #endif /* MRUBY_ERROR_H */
@@ -0,0 +1,92 @@
1
+ /**
2
+ ** @file mruby/gc.h - garbage collector for mruby
3
+ **
4
+ ** See Copyright Notice in mruby.h
5
+ */
6
+
7
+ #ifndef MRUBY_GC_H
8
+ #define MRUBY_GC_H
9
+
10
+ #include "common.h"
11
+
12
+ /**
13
+ * Uncommon memory management stuffs.
14
+ */
15
+ MRB_BEGIN_DECL
16
+
17
+
18
+ struct mrb_state;
19
+
20
+ #define MRB_EACH_OBJ_OK 0
21
+ #define MRB_EACH_OBJ_BREAK 1
22
+ typedef int (mrb_each_object_callback)(struct mrb_state *mrb, struct RBasic *obj, void *data);
23
+ void mrb_objspace_each_objects(struct mrb_state *mrb, mrb_each_object_callback *callback, void *data);
24
+ size_t mrb_objspace_page_slot_size(void);
25
+ MRB_API void mrb_free_context(struct mrb_state *mrb, struct mrb_context *c);
26
+
27
+ #ifndef MRB_GC_ARENA_SIZE
28
+ #define MRB_GC_ARENA_SIZE 100
29
+ #endif
30
+
31
+ typedef enum {
32
+ MRB_GC_STATE_ROOT = 0,
33
+ MRB_GC_STATE_MARK,
34
+ MRB_GC_STATE_SWEEP
35
+ } mrb_gc_state;
36
+
37
+ /* Disable MSVC warning "C4200: nonstandard extension used: zero-sized array
38
+ * in struct/union" when in C++ mode */
39
+ #ifdef _MSC_VER
40
+ #pragma warning(push)
41
+ #pragma warning(disable : 4200)
42
+ #endif
43
+
44
+ typedef struct mrb_heap_page {
45
+ struct RBasic *freelist;
46
+ struct mrb_heap_page *prev;
47
+ struct mrb_heap_page *next;
48
+ struct mrb_heap_page *free_next;
49
+ struct mrb_heap_page *free_prev;
50
+ mrb_bool old:1;
51
+ void *objects[];
52
+ } mrb_heap_page;
53
+
54
+ #ifdef _MSC_VER
55
+ #pragma warning(pop)
56
+ #endif
57
+
58
+ typedef struct mrb_gc {
59
+ mrb_heap_page *heaps; /* heaps for GC */
60
+ mrb_heap_page *sweeps;
61
+ mrb_heap_page *free_heaps;
62
+ size_t live; /* count of live objects */
63
+ #ifdef MRB_GC_FIXED_ARENA
64
+ struct RBasic *arena[MRB_GC_ARENA_SIZE]; /* GC protection array */
65
+ #else
66
+ struct RBasic **arena; /* GC protection array */
67
+ int arena_capa;
68
+ #endif
69
+ int arena_idx;
70
+
71
+ mrb_gc_state state; /* state of gc */
72
+ int current_white_part; /* make white object by white_part */
73
+ struct RBasic *gray_list; /* list of gray objects to be traversed incrementally */
74
+ struct RBasic *atomic_gray_list; /* list of objects to be traversed atomically */
75
+ size_t live_after_mark;
76
+ size_t threshold;
77
+ int interval_ratio;
78
+ int step_ratio;
79
+ mrb_bool iterating :1;
80
+ mrb_bool disabled :1;
81
+ mrb_bool full :1;
82
+ mrb_bool generational :1;
83
+ mrb_bool out_of_memory :1;
84
+ size_t majorgc_old_threshold;
85
+ } mrb_gc;
86
+
87
+ MRB_API mrb_bool
88
+ mrb_object_dead_p(struct mrb_state *mrb, struct RBasic *object);
89
+
90
+ MRB_END_DECL
91
+
92
+ #endif /* MRUBY_GC_H */
@@ -0,0 +1,242 @@
1
+ /**
2
+ ** @file mruby/hash.h - Hash class
3
+ **
4
+ ** See Copyright Notice in mruby.h
5
+ */
6
+
7
+ #ifndef MRUBY_HASH_H
8
+ #define MRUBY_HASH_H
9
+
10
+ #include "common.h"
11
+
12
+ /**
13
+ * Hash class
14
+ */
15
+ MRB_BEGIN_DECL
16
+
17
+ /* offset of `iv` must be 3 words */
18
+ struct RHash {
19
+ MRB_OBJECT_HEADER;
20
+ #ifdef MRB_64BIT
21
+ uint32_t size;
22
+ struct iv_tbl *iv;
23
+ uint32_t ea_capa;
24
+ uint32_t ea_n_used;
25
+ #else
26
+ struct iv_tbl *iv;
27
+ uint32_t size;
28
+ #endif
29
+ union {
30
+ struct hash_entry *ea;
31
+ struct hash_table *ht;
32
+ };
33
+ };
34
+
35
+ #define mrb_hash_ptr(v) ((struct RHash*)(mrb_ptr(v)))
36
+ #define mrb_hash_value(p) mrb_obj_value((void*)(p))
37
+
38
+ size_t mrb_hash_memsize(mrb_value obj);
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
+
43
+ /*
44
+ * Initializes a new hash.
45
+ *
46
+ * Equivalent to:
47
+ *
48
+ * Hash.new
49
+ *
50
+ * @param mrb The mruby state reference.
51
+ * @return The initialized hash.
52
+ */
53
+ MRB_API mrb_value mrb_hash_new(mrb_state *mrb);
54
+
55
+ /*
56
+ * Sets a keys and values to hashes.
57
+ *
58
+ * Equivalent to:
59
+ *
60
+ * hash[key] = val
61
+ *
62
+ * @param mrb The mruby state reference.
63
+ * @param hash The target hash.
64
+ * @param key The key to set.
65
+ * @param val The value to set.
66
+ * @return The value.
67
+ */
68
+ MRB_API void mrb_hash_set(mrb_state *mrb, mrb_value hash, mrb_value key, mrb_value val);
69
+
70
+ /*
71
+ * Gets a value from a key. If the key is not found, the default of the
72
+ * hash is used.
73
+ *
74
+ * Equivalent to:
75
+ *
76
+ * hash[key]
77
+ *
78
+ * @param mrb The mruby state reference.
79
+ * @param hash The target hash.
80
+ * @param key The key to get.
81
+ * @return The found value.
82
+ */
83
+ MRB_API mrb_value mrb_hash_get(mrb_state *mrb, mrb_value hash, mrb_value key);
84
+
85
+ /*
86
+ * Gets a value from a key. If the key is not found, the default parameter is
87
+ * used.
88
+ *
89
+ * Equivalent to:
90
+ *
91
+ * hash.key?(key) ? hash[key] : def
92
+ *
93
+ * @param mrb The mruby state reference.
94
+ * @param hash The target hash.
95
+ * @param key The key to get.
96
+ * @param def The default value.
97
+ * @return The found value.
98
+ */
99
+ MRB_API mrb_value mrb_hash_fetch(mrb_state *mrb, mrb_value hash, mrb_value key, mrb_value def);
100
+
101
+ /*
102
+ * Deletes hash key and value pair.
103
+ *
104
+ * Equivalent to:
105
+ *
106
+ * hash.delete(key)
107
+ *
108
+ * @param mrb The mruby state reference.
109
+ * @param hash The target hash.
110
+ * @param key The key to delete.
111
+ * @return The deleted value. This value is not protected from GC. Use `mrb_gc_protect()` if necessary.
112
+ */
113
+ MRB_API mrb_value mrb_hash_delete_key(mrb_state *mrb, mrb_value hash, mrb_value key);
114
+
115
+ /*
116
+ * Gets an array of keys.
117
+ *
118
+ * Equivalent to:
119
+ *
120
+ * hash.keys
121
+ *
122
+ * @param mrb The mruby state reference.
123
+ * @param hash The target hash.
124
+ * @return An array with the keys of the hash.
125
+ */
126
+ MRB_API mrb_value mrb_hash_keys(mrb_state *mrb, mrb_value hash);
127
+ /*
128
+ * Check if the hash has the key.
129
+ *
130
+ * Equivalent to:
131
+ *
132
+ * hash.key?(key)
133
+ *
134
+ * @param mrb The mruby state reference.
135
+ * @param hash The target hash.
136
+ * @param key The key to check existence.
137
+ * @return True if the hash has the key
138
+ */
139
+ MRB_API mrb_bool mrb_hash_key_p(mrb_state *mrb, mrb_value hash, mrb_value key);
140
+
141
+ /*
142
+ * Check if the hash is empty
143
+ *
144
+ * Equivalent to:
145
+ *
146
+ * hash.empty?
147
+ *
148
+ * @param mrb The mruby state reference.
149
+ * @param self The target hash.
150
+ * @return True if the hash is empty, false otherwise.
151
+ */
152
+ MRB_API mrb_bool mrb_hash_empty_p(mrb_state *mrb, mrb_value self);
153
+
154
+ /*
155
+ * Gets an array of values.
156
+ *
157
+ * Equivalent to:
158
+ *
159
+ * hash.values
160
+ *
161
+ * @param mrb The mruby state reference.
162
+ * @param hash The target hash.
163
+ * @return An array with the values of the hash.
164
+ */
165
+ MRB_API mrb_value mrb_hash_values(mrb_state *mrb, mrb_value hash);
166
+
167
+ /*
168
+ * Clears the hash.
169
+ *
170
+ * Equivalent to:
171
+ *
172
+ * hash.clear
173
+ *
174
+ * @param mrb The mruby state reference.
175
+ * @param hash The target hash.
176
+ * @return The hash
177
+ */
178
+ MRB_API mrb_value mrb_hash_clear(mrb_state *mrb, mrb_value hash);
179
+
180
+ /*
181
+ * Get hash size.
182
+ *
183
+ * Equivalent to:
184
+ *
185
+ * hash.size
186
+ *
187
+ * @param mrb The mruby state reference.
188
+ * @param hash The target hash.
189
+ * @return The hash size.
190
+ */
191
+ MRB_API mrb_int mrb_hash_size(mrb_state *mrb, mrb_value hash);
192
+
193
+ /*
194
+ * Copies the hash. This function does NOT copy the instance variables
195
+ * (except for the default value). Use mrb_obj_dup() to copy the instance
196
+ * variables as well.
197
+ *
198
+ * @param mrb The mruby state reference.
199
+ * @param hash The target hash.
200
+ * @return The copy of the hash
201
+ */
202
+ MRB_API mrb_value mrb_hash_dup(mrb_state *mrb, mrb_value hash);
203
+
204
+ /*
205
+ * Merges two hashes. The first hash will be modified by the
206
+ * second hash.
207
+ *
208
+ * @param mrb The mruby state reference.
209
+ * @param hash1 The target hash.
210
+ * @param hash2 Updating hash
211
+ */
212
+ MRB_API void mrb_hash_merge(mrb_state *mrb, mrb_value hash1, mrb_value hash2);
213
+
214
+ #define RHASH(hash) ((struct RHash*)(mrb_ptr(hash)))
215
+
216
+ #define MRB_HASH_IB_BIT_BIT 5
217
+ #define MRB_HASH_AR_EA_CAPA_BIT 5
218
+ #define MRB_HASH_IB_BIT_SHIFT 0
219
+ #define MRB_HASH_AR_EA_CAPA_SHIFT 0
220
+ #define MRB_HASH_AR_EA_N_USED_SHIFT MRB_HASH_AR_EA_CAPA_BIT
221
+ #define MRB_HASH_SIZE_FLAGS_SHIFT (MRB_HASH_AR_EA_CAPA_BIT * 2)
222
+ #define MRB_HASH_IB_BIT_MASK ((1 << MRB_HASH_IB_BIT_BIT) - 1)
223
+ #define MRB_HASH_AR_EA_CAPA_MASK ((1 << MRB_HASH_AR_EA_CAPA_BIT) - 1)
224
+ #define MRB_HASH_AR_EA_N_USED_MASK (MRB_HASH_AR_EA_CAPA_MASK << MRB_HASH_AR_EA_N_USED_SHIFT)
225
+ #define MRB_HASH_DEFAULT (1 << (MRB_HASH_SIZE_FLAGS_SHIFT + 0))
226
+ #define MRB_HASH_PROC_DEFAULT (1 << (MRB_HASH_SIZE_FLAGS_SHIFT + 1))
227
+ #define MRB_HASH_HT (1 << (MRB_HASH_SIZE_FLAGS_SHIFT + 2))
228
+ #define MRB_RHASH_DEFAULT_P(hash) (RHASH(hash)->flags & MRB_HASH_DEFAULT)
229
+ #define MRB_RHASH_PROCDEFAULT_P(hash) (RHASH(hash)->flags & MRB_HASH_PROC_DEFAULT)
230
+
231
+ /* GC functions */
232
+ void mrb_gc_mark_hash(mrb_state*, struct RHash*);
233
+ size_t mrb_gc_mark_hash_size(mrb_state*, struct RHash*);
234
+ void mrb_gc_free_hash(mrb_state*, struct RHash*);
235
+
236
+ /* return non zero to break the loop */
237
+ typedef int (mrb_hash_foreach_func)(mrb_state *mrb, mrb_value key, mrb_value val, void *data);
238
+ MRB_API void mrb_hash_foreach(mrb_state *mrb, struct RHash *hash, mrb_hash_foreach_func *func, void *p);
239
+
240
+ MRB_END_DECL
241
+
242
+ #endif /* MRUBY_HASH_H */
@@ -0,0 +1,147 @@
1
+ /**
2
+ ** @file mruby/irep.h - mrb_irep structure
3
+ **
4
+ ** See Copyright Notice in mruby.h
5
+ */
6
+
7
+ #ifndef MRUBY_IREP_H
8
+ #define MRUBY_IREP_H
9
+
10
+ #include "common.h"
11
+ #include <mruby/compile.h>
12
+
13
+ /**
14
+ * Compiled mruby scripts.
15
+ */
16
+ MRB_BEGIN_DECL
17
+
18
+ enum irep_pool_type {
19
+ IREP_TT_STR = 0, /* string (need free) */
20
+ IREP_TT_SSTR = 2, /* string (static) */
21
+ IREP_TT_INT32 = 1, /* 32bit integer */
22
+ IREP_TT_INT64 = 3, /* 64bit integer */
23
+ IREP_TT_FLOAT = 5, /* float (double/float) */
24
+ };
25
+
26
+ #define IREP_TT_NFLAG 1 /* number (non string) flag */
27
+ #define IREP_TT_SFLAG 2 /* static string flag */
28
+
29
+ typedef struct mrb_pool_value {
30
+ uint32_t tt; /* packed type and length (for string) */
31
+ union {
32
+ const char *str;
33
+ int32_t i32;
34
+ #if defined(MRB_64BIT) || defined(MRB_INT64)
35
+ int64_t i64;
36
+ #endif
37
+ #ifndef MRB_NO_FLOAT
38
+ mrb_float f;
39
+ #endif
40
+ } u;
41
+ } mrb_pool_value;
42
+
43
+ enum mrb_catch_type {
44
+ MRB_CATCH_RESCUE = 0,
45
+ MRB_CATCH_ENSURE = 1,
46
+ };
47
+
48
+ struct mrb_irep_catch_handler {
49
+ 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. */
52
+ uint8_t target[4]; /* The address to jump to if a match is made. */
53
+ };
54
+
55
+ /* Program data array struct */
56
+ typedef struct mrb_irep {
57
+ uint16_t nlocals; /* Number of local variables */
58
+ uint16_t nregs; /* Number of register variables */
59
+ uint16_t clen; /* Number of catch handlers */
60
+ uint8_t flags;
61
+
62
+ const mrb_code *iseq;
63
+ /*
64
+ * A catch handler table is placed after the iseq entity.
65
+ * The reason it doesn't add fields to the structure is to keep the mrb_irep structure from bloating.
66
+ * The catch handler table can be obtained with `mrb_irep_catch_handler_table(irep)`.
67
+ */
68
+ const mrb_pool_value *pool;
69
+ const mrb_sym *syms;
70
+ const struct mrb_irep * const *reps;
71
+
72
+ const mrb_sym *lv;
73
+ /* debug info */
74
+ struct mrb_irep_debug_info* debug_info;
75
+
76
+ uint32_t ilen;
77
+ uint16_t plen, slen;
78
+ uint16_t rlen;
79
+ uint16_t refcnt;
80
+ } mrb_irep;
81
+
82
+ #define MRB_ISEQ_NO_FREE 1
83
+ #define MRB_IREP_NO_FREE 2
84
+ #define MRB_IREP_STATIC (MRB_ISEQ_NO_FREE | MRB_IREP_NO_FREE)
85
+
86
+ MRB_API mrb_irep *mrb_add_irep(mrb_state *mrb);
87
+
88
+ /** load mruby bytecode functions
89
+ * Please note! Currently due to interactions with the GC calling these functions will
90
+ * leak one RProc object per function call.
91
+ * To prevent this save the current memory arena before calling and restore the arena
92
+ * right after, like so
93
+ * int ai = mrb_gc_arena_save(mrb);
94
+ * mrb_value status = mrb_load_irep(mrb, buffer);
95
+ * mrb_gc_arena_restore(mrb, ai);
96
+ */
97
+
98
+ /* @param [const uint8_t*] irep code, expected as a literal */
99
+ MRB_API mrb_value mrb_load_irep(mrb_state*, const uint8_t*);
100
+
101
+ /*
102
+ * @param [const void*] irep code
103
+ * @param [size_t] size of irep buffer. If -1 is given, it is considered unrestricted.
104
+ */
105
+ MRB_API mrb_value mrb_load_irep_buf(mrb_state*, const void*, size_t);
106
+
107
+ /* @param [const uint8_t*] irep code, expected as a literal */
108
+ MRB_API mrb_value mrb_load_irep_cxt(mrb_state*, const uint8_t*, mrbc_context*);
109
+
110
+ /*
111
+ * @param [const void*] irep code
112
+ * @param [size_t] size of irep buffer. If -1 is given, it is considered unrestricted.
113
+ */
114
+ MRB_API mrb_value mrb_load_irep_buf_cxt(mrb_state*, const void*, size_t, mrbc_context*);
115
+
116
+ void mrb_irep_free(mrb_state*, struct mrb_irep*);
117
+ void mrb_irep_incref(mrb_state*, struct mrb_irep*);
118
+ void mrb_irep_decref(mrb_state*, struct mrb_irep*);
119
+ void mrb_irep_cutref(mrb_state*, struct mrb_irep*);
120
+ void mrb_irep_remove_lv(mrb_state *mrb, mrb_irep *irep);
121
+
122
+ struct mrb_insn_data {
123
+ uint8_t insn;
124
+ uint16_t a;
125
+ uint16_t b;
126
+ uint16_t c;
127
+ };
128
+
129
+ struct mrb_insn_data mrb_decode_insn(const mrb_code *pc);
130
+
131
+ static inline const struct mrb_irep_catch_handler *
132
+ mrb_irep_catch_handler_table(const struct mrb_irep *irep)
133
+ {
134
+ if (irep->clen > 0) {
135
+ return (const struct mrb_irep_catch_handler*)(irep->iseq + irep->ilen);
136
+ }
137
+ else {
138
+ return (const struct mrb_irep_catch_handler*)NULL;
139
+ }
140
+ }
141
+
142
+ #define mrb_irep_catch_handler_pack(n, v) uint32_to_bin(n, v)
143
+ #define mrb_irep_catch_handler_unpack(v) bin_to_uint32(v)
144
+
145
+ MRB_END_DECL
146
+
147
+ #endif /* MRUBY_IREP_H */
@@ -0,0 +1,50 @@
1
+ /**
2
+ ** @file mruby/istruct.h - Inline structures
3
+ **
4
+ ** See Copyright Notice in mruby.h
5
+ */
6
+
7
+ #ifndef MRUBY_ISTRUCT_H
8
+ #define MRUBY_ISTRUCT_H
9
+
10
+ #include "common.h"
11
+ #include <string.h>
12
+
13
+ /**
14
+ * Inline structures that fit in RVALUE
15
+ *
16
+ * They cannot have finalizer, and cannot have instance variables.
17
+ */
18
+ MRB_BEGIN_DECL
19
+
20
+ #define ISTRUCT_DATA_SIZE (sizeof(void*) * 3)
21
+
22
+ struct RIStruct {
23
+ MRB_OBJECT_HEADER;
24
+ union {
25
+ intptr_t inline_alignment[3];
26
+ char inline_data[ISTRUCT_DATA_SIZE];
27
+ };
28
+ };
29
+
30
+ #define RISTRUCT(obj) ((struct RIStruct*)(mrb_ptr(obj)))
31
+ #define ISTRUCT_PTR(obj) (RISTRUCT(obj)->inline_data)
32
+
33
+ MRB_INLINE mrb_int mrb_istruct_size()
34
+ {
35
+ return ISTRUCT_DATA_SIZE;
36
+ }
37
+
38
+ MRB_INLINE void* mrb_istruct_ptr(mrb_value object)
39
+ {
40
+ return ISTRUCT_PTR(object);
41
+ }
42
+
43
+ MRB_INLINE void mrb_istruct_copy(mrb_value dest, mrb_value src)
44
+ {
45
+ memcpy(ISTRUCT_PTR(dest), ISTRUCT_PTR(src), ISTRUCT_DATA_SIZE);
46
+ }
47
+
48
+ MRB_END_DECL
49
+
50
+ #endif /* MRUBY_ISTRUCT_H */