ruby2d 0.11.2 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/assets/include/GLES2/gl2.h +656 -0
- data/assets/include/GLES2/gl2ext.h +3949 -0
- data/assets/include/GLES2/gl2ext_angle.h +701 -0
- data/assets/include/GLES2/gl2platform.h +27 -0
- data/assets/include/GLES3/gl3.h +1192 -0
- data/assets/include/GLES3/gl31.h +1507 -0
- data/assets/include/GLES3/gl32.h +1808 -0
- data/assets/include/GLES3/gl3platform.h +27 -0
- data/assets/include/KHR/khrplatform.h +290 -0
- data/assets/include/SDL2/SDL.h +1 -0
- data/assets/include/SDL2/SDL_assert.h +4 -2
- data/assets/include/SDL2/SDL_atomic.h +20 -0
- data/assets/include/SDL2/SDL_audio.h +40 -4
- data/assets/include/SDL2/SDL_blendmode.h +4 -6
- data/assets/include/SDL2/SDL_clipboard.h +47 -0
- data/assets/include/SDL2/SDL_config.h +6 -2
- data/assets/include/SDL2/SDL_config_android.h +2 -0
- data/assets/include/SDL2/SDL_config_emscripten.h +2 -0
- data/assets/include/SDL2/SDL_config_iphoneos.h +3 -1
- data/assets/include/SDL2/SDL_config_macosx.h +3 -6
- data/assets/include/SDL2/SDL_config_minimal.h +18 -11
- data/assets/include/SDL2/SDL_config_ngage.h +89 -0
- data/assets/include/SDL2/SDL_config_os2.h +5 -3
- data/assets/include/SDL2/SDL_config_pandora.h +1 -0
- data/assets/include/SDL2/SDL_config_windows.h +71 -45
- data/assets/include/SDL2/SDL_config_wingdk.h +253 -0
- data/assets/include/SDL2/SDL_config_winrt.h +11 -49
- data/assets/include/SDL2/SDL_config_xbox.h +235 -0
- data/assets/include/SDL2/SDL_cpuinfo.h +39 -4
- data/assets/include/SDL2/SDL_egl.h +59 -9
- data/assets/include/SDL2/SDL_endian.h +34 -3
- data/assets/include/SDL2/SDL_events.h +32 -1
- data/assets/include/SDL2/SDL_filesystem.h +5 -1
- data/assets/include/SDL2/SDL_gamecontroller.h +78 -5
- data/assets/include/SDL2/SDL_guid.h +100 -0
- data/assets/include/SDL2/SDL_hints.h +645 -43
- data/assets/include/SDL2/SDL_image.h +2045 -33
- data/assets/include/SDL2/SDL_joystick.h +127 -7
- data/assets/include/SDL2/SDL_keyboard.h +38 -1
- data/assets/include/SDL2/SDL_keycode.h +6 -1
- data/assets/include/SDL2/SDL_log.h +2 -2
- data/assets/include/SDL2/SDL_main.h +42 -2
- data/assets/include/SDL2/SDL_metal.h +2 -1
- data/assets/include/SDL2/SDL_mixer.h +2529 -396
- data/assets/include/SDL2/SDL_mouse.h +12 -1
- data/assets/include/SDL2/SDL_opengl.h +0 -51
- data/assets/include/SDL2/SDL_opengl_glext.h +2260 -231
- data/assets/include/SDL2/SDL_opengles2_gl2.h +374 -339
- data/assets/include/SDL2/SDL_opengles2_gl2ext.h +3479 -1496
- data/assets/include/SDL2/SDL_opengles2_gl2platform.h +6 -9
- data/assets/include/SDL2/SDL_opengles2_khrplatform.h +43 -14
- data/assets/include/SDL2/SDL_platform.h +32 -6
- data/assets/include/SDL2/SDL_rect.h +154 -2
- data/assets/include/SDL2/SDL_render.h +46 -17
- data/assets/include/SDL2/SDL_revision.h +4 -0
- data/assets/include/SDL2/SDL_rwops.h +1 -15
- data/assets/include/SDL2/SDL_scancode.h +46 -21
- data/assets/include/SDL2/SDL_sensor.h +24 -3
- data/assets/include/SDL2/SDL_stdinc.h +119 -8
- data/assets/include/SDL2/SDL_surface.h +3 -1
- data/assets/include/SDL2/SDL_system.h +66 -6
- data/assets/include/SDL2/SDL_syswm.h +2 -0
- data/assets/include/SDL2/SDL_test_common.h +1 -0
- data/assets/include/SDL2/SDL_test_font.h +90 -3
- data/assets/include/SDL2/SDL_thread.h +3 -3
- data/assets/include/SDL2/SDL_touch.h +8 -0
- data/assets/include/SDL2/SDL_ttf.h +2084 -155
- data/assets/include/SDL2/SDL_version.h +19 -3
- data/assets/include/SDL2/SDL_video.h +71 -9
- data/assets/include/SDL2/begin_code.h +4 -4
- data/assets/include/mrbconf.h +15 -17
- data/assets/include/mruby/array.h +8 -21
- data/assets/include/mruby/boxing_nan.h +115 -86
- data/assets/include/mruby/boxing_word.h +104 -78
- data/assets/include/mruby/common.h +6 -0
- data/assets/include/mruby/compile.h +3 -4
- data/assets/include/mruby/debug.h +4 -2
- data/assets/include/mruby/dump.h +5 -2
- data/assets/include/mruby/error.h +12 -2
- data/assets/include/mruby/gc.h +2 -0
- data/assets/include/mruby/hash.h +1 -3
- data/assets/include/mruby/irep.h +4 -4
- data/assets/include/mruby/numeric.h +21 -13
- data/assets/include/mruby/opcode.h +30 -0
- data/assets/include/mruby/ops.h +99 -101
- data/assets/include/mruby/presym/scanning.h +15 -9
- data/assets/include/mruby/proc.h +4 -2
- data/assets/include/mruby/string.h +3 -24
- data/assets/include/mruby/value.h +80 -40
- data/assets/include/mruby/variable.h +0 -15
- data/assets/include/mruby/version.h +5 -5
- data/assets/include/mruby.h +86 -16
- 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/universal/lib/libSDL2_mixer.a +0 -0
- data/assets/macos/universal/lib/libSDL2_ttf.a +0 -0
- data/assets/macos/universal/lib/libavif.a +0 -0
- data/assets/macos/universal/lib/libbrotlicommon-static.a +0 -0
- data/assets/macos/universal/lib/libbrotlidec-static.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/libhwy.a +0 -0
- data/assets/macos/universal/lib/libjpeg.a +0 -0
- data/assets/macos/universal/lib/libjxl.a +0 -0
- data/assets/macos/universal/lib/libmodplug.a +0 -0
- data/assets/macos/universal/lib/libmpg123.a +0 -0
- data/assets/macos/universal/lib/libmruby.a +0 -0
- data/assets/macos/universal/lib/libogg.a +0 -0
- data/assets/macos/universal/lib/libpng.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/macos/universal/lib/libzstd.a +0 -0
- data/assets/wasm/libmruby.a +0 -0
- data/assets/wasm/template.html +52 -4
- 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/libhwy.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/libjxl.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/libpng.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 +1 -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/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/libharfbuzz.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libhwy.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libjpeg.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libjxl.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/liblzma.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/libopus.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libpng.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/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/ext/ruby2d/canvas.c +540 -0
- data/ext/ruby2d/extconf.rb +39 -21
- data/ext/ruby2d/gl.c +3 -3
- data/ext/ruby2d/image.c +7 -7
- data/ext/ruby2d/ruby2d.c +741 -24
- data/ext/ruby2d/ruby2d.h +66 -3
- data/ext/ruby2d/sound.c +16 -2
- data/lib/ruby2d/canvas.rb +315 -0
- data/lib/ruby2d/circle.rb +30 -15
- data/lib/ruby2d/cli/build.rb +11 -4
- data/lib/ruby2d/cli/enable_console.rb +3 -1
- data/lib/ruby2d/color.rb +133 -77
- data/lib/ruby2d/core.rb +32 -0
- data/lib/ruby2d/dsl.rb +38 -32
- data/lib/ruby2d/exceptions.rb +2 -1
- data/lib/ruby2d/font.rb +97 -62
- data/lib/ruby2d/image.rb +48 -27
- data/lib/ruby2d/line.rb +84 -45
- data/lib/ruby2d/music.rb +33 -23
- data/lib/ruby2d/pixel.rb +10 -9
- data/lib/ruby2d/pixmap.rb +39 -0
- data/lib/ruby2d/pixmap_atlas.rb +56 -0
- data/lib/ruby2d/quad.rb +98 -49
- data/lib/ruby2d/rectangle.rb +35 -36
- data/lib/ruby2d/renderable.rb +7 -6
- data/lib/ruby2d/sound.rb +23 -17
- data/lib/ruby2d/sprite.rb +181 -140
- data/lib/ruby2d/square.rb +21 -20
- data/lib/ruby2d/text.rb +47 -19
- data/lib/ruby2d/texture.rb +13 -3
- data/lib/ruby2d/tileset.rb +97 -44
- data/lib/ruby2d/triangle.rb +91 -42
- data/lib/ruby2d/version.rb +3 -1
- data/lib/ruby2d/vertices.rb +81 -45
- data/lib/ruby2d/window.rb +508 -371
- data/lib/ruby2d.rb +11 -29
- metadata +84 -16
- data/assets/include/SDL2/SDL_config_psp.h +0 -165
- data/assets/include/SDL2/SDL_config_wiz.h +0 -154
- data/assets/include/glew.h +0 -23686
- data/assets/macos/universal/lib/libpng16.a +0 -0
- data/assets/wasm/build_config.rb +0 -13
- data/assets/windows/glew/README.md +0 -10
- data/assets/windows/glew/glew.h +0 -23686
- data/assets/windows/glew/libglew32.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libpng16.a +0 -0
- data/lib/ruby2d/entity.rb +0 -17
@@ -58,8 +58,8 @@ typedef struct SDL_version
|
|
58
58
|
/* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
|
59
59
|
*/
|
60
60
|
#define SDL_MAJOR_VERSION 2
|
61
|
-
#define SDL_MINOR_VERSION
|
62
|
-
#define SDL_PATCHLEVEL
|
61
|
+
#define SDL_MINOR_VERSION 26
|
62
|
+
#define SDL_PATCHLEVEL 1
|
63
63
|
|
64
64
|
/**
|
65
65
|
* Macro to determine SDL version program was compiled against.
|
@@ -83,6 +83,8 @@ typedef struct SDL_version
|
|
83
83
|
(x)->patch = SDL_PATCHLEVEL; \
|
84
84
|
}
|
85
85
|
|
86
|
+
/* TODO: Remove this whole block in SDL 3 */
|
87
|
+
#if SDL_MAJOR_VERSION < 3
|
86
88
|
/**
|
87
89
|
* This macro turns the version numbers into a numeric value:
|
88
90
|
* \verbatim
|
@@ -90,21 +92,35 @@ typedef struct SDL_version
|
|
90
92
|
\endverbatim
|
91
93
|
*
|
92
94
|
* This assumes that there will never be more than 100 patchlevels.
|
95
|
+
*
|
96
|
+
* In versions higher than 2.9.0, the minor version overflows into
|
97
|
+
* the thousands digit: for example, 2.23.0 is encoded as 4300,
|
98
|
+
* and 2.255.99 would be encoded as 25799.
|
99
|
+
* This macro will not be available in SDL 3.x.
|
93
100
|
*/
|
94
101
|
#define SDL_VERSIONNUM(X, Y, Z) \
|
95
102
|
((X)*1000 + (Y)*100 + (Z))
|
96
103
|
|
97
104
|
/**
|
98
105
|
* This is the version number macro for the current SDL version.
|
106
|
+
*
|
107
|
+
* In versions higher than 2.9.0, the minor version overflows into
|
108
|
+
* the thousands digit: for example, 2.23.0 is encoded as 4300.
|
109
|
+
* This macro will not be available in SDL 3.x.
|
110
|
+
*
|
111
|
+
* Deprecated, use SDL_VERSION_ATLEAST or SDL_VERSION instead.
|
99
112
|
*/
|
100
113
|
#define SDL_COMPILEDVERSION \
|
101
114
|
SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL)
|
115
|
+
#endif /* SDL_MAJOR_VERSION < 3 */
|
102
116
|
|
103
117
|
/**
|
104
118
|
* This macro will evaluate to true if compiled with SDL at least X.Y.Z.
|
105
119
|
*/
|
106
120
|
#define SDL_VERSION_ATLEAST(X, Y, Z) \
|
107
|
-
(
|
121
|
+
((SDL_MAJOR_VERSION >= X) && \
|
122
|
+
(SDL_MAJOR_VERSION > X || SDL_MINOR_VERSION >= Y) && \
|
123
|
+
(SDL_MAJOR_VERSION > X || SDL_MINOR_VERSION > Y || SDL_PATCHLEVEL >= Z))
|
108
124
|
|
109
125
|
/**
|
110
126
|
* Get the version of SDL that is linked against your program.
|
@@ -248,7 +248,8 @@ typedef enum
|
|
248
248
|
SDL_GL_FRAMEBUFFER_SRGB_CAPABLE,
|
249
249
|
SDL_GL_CONTEXT_RELEASE_BEHAVIOR,
|
250
250
|
SDL_GL_CONTEXT_RESET_NOTIFICATION,
|
251
|
-
SDL_GL_CONTEXT_NO_ERROR
|
251
|
+
SDL_GL_CONTEXT_NO_ERROR,
|
252
|
+
SDL_GL_FLOATBUFFERS
|
252
253
|
} SDL_GLattr;
|
253
254
|
|
254
255
|
typedef enum
|
@@ -444,6 +445,15 @@ extern DECLSPEC int SDLCALL SDL_GetDisplayUsableBounds(int displayIndex, SDL_Rec
|
|
444
445
|
* A failure of this function usually means that either no DPI information is
|
445
446
|
* available or the `displayIndex` is out of range.
|
446
447
|
*
|
448
|
+
* **WARNING**: This reports the DPI that the hardware reports, and it is not
|
449
|
+
* always reliable! It is almost always better to use SDL_GetWindowSize() to
|
450
|
+
* find the window size, which might be in logical points instead of pixels,
|
451
|
+
* and then SDL_GL_GetDrawableSize(), SDL_Vulkan_GetDrawableSize(),
|
452
|
+
* SDL_Metal_GetDrawableSize(), or SDL_GetRendererOutputSize(), and compare
|
453
|
+
* the two values to get an actual scaling value between the two. We will be
|
454
|
+
* rethinking how high-dpi details should be managed in SDL3 to make things
|
455
|
+
* more consistent, reliable, and clear.
|
456
|
+
*
|
447
457
|
* \param displayIndex the index of the display from which DPI information
|
448
458
|
* should be queried
|
449
459
|
* \param ddpi a pointer filled in with the diagonal DPI of the display; may
|
@@ -587,6 +597,35 @@ extern DECLSPEC int SDLCALL SDL_GetCurrentDisplayMode(int displayIndex, SDL_Disp
|
|
587
597
|
*/
|
588
598
|
extern DECLSPEC SDL_DisplayMode * SDLCALL SDL_GetClosestDisplayMode(int displayIndex, const SDL_DisplayMode * mode, SDL_DisplayMode * closest);
|
589
599
|
|
600
|
+
/**
|
601
|
+
* Get the index of the display containing a point
|
602
|
+
*
|
603
|
+
* \param point the point to query
|
604
|
+
* \returns the index of the display containing the point or a negative error
|
605
|
+
* code on failure; call SDL_GetError() for more information.
|
606
|
+
*
|
607
|
+
* \since This function is available since SDL 2.24.0.
|
608
|
+
*
|
609
|
+
* \sa SDL_GetDisplayBounds
|
610
|
+
* \sa SDL_GetNumVideoDisplays
|
611
|
+
*/
|
612
|
+
extern DECLSPEC int SDLCALL SDL_GetPointDisplayIndex(const SDL_Point * point);
|
613
|
+
|
614
|
+
/**
|
615
|
+
* Get the index of the display primarily containing a rect
|
616
|
+
*
|
617
|
+
* \param rect the rect to query
|
618
|
+
* \returns the index of the display entirely containing the rect or closest
|
619
|
+
* to the center of the rect on success or a negative error code on
|
620
|
+
* failure; call SDL_GetError() for more information.
|
621
|
+
*
|
622
|
+
* \since This function is available since SDL 2.24.0.
|
623
|
+
*
|
624
|
+
* \sa SDL_GetDisplayBounds
|
625
|
+
* \sa SDL_GetNumVideoDisplays
|
626
|
+
*/
|
627
|
+
extern DECLSPEC int SDLCALL SDL_GetRectDisplayIndex(const SDL_Rect * rect);
|
628
|
+
|
590
629
|
/**
|
591
630
|
* Get the index of the display associated with a window.
|
592
631
|
*
|
@@ -697,7 +736,10 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetWindowPixelFormat(SDL_Window * window);
|
|
697
736
|
* in pixels may differ from its size in screen coordinates on platforms with
|
698
737
|
* high-DPI support (e.g. iOS and macOS). Use SDL_GetWindowSize() to query the
|
699
738
|
* client area's size in screen coordinates, and SDL_GL_GetDrawableSize() or
|
700
|
-
* SDL_GetRendererOutputSize() to query the drawable size in pixels.
|
739
|
+
* SDL_GetRendererOutputSize() to query the drawable size in pixels. Note that
|
740
|
+
* when this flag is set, the drawable size can vary after the window is
|
741
|
+
* created and should be queried after major window events such as when the
|
742
|
+
* window is resized or moved between displays.
|
701
743
|
*
|
702
744
|
* If the window is set fullscreen, the width and height parameters `w` and
|
703
745
|
* `h` will not be used. However, invalid size parameters (e.g. too large) may
|
@@ -1004,6 +1046,27 @@ extern DECLSPEC int SDLCALL SDL_GetWindowBordersSize(SDL_Window * window,
|
|
1004
1046
|
int *top, int *left,
|
1005
1047
|
int *bottom, int *right);
|
1006
1048
|
|
1049
|
+
/**
|
1050
|
+
* Get the size of a window in pixels.
|
1051
|
+
*
|
1052
|
+
* This may differ from SDL_GetWindowSize() if we're rendering to a high-DPI
|
1053
|
+
* drawable, i.e. the window was created with `SDL_WINDOW_ALLOW_HIGHDPI` on a
|
1054
|
+
* platform with high-DPI support (Apple calls this "Retina"), and not
|
1055
|
+
* disabled by the `SDL_HINT_VIDEO_HIGHDPI_DISABLED` hint.
|
1056
|
+
*
|
1057
|
+
* \param window the window from which the drawable size should be queried
|
1058
|
+
* \param w a pointer to variable for storing the width in pixels, may be NULL
|
1059
|
+
* \param h a pointer to variable for storing the height in pixels, may be
|
1060
|
+
* NULL
|
1061
|
+
*
|
1062
|
+
* \since This function is available since SDL 2.26.0.
|
1063
|
+
*
|
1064
|
+
* \sa SDL_CreateWindow
|
1065
|
+
* \sa SDL_GetWindowSize
|
1066
|
+
*/
|
1067
|
+
extern DECLSPEC void SDLCALL SDL_GetWindowSizeInPixels(SDL_Window * window,
|
1068
|
+
int *w, int *h);
|
1069
|
+
|
1007
1070
|
/**
|
1008
1071
|
* Set the minimum size of a window's client area.
|
1009
1072
|
*
|
@@ -1337,6 +1400,7 @@ extern DECLSPEC void SDLCALL SDL_SetWindowKeyboardGrab(SDL_Window * window,
|
|
1337
1400
|
* Mouse grab confines the mouse cursor to the window.
|
1338
1401
|
*
|
1339
1402
|
* \param window The window for which the mouse grab mode should be set.
|
1403
|
+
* \param grabbed This is SDL_TRUE to grab mouse, and SDL_FALSE to release.
|
1340
1404
|
*
|
1341
1405
|
* \since This function is available since SDL 2.0.16.
|
1342
1406
|
*
|
@@ -1747,6 +1811,9 @@ extern DECLSPEC void SDLCALL SDL_EnableScreenSaver(void);
|
|
1747
1811
|
* If you disable the screensaver, it is automatically re-enabled when SDL
|
1748
1812
|
* quits.
|
1749
1813
|
*
|
1814
|
+
* The screensaver is disabled by default since SDL 2.0.2. Before SDL 2.0.2
|
1815
|
+
* the screensaver was enabled by default.
|
1816
|
+
*
|
1750
1817
|
* \since This function is available since SDL 2.0.0.
|
1751
1818
|
*
|
1752
1819
|
* \sa SDL_EnableScreenSaver
|
@@ -2008,13 +2075,8 @@ extern DECLSPEC void SDLCALL SDL_GL_GetDrawableSize(SDL_Window * window, int *w,
|
|
2008
2075
|
* retry the call with 1 for the interval.
|
2009
2076
|
*
|
2010
2077
|
* Adaptive vsync is implemented for some glX drivers with
|
2011
|
-
* GLX_EXT_swap_control_tear
|
2012
|
-
*
|
2013
|
-
* https://www.opengl.org/registry/specs/EXT/glx_swap_control_tear.txt
|
2014
|
-
*
|
2015
|
-
* and for some Windows drivers with WGL_EXT_swap_control_tear:
|
2016
|
-
*
|
2017
|
-
* https://www.opengl.org/registry/specs/EXT/wgl_swap_control_tear.txt
|
2078
|
+
* GLX_EXT_swap_control_tear, and for some Windows drivers with
|
2079
|
+
* WGL_EXT_swap_control_tear.
|
2018
2080
|
*
|
2019
2081
|
* Read more on the Khronos wiki:
|
2020
2082
|
* https://www.khronos.org/opengl/wiki/Swap_Interval#Adaptive_Vsync
|
@@ -34,7 +34,7 @@
|
|
34
34
|
#define _begin_code_h
|
35
35
|
|
36
36
|
#ifndef SDL_DEPRECATED
|
37
|
-
# if (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */
|
37
|
+
# if defined(__GNUC__) && (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */
|
38
38
|
# define SDL_DEPRECATED __attribute__((deprecated))
|
39
39
|
# else
|
40
40
|
# define SDL_DEPRECATED
|
@@ -51,7 +51,7 @@
|
|
51
51
|
|
52
52
|
/* Some compilers use a special export keyword */
|
53
53
|
#ifndef DECLSPEC
|
54
|
-
# if defined(__WIN32__) || defined(__WINRT__) || defined(__CYGWIN__)
|
54
|
+
# if defined(__WIN32__) || defined(__WINRT__) || defined(__CYGWIN__) || defined(__GDK__)
|
55
55
|
# ifdef DLL_EXPORT
|
56
56
|
# define DECLSPEC __declspec(dllexport)
|
57
57
|
# else
|
@@ -74,7 +74,7 @@
|
|
74
74
|
|
75
75
|
/* By default SDL uses the C calling convention */
|
76
76
|
#ifndef SDLCALL
|
77
|
-
#if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__)
|
77
|
+
#if (defined(__WIN32__) || defined(__WINRT__) || defined(__GDK__)) && !defined(__GNUC__)
|
78
78
|
#define SDLCALL __cdecl
|
79
79
|
#elif defined(__OS2__) || defined(__EMX__)
|
80
80
|
#define SDLCALL _System
|
@@ -107,7 +107,7 @@
|
|
107
107
|
#ifdef __BORLANDC__
|
108
108
|
#pragma nopackwarning
|
109
109
|
#endif
|
110
|
-
#ifdef
|
110
|
+
#ifdef _WIN64
|
111
111
|
/* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */
|
112
112
|
#pragma pack(push,8)
|
113
113
|
#else
|
data/assets/include/mrbconf.h
CHANGED
@@ -7,9 +7,6 @@
|
|
7
7
|
#ifndef MRUBYCONF_H
|
8
8
|
#define MRUBYCONF_H
|
9
9
|
|
10
|
-
#include <limits.h>
|
11
|
-
#include <stdint.h>
|
12
|
-
|
13
10
|
/* architecture selection: */
|
14
11
|
/* specify -DMRB_32BIT or -DMRB_64BIT to override */
|
15
12
|
#if !defined(MRB_32BIT) && !defined(MRB_64BIT)
|
@@ -25,10 +22,10 @@
|
|
25
22
|
#endif
|
26
23
|
|
27
24
|
/* configuration options: */
|
28
|
-
/* add -DMRB_USE_FLOAT32 to use float instead of double for floating
|
25
|
+
/* add -DMRB_USE_FLOAT32 to use float instead of double for floating-point numbers */
|
29
26
|
//#define MRB_USE_FLOAT32
|
30
27
|
|
31
|
-
/* exclude floating
|
28
|
+
/* exclude floating-point numbers */
|
32
29
|
//#define MRB_NO_FLOAT
|
33
30
|
|
34
31
|
/* obsolete configuration */
|
@@ -82,6 +79,9 @@
|
|
82
79
|
# define MRB_WORD_BOXING
|
83
80
|
#endif
|
84
81
|
|
82
|
+
/* if defined mruby allocates Float objects in the heap to keep full precision if needed */
|
83
|
+
//#define MRB_WORDBOX_NO_FLOAT_TRUNCATE
|
84
|
+
|
85
85
|
/* add -DMRB_INT32 to use 32bit integer for mrb_int; conflict with MRB_INT64;
|
86
86
|
Default for 32-bit CPU mode. */
|
87
87
|
//#define MRB_INT32
|
@@ -113,11 +113,17 @@
|
|
113
113
|
/* number of object per heap page */
|
114
114
|
//#define MRB_HEAP_PAGE_SIZE 1024
|
115
115
|
|
116
|
-
/* if
|
117
|
-
//#define
|
116
|
+
/* define if your platform does not support etext, edata */
|
117
|
+
//#define MRB_NO_DEFAULT_RO_DATA_P
|
118
|
+
|
119
|
+
/* define if your platform supports etext, edata */
|
120
|
+
//#define MRB_USE_RO_DATA_P_ETEXT
|
121
|
+
/* use MRB_USE_ETEXT_RO_DATA_P by default on Linux */
|
122
|
+
#if (defined(__linux__) && !defined(__KERNEL__))
|
123
|
+
#define MRB_USE_ETEXT_RO_DATA_P
|
124
|
+
#endif
|
118
125
|
|
119
|
-
/*
|
120
|
-
you can try mrb_ro_data_p() that you have implemented yourself in any file;
|
126
|
+
/* you can provide and use mrb_ro_data_p() for your platform.
|
121
127
|
prototype is `mrb_bool mrb_ro_data_p(const char *ptr)` */
|
122
128
|
//#define MRB_USE_CUSTOM_RO_DATA_P
|
123
129
|
|
@@ -181,14 +187,6 @@
|
|
181
187
|
# include <stdio.h>
|
182
188
|
#endif
|
183
189
|
|
184
|
-
#ifndef FALSE
|
185
|
-
# define FALSE 0
|
186
|
-
#endif
|
187
|
-
|
188
|
-
#ifndef TRUE
|
189
|
-
# define TRUE 1
|
190
|
-
#endif
|
191
|
-
|
192
190
|
/*
|
193
191
|
** mruby tuning profiles
|
194
192
|
**/
|
@@ -14,15 +14,17 @@
|
|
14
14
|
*/
|
15
15
|
MRB_BEGIN_DECL
|
16
16
|
|
17
|
-
|
18
17
|
typedef struct mrb_shared_array {
|
19
18
|
int refcnt;
|
20
19
|
mrb_ssize len;
|
21
20
|
mrb_value *ptr;
|
22
21
|
} mrb_shared_array;
|
23
22
|
|
24
|
-
#if defined(MRB_32BIT) && defined(MRB_NO_BOXING)
|
23
|
+
#if defined(MRB_32BIT) && defined(MRB_NO_BOXING) && !defined(MRB_USE_FLOAT32) && !defined(MRB_ARY_NO_EMBED)
|
25
24
|
# define MRB_ARY_NO_EMBED
|
25
|
+
#endif
|
26
|
+
|
27
|
+
#ifdef MRB_ARY_NO_EMBED
|
26
28
|
# define MRB_ARY_EMBED_LEN_MAX 0
|
27
29
|
#else
|
28
30
|
# define MRB_ARY_EMBED_LEN_MAX ((mrb_int)(sizeof(void*)*3/sizeof(mrb_value)))
|
@@ -65,7 +67,7 @@ struct RArray {
|
|
65
67
|
#define ARY_EMBED_PTR(a) ((a)->as.ary)
|
66
68
|
#endif
|
67
69
|
|
68
|
-
#define ARY_LEN(a) (ARY_EMBED_P(a)?ARY_EMBED_LEN(a):(a)->as.heap.len)
|
70
|
+
#define ARY_LEN(a) (ARY_EMBED_P(a)?ARY_EMBED_LEN(a):(mrb_int)(a)->as.heap.len)
|
69
71
|
#define ARY_PTR(a) (ARY_EMBED_P(a)?ARY_EMBED_PTR(a):(a)->as.heap.ptr)
|
70
72
|
#define RARRAY_LEN(a) ARY_LEN(RARRAY(a))
|
71
73
|
#define RARRAY_PTR(a) ARY_PTR(RARRAY(a))
|
@@ -107,7 +109,7 @@ MRB_API mrb_value mrb_ary_new(mrb_state *mrb);
|
|
107
109
|
* Array[value1, value2, ...]
|
108
110
|
*
|
109
111
|
* @param mrb The mruby state reference.
|
110
|
-
* @param size The
|
112
|
+
* @param size The number of values.
|
111
113
|
* @param vals The actual values.
|
112
114
|
* @return The initialized array.
|
113
115
|
*/
|
@@ -176,20 +178,6 @@ MRB_API void mrb_ary_push(mrb_state *mrb, mrb_value array, mrb_value value);
|
|
176
178
|
*/
|
177
179
|
MRB_API mrb_value mrb_ary_pop(mrb_state *mrb, mrb_value ary);
|
178
180
|
|
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
181
|
/*
|
194
182
|
* Sets a value on an array at the given index
|
195
183
|
*
|
@@ -200,7 +188,7 @@ MRB_API mrb_value mrb_ary_ref(mrb_state *mrb, mrb_value ary, mrb_int n);
|
|
200
188
|
* @param mrb The mruby state reference.
|
201
189
|
* @param ary The target array.
|
202
190
|
* @param n The array index being referenced.
|
203
|
-
* @param val The value being
|
191
|
+
* @param val The value being set.
|
204
192
|
*/
|
205
193
|
MRB_API void mrb_ary_set(mrb_state *mrb, mrb_value ary, mrb_int n, mrb_value val);
|
206
194
|
|
@@ -216,8 +204,6 @@ MRB_API void mrb_ary_set(mrb_state *mrb, mrb_value ary, mrb_int n, mrb_value val
|
|
216
204
|
* @param other The array to replace it with.
|
217
205
|
*/
|
218
206
|
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
207
|
|
222
208
|
/*
|
223
209
|
* Unshift an element into the array
|
@@ -243,6 +229,7 @@ MRB_API mrb_value mrb_ary_unshift(mrb_state *mrb, mrb_value self, mrb_value item
|
|
243
229
|
* @param offset The element position (negative counts from the tail).
|
244
230
|
*/
|
245
231
|
MRB_API mrb_value mrb_ary_entry(mrb_value ary, mrb_int offset);
|
232
|
+
#define mrb_ary_ref(mrb, ary, n) mrb_ary_entry(ary, n)
|
246
233
|
|
247
234
|
/*
|
248
235
|
* Replace subsequence of an array.
|
@@ -15,116 +15,145 @@
|
|
15
15
|
# error ---->> MRB_NAN_BOXING and MRB_NO_FLOAT conflict <<----
|
16
16
|
#endif
|
17
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
18
|
#define MRB_FIXNUM_MIN INT32_MIN
|
25
19
|
#define MRB_FIXNUM_MAX INT32_MAX
|
26
20
|
|
21
|
+
enum mrb_nanbox_tt_inline {
|
22
|
+
MRB_NANBOX_TT_OBJECT = 0,
|
23
|
+
MRB_NANBOX_TT_INTEGER = 1,
|
24
|
+
MRB_NANBOX_TT_MISC = 2,
|
25
|
+
MRB_NANBOX_TT_CPTR = 3,
|
26
|
+
};
|
27
|
+
|
27
28
|
/* value representation by nan-boxing:
|
28
|
-
* float :
|
29
|
-
*
|
30
|
-
*
|
31
|
-
*
|
32
|
-
*
|
33
|
-
*
|
29
|
+
* float : SEEEEEEE EEEEFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF
|
30
|
+
* +/-inf: S1111111 11110000 00000000 00000000 00000000 00000000 00000000 00000000
|
31
|
+
* nan : 01111111 11111000 00000000 00000000 00000000 00000000 00000000 00000000
|
32
|
+
* int : 01111111 11111001 00000000 00000000 IIIIIIII IIIIIIII IIIIIIII IIIIIIII
|
33
|
+
* sym : 01111111 11111110 00000000 00TTTTTT SSSSSSSS SSSSSSSS SSSSSSSS SSSSSSSS
|
34
|
+
* misc : 01111111 11111110 00000000 00TTTTTT 00000000 00000000 00000000 0000MMMM
|
35
|
+
* object: 01111111 11111100 PPPPPPPP PPPPPPPP PPPPPPPP PPPPPPPP PPPPPPPP PPPPPP00
|
36
|
+
* cptr : 01111111 11111111 PPPPPPPP PPPPPPPP PPPPPPPP PPPPPPPP PPPPPPPP PPPPPPPP
|
37
|
+
* Stored as O = R + 0x8004000000000000, retrieved as R = O - 0x8004000000000000.
|
38
|
+
* This makes pointers have all zeros in the top 32 bits.
|
34
39
|
*/
|
35
40
|
typedef struct mrb_value {
|
36
41
|
uint64_t u;
|
37
42
|
} mrb_value;
|
38
43
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
44
|
+
static inline mrb_float
|
45
|
+
mrb_nan_boxing_value_float(mrb_value v)
|
46
|
+
{
|
47
|
+
union {
|
48
|
+
mrb_float f;
|
49
|
+
uint64_t u;
|
50
|
+
} x;
|
51
|
+
x.u = v.u - 0x8004000000000000;
|
52
|
+
return x.f;
|
53
|
+
}
|
54
|
+
|
55
|
+
#define SET_FLOAT_VALUE(mrb,r,f) do { \
|
56
|
+
union { \
|
57
|
+
mrb_float f; \
|
58
|
+
uint64_t u; \
|
59
|
+
} float_uint_union; \
|
60
|
+
if ((f) != (f)) { /* NaN */ \
|
61
|
+
float_uint_union.u = 0x7ff8000000000000UL; \
|
62
|
+
} \
|
63
|
+
else { \
|
64
|
+
float_uint_union.f = (f); \
|
65
|
+
} \
|
66
|
+
r.u = float_uint_union.u + 0x8004000000000000; \
|
67
|
+
} while(0)
|
68
|
+
|
69
|
+
#define mrb_float_p(o) (((uint64_t)((o).u)&0xfffc000000000000) != 0)
|
70
|
+
|
71
|
+
struct RInteger {
|
72
|
+
MRB_OBJECT_HEADER;
|
73
|
+
mrb_int i;
|
55
74
|
};
|
56
75
|
|
57
|
-
|
76
|
+
#define mrb_nb_tt(o) ((enum mrb_nanbox_tt_inline)((uint32_t)((o).u>>48)&3))
|
58
77
|
|
59
|
-
|
60
|
-
|
78
|
+
MRB_INLINE enum mrb_vtype
|
79
|
+
mrb_type(mrb_value o)
|
61
80
|
{
|
62
|
-
|
63
|
-
|
64
|
-
|
81
|
+
if (mrb_float_p(o)) return MRB_TT_FLOAT;
|
82
|
+
|
83
|
+
int64_t u = o.u;
|
84
|
+
switch (mrb_nb_tt(o)) {
|
85
|
+
case MRB_NANBOX_TT_OBJECT: {
|
86
|
+
if (u == 0) return MRB_TT_FALSE;
|
87
|
+
return ((struct RBasic*)(uintptr_t)u)->tt;
|
88
|
+
}
|
89
|
+
case MRB_NANBOX_TT_INTEGER:
|
90
|
+
return MRB_TT_INTEGER;
|
91
|
+
case MRB_NANBOX_TT_MISC:
|
92
|
+
return (enum mrb_vtype)((uint32_t)(o.u >> 32) & 0x1f);
|
93
|
+
case MRB_NANBOX_TT_CPTR:
|
94
|
+
return MRB_TT_CPTR;
|
95
|
+
default:
|
96
|
+
/* never happen */
|
97
|
+
return MRB_TT_FLOAT;
|
98
|
+
}
|
65
99
|
}
|
66
100
|
|
67
|
-
#define
|
68
|
-
|
69
|
-
#define mrb_float(o)
|
70
|
-
#
|
71
|
-
|
72
|
-
#
|
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)
|
101
|
+
#define NANBOX_SET_MISC_VALUE(r,t,i) NANBOX_SET_VALUE(r, MRB_NANBOX_TT_MISC, ((uint64_t)(t)<<32) | (i))
|
102
|
+
|
103
|
+
#define mrb_float(o) mrb_nan_boxing_value_float(o)
|
104
|
+
#ifdef MRB_INT64
|
105
|
+
/*
|
106
|
+
#ifdef MRB_32BIT
|
107
|
+
#define mrb_fixnum(o) ((mrb_int)((intptr_t)0xffffffffffff&((o).u))|(((o).u & 0x800000000000)?0xffff000000000000:0))
|
78
108
|
#else
|
79
|
-
#define
|
80
|
-
#define mrb_cptr(o) mrb_ptr(o)
|
81
|
-
#define BOXNAN_SHIFT_LONG_POINTER(v) 0
|
109
|
+
#define mrb_fixnum(o) ((mrb_int)(int32_t)((o).u))
|
82
110
|
#endif
|
111
|
+
*/
|
83
112
|
|
84
|
-
#define
|
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)
|
113
|
+
#define mrb_fixnum(o) ((mrb_int)(int32_t)((o).u))
|
90
114
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
115
|
+
static inline mrb_int
|
116
|
+
mrb_nan_boxing_value_int(mrb_value v)
|
117
|
+
{
|
118
|
+
uint64_t u = v.u;
|
119
|
+
if (mrb_nb_tt(v)==MRB_NANBOX_TT_OBJECT) {
|
120
|
+
struct RInteger *p = (struct RInteger*)(uintptr_t)u;
|
121
|
+
return p->i;
|
122
|
+
}
|
123
|
+
return mrb_fixnum(v);
|
124
|
+
}
|
125
|
+
#define mrb_integer(o) mrb_nan_boxing_value_int(o)
|
98
126
|
#else
|
99
|
-
#define
|
127
|
+
#define mrb_fixnum(o) ((mrb_int)(((uintptr_t)0xffffffff)&((o).u)))
|
128
|
+
#define mrb_integer(o) mrb_fixnum(o)
|
100
129
|
#endif
|
130
|
+
#define mrb_symbol(o) ((mrb_sym)((uintptr_t)0xffffffff)&((o).u))
|
131
|
+
#define mrb_ptr(o) ((void*)(uintptr_t)(o).u)
|
132
|
+
#define mrb_cptr(o) ((void*)(uintptr_t)(0xffffffffffffULL&(o).u))
|
101
133
|
|
102
|
-
#define
|
103
|
-
|
104
|
-
|
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)
|
134
|
+
#define NANBOX_SET_VALUE(o, tt, v) do { \
|
135
|
+
(o).u = ((uint64_t)(tt)<<48) | ((uint64_t)(v)); \
|
136
|
+
} while (0)
|
113
137
|
|
114
|
-
#define SET_NIL_VALUE(r)
|
115
|
-
#define SET_FALSE_VALUE(r)
|
116
|
-
#define SET_TRUE_VALUE(r)
|
117
|
-
#define SET_BOOL_VALUE(r,b)
|
118
|
-
#
|
119
|
-
|
120
|
-
#define
|
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))
|
138
|
+
#define SET_NIL_VALUE(r) ((r).u = 0)
|
139
|
+
#define SET_FALSE_VALUE(r) NANBOX_SET_MISC_VALUE(r, MRB_TT_FALSE, 1)
|
140
|
+
#define SET_TRUE_VALUE(r) NANBOX_SET_MISC_VALUE(r, MRB_TT_TRUE, 1)
|
141
|
+
#define SET_BOOL_VALUE(r,b) NANBOX_SET_MISC_VALUE(r, (b) ? MRB_TT_TRUE : MRB_TT_FALSE, 1)
|
142
|
+
#ifdef MRB_INT64
|
143
|
+
MRB_API mrb_value mrb_boxing_int_value(struct mrb_state*, mrb_int);
|
144
|
+
#define SET_INT_VALUE(mrb, r, n) ((r) = mrb_boxing_int_value(mrb, n))
|
125
145
|
#else
|
126
|
-
#define
|
146
|
+
#define SET_INT_VALUE(mrb, r, n) SET_FIXNUM_VALUE(r, n)
|
127
147
|
#endif
|
128
|
-
#define
|
148
|
+
#define SET_FIXNUM_VALUE(r,n) NANBOX_SET_VALUE(r, MRB_NANBOX_TT_INTEGER, (uint32_t)(n))
|
149
|
+
#define SET_SYM_VALUE(r,v) NANBOX_SET_MISC_VALUE(r, MRB_TT_SYMBOL, (uint32_t)(v))
|
150
|
+
#define SET_OBJ_VALUE(r,v) do {(r).u = (uint64_t)(uintptr_t)(v);} while (0)
|
151
|
+
#define SET_CPTR_VALUE(mrb,r,v) NANBOX_SET_VALUE(r, MRB_NANBOX_TT_CPTR, (uint64_t)(uintptr_t)(v) & 0x0000ffffffffffffULL)
|
152
|
+
#define SET_UNDEF_VALUE(r) NANBOX_SET_MISC_VALUE(r, MRB_TT_UNDEF, 4)
|
153
|
+
|
154
|
+
#define mrb_immediate_p(o) ((mrb_float_p(o) || mrb_nb_tt(o) != MRB_NANBOX_TT_OBJECT) || (o).u == 0)
|
155
|
+
#define mrb_nil_p(o) ((o).u == 0)
|
156
|
+
#define mrb_false_p(o) (mrb_type(o) == MRB_TT_FALSE || (o).u == 0)
|
157
|
+
#define mrb_fixnum_p(o) (!mrb_float_p(o) && mrb_nb_tt(o)==MRB_NANBOX_TT_INTEGER)
|
129
158
|
|
130
159
|
#endif /* MRUBY_BOXING_NAN_H */
|