ruby2d 0.11.0 → 0.11.3
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/libmruby.a +0 -0
- data/assets/wasm/template.html +64 -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-ucrt-x86_64/bin/mrbc.exe +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libFLAC.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libLerc.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libSDL2.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libSDL2_image.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libSDL2_mixer.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libSDL2_ttf.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libbrotlicommon.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libbrotlidec.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libbz2.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libdeflate.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libfreetype.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libglew32.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libgraphite2.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libharfbuzz.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libjbig.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libjpeg.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/liblzma.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libmodplug.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libmpg123.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libmruby.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libogg.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libopus.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libopusfile.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libpng16.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libsndfile.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libssp.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libstdc++.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libtiff.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libvorbis.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libvorbisfile.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libwebp.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libz.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libzstd.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 +44 -25
- data/ext/ruby2d/gl.c +1 -1
- data/ext/ruby2d/gl3.c +0 -1
- data/ext/ruby2d/gles.c +137 -84
- data/ext/ruby2d/ruby2d.c +126 -32
- data/ext/ruby2d/ruby2d.h +53 -6
- data/ext/ruby2d/text.c +14 -1
- data/ext/ruby2d/window.c +253 -215
- data/lib/ruby2d/cli/build.rb +242 -59
- data/lib/ruby2d/cli/colorize.rb +5 -4
- data/lib/ruby2d/cli/platform.rb +17 -0
- data/lib/ruby2d/font.rb +7 -1
- data/lib/ruby2d/sprite.rb +7 -2
- data/lib/ruby2d/text.rb +1 -3
- data/lib/ruby2d/texture.rb +21 -21
- data/lib/ruby2d/tileset.rb +34 -33
- data/lib/ruby2d/version.rb +1 -1
- data/lib/ruby2d/vertices.rb +11 -6
- data/lib/ruby2d.rb +14 -20
- metadata +279 -151
- 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
@@ -0,0 +1,317 @@
|
|
1
|
+
/**
|
2
|
+
** @file mruby/array.h - Array class
|
3
|
+
**
|
4
|
+
** See Copyright Notice in mruby.h
|
5
|
+
*/
|
6
|
+
|
7
|
+
#ifndef MRUBY_ARRAY_H
|
8
|
+
#define MRUBY_ARRAY_H
|
9
|
+
|
10
|
+
#include "common.h"
|
11
|
+
|
12
|
+
/*
|
13
|
+
* Array class
|
14
|
+
*/
|
15
|
+
MRB_BEGIN_DECL
|
16
|
+
|
17
|
+
|
18
|
+
typedef struct mrb_shared_array {
|
19
|
+
int refcnt;
|
20
|
+
mrb_ssize len;
|
21
|
+
mrb_value *ptr;
|
22
|
+
} mrb_shared_array;
|
23
|
+
|
24
|
+
#if defined(MRB_32BIT) && defined(MRB_NO_BOXING)
|
25
|
+
# define MRB_ARY_NO_EMBED
|
26
|
+
# define MRB_ARY_EMBED_LEN_MAX 0
|
27
|
+
#else
|
28
|
+
# define MRB_ARY_EMBED_LEN_MAX ((mrb_int)(sizeof(void*)*3/sizeof(mrb_value)))
|
29
|
+
mrb_static_assert(MRB_ARY_EMBED_LEN_MAX > 0, "MRB_ARY_EMBED_LEN_MAX > 0");
|
30
|
+
#endif
|
31
|
+
|
32
|
+
struct RArray {
|
33
|
+
MRB_OBJECT_HEADER;
|
34
|
+
union {
|
35
|
+
struct {
|
36
|
+
mrb_ssize len;
|
37
|
+
union {
|
38
|
+
mrb_ssize capa;
|
39
|
+
mrb_shared_array *shared;
|
40
|
+
} aux;
|
41
|
+
mrb_value *ptr;
|
42
|
+
} heap;
|
43
|
+
#ifndef MRB_ARY_NO_EMBED
|
44
|
+
mrb_value ary[MRB_ARY_EMBED_LEN_MAX];
|
45
|
+
#endif
|
46
|
+
} as;
|
47
|
+
};
|
48
|
+
|
49
|
+
#define mrb_ary_ptr(v) ((struct RArray*)(mrb_ptr(v)))
|
50
|
+
#define mrb_ary_value(p) mrb_obj_value((void*)(p))
|
51
|
+
#define RARRAY(v) ((struct RArray*)(mrb_ptr(v)))
|
52
|
+
|
53
|
+
#ifdef MRB_ARY_NO_EMBED
|
54
|
+
#define ARY_EMBED_P(a) 0
|
55
|
+
#define ARY_UNSET_EMBED_FLAG(a) (void)0
|
56
|
+
#define ARY_EMBED_LEN(a) 0
|
57
|
+
#define ARY_SET_EMBED_LEN(a,len) (void)0
|
58
|
+
#define ARY_EMBED_PTR(a) 0
|
59
|
+
#else
|
60
|
+
#define MRB_ARY_EMBED_MASK 7
|
61
|
+
#define ARY_EMBED_P(a) ((a)->flags & MRB_ARY_EMBED_MASK)
|
62
|
+
#define ARY_UNSET_EMBED_FLAG(a) ((a)->flags &= ~(MRB_ARY_EMBED_MASK))
|
63
|
+
#define ARY_EMBED_LEN(a) ((mrb_int)(((a)->flags & MRB_ARY_EMBED_MASK) - 1))
|
64
|
+
#define ARY_SET_EMBED_LEN(a,len) ((a)->flags = ((a)->flags&~MRB_ARY_EMBED_MASK) | ((uint32_t)(len) + 1))
|
65
|
+
#define ARY_EMBED_PTR(a) ((a)->as.ary)
|
66
|
+
#endif
|
67
|
+
|
68
|
+
#define ARY_LEN(a) (ARY_EMBED_P(a)?ARY_EMBED_LEN(a):(a)->as.heap.len)
|
69
|
+
#define ARY_PTR(a) (ARY_EMBED_P(a)?ARY_EMBED_PTR(a):(a)->as.heap.ptr)
|
70
|
+
#define RARRAY_LEN(a) ARY_LEN(RARRAY(a))
|
71
|
+
#define RARRAY_PTR(a) ARY_PTR(RARRAY(a))
|
72
|
+
#define ARY_SET_LEN(a,n) do {\
|
73
|
+
if (ARY_EMBED_P(a)) {\
|
74
|
+
mrb_assert((n) <= MRB_ARY_EMBED_LEN_MAX); \
|
75
|
+
ARY_SET_EMBED_LEN(a,n);\
|
76
|
+
}\
|
77
|
+
else\
|
78
|
+
(a)->as.heap.len = (n);\
|
79
|
+
} while (0)
|
80
|
+
#define ARY_CAPA(a) (ARY_EMBED_P(a)?MRB_ARY_EMBED_LEN_MAX:(a)->as.heap.aux.capa)
|
81
|
+
#define MRB_ARY_SHARED 256
|
82
|
+
#define ARY_SHARED_P(a) ((a)->flags & MRB_ARY_SHARED)
|
83
|
+
#define ARY_SET_SHARED_FLAG(a) ((a)->flags |= MRB_ARY_SHARED)
|
84
|
+
#define ARY_UNSET_SHARED_FLAG(a) ((a)->flags &= ~MRB_ARY_SHARED)
|
85
|
+
|
86
|
+
void mrb_ary_decref(mrb_state*, mrb_shared_array*);
|
87
|
+
MRB_API void mrb_ary_modify(mrb_state*, struct RArray*);
|
88
|
+
MRB_API mrb_value mrb_ary_new_capa(mrb_state*, mrb_int);
|
89
|
+
|
90
|
+
/*
|
91
|
+
* Initializes a new array.
|
92
|
+
*
|
93
|
+
* Equivalent to:
|
94
|
+
*
|
95
|
+
* Array.new
|
96
|
+
*
|
97
|
+
* @param mrb The mruby state reference.
|
98
|
+
* @return The initialized array.
|
99
|
+
*/
|
100
|
+
MRB_API mrb_value mrb_ary_new(mrb_state *mrb);
|
101
|
+
|
102
|
+
/*
|
103
|
+
* Initializes a new array with initial values
|
104
|
+
*
|
105
|
+
* Equivalent to:
|
106
|
+
*
|
107
|
+
* Array[value1, value2, ...]
|
108
|
+
*
|
109
|
+
* @param mrb The mruby state reference.
|
110
|
+
* @param size The numer of values.
|
111
|
+
* @param vals The actual values.
|
112
|
+
* @return The initialized array.
|
113
|
+
*/
|
114
|
+
MRB_API mrb_value mrb_ary_new_from_values(mrb_state *mrb, mrb_int size, const mrb_value *vals);
|
115
|
+
|
116
|
+
/*
|
117
|
+
* Initializes a new array with two initial values
|
118
|
+
*
|
119
|
+
* Equivalent to:
|
120
|
+
*
|
121
|
+
* Array[car, cdr]
|
122
|
+
*
|
123
|
+
* @param mrb The mruby state reference.
|
124
|
+
* @param car The first value.
|
125
|
+
* @param cdr The second value.
|
126
|
+
* @return The initialized array.
|
127
|
+
*/
|
128
|
+
MRB_API mrb_value mrb_assoc_new(mrb_state *mrb, mrb_value car, mrb_value cdr);
|
129
|
+
|
130
|
+
/*
|
131
|
+
* Concatenate two arrays. The target array will be modified
|
132
|
+
*
|
133
|
+
* Equivalent to:
|
134
|
+
* ary.concat(other)
|
135
|
+
*
|
136
|
+
* @param mrb The mruby state reference.
|
137
|
+
* @param self The target array.
|
138
|
+
* @param other The array that will be concatenated to self.
|
139
|
+
*/
|
140
|
+
MRB_API void mrb_ary_concat(mrb_state *mrb, mrb_value self, mrb_value other);
|
141
|
+
|
142
|
+
/*
|
143
|
+
* Create an array from the input. It tries calling to_a on the
|
144
|
+
* value. If value does not respond to that, it creates a new
|
145
|
+
* array with just this value.
|
146
|
+
*
|
147
|
+
* @param mrb The mruby state reference.
|
148
|
+
* @param value The value to change into an array.
|
149
|
+
* @return An array representation of value.
|
150
|
+
*/
|
151
|
+
MRB_API mrb_value mrb_ary_splat(mrb_state *mrb, mrb_value value);
|
152
|
+
|
153
|
+
/*
|
154
|
+
* Pushes value into array.
|
155
|
+
*
|
156
|
+
* Equivalent to:
|
157
|
+
*
|
158
|
+
* ary << value
|
159
|
+
*
|
160
|
+
* @param mrb The mruby state reference.
|
161
|
+
* @param ary The array in which the value will be pushed
|
162
|
+
* @param value The value to be pushed into array
|
163
|
+
*/
|
164
|
+
MRB_API void mrb_ary_push(mrb_state *mrb, mrb_value array, mrb_value value);
|
165
|
+
|
166
|
+
/*
|
167
|
+
* Pops the last element from the array.
|
168
|
+
*
|
169
|
+
* Equivalent to:
|
170
|
+
*
|
171
|
+
* ary.pop
|
172
|
+
*
|
173
|
+
* @param mrb The mruby state reference.
|
174
|
+
* @param ary The array from which the value will be popped.
|
175
|
+
* @return The popped value.
|
176
|
+
*/
|
177
|
+
MRB_API mrb_value mrb_ary_pop(mrb_state *mrb, mrb_value ary);
|
178
|
+
|
179
|
+
/*
|
180
|
+
* Returns a reference to an element of the array on the given index.
|
181
|
+
*
|
182
|
+
* Equivalent to:
|
183
|
+
*
|
184
|
+
* ary[n]
|
185
|
+
*
|
186
|
+
* @param mrb The mruby state reference.
|
187
|
+
* @param ary The target array.
|
188
|
+
* @param n The array index being referenced
|
189
|
+
* @return The referenced value.
|
190
|
+
*/
|
191
|
+
MRB_API mrb_value mrb_ary_ref(mrb_state *mrb, mrb_value ary, mrb_int n);
|
192
|
+
|
193
|
+
/*
|
194
|
+
* Sets a value on an array at the given index
|
195
|
+
*
|
196
|
+
* Equivalent to:
|
197
|
+
*
|
198
|
+
* ary[n] = val
|
199
|
+
*
|
200
|
+
* @param mrb The mruby state reference.
|
201
|
+
* @param ary The target array.
|
202
|
+
* @param n The array index being referenced.
|
203
|
+
* @param val The value being setted.
|
204
|
+
*/
|
205
|
+
MRB_API void mrb_ary_set(mrb_state *mrb, mrb_value ary, mrb_int n, mrb_value val);
|
206
|
+
|
207
|
+
/*
|
208
|
+
* Replace the array with another array
|
209
|
+
*
|
210
|
+
* Equivalent to:
|
211
|
+
*
|
212
|
+
* ary.replace(other)
|
213
|
+
*
|
214
|
+
* @param mrb The mruby state reference
|
215
|
+
* @param self The target array.
|
216
|
+
* @param other The array to replace it with.
|
217
|
+
*/
|
218
|
+
MRB_API void mrb_ary_replace(mrb_state *mrb, mrb_value self, mrb_value other);
|
219
|
+
MRB_API mrb_value mrb_ensure_array_type(mrb_state *mrb, mrb_value self);
|
220
|
+
MRB_API mrb_value mrb_check_array_type(mrb_state *mrb, mrb_value self);
|
221
|
+
|
222
|
+
/*
|
223
|
+
* Unshift an element into the array
|
224
|
+
*
|
225
|
+
* Equivalent to:
|
226
|
+
*
|
227
|
+
* ary.unshift(item)
|
228
|
+
*
|
229
|
+
* @param mrb The mruby state reference.
|
230
|
+
* @param self The target array.
|
231
|
+
* @param item The item to unshift.
|
232
|
+
*/
|
233
|
+
MRB_API mrb_value mrb_ary_unshift(mrb_state *mrb, mrb_value self, mrb_value item);
|
234
|
+
|
235
|
+
/*
|
236
|
+
* Get nth element in the array
|
237
|
+
*
|
238
|
+
* Equivalent to:
|
239
|
+
*
|
240
|
+
* ary[offset]
|
241
|
+
*
|
242
|
+
* @param ary The target array.
|
243
|
+
* @param offset The element position (negative counts from the tail).
|
244
|
+
*/
|
245
|
+
MRB_API mrb_value mrb_ary_entry(mrb_value ary, mrb_int offset);
|
246
|
+
|
247
|
+
/*
|
248
|
+
* Replace subsequence of an array.
|
249
|
+
*
|
250
|
+
* Equivalent to:
|
251
|
+
*
|
252
|
+
* ary[head, len] = rpl
|
253
|
+
*
|
254
|
+
* @param mrb The mruby state reference.
|
255
|
+
* @param self The array from which the value will be partiality replaced.
|
256
|
+
* @param head Beginning position of a replacement subsequence.
|
257
|
+
* @param len Length of a replacement subsequence.
|
258
|
+
* @param rpl The array of replacement elements.
|
259
|
+
* It is possible to pass `mrb_undef_value()` instead of an empty array.
|
260
|
+
* @return The receiver array.
|
261
|
+
*/
|
262
|
+
MRB_API mrb_value mrb_ary_splice(mrb_state *mrb, mrb_value self, mrb_int head, mrb_int len, mrb_value rpl);
|
263
|
+
|
264
|
+
/*
|
265
|
+
* Shifts the first element from the array.
|
266
|
+
*
|
267
|
+
* Equivalent to:
|
268
|
+
*
|
269
|
+
* ary.shift
|
270
|
+
*
|
271
|
+
* @param mrb The mruby state reference.
|
272
|
+
* @param self The array from which the value will be shifted.
|
273
|
+
* @return The shifted value.
|
274
|
+
*/
|
275
|
+
MRB_API mrb_value mrb_ary_shift(mrb_state *mrb, mrb_value self);
|
276
|
+
|
277
|
+
/*
|
278
|
+
* Removes all elements from the array
|
279
|
+
*
|
280
|
+
* Equivalent to:
|
281
|
+
*
|
282
|
+
* ary.clear
|
283
|
+
*
|
284
|
+
* @param mrb The mruby state reference.
|
285
|
+
* @param self The target array.
|
286
|
+
* @return self
|
287
|
+
*/
|
288
|
+
MRB_API mrb_value mrb_ary_clear(mrb_state *mrb, mrb_value self);
|
289
|
+
|
290
|
+
/*
|
291
|
+
* Join the array elements together in a string
|
292
|
+
*
|
293
|
+
* Equivalent to:
|
294
|
+
*
|
295
|
+
* ary.join(sep="")
|
296
|
+
*
|
297
|
+
* @param mrb The mruby state reference.
|
298
|
+
* @param ary The target array
|
299
|
+
* @param sep The separator, can be NULL
|
300
|
+
*/
|
301
|
+
MRB_API mrb_value mrb_ary_join(mrb_state *mrb, mrb_value ary, mrb_value sep);
|
302
|
+
|
303
|
+
/*
|
304
|
+
* Update the capacity of the array
|
305
|
+
*
|
306
|
+
* @param mrb The mruby state reference.
|
307
|
+
* @param ary The target array.
|
308
|
+
* @param new_len The new capacity of the array
|
309
|
+
*/
|
310
|
+
MRB_API mrb_value mrb_ary_resize(mrb_state *mrb, mrb_value ary, mrb_int new_len);
|
311
|
+
|
312
|
+
/* helper functions */
|
313
|
+
mrb_value mrb_ary_subseq(mrb_state *mrb, mrb_value ary, mrb_int beg, mrb_int len);
|
314
|
+
|
315
|
+
MRB_END_DECL
|
316
|
+
|
317
|
+
#endif /* MRUBY_ARRAY_H */
|
@@ -0,0 +1,130 @@
|
|
1
|
+
/**
|
2
|
+
** @file mruby/boxing_nan.h - nan boxing mrb_value definition
|
3
|
+
**
|
4
|
+
** See Copyright Notice in mruby.h
|
5
|
+
*/
|
6
|
+
|
7
|
+
#ifndef MRUBY_BOXING_NAN_H
|
8
|
+
#define MRUBY_BOXING_NAN_H
|
9
|
+
|
10
|
+
#ifdef MRB_USE_FLOAT32
|
11
|
+
# error ---->> MRB_NAN_BOXING and MRB_USE_FLOAT32 conflict <<----
|
12
|
+
#endif
|
13
|
+
|
14
|
+
#ifdef MRB_NO_FLOAT
|
15
|
+
# error ---->> MRB_NAN_BOXING and MRB_NO_FLOAT conflict <<----
|
16
|
+
#endif
|
17
|
+
|
18
|
+
#ifdef MRB_INT64
|
19
|
+
# error ---->> MRB_NAN_BOXING and MRB_INT64 conflict <<----
|
20
|
+
#endif
|
21
|
+
|
22
|
+
#define MRB_FIXNUM_SHIFT 0
|
23
|
+
#define MRB_SYMBOL_SHIFT 0
|
24
|
+
#define MRB_FIXNUM_MIN INT32_MIN
|
25
|
+
#define MRB_FIXNUM_MAX INT32_MAX
|
26
|
+
|
27
|
+
/* value representation by nan-boxing:
|
28
|
+
* float : FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF
|
29
|
+
* object: 111111111111TTTT TTPPPPPPPPPPPPPP PPPPPPPPPPPPPPPP PPPPPPPPPPPPPPPP
|
30
|
+
* int : 1111111111110001 0000000000000000 IIIIIIIIIIIIIIII IIIIIIIIIIIIIIII
|
31
|
+
* sym : 1111111111110001 0100000000000000 SSSSSSSSSSSSSSSS SSSSSSSSSSSSSSSS
|
32
|
+
* In order to get enough bit size to save TT, all pointers are shifted 2 bits
|
33
|
+
* in the right direction. Also, TTTTTT is the mrb_vtype + 1;
|
34
|
+
*/
|
35
|
+
typedef struct mrb_value {
|
36
|
+
uint64_t u;
|
37
|
+
} mrb_value;
|
38
|
+
|
39
|
+
union mrb_value_ {
|
40
|
+
mrb_float f;
|
41
|
+
uint64_t u;
|
42
|
+
#ifdef MRB_64BIT
|
43
|
+
void *p;
|
44
|
+
# define BOXNAN_IMMEDIATE_VALUE uint32_t i
|
45
|
+
#else
|
46
|
+
# define BOXNAN_IMMEDIATE_VALUE union { uint32_t i; void *p; }
|
47
|
+
#endif
|
48
|
+
struct {
|
49
|
+
MRB_ENDIAN_LOHI(
|
50
|
+
uint32_t ttt;
|
51
|
+
,BOXNAN_IMMEDIATE_VALUE;
|
52
|
+
)
|
53
|
+
};
|
54
|
+
mrb_value value;
|
55
|
+
};
|
56
|
+
|
57
|
+
mrb_static_assert1(sizeof(mrb_value) == sizeof(union mrb_value_));
|
58
|
+
|
59
|
+
static inline union mrb_value_
|
60
|
+
mrb_val_union(mrb_value v)
|
61
|
+
{
|
62
|
+
union mrb_value_ x;
|
63
|
+
x.value = v;
|
64
|
+
return x;
|
65
|
+
}
|
66
|
+
|
67
|
+
#define mrb_tt(o) ((enum mrb_vtype)((mrb_val_union(o).ttt & 0xfc000)>>14)-1)
|
68
|
+
#define mrb_type(o) (enum mrb_vtype)((uint32_t)0xfff00000 < mrb_val_union(o).ttt ? mrb_tt(o) : MRB_TT_FLOAT)
|
69
|
+
#define mrb_float(o) mrb_val_union(o).f
|
70
|
+
#define mrb_fixnum(o) ((mrb_int)mrb_val_union(o).i)
|
71
|
+
#define mrb_integer(o) mrb_fixnum(o)
|
72
|
+
#define mrb_symbol(o) ((mrb_sym)mrb_val_union(o).i)
|
73
|
+
|
74
|
+
#ifdef MRB_64BIT
|
75
|
+
#define mrb_ptr(o) ((void*)((((uintptr_t)0x3fffffffffff)&((uintptr_t)(mrb_val_union(o).p)))<<2))
|
76
|
+
#define mrb_cptr(o) (((struct RCptr*)mrb_ptr(o))->p)
|
77
|
+
#define BOXNAN_SHIFT_LONG_POINTER(v) (((uintptr_t)(v)>>34)&0x3fff)
|
78
|
+
#else
|
79
|
+
#define mrb_ptr(o) ((void*)mrb_val_union(o).i)
|
80
|
+
#define mrb_cptr(o) mrb_ptr(o)
|
81
|
+
#define BOXNAN_SHIFT_LONG_POINTER(v) 0
|
82
|
+
#endif
|
83
|
+
|
84
|
+
#define BOXNAN_SET_VALUE(o, tt, attr, v) do { \
|
85
|
+
union mrb_value_ mrb_value_union_variable; \
|
86
|
+
mrb_value_union_variable.attr = (v);\
|
87
|
+
mrb_value_union_variable.ttt = 0xfff00000 | (((tt)+1)<<14);\
|
88
|
+
o = mrb_value_union_variable.value;\
|
89
|
+
} while (0)
|
90
|
+
|
91
|
+
#ifdef MRB_64BIT
|
92
|
+
#define BOXNAN_SET_OBJ_VALUE(o, tt, v) do {\
|
93
|
+
union mrb_value_ mrb_value_union_variable;\
|
94
|
+
mrb_value_union_variable.p = (void*)((uintptr_t)(v)>>2);\
|
95
|
+
mrb_value_union_variable.ttt = (0xfff00000|(((tt)+1)<<14)|BOXNAN_SHIFT_LONG_POINTER(v));\
|
96
|
+
o = mrb_value_union_variable.value;\
|
97
|
+
} while (0)
|
98
|
+
#else
|
99
|
+
#define BOXNAN_SET_OBJ_VALUE(o, tt, v) BOXNAN_SET_VALUE(o, tt, i, (uint32_t)v)
|
100
|
+
#endif
|
101
|
+
|
102
|
+
#define SET_FLOAT_VALUE(mrb,r,v) do { \
|
103
|
+
union mrb_value_ mrb_value_union_variable; \
|
104
|
+
if ((v) != (v)) { /* NaN */ \
|
105
|
+
mrb_value_union_variable.ttt = 0x7ff80000; \
|
106
|
+
mrb_value_union_variable.i = 0; \
|
107
|
+
} \
|
108
|
+
else { \
|
109
|
+
mrb_value_union_variable.f = (v); \
|
110
|
+
} \
|
111
|
+
r = mrb_value_union_variable.value; \
|
112
|
+
} while(0)
|
113
|
+
|
114
|
+
#define SET_NIL_VALUE(r) BOXNAN_SET_VALUE(r, MRB_TT_FALSE, i, 0)
|
115
|
+
#define SET_FALSE_VALUE(r) BOXNAN_SET_VALUE(r, MRB_TT_FALSE, i, 1)
|
116
|
+
#define SET_TRUE_VALUE(r) BOXNAN_SET_VALUE(r, MRB_TT_TRUE, i, 1)
|
117
|
+
#define SET_BOOL_VALUE(r,b) BOXNAN_SET_VALUE(r, b ? MRB_TT_TRUE : MRB_TT_FALSE, i, 1)
|
118
|
+
#define SET_INT_VALUE(mrb, r,n) BOXNAN_SET_VALUE(r, MRB_TT_INTEGER, i, (uint32_t)(n))
|
119
|
+
#define SET_FIXNUM_VALUE(r,n) BOXNAN_SET_VALUE(r, MRB_TT_INTEGER, i, (uint32_t)(n))
|
120
|
+
#define SET_SYM_VALUE(r,v) BOXNAN_SET_VALUE(r, MRB_TT_SYMBOL, i, (uint32_t)(v))
|
121
|
+
#define SET_OBJ_VALUE(r,v) BOXNAN_SET_OBJ_VALUE(r, (((struct RObject*)(v))->tt), (v))
|
122
|
+
#ifdef MRB_64BIT
|
123
|
+
MRB_API mrb_value mrb_nan_boxing_cptr_value(struct mrb_state*, void*);
|
124
|
+
#define SET_CPTR_VALUE(mrb,r,v) ((r) = mrb_nan_boxing_cptr_value(mrb, v))
|
125
|
+
#else
|
126
|
+
#define SET_CPTR_VALUE(mrb,r,v) BOXNAN_SET_VALUE(r, MRB_TT_CPTR, p, v)
|
127
|
+
#endif
|
128
|
+
#define SET_UNDEF_VALUE(r) BOXNAN_SET_VALUE(r, MRB_TT_UNDEF, i, 0)
|
129
|
+
|
130
|
+
#endif /* MRUBY_BOXING_NAN_H */
|
@@ -0,0 +1,58 @@
|
|
1
|
+
/**
|
2
|
+
** @file mruby/boxing_no.h - unboxed mrb_value definition
|
3
|
+
**
|
4
|
+
** See Copyright Notice in mruby.h
|
5
|
+
*/
|
6
|
+
|
7
|
+
#ifndef MRUBY_BOXING_NO_H
|
8
|
+
#define MRUBY_BOXING_NO_H
|
9
|
+
|
10
|
+
#define MRB_FIXNUM_SHIFT 0
|
11
|
+
#define MRB_SYMBOL_SHIFT 0
|
12
|
+
#define MRB_FIXNUM_MIN MRB_INT_MIN
|
13
|
+
#define MRB_FIXNUM_MAX MRB_INT_MAX
|
14
|
+
|
15
|
+
union mrb_value_union {
|
16
|
+
#ifndef MRB_NO_FLOAT
|
17
|
+
mrb_float f;
|
18
|
+
#endif
|
19
|
+
void *p;
|
20
|
+
mrb_int i;
|
21
|
+
mrb_sym sym;
|
22
|
+
};
|
23
|
+
|
24
|
+
typedef struct mrb_value {
|
25
|
+
union mrb_value_union value;
|
26
|
+
enum mrb_vtype tt;
|
27
|
+
} mrb_value;
|
28
|
+
|
29
|
+
#define mrb_ptr(o) (o).value.p
|
30
|
+
#define mrb_cptr(o) mrb_ptr(o)
|
31
|
+
#ifndef MRB_NO_FLOAT
|
32
|
+
#define mrb_float(o) (o).value.f
|
33
|
+
#endif
|
34
|
+
#define mrb_fixnum(o) (o).value.i
|
35
|
+
#define mrb_integer(o) mrb_fixnum(o)
|
36
|
+
#define mrb_symbol(o) (o).value.sym
|
37
|
+
#define mrb_type(o) (o).tt
|
38
|
+
|
39
|
+
#define BOXNIX_SET_VALUE(o, ttt, attr, v) do {\
|
40
|
+
(o).tt = ttt;\
|
41
|
+
(o).attr = v;\
|
42
|
+
} while (0)
|
43
|
+
|
44
|
+
#define SET_NIL_VALUE(r) BOXNIX_SET_VALUE(r, MRB_TT_FALSE, value.i, 0)
|
45
|
+
#define SET_FALSE_VALUE(r) BOXNIX_SET_VALUE(r, MRB_TT_FALSE, value.i, 1)
|
46
|
+
#define SET_TRUE_VALUE(r) BOXNIX_SET_VALUE(r, MRB_TT_TRUE, value.i, 1)
|
47
|
+
#define SET_BOOL_VALUE(r,b) BOXNIX_SET_VALUE(r, b ? MRB_TT_TRUE : MRB_TT_FALSE, value.i, 1)
|
48
|
+
#define SET_INT_VALUE(mrb,r,n) BOXNIX_SET_VALUE(r, MRB_TT_INTEGER, value.i, (n))
|
49
|
+
#define SET_FIXNUM_VALUE(r,n) BOXNIX_SET_VALUE(r, MRB_TT_INTEGER, value.i, (n))
|
50
|
+
#ifndef MRB_NO_FLOAT
|
51
|
+
#define SET_FLOAT_VALUE(mrb,r,v) BOXNIX_SET_VALUE(r, MRB_TT_FLOAT, value.f, (v))
|
52
|
+
#endif
|
53
|
+
#define SET_SYM_VALUE(r,v) BOXNIX_SET_VALUE(r, MRB_TT_SYMBOL, value.sym, (v))
|
54
|
+
#define SET_OBJ_VALUE(r,v) BOXNIX_SET_VALUE(r, (((struct RObject*)(v))->tt), value.p, (v))
|
55
|
+
#define SET_CPTR_VALUE(mrb,r,v) BOXNIX_SET_VALUE(r, MRB_TT_CPTR, value.p, v)
|
56
|
+
#define SET_UNDEF_VALUE(r) BOXNIX_SET_VALUE(r, MRB_TT_UNDEF, value.i, 0)
|
57
|
+
|
58
|
+
#endif /* MRUBY_BOXING_NO_H */
|
@@ -0,0 +1,205 @@
|
|
1
|
+
/**
|
2
|
+
** @file mruby/boxing_word.h - word boxing mrb_value definition
|
3
|
+
**
|
4
|
+
** See Copyright Notice in mruby.h
|
5
|
+
*/
|
6
|
+
|
7
|
+
#ifndef MRUBY_BOXING_WORD_H
|
8
|
+
#define MRUBY_BOXING_WORD_H
|
9
|
+
|
10
|
+
#ifndef MRB_NO_FLOAT
|
11
|
+
struct RFloat {
|
12
|
+
MRB_OBJECT_HEADER;
|
13
|
+
mrb_float f;
|
14
|
+
};
|
15
|
+
#endif
|
16
|
+
|
17
|
+
struct RInteger {
|
18
|
+
MRB_OBJECT_HEADER;
|
19
|
+
mrb_int i;
|
20
|
+
};
|
21
|
+
|
22
|
+
enum mrb_special_consts {
|
23
|
+
MRB_Qnil = 0,
|
24
|
+
MRB_Qfalse = 4,
|
25
|
+
MRB_Qtrue = 12,
|
26
|
+
MRB_Qundef = 20,
|
27
|
+
};
|
28
|
+
|
29
|
+
#if defined(MRB_64BIT) && defined(MRB_INT32)
|
30
|
+
#define MRB_FIXNUM_SHIFT 0
|
31
|
+
#else
|
32
|
+
#define MRB_FIXNUM_SHIFT BOXWORD_FIXNUM_SHIFT
|
33
|
+
#endif
|
34
|
+
#define MRB_SYMBOL_SHIFT BOXWORD_SYMBOL_SHIFT
|
35
|
+
|
36
|
+
#if defined(MRB_64BIT) && defined(MRB_INT64)
|
37
|
+
# define MRB_FIXNUM_MIN (INT64_MIN>>MRB_FIXNUM_SHIFT)
|
38
|
+
# define MRB_FIXNUM_MAX (INT64_MAX>>MRB_FIXNUM_SHIFT)
|
39
|
+
#else
|
40
|
+
# define MRB_FIXNUM_MIN (INT32_MIN>>MRB_FIXNUM_SHIFT)
|
41
|
+
# define MRB_FIXNUM_MAX (INT32_MAX>>MRB_FIXNUM_SHIFT)
|
42
|
+
#endif
|
43
|
+
|
44
|
+
#define BOXWORD_FIXNUM_BIT_POS 1
|
45
|
+
#define BOXWORD_SYMBOL_BIT_POS 2
|
46
|
+
#define BOXWORD_FIXNUM_SHIFT BOXWORD_FIXNUM_BIT_POS
|
47
|
+
#ifdef MRB_64BIT
|
48
|
+
#define BOXWORD_SYMBOL_SHIFT 0
|
49
|
+
#else
|
50
|
+
#define BOXWORD_SYMBOL_SHIFT BOXWORD_SYMBOL_BIT_POS
|
51
|
+
#endif
|
52
|
+
#define BOXWORD_FIXNUM_FLAG (1 << (BOXWORD_FIXNUM_BIT_POS - 1))
|
53
|
+
#define BOXWORD_SYMBOL_FLAG (1 << (BOXWORD_SYMBOL_BIT_POS - 1))
|
54
|
+
#define BOXWORD_FIXNUM_MASK ((1 << BOXWORD_FIXNUM_BIT_POS) - 1)
|
55
|
+
#define BOXWORD_SYMBOL_MASK ((1 << BOXWORD_SYMBOL_BIT_POS) - 1)
|
56
|
+
#define BOXWORD_IMMEDIATE_MASK 0x07
|
57
|
+
|
58
|
+
#define BOXWORD_SET_SHIFT_VALUE(o,n,v) \
|
59
|
+
((o).w = (((uintptr_t)(v)) << BOXWORD_##n##_SHIFT) | BOXWORD_##n##_FLAG)
|
60
|
+
#define BOXWORD_SHIFT_VALUE_P(o,n) \
|
61
|
+
(((o).w & BOXWORD_##n##_MASK) == BOXWORD_##n##_FLAG)
|
62
|
+
#define BOXWORD_OBJ_TYPE_P(o,n) \
|
63
|
+
(!mrb_immediate_p(o) && mrb_val_union(o).bp->tt == MRB_TT_##n)
|
64
|
+
|
65
|
+
/*
|
66
|
+
* mrb_value representation:
|
67
|
+
*
|
68
|
+
* nil : ...0000 0000 (all bits are 0)
|
69
|
+
* false : ...0000 0100 (mrb_fixnum(v) != 0)
|
70
|
+
* true : ...0000 1100
|
71
|
+
* undef : ...0001 0100
|
72
|
+
* fixnum: ...IIII III1
|
73
|
+
* symbol: ...SSSS SS10 (use only upper 32-bit as symbol value on 64-bit CPU)
|
74
|
+
* object: ...PPPP P000 (any bits are 1)
|
75
|
+
*/
|
76
|
+
typedef struct mrb_value {
|
77
|
+
uintptr_t w;
|
78
|
+
} mrb_value;
|
79
|
+
|
80
|
+
union mrb_value_ {
|
81
|
+
void *p;
|
82
|
+
#ifdef MRB_64BIT
|
83
|
+
/* use struct to avoid bit shift. */
|
84
|
+
struct {
|
85
|
+
MRB_ENDIAN_LOHI(
|
86
|
+
mrb_sym sym;
|
87
|
+
,uint32_t sym_flag;
|
88
|
+
)
|
89
|
+
};
|
90
|
+
#endif
|
91
|
+
struct RBasic *bp;
|
92
|
+
#ifndef MRB_NO_FLOAT
|
93
|
+
struct RFloat *fp;
|
94
|
+
#endif
|
95
|
+
struct RInteger *ip;
|
96
|
+
struct RCptr *vp;
|
97
|
+
uintptr_t w;
|
98
|
+
mrb_value value;
|
99
|
+
};
|
100
|
+
|
101
|
+
mrb_static_assert1(sizeof(mrb_value) == sizeof(union mrb_value_));
|
102
|
+
|
103
|
+
static inline union mrb_value_
|
104
|
+
mrb_val_union(mrb_value v)
|
105
|
+
{
|
106
|
+
union mrb_value_ x;
|
107
|
+
x.value = v;
|
108
|
+
return x;
|
109
|
+
}
|
110
|
+
|
111
|
+
MRB_API mrb_value mrb_word_boxing_cptr_value(struct mrb_state*, void*);
|
112
|
+
#ifndef MRB_NO_FLOAT
|
113
|
+
MRB_API mrb_value mrb_word_boxing_float_value(struct mrb_state*, mrb_float);
|
114
|
+
#endif
|
115
|
+
MRB_API mrb_value mrb_word_boxing_int_value(struct mrb_state*, mrb_int);
|
116
|
+
|
117
|
+
#define mrb_immediate_p(o) ((o).w & BOXWORD_IMMEDIATE_MASK || (o).w == MRB_Qnil)
|
118
|
+
|
119
|
+
#define mrb_ptr(o) mrb_val_union(o).p
|
120
|
+
#define mrb_cptr(o) mrb_val_union(o).vp->p
|
121
|
+
#ifndef MRB_NO_FLOAT
|
122
|
+
#define mrb_float(o) mrb_val_union(o).fp->f
|
123
|
+
#endif
|
124
|
+
#define mrb_fixnum(o) (mrb_int)(((intptr_t)(o).w) >> BOXWORD_FIXNUM_SHIFT)
|
125
|
+
MRB_INLINE mrb_int
|
126
|
+
mrb_integer_func(mrb_value o) {
|
127
|
+
if (mrb_immediate_p(o)) return mrb_fixnum(o);
|
128
|
+
return mrb_val_union(o).ip->i;
|
129
|
+
}
|
130
|
+
#define mrb_integer(o) mrb_integer_func(o)
|
131
|
+
#ifdef MRB_64BIT
|
132
|
+
#define mrb_symbol(o) mrb_val_union(o).sym
|
133
|
+
#else
|
134
|
+
#define mrb_symbol(o) (mrb_sym)(((o).w) >> BOXWORD_SYMBOL_SHIFT)
|
135
|
+
#endif
|
136
|
+
#define mrb_bool(o) (((o).w & ~(uintptr_t)MRB_Qfalse) != 0)
|
137
|
+
|
138
|
+
#define mrb_fixnum_p(o) BOXWORD_SHIFT_VALUE_P(o, FIXNUM)
|
139
|
+
#define mrb_integer_p(o) (BOXWORD_SHIFT_VALUE_P(o, FIXNUM)||BOXWORD_OBJ_TYPE_P(o, INTEGER))
|
140
|
+
#ifdef MRB_64BIT
|
141
|
+
#define mrb_symbol_p(o) (mrb_val_union(o).sym_flag == BOXWORD_SYMBOL_FLAG)
|
142
|
+
#else
|
143
|
+
#define mrb_symbol_p(o) BOXWORD_SHIFT_VALUE_P(o, SYMBOL)
|
144
|
+
#endif
|
145
|
+
#define mrb_undef_p(o) ((o).w == MRB_Qundef)
|
146
|
+
#define mrb_nil_p(o) ((o).w == MRB_Qnil)
|
147
|
+
#define mrb_false_p(o) ((o).w == MRB_Qfalse)
|
148
|
+
#define mrb_true_p(o) ((o).w == MRB_Qtrue)
|
149
|
+
#ifndef MRB_NO_FLOAT
|
150
|
+
#define mrb_float_p(o) BOXWORD_OBJ_TYPE_P(o, FLOAT)
|
151
|
+
#endif
|
152
|
+
#define mrb_array_p(o) BOXWORD_OBJ_TYPE_P(o, ARRAY)
|
153
|
+
#define mrb_string_p(o) BOXWORD_OBJ_TYPE_P(o, STRING)
|
154
|
+
#define mrb_hash_p(o) BOXWORD_OBJ_TYPE_P(o, HASH)
|
155
|
+
#define mrb_cptr_p(o) BOXWORD_OBJ_TYPE_P(o, CPTR)
|
156
|
+
#define mrb_exception_p(o) BOXWORD_OBJ_TYPE_P(o, EXCEPTION)
|
157
|
+
#define mrb_free_p(o) BOXWORD_OBJ_TYPE_P(o, FREE)
|
158
|
+
#define mrb_object_p(o) BOXWORD_OBJ_TYPE_P(o, OBJECT)
|
159
|
+
#define mrb_class_p(o) BOXWORD_OBJ_TYPE_P(o, CLASS)
|
160
|
+
#define mrb_module_p(o) BOXWORD_OBJ_TYPE_P(o, MODULE)
|
161
|
+
#define mrb_iclass_p(o) BOXWORD_OBJ_TYPE_P(o, ICLASS)
|
162
|
+
#define mrb_sclass_p(o) BOXWORD_OBJ_TYPE_P(o, SCLASS)
|
163
|
+
#define mrb_proc_p(o) BOXWORD_OBJ_TYPE_P(o, PROC)
|
164
|
+
#define mrb_range_p(o) BOXWORD_OBJ_TYPE_P(o, RANGE)
|
165
|
+
#define mrb_env_p(o) BOXWORD_OBJ_TYPE_P(o, ENV)
|
166
|
+
#define mrb_data_p(o) BOXWORD_OBJ_TYPE_P(o, DATA)
|
167
|
+
#define mrb_fiber_p(o) BOXWORD_OBJ_TYPE_P(o, FIBER)
|
168
|
+
#define mrb_istruct_p(o) BOXWORD_OBJ_TYPE_P(o, ISTRUCT)
|
169
|
+
#define mrb_break_p(o) BOXWORD_OBJ_TYPE_P(o, BREAK)
|
170
|
+
|
171
|
+
#ifndef MRB_NO_FLOAT
|
172
|
+
#define SET_FLOAT_VALUE(mrb,r,v) ((r) = mrb_word_boxing_float_value(mrb, v))
|
173
|
+
#endif
|
174
|
+
#define SET_CPTR_VALUE(mrb,r,v) ((r) = mrb_word_boxing_cptr_value(mrb, v))
|
175
|
+
#define SET_UNDEF_VALUE(r) ((r).w = MRB_Qundef)
|
176
|
+
#define SET_NIL_VALUE(r) ((r).w = MRB_Qnil)
|
177
|
+
#define SET_FALSE_VALUE(r) ((r).w = MRB_Qfalse)
|
178
|
+
#define SET_TRUE_VALUE(r) ((r).w = MRB_Qtrue)
|
179
|
+
#define SET_BOOL_VALUE(r,b) ((b) ? SET_TRUE_VALUE(r) : SET_FALSE_VALUE(r))
|
180
|
+
#define SET_INT_VALUE(mrb,r,n) ((r) = mrb_word_boxing_int_value(mrb, n))
|
181
|
+
#define SET_FIXNUM_VALUE(r,n) BOXWORD_SET_SHIFT_VALUE(r, FIXNUM, n)
|
182
|
+
#ifdef MRB_64BIT
|
183
|
+
#define SET_SYM_VALUE(r,v) do {\
|
184
|
+
union mrb_value_ mrb_value_union_variable;\
|
185
|
+
mrb_value_union_variable.sym = v;\
|
186
|
+
mrb_value_union_variable.sym_flag = BOXWORD_SYMBOL_FLAG;\
|
187
|
+
(r) = mrb_value_union_variable.value;\
|
188
|
+
} while (0)
|
189
|
+
#else
|
190
|
+
#define SET_SYM_VALUE(r,n) BOXWORD_SET_SHIFT_VALUE(r, SYMBOL, n)
|
191
|
+
#endif
|
192
|
+
#define SET_OBJ_VALUE(r,v) ((r).w = (uintptr_t)(v))
|
193
|
+
|
194
|
+
MRB_INLINE enum mrb_vtype
|
195
|
+
mrb_type(mrb_value o)
|
196
|
+
{
|
197
|
+
return !mrb_bool(o) ? MRB_TT_FALSE :
|
198
|
+
mrb_true_p(o) ? MRB_TT_TRUE :
|
199
|
+
mrb_fixnum_p(o) ? MRB_TT_INTEGER :
|
200
|
+
mrb_symbol_p(o) ? MRB_TT_SYMBOL :
|
201
|
+
mrb_undef_p(o) ? MRB_TT_UNDEF :
|
202
|
+
mrb_val_union(o).bp->tt;
|
203
|
+
}
|
204
|
+
|
205
|
+
#endif /* MRUBY_BOXING_WORD_H */
|