mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
partial VC support
This commit is contained in:
+2
-2
@@ -315,7 +315,7 @@ mrb_define_method_id(mrb_state *mrb, struct RClass *c, mrb_sym mid, mrb_func_t f
|
||||
void
|
||||
mrb_define_method(mrb_state *mrb, struct RClass *c, const char *name, mrb_func_t func, int aspec)
|
||||
{
|
||||
return mrb_define_method_id(mrb, c, mrb_intern(mrb, name), func, aspec);
|
||||
mrb_define_method_id(mrb, c, mrb_intern(mrb, name), func, aspec);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -576,7 +576,7 @@ mrb_singleton_class(mrb_state *mrb, mrb_value v)
|
||||
void
|
||||
mrb_define_class_method(mrb_state *mrb, struct RClass *c, const char *name, mrb_func_t func, int aspec)
|
||||
{
|
||||
return mrb_define_method_id(mrb, c->c, mrb_intern(mrb, name), func, aspec);
|
||||
mrb_define_method_id(mrb, c->c, mrb_intern(mrb, name), func, aspec);
|
||||
}
|
||||
|
||||
struct RProc*
|
||||
|
||||
@@ -37,6 +37,7 @@ mrb_hash_ht_hash_equal(mrb_state *mrb, mrb_value a, mrb_value b)
|
||||
{
|
||||
return mrb_equal(mrb, a, b);
|
||||
}
|
||||
|
||||
KHASH_INIT(ht, mrb_value, mrb_value, 1, mrb_hash_ht_hash_func, mrb_hash_ht_hash_equal);
|
||||
|
||||
mrb_value mrb_exec_recursive_paired(mrb_state *mrb, mrb_value (*func) (mrb_state *, mrb_value, mrb_value, int),
|
||||
|
||||
+4
-3
@@ -729,9 +729,10 @@ mrb_value
|
||||
mrb_obj_ivar_get(mrb_state *mrb, mrb_value self)
|
||||
{
|
||||
mrb_value arg;
|
||||
mrb_sym id;
|
||||
|
||||
mrb_get_args(mrb, "o", &arg);
|
||||
mrb_sym id = mrb_to_id(mrb, arg);
|
||||
id = mrb_to_id(mrb, arg);
|
||||
|
||||
//if (!mrb_is_instance_id(id)) {
|
||||
// mrb_name_error(mrb, id, "`%s' is not allowed as an instance variable name", mrb_sym2name(mrb, id));
|
||||
@@ -797,7 +798,7 @@ mrb_obj_instance_variables(mrb_state *mrb, mrb_value self)
|
||||
{
|
||||
mrb_value ary;
|
||||
kh_iv_t *h = RCLASS_IV_TBL(self);
|
||||
int i;
|
||||
khint_t i;
|
||||
const char* p;
|
||||
|
||||
ary = mrb_ary_new(mrb);
|
||||
@@ -924,7 +925,7 @@ mrb_f_loop(mrb_state *mrb, mrb_value self)
|
||||
static void
|
||||
method_entry_loop(mrb_state *mrb, struct RClass* klass, mrb_value ary)
|
||||
{
|
||||
int i;
|
||||
khint_t i;
|
||||
|
||||
khash_t(mt) *h = klass->mt;
|
||||
if (!h) return;
|
||||
|
||||
+2
-2
@@ -1084,7 +1084,7 @@ fix_to_f(mrb_state *mrb, mrb_value num)
|
||||
*/
|
||||
/* ------------------------------------------------------------------------*/
|
||||
static mrb_int
|
||||
flt2big(mrb_state *mrb, float d)
|
||||
flt2big(mrb_state *mrb, mrb_float d)
|
||||
{
|
||||
mrb_int z;
|
||||
|
||||
@@ -1099,7 +1099,7 @@ flt2big(mrb_state *mrb, float d)
|
||||
}
|
||||
|
||||
mrb_value
|
||||
mrb_flt2big(mrb_state *mrb, float d)
|
||||
mrb_flt2big(mrb_state *mrb, mrb_float d)
|
||||
{
|
||||
return mrb_fixnum_value(flt2big(mrb, d));
|
||||
}
|
||||
|
||||
@@ -85,9 +85,9 @@ mrb_reg_s_new_instance(mrb_state *mrb, /*int argc, mrb_value *argv, */mrb_value
|
||||
//mrb_obj_call_init(obj, argc, argv);...mrb_funcall2(obj, idInitialize, argc, argv);
|
||||
mrb_value argv[16];
|
||||
int argc;
|
||||
struct RRegexp *re;
|
||||
|
||||
mrb_get_args(mrb, "*", &argv, &argc);
|
||||
struct RRegexp *re;
|
||||
re = mrb_obj_alloc(mrb, MRB_TT_REGEX, mrb->regex_class);
|
||||
re->ptr = 0;
|
||||
re->src = 0;
|
||||
@@ -1861,12 +1861,16 @@ mrb_match_begin(mrb_state *mrb, mrb_value match/*, mrb_value n*/)
|
||||
{
|
||||
mrb_value argv[16];
|
||||
int argc;
|
||||
mrb_get_args(mrb, "*", &argv, &argc);
|
||||
mrb_value n = argv[0];
|
||||
int i = match_backref_number(mrb, match, n);
|
||||
struct re_registers *regs = RMATCH_REGS(match);
|
||||
int i;
|
||||
struct re_registers *regs;
|
||||
|
||||
match_check(mrb, match);
|
||||
mrb_get_args(mrb, "*", &argv, &argc);
|
||||
n = argv[0];
|
||||
i = match_backref_number(mrb, match, n);
|
||||
regs = RMATCH_REGS(match);
|
||||
|
||||
if (i < 0 || regs->num_regs <= i)
|
||||
mrb_raise(mrb, E_INDEX_ERROR, "index %d out of matches", i);
|
||||
|
||||
@@ -1944,12 +1948,16 @@ mrb_match_end(mrb_state *mrb, mrb_value match/*, mrb_value n*/)
|
||||
{
|
||||
mrb_value argv[16];
|
||||
int argc;
|
||||
mrb_get_args(mrb, "*", &argv, &argc);
|
||||
mrb_value n = argv[0];
|
||||
int i = match_backref_number(mrb, match, n);
|
||||
struct re_registers *regs = RMATCH_REGS(match);
|
||||
mrb_value n;
|
||||
int i;
|
||||
struct re_registers *regs;
|
||||
|
||||
match_check(mrb, match);
|
||||
mrb_get_args(mrb, "*", &argv, &argc);
|
||||
n = argv[0];
|
||||
i = match_backref_number(mrb, match, n);
|
||||
regs = RMATCH_REGS(match);
|
||||
|
||||
if (i < 0 || regs->num_regs <= i)
|
||||
mrb_raise(mrb, E_INDEX_ERROR, "index %d out of matches", i);
|
||||
|
||||
@@ -2050,11 +2058,12 @@ mrb_match_offset(mrb_state *mrb, mrb_value match/*, mrb_value n*/)
|
||||
{
|
||||
mrb_value n;
|
||||
struct re_registers *regs = RMATCH_REGS(match);
|
||||
|
||||
mrb_get_args(mrb, "o", &n);
|
||||
int i = match_backref_number(mrb, match, n);
|
||||
int i;
|
||||
|
||||
match_check(mrb, match);
|
||||
mrb_get_args(mrb, "o", &n);
|
||||
i = match_backref_number(mrb, match, n);
|
||||
|
||||
if (i < 0 || regs->num_regs <= i)
|
||||
mrb_raise(mrb, E_INDEX_ERROR, "index %d out of matches", i);
|
||||
|
||||
|
||||
+2
-1
@@ -600,6 +600,7 @@ retry:
|
||||
{
|
||||
const char *start = p;
|
||||
char term = (*p == '<') ? '>' : '}';
|
||||
mrb_value symname;
|
||||
|
||||
for (; p < end && *p != term; )
|
||||
p++;
|
||||
@@ -607,7 +608,7 @@ retry:
|
||||
mrb_raise(mrb, E_ARGUMENT_ERROR, "name%.*s after <%s>",
|
||||
(int)(p - start + 1), start, mrb_sym2name(mrb, id));
|
||||
}
|
||||
mrb_value symname = mrb_str_new(mrb, start + 1, p - start - 1);
|
||||
symname = mrb_str_new(mrb, start + 1, p - start - 1);
|
||||
id = mrb_intern(mrb, RSTRING_PTR(symname));
|
||||
nextvalue = GETNAMEARG(mrb_symbol_value(id), start, (int)(p - start + 1));
|
||||
if (UNDEF_P(nextvalue)) {
|
||||
|
||||
+2
-1
@@ -3843,6 +3843,7 @@ mrb_cstr_to_inum(mrb_state *mrb, const char *str, int base, int badcheck)
|
||||
// long i;
|
||||
// mrb_value z;
|
||||
// BDIGIT *zds;
|
||||
unsigned long val;
|
||||
|
||||
#undef ISDIGIT
|
||||
#define ISDIGIT(c) ('0' <= (c) && (c) <= '9')
|
||||
@@ -3958,7 +3959,7 @@ mrb_cstr_to_inum(mrb_state *mrb, const char *str, int base, int badcheck)
|
||||
}
|
||||
len *= strlen(str)*sizeof(char);
|
||||
|
||||
unsigned long val = strtoul((char*)str, &end, base);
|
||||
val = strtoul((char*)str, &end, base);
|
||||
|
||||
if (badcheck) {
|
||||
if (end == str) goto bad; /* no number */
|
||||
|
||||
+1
-1
@@ -350,7 +350,7 @@ mrb_value
|
||||
mrb_f_global_variables(mrb_state *mrb, mrb_value self)
|
||||
{
|
||||
char buf[3];
|
||||
int i;
|
||||
khint_t i;
|
||||
struct kh_iv *h = mrb->globals;
|
||||
mrb_value ary = mrb_ary_new(mrb);
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ stack_init(mrb_state *mrb)
|
||||
static void
|
||||
stack_extend(mrb_state *mrb, int room, int keep)
|
||||
{
|
||||
size_t size, off;
|
||||
int size, off;
|
||||
|
||||
if (mrb->stack + room > mrb->stend) {
|
||||
size = mrb->stend - mrb->stbase;
|
||||
@@ -1370,7 +1370,7 @@ mrb_run(mrb_state *mrb, struct RProc *proc, mrb_value self)
|
||||
}
|
||||
else {
|
||||
struct RArray *ary = mrb_ary_ptr(v);
|
||||
size_t len = ary->len;
|
||||
int len = ary->len;
|
||||
int i;
|
||||
|
||||
if (len > pre + post) {
|
||||
|
||||
Reference in New Issue
Block a user