ruby2d 0.11.1 → 0.11.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (371) 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/{lib → 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 +39 -25
  311. data/ext/ruby2d/gl.c +1 -1
  312. data/ext/ruby2d/gl3.c +0 -1
  313. data/ext/ruby2d/gles.c +137 -84
  314. data/ext/ruby2d/ruby2d.c +126 -32
  315. data/ext/ruby2d/ruby2d.h +53 -6
  316. data/ext/ruby2d/text.c +14 -1
  317. data/ext/ruby2d/window.c +253 -215
  318. data/lib/ruby2d/cli/build.rb +237 -59
  319. data/lib/ruby2d/cli/colorize.rb +5 -4
  320. data/lib/ruby2d/cli/platform.rb +17 -0
  321. data/lib/ruby2d/font.rb +7 -1
  322. data/lib/ruby2d/sprite.rb +7 -2
  323. data/lib/ruby2d/text.rb +1 -3
  324. data/lib/ruby2d/texture.rb +21 -21
  325. data/lib/ruby2d/tileset.rb +34 -33
  326. data/lib/ruby2d/version.rb +1 -1
  327. data/lib/ruby2d/vertices.rb +11 -6
  328. data/lib/ruby2d.rb +14 -20
  329. metadata +246 -152
  330. data/assets/README.md +0 -22
  331. data/assets/Rakefile +0 -85
  332. data/assets/macos/lib/libFLAC.a +0 -0
  333. data/assets/macos/lib/libSDL2.a +0 -0
  334. data/assets/macos/lib/libSDL2_image.a +0 -0
  335. data/assets/macos/lib/libSDL2_ttf.a +0 -0
  336. data/assets/macos/lib/libfreetype.a +0 -0
  337. data/assets/macos/lib/libjpeg.a +0 -0
  338. data/assets/macos/lib/libpng16.a +0 -0
  339. data/assets/macos/lib/libtiff.a +0 -0
  340. data/assets/macos/lib/libvorbis.a +0 -0
  341. data/assets/macos/lib/libvorbisfile.a +0 -0
  342. data/assets/macos/lib/libwebp.a +0 -0
  343. data/assets/mingw/bin/SDL2.dll +0 -0
  344. data/assets/mingw/bin/SDL2_image.dll +0 -0
  345. data/assets/mingw/bin/SDL2_mixer.dll +0 -0
  346. data/assets/mingw/bin/SDL2_ttf.dll +0 -0
  347. data/assets/mingw/bin/glew32.dll +0 -0
  348. data/assets/mingw/bin/libFLAC-8.dll +0 -0
  349. data/assets/mingw/bin/libfreetype-6.dll +0 -0
  350. data/assets/mingw/bin/libjpeg-9.dll +0 -0
  351. data/assets/mingw/bin/libmodplug-1.dll +0 -0
  352. data/assets/mingw/bin/libmpg123-0.dll +0 -0
  353. data/assets/mingw/bin/libogg-0.dll +0 -0
  354. data/assets/mingw/bin/libopus-0.dll +0 -0
  355. data/assets/mingw/bin/libopusfile-0.dll +0 -0
  356. data/assets/mingw/bin/libpng16-16.dll +0 -0
  357. data/assets/mingw/bin/libtiff-5.dll +0 -0
  358. data/assets/mingw/bin/libvorbis-0.dll +0 -0
  359. data/assets/mingw/bin/libvorbisfile-3.dll +0 -0
  360. data/assets/mingw/bin/libwebp-7.dll +0 -0
  361. data/assets/mingw/bin/zlib1.dll +0 -0
  362. data/assets/mingw/lib/libSDL2.dll.a +0 -0
  363. data/assets/mingw/lib/libSDL2_image.a +0 -0
  364. data/assets/mingw/lib/libSDL2_image.dll.a +0 -0
  365. data/assets/mingw/lib/libSDL2_mixer.a +0 -0
  366. data/assets/mingw/lib/libSDL2_mixer.dll.a +0 -0
  367. data/assets/mingw/lib/libSDL2_test.a +0 -0
  368. data/assets/mingw/lib/libSDL2_ttf.a +0 -0
  369. data/assets/mingw/lib/libSDL2_ttf.dll.a +0 -0
  370. data/assets/mingw/lib/libSDL2main.a +0 -0
  371. data/assets/mingw/lib/libglew32.dll.a +0 -0
@@ -0,0 +1,108 @@
1
+ /**
2
+ ** @file mruby/class.h - Class class
3
+ **
4
+ ** See Copyright Notice in mruby.h
5
+ */
6
+
7
+ #ifndef MRUBY_CLASS_H
8
+ #define MRUBY_CLASS_H
9
+
10
+ #include "common.h"
11
+
12
+ /**
13
+ * Class class
14
+ */
15
+ MRB_BEGIN_DECL
16
+
17
+ struct RClass {
18
+ MRB_OBJECT_HEADER;
19
+ struct iv_tbl *iv;
20
+ struct mt_tbl *mt;
21
+ struct RClass *super;
22
+ };
23
+
24
+ #define mrb_class_ptr(v) ((struct RClass*)(mrb_ptr(v)))
25
+
26
+ MRB_INLINE struct RClass*
27
+ mrb_class(mrb_state *mrb, mrb_value v)
28
+ {
29
+ switch (mrb_type(v)) {
30
+ case MRB_TT_FALSE:
31
+ if (mrb_fixnum(v))
32
+ return mrb->false_class;
33
+ return mrb->nil_class;
34
+ case MRB_TT_TRUE:
35
+ return mrb->true_class;
36
+ case MRB_TT_SYMBOL:
37
+ return mrb->symbol_class;
38
+ case MRB_TT_INTEGER:
39
+ return mrb->integer_class;
40
+ #ifndef MRB_NO_FLOAT
41
+ case MRB_TT_FLOAT:
42
+ return mrb->float_class;
43
+ #endif
44
+ case MRB_TT_CPTR:
45
+ return mrb->object_class;
46
+ case MRB_TT_ENV:
47
+ return NULL;
48
+ default:
49
+ return mrb_obj_ptr(v)->c;
50
+ }
51
+ }
52
+
53
+ /* flags:
54
+ 20: frozen
55
+ 19: is_prepended
56
+ 18: is_origin
57
+ 17: is_inherited (used by method cache)
58
+ 16: unused
59
+ 0-15: instance type
60
+ */
61
+ #define MRB_FL_CLASS_IS_PREPENDED (1 << 19)
62
+ #define MRB_FL_CLASS_IS_ORIGIN (1 << 18)
63
+ #define MRB_CLASS_ORIGIN(c) do {\
64
+ if ((c)->flags & MRB_FL_CLASS_IS_PREPENDED) {\
65
+ (c) = (c)->super;\
66
+ while (!((c)->flags & MRB_FL_CLASS_IS_ORIGIN)) {\
67
+ (c) = (c)->super;\
68
+ }\
69
+ }\
70
+ } while (0)
71
+ #define MRB_FL_CLASS_IS_INHERITED (1 << 17)
72
+ #define MRB_INSTANCE_TT_MASK (0xFF)
73
+ #define MRB_SET_INSTANCE_TT(c, tt) ((c)->flags = (((c)->flags & ~MRB_INSTANCE_TT_MASK) | (char)(tt)))
74
+ #define MRB_INSTANCE_TT(c) (enum mrb_vtype)((c)->flags & MRB_INSTANCE_TT_MASK)
75
+
76
+ struct RClass *mrb_vm_define_class(mrb_state*, mrb_value, mrb_value, mrb_sym);
77
+ struct RClass *mrb_vm_define_module(mrb_state*, mrb_value, mrb_sym);
78
+ MRB_API void mrb_define_method_raw(mrb_state*, struct RClass*, mrb_sym, mrb_method_t);
79
+ MRB_API void mrb_alias_method(mrb_state*, struct RClass *c, mrb_sym a, mrb_sym b);
80
+ MRB_API void mrb_remove_method(mrb_state *mrb, struct RClass *c, mrb_sym sym);
81
+
82
+ MRB_API mrb_method_t mrb_method_search_vm(mrb_state*, struct RClass**, mrb_sym);
83
+ MRB_API mrb_method_t mrb_method_search(mrb_state*, struct RClass*, mrb_sym);
84
+
85
+ MRB_API struct RClass* mrb_class_real(struct RClass* cl);
86
+ mrb_value mrb_instance_new(mrb_state *mrb, mrb_value cv);
87
+
88
+ void mrb_class_name_class(mrb_state*, struct RClass*, struct RClass*, mrb_sym);
89
+ mrb_bool mrb_const_name_p(mrb_state*, const char*, mrb_int);
90
+ mrb_value mrb_class_find_path(mrb_state*, struct RClass*);
91
+ mrb_value mrb_mod_to_s(mrb_state*, mrb_value);
92
+ void mrb_gc_mark_mt(mrb_state*, struct RClass*);
93
+ size_t mrb_gc_mark_mt_size(mrb_state*, struct RClass*);
94
+ void mrb_gc_free_mt(mrb_state*, struct RClass*);
95
+
96
+ #ifndef MRB_NO_METHOD_CACHE
97
+ void mrb_mc_clear_by_class(mrb_state *mrb, struct RClass* c);
98
+ #else
99
+ #define mrb_mc_clear_by_class(mrb,c)
100
+ #endif
101
+
102
+ /* return non zero to break the loop */
103
+ typedef int (mrb_mt_foreach_func)(mrb_state*,mrb_sym,mrb_method_t,void*);
104
+ MRB_API void mrb_mt_foreach(mrb_state*, struct RClass*, mrb_mt_foreach_func*, void*);
105
+
106
+ MRB_END_DECL
107
+
108
+ #endif /* MRUBY_CLASS_H */
@@ -0,0 +1,92 @@
1
+ /**
2
+ ** @file common.h - mruby common platform definition"
3
+ **
4
+ ** See Copyright Notice in mruby.h
5
+ */
6
+
7
+ #ifndef MRUBY_COMMON_H
8
+ #define MRUBY_COMMON_H
9
+
10
+ #ifdef __APPLE__
11
+ #ifndef __TARGETCONDITIONALS__
12
+ #include "TargetConditionals.h"
13
+ #endif
14
+ #endif
15
+
16
+ #ifdef __cplusplus
17
+ #ifdef MRB_USE_CXX_ABI
18
+ #define MRB_BEGIN_DECL
19
+ #define MRB_END_DECL
20
+ #else
21
+ # define MRB_BEGIN_DECL extern "C" {
22
+ # define MRB_END_DECL }
23
+ #endif
24
+ #else
25
+ /** Start declarations in C mode */
26
+ # define MRB_BEGIN_DECL
27
+ /** End declarations in C mode */
28
+ # define MRB_END_DECL
29
+ #endif
30
+
31
+ /**
32
+ * Shared compiler macros
33
+ */
34
+ MRB_BEGIN_DECL
35
+
36
+ /** Declare a function that never returns. */
37
+ #if defined __STDC_VERSION__ && __STDC_VERSION__ >= 201112L
38
+ # define mrb_noreturn _Noreturn
39
+ #elif defined __GNUC__ && !defined __STRICT_ANSI__
40
+ # define mrb_noreturn __attribute__((noreturn))
41
+ #elif defined _MSC_VER
42
+ # define mrb_noreturn __declspec(noreturn)
43
+ #else
44
+ # define mrb_noreturn
45
+ #endif
46
+
47
+ /** Mark a function as deprecated. */
48
+ #if defined __GNUC__ && !defined __STRICT_ANSI__
49
+ # define mrb_deprecated __attribute__((deprecated))
50
+ #elif defined _MSC_VER
51
+ # define mrb_deprecated __declspec(deprecated)
52
+ #else
53
+ # define mrb_deprecated
54
+ #endif
55
+
56
+ /** Declare a function as always inlined. */
57
+ #if defined _MSC_VER && _MSC_VER < 1900
58
+ # ifndef __cplusplus
59
+ # define inline __inline
60
+ # endif
61
+ #endif
62
+ #define MRB_INLINE static inline
63
+
64
+ /** Declare a public MRuby API function. */
65
+ #ifndef MRB_API
66
+ #if defined(MRB_BUILD_AS_DLL)
67
+ #if defined(MRB_CORE) || defined(MRB_LIB)
68
+ # define MRB_API __declspec(dllexport)
69
+ #else
70
+ # define MRB_API __declspec(dllimport)
71
+ #endif
72
+ #else
73
+ # define MRB_API extern
74
+ #endif
75
+ #endif
76
+
77
+ /** Declare mingw versions */
78
+ #if defined(__MINGW32__) || defined(__MINGW64__)
79
+ # include <_mingw.h>
80
+ # if defined(__MINGW64_VERSION_MAJOR)
81
+ # define MRB_MINGW64_VERSION (__MINGW64_VERSION_MAJOR * 1000 + __MINGW64_VERSION_MINOR)
82
+ # elif defined(__MINGW32_MAJOR_VERSION)
83
+ # define MRB_MINGW32_VERSION (__MINGW32_MAJOR_VERSION * 1000 + __MINGW32_MINOR_VERSION)
84
+ # endif
85
+ # if defined(__MINGW32__) && !defined(__MINGW64__)
86
+ # define MRB_MINGW32_LEGACY
87
+ # endif
88
+ #endif
89
+
90
+ MRB_END_DECL
91
+
92
+ #endif /* MRUBY_COMMON_H */
@@ -0,0 +1,210 @@
1
+ /**
2
+ ** @file mruby/compile.h - mruby parser
3
+ **
4
+ ** See Copyright Notice in mruby.h
5
+ */
6
+
7
+ #ifndef MRUBY_COMPILE_H
8
+ #define MRUBY_COMPILE_H
9
+
10
+ #include "common.h"
11
+
12
+ /**
13
+ * MRuby Compiler
14
+ */
15
+ MRB_BEGIN_DECL
16
+
17
+ #include <mruby.h>
18
+
19
+ struct mrb_jmpbuf;
20
+
21
+ struct mrb_parser_state;
22
+ /* load context */
23
+ typedef struct mrbc_context {
24
+ mrb_sym *syms;
25
+ int slen;
26
+ char *filename;
27
+ uint16_t lineno;
28
+ int (*partial_hook)(struct mrb_parser_state*);
29
+ void *partial_data;
30
+ struct RClass *target_class;
31
+ mrb_bool capture_errors:1;
32
+ mrb_bool dump_result:1;
33
+ mrb_bool no_exec:1;
34
+ mrb_bool keep_lv:1;
35
+ mrb_bool no_optimize:1;
36
+ const struct RProc *upper;
37
+
38
+ size_t parser_nerr;
39
+ } mrbc_context;
40
+
41
+ MRB_API mrbc_context* mrbc_context_new(mrb_state *mrb);
42
+ MRB_API void mrbc_context_free(mrb_state *mrb, mrbc_context *cxt);
43
+ MRB_API const char *mrbc_filename(mrb_state *mrb, mrbc_context *c, const char *s);
44
+ MRB_API void mrbc_partial_hook(mrb_state *mrb, mrbc_context *c, int (*partial_hook)(struct mrb_parser_state*), void*data);
45
+ MRB_API void mrbc_cleanup_local_variables(mrb_state *mrb, mrbc_context *c);
46
+
47
+ /* AST node structure */
48
+ typedef struct mrb_ast_node {
49
+ struct mrb_ast_node *car, *cdr;
50
+ uint16_t lineno, filename_index;
51
+ } mrb_ast_node;
52
+
53
+ /* lexer states */
54
+ enum mrb_lex_state_enum {
55
+ EXPR_BEG, /* ignore newline, +/- is a sign. */
56
+ EXPR_END, /* newline significant, +/- is an operator. */
57
+ EXPR_ENDARG, /* ditto, and unbound braces. */
58
+ EXPR_ENDFN, /* ditto, and unbound braces. */
59
+ EXPR_ARG, /* newline significant, +/- is an operator. */
60
+ EXPR_CMDARG, /* newline significant, +/- is an operator. */
61
+ EXPR_MID, /* newline significant, +/- is an operator. */
62
+ EXPR_FNAME, /* ignore newline, no reserved words. */
63
+ EXPR_DOT, /* right after '.' or '::', no reserved words. */
64
+ EXPR_CLASS, /* immediate after 'class', no here document. */
65
+ EXPR_VALUE, /* alike EXPR_BEG but label is disallowed. */
66
+ EXPR_MAX_STATE
67
+ };
68
+
69
+ /* saved error message */
70
+ struct mrb_parser_message {
71
+ uint16_t lineno;
72
+ int column;
73
+ char* message;
74
+ };
75
+
76
+ #define STR_FUNC_PARSING 0x01
77
+ #define STR_FUNC_EXPAND 0x02
78
+ #define STR_FUNC_REGEXP 0x04
79
+ #define STR_FUNC_WORD 0x08
80
+ #define STR_FUNC_SYMBOL 0x10
81
+ #define STR_FUNC_ARRAY 0x20
82
+ #define STR_FUNC_HEREDOC 0x40
83
+ #define STR_FUNC_XQUOTE 0x80
84
+
85
+ enum mrb_string_type {
86
+ str_not_parsing = (0),
87
+ str_squote = (STR_FUNC_PARSING),
88
+ str_dquote = (STR_FUNC_PARSING|STR_FUNC_EXPAND),
89
+ str_regexp = (STR_FUNC_PARSING|STR_FUNC_REGEXP|STR_FUNC_EXPAND),
90
+ str_sword = (STR_FUNC_PARSING|STR_FUNC_WORD|STR_FUNC_ARRAY),
91
+ str_dword = (STR_FUNC_PARSING|STR_FUNC_WORD|STR_FUNC_ARRAY|STR_FUNC_EXPAND),
92
+ str_ssym = (STR_FUNC_PARSING|STR_FUNC_SYMBOL),
93
+ str_ssymbols = (STR_FUNC_PARSING|STR_FUNC_SYMBOL|STR_FUNC_ARRAY),
94
+ str_dsymbols = (STR_FUNC_PARSING|STR_FUNC_SYMBOL|STR_FUNC_ARRAY|STR_FUNC_EXPAND),
95
+ str_heredoc = (STR_FUNC_PARSING|STR_FUNC_HEREDOC),
96
+ str_xquote = (STR_FUNC_PARSING|STR_FUNC_XQUOTE|STR_FUNC_EXPAND),
97
+ };
98
+
99
+ /* heredoc structure */
100
+ struct mrb_parser_heredoc_info {
101
+ mrb_bool allow_indent:1;
102
+ mrb_bool remove_indent:1;
103
+ size_t indent;
104
+ mrb_ast_node *indented;
105
+ mrb_bool line_head:1;
106
+ enum mrb_string_type type;
107
+ const char *term;
108
+ int term_len;
109
+ mrb_ast_node *doc;
110
+ };
111
+
112
+ #define MRB_PARSER_TOKBUF_MAX (UINT16_MAX-1)
113
+ #define MRB_PARSER_TOKBUF_SIZE 256
114
+
115
+ /* parser structure */
116
+ struct mrb_parser_state {
117
+ mrb_state *mrb;
118
+ struct mrb_pool *pool;
119
+ mrb_ast_node *cells;
120
+ const char *s, *send;
121
+ #ifndef MRB_NO_STDIO
122
+ /* If both f and s are non-null, it will be taken preferentially from s until s < send. */
123
+ FILE *f;
124
+ #endif
125
+ mrbc_context *cxt;
126
+ mrb_sym filename_sym;
127
+ uint16_t lineno;
128
+ int column;
129
+
130
+ enum mrb_lex_state_enum lstate;
131
+ mrb_ast_node *lex_strterm; /* (type nest_level beg . end) */
132
+
133
+ unsigned int cond_stack;
134
+ unsigned int cmdarg_stack;
135
+ int paren_nest;
136
+ int lpar_beg;
137
+ int in_def, in_single;
138
+ mrb_bool cmd_start:1;
139
+ mrb_ast_node *locals;
140
+
141
+ mrb_ast_node *pb;
142
+ char *tokbuf;
143
+ char buf[MRB_PARSER_TOKBUF_SIZE];
144
+ int tidx;
145
+ int tsiz;
146
+
147
+ mrb_ast_node *all_heredocs; /* list of mrb_parser_heredoc_info* */
148
+ mrb_ast_node *heredocs_from_nextline;
149
+ mrb_ast_node *parsing_heredoc;
150
+ mrb_ast_node *lex_strterm_before_heredoc;
151
+
152
+ void *ylval;
153
+
154
+ size_t nerr;
155
+ size_t nwarn;
156
+ mrb_ast_node *tree;
157
+
158
+ mrb_bool no_optimize:1;
159
+ mrb_bool capture_errors:1;
160
+ const struct RProc *upper;
161
+ struct mrb_parser_message error_buffer[10];
162
+ struct mrb_parser_message warn_buffer[10];
163
+
164
+ mrb_sym* filename_table;
165
+ uint16_t filename_table_length;
166
+ uint16_t current_filename_index;
167
+
168
+ struct mrb_jmpbuf* jmp;
169
+ mrb_ast_node *nvars;
170
+ };
171
+
172
+ MRB_API struct mrb_parser_state* mrb_parser_new(mrb_state*);
173
+ MRB_API void mrb_parser_free(struct mrb_parser_state*);
174
+ MRB_API void mrb_parser_parse(struct mrb_parser_state*,mrbc_context*);
175
+
176
+ MRB_API void mrb_parser_set_filename(struct mrb_parser_state*, char const*);
177
+ MRB_API mrb_sym mrb_parser_get_filename(struct mrb_parser_state*, uint16_t idx);
178
+
179
+ /* utility functions */
180
+ #ifndef MRB_NO_STDIO
181
+ MRB_API struct mrb_parser_state* mrb_parse_file(mrb_state*,FILE*,mrbc_context*);
182
+ #endif
183
+ MRB_API struct mrb_parser_state* mrb_parse_string(mrb_state*,const char*,mrbc_context*);
184
+ MRB_API struct mrb_parser_state* mrb_parse_nstring(mrb_state*,const char*,size_t,mrbc_context*);
185
+ MRB_API struct RProc* mrb_generate_code(mrb_state*, struct mrb_parser_state*);
186
+ MRB_API mrb_value mrb_load_exec(mrb_state *mrb, struct mrb_parser_state *p, mrbc_context *c);
187
+
188
+ /** program load functions
189
+ * Please note! Currently due to interactions with the GC calling these functions will
190
+ * leak one RProc object per function call.
191
+ * To prevent this save the current memory arena before calling and restore the arena
192
+ * right after, like so
193
+ * int ai = mrb_gc_arena_save(mrb);
194
+ * mrb_value status = mrb_load_string(mrb, buffer);
195
+ * mrb_gc_arena_restore(mrb, ai);
196
+ */
197
+ #ifndef MRB_NO_STDIO
198
+ MRB_API mrb_value mrb_load_file(mrb_state*,FILE*);
199
+ MRB_API mrb_value mrb_load_file_cxt(mrb_state*,FILE*, mrbc_context *cxt);
200
+ MRB_API mrb_value mrb_load_detect_file_cxt(mrb_state *mrb, FILE *fp, mrbc_context *c);
201
+ #endif
202
+ MRB_API mrb_value mrb_load_string(mrb_state *mrb, const char *s);
203
+ MRB_API mrb_value mrb_load_nstring(mrb_state *mrb, const char *s, size_t len);
204
+ MRB_API mrb_value mrb_load_string_cxt(mrb_state *mrb, const char *s, mrbc_context *cxt);
205
+ MRB_API mrb_value mrb_load_nstring_cxt(mrb_state *mrb, const char *s, size_t len, mrbc_context *cxt);
206
+
207
+ /** @} */
208
+ MRB_END_DECL
209
+
210
+ #endif /* MRUBY_COMPILE_H */
@@ -0,0 +1,76 @@
1
+ /**
2
+ ** @file mruby/data.h - Data class
3
+ **
4
+ ** See Copyright Notice in mruby.h
5
+ */
6
+
7
+ #ifndef MRUBY_DATA_H
8
+ #define MRUBY_DATA_H
9
+
10
+ #include "common.h"
11
+
12
+ /**
13
+ * Custom C wrapped data.
14
+ *
15
+ * Defining Ruby wrappers around native objects.
16
+ */
17
+ MRB_BEGIN_DECL
18
+
19
+ /**
20
+ * Custom data type description.
21
+ */
22
+ typedef struct mrb_data_type {
23
+ /** data type name */
24
+ const char *struct_name;
25
+
26
+ /** data type release function pointer */
27
+ void (*dfree)(mrb_state *mrb, void*);
28
+ } mrb_data_type;
29
+
30
+ struct RData {
31
+ MRB_OBJECT_HEADER;
32
+ struct iv_tbl *iv;
33
+ const mrb_data_type *type;
34
+ void *data;
35
+ };
36
+
37
+ MRB_API struct RData *mrb_data_object_alloc(mrb_state *mrb, struct RClass* klass, void *datap, const mrb_data_type *type);
38
+
39
+ #define Data_Wrap_Struct(mrb,klass,type,ptr)\
40
+ mrb_data_object_alloc(mrb,klass,ptr,type)
41
+
42
+ #define Data_Make_Struct(mrb,klass,strct,type,sval,data_obj) do { \
43
+ (data_obj) = Data_Wrap_Struct(mrb,klass,type,NULL);\
44
+ (sval) = (strct *)mrb_malloc(mrb, sizeof(strct)); \
45
+ { static const strct zero = { 0 }; *(sval) = zero; };\
46
+ (data_obj)->data = (sval);\
47
+ } while (0)
48
+
49
+ #define RDATA(obj) ((struct RData *)(mrb_ptr(obj)))
50
+ #define DATA_PTR(d) (RDATA(d)->data)
51
+ #define DATA_TYPE(d) (RDATA(d)->type)
52
+ MRB_API void mrb_data_check_type(mrb_state *mrb, mrb_value, const mrb_data_type*);
53
+ MRB_API void *mrb_data_get_ptr(mrb_state *mrb, mrb_value, const mrb_data_type*);
54
+ #define DATA_GET_PTR(mrb,obj,dtype,type) (type*)mrb_data_get_ptr(mrb,obj,dtype)
55
+ MRB_API void *mrb_data_check_get_ptr(mrb_state *mrb, mrb_value, const mrb_data_type*);
56
+ #define DATA_CHECK_GET_PTR(mrb,obj,dtype,type) (type*)mrb_data_check_get_ptr(mrb,obj,dtype)
57
+
58
+ /* obsolete functions and macros */
59
+ #define mrb_data_check_and_get(mrb,obj,dtype) mrb_data_get_ptr(mrb,obj,dtype)
60
+ #define mrb_get_datatype(mrb,val,type) mrb_data_get_ptr(mrb, val, type)
61
+ #define mrb_check_datatype(mrb,val,type) mrb_data_get_ptr(mrb, val, type)
62
+ #define Data_Get_Struct(mrb,obj,type,sval) do {\
63
+ *(void**)&sval = mrb_data_get_ptr(mrb, obj, type); \
64
+ } while (0)
65
+
66
+ MRB_INLINE void
67
+ mrb_data_init(mrb_value v, void *ptr, const mrb_data_type *type)
68
+ {
69
+ mrb_assert(mrb_data_p(v));
70
+ DATA_PTR(v) = ptr;
71
+ DATA_TYPE(v) = type;
72
+ }
73
+
74
+ MRB_END_DECL
75
+
76
+ #endif /* MRUBY_DATA_H */
@@ -0,0 +1,66 @@
1
+ /**
2
+ ** @file mruby/debug.h - mruby debug info
3
+ **
4
+ ** See Copyright Notice in mruby.h
5
+ */
6
+
7
+ #ifndef MRUBY_DEBUG_H
8
+ #define MRUBY_DEBUG_H
9
+
10
+ #include "common.h"
11
+
12
+ /**
13
+ * MRuby Debugging.
14
+ */
15
+ MRB_BEGIN_DECL
16
+
17
+ typedef enum mrb_debug_line_type {
18
+ mrb_debug_line_ary = 0,
19
+ mrb_debug_line_flat_map = 1
20
+ } mrb_debug_line_type;
21
+
22
+ typedef struct mrb_irep_debug_info_line {
23
+ uint32_t start_pos;
24
+ uint16_t line;
25
+ } mrb_irep_debug_info_line;
26
+
27
+ typedef struct mrb_irep_debug_info_file {
28
+ uint32_t start_pos;
29
+ mrb_sym filename_sym;
30
+ uint32_t line_entry_count;
31
+ mrb_debug_line_type line_type;
32
+ union {
33
+ void *ptr;
34
+ mrb_irep_debug_info_line *flat_map;
35
+ uint16_t *ary;
36
+ } lines;
37
+ } mrb_irep_debug_info_file;
38
+
39
+ typedef struct mrb_irep_debug_info {
40
+ uint32_t pc_count;
41
+ uint16_t flen;
42
+ mrb_irep_debug_info_file **files;
43
+ } mrb_irep_debug_info;
44
+
45
+ /*
46
+ * get line from irep's debug info and program counter
47
+ * @return returns NULL if not found
48
+ */
49
+ MRB_API const char *mrb_debug_get_filename(mrb_state *mrb, const mrb_irep *irep, uint32_t pc);
50
+
51
+ /*
52
+ * get line from irep's debug info and program counter
53
+ * @return returns -1 if not found
54
+ */
55
+ MRB_API int32_t mrb_debug_get_line(mrb_state *mrb, const mrb_irep *irep, uint32_t pc);
56
+
57
+ MRB_API mrb_irep_debug_info *mrb_debug_info_alloc(mrb_state *mrb, mrb_irep *irep);
58
+ MRB_API mrb_irep_debug_info_file *mrb_debug_info_append_file(
59
+ mrb_state *mrb, mrb_irep_debug_info *info,
60
+ const char *filename, uint16_t *lines,
61
+ uint32_t start_pos, uint32_t end_pos);
62
+ MRB_API void mrb_debug_info_free(mrb_state *mrb, mrb_irep_debug_info *d);
63
+
64
+ MRB_END_DECL
65
+
66
+ #endif /* MRUBY_DEBUG_H */
@@ -0,0 +1,158 @@
1
+ /**
2
+ ** @file mruby/dump.h - mruby binary dumper (mrbc binary format)
3
+ **
4
+ ** See Copyright Notice in mruby.h
5
+ */
6
+
7
+ #ifndef MRUBY_DUMP_H
8
+ #define MRUBY_DUMP_H
9
+
10
+ #include <mruby.h>
11
+ #include <mruby/irep.h>
12
+ #include "common.h"
13
+
14
+ /**
15
+ * Dumping compiled mruby script.
16
+ */
17
+ MRB_BEGIN_DECL
18
+
19
+ #define DUMP_DEBUG_INFO 1
20
+
21
+ int mrb_dump_irep(mrb_state *mrb, const mrb_irep *irep, uint8_t flags, uint8_t **bin, size_t *bin_size);
22
+ #ifndef MRB_NO_STDIO
23
+ int mrb_dump_irep_binary(mrb_state*, const mrb_irep*, uint8_t, FILE*);
24
+ int mrb_dump_irep_cfunc(mrb_state *mrb, const mrb_irep*, uint8_t flags, FILE *f, const char *initname);
25
+ int mrb_dump_irep_cstruct(mrb_state *mrb, const mrb_irep*, uint8_t flags, FILE *f, const char *initname);
26
+ mrb_irep *mrb_read_irep_file(mrb_state*, FILE*);
27
+ MRB_API mrb_value mrb_load_irep_file(mrb_state*,FILE*);
28
+ MRB_API mrb_value mrb_load_irep_file_cxt(mrb_state*, FILE*, mrbc_context*);
29
+ #endif
30
+ MRB_API mrb_irep *mrb_read_irep(mrb_state*, const uint8_t*);
31
+ MRB_API mrb_irep *mrb_read_irep_buf(mrb_state*, const void*, size_t);
32
+
33
+ /* dump/load error code
34
+ *
35
+ * NOTE: MRB_DUMP_GENERAL_FAILURE is caused by
36
+ * unspecified issues like malloc failed.
37
+ */
38
+ #define MRB_DUMP_OK 0
39
+ #define MRB_DUMP_GENERAL_FAILURE (-1)
40
+ #define MRB_DUMP_WRITE_FAULT (-2)
41
+ #define MRB_DUMP_READ_FAULT (-3)
42
+ #define MRB_DUMP_INVALID_FILE_HEADER (-4)
43
+ #define MRB_DUMP_INVALID_IREP (-5)
44
+ #define MRB_DUMP_INVALID_ARGUMENT (-6)
45
+
46
+ /* null symbol length */
47
+ #define MRB_DUMP_NULL_SYM_LEN 0xFFFF
48
+
49
+ /* Rite Binary File header */
50
+ #define RITE_BINARY_IDENT "RITE"
51
+ /* Binary Format Version Major:Minor */
52
+ /* Major: Incompatible to prior versions */
53
+ /* Minor: Upper-compatible to prior versions */
54
+ #define RITE_BINARY_MAJOR_VER "02"
55
+ #define RITE_BINARY_MINOR_VER "00"
56
+ #define RITE_BINARY_FORMAT_VER RITE_BINARY_MAJOR_VER RITE_BINARY_MINOR_VER
57
+ #define RITE_COMPILER_NAME "MATZ"
58
+ #define RITE_COMPILER_VERSION "0000"
59
+
60
+ #define RITE_VM_VER "0300"
61
+
62
+ #define RITE_BINARY_EOF "END\0"
63
+ #define RITE_SECTION_IREP_IDENT "IREP"
64
+ #define RITE_SECTION_DEBUG_IDENT "DBG\0"
65
+ #define RITE_SECTION_LV_IDENT "LVAR"
66
+
67
+ #define MRB_DUMP_DEFAULT_STR_LEN 128
68
+ #define MRB_DUMP_ALIGNMENT sizeof(uint32_t)
69
+
70
+ /* binary header */
71
+ struct rite_binary_header {
72
+ uint8_t binary_ident[4]; /* Binary Identifier */
73
+ uint8_t major_version[2]; /* Binary Format Major Version */
74
+ uint8_t minor_version[2]; /* Binary Format Minor Version */
75
+ uint8_t binary_size[4]; /* Binary Size */
76
+ uint8_t compiler_name[4]; /* Compiler name */
77
+ uint8_t compiler_version[4];
78
+ };
79
+
80
+ /* section header */
81
+ #define RITE_SECTION_HEADER \
82
+ uint8_t section_ident[4]; \
83
+ uint8_t section_size[4]
84
+
85
+ struct rite_section_header {
86
+ RITE_SECTION_HEADER;
87
+ };
88
+
89
+ struct rite_section_irep_header {
90
+ RITE_SECTION_HEADER;
91
+
92
+ uint8_t rite_version[4]; /* Rite Instruction Specification Version */
93
+ };
94
+
95
+ struct rite_section_debug_header {
96
+ RITE_SECTION_HEADER;
97
+ };
98
+
99
+ struct rite_section_lv_header {
100
+ RITE_SECTION_HEADER;
101
+ };
102
+
103
+ #define RITE_LV_NULL_MARK UINT16_MAX
104
+
105
+ struct rite_binary_footer {
106
+ RITE_SECTION_HEADER;
107
+ };
108
+
109
+ static inline size_t
110
+ uint8_to_bin(uint8_t s, uint8_t *bin)
111
+ {
112
+ *bin = s;
113
+ return sizeof(uint8_t);
114
+ }
115
+
116
+ static inline size_t
117
+ uint16_to_bin(uint16_t s, uint8_t *bin)
118
+ {
119
+ *bin++ = (s >> 8) & 0xff;
120
+ *bin = s & 0xff;
121
+ return sizeof(uint16_t);
122
+ }
123
+
124
+ static inline size_t
125
+ uint32_to_bin(uint32_t l, uint8_t *bin)
126
+ {
127
+ *bin++ = (l >> 24) & 0xff;
128
+ *bin++ = (l >> 16) & 0xff;
129
+ *bin++ = (l >> 8) & 0xff;
130
+ *bin = l & 0xff;
131
+ return sizeof(uint32_t);
132
+ }
133
+
134
+ static inline uint32_t
135
+ bin_to_uint32(const uint8_t *bin)
136
+ {
137
+ return (uint32_t)bin[0] << 24 |
138
+ (uint32_t)bin[1] << 16 |
139
+ (uint32_t)bin[2] << 8 |
140
+ (uint32_t)bin[3];
141
+ }
142
+
143
+ static inline uint16_t
144
+ bin_to_uint16(const uint8_t *bin)
145
+ {
146
+ return (uint16_t)bin[0] << 8 |
147
+ (uint16_t)bin[1];
148
+ }
149
+
150
+ static inline uint8_t
151
+ bin_to_uint8(const uint8_t *bin)
152
+ {
153
+ return (uint8_t)bin[0];
154
+ }
155
+
156
+ MRB_END_DECL
157
+
158
+ #endif /* MRUBY_DUMP_H */