ruby2d 0.10.0 → 0.11.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/assets/include/SDL2/SDL.h +108 -14
- data/assets/include/SDL2/SDL_assert.h +81 -50
- data/assets/include/SDL2/SDL_atomic.h +135 -35
- data/assets/include/SDL2/SDL_audio.h +960 -355
- data/assets/include/SDL2/SDL_bits.h +11 -6
- data/assets/include/SDL2/SDL_blendmode.h +91 -14
- data/assets/include/SDL2/SDL_clipboard.h +30 -7
- data/assets/include/SDL2/SDL_config.h +3 -1
- data/assets/include/SDL2/SDL_config_android.h +11 -1
- data/assets/include/SDL2/SDL_config_emscripten.h +216 -0
- data/assets/include/SDL2/SDL_config_iphoneos.h +9 -1
- data/assets/include/SDL2/SDL_config_macosx.h +16 -2
- data/assets/include/SDL2/SDL_config_minimal.h +4 -1
- data/assets/include/SDL2/SDL_config_os2.h +37 -20
- data/assets/include/SDL2/SDL_config_pandora.h +6 -1
- data/assets/include/SDL2/SDL_config_psp.h +8 -8
- data/assets/include/SDL2/SDL_config_windows.h +39 -22
- data/assets/include/SDL2/SDL_config_winrt.h +23 -8
- data/assets/include/SDL2/SDL_config_wiz.h +6 -1
- data/assets/include/SDL2/SDL_copying.h +1 -1
- data/assets/include/SDL2/SDL_cpuinfo.h +331 -71
- data/assets/include/SDL2/SDL_egl.h +906 -280
- data/assets/include/SDL2/SDL_endian.h +101 -47
- data/assets/include/SDL2/SDL_error.h +70 -19
- data/assets/include/SDL2/SDL_events.h +387 -79
- data/assets/include/SDL2/SDL_filesystem.h +73 -64
- data/assets/include/SDL2/SDL_gamecontroller.h +585 -125
- data/assets/include/SDL2/SDL_gesture.h +36 -6
- data/assets/include/SDL2/SDL_haptic.h +304 -210
- data/assets/include/SDL2/SDL_hidapi.h +451 -0
- data/assets/include/SDL2/SDL_hints.h +1286 -897
- data/assets/include/SDL2/SDL_joystick.h +577 -130
- data/assets/include/SDL2/SDL_keyboard.h +162 -63
- data/assets/include/SDL2/SDL_keycode.h +7 -5
- data/assets/include/SDL2/SDL_loadso.h +42 -8
- data/assets/include/SDL2/SDL_locale.h +34 -32
- data/assets/include/SDL2/SDL_log.h +212 -19
- data/assets/include/SDL2/SDL_main.h +72 -17
- data/assets/include/SDL2/SDL_messagebox.h +70 -23
- data/assets/include/SDL2/SDL_metal.h +27 -32
- data/assets/include/SDL2/SDL_misc.h +19 -15
- data/assets/include/SDL2/SDL_mouse.h +262 -110
- data/assets/include/SDL2/SDL_mutex.h +286 -66
- data/assets/include/SDL2/SDL_name.h +1 -1
- data/assets/include/SDL2/SDL_opengl.h +1 -1
- data/assets/include/SDL2/SDL_opengles.h +1 -1
- data/assets/include/SDL2/SDL_opengles2.h +2 -2
- data/assets/include/SDL2/SDL_pixels.h +199 -34
- data/assets/include/SDL2/SDL_platform.h +39 -2
- data/assets/include/SDL2/SDL_power.h +23 -10
- data/assets/include/SDL2/SDL_quit.h +1 -1
- data/assets/include/SDL2/SDL_rect.h +78 -28
- data/assets/include/SDL2/SDL_render.h +1204 -472
- data/assets/include/SDL2/SDL_revision.h +2 -2
- data/assets/include/SDL2/SDL_rwops.h +605 -33
- data/assets/include/SDL2/SDL_scancode.h +1 -1
- data/assets/include/SDL2/SDL_sensor.h +76 -42
- data/assets/include/SDL2/SDL_shape.h +38 -27
- data/assets/include/SDL2/SDL_stdinc.h +96 -24
- data/assets/include/SDL2/SDL_surface.h +571 -139
- data/assets/include/SDL2/SDL_system.h +339 -101
- data/assets/include/SDL2/SDL_syswm.h +50 -20
- data/assets/include/SDL2/SDL_test.h +1 -1
- data/assets/include/SDL2/SDL_test_assert.h +2 -2
- data/assets/include/SDL2/SDL_test_common.h +23 -6
- data/assets/include/SDL2/SDL_test_compare.h +1 -1
- data/assets/include/SDL2/SDL_test_crc32.h +1 -1
- data/assets/include/SDL2/SDL_test_font.h +3 -3
- data/assets/include/SDL2/SDL_test_fuzzer.h +28 -26
- data/assets/include/SDL2/SDL_test_harness.h +6 -6
- data/assets/include/SDL2/SDL_test_images.h +1 -1
- data/assets/include/SDL2/SDL_test_log.h +1 -1
- data/assets/include/SDL2/SDL_test_md5.h +1 -1
- data/assets/include/SDL2/SDL_test_memory.h +1 -1
- data/assets/include/SDL2/SDL_test_random.h +2 -2
- data/assets/include/SDL2/SDL_thread.h +226 -128
- data/assets/include/SDL2/SDL_timer.h +129 -22
- data/assets/include/SDL2/SDL_touch.h +48 -8
- data/assets/include/SDL2/SDL_ttf.h +102 -9
- data/assets/include/SDL2/SDL_types.h +1 -1
- data/assets/include/SDL2/SDL_version.h +72 -46
- data/assets/include/SDL2/SDL_video.h +1266 -460
- data/assets/include/SDL2/SDL_vulkan.h +100 -161
- data/assets/include/SDL2/begin_code.h +22 -1
- data/assets/include/SDL2/close_code.h +1 -1
- data/assets/include/mrbconf.h +234 -0
- data/assets/include/mruby/array.h +317 -0
- data/assets/include/mruby/boxing_nan.h +130 -0
- data/assets/include/mruby/boxing_no.h +58 -0
- data/assets/include/mruby/boxing_word.h +205 -0
- data/assets/include/mruby/class.h +108 -0
- data/assets/include/mruby/common.h +92 -0
- data/assets/include/mruby/compile.h +210 -0
- data/assets/include/mruby/data.h +76 -0
- data/assets/include/mruby/debug.h +66 -0
- data/assets/include/mruby/dump.h +158 -0
- data/assets/include/mruby/endian.h +44 -0
- data/assets/include/mruby/error.h +137 -0
- data/assets/include/mruby/gc.h +92 -0
- data/assets/include/mruby/hash.h +242 -0
- data/assets/include/mruby/irep.h +147 -0
- data/assets/include/mruby/istruct.h +50 -0
- data/assets/include/mruby/khash.h +284 -0
- data/assets/include/mruby/numeric.h +169 -0
- data/assets/include/mruby/object.h +43 -0
- data/assets/include/mruby/opcode.h +43 -0
- data/assets/include/mruby/ops.h +122 -0
- data/assets/include/mruby/presym/disable.h +70 -0
- data/assets/include/mruby/presym/enable.h +37 -0
- data/assets/include/mruby/presym/scanning.h +73 -0
- data/assets/include/mruby/presym.h +40 -0
- data/assets/include/mruby/proc.h +209 -0
- data/assets/include/mruby/range.h +79 -0
- data/assets/include/mruby/re.h +16 -0
- data/assets/include/mruby/string.h +469 -0
- data/assets/include/mruby/throw.h +66 -0
- data/assets/include/mruby/value.h +400 -0
- data/assets/include/mruby/variable.h +140 -0
- data/assets/include/mruby/version.h +143 -0
- data/assets/include/mruby.h +1444 -0
- data/assets/macos/universal/bin/mrbc +0 -0
- data/assets/macos/universal/lib/libFLAC.a +0 -0
- data/assets/macos/universal/lib/libSDL2.a +0 -0
- data/assets/macos/universal/lib/libSDL2_image.a +0 -0
- data/assets/macos/{lib → universal/lib}/libSDL2_mixer.a +0 -0
- data/assets/macos/universal/lib/libSDL2_ttf.a +0 -0
- data/assets/macos/universal/lib/libfreetype.a +0 -0
- data/assets/macos/universal/lib/libgraphite2.a +0 -0
- data/assets/macos/universal/lib/libharfbuzz.a +0 -0
- data/assets/macos/universal/lib/libjpeg.a +0 -0
- data/assets/macos/universal/lib/libmodplug.a +0 -0
- data/assets/macos/{lib → universal/lib}/libmpg123.a +0 -0
- data/assets/{mingw/lib/libSDL2.a → macos/universal/lib/libmruby.a} +0 -0
- data/assets/macos/{lib → universal/lib}/libogg.a +0 -0
- data/assets/macos/universal/lib/libpng16.a +0 -0
- data/assets/macos/universal/lib/libtiff.a +0 -0
- data/assets/macos/universal/lib/libvorbis.a +0 -0
- data/assets/macos/universal/lib/libvorbisfile.a +0 -0
- data/assets/macos/universal/lib/libwebp.a +0 -0
- data/assets/test_media/README.md +3 -0
- data/assets/test_media/bitstream_vera/COPYRIGHT.txt +124 -0
- data/assets/test_media/bitstream_vera/vera.ttf +0 -0
- data/assets/test_media/boom.png +0 -0
- data/assets/test_media/coin.png +0 -0
- data/assets/test_media/colors.png +0 -0
- data/assets/test_media/controller.png +0 -0
- data/assets/test_media/dial.wav +0 -0
- data/assets/test_media/hero.png +0 -0
- data/assets/test_media/image.bmp +0 -0
- data/assets/test_media/image.jpg +0 -0
- data/assets/test_media/image.png +0 -0
- data/assets/test_media/music.flac +0 -0
- data/assets/test_media/music.mp3 +0 -0
- data/assets/test_media/music.ogg +0 -0
- data/assets/test_media/music.wav +0 -0
- data/assets/test_media/originals/boom.pxm +0 -0
- data/assets/test_media/originals/coin.pxm +0 -0
- data/assets/test_media/originals/controller.sketch +0 -0
- data/assets/test_media/originals/hero.pxm +0 -0
- data/assets/test_media/originals/image.pxm +0 -0
- data/assets/test_media/originals/music.caf +0 -0
- data/assets/test_media/originals/texture_atlas.pxm +0 -0
- data/assets/test_media/rondo_alla_turka.ogg +0 -0
- data/assets/test_media/sound.flac +0 -0
- data/assets/test_media/sound.mp3 +0 -0
- data/assets/test_media/sound.ogg +0 -0
- data/assets/test_media/sound.wav +0 -0
- data/assets/test_media/sprite_sheet.png +0 -0
- data/assets/test_media/texture_atlas.png +0 -0
- data/assets/wasm/build_config.rb +13 -0
- data/assets/wasm/libmruby.a +0 -0
- data/assets/wasm/template.html +17 -0
- data/assets/windows/glew/README.md +10 -0
- data/assets/windows/glew/glew.h +23686 -0
- data/assets/{mingw/lib → windows/glew}/libglew32.a +0 -0
- data/assets/windows/mingw-w64-x86_64/bin/mrbc.exe +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libFLAC.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libLerc.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libSDL2.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libSDL2_image.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libSDL2_mixer.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libSDL2_ttf.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libbrotlicommon.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libbrotlidec.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libbz2.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libdeflate.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libfreetype.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libglew32.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libgraphite2.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libharfbuzz.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libjbig.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libjpeg.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/liblzma.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libmodplug.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libmpg123.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libmruby.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libogg.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libopus.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libopusfile.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libpng16.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libsndfile.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libssp.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libstdc++.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libtiff.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libvorbis.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libvorbisfile.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libwebp.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libz.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libzstd.a +0 -0
- data/assets/{ios → xcode/ios}/Assets.xcassets/AppIcon.appiconset/Contents.json +0 -0
- data/assets/{ios → xcode/ios}/Assets.xcassets/Contents.json +0 -0
- data/assets/{ios → xcode/ios}/Base.lproj/LaunchScreen.storyboard +0 -0
- data/assets/{ios → xcode/ios}/Info.plist +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mrbconf.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/array.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/boxing_nan.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/boxing_no.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/boxing_word.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/class.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/common.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/compile.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/data.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/debug.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/dump.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/error.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/gc.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/hash.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/irep.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/istruct.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/khash.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/numeric.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/object.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/opcode.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/ops.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/proc.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/range.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/re.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/string.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/throw.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/value.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/variable.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby/version.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Headers/mruby.h +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/Info.plist +0 -0
- data/assets/{ios → xcode/ios}/MRuby.framework/MRuby +0 -0
- data/assets/{ios → xcode/ios}/MyApp.xcodeproj/project.pbxproj +0 -0
- data/assets/{ios → xcode/ios}/MyApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -0
- data/assets/{ios → xcode/ios}/MyApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -0
- data/assets/{ios → xcode/ios}/MyApp.xcodeproj/project.xcworkspace/xcshareddata/MyApp.xcscmblueprint +0 -0
- data/assets/{ios → xcode/ios}/main.c +0 -0
- 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
- data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Contents.json +0 -0
- data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Contents.json +0 -0
- 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
- data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Contents.json +0 -0
- 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
- data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Middle.imagestacklayer/Contents.json +0 -0
- 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
- data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Back.imagestacklayer/Contents.json +0 -0
- data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Contents.json +0 -0
- 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
- data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Front.imagestacklayer/Contents.json +0 -0
- 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
- data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Middle.imagestacklayer/Contents.json +0 -0
- data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Contents.json +0 -0
- data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image Wide.imageset/Contents.json +0 -0
- data/assets/{tvos → xcode/tvos}/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/Contents.json +0 -0
- data/assets/{tvos → xcode/tvos}/Assets.xcassets/Contents.json +0 -0
- data/assets/{tvos → xcode/tvos}/Assets.xcassets/LaunchImage.launchimage/Contents.json +0 -0
- data/assets/{tvos → xcode/tvos}/Info.plist +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mrbconf.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/array.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/boxing_nan.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/boxing_no.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/boxing_word.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/class.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/common.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/compile.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/data.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/debug.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/dump.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/error.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/gc.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/hash.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/irep.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/istruct.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/khash.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/numeric.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/object.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/opcode.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/ops.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/proc.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/range.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/re.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/string.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/throw.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/value.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/variable.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby/version.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Headers/mruby.h +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/Info.plist +0 -0
- data/assets/{tvos → xcode/tvos}/MRuby.framework/MRuby +0 -0
- data/assets/{tvos → xcode/tvos}/MyApp.xcodeproj/project.pbxproj +0 -0
- data/assets/{tvos → xcode/tvos}/MyApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -0
- data/assets/{tvos → xcode/tvos}/MyApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -0
- data/assets/{tvos → xcode/tvos}/MyApp.xcodeproj/project.xcworkspace/xcshareddata/MyApp.xcscmblueprint +0 -0
- data/assets/{tvos → xcode/tvos}/main.c +0 -0
- data/bin/ruby2d +3 -4
- data/ext/ruby2d/extconf.rb +68 -46
- data/ext/ruby2d/font.c +35 -0
- data/ext/ruby2d/gl.c +9 -58
- data/ext/ruby2d/gl2.c +8 -83
- data/ext/ruby2d/gl3.c +57 -116
- data/ext/ruby2d/gles.c +130 -151
- data/ext/ruby2d/image.c +16 -96
- data/ext/ruby2d/ruby2d.c +265 -298
- data/ext/ruby2d/ruby2d.h +69 -159
- data/ext/ruby2d/sound.c +1 -1
- data/ext/ruby2d/text.c +20 -114
- data/ext/ruby2d/window.c +257 -219
- data/lib/ruby2d/circle.rb +3 -1
- data/lib/ruby2d/cli/build.rb +239 -59
- data/lib/ruby2d/cli/colorize.rb +5 -4
- data/lib/ruby2d/cli/platform.rb +17 -0
- data/lib/ruby2d/font.rb +26 -1
- data/lib/ruby2d/image.rb +22 -17
- data/lib/ruby2d/line.rb +3 -1
- data/lib/ruby2d/quad.rb +3 -1
- data/lib/ruby2d/rectangle.rb +1 -1
- data/lib/ruby2d/renderable.rb +0 -12
- data/lib/ruby2d/sound.rb +25 -0
- data/lib/ruby2d/sprite.rb +44 -89
- data/lib/ruby2d/square.rb +1 -1
- data/lib/ruby2d/text.rb +40 -20
- data/lib/ruby2d/texture.rb +28 -0
- data/lib/ruby2d/tileset.rb +47 -28
- data/lib/ruby2d/triangle.rb +3 -1
- data/lib/ruby2d/version.rb +1 -1
- data/lib/ruby2d/vertices.rb +89 -0
- data/lib/ruby2d/window.rb +13 -3
- data/lib/ruby2d.rb +16 -20
- metadata +249 -153
- data/assets/README.md +0 -22
- data/assets/Rakefile +0 -85
- data/assets/macos/lib/libFLAC.a +0 -0
- data/assets/macos/lib/libSDL2.a +0 -0
- data/assets/macos/lib/libSDL2_image.a +0 -0
- data/assets/macos/lib/libSDL2_ttf.a +0 -0
- data/assets/macos/lib/libfreetype.a +0 -0
- data/assets/macos/lib/libjpeg.a +0 -0
- data/assets/macos/lib/libpng16.a +0 -0
- data/assets/macos/lib/libtiff.a +0 -0
- data/assets/macos/lib/libvorbis.a +0 -0
- data/assets/macos/lib/libvorbisfile.a +0 -0
- data/assets/macos/lib/libwebp.a +0 -0
- data/assets/mingw/bin/SDL2.dll +0 -0
- data/assets/mingw/bin/SDL2_image.dll +0 -0
- data/assets/mingw/bin/SDL2_mixer.dll +0 -0
- data/assets/mingw/bin/SDL2_ttf.dll +0 -0
- data/assets/mingw/bin/glew32.dll +0 -0
- data/assets/mingw/bin/libFLAC-8.dll +0 -0
- data/assets/mingw/bin/libfreetype-6.dll +0 -0
- data/assets/mingw/bin/libjpeg-9.dll +0 -0
- data/assets/mingw/bin/libmodplug-1.dll +0 -0
- data/assets/mingw/bin/libmpg123-0.dll +0 -0
- data/assets/mingw/bin/libogg-0.dll +0 -0
- data/assets/mingw/bin/libopus-0.dll +0 -0
- data/assets/mingw/bin/libopusfile-0.dll +0 -0
- data/assets/mingw/bin/libpng16-16.dll +0 -0
- data/assets/mingw/bin/libtiff-5.dll +0 -0
- data/assets/mingw/bin/libvorbis-0.dll +0 -0
- data/assets/mingw/bin/libvorbisfile-3.dll +0 -0
- data/assets/mingw/bin/libwebp-7.dll +0 -0
- data/assets/mingw/bin/zlib1.dll +0 -0
- data/assets/mingw/lib/libSDL2.dll.a +0 -0
- data/assets/mingw/lib/libSDL2_image.a +0 -0
- data/assets/mingw/lib/libSDL2_image.dll.a +0 -0
- data/assets/mingw/lib/libSDL2_mixer.a +0 -0
- data/assets/mingw/lib/libSDL2_mixer.dll.a +0 -0
- data/assets/mingw/lib/libSDL2_test.a +0 -0
- data/assets/mingw/lib/libSDL2_ttf.a +0 -0
- data/assets/mingw/lib/libSDL2_ttf.dll.a +0 -0
- data/assets/mingw/lib/libSDL2main.a +0 -0
- data/assets/mingw/lib/libglew32.dll.a +0 -0
- data/ext/ruby2d/sprite.c +0 -147
- data/ext/ruby2d/tileset.c +0 -30
@@ -0,0 +1,469 @@
|
|
1
|
+
/**
|
2
|
+
** @file mruby/string.h - String class
|
3
|
+
**
|
4
|
+
** See Copyright Notice in mruby.h
|
5
|
+
*/
|
6
|
+
|
7
|
+
#ifndef MRUBY_STRING_H
|
8
|
+
#define MRUBY_STRING_H
|
9
|
+
|
10
|
+
#include "common.h"
|
11
|
+
|
12
|
+
/**
|
13
|
+
* String class
|
14
|
+
*/
|
15
|
+
MRB_BEGIN_DECL
|
16
|
+
|
17
|
+
extern const char mrb_digitmap[];
|
18
|
+
|
19
|
+
#define RSTRING_EMBED_LEN_MAX \
|
20
|
+
((mrb_int)(sizeof(void*) * 3 + sizeof(void*) - 32 / CHAR_BIT - 1))
|
21
|
+
|
22
|
+
struct RString {
|
23
|
+
MRB_OBJECT_HEADER;
|
24
|
+
union {
|
25
|
+
struct {
|
26
|
+
mrb_ssize len;
|
27
|
+
union {
|
28
|
+
mrb_ssize capa;
|
29
|
+
struct mrb_shared_string *shared;
|
30
|
+
struct RString *fshared;
|
31
|
+
} aux;
|
32
|
+
char *ptr;
|
33
|
+
} heap;
|
34
|
+
} as;
|
35
|
+
};
|
36
|
+
struct RStringEmbed {
|
37
|
+
MRB_OBJECT_HEADER;
|
38
|
+
char ary[RSTRING_EMBED_LEN_MAX+1];
|
39
|
+
};
|
40
|
+
|
41
|
+
#define RSTR_SET_TYPE_FLAG(s, type) (RSTR_UNSET_TYPE_FLAG(s), (s)->flags |= MRB_STR_##type)
|
42
|
+
#define RSTR_UNSET_TYPE_FLAG(s) ((s)->flags &= ~(MRB_STR_TYPE_MASK|MRB_STR_EMBED_LEN_MASK))
|
43
|
+
|
44
|
+
#define RSTR_EMBED_P(s) ((s)->flags & MRB_STR_EMBED)
|
45
|
+
#define RSTR_SET_EMBED_FLAG(s) ((s)->flags |= MRB_STR_EMBED)
|
46
|
+
#define RSTR_UNSET_EMBED_FLAG(s) ((s)->flags &= ~(MRB_STR_EMBED|MRB_STR_EMBED_LEN_MASK))
|
47
|
+
#define RSTR_SET_EMBED_LEN(s, n) do {\
|
48
|
+
size_t tmp_n = (n);\
|
49
|
+
(s)->flags &= ~MRB_STR_EMBED_LEN_MASK;\
|
50
|
+
(s)->flags |= (tmp_n) << MRB_STR_EMBED_LEN_SHIFT;\
|
51
|
+
} while (0)
|
52
|
+
#define RSTR_SET_LEN(s, n) do {\
|
53
|
+
if (RSTR_EMBED_P(s)) {\
|
54
|
+
RSTR_SET_EMBED_LEN((s),(n));\
|
55
|
+
}\
|
56
|
+
else {\
|
57
|
+
(s)->as.heap.len = (mrb_ssize)(n);\
|
58
|
+
}\
|
59
|
+
} while (0)
|
60
|
+
#define RSTR_EMBED_PTR(s) (((struct RStringEmbed*)(s))->ary)
|
61
|
+
#define RSTR_EMBED_LEN(s)\
|
62
|
+
(mrb_int)(((s)->flags & MRB_STR_EMBED_LEN_MASK) >> MRB_STR_EMBED_LEN_SHIFT)
|
63
|
+
#define RSTR_EMBEDDABLE_P(len) ((len) <= RSTRING_EMBED_LEN_MAX)
|
64
|
+
|
65
|
+
#define RSTR_PTR(s) ((RSTR_EMBED_P(s)) ? RSTR_EMBED_PTR(s) : (s)->as.heap.ptr)
|
66
|
+
#define RSTR_LEN(s) ((RSTR_EMBED_P(s)) ? RSTR_EMBED_LEN(s) : (s)->as.heap.len)
|
67
|
+
#define RSTR_CAPA(s) (RSTR_EMBED_P(s) ? RSTRING_EMBED_LEN_MAX : (s)->as.heap.aux.capa)
|
68
|
+
|
69
|
+
#define RSTR_SHARED_P(s) ((s)->flags & MRB_STR_SHARED)
|
70
|
+
#define RSTR_SET_SHARED_FLAG(s) ((s)->flags |= MRB_STR_SHARED)
|
71
|
+
#define RSTR_UNSET_SHARED_FLAG(s) ((s)->flags &= ~MRB_STR_SHARED)
|
72
|
+
|
73
|
+
#define RSTR_FSHARED_P(s) ((s)->flags & MRB_STR_FSHARED)
|
74
|
+
#define RSTR_SET_FSHARED_FLAG(s) ((s)->flags |= MRB_STR_FSHARED)
|
75
|
+
#define RSTR_UNSET_FSHARED_FLAG(s) ((s)->flags &= ~MRB_STR_FSHARED)
|
76
|
+
|
77
|
+
#define RSTR_NOFREE_P(s) ((s)->flags & MRB_STR_NOFREE)
|
78
|
+
#define RSTR_SET_NOFREE_FLAG(s) ((s)->flags |= MRB_STR_NOFREE)
|
79
|
+
#define RSTR_UNSET_NOFREE_FLAG(s) ((s)->flags &= ~MRB_STR_NOFREE)
|
80
|
+
|
81
|
+
#ifdef MRB_UTF8_STRING
|
82
|
+
# define RSTR_ASCII_P(s) ((s)->flags & MRB_STR_ASCII)
|
83
|
+
# define RSTR_SET_ASCII_FLAG(s) ((s)->flags |= MRB_STR_ASCII)
|
84
|
+
# define RSTR_UNSET_ASCII_FLAG(s) ((s)->flags &= ~MRB_STR_ASCII)
|
85
|
+
# define RSTR_WRITE_ASCII_FLAG(s, v) (RSTR_UNSET_ASCII_FLAG(s), (s)->flags |= v)
|
86
|
+
# define RSTR_COPY_ASCII_FLAG(dst, src) RSTR_WRITE_ASCII_FLAG(dst, RSTR_ASCII_P(src))
|
87
|
+
#else
|
88
|
+
# define RSTR_ASCII_P(s) (void)0
|
89
|
+
# define RSTR_SET_ASCII_FLAG(s) (void)0
|
90
|
+
# define RSTR_UNSET_ASCII_FLAG(s) (void)0
|
91
|
+
# define RSTR_WRITE_ASCII_FLAG(s, v) (void)0
|
92
|
+
# define RSTR_COPY_ASCII_FLAG(dst, src) (void)0
|
93
|
+
#endif
|
94
|
+
|
95
|
+
/**
|
96
|
+
* Returns a pointer from a Ruby string
|
97
|
+
*/
|
98
|
+
#define mrb_str_ptr(s) ((struct RString*)(mrb_ptr(s)))
|
99
|
+
#define RSTRING(s) mrb_str_ptr(s)
|
100
|
+
#define RSTRING_PTR(s) RSTR_PTR(RSTRING(s))
|
101
|
+
#define RSTRING_EMBED_LEN(s) RSTR_EMBED_LEN(RSTRING(s))
|
102
|
+
#define RSTRING_LEN(s) RSTR_LEN(RSTRING(s))
|
103
|
+
#define RSTRING_CAPA(s) RSTR_CAPA(RSTRING(s))
|
104
|
+
#define RSTRING_END(s) (RSTRING_PTR(s) + RSTRING_LEN(s))
|
105
|
+
MRB_API mrb_int mrb_str_strlen(mrb_state*, struct RString*);
|
106
|
+
#define RSTRING_CSTR(mrb,s) mrb_string_cstr(mrb, s)
|
107
|
+
|
108
|
+
#define MRB_STR_SHARED 1
|
109
|
+
#define MRB_STR_FSHARED 2
|
110
|
+
#define MRB_STR_NOFREE 4
|
111
|
+
#define MRB_STR_EMBED 8 /* type flags up to here */
|
112
|
+
#define MRB_STR_ASCII 16
|
113
|
+
#define MRB_STR_EMBED_LEN_SHIFT 6
|
114
|
+
#define MRB_STR_EMBED_LEN_BIT 5
|
115
|
+
#define MRB_STR_EMBED_LEN_MASK (((1 << MRB_STR_EMBED_LEN_BIT) - 1) << MRB_STR_EMBED_LEN_SHIFT)
|
116
|
+
#define MRB_STR_TYPE_MASK 15
|
117
|
+
|
118
|
+
void mrb_gc_free_str(mrb_state*, struct RString*);
|
119
|
+
|
120
|
+
MRB_API void mrb_str_modify(mrb_state *mrb, struct RString *s);
|
121
|
+
/* mrb_str_modify() with keeping ASCII flag if set */
|
122
|
+
MRB_API void mrb_str_modify_keep_ascii(mrb_state *mrb, struct RString *s);
|
123
|
+
|
124
|
+
/**
|
125
|
+
* Finds the index of a substring in a string
|
126
|
+
*/
|
127
|
+
MRB_API mrb_int mrb_str_index(mrb_state *mrb, mrb_value str, const char *p, mrb_int len, mrb_int offset);
|
128
|
+
#define mrb_str_index_lit(mrb, str, lit, off) mrb_str_index(mrb, str, lit, mrb_strlen_lit(lit), off);
|
129
|
+
|
130
|
+
/**
|
131
|
+
* Appends self to other. Returns self as a concatenated string.
|
132
|
+
*
|
133
|
+
*
|
134
|
+
* Example:
|
135
|
+
*
|
136
|
+
* int
|
137
|
+
* main(int argc,
|
138
|
+
* char **argv)
|
139
|
+
* {
|
140
|
+
* // Variable declarations.
|
141
|
+
* mrb_value str1;
|
142
|
+
* mrb_value str2;
|
143
|
+
*
|
144
|
+
* mrb_state *mrb = mrb_open();
|
145
|
+
* if (!mrb)
|
146
|
+
* {
|
147
|
+
* // handle error
|
148
|
+
* }
|
149
|
+
*
|
150
|
+
* // Creates new Ruby strings.
|
151
|
+
* str1 = mrb_str_new_lit(mrb, "abc");
|
152
|
+
* str2 = mrb_str_new_lit(mrb, "def");
|
153
|
+
*
|
154
|
+
* // Concatenates str2 to str1.
|
155
|
+
* mrb_str_concat(mrb, str1, str2);
|
156
|
+
*
|
157
|
+
* // Prints new Concatenated Ruby string.
|
158
|
+
* mrb_p(mrb, str1);
|
159
|
+
*
|
160
|
+
* mrb_close(mrb);
|
161
|
+
* return 0;
|
162
|
+
* }
|
163
|
+
*
|
164
|
+
* Result:
|
165
|
+
*
|
166
|
+
* => "abcdef"
|
167
|
+
*
|
168
|
+
* @param mrb The current mruby state.
|
169
|
+
* @param self String to concatenate.
|
170
|
+
* @param other String to append to self.
|
171
|
+
* @return [mrb_value] Returns a new String appending other to self.
|
172
|
+
*/
|
173
|
+
MRB_API void mrb_str_concat(mrb_state *mrb, mrb_value self, mrb_value other);
|
174
|
+
|
175
|
+
/**
|
176
|
+
* Adds two strings together.
|
177
|
+
*
|
178
|
+
*
|
179
|
+
* Example:
|
180
|
+
*
|
181
|
+
* int
|
182
|
+
* main(int argc,
|
183
|
+
* char **argv)
|
184
|
+
* {
|
185
|
+
* // Variable declarations.
|
186
|
+
* mrb_value a;
|
187
|
+
* mrb_value b;
|
188
|
+
* mrb_value c;
|
189
|
+
*
|
190
|
+
* mrb_state *mrb = mrb_open();
|
191
|
+
* if (!mrb)
|
192
|
+
* {
|
193
|
+
* // handle error
|
194
|
+
* }
|
195
|
+
*
|
196
|
+
* // Creates two Ruby strings from the passed in C strings.
|
197
|
+
* a = mrb_str_new_lit(mrb, "abc");
|
198
|
+
* b = mrb_str_new_lit(mrb, "def");
|
199
|
+
*
|
200
|
+
* // Prints both C strings.
|
201
|
+
* mrb_p(mrb, a);
|
202
|
+
* mrb_p(mrb, b);
|
203
|
+
*
|
204
|
+
* // Concatenates both Ruby strings.
|
205
|
+
* c = mrb_str_plus(mrb, a, b);
|
206
|
+
*
|
207
|
+
* // Prints new Concatenated Ruby string.
|
208
|
+
* mrb_p(mrb, c);
|
209
|
+
*
|
210
|
+
* mrb_close(mrb);
|
211
|
+
* return 0;
|
212
|
+
* }
|
213
|
+
*
|
214
|
+
*
|
215
|
+
* Result:
|
216
|
+
*
|
217
|
+
* => "abc" # First string
|
218
|
+
* => "def" # Second string
|
219
|
+
* => "abcdef" # First & Second concatenated.
|
220
|
+
*
|
221
|
+
* @param mrb The current mruby state.
|
222
|
+
* @param a First string to concatenate.
|
223
|
+
* @param b Second string to concatenate.
|
224
|
+
* @return [mrb_value] Returns a new String containing a concatenated to b.
|
225
|
+
*/
|
226
|
+
MRB_API mrb_value mrb_str_plus(mrb_state *mrb, mrb_value a, mrb_value b);
|
227
|
+
|
228
|
+
/**
|
229
|
+
* Converts pointer into a Ruby string.
|
230
|
+
*
|
231
|
+
* @param mrb The current mruby state.
|
232
|
+
* @param p The pointer to convert to Ruby string.
|
233
|
+
* @return [mrb_value] Returns a new Ruby String.
|
234
|
+
*/
|
235
|
+
MRB_API mrb_value mrb_ptr_to_str(mrb_state *mrb, void *p);
|
236
|
+
|
237
|
+
/**
|
238
|
+
* Returns an object as a Ruby string.
|
239
|
+
*
|
240
|
+
* @param mrb The current mruby state.
|
241
|
+
* @param obj An object to return as a Ruby string.
|
242
|
+
* @return [mrb_value] An object as a Ruby string.
|
243
|
+
*/
|
244
|
+
MRB_API mrb_value mrb_obj_as_string(mrb_state *mrb, mrb_value obj);
|
245
|
+
|
246
|
+
/**
|
247
|
+
* Resizes the string's length. Returns the amount of characters
|
248
|
+
* in the specified by len.
|
249
|
+
*
|
250
|
+
* Example:
|
251
|
+
*
|
252
|
+
* int
|
253
|
+
* main(int argc,
|
254
|
+
* char **argv)
|
255
|
+
* {
|
256
|
+
* // Variable declaration.
|
257
|
+
* mrb_value str;
|
258
|
+
*
|
259
|
+
* mrb_state *mrb = mrb_open();
|
260
|
+
* if (!mrb)
|
261
|
+
* {
|
262
|
+
* // handle error
|
263
|
+
* }
|
264
|
+
* // Creates a new string.
|
265
|
+
* str = mrb_str_new_lit(mrb, "Hello, world!");
|
266
|
+
* // Returns 5 characters of
|
267
|
+
* mrb_str_resize(mrb, str, 5);
|
268
|
+
* mrb_p(mrb, str);
|
269
|
+
*
|
270
|
+
* mrb_close(mrb);
|
271
|
+
* return 0;
|
272
|
+
* }
|
273
|
+
*
|
274
|
+
* Result:
|
275
|
+
*
|
276
|
+
* => "Hello"
|
277
|
+
*
|
278
|
+
* @param mrb The current mruby state.
|
279
|
+
* @param str The Ruby string to resize.
|
280
|
+
* @param len The length.
|
281
|
+
* @return [mrb_value] An object as a Ruby string.
|
282
|
+
*/
|
283
|
+
MRB_API mrb_value mrb_str_resize(mrb_state *mrb, mrb_value str, mrb_int len);
|
284
|
+
|
285
|
+
/**
|
286
|
+
* Returns a sub string.
|
287
|
+
*
|
288
|
+
* Example:
|
289
|
+
*
|
290
|
+
* int
|
291
|
+
* main(int argc,
|
292
|
+
* char const **argv)
|
293
|
+
* {
|
294
|
+
* // Variable declarations.
|
295
|
+
* mrb_value str1;
|
296
|
+
* mrb_value str2;
|
297
|
+
*
|
298
|
+
* mrb_state *mrb = mrb_open();
|
299
|
+
* if (!mrb)
|
300
|
+
* {
|
301
|
+
* // handle error
|
302
|
+
* }
|
303
|
+
* // Creates new string.
|
304
|
+
* str1 = mrb_str_new_lit(mrb, "Hello, world!");
|
305
|
+
* // Returns a sub-string within the range of 0..2
|
306
|
+
* str2 = mrb_str_substr(mrb, str1, 0, 2);
|
307
|
+
*
|
308
|
+
* // Prints sub-string.
|
309
|
+
* mrb_p(mrb, str2);
|
310
|
+
*
|
311
|
+
* mrb_close(mrb);
|
312
|
+
* return 0;
|
313
|
+
* }
|
314
|
+
*
|
315
|
+
* Result:
|
316
|
+
*
|
317
|
+
* => "He"
|
318
|
+
*
|
319
|
+
* @param mrb The current mruby state.
|
320
|
+
* @param str Ruby string.
|
321
|
+
* @param beg The beginning point of the sub-string.
|
322
|
+
* @param len The end point of the sub-string.
|
323
|
+
* @return [mrb_value] An object as a Ruby sub-string.
|
324
|
+
*/
|
325
|
+
MRB_API mrb_value mrb_str_substr(mrb_state *mrb, mrb_value str, mrb_int beg, mrb_int len);
|
326
|
+
|
327
|
+
/**
|
328
|
+
* Returns a Ruby string type.
|
329
|
+
*
|
330
|
+
*
|
331
|
+
* @param mrb The current mruby state.
|
332
|
+
* @param str Ruby string.
|
333
|
+
* @return [mrb_value] A Ruby string.
|
334
|
+
*/
|
335
|
+
MRB_API mrb_value mrb_ensure_string_type(mrb_state *mrb, mrb_value str);
|
336
|
+
MRB_API mrb_value mrb_check_string_type(mrb_state *mrb, mrb_value str);
|
337
|
+
/* obsolete: use mrb_ensure_string_type() instead */
|
338
|
+
MRB_API mrb_value mrb_string_type(mrb_state *mrb, mrb_value str);
|
339
|
+
|
340
|
+
|
341
|
+
MRB_API mrb_value mrb_str_new_capa(mrb_state *mrb, size_t capa);
|
342
|
+
#define mrb_str_buf_new(mrb, capa) mrb_str_new_capa(mrb, (capa))
|
343
|
+
|
344
|
+
/* NULL terminated C string from mrb_value */
|
345
|
+
MRB_API const char *mrb_string_cstr(mrb_state *mrb, mrb_value str);
|
346
|
+
/* NULL terminated C string from mrb_value; `str` will be updated */
|
347
|
+
MRB_API const char *mrb_string_value_cstr(mrb_state *mrb, mrb_value *str);
|
348
|
+
/* obsolete: use RSTRING_PTR() */
|
349
|
+
MRB_API const char *mrb_string_value_ptr(mrb_state *mrb, mrb_value str);
|
350
|
+
/* obsolete: use RSTRING_LEN() */
|
351
|
+
MRB_API mrb_int mrb_string_value_len(mrb_state *mrb, mrb_value str);
|
352
|
+
|
353
|
+
/**
|
354
|
+
* Duplicates a string object.
|
355
|
+
*
|
356
|
+
*
|
357
|
+
* @param mrb The current mruby state.
|
358
|
+
* @param str Ruby string.
|
359
|
+
* @return [mrb_value] Duplicated Ruby string.
|
360
|
+
*/
|
361
|
+
MRB_API mrb_value mrb_str_dup(mrb_state *mrb, mrb_value str);
|
362
|
+
|
363
|
+
/**
|
364
|
+
* Returns a symbol from a passed in Ruby string.
|
365
|
+
*
|
366
|
+
* @param mrb The current mruby state.
|
367
|
+
* @param self Ruby string.
|
368
|
+
* @return [mrb_value] A symbol.
|
369
|
+
*/
|
370
|
+
MRB_API mrb_value mrb_str_intern(mrb_state *mrb, mrb_value self);
|
371
|
+
|
372
|
+
MRB_API mrb_value mrb_str_to_inum(mrb_state *mrb, mrb_value str, mrb_int base, mrb_bool badcheck);
|
373
|
+
MRB_API mrb_value mrb_cstr_to_inum(mrb_state *mrb, const char *s, mrb_int base, mrb_bool badcheck);
|
374
|
+
MRB_API double mrb_str_to_dbl(mrb_state *mrb, mrb_value str, mrb_bool badcheck);
|
375
|
+
MRB_API double mrb_cstr_to_dbl(mrb_state *mrb, const char *s, mrb_bool badcheck);
|
376
|
+
|
377
|
+
/**
|
378
|
+
* Returns a converted string type.
|
379
|
+
* For type checking, non converting `mrb_to_str` is recommended.
|
380
|
+
* obsolete: use `mrb_obj_as_string()` instead.
|
381
|
+
*/
|
382
|
+
#define mrb_str_to_str(mrb, str) mrb_obj_as_string(mrb, str)
|
383
|
+
|
384
|
+
/**
|
385
|
+
* Returns true if the strings match and false if the strings don't match.
|
386
|
+
*
|
387
|
+
* @param mrb The current mruby state.
|
388
|
+
* @param str1 Ruby string to compare.
|
389
|
+
* @param str2 Ruby string to compare.
|
390
|
+
* @return [mrb_value] boolean value.
|
391
|
+
*/
|
392
|
+
MRB_API mrb_bool mrb_str_equal(mrb_state *mrb, mrb_value str1, mrb_value str2);
|
393
|
+
|
394
|
+
/**
|
395
|
+
* Returns a concatenated string comprised of a Ruby string and a C string.
|
396
|
+
*
|
397
|
+
* @param mrb The current mruby state.
|
398
|
+
* @param str Ruby string.
|
399
|
+
* @param ptr A C string.
|
400
|
+
* @param len length of C string.
|
401
|
+
* @return [mrb_value] A Ruby string.
|
402
|
+
* @see mrb_str_cat_cstr
|
403
|
+
*/
|
404
|
+
MRB_API mrb_value mrb_str_cat(mrb_state *mrb, mrb_value str, const char *ptr, size_t len);
|
405
|
+
|
406
|
+
/**
|
407
|
+
* Returns a concatenated string comprised of a Ruby string and a C string.
|
408
|
+
*
|
409
|
+
* @param mrb The current mruby state.
|
410
|
+
* @param str Ruby string.
|
411
|
+
* @param ptr A C string.
|
412
|
+
* @return [mrb_value] A Ruby string.
|
413
|
+
* @see mrb_str_cat
|
414
|
+
*/
|
415
|
+
MRB_API mrb_value mrb_str_cat_cstr(mrb_state *mrb, mrb_value str, const char *ptr);
|
416
|
+
MRB_API mrb_value mrb_str_cat_str(mrb_state *mrb, mrb_value str, mrb_value str2);
|
417
|
+
#define mrb_str_cat_lit(mrb, str, lit) mrb_str_cat(mrb, str, lit, mrb_strlen_lit(lit))
|
418
|
+
|
419
|
+
/**
|
420
|
+
* Adds str2 to the end of str1.
|
421
|
+
*/
|
422
|
+
MRB_API mrb_value mrb_str_append(mrb_state *mrb, mrb_value str, mrb_value str2);
|
423
|
+
|
424
|
+
/**
|
425
|
+
* Returns 0 if both Ruby strings are equal. Returns a value < 0 if Ruby str1 is less than Ruby str2. Returns a value > 0 if Ruby str2 is greater than Ruby str1.
|
426
|
+
*/
|
427
|
+
MRB_API int mrb_str_cmp(mrb_state *mrb, mrb_value str1, mrb_value str2);
|
428
|
+
|
429
|
+
/**
|
430
|
+
* Returns a newly allocated C string from a Ruby string.
|
431
|
+
* This is an utility function to pass a Ruby string to C library functions.
|
432
|
+
*
|
433
|
+
* - Returned string does not contain any NUL characters (but terminator).
|
434
|
+
* - It raises an ArgumentError exception if Ruby string contains
|
435
|
+
* NUL characters.
|
436
|
+
* - Returned string will be freed automatically on next GC.
|
437
|
+
* - Caller can modify returned string without affecting Ruby string
|
438
|
+
* (e.g. it can be used for mkstemp(3)).
|
439
|
+
*
|
440
|
+
* @param mrb The current mruby state.
|
441
|
+
* @param str Ruby string. Must be an instance of String.
|
442
|
+
* @return [char *] A newly allocated C string.
|
443
|
+
*/
|
444
|
+
MRB_API char *mrb_str_to_cstr(mrb_state *mrb, mrb_value str);
|
445
|
+
|
446
|
+
uint32_t mrb_str_hash(mrb_state *mrb, mrb_value str);
|
447
|
+
mrb_value mrb_str_dump(mrb_state *mrb, mrb_value str);
|
448
|
+
|
449
|
+
/**
|
450
|
+
* Returns a printable version of str, surrounded by quote marks, with special characters escaped.
|
451
|
+
*/
|
452
|
+
mrb_value mrb_str_inspect(mrb_state *mrb, mrb_value str);
|
453
|
+
|
454
|
+
/* For backward compatibility */
|
455
|
+
#define mrb_str_cat2(mrb, str, ptr) mrb_str_cat_cstr(mrb, str, ptr)
|
456
|
+
#define mrb_str_buf_cat(mrb, str, ptr, len) mrb_str_cat(mrb, str, ptr, len)
|
457
|
+
#define mrb_str_buf_append(mrb, str, str2) mrb_str_cat_str(mrb, str, str2)
|
458
|
+
|
459
|
+
mrb_bool mrb_str_beg_len(mrb_int str_len, mrb_int *begp, mrb_int *lenp);
|
460
|
+
mrb_value mrb_str_byte_subseq(mrb_state *mrb, mrb_value str, mrb_int beg, mrb_int len);
|
461
|
+
|
462
|
+
#ifdef MRB_UTF8_STRING
|
463
|
+
mrb_int mrb_utf8len(const char *str, const char *end);
|
464
|
+
mrb_int mrb_utf8_strlen(const char *str, mrb_int byte_len);
|
465
|
+
#endif
|
466
|
+
|
467
|
+
MRB_END_DECL
|
468
|
+
|
469
|
+
#endif /* MRUBY_STRING_H */
|
@@ -0,0 +1,66 @@
|
|
1
|
+
/**
|
2
|
+
** @file mruby/throw.h - mruby exception throwing handler
|
3
|
+
**
|
4
|
+
** See Copyright Notice in mruby.h
|
5
|
+
*/
|
6
|
+
|
7
|
+
#ifndef MRB_THROW_H
|
8
|
+
#define MRB_THROW_H
|
9
|
+
|
10
|
+
#if defined(MRB_USE_CXX_ABI)
|
11
|
+
# if !defined(__cplusplus)
|
12
|
+
# error Trying to use C++ exception handling in C code
|
13
|
+
# endif
|
14
|
+
#endif
|
15
|
+
|
16
|
+
#if defined(MRB_USE_CXX_EXCEPTION)
|
17
|
+
|
18
|
+
# if defined(__cplusplus)
|
19
|
+
|
20
|
+
#define MRB_TRY(buf) try {
|
21
|
+
#define MRB_CATCH(buf) } catch(mrb_jmpbuf_impl e) { if (e != (buf)->impl) { throw e; }
|
22
|
+
#define MRB_END_EXC(buf) }
|
23
|
+
|
24
|
+
#define MRB_THROW(buf) throw((buf)->impl)
|
25
|
+
typedef mrb_int mrb_jmpbuf_impl;
|
26
|
+
|
27
|
+
# else
|
28
|
+
# error "need to be compiled with C++ compiler"
|
29
|
+
# endif /* __cplusplus */
|
30
|
+
|
31
|
+
#else
|
32
|
+
|
33
|
+
#include <setjmp.h>
|
34
|
+
|
35
|
+
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
|
36
|
+
#define MRB_SETJMP _setjmp
|
37
|
+
#define MRB_LONGJMP _longjmp
|
38
|
+
#elif defined(__MINGW64__) && defined(__GNUC__) && __GNUC__ >= 4
|
39
|
+
#define MRB_SETJMP __builtin_setjmp
|
40
|
+
#define MRB_LONGJMP __builtin_longjmp
|
41
|
+
#else
|
42
|
+
#define MRB_SETJMP setjmp
|
43
|
+
#define MRB_LONGJMP longjmp
|
44
|
+
#endif
|
45
|
+
|
46
|
+
#define MRB_TRY(buf) if (MRB_SETJMP((buf)->impl) == 0) {
|
47
|
+
#define MRB_CATCH(buf) } else {
|
48
|
+
#define MRB_END_EXC(buf) }
|
49
|
+
|
50
|
+
#define MRB_THROW(buf) MRB_LONGJMP((buf)->impl, 1);
|
51
|
+
#define mrb_jmpbuf_impl jmp_buf
|
52
|
+
|
53
|
+
#endif
|
54
|
+
|
55
|
+
struct mrb_jmpbuf {
|
56
|
+
mrb_jmpbuf_impl impl;
|
57
|
+
|
58
|
+
#if defined(MRB_USE_CXX_EXCEPTION)
|
59
|
+
static mrb_int jmpbuf_id;
|
60
|
+
# if defined(__cplusplus)
|
61
|
+
mrb_jmpbuf() : impl(jmpbuf_id++) {}
|
62
|
+
# endif
|
63
|
+
#endif
|
64
|
+
};
|
65
|
+
|
66
|
+
#endif /* MRB_THROW_H */
|