diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/class.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/class.c b/src/class.c index 11a21f7a7..2c1145ed3 100644 --- a/src/class.c +++ b/src/class.c @@ -14,6 +14,7 @@ #include "mruby/string.h" #include "mruby/variable.h" #include "mruby/error.h" +#include "mruby/data.h" KHASH_DEFINE(mt, mrb_sym, struct RProc*, 1, kh_int_hash_func, kh_int_hash_equal) @@ -406,6 +407,7 @@ to_hash(mrb_state *mrb, mrb_value val) i: Integer [mrb_int] b: Boolean [mrb_bool] n: Symbol [mrb_sym] + d: Data [void*,mrb_data_type const] 2nd argument will be used to check data type so it won't be modified &: Block [mrb_value] *: rest argument [mrb_value*,int] Receive the rest of the arguments as an array. |: optional Next argument of '|' and later are optional. @@ -658,6 +660,19 @@ mrb_get_args(mrb_state *mrb, const char *format, ...) } } break; + case 'd': + { + void** datap; + struct mrb_data_type const* type; + + datap = va_arg(ap, void**); + type = va_arg(ap, struct mrb_data_type const*); + if (i < argc) { + *datap = mrb_data_get_ptr(mrb, *sp++, type); + ++i; + } + } + break; case '&': { |
