ruby2d 0.11.3 → 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/template.html +2 -1
- 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/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/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/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/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/libopus.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 +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/libwebp.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libz.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 +33 -20
- 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 +5 -3
- 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 +51 -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/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-ucrt-x86_64/lib/libpng16.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libpng16.a +0 -0
- data/lib/ruby2d/entity.rb +0 -17
data/assets/include/mruby.h
CHANGED
@@ -44,6 +44,9 @@
|
|
44
44
|
#include <limits.h>
|
45
45
|
|
46
46
|
#ifdef __cplusplus
|
47
|
+
#ifndef UINTPTR_MAX
|
48
|
+
#error Must be placed `#include <mruby.h>` before `#include <stdint.h>`
|
49
|
+
#endif
|
47
50
|
#ifndef SIZE_MAX
|
48
51
|
#ifdef __SIZE_MAX__
|
49
52
|
#define SIZE_MAX __SIZE_MAX__
|
@@ -66,14 +69,18 @@
|
|
66
69
|
#define mrb_assert_int_fit(t1,n,t2,max) ((void)0)
|
67
70
|
#endif
|
68
71
|
|
69
|
-
#if (defined __cplusplus && __cplusplus >=
|
72
|
+
#if (defined __cplusplus && __cplusplus >= 201703L)
|
73
|
+
# define mrb_static_assert(...) static_assert(__VA_ARGS__)
|
74
|
+
# define mrb_static_assert1(exp) static_assert(exp)
|
75
|
+
# define mrb_static_assert2(exp, str) static_assert(exp, str)
|
76
|
+
#elif (defined __cplusplus && __cplusplus >= 201103L) || \
|
70
77
|
(defined _MSC_VER) || \
|
71
78
|
(defined __GXX_EXPERIMENTAL_CXX0X__) /* for old G++/Clang++ */
|
72
|
-
# define
|
79
|
+
# define mrb_static_assert2(exp, str) static_assert(exp, str)
|
73
80
|
#elif defined __STDC_VERSION__ && \
|
74
81
|
((__STDC_VERSION__ >= 201112L) || \
|
75
82
|
(defined __GNUC__ && __GNUC__ * 100 + __GNUC_MINOR__ >= 406))
|
76
|
-
# define
|
83
|
+
# define mrb_static_assert2(exp, str) _Static_assert(exp, str)
|
77
84
|
#else
|
78
85
|
# /* alternative implementation of static_assert() */
|
79
86
|
# define _mrb_static_assert_cat0(a, b) a##b
|
@@ -83,10 +90,26 @@
|
|
83
90
|
# else
|
84
91
|
# define _mrb_static_assert_id(prefix) _mrb_static_assert_cat(prefix, __LINE__)
|
85
92
|
# endif
|
86
|
-
# define
|
93
|
+
# define mrb_static_assert2(exp, str) \
|
87
94
|
struct _mrb_static_assert_id(_mrb_static_assert_) { char x[(exp) ? 1 : -1]; }
|
88
95
|
#endif
|
89
|
-
|
96
|
+
|
97
|
+
#ifndef mrb_static_assert
|
98
|
+
# define mrb_static_assert1(exp) mrb_static_assert2(exp, #exp)
|
99
|
+
# define mrb_static_assert_expand(...) __VA_ARGS__ /* for MSVC behaviour - https://stackoverflow.com/q/5530505 */
|
100
|
+
# define mrb_static_assert_selector(a, b, name, ...) name
|
101
|
+
/**
|
102
|
+
* The `mrb_static_assert()` macro function takes one or two arguments.
|
103
|
+
*
|
104
|
+
* !!!c
|
105
|
+
* mrb_static_assert(expect_condition);
|
106
|
+
* mrb_static_assert(expect_condition, error_message);
|
107
|
+
*/
|
108
|
+
# define mrb_static_assert(...) \
|
109
|
+
mrb_static_assert_expand(mrb_static_assert_selector(__VA_ARGS__, mrb_static_assert2, mrb_static_assert1, _)(__VA_ARGS__))
|
110
|
+
#endif
|
111
|
+
|
112
|
+
#define mrb_static_assert_powerof2(num) mrb_static_assert((num) > 0 && (num) == ((num) & -(num)), "need power of 2 for " #num)
|
90
113
|
|
91
114
|
#include "mrbconf.h"
|
92
115
|
|
@@ -96,6 +119,7 @@
|
|
96
119
|
#include <mruby/version.h>
|
97
120
|
|
98
121
|
#ifndef MRB_NO_FLOAT
|
122
|
+
#include <math.h>
|
99
123
|
#include <float.h>
|
100
124
|
#ifndef FLT_EPSILON
|
101
125
|
#define FLT_EPSILON (1.19209290e-07f)
|
@@ -149,9 +173,10 @@ typedef void* (*mrb_allocf) (struct mrb_state *mrb, void*, size_t, void *ud);
|
|
149
173
|
#endif
|
150
174
|
|
151
175
|
typedef struct {
|
176
|
+
uint8_t n:4; /* (15=*) c=n|nk<<4 */
|
177
|
+
uint8_t nk:4; /* (15=*) */
|
178
|
+
uint8_t cci; /* called from C function */
|
152
179
|
mrb_sym mid;
|
153
|
-
int16_t argc;
|
154
|
-
int16_t acc;
|
155
180
|
const struct RProc *proc;
|
156
181
|
mrb_value *stack;
|
157
182
|
const mrb_code *pc; /* current address on iseq of this proc */
|
@@ -185,6 +210,7 @@ struct mrb_context {
|
|
185
210
|
|
186
211
|
#ifdef MRB_METHOD_CACHE_SIZE
|
187
212
|
# undef MRB_NO_METHOD_CACHE
|
213
|
+
mrb_static_assert_powerof2(MRB_METHOD_CACHE_SIZE);
|
188
214
|
#else
|
189
215
|
/* default method cache size: 256 */
|
190
216
|
/* cache size needs to be power of 2 */
|
@@ -265,7 +291,9 @@ typedef struct mrb_state {
|
|
265
291
|
#endif
|
266
292
|
|
267
293
|
mrb_sym symidx;
|
268
|
-
|
294
|
+
const char **symtbl;
|
295
|
+
uint8_t *symlink;
|
296
|
+
uint8_t *symflags;
|
269
297
|
mrb_sym symhash[256];
|
270
298
|
size_t symcapa;
|
271
299
|
#ifndef MRB_USE_ALL_SYMBOLS
|
@@ -886,19 +914,20 @@ MRB_API struct RClass* mrb_define_module_under_id(mrb_state *mrb, struct RClass
|
|
886
914
|
* | char | Ruby type | C types | Notes |
|
887
915
|
* |:----:|----------------|-------------------|----------------------------------------------------|
|
888
916
|
* | `o` | {Object} | {mrb_value} | Could be used to retrieve any type of argument |
|
889
|
-
* | `C` | {Class}/{Module} | {mrb_value} |
|
917
|
+
* | `C` | {Class}/{Module} | {mrb_value} | when `!` follows, the value may be `nil` |
|
890
918
|
* | `S` | {String} | {mrb_value} | when `!` follows, the value may be `nil` |
|
891
919
|
* | `A` | {Array} | {mrb_value} | when `!` follows, the value may be `nil` |
|
892
920
|
* | `H` | {Hash} | {mrb_value} | when `!` follows, the value may be `nil` |
|
893
921
|
* | `s` | {String} | const char *, {mrb_int} | Receive two arguments; `s!` gives (`NULL`,`0`) for `nil` |
|
894
922
|
* | `z` | {String} | const char * | `NULL` terminated string; `z!` gives `NULL` for `nil` |
|
895
923
|
* | `a` | {Array} | const {mrb_value} *, {mrb_int} | Receive two arguments; `a!` gives (`NULL`,`0`) for `nil` |
|
924
|
+
* | `c` | {Class}/{Module} | strcut RClass * | `c!` gives `NULL` for `nil` |
|
896
925
|
* | `f` | {Integer}/{Float} | {mrb_float} | |
|
897
926
|
* | `i` | {Integer}/{Float} | {mrb_int} | |
|
898
927
|
* | `b` | boolean | {mrb_bool} | |
|
899
928
|
* | `n` | {String}/{Symbol} | {mrb_sym} | |
|
900
929
|
* | `d` | data | void *, {mrb_data_type} const | 2nd argument will be used to check data type so it won't be modified; when `!` follows, the value may be `nil` |
|
901
|
-
* | `I` | inline struct | void
|
930
|
+
* | `I` | inline struct | void *, struct RClass | `I!` gives `NULL` for `nil` |
|
902
931
|
* | `&` | block | {mrb_value} | &! raises exception if no block given. |
|
903
932
|
* | `*` | rest arguments | const {mrb_value} *, {mrb_int} | Receive the rest of arguments as an array; `*!` avoid copy of the stack. |
|
904
933
|
* | <code>\|</code> | optional | | After this spec following specs would be optional. |
|
@@ -906,6 +935,13 @@ MRB_API struct RClass* mrb_define_module_under_id(mrb_state *mrb, struct RClass
|
|
906
935
|
* | `:` | keyword args | {mrb_kwargs} const | Get keyword arguments. @see mrb_kwargs |
|
907
936
|
*
|
908
937
|
* @see mrb_get_args
|
938
|
+
*
|
939
|
+
* Immediately after format specifiers it can add format modifiers:
|
940
|
+
*
|
941
|
+
* | char | Notes |
|
942
|
+
* |:----:|-----------------------------------------------------------------------------------------|
|
943
|
+
* | `!` | Switch to the alternate mode; The behaviour changes depending on the format specifier |
|
944
|
+
* | `+` | Request a not frozen object; However, except nil value |
|
909
945
|
*/
|
910
946
|
typedef const char *mrb_args_format;
|
911
947
|
|
@@ -1004,6 +1040,11 @@ MRB_API const mrb_value *mrb_get_argv(mrb_state *mrb);
|
|
1004
1040
|
*/
|
1005
1041
|
MRB_API mrb_value mrb_get_arg1(mrb_state *mrb);
|
1006
1042
|
|
1043
|
+
/**
|
1044
|
+
* Check if a block argument is given from mrb_state.
|
1045
|
+
*/
|
1046
|
+
MRB_API mrb_bool mrb_block_given_p(mrb_state *mrb);
|
1047
|
+
|
1007
1048
|
/* `strlen` for character string literals (use with caution or `strlen` instead)
|
1008
1049
|
Adjacent string literals are concatenated in C/C++ in translation phase 6.
|
1009
1050
|
If `lit` is not one, the compiler will report a syntax error:
|
@@ -1126,6 +1167,17 @@ MRB_API void *mrb_malloc_simple(mrb_state*, size_t); /* return NULL if no memor
|
|
1126
1167
|
MRB_API struct RBasic *mrb_obj_alloc(mrb_state*, enum mrb_vtype, struct RClass*);
|
1127
1168
|
MRB_API void mrb_free(mrb_state*, void*);
|
1128
1169
|
|
1170
|
+
/**
|
1171
|
+
* Allocates a Ruby object that matches the constant literal defined in
|
1172
|
+
* `enum mrb_vtype` and returns a pointer to the corresponding C type.
|
1173
|
+
*
|
1174
|
+
* @param mrb The current mruby state
|
1175
|
+
* @param tt The constant literal of `enum mrb_vtype`
|
1176
|
+
* @param klass A Class object
|
1177
|
+
* @return Reference to the newly created object
|
1178
|
+
*/
|
1179
|
+
#define MRB_OBJ_ALLOC(mrb, tt, klass) ((MRB_VTYPE_TYPEOF(tt)*)mrb_obj_alloc(mrb, tt, klass))
|
1180
|
+
|
1129
1181
|
MRB_API mrb_value mrb_str_new(mrb_state *mrb, const char *p, size_t len);
|
1130
1182
|
|
1131
1183
|
/**
|
@@ -1219,10 +1271,11 @@ MRB_API mrb_sym mrb_obj_to_sym(mrb_state *mrb, mrb_value name);
|
|
1219
1271
|
MRB_API mrb_bool mrb_obj_eq(mrb_state *mrb, mrb_value a, mrb_value b);
|
1220
1272
|
MRB_API mrb_bool mrb_obj_equal(mrb_state *mrb, mrb_value a, mrb_value b);
|
1221
1273
|
MRB_API mrb_bool mrb_equal(mrb_state *mrb, mrb_value obj1, mrb_value obj2);
|
1222
|
-
MRB_API mrb_value mrb_convert_to_integer(mrb_state *mrb, mrb_value val, mrb_int base);
|
1223
|
-
MRB_API mrb_value mrb_Integer(mrb_state *mrb, mrb_value val);
|
1224
1274
|
#ifndef MRB_NO_FLOAT
|
1225
|
-
MRB_API mrb_value
|
1275
|
+
MRB_API mrb_value mrb_ensure_float_type(mrb_state *mrb, mrb_value val);
|
1276
|
+
#define mrb_as_float(mrb, x) mrb_float(mrb_ensure_float_type(mrb, x))
|
1277
|
+
/* obsolete: use mrb_ensure_float_type() instead */
|
1278
|
+
#define mrb_to_float(mrb, val) mrb_ensure_float_type(mrb, val)
|
1226
1279
|
#endif
|
1227
1280
|
MRB_API mrb_value mrb_inspect(mrb_state *mrb, mrb_value obj);
|
1228
1281
|
MRB_API mrb_bool mrb_eql(mrb_state *mrb, mrb_value obj1, mrb_value obj2);
|
@@ -1339,10 +1392,25 @@ MRB_API void mrb_gc_register(mrb_state *mrb, mrb_value obj);
|
|
1339
1392
|
/* mrb_gc_unregister() removes the object from GC root. */
|
1340
1393
|
MRB_API void mrb_gc_unregister(mrb_state *mrb, mrb_value obj);
|
1341
1394
|
|
1342
|
-
|
1343
|
-
|
1395
|
+
/* type conversion/check functions */
|
1396
|
+
MRB_API mrb_value mrb_ensure_array_type(mrb_state *mrb, mrb_value self);
|
1397
|
+
MRB_API mrb_value mrb_check_array_type(mrb_state *mrb, mrb_value self);
|
1398
|
+
MRB_API mrb_value mrb_ensure_hash_type(mrb_state *mrb, mrb_value hash);
|
1399
|
+
MRB_API mrb_value mrb_check_hash_type(mrb_state *mrb, mrb_value hash);
|
1400
|
+
MRB_API mrb_value mrb_ensure_string_type(mrb_state *mrb, mrb_value str);
|
1401
|
+
MRB_API mrb_value mrb_check_string_type(mrb_state *mrb, mrb_value str);
|
1402
|
+
/* obsolete: use mrb_ensure_string_type() instead */
|
1403
|
+
#define mrb_string_type(mrb, str) mrb_ensure_string_type(mrb,str)
|
1404
|
+
#define mrb_to_str(mrb, str) mrb_ensure_string_type(mrb,str)
|
1405
|
+
/* obsolete: use mrb_obj_as_string() instead */
|
1406
|
+
#define mrb_str_to_str(mrb, str) mrb_obj_as_string(mrb, str)
|
1407
|
+
MRB_API mrb_value mrb_ensure_int_type(mrb_state *mrb, mrb_value val);
|
1408
|
+
#define mrb_as_int(mrb, val) mrb_integer(mrb_ensure_int_type(mrb, val))
|
1409
|
+
/* obsolete: use mrb_ensure_int_type() instead */
|
1410
|
+
#define mrb_to_integer(mrb, val) mrb_ensure_int_type(mrb, val)
|
1411
|
+
#define mrb_to_int(mrb, val) mrb_ensure_int_type(mrb, val)
|
1412
|
+
|
1344
1413
|
/* string type checking (contrary to the name, it doesn't convert) */
|
1345
|
-
MRB_API mrb_value mrb_to_str(mrb_state *mrb, mrb_value val);
|
1346
1414
|
MRB_API void mrb_check_type(mrb_state *mrb, mrb_value x, enum mrb_vtype t);
|
1347
1415
|
|
1348
1416
|
MRB_INLINE void mrb_check_frozen(mrb_state *mrb, void *o)
|
@@ -1361,6 +1429,8 @@ MRB_API mrb_bool mrb_respond_to(mrb_state *mrb, mrb_value obj, mrb_sym mid);
|
|
1361
1429
|
MRB_API mrb_bool mrb_obj_is_instance_of(mrb_state *mrb, mrb_value obj, struct RClass* c);
|
1362
1430
|
MRB_API mrb_bool mrb_func_basic_p(mrb_state *mrb, mrb_value obj, mrb_sym mid, mrb_func_t func);
|
1363
1431
|
|
1432
|
+
/* obsolete function(s); will be removed */
|
1433
|
+
#define mrb_int(mrb, val) mrb_as_int(mrb, val)
|
1364
1434
|
|
1365
1435
|
/**
|
1366
1436
|
* Resume a Fiber
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/assets/wasm/template.html
CHANGED
@@ -39,7 +39,8 @@
|
|
39
39
|
<p>This is a sample HTML template, but you can create your own!</p>
|
40
40
|
<hr>
|
41
41
|
<canvas id="canvas" oncontextmenu=".preventDefault()"></canvas>
|
42
|
-
<h2>
|
42
|
+
<h2 style="margin-bottom: 0;">Output</h2>
|
43
|
+
<p style="margin: 4px 0 8px 0">Open the JavaScript console in developer tools for more detail.</p>
|
43
44
|
<textarea id="output"></textarea>
|
44
45
|
</body>
|
45
46
|
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|