Merge pull request #79 from rystyle/whitespace

rm whitespace mix
This commit is contained in:
Yukihiro "Matz" Matsumoto
2012-04-30 15:41:37 -07:00
78 changed files with 19430 additions and 19430 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
/*
** mrbconf.h - mruby core configuration
**
**
** See Copyright Notice in mruby.h
*/
@@ -42,4 +42,4 @@ typedef intptr_t mrb_sym;
# define TRUE 1
#endif
#endif /* MRUBYCONF_H */
#endif /* MRUBYCONF_H */
+14 -14
View File
@@ -1,8 +1,8 @@
/*
** mruby - An embeddable Ruby implementaion
**
**
** Copyright (c) mruby developers 2010-2012
**
**
** Permission is hereby granted, free of charge, to any person obtaining
** a copy of this software and associated documentation files (the
** "Software"), to deal in the Software without restriction, including
@@ -33,7 +33,7 @@
enum mrb_vtype {
MRB_TT_FALSE = 0, /* 0 */
MRB_TT_FREE, /* 1 */
MRB_TT_FREE, /* 1 */
MRB_TT_TRUE, /* 2 */
MRB_TT_FIXNUM, /* 3 */
MRB_TT_SYMBOL, /* 4 */
@@ -276,8 +276,8 @@ typedef struct mrb_state {
mrb_int gc_step_ratio;
mrb_sym symidx;
struct kh_n2s *name2sym; /* symbol table */
struct kh_s2n *sym2name; /* reverse symbol table */
struct kh_n2s *name2sym; /* symbol table */
struct kh_s2n *sym2name; /* reverse symbol table */
struct RNode *local_svar;/* regexp */
struct RClass *eException_class;
@@ -310,22 +310,22 @@ struct RClass * mrb_define_class_under(mrb_state *mrb, struct RClass *outer, con
struct RClass * mrb_define_module_under(mrb_state *mrb, struct RClass *outer, const char *name);
/* required arguments */
#define ARGS_REQ(n) (((n)&0x1f) << 19)
#define ARGS_REQ(n) (((n)&0x1f) << 19)
/* optional arguments */
#define ARGS_OPT(n) (((n)&0x1f) << 14)
#define ARGS_OPT(n) (((n)&0x1f) << 14)
/* rest argument */
#define ARGS_REST() (1 << 13)
#define ARGS_REST() (1 << 13)
/* required arguments after rest */
#define ARGS_POST(n) (((n)&0x1f) << 8)
#define ARGS_POST(n) (((n)&0x1f) << 8)
/* keyword arguments (n of keys, kdict) */
#define ARGS_KEY(n1,n2) ((((n1)&0x1f) << 3) | ((n2)?(1<<2):0))
#define ARGS_KEY(n1,n2) ((((n1)&0x1f) << 3) | ((n2)?(1<<2):0))
/* block argument */
#define ARGS_BLOCK() (1 << 1)
#define ARGS_BLOCK() (1 << 1)
/* accept any number of arguments */
#define ARGS_ANY() ARGS_REST()
#define ARGS_ANY() ARGS_REST()
/* accept no arguments */
#define ARGS_NONE() 0
#define ARGS_NONE() 0
int mrb_get_args(mrb_state *mrb, const char *format, ...);
@@ -600,4 +600,4 @@ int mrb_sourceline(void);
void ruby_default_signal(int sig);
mrb_value mrb_attr_get(mrb_state *mrb, mrb_value obj, mrb_sym id);
#endif /* MRUBY_H */
#endif /* MRUBY_H */
+2 -2
View File
@@ -1,6 +1,6 @@
/*
** array.h - Array class
**
**
** See Copyright Notice in mruby.h
*/
@@ -45,4 +45,4 @@ mrb_value mrb_ary_tmp_new(mrb_state *mrb, long capa);
mrb_value mrb_ary_sort(mrb_state *mrb, mrb_value ary);
mrb_value mrb_ary_shift(mrb_state *mrb, mrb_value self);
#endif /* MRUBY_ARRAY_H */
#endif /* MRUBY_ARRAY_H */
+1 -1
View File
@@ -1,6 +1,6 @@
/*
** cdump.h - mruby binary dumper (C source format)
**
**
** See Copyright Notice in mruby.h
*/
+2 -2
View File
@@ -1,6 +1,6 @@
/*
** class.h - Class class
**
**
** See Copyright Notice in mruby.h
*/
@@ -74,4 +74,4 @@ void mrb_define_method_id(mrb_state *mrb, struct RClass *c, mrb_sym mid, mrb_fun
void mrb_obj_call_init(mrb_state *mrb, mrb_value obj, int argc, mrb_value *argv);
#endif /* MRUBY_CLASS_H */
#endif /* MRUBY_CLASS_H */
+2 -2
View File
@@ -1,6 +1,6 @@
/*
** data.h - Data class
**
**
** See Copyright Notice in mruby.h
*/
@@ -13,7 +13,7 @@ extern "C" {
struct mrb_data_type {
const char *struct_name;
const char *struct_name;
void (*dfree)(mrb_state *mrb, void*);
};
+1 -1
View File
@@ -1,6 +1,6 @@
/*
** dump.h - mruby binary dumper (Rite binary format)
**
**
** See Copyright Notice in mruby.h
*/
+4 -4
View File
@@ -1,6 +1,6 @@
/*
** hash.h - Hash class
**
**
** See Copyright Notice in mruby.h
*/
@@ -15,9 +15,9 @@ struct RHash {
#define N 624
#define M 397
#define MATRIX_A 0x9908b0dfU /* constant vector a */
#define UMASK 0x80000000U /* most significant w-r bits */
#define LMASK 0x7fffffffU /* least significant r bits */
#define MATRIX_A 0x9908b0dfU /* constant vector a */
#define UMASK 0x80000000U /* most significant w-r bits */
#define LMASK 0x7fffffffU /* least significant r bits */
#define MIXBITS(u,v) ( ((u) & UMASK) | ((v) & LMASK) )
#define TWIST(u,v) ((MIXBITS(u,v) >> 1) ^ ((v)&1U ? MATRIX_A : 0U))
enum {MT_MAX_STATE = N};
+2 -2
View File
@@ -1,6 +1,6 @@
/*
** irep.h - mrb_irep structure
**
**
** See Copyright Notice in mruby.h
*/
@@ -26,4 +26,4 @@ typedef struct mrb_irep {
void mrb_add_irep(mrb_state *mrb, int n);
#endif /* MRUBY_IREP_H */
#endif /* MRUBY_IREP_H */
+1 -1
View File
@@ -1,6 +1,6 @@
/*
** ritehash.c - Rite Hash for mruby
**
**
** See Copyright Notice in mruby.h
*/
+2 -2
View File
@@ -1,6 +1,6 @@
/*
** numeric.h - Numeric, Integer, Float, Fixnum class
**
**
** See Copyright Notice in mruby.h
*/
@@ -20,4 +20,4 @@ mrb_value mrb_flt2big(mrb_state *mrb, float d);
void mrb_num_zerodiv(mrb_state *mrb);
mrb_value mrb_fix2str(mrb_state *mrb, mrb_value x, int base);
#endif /* MRUBY_NUMERIC_H */
#endif /* MRUBY_NUMERIC_H */
+3 -3
View File
@@ -1,13 +1,13 @@
/*
** object.h - Object, NilClass, TrueClass, FalseClass class
**
**
** See Copyright Notice in mruby.h
*/
#ifndef MRUBY_OBJECT_H
#define MRUBY_OBJECT_H
#define MRUBY_OBJECT_HEADER \
#define MRUBY_OBJECT_HEADER \
enum mrb_vtype tt:8;\
int color:3;\
unsigned int flags:21;\
@@ -49,4 +49,4 @@ struct RObject {
#define ROBJECT(v) ((struct RObject*)((v).value.p))
#define ROBJECT_IVPTR(v) (((struct RObject*)((v).value.p))->iv)
#define ROBJECT_NUMIV(v) (ROBJECT_IVPTR(v) ? ROBJECT_IVPTR(v)->size : 0)
#endif /* MRUBY_OBJECT_H */
#endif /* MRUBY_OBJECT_H */
+9 -9
View File
@@ -1,6 +1,6 @@
/*
** proc.h - Proc class
**
**
** See Copyright Notice in mruby.h
*/
@@ -28,13 +28,13 @@ struct RProc {
};
/* aspec access */
#define ARGS_GETREQ(a) (((a) >> 19) & 0x1f)
#define ARGS_GETOPT(a) (((a) >> 14) & 0x1f)
#define ARGS_GETREST(a) ((a) & (1<<13))
#define ARGS_GETPOST(a) (((a) >> 8) & 0x1f)
#define ARGS_GETKEY(a) (((a) >> 3) & 0x1f))
#define ARGS_GETKDICT(a) ((a) & (1<<2))
#define ARGS_GETBLOCK(a) ((a) & (1<<1))
#define ARGS_GETREQ(a) (((a) >> 19) & 0x1f)
#define ARGS_GETOPT(a) (((a) >> 14) & 0x1f)
#define ARGS_GETREST(a) ((a) & (1<<13))
#define ARGS_GETPOST(a) (((a) >> 8) & 0x1f)
#define ARGS_GETKEY(a) (((a) >> 3) & 0x1f))
#define ARGS_GETKDICT(a) ((a) & (1<<2))
#define ARGS_GETBLOCK(a) ((a) & (1<<1))
#define MRB_PROC_CFUNC 128
#define MRB_PROC_CFUNC_P(p) ((p)->flags & MRB_PROC_CFUNC)
@@ -47,4 +47,4 @@ struct RProc *mrb_proc_new(mrb_state*, mrb_irep*);
struct RProc *mrb_proc_new_cfunc(mrb_state*, mrb_func_t);
struct RProc *mrb_closure_new(mrb_state*, mrb_irep*);
#endif /* MRUBY_STRING_H */
#endif /* MRUBY_STRING_H */
+2 -2
View File
@@ -1,6 +1,6 @@
/*
** range.h - Range class
**
**
** See Copyright Notice in mruby.h
*/
@@ -24,4 +24,4 @@ mrb_int mrb_range_beg_len(mrb_state *mrb, mrb_value range, mrb_int *begp, mrb_in
int mrb_obj_is_instance_of(mrb_state *mrb, mrb_value obj, struct RClass* c);
struct RClass* mrb_class_real(struct RClass* cl);
#endif /* MRUBY_RANGE_H */
#endif /* MRUBY_RANGE_H */
+1 -1
View File
@@ -1,6 +1,6 @@
/*
** string.h - String class
**
**
** See Copyright Notice in mruby.h
*/
+1 -1
View File
@@ -1,6 +1,6 @@
/*
** struct.h - Struct class
**
**
** See Copyright Notice in mruby.h
*/
+2 -2
View File
@@ -1,6 +1,6 @@
/*
** variable.h - mruby variables
**
**
** See Copyright Notice in mruby.h
*/
@@ -44,4 +44,4 @@ mrb_value mrb_f_global_variables(mrb_state *mrb, mrb_value self);
mrb_value mrb_gv_get(mrb_state *mrb, mrb_sym sym);
void mrb_gv_set(mrb_state *mrb, mrb_sym sym, mrb_value val);
#endif /* MRUBY_VARIABLE_H */
#endif /* MRUBY_VARIABLE_H */
+1 -1
View File
@@ -1,6 +1,6 @@
/*
** array.c - Array class
**
**
** See Copyright Notice in mruby.h
*/
+2 -2
View File
@@ -1,6 +1,6 @@
/*
** cdump.c - mruby binary dumper (C source format)
**
**
** See Copyright Notice in mruby.h
*/
@@ -124,7 +124,7 @@ make_cdump_irep(mrb_state *mrb, int irep_no, FILE *f)
SOURCE_CODE (" irep->syms = mrb_malloc(mrb, sizeof(mrb_sym)*%d);", irep->slen);
for (n=0; n<irep->slen; n++)
if (irep->syms[n]) {
SOURCE_CODE (" irep->syms[%d] = mrb_intern(mrb, \"%s\");", n, mrb_sym2name(mrb, irep->syms[n]));
SOURCE_CODE (" irep->syms[%d] = mrb_intern(mrb, \"%s\");", n, mrb_sym2name(mrb, irep->syms[n]));
}
}
else
+64 -64
View File
@@ -1,6 +1,6 @@
/*
** class.c - Class class
**
**
** See Copyright Notice in mruby.h
*/
@@ -49,7 +49,7 @@ mrb_gc_mark_mt(mrb_state *mrb, struct RClass *c)
if (kh_exist(h, k)){
struct RProc *m = kh_value(h, k);
if (m) {
paint_black(m);
paint_black(m);
}
}
}
@@ -94,7 +94,7 @@ class_sym(mrb_state *mrb, struct RClass *c, struct RClass *outer)
if (!kh_exist(h,k)) continue;
v = kh_value(h,k);
if (mrb_type(v) == c->tt && mrb_class_ptr(v) == c) {
return kh_key(h,k);
return kh_key(h,k);
}
}
}
@@ -183,7 +183,7 @@ mrb_define_class_id(mrb_state *mrb, mrb_sym name, struct RClass *super)
struct RClass *c = mrb_class_new(mrb, super);
mrb_obj_iv_set(mrb, (struct RObject*)mrb->object_class,
name, mrb_obj_value(c));
name, mrb_obj_value(c));
mrb_name_class(mrb, c, name);
return c;
@@ -258,7 +258,7 @@ mrb_define_class_under(mrb_state *mrb, struct RClass *outer, const char *name, s
}
if (!super) {
mrb_warn("no super class for `%s::%s', Object assumed",
mrb_obj_classname(mrb, mrb_obj_value(outer)), mrb_sym2name(mrb, id));
mrb_obj_classname(mrb, mrb_obj_value(outer)), mrb_sym2name(mrb, id));
}
c = mrb_class_new(mrb, super);
setup_class(mrb, mrb_obj_value(outer), c, id);
@@ -366,17 +366,17 @@ mrb_get_args(mrb_state *mrb, const char *format, ...)
mrb_float *p;
p = va_arg(ap, mrb_float*);
switch (sp->tt) {
case MRB_TT_FLOAT:
*p = (argc > i) ? mrb_float(*sp) : 0;
break;
case MRB_TT_FIXNUM:
*p = (argc > i) ? (mrb_float)mrb_fixnum(*sp) : 0;
break;
default:
// error
break;
}
switch (sp->tt) {
case MRB_TT_FLOAT:
*p = (argc > i) ? mrb_float(*sp) : 0;
break;
case MRB_TT_FIXNUM:
*p = (argc > i) ? (mrb_float)mrb_fixnum(*sp) : 0;
break;
default:
// error
break;
}
i++; sp++;
}
break;
@@ -386,17 +386,17 @@ mrb_get_args(mrb_state *mrb, const char *format, ...)
size_t *pl;
struct RString *s;
if (argc > i) {
s = mrb_str_ptr(*sp);
ps = va_arg(ap, char**);
*ps = s->buf;
pl = va_arg(ap, size_t*);
*pl = s->len;
}
else {
*ps = "";
*pl = 0;
}
if (argc > i) {
s = mrb_str_ptr(*sp);
ps = va_arg(ap, char**);
*ps = s->buf;
pl = va_arg(ap, size_t*);
*pl = s->len;
}
else {
*ps = "";
*pl = 0;
}
i++; sp++;
}
break;
@@ -421,25 +421,25 @@ mrb_get_args(mrb_state *mrb, const char *format, ...)
case 'b':
{
struct RProc **p;
mrb_value *bp = mrb->stack + 1;
mrb_value *bp = mrb->stack + 1;
p = va_arg(ap, struct RProc**);
if (mrb->ci->argc > 0) {
bp += mrb->ci->argc;
}
if (mrb_nil_p(*bp)) *p = 0;
else *p = mrb_proc_ptr(*bp);
if (mrb->ci->argc > 0) {
bp += mrb->ci->argc;
}
if (mrb_nil_p(*bp)) *p = 0;
else *p = mrb_proc_ptr(*bp);
}
break;
case '&':
{
mrb_value *p, *bp = mrb->stack + 1;
mrb_value *p, *bp = mrb->stack + 1;
p = va_arg(ap, mrb_value*);
if (mrb->ci->argc > 0) {
bp += mrb->ci->argc;
}
*p = *bp;
if (mrb->ci->argc > 0) {
bp += mrb->ci->argc;
}
*p = *bp;
}
break;
case '*':
@@ -447,20 +447,20 @@ mrb_get_args(mrb_state *mrb, const char *format, ...)
mrb_value **var;
var = va_arg(ap, mrb_value**);
argcp = va_arg(ap, int*);
if (argc > i) {
*argcp = argc-i;
if (*argcp > 0) {
if (var) {
*var = sp;
}
i += *argcp;
}
}
else {
*argcp = 0;
*var = NULL;
}
goto last_var;
if (argc > i) {
*argcp = argc-i;
if (*argcp > 0) {
if (var) {
*var = sp;
}
i += *argcp;
}
}
else {
*argcp = 0;
*var = NULL;
}
goto last_var;
}
break;
}
@@ -535,7 +535,7 @@ mrb_singleton_class(mrb_state *mrb, mrb_value v)
case MRB_TT_FLOAT:
return mrb_nil_value(); /* should raise TypeError */
default:
break;
break;
}
obj = (struct RBasic*)mrb_object(v);
obj->c = mrb_singleton_class_ptr(mrb, obj->c);
@@ -561,10 +561,10 @@ mrb_method_search_vm(mrb_state *mrb, struct RClass **cp, mrb_sym mid)
if (h) {
k = kh_get(mt, h, mid);
if (k != kh_end(h)) {
m = kh_value(h, k);
if (!m) break;
*cp = c;
return m;
m = kh_value(h, k);
if (!m) break;
*cp = c;
return m;
}
}
c = c->super;
@@ -748,7 +748,7 @@ mrb_obj_respond_to(struct RClass* c, mrb_sym mid)
if (h) {
k = kh_get(mt, h, mid);
if (k != kh_end(h))
return 1; /* exist method */
return 1; /* exist method */
}
c = c->super;
}
@@ -884,7 +884,7 @@ void
mrb_alias_method(mrb_state *mrb, struct RClass *c, mrb_sym a, mrb_sym b)
{
struct RProc *m = mrb_method_search(mrb, c, b);
mrb_define_method_vm(mrb, c, a, mrb_obj_value(m));
}
@@ -938,7 +938,7 @@ mrb_mod_to_s(mrb_state *mrb, mrb_value klass)
if (!cn) {
char buf[256];
switch (mrb_type(klass)) {
case MRB_TT_CLASS:
snprintf(buf, 256, "#<Class:%p>", c);
@@ -1011,10 +1011,10 @@ mrb_mod_eqq(mrb_state *mrb, mrb_value mod)
void
mrb_init_class(mrb_state *mrb)
{
struct RClass *bob; /* BasicObject */
struct RClass *obj; /* Object */
struct RClass *mod; /* Module */
struct RClass *cls; /* Class */
struct RClass *bob; /* BasicObject */
struct RClass *obj; /* Object */
struct RClass *mod; /* Module */
struct RClass *cls; /* Class */
//struct RClass *krn; /* Kernel */
/* boot class hierarchy */
+418 -418
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -1,6 +1,6 @@
/*
** compar.c - Comparable module
**
**
** See Copyright Notice in mruby.h
*/
@@ -22,7 +22,7 @@ mrb_cmperr(mrb_state *mrb, mrb_value x, mrb_value y)
classname = mrb_obj_classname(mrb, y);
}
mrb_raise(mrb, E_ARGUMENT_ERROR, "comparison of %s with %s failed",
mrb_obj_classname(mrb, x), classname);
mrb_obj_classname(mrb, x), classname);
}
int
+12 -12
View File
@@ -1,6 +1,6 @@
/*
** compile.h - mruby parser
**
**
** See Copyright Notice in mruby.h
*/
@@ -17,17 +17,17 @@ typedef struct mrb_ast_node {
#include <stdio.h>
enum mrb_lex_state_enum {
EXPR_BEG, /* ignore newline, +/- is a sign. */
EXPR_END, /* newline significant, +/- is an operator. */
EXPR_ENDARG, /* ditto, and unbound braces. */
EXPR_ENDFN, /* ditto, and unbound braces. */
EXPR_ARG, /* newline significant, +/- is an operator. */
EXPR_CMDARG, /* newline significant, +/- is an operator. */
EXPR_MID, /* newline significant, +/- is an operator. */
EXPR_FNAME, /* ignore newline, no reserved words. */
EXPR_DOT, /* right after `.' or `::', no reserved words. */
EXPR_CLASS, /* immediate after `class', no here document. */
EXPR_VALUE, /* alike EXPR_BEG but label is disallowed. */
EXPR_BEG, /* ignore newline, +/- is a sign. */
EXPR_END, /* newline significant, +/- is an operator. */
EXPR_ENDARG, /* ditto, and unbound braces. */
EXPR_ENDFN, /* ditto, and unbound braces. */
EXPR_ARG, /* newline significant, +/- is an operator. */
EXPR_CMDARG, /* newline significant, +/- is an operator. */
EXPR_MID, /* newline significant, +/- is an operator. */
EXPR_FNAME, /* ignore newline, no reserved words. */
EXPR_DOT, /* right after `.' or `::', no reserved words. */
EXPR_CLASS, /* immediate after `class', no here document. */
EXPR_VALUE, /* alike EXPR_BEG but label is disallowed. */
EXPR_MAX_STATE
};
+1 -1
View File
@@ -1,6 +1,6 @@
/*
** crc.c - calculate CRC
**
**
** See Copyright Notice in mruby.h
*/
+2 -2
View File
@@ -1,6 +1,6 @@
/*
** dump.c - mruby binary dumper (Rite binary format)
**
**
** See Copyright Notice in mruby.h
*/
@@ -661,7 +661,7 @@ mrb_dump_irep(mrb_state *mrb, int top, FILE* fp)
if (fwrite("00000000"/* end of file */, 8, 1, fp) != 1)
return MRB_DUMP_WRITE_FAULT;
rc = dump_rite_header(mrb, top, fp, rbds); //TODO: Remove top(SIREP)
rc = dump_rite_header(mrb, top, fp, rbds); //TODO: Remove top(SIREP)
return rc;
}
+9 -9
View File
@@ -1,6 +1,6 @@
/*
** encoding.c - Encoding class
**
**
** See Copyright Notice in mruby.h
*/
@@ -1376,14 +1376,14 @@ nl_langinfo_codeset(void)
p = strchr(l, '.');
if (!p++) p = l;
if (strstart(p, "UTF"))
return "UTF-8";
return "UTF-8";
if ((n = 5, strstart(p, "8859-")) || (n = 9, strstart(p, "ISO-8859-"))) {
if (digit(p[n])) {
p += n;
memcpy(buf, "ISO-8859-\0\0", 12);
buf[9] = *p++;
if (digit(*p)) buf[10] = *p++;
return buf;
p += n;
memcpy(buf, "ISO-8859-\0\0", 12);
buf[9] = *p++;
if (digit(*p)) buf[10] = *p++;
return buf;
}
}
if (strstart(p, "KOI8-R")) return "KOI8-R";
@@ -1406,8 +1406,8 @@ nl_langinfo_codeset(void)
if (strstart(l, "ru")) return "KOI8-R";
if (strstart(l, "uk")) return "KOI8-U";
if (strstart(l, "pl") || strstart(l, "hr") ||
strstart(l, "hu") || strstart(l, "cs") ||
strstart(l, "sk") || strstart(l, "sl")) return "ISO-8859-2";
strstart(l, "hu") || strstart(l, "cs") ||
strstart(l, "sk") || strstart(l, "sl")) return "ISO-8859-2";
if (strstart(l, "eo") || strstart(l, "mt")) return "ISO-8859-3";
if (strstart(l, "el")) return "ISO-8859-7";
if (strstart(l, "he")) return "ISO-8859-8";
+7 -7
View File
@@ -1,6 +1,6 @@
/*
** encoding.h - Encoding class
**
**
** See Copyright Notice in mruby.h
*/
@@ -62,16 +62,16 @@ int mrb_toupper(int c);
#define ENCODING_MAXNAMELEN 42
#define ENC_CODERANGE_MASK ((int)(FL_USER8|FL_USER9))
#define ENC_CODERANGE_UNKNOWN 0
#define ENC_CODERANGE_7BIT ((int)FL_USER8)
#define ENC_CODERANGE_VALID ((int)FL_USER9)
#define ENC_CODERANGE_BROKEN ((int)(FL_USER8|FL_USER9))
#define ENC_CODERANGE_MASK ((int)(FL_USER8|FL_USER9))
#define ENC_CODERANGE_UNKNOWN 0
#define ENC_CODERANGE_7BIT ((int)FL_USER8)
#define ENC_CODERANGE_VALID ((int)FL_USER9)
#define ENC_CODERANGE_BROKEN ((int)(FL_USER8|FL_USER9))
#define ENC_CODERANGE(obj) ((int)(RSTRING(obj)->flags & ENC_CODERANGE_MASK))
#define ENC_CODERANGE_ASCIIONLY(obj) (ENC_CODERANGE(obj) == ENC_CODERANGE_7BIT)
#ifdef INCLUDE_ENCODING
#define ENC_CODERANGE_SET(obj,cr) (RSTRING(obj)->flags = \
(RSTRING(obj)->flags & ~ENC_CODERANGE_MASK) | (cr))
(RSTRING(obj)->flags & ~ENC_CODERANGE_MASK) | (cr))
#else
#define ENC_CODERANGE_SET(obj,cr)
#endif //INCLUDE_ENCODING
+1 -1
View File
@@ -1,6 +1,6 @@
/*
** enum.c - Enumerable module
**
**
** See Copyright Notice in mruby.h
*/
+2 -2
View File
@@ -1,6 +1,6 @@
/*
** error.c - Exception class
**
**
** See Copyright Notice in mruby.h
*/
@@ -332,7 +332,7 @@ error_pos(void)
static void
set_backtrace(mrb_state *mrb, mrb_value info, mrb_value bt)
{
mrb_funcall(mrb, info, "set_backtrace", 1, bt);
mrb_funcall(mrb, info, "set_backtrace", 1, bt);
}
mrb_value
+1 -1
View File
@@ -1,6 +1,6 @@
/*
** error.h - Exception class
**
**
** See Copyright Notice in mruby.h
*/
+2 -2
View File
@@ -1,6 +1,6 @@
/*
** etc.c -
**
** etc.c -
**
** See Copyright Notice in mruby.h
*/
+24 -24
View File
@@ -1,6 +1,6 @@
/*
** eval_intern.h -
**
** eval_intern.h -
**
** See Copyright Notice in mruby.h
*/
@@ -48,7 +48,7 @@
# ifndef alloca
# define alloca __builtin_alloca
# endif
# endif /* atarist */
# endif /* atarist */
#else
# ifdef HAVE_ALLOCA_H
# include <alloca.h>
@@ -56,11 +56,11 @@
# ifdef _AIX
#pragma alloca
# else
# ifndef alloca /* predefined by HP cc +Olibcalls */
# ifndef alloca /* predefined by HP cc +Olibcalls */
void *alloca();
# endif
# endif /* AIX */
# endif /* HAVE_ALLOCA_H */
# endif /* HAVE_ALLOCA_H */
#endif /* __GNUC__ */
#ifndef HAVE_STRING_H
@@ -135,25 +135,25 @@ char *strrchr(const char *, const char);
//#define JUMP_TAG(st) TH_JUMP_TAG(GET_THREAD(), st)
enum ruby_tag_type {
RUBY_TAG_RETURN = 0x1,
RUBY_TAG_BREAK = 0x2,
RUBY_TAG_NEXT = 0x3,
RUBY_TAG_RETRY = 0x4,
RUBY_TAG_REDO = 0x5,
RUBY_TAG_RAISE = 0x6,
RUBY_TAG_THROW = 0x7,
RUBY_TAG_FATAL = 0x8,
RUBY_TAG_MASK = 0xf
RUBY_TAG_RETURN = 0x1,
RUBY_TAG_BREAK = 0x2,
RUBY_TAG_NEXT = 0x3,
RUBY_TAG_RETRY = 0x4,
RUBY_TAG_REDO = 0x5,
RUBY_TAG_RAISE = 0x6,
RUBY_TAG_THROW = 0x7,
RUBY_TAG_FATAL = 0x8,
RUBY_TAG_MASK = 0xf
};
#define TAG_RETURN RUBY_TAG_RETURN
#define TAG_BREAK RUBY_TAG_BREAK
#define TAG_NEXT RUBY_TAG_NEXT
#define TAG_RETRY RUBY_TAG_RETRY
#define TAG_REDO RUBY_TAG_REDO
#define TAG_RAISE RUBY_TAG_RAISE
#define TAG_THROW RUBY_TAG_THROW
#define TAG_FATAL RUBY_TAG_FATAL
#define TAG_MASK RUBY_TAG_MASK
#define TAG_RETURN RUBY_TAG_RETURN
#define TAG_BREAK RUBY_TAG_BREAK
#define TAG_NEXT RUBY_TAG_NEXT
#define TAG_RETRY RUBY_TAG_RETRY
#define TAG_REDO RUBY_TAG_REDO
#define TAG_RAISE RUBY_TAG_RAISE
#define TAG_THROW RUBY_TAG_THROW
#define TAG_FATAL RUBY_TAG_FATAL
#define TAG_MASK RUBY_TAG_MASK
#define NEW_THROW_OBJECT(val, pt, st) \
((mrb_value)mrb_node_newnode(NODE_LIT, (mrb_value)(val), (mrb_value)(pt), (mrb_value)(st)))
@@ -208,7 +208,7 @@ NORETURN(void rb_print_undef(mrb_value, mrb_sym, int));
NORETURN(void rb_vm_localjump_error(const char *,mrb_value, int));
NORETURN(void rb_vm_jump_tag_but_local_jump(int, mrb_value));
//NORETURN(void mrb_raise_method_missing(mrb_thread_t *th, int argc, mrb_value *argv,
// mrb_value obj, int call_status));
// mrb_value obj, int call_status));
mrb_value mrb_vm_make_jump_tag_but_local_jump(int state, mrb_value val);
NODE *mrb_vm_cref(void);
+10 -10
View File
@@ -1,6 +1,6 @@
/*
** gc.c - garbage collector for RiteVM
**
**
** See Copyright Notice in mruby.h
*/
@@ -298,7 +298,7 @@ gc_mark_children(mrb_state *mrb, struct RBasic *obj)
case MRB_TT_MODULE:
{
struct RClass *c = (struct RClass*)obj;
mrb_gc_mark_iv(mrb, (struct RObject*)obj);
mrb_gc_mark_mt(mrb, c);
mrb_gc_mark(mrb, (struct RBasic*)c->super);
@@ -353,8 +353,8 @@ gc_mark_children(mrb_state *mrb, struct RBasic *obj)
struct RString *s = (struct RString*)obj;
while (s->flags & MRB_STR_SHARED) {
s = s->aux.shared;
if (!s) break;
s = s->aux.shared;
if (!s) break;
}
}
break;
@@ -441,7 +441,7 @@ obj_free(mrb_state *mrb, struct RBasic *obj)
d->type->dfree(mrb, d->data);
}
}
break;
break;
default:
break;
@@ -594,12 +594,12 @@ incremental_sweep_phase(mrb_state *mrb, size_t limit)
while (p<e) {
if (is_dead(mrb, &p->as.basic)) {
if (p->as.basic.tt != MRB_TT_FREE) {
obj_free(mrb, &p->as.basic);
p->as.free.next = page->freelist;
page->freelist = (struct RBasic*)p;
if (p->as.basic.tt != MRB_TT_FREE) {
obj_free(mrb, &p->as.basic);
p->as.free.next = page->freelist;
page->freelist = (struct RBasic*)p;
freed++;
}
}
}
else {
paint_partial_white(mrb, &p->as.basic); /* next gc target */
+1 -1
View File
@@ -1,6 +1,6 @@
/*
** gc.h - garbage collector for RiteVM
**
**
** See Copyright Notice in mruby.h
*/
+1 -1
View File
@@ -1,6 +1,6 @@
/*
** hash.c - Hash class
**
**
** See Copyright Notice in mruby.h
*/
+1 -1
View File
@@ -1,6 +1,6 @@
/*
** init.c - initialize mruby core
**
**
** See Copyright Notice in mruby.h
*/
+1 -1
View File
@@ -1,6 +1,6 @@
/*
** init_ext.c - initialize extend libraries
**
**
** See Copyright Notice in mruby.h
*/
+19 -19
View File
@@ -1,6 +1,6 @@
/*
** kernel.c - Kernel module
**
**
** See Copyright Notice in mruby.h
*/
@@ -55,22 +55,22 @@ inspect_obj(mrb_state *mrb, mrb_value obj, mrb_value str, int recur)
if (h) {
for (k = kh_begin(h); k != kh_end(h); k++) {
if (kh_exist(h, k)){
mrb_sym id = kh_key(h, k);
mrb_value value = kh_value(h, k);
if (kh_exist(h, k)){
mrb_sym id = kh_key(h, k);
mrb_value value = kh_value(h, k);
/* need not to show internal data */
if (RSTRING_PTR(str)[0] == '-') { /* first element */
RSTRING_PTR(str)[0] = '#';
mrb_str_cat2(mrb, str, " ");
}
else {
mrb_str_cat2(mrb, str, ", ");
}
mrb_str_cat2(mrb, str, mrb_sym2name(mrb, id));
mrb_str_cat2(mrb, str, "=");
mrb_str_append(mrb, str, mrb_inspect(mrb, value));
}
/* need not to show internal data */
if (RSTRING_PTR(str)[0] == '-') { /* first element */
RSTRING_PTR(str)[0] = '#';
mrb_str_cat2(mrb, str, " ");
}
else {
mrb_str_cat2(mrb, str, ", ");
}
mrb_str_cat2(mrb, str, mrb_sym2name(mrb, id));
mrb_str_cat2(mrb, str, "=");
mrb_str_append(mrb, str, mrb_inspect(mrb, value));
}
}
}
}
@@ -398,7 +398,7 @@ init_copy(mrb_state *mrb, mrb_value dest, mrb_value obj)
ROBJECT(dest)->iv = ROBJECT(obj)->iv;
}
break;
default:
break;
}
@@ -795,13 +795,13 @@ mrb_obj_instance_variables(mrb_state *mrb, mrb_value self)
ary = mrb_ary_new(mrb);
if (h) {
for (i=0;i<kh_end(h);i++) {
if (kh_exist(h, i)) {
if (kh_exist(h, i)) {
p = mrb_sym2name(mrb, kh_key(h,i));
if (*p == '@') {
if (mrb_type(kh_value(h, i)) != MRB_TT_UNDEF)
mrb_ary_push(mrb, ary, mrb_str_new_cstr(mrb, p));
}
}
}
}
}
return ary;
+3 -3
View File
@@ -1,6 +1,6 @@
/*
** load.c - mruby binary loader
**
**
** See Copyright Notice in mruby.h
*/
@@ -412,12 +412,12 @@ read_rite_irep_record(mrb_state *mrb, unsigned char *src, mrb_irep *irep, uint32
switch (tt) { //pool data
case MRB_TT_FIXNUM:
fix_num = readint(buf, 10);
fix_num = readint(buf, 10);
irep->pool[i] = mrb_fixnum_value(fix_num);
break;
case MRB_TT_FLOAT:
f = readfloat(buf);
f = readfloat(buf);
irep->pool[i] = mrb_float_value(f);
break;
+1 -1
View File
@@ -1,6 +1,6 @@
/*
** method.h - method structures and functions
**
**
** See Copyright Notice in mruby.h
*/
+17 -17
View File
@@ -1,6 +1,6 @@
/*
** minimain.c -
**
** minimain.c -
**
** See Copyright Notice in mruby.h
*/
@@ -71,21 +71,21 @@ main(int argc, char **argv)
n = 0;
fib_iseq[n++] = MKOP_AB(OP_MOVE, 2, 1); /* r2 := r1 */
fib_iseq[n++] = MKOP_AsBx(OP_LOADI, 3, 3); /* r3 := 2 */
fib_iseq[n++] = MKOP_ABC(OP_LT, 2, 0, 2); /* r2 .< r3 */
fib_iseq[n++] = MKOP_AsBx(OP_JMPNOT, 2, 2); /* ifnot r2 :else */
fib_iseq[n++] = MKOP_AsBx(OP_LOADI, 2, 1); /* r6 := 1 */
fib_iseq[n++] = MKOP_A(OP_RETURN, 2); /* return r2 */
fib_iseq[n++] = MKOP_AB(OP_MOVE, 3, 0); /* r3 := r0 :else */
fib_iseq[n++] = MKOP_AB(OP_MOVE, 4, 1); /* r4 := r1 */
fib_iseq[n++] = MKOP_ABC(OP_SUBI, 4, 1, 2); /* r4 .- 2 */
fib_iseq[n++] = MKOP_ABC(OP_SEND, 3, 3, 1); /* r3 .fib r4 */
fib_iseq[n++] = MKOP_AB(OP_MOVE, 4, 0); /* r4 := r0 */
fib_iseq[n++] = MKOP_AB(OP_MOVE, 5, 1); /* r5 := r1 */
fib_iseq[n++] = MKOP_ABC(OP_SUBI, 5, 1, 1); /* r5 .- 1 */
fib_iseq[n++] = MKOP_ABC(OP_SEND, 4, 3, 1); /* r4 .fib :r5 */
fib_iseq[n++] = MKOP_ABC(OP_ADD, 3, 2, 1); /* r3 .+ r4 */
fib_iseq[n++] = MKOP_A(OP_RETURN, 3); /* return r3 */
fib_iseq[n++] = MKOP_AsBx(OP_LOADI, 3, 3); /* r3 := 2 */
fib_iseq[n++] = MKOP_ABC(OP_LT, 2, 0, 2); /* r2 .< r3 */
fib_iseq[n++] = MKOP_AsBx(OP_JMPNOT, 2, 2); /* ifnot r2 :else */
fib_iseq[n++] = MKOP_AsBx(OP_LOADI, 2, 1); /* r6 := 1 */
fib_iseq[n++] = MKOP_A(OP_RETURN, 2); /* return r2 */
fib_iseq[n++] = MKOP_AB(OP_MOVE, 3, 0); /* r3 := r0 :else */
fib_iseq[n++] = MKOP_AB(OP_MOVE, 4, 1); /* r4 := r1 */
fib_iseq[n++] = MKOP_ABC(OP_SUBI, 4, 1, 2); /* r4 .- 2 */
fib_iseq[n++] = MKOP_ABC(OP_SEND, 3, 3, 1); /* r3 .fib r4 */
fib_iseq[n++] = MKOP_AB(OP_MOVE, 4, 0); /* r4 := r0 */
fib_iseq[n++] = MKOP_AB(OP_MOVE, 5, 1); /* r5 := r1 */
fib_iseq[n++] = MKOP_ABC(OP_SUBI, 5, 1, 1); /* r5 .- 1 */
fib_iseq[n++] = MKOP_ABC(OP_SEND, 4, 3, 1); /* r4 .fib :r5 */
fib_iseq[n++] = MKOP_ABC(OP_ADD, 3, 2, 1); /* r3 .+ r4 */
fib_iseq[n++] = MKOP_A(OP_RETURN, 3); /* return r3 */
fib_irep.ilen = n;
fib_irep.idx = sirep+1;
+15341 -15341
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -1,6 +1,6 @@
/*
** node.h - nodes of abstract syntax tree
**
**
** See Copyright Notice in mruby.h
*/
+1 -1
View File
@@ -1,6 +1,6 @@
/*
** numeric.c - Numeric, Integer, Float, Fixnum class
**
**
** See Copyright Notice in mruby.h
*/
+1 -1
View File
@@ -1,6 +1,6 @@
/*
** object.c - Object, NilClass, TrueClass, FalseClass class
**
**
** See Copyright Notice in mruby.h
*/
+83 -83
View File
@@ -1,6 +1,6 @@
/*
** opcode.h - RiteVM operation codes
**
**
** See Copyright Notice in mruby.h
*/
@@ -47,98 +47,98 @@
#define MKOP_Abc(op,a,b,c) (MKOP_A(op,a)|MKARG_bc(b,c))
enum {
OP_NOP=0,/* */
OP_MOVE,/* A B R(A) := R(B) */
OP_LOADL,/* A Bx R(A) := Lit(Bx) */
OP_LOADI,/* A sBx R(A) := sBx */
OP_LOADSYM,/* A Bx R(A) := Sym(Bx) */
OP_LOADNIL,/* A R(A) := nil */
OP_LOADSELF,/* A R(A) := self */
OP_LOADT,/* A R(A) := true */
OP_LOADF,/* A R(A) := false */
OP_NOP=0,/* */
OP_MOVE,/* A B R(A) := R(B) */
OP_LOADL,/* A Bx R(A) := Lit(Bx) */
OP_LOADI,/* A sBx R(A) := sBx */
OP_LOADSYM,/* A Bx R(A) := Sym(Bx) */
OP_LOADNIL,/* A R(A) := nil */
OP_LOADSELF,/* A R(A) := self */
OP_LOADT,/* A R(A) := true */
OP_LOADF,/* A R(A) := false */
OP_GETGLOBAL,/* A Bx R(A) := getglobal(Sym(Bx)) */
OP_SETGLOBAL,/* A Bx setglobal(Sym(Bx), R(A)) */
OP_GETSPECIAL,/*A Bx R(A) := Special[Bx] */
OP_SETSPECIAL,/*A Bx Special[Bx] := R(A) */
OP_GETIV,/* A Bx R(A) := ivget(Sym(Bx)) */
OP_SETIV,/* A Bx ivset(Sym(Bx),R(A)) */
OP_GETCV,/* A Bx R(A) := cvget(Sym(Bx)) */
OP_SETCV,/* A Bx cvset(Sym(Bx),R(A)) */
OP_GETCONST,/* A Bx R(A) := constget(Sym(Bx)) */
OP_SETCONST,/* A Bx constset(Sym(Bx),R(A)) */
OP_GETMCNST,/* A Bx R(A) := R(A)::Sym(B) */
OP_SETMCNST,/* A Bx R(A+1)::Sym(B) := R(A) */
OP_GETUPVAR,/* A B C R(A) := uvget(B,C) */
OP_SETUPVAR,/* A B C uvset(B,C,R(A)) */
OP_GETGLOBAL,/* A Bx R(A) := getglobal(Sym(Bx)) */
OP_SETGLOBAL,/* A Bx setglobal(Sym(Bx), R(A)) */
OP_GETSPECIAL,/*A Bx R(A) := Special[Bx] */
OP_SETSPECIAL,/*A Bx Special[Bx] := R(A) */
OP_GETIV,/* A Bx R(A) := ivget(Sym(Bx)) */
OP_SETIV,/* A Bx ivset(Sym(Bx),R(A)) */
OP_GETCV,/* A Bx R(A) := cvget(Sym(Bx)) */
OP_SETCV,/* A Bx cvset(Sym(Bx),R(A)) */
OP_GETCONST,/* A Bx R(A) := constget(Sym(Bx)) */
OP_SETCONST,/* A Bx constset(Sym(Bx),R(A)) */
OP_GETMCNST,/* A Bx R(A) := R(A)::Sym(B) */
OP_SETMCNST,/* A Bx R(A+1)::Sym(B) := R(A) */
OP_GETUPVAR,/* A B C R(A) := uvget(B,C) */
OP_SETUPVAR,/* A B C uvset(B,C,R(A)) */
OP_JMP,/* sBx pc+=sBx */
OP_JMPIF,/* A sBx if R(A) pc+=sBx */
OP_JMPNOT,/* A sBx if !R(A) pc+=sBx */
OP_ONERR,/* sBx rescue_push(pc+sBx) */
OP_RESCUE,/* A clear(exc); R(A) := exception (ignore when A=0) */
OP_POPERR,/* A A.times{rescue_pop()} */
OP_RAISE,/* A raise(R(A)) */
OP_EPUSH,/* Bx ensure_push(SEQ[Bx]) */
OP_EPOP,/* A A.times{ensure_pop().call} */
OP_JMP,/* sBx pc+=sBx */
OP_JMPIF,/* A sBx if R(A) pc+=sBx */
OP_JMPNOT,/* A sBx if !R(A) pc+=sBx */
OP_ONERR,/* sBx rescue_push(pc+sBx) */
OP_RESCUE,/* A clear(exc); R(A) := exception (ignore when A=0) */
OP_POPERR,/* A A.times{rescue_pop()} */
OP_RAISE,/* A raise(R(A)) */
OP_EPUSH,/* Bx ensure_push(SEQ[Bx]) */
OP_EPOP,/* A A.times{ensure_pop().call} */
OP_SEND,/* A B C R(A) := call(R(A),mSym(B),R(A+1),...,R(A+C)) */
OP_FSEND,/* A B C R(A) := fcall(R(A),mSym(B),R(A+1),...,R(A+C-1)) */
OP_VSEND,/* A B R(A) := vcall(R(A),mSym(B)) */
OP_CALL,/* A B C R(A) := self.call(R(A),.., R(A+C)) */
OP_SUPER,/* A B C R(A) := super(R(A+1),... ,R(A+C-1)) */
OP_ARGARY,/* A Bx R(A) := argument array (16=6:1:5:4) */
OP_ENTER,/* Ax arg setup according to flags (24=5:5:1:5:5:1:1) */
OP_KARG,/* A B C R(A) := kdict[mSym(B)]; if C kdict.rm(mSym(B)) */
OP_KDICT,/* A C R(A) := kdict */
OP_SEND,/* A B C R(A) := call(R(A),mSym(B),R(A+1),...,R(A+C)) */
OP_FSEND,/* A B C R(A) := fcall(R(A),mSym(B),R(A+1),...,R(A+C-1)) */
OP_VSEND,/* A B R(A) := vcall(R(A),mSym(B)) */
OP_CALL,/* A B C R(A) := self.call(R(A),.., R(A+C)) */
OP_SUPER,/* A B C R(A) := super(R(A+1),... ,R(A+C-1)) */
OP_ARGARY,/* A Bx R(A) := argument array (16=6:1:5:4) */
OP_ENTER,/* Ax arg setup according to flags (24=5:5:1:5:5:1:1) */
OP_KARG,/* A B C R(A) := kdict[mSym(B)]; if C kdict.rm(mSym(B)) */
OP_KDICT,/* A C R(A) := kdict */
OP_RETURN,/* A B return R(A) (B=normal,in-block return/break) */
OP_TAILCALL,/* A B C return call(R(A),mSym(B),*R(C)) */
OP_BLKPUSH,/* A Bx R(A) := block (16=6:1:5:4) */
OP_RETURN,/* A B return R(A) (B=normal,in-block return/break) */
OP_TAILCALL,/* A B C return call(R(A),mSym(B),*R(C)) */
OP_BLKPUSH,/* A Bx R(A) := block (16=6:1:5:4) */
OP_ADD,/* A B C R(A) := R(A)+R(A+1) (mSyms[B]=:+,C=1) */
OP_ADDI,/* A B C R(A) := R(A)+C (mSyms[B]=:+) */
OP_SUB,/* A B C R(A) := R(A)-R(A+1) (mSyms[B]=:-,C=1) */
OP_SUBI,/* A B C R(A) := R(A)-C (mSyms[B]=:-) */
OP_MUL,/* A B C R(A) := R(A)*R(A+1) (mSyms[B]=:*,C=1) */
OP_DIV,/* A B C R(A) := R(A)/R(A+1) (mSyms[B]=:/,C=1) */
OP_EQ,/* A B C R(A) := R(A)==R(A+1) (mSyms[B]=:==,C=1) */
OP_LT,/* A B C R(A) := R(A)<R(A+1) (mSyms[B]=:<,C=1) */
OP_LE,/* A B C R(A) := R(A)<=R(A+1) (mSyms[B]=:<=,C=1) */
OP_GT,/* A B C R(A) := R(A)>R(A+1) (mSyms[B]=:>,C=1) */
OP_GE,/* A B C R(A) := R(A)>=R(A+1) (mSyms[B]=:>=,C=1) */
OP_ADD,/* A B C R(A) := R(A)+R(A+1) (mSyms[B]=:+,C=1) */
OP_ADDI,/* A B C R(A) := R(A)+C (mSyms[B]=:+) */
OP_SUB,/* A B C R(A) := R(A)-R(A+1) (mSyms[B]=:-,C=1) */
OP_SUBI,/* A B C R(A) := R(A)-C (mSyms[B]=:-) */
OP_MUL,/* A B C R(A) := R(A)*R(A+1) (mSyms[B]=:*,C=1) */
OP_DIV,/* A B C R(A) := R(A)/R(A+1) (mSyms[B]=:/,C=1) */
OP_EQ,/* A B C R(A) := R(A)==R(A+1) (mSyms[B]=:==,C=1) */
OP_LT,/* A B C R(A) := R(A)<R(A+1) (mSyms[B]=:<,C=1) */
OP_LE,/* A B C R(A) := R(A)<=R(A+1) (mSyms[B]=:<=,C=1) */
OP_GT,/* A B C R(A) := R(A)>R(A+1) (mSyms[B]=:>,C=1) */
OP_GE,/* A B C R(A) := R(A)>=R(A+1) (mSyms[B]=:>=,C=1) */
OP_ARRAY,/* A B C R(A) := ary_new(R(B),R(B+1)..R(B+C)) */
OP_ARYCAT,/* A B ary_cat(R(A),R(B)) */
OP_ARYPUSH,/* A B ary_push(R(A),R(B)) */
OP_AREF,/* A B C R(A) := R(B)[C] */
OP_ASET,/* A B C R(B)[C] := R(A) */
OP_APOST,/* A B C *R(A),R(A+1)..R(A+C) := R(A) */
OP_ARRAY,/* A B C R(A) := ary_new(R(B),R(B+1)..R(B+C)) */
OP_ARYCAT,/* A B ary_cat(R(A),R(B)) */
OP_ARYPUSH,/* A B ary_push(R(A),R(B)) */
OP_AREF,/* A B C R(A) := R(B)[C] */
OP_ASET,/* A B C R(B)[C] := R(A) */
OP_APOST,/* A B C *R(A),R(A+1)..R(A+C) := R(A) */
OP_STRING,/* A Bx R(A) := str_dup(Lit(Bx)) */
OP_STRCAT,/* A B str_cat(R(A),R(B)) */
OP_STRING,/* A Bx R(A) := str_dup(Lit(Bx)) */
OP_STRCAT,/* A B str_cat(R(A),R(B)) */
OP_HASH,/* A B C R(A) := hash_new(R(B),R(B+1)..R(B+C)) */
OP_LAMBDA,/* A Bz Cz R(A) := lambda(SEQ[Bz],Cm) */
OP_RANGE,/* A B C R(A) := range_new(R(B),R(B+1),C) */
OP_HASH,/* A B C R(A) := hash_new(R(B),R(B+1)..R(B+C)) */
OP_LAMBDA,/* A Bz Cz R(A) := lambda(SEQ[Bz],Cm) */
OP_RANGE,/* A B C R(A) := range_new(R(B),R(B+1),C) */
OP_OCLASS,/* A R(A) := ::Object */
OP_CLASS,/* A B R(A) := newclass(R(A),mSym(B),R(A+1)) */
OP_MODULE,/* A B R(A) := newmodule(R(A),mSym(B)) */
OP_EXEC,/* A Bx R(A) := blockexec(R(A),SEQ[Bx]) */
OP_METHOD,/* A B R(A).newmethod(mSym(B),R(A+1)) */
OP_SCLASS,/* A B R(A) := R(B).singleton_class */
OP_TCLASS,/* A R(A) := target_class */
OP_OCLASS,/* A R(A) := ::Object */
OP_CLASS,/* A B R(A) := newclass(R(A),mSym(B),R(A+1)) */
OP_MODULE,/* A B R(A) := newmodule(R(A),mSym(B)) */
OP_EXEC,/* A Bx R(A) := blockexec(R(A),SEQ[Bx]) */
OP_METHOD,/* A B R(A).newmethod(mSym(B),R(A+1)) */
OP_SCLASS,/* A B R(A) := R(B).singleton_class */
OP_TCLASS,/* A R(A) := target_class */
OP_DEBUG,/* A print R(A) */
OP_STOP,/* stop VM */
OP_ERR,/* Bx raise RuntimeError with message Lit(Bx) */
OP_DEBUG,/* A print R(A) */
OP_STOP,/* stop VM */
OP_ERR,/* Bx raise RuntimeError with message Lit(Bx) */
OP_RSVD1,/* reserved instruction #1 */
OP_RSVD2,/* reserved instruction #2 */
OP_RSVD3,/* reserved instruction #3 */
OP_RSVD4,/* reserved instruction #4 */
OP_RSVD5,/* reserved instruction #5 */
OP_RSVD1,/* reserved instruction #1 */
OP_RSVD2,/* reserved instruction #2 */
OP_RSVD3,/* reserved instruction #3 */
OP_RSVD4,/* reserved instruction #4 */
OP_RSVD5,/* reserved instruction #5 */
};
#define OP_L_STRICT 1
@@ -151,4 +151,4 @@ OP_RSVD5,/* reserved instruction #5 */
#define OP_R_BREAK 1
#define OP_R_RETURN 2
#endif /* OPCODE_H */
#endif /* OPCODE_H */
+3 -3
View File
@@ -1,6 +1,6 @@
/*
** pool.c - memory pool
**
**
** See Copyright Notice in mruby.h
*/
@@ -124,8 +124,8 @@ mrb_pool_realloc(mrb_pool *pool, void *p, size_t oldlen, size_t newlen)
beg = (char*)p - page->page;
if (beg + oldlen != page->offset) break;
if (beg + newlen > page->len) {
page->offset = beg;
break;
page->offset = beg;
break;
}
page->offset = beg + newlen;
return p;
+1 -1
View File
@@ -1,6 +1,6 @@
/*
** pool.h - memory pool
**
**
** See Copyright Notice in mruby.h
*/
+1 -1
View File
@@ -1,6 +1,6 @@
/*
** print.c - Kernel.#p
**
**
** See Copyright Notice in mruby.h
*/
+1 -1
View File
@@ -1,6 +1,6 @@
/*
** proc.c - Proc class
**
**
** See Copyright Notice in mruby.h
*/
+1 -1
View File
@@ -1,6 +1,6 @@
/*
** range.c - Range class
**
**
** See Copyright Notice in mruby.h
*/
+1 -1
View File
@@ -1,6 +1,6 @@
/*
** re.c - Regexp class
**
**
** See Copyright Notice in mruby.h
*/
+1 -1
View File
@@ -1,6 +1,6 @@
/*
** re.h - Regexp class
**
**
** See Copyright Notice in mruby.h
*/
+908 -908
View File
File diff suppressed because it is too large Load Diff
+25 -25
View File
@@ -84,7 +84,7 @@ onigenc_get_right_adjust_char_head(OnigEncoding enc, const UChar* start, const U
extern UChar*
onigenc_get_right_adjust_char_head_with_prev(OnigEncoding enc,
const UChar* start, const UChar* s, const UChar* end, const UChar** prev)
const UChar* start, const UChar* s, const UChar* end, const UChar** prev)
{
UChar* p = ONIGENC_LEFT_ADJUST_CHAR_HEAD(enc, start, s, end);
@@ -418,8 +418,8 @@ const OnigPairCaseFoldCodes OnigAsciiLowerMap[] = {
extern int
onigenc_ascii_apply_all_case_fold(OnigCaseFoldType flag ARG_UNUSED,
OnigApplyAllCaseFoldFunc f, void* arg,
OnigEncoding enc ARG_UNUSED)
OnigApplyAllCaseFoldFunc f, void* arg,
OnigEncoding enc ARG_UNUSED)
{
OnigCodePoint code;
int i, r;
@@ -462,7 +462,7 @@ onigenc_ascii_get_case_fold_codes_by_str(OnigCaseFoldType flag ARG_UNUSED,
static int
ss_apply_all_case_fold(OnigCaseFoldType flag ARG_UNUSED,
OnigApplyAllCaseFoldFunc f, void* arg)
OnigApplyAllCaseFoldFunc f, void* arg)
{
OnigCodePoint ss[] = { 0x73, 0x73 };
@@ -508,7 +508,7 @@ onigenc_get_case_fold_codes_by_str_with_map(int map_size,
items[0].code_len = 1;
items[0].code[0] = (OnigCodePoint )(*p + 0x20);
if (*p == 0x53 && ess_tsett_flag != 0 && end > p + 1
&& (*(p+1) == 0x53 || *(p+1) == 0x73)) {
&& (*(p+1) == 0x53 || *(p+1) == 0x73)) {
/* SS */
items[1].byte_len = 2;
items[1].code_len = 1;
@@ -523,7 +523,7 @@ onigenc_get_case_fold_codes_by_str_with_map(int map_size,
items[0].code_len = 1;
items[0].code[0] = (OnigCodePoint )(*p - 0x20);
if (*p == 0x73 && ess_tsett_flag != 0 && end > p + 1
&& (*(p+1) == 0x73 || *(p+1) == 0x53)) {
&& (*(p+1) == 0x73 || *(p+1) == 0x53)) {
/* ss */
items[1].byte_len = 2;
items[1].code_len = 1;
@@ -561,16 +561,16 @@ onigenc_get_case_fold_codes_by_str_with_map(int map_size,
for (i = 0; i < map_size; i++) {
if (*p == map[i].from) {
items[0].byte_len = 1;
items[0].code_len = 1;
items[0].code[0] = map[i].to;
return 1;
items[0].byte_len = 1;
items[0].code_len = 1;
items[0].code[0] = map[i].to;
return 1;
}
else if (*p == map[i].to) {
items[0].byte_len = 1;
items[0].code_len = 1;
items[0].code[0] = map[i].from;
return 1;
items[0].byte_len = 1;
items[0].code_len = 1;
items[0].code[0] = map[i].from;
return 1;
}
}
}
@@ -582,7 +582,7 @@ onigenc_get_case_fold_codes_by_str_with_map(int map_size,
extern int
onigenc_not_support_get_ctype_code_range(OnigCtype ctype,
OnigCodePoint* sb_out, const OnigCodePoint* ranges[],
OnigEncoding enc)
OnigEncoding enc)
{
return ONIG_NO_SUPPORT_CONFIG;
}
@@ -599,7 +599,7 @@ onigenc_is_mbc_newline_0x0a(const UChar* p, const UChar* end, OnigEncoding enc A
/* for single byte encodings */
extern int
onigenc_ascii_mbc_case_fold(OnigCaseFoldType flag ARG_UNUSED, const UChar** p,
const UChar*end, UChar* lower, OnigEncoding enc ARG_UNUSED)
const UChar*end, UChar* lower, OnigEncoding enc ARG_UNUSED)
{
*lower = ONIGENC_ASCII_CODE_TO_LOWER_CASE(**p);
@@ -609,14 +609,14 @@ onigenc_ascii_mbc_case_fold(OnigCaseFoldType flag ARG_UNUSED, const UChar** p,
extern int
onigenc_single_byte_mbc_enc_len(const UChar* p ARG_UNUSED, const UChar* e ARG_UNUSED,
OnigEncoding enc ARG_UNUSED)
OnigEncoding enc ARG_UNUSED)
{
return 1;
}
extern OnigCodePoint
onigenc_single_byte_mbc_to_code(const UChar* p, const UChar* end ARG_UNUSED,
OnigEncoding enc ARG_UNUSED)
OnigEncoding enc ARG_UNUSED)
{
return (OnigCodePoint )(*p);
}
@@ -637,21 +637,21 @@ onigenc_single_byte_code_to_mbc(OnigCodePoint code, UChar *buf, OnigEncoding enc
extern UChar*
onigenc_single_byte_left_adjust_char_head(const UChar* start ARG_UNUSED, const UChar* s,
const UChar* end,
OnigEncoding enc ARG_UNUSED)
OnigEncoding enc ARG_UNUSED)
{
return (UChar* )s;
}
extern int
onigenc_always_true_is_allowed_reverse_match(const UChar* s ARG_UNUSED, const UChar* end ARG_UNUSED,
OnigEncoding enc ARG_UNUSED)
OnigEncoding enc ARG_UNUSED)
{
return TRUE;
}
extern int
onigenc_always_false_is_allowed_reverse_match(const UChar* s ARG_UNUSED, const UChar* end ARG_UNUSED,
OnigEncoding enc ARG_UNUSED)
OnigEncoding enc ARG_UNUSED)
{
return FALSE;
}
@@ -687,7 +687,7 @@ onigenc_mbn_mbc_to_code(OnigEncoding enc, const UChar* p, const UChar* end)
extern int
onigenc_mbn_mbc_case_fold(OnigEncoding enc, OnigCaseFoldType flag ARG_UNUSED,
const UChar** pp, const UChar* end ARG_UNUSED,
UChar* lower)
UChar* lower)
{
int len;
const UChar *p = *pp;
@@ -796,7 +796,7 @@ onigenc_minimum_property_name_to_ctype(OnigEncoding enc, UChar* p, UChar* end)
extern int
onigenc_mb2_is_code_ctype(OnigEncoding enc, OnigCodePoint code,
unsigned int ctype)
unsigned int ctype)
{
if (code < 128)
return ONIGENC_IS_ASCII_CODE_CTYPE(code, ctype);
@@ -811,7 +811,7 @@ onigenc_mb2_is_code_ctype(OnigEncoding enc, OnigCodePoint code,
extern int
onigenc_mb4_is_code_ctype(OnigEncoding enc, OnigCodePoint code,
unsigned int ctype)
unsigned int ctype)
{
if (code < 128)
return ONIGENC_IS_ASCII_CODE_CTYPE(code, ctype);
@@ -890,7 +890,7 @@ onigenc_property_list_add_property(UChar* name, const OnigCodePoint* prop,
*pnum = *pnum + 1;
onig_st_insert_strend(*table, name, name + strlen((char* )name),
(hash_data_type )(*pnum + ONIGENC_MAX_STD_CTYPE));
(hash_data_type )(*pnum + ONIGENC_MAX_STD_CTYPE));
return 0;
}
+6 -6
View File
@@ -182,12 +182,12 @@ ONIG_EXTERN const unsigned short OnigEncAsciiCtypeTable[];
extern int ONIG_ENC_REGISTER(const char *, OnigEncodingType*);
#define OnigEncodingName(n) encoding_##n
#define OnigEncodingDeclare(n) static OnigEncodingType OnigEncodingName(n)
#define OnigEncodingDefine(f,n) \
OnigEncodingDeclare(n); \
void Init_##f(void) { \
ONIG_ENC_REGISTER(OnigEncodingName(n).name, \
&OnigEncodingName(n)); \
} \
#define OnigEncodingDefine(f,n) \
OnigEncodingDeclare(n); \
void Init_##f(void) { \
ONIG_ENC_REGISTER(OnigEncodingName(n).name, \
&OnigEncodingName(n)); \
} \
OnigEncodingDeclare(n)
#else
#define OnigEncodingName(n) OnigEncoding##n
+42 -42
View File
@@ -189,7 +189,7 @@ static void sprint_byte_with_x(char* s, unsigned int v)
}
static int to_ascii(OnigEncoding enc, UChar *s, UChar *end,
UChar buf[], int buf_size, int *is_over)
UChar buf[], int buf_size, int *is_over)
{
int len;
UChar *p;
@@ -201,24 +201,24 @@ static int to_ascii(OnigEncoding enc, UChar *s, UChar *end,
while (p < end) {
code = ONIGENC_MBC_TO_CODE(enc, p, end);
if (code >= 0x80) {
if (code > 0xffff && len + 10 <= buf_size) {
sprint_byte_with_x((char*)(&(buf[len])), (unsigned int)(code >> 24));
sprint_byte((char*)(&(buf[len+4])), (unsigned int)(code >> 16));
sprint_byte((char*)(&(buf[len+6])), (unsigned int)(code >> 8));
sprint_byte((char*)(&(buf[len+8])), (unsigned int)code);
len += 10;
}
else if (len + 6 <= buf_size) {
sprint_byte_with_x((char*)(&(buf[len])), (unsigned int)(code >> 8));
sprint_byte((char*)(&(buf[len+4])), (unsigned int)code);
len += 6;
}
else {
break;
}
if (code > 0xffff && len + 10 <= buf_size) {
sprint_byte_with_x((char*)(&(buf[len])), (unsigned int)(code >> 24));
sprint_byte((char*)(&(buf[len+4])), (unsigned int)(code >> 16));
sprint_byte((char*)(&(buf[len+6])), (unsigned int)(code >> 8));
sprint_byte((char*)(&(buf[len+8])), (unsigned int)code);
len += 10;
}
else if (len + 6 <= buf_size) {
sprint_byte_with_x((char*)(&(buf[len])), (unsigned int)(code >> 8));
sprint_byte((char*)(&(buf[len+4])), (unsigned int)code);
len += 6;
}
else {
break;
}
}
else {
buf[len++] = (UChar )code;
buf[len++] = (UChar )code;
}
p += enclen(enc, p, end);
@@ -262,27 +262,27 @@ onig_error_code_to_str(UChar* s, int code, ...)
case ONIGERR_INVALID_CHAR_PROPERTY_NAME:
einfo = va_arg(vargs, OnigErrorInfo*);
len = to_ascii(einfo->enc, einfo->par, einfo->par_end,
parbuf, MAX_ERROR_PAR_LEN - 3, &is_over);
parbuf, MAX_ERROR_PAR_LEN - 3, &is_over);
q = onig_error_code_to_format(code);
p = s;
while (*q != '\0') {
if (*q == '%') {
q++;
if (*q == 'n') { /* '%n': name */
xmemcpy(p, parbuf, len);
p += len;
if (is_over != 0) {
xmemcpy(p, "...", 3);
p += 3;
}
q++;
}
else
goto normal_char;
q++;
if (*q == 'n') { /* '%n': name */
xmemcpy(p, parbuf, len);
p += len;
if (is_over != 0) {
xmemcpy(p, "...", 3);
p += 3;
}
q++;
}
else
goto normal_char;
}
else {
normal_char:
*p++ = *q++;
*p++ = *q++;
}
}
*p = '\0';
@@ -321,13 +321,13 @@ onig_vsnprintf_with_pattern(UChar buf[], int bufsize, OnigEncoding enc,
p = pat;
while (p < pat_end) {
if (*p == '\\') {
*s++ = *p++;
len = enclen(enc, p, pat_end);
while (len-- > 0) *s++ = *p++;
*s++ = *p++;
len = enclen(enc, p, pat_end);
while (len-- > 0) *s++ = *p++;
}
else if (*p == '/') {
*s++ = (unsigned char )'\\';
*s++ = *p++;
*s++ = (unsigned char )'\\';
*s++ = *p++;
}
else if (ONIGENC_IS_MBC_HEAD(enc, p, pat_end)) {
len = enclen(enc, p, pat_end);
@@ -346,14 +346,14 @@ onig_vsnprintf_with_pattern(UChar buf[], int bufsize, OnigEncoding enc,
}
}
else if (!ONIGENC_IS_CODE_PRINT(enc, *p) &&
!ONIGENC_IS_CODE_SPACE(enc, *p)) {
sprint_byte_with_x((char* )bs, (unsigned int )(*p++));
len = onigenc_str_bytelen_null(ONIG_ENCODING_ASCII, bs);
!ONIGENC_IS_CODE_SPACE(enc, *p)) {
sprint_byte_with_x((char* )bs, (unsigned int )(*p++));
len = onigenc_str_bytelen_null(ONIG_ENCODING_ASCII, bs);
bp = bs;
while (len-- > 0) *s++ = *bp++;
while (len-- > 0) *s++ = *bp++;
}
else {
*s++ = *p++;
*s++ = *p++;
}
}
@@ -369,7 +369,7 @@ onig_snprintf_with_pattern(UChar buf[], int bufsize, OnigEncoding enc,
va_list args;
va_start(args, fmt);
onig_vsnprintf_with_pattern(buf, bufsize, enc,
pat, pat_end, fmt, args);
pat, pat_end, fmt, args);
va_end(args);
}
#endif //INCLUDE_REGEXP
+1 -1
View File
@@ -1,6 +1,6 @@
/*
** regex.h - Regexp class
**
**
** See Copyright Notice in mruby.h
*/
+688 -688
View File
File diff suppressed because it is too large Load Diff
+4 -4
View File
@@ -284,7 +284,7 @@ typedef unsigned int BitStatusType;
((n) < (int )BIT_STATUS_BITS_NUM ? ((stats) & (1 << n)) : ((stats) & 1))
#define BIT_STATUS_ON_AT(stats,n) do {\
if ((n) < (int )BIT_STATUS_BITS_NUM) \
if ((n) < (int )BIT_STATUS_BITS_NUM) \
(stats) |= (1 << (n));\
else\
(stats) |= 1;\
@@ -347,7 +347,7 @@ typedef Bits* BitSetRef;
#define BITSET_CLEAR(bs) do {\
int i;\
for (i = 0; i < (int )BITSET_SIZE; i++) { (bs)[i] = 0; } \
for (i = 0; i < (int )BITSET_SIZE; i++) { (bs)[i] = 0; } \
} while (0)
#define BS_ROOM(bs,pos) (bs)[pos / BITS_IN_ROOM]
@@ -814,8 +814,8 @@ extern int onig_st_insert_strend(hash_table_type* table, const UChar* str_key, c
/* encoding property management */
#define PROPERTY_LIST_ADD_PROP(Name, CR) \
r = onigenc_property_list_add_property((UChar* )Name, CR,\
&PropertyNameTable, &PropertyList, &PropertyListNum,\
&PropertyListSize);\
&PropertyNameTable, &PropertyList, &PropertyListNum,\
&PropertyListSize);\
if (r != 0) goto end
#define PROPERTY_LIST_INIT_CHECK \
+858 -858
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -1,6 +1,6 @@
/*
** sprintf.c - Kernel.#sprintf
**
**
** See Copyright Notice in mruby.h
*/
@@ -162,7 +162,7 @@ mrb_fix2binstr(mrb_state *mrb, mrb_value x, int base)
posarg > 0 ? \
(mrb_raise(mrb, E_ARGUMENT_ERROR, "named%.*s after unnumbered(%d)", (len), (name), posarg), mrb_undef_value()) : \
posarg == -1 ? \
(mrb_raise(mrb, E_ARGUMENT_ERROR, "named%.*s after numbered", (len), (name)), mrb_undef_value()) : \
(mrb_raise(mrb, E_ARGUMENT_ERROR, "named%.*s after numbered", (len), (name)), mrb_undef_value()) : \
(posarg = -2, mrb_hash_getWithDef(mrb, get_hash(mrb, &hash, argc, argv), id, mrb_undef_value())))
#define GETNUM(n, val) \
+156 -156
View File
@@ -1,6 +1,6 @@
/* This is a public domain general purpose hash table package written by Peter Moore @ UCB. */
/* static char sccsid[] = "@(#) st.c 5.1 89/12/14 Crucible"; */
/* static char sccsid[] = "@(#) st.c 5.1 89/12/14 Crucible"; */
#include <stdio.h>
#ifdef HAVE_STDLIB_H
@@ -66,35 +66,35 @@ static void rehash(st_table *);
Table of prime numbers 2^n+a, 2<=n<=30.
*/
static long primes[] = {
8 + 3,
16 + 3,
32 + 5,
64 + 3,
128 + 3,
256 + 27,
512 + 9,
1024 + 9,
2048 + 5,
4096 + 3,
8192 + 27,
16384 + 43,
32768 + 3,
65536 + 45,
131072 + 29,
262144 + 3,
524288 + 21,
1048576 + 7,
2097152 + 17,
4194304 + 15,
8388608 + 9,
16777216 + 43,
33554432 + 35,
67108864 + 15,
134217728 + 29,
268435456 + 3,
536870912 + 11,
1073741824 + 85,
0
8 + 3,
16 + 3,
32 + 5,
64 + 3,
128 + 3,
256 + 27,
512 + 9,
1024 + 9,
2048 + 5,
4096 + 3,
8192 + 27,
16384 + 43,
32768 + 3,
65536 + 45,
131072 + 29,
262144 + 3,
524288 + 21,
1048576 + 7,
2097152 + 17,
4194304 + 15,
8388608 + 9,
16777216 + 43,
33554432 + 35,
67108864 + 15,
134217728 + 29,
268435456 + 3,
536870912 + 11,
1073741824 + 85,
0
};
static int
@@ -104,20 +104,20 @@ new_size(int size)
#if 0
for (i=3; i<31; i++) {
if ((1<<i) > size) return 1<<i;
if ((1<<i) > size) return 1<<i;
}
return -1;
#else
int newsize;
for (i = 0, newsize = MINSIZE;
i < sizeof(primes)/sizeof(primes[0]);
i++, newsize <<= 1)
i < sizeof(primes)/sizeof(primes[0]);
i++, newsize <<= 1)
{
if (newsize > size) return primes[i];
if (newsize > size) return primes[i];
}
/* Ran out of polynomials */
return -1; /* should raise exception */
return -1; /* should raise exception */
#endif
}
@@ -126,7 +126,7 @@ st_init_table_with_size(const struct st_hash_type *type, int size)
{
st_table *tbl;
size = new_size(size); /* round up to prime number */
size = new_size(size); /* round up to prime number */
tbl = alloc(st_table);
tbl->type = type;
@@ -188,13 +188,13 @@ st_clear(st_table *table)
st_index_t i;
for(i = 0; i < table->num_bins; i++) {
ptr = table->bins[i];
table->bins[i] = 0;
while (ptr != 0) {
next = ptr->next;
free(ptr);
ptr = next;
}
ptr = table->bins[i];
table->bins[i] = 0;
while (ptr != 0) {
next = ptr->next;
free(ptr);
ptr = next;
}
}
table->num_entries = 0;
table->head = 0;
@@ -216,10 +216,10 @@ st_free_table(st_table *table)
bin_pos = hash_val%(table)->num_bins;\
ptr = (table)->bins[bin_pos];\
if (PTR_NOT_EQUAL(table, ptr, hash_val, key)) {\
while (PTR_NOT_EQUAL(table, ptr->next, hash_val, key)) {\
ptr = ptr->next;\
}\
ptr = ptr->next;\
while (PTR_NOT_EQUAL(table, ptr->next, hash_val, key)) {\
ptr = ptr->next;\
}\
ptr = ptr->next;\
}\
} while (0)
@@ -233,11 +233,11 @@ st_lookup(st_table *table, st_data_t key, st_data_t *value)
FIND_ENTRY(table, ptr, hash_val, bin_pos);
if (ptr == 0) {
return 0;
return 0;
}
else {
if (value != 0) *value = ptr->record;
return 1;
if (value != 0) *value = ptr->record;
return 1;
}
}
@@ -245,7 +245,7 @@ st_lookup(st_table *table, st_data_t key, st_data_t *value)
do {\
st_table_entry *entry;\
if (table->num_entries/(table->num_bins) > ST_DEFAULT_MAX_DENSITY) {\
rehash(table);\
rehash(table);\
bin_pos = hash_val % table->num_bins;\
}\
\
@@ -256,13 +256,13 @@ do {\
entry->record = value;\
entry->next = table->bins[bin_pos];\
if (table->head != 0) {\
entry->fore = 0;\
(entry->back = table->tail)->fore = entry;\
table->tail = entry;\
entry->fore = 0;\
(entry->back = table->tail)->fore = entry;\
table->tail = entry;\
}\
else {\
table->head = table->tail = entry;\
entry->fore = entry->back = 0;\
table->head = table->tail = entry;\
entry->fore = entry->back = 0;\
}\
table->bins[bin_pos] = entry;\
table->num_entries++;\
@@ -278,12 +278,12 @@ st_insert(st_table *table, st_data_t key, st_data_t value)
FIND_ENTRY(table, ptr, hash_val, bin_pos);
if (ptr == 0) {
ADD_DIRECT(table, key, value, hash_val, bin_pos);
return 0;
ADD_DIRECT(table, key, value, hash_val, bin_pos);
return 0;
}
else {
ptr->record = value;
return 1;
ptr->record = value;
return 1;
}
}
@@ -305,17 +305,17 @@ rehash(register st_table *table)
new_num_bins = new_size(table->num_bins+1);
new_bins = (st_table_entry**)
realloc(table->bins, new_num_bins * sizeof(st_table_entry*));
realloc(table->bins, new_num_bins * sizeof(st_table_entry*));
for (i = 0; i < new_num_bins; ++i) new_bins[i] = 0;
table->num_bins = new_num_bins;
table->bins = new_bins;
if ((ptr = table->head) != 0) {
do {
hash_val = ptr->hash % new_num_bins;
ptr->next = new_bins[hash_val];
new_bins[hash_val] = ptr;
} while ((ptr = ptr->fore) != 0);
do {
hash_val = ptr->hash % new_num_bins;
ptr->next = new_bins[hash_val];
new_bins[hash_val] = ptr;
} while ((ptr = ptr->fore) != 0);
}
}
@@ -329,55 +329,55 @@ st_copy(st_table *old_table)
new_table = alloc(st_table);
if (new_table == 0) {
return 0;
return 0;
}
*new_table = *old_table;
new_table->bins = (st_table_entry**)
Calloc((unsigned)num_bins, sizeof(st_table_entry*));
Calloc((unsigned)num_bins, sizeof(st_table_entry*));
if (new_table->bins == 0) {
free(new_table);
return 0;
free(new_table);
return 0;
}
if ((ptr = old_table->head) != 0) {
prev = 0;
tail = &new_table->head;
do {
entry = alloc(st_table_entry);
if (entry == 0) {
st_free_table(new_table);
return 0;
}
*entry = *ptr;
hash_val = entry->hash % num_bins;
entry->next = new_table->bins[hash_val];
new_table->bins[hash_val] = entry;
entry->back = prev;
*tail = prev = entry;
tail = &entry->fore;
} while ((ptr = ptr->fore) != 0);
new_table->tail = prev;
prev = 0;
tail = &new_table->head;
do {
entry = alloc(st_table_entry);
if (entry == 0) {
st_free_table(new_table);
return 0;
}
*entry = *ptr;
hash_val = entry->hash % num_bins;
entry->next = new_table->bins[hash_val];
new_table->bins[hash_val] = entry;
entry->back = prev;
*tail = prev = entry;
tail = &entry->fore;
} while ((ptr = ptr->fore) != 0);
new_table->tail = prev;
}
return new_table;
}
#define REMOVE_ENTRY(table, ptr) do \
{ \
if (ptr->fore == 0 && ptr->back == 0) { \
table->head = 0; \
table->tail = 0; \
} \
else { \
st_table_entry *fore = ptr->fore, *back = ptr->back; \
if (fore) fore->back = back; \
if (back) back->fore = fore; \
if (ptr == table->head) table->head = fore; \
if (ptr == table->tail) table->tail = back; \
} \
table->num_entries--; \
#define REMOVE_ENTRY(table, ptr) do \
{ \
if (ptr->fore == 0 && ptr->back == 0) { \
table->head = 0; \
table->tail = 0; \
} \
else { \
st_table_entry *fore = ptr->fore, *back = ptr->back; \
if (fore) fore->back = back; \
if (back) back->fore = fore; \
if (ptr == table->head) table->head = fore; \
if (ptr == table->tail) table->tail = back; \
} \
table->num_entries--; \
} while (0)
int
@@ -389,14 +389,14 @@ st_delete(register st_table *table, register st_data_t *key, st_data_t *value)
hash_val = do_hash_bin(*key, table);
for (prev = &table->bins[hash_val]; (ptr = *prev) != 0; prev = &ptr->next) {
if (EQUAL(table, *key, ptr->key)) {
*prev = ptr->next;
REMOVE_ENTRY(table, ptr);
if (value != 0) *value = ptr->record;
*key = ptr->key;
free(ptr);
return 1;
}
if (EQUAL(table, *key, ptr->key)) {
*prev = ptr->next;
REMOVE_ENTRY(table, ptr);
if (value != 0) *value = ptr->record;
*key = ptr->key;
free(ptr);
return 1;
}
}
if (value != 0) *value = 0;
@@ -411,40 +411,40 @@ st_foreach(st_table *table, int (*func)(ANYARGS), st_data_t arg)
st_index_t i;
if ((ptr = table->head) != 0) {
do {
i = ptr->hash % table->num_bins;
retval = (*func)(ptr->key, ptr->record, (void*)arg);
switch (retval) {
case ST_CHECK: /* check if hash is modified during iteration */
for (tmp = table->bins[i]; tmp != ptr; tmp = tmp->next) {
if (!tmp) {
/* call func with error notice */
retval = (*func)(0, 0, arg, 1);
return 1;
}
}
/* fall through */
default:
case ST_CONTINUE:
ptr = ptr->fore;
break;
case ST_STOP:
return 0;
case ST_DELETE:
last = &table->bins[ptr->hash % table->num_bins];
for (; (tmp = *last) != 0; last = &tmp->next) {
if (ptr == tmp) {
tmp = ptr->fore;
*last = ptr->next;
REMOVE_ENTRY(table, ptr);
free(ptr);
if (ptr == tmp) return 0;
ptr = tmp;
break;
}
}
}
} while (ptr && table->head);
do {
i = ptr->hash % table->num_bins;
retval = (*func)(ptr->key, ptr->record, (void*)arg);
switch (retval) {
case ST_CHECK: /* check if hash is modified during iteration */
for (tmp = table->bins[i]; tmp != ptr; tmp = tmp->next) {
if (!tmp) {
/* call func with error notice */
retval = (*func)(0, 0, arg, 1);
return 1;
}
}
/* fall through */
default:
case ST_CONTINUE:
ptr = ptr->fore;
break;
case ST_STOP:
return 0;
case ST_DELETE:
last = &table->bins[ptr->hash % table->num_bins];
for (; (tmp = *last) != 0; last = &tmp->next) {
if (ptr == tmp) {
tmp = ptr->fore;
*last = ptr->next;
REMOVE_ENTRY(table, ptr);
free(ptr);
if (ptr == tmp) return 0;
ptr = tmp;
break;
}
}
}
} while (ptr && table->head);
}
return 0;
}
@@ -458,19 +458,19 @@ strhash(const char *string)
register unsigned int h = 0, g;
while ((c = *string++) != '\0') {
h = ( h << 4 ) + c;
if ( g = h & 0xF0000000 )
h ^= g >> 24;
h &= ~g;
h = ( h << 4 ) + c;
if ( g = h & 0xF0000000 )
h ^= g >> 24;
h &= ~g;
}
return h;
#elif defined(HASH_PERL)
register int val = 0;
while ((c = *string++) != '\0') {
val += c;
val += (val << 10);
val ^= (val >> 6);
val += c;
val += (val << 10);
val ^= (val >> 6);
}
val += (val << 3);
val ^= (val >> 11);
@@ -480,7 +480,7 @@ strhash(const char *string)
register int val = 0;
while ((c = *string++) != '\0') {
val = val*997 + c;
val = val*997 + c;
}
return val + (val>>5);
@@ -549,12 +549,12 @@ strcasehash(st_data_t arg)
* FNV-1a hash each octet in the buffer
*/
while (*string) {
unsigned int c = (unsigned char)*string++;
if ((unsigned int)(c - 'A') <= ('Z' - 'A')) c += 'a' - 'A';
hval ^= c;
unsigned int c = (unsigned char)*string++;
if ((unsigned int)(c - 'A') <= ('Z' - 'A')) c += 'a' - 'A';
hval ^= c;
/* multiply by the 32 bit FNV magic prime mod 2^32 */
hval *= FNV_32_PRIME;
/* multiply by the 32 bit FNV magic prime mod 2^32 */
hval *= FNV_32_PRIME;
}
return hval;
}
+4 -4
View File
@@ -84,11 +84,11 @@ int st_strncasecmp(const char *s1, const char *s2, size_t n);
#define STRCASECMP(s1, s2) (st_strcasecmp(s1, s2))
#define STRNCASECMP(s1, s2, n) (st_strncasecmp(s1, s2, n))
#define ST_NUMCMP ((int (*)()) 0)
#define ST_NUMHASH ((int (*)()) -2)
#define ST_NUMCMP ((int (*)()) 0)
#define ST_NUMHASH ((int (*)()) -2)
#define st_numcmp ST_NUMCMP
#define st_numhash ST_NUMHASH
#define st_numcmp ST_NUMCMP
#define st_numhash ST_NUMHASH
int st_strhash();
+1 -1
View File
@@ -1,6 +1,6 @@
/*
** state.c - RiteVM open/close functions
**
**
** See Copyright Notice in mruby.h
*/
+1 -1
View File
@@ -1,6 +1,6 @@
/*
** string.c - String class
**
**
** See Copyright Notice in mruby.h
*/
+1 -1
View File
@@ -1,6 +1,6 @@
/*
** struct.c - Struct class
**
**
** See Copyright Notice in mruby.h
*/
+1 -1
View File
@@ -1,6 +1,6 @@
/*
** symbol.c - Symbol class
**
**
** See Copyright Notice in mruby.h
*/
+1 -1
View File
@@ -3906,7 +3906,7 @@ econv_primitive_errinfo(mrb_state *mrb, mrb_value self)
static mrb_value
econv_insert_output(mrb_state *mrb, mrb_value self)
{
mrb_value string;
mrb_value string;
const char *insert_enc;
int ret;
+28 -28
View File
@@ -22,20 +22,20 @@
#define PType (unsigned int)
#define NOMAP (PType 0x01) /* direct map */
#define ONEbt (0x02) /* one byte payload */
#define TWObt (0x03) /* two bytes payload */
#define THREEbt (0x05) /* three bytes payload */
#define FOURbt (0x06) /* four bytes payload, UTF-8 only, macros start at getBT0 */
#define INVALID (PType 0x07) /* invalid byte sequence */
#define UNDEF (PType 0x09) /* legal but undefined */
#define ZERObt (PType 0x0A) /* zero bytes of payload, i.e. remove */
#define FUNii (PType 0x0B) /* function from info to info */
#define FUNsi (PType 0x0D) /* function from start to info */
#define FUNio (PType 0x0E) /* function from info to output */
#define FUNso (PType 0x0F) /* function from start to output */
#define STR1 (PType 0x11) /* string 4 <= len <= 259 bytes: 1byte length + content */
#define GB4bt (PType 0x12) /* GB18030 four bytes payload */
#define NOMAP (PType 0x01) /* direct map */
#define ONEbt (0x02) /* one byte payload */
#define TWObt (0x03) /* two bytes payload */
#define THREEbt (0x05) /* three bytes payload */
#define FOURbt (0x06) /* four bytes payload, UTF-8 only, macros start at getBT0 */
#define INVALID (PType 0x07) /* invalid byte sequence */
#define UNDEF (PType 0x09) /* legal but undefined */
#define ZERObt (PType 0x0A) /* zero bytes of payload, i.e. remove */
#define FUNii (PType 0x0B) /* function from info to info */
#define FUNsi (PType 0x0D) /* function from start to info */
#define FUNio (PType 0x0E) /* function from info to output */
#define FUNso (PType 0x0F) /* function from start to output */
#define STR1 (PType 0x11) /* string 4 <= len <= 259 bytes: 1byte length + content */
#define GB4bt (PType 0x12) /* GB18030 four bytes payload */
#define FUNsio (PType 0x13) /* function from start and info to output */
#define STR1_LENGTH(byte_addr) (unsigned int)(*(byte_addr) + 4)
@@ -43,24 +43,24 @@
#define makeSTR1(bi) (((bi) << 6) | STR1)
#define makeSTR1LEN(len) ((len)-4)
#define o1(b1) (PType((((unsigned char)(b1))<<8)|ONEbt))
#define o2(b1,b2) (PType((((unsigned char)(b1))<<8)|(((unsigned char)(b2))<<16)|TWObt))
#define o3(b1,b2,b3) (PType(((((unsigned char)(b1))<<8)|(((unsigned char)(b2))<<16)|(((unsigned int)(unsigned char)(b3))<<24)|THREEbt)&0xffffffffU))
#define o4(b0,b1,b2,b3) (PType(((((unsigned char)(b1))<<8)|(((unsigned char)(b2))<<16)|(((unsigned char)(b3))<<24)|((((unsigned char)(b0))&0x07)<<5)|FOURbt)&0xffffffffU))
#define o1(b1) (PType((((unsigned char)(b1))<<8)|ONEbt))
#define o2(b1,b2) (PType((((unsigned char)(b1))<<8)|(((unsigned char)(b2))<<16)|TWObt))
#define o3(b1,b2,b3) (PType(((((unsigned char)(b1))<<8)|(((unsigned char)(b2))<<16)|(((unsigned int)(unsigned char)(b3))<<24)|THREEbt)&0xffffffffU))
#define o4(b0,b1,b2,b3) (PType(((((unsigned char)(b1))<<8)|(((unsigned char)(b2))<<16)|(((unsigned char)(b3))<<24)|((((unsigned char)(b0))&0x07)<<5)|FOURbt)&0xffffffffU))
#define g4(b0,b1,b2,b3) (PType(((((unsigned char)(b0))<<8)|(((unsigned char)(b2))<<16)|((((unsigned char)(b1))&0x0f)<<24)|((((unsigned int)(unsigned char)(b3))&0x0f)<<28)|GB4bt)&0xffffffffU))
#define funsio(diff) (PType((((unsigned int)(diff))<<8)|FUNsio))
#define funsio(diff) (PType((((unsigned int)(diff))<<8)|FUNsio))
#define getBT1(a) ((unsigned char)((a)>> 8))
#define getBT2(a) ((unsigned char)((a)>>16))
#define getBT3(a) ((unsigned char)((a)>>24))
#define getBT0(a) (((unsigned char)((a)>> 5)&0x07)|0xF0) /* for UTF-8 only!!! */
#define getBT1(a) ((unsigned char)((a)>> 8))
#define getBT2(a) ((unsigned char)((a)>>16))
#define getBT3(a) ((unsigned char)((a)>>24))
#define getBT0(a) (((unsigned char)((a)>> 5)&0x07)|0xF0) /* for UTF-8 only!!! */
#define getGB4bt0(a) ((unsigned char)((a)>> 8))
#define getGB4bt1(a) ((((unsigned char)((a)>>24))&0x0F)|0x30)
#define getGB4bt2(a) ((unsigned char)((a)>>16))
#define getGB4bt3(a) ((((unsigned char)((a)>>28))&0x0F)|0x30)
#define getGB4bt0(a) ((unsigned char)((a)>> 8))
#define getGB4bt1(a) ((((unsigned char)((a)>>24))&0x0F)|0x30)
#define getGB4bt2(a) ((unsigned char)((a)>>16))
#define getGB4bt3(a) ((((unsigned char)((a)>>28))&0x0F)|0x30)
#define o2FUNii(b1,b2) (PType((((unsigned char)(b1))<<8)|(((unsigned char)(b2))<<16)|FUNii))
#define o2FUNii(b1,b2) (PType((((unsigned char)(b1))<<8)|(((unsigned char)(b2))<<16)|FUNii))
/* do we need these??? maybe not, can be done with simple tables */
#define ONETRAIL /* legal but undefined if one more trailing UTF-8 */
+145 -145
View File
@@ -2073,7 +2073,7 @@ onigenc_unicode_ctype_code_range(int ctype, const OnigCodePoint* ranges[])
extern int
onigenc_utf16_32_get_ctype_code_range(OnigCtype ctype, OnigCodePoint* sb_out,
const OnigCodePoint* ranges[],
struct OnigEncodingTypeST* enc ARG_UNUSED)
struct OnigEncodingTypeST* enc ARG_UNUSED)
{
*sb_out = 0x00;
return onigenc_unicode_ctype_code_range(ctype, ranges);
@@ -2246,15 +2246,15 @@ onigenc_unicode_mbc_case_fold(OnigEncoding enc,
if (onig_st_lookup(FoldTable, (st_data_t )code, (void* )&to) != 0) {
if (to->n == 1) {
return ONIGENC_CODE_TO_MBC(enc, to->code[0], fold);
return ONIGENC_CODE_TO_MBC(enc, to->code[0], fold);
}
else
{
rlen = 0;
for (i = 0; i < to->n; i++) {
len = ONIGENC_CODE_TO_MBC(enc, to->code[i], fold);
fold += len;
rlen += len;
len = ONIGENC_CODE_TO_MBC(enc, to->code[i], fold);
fold += len;
rlen += len;
}
return rlen;
}
@@ -2268,8 +2268,8 @@ onigenc_unicode_mbc_case_fold(OnigEncoding enc,
extern int
onigenc_unicode_apply_all_case_fold(OnigCaseFoldType flag,
OnigApplyAllCaseFoldFunc f, void* arg,
OnigEncoding enc ARG_UNUSED)
OnigApplyAllCaseFoldFunc f, void* arg,
OnigEncoding enc ARG_UNUSED)
{
const CaseUnfold_11_Type* p11;
OnigCodePoint code;
@@ -2289,11 +2289,11 @@ onigenc_unicode_apply_all_case_fold(OnigCaseFoldType flag,
if (r != 0) return r;
for (k = 0; k < j; k++) {
r = (*f)(p11->to.code[j], (OnigCodePoint* )(&p11->to.code[k]), 1, arg);
if (r != 0) return r;
r = (*f)(p11->to.code[j], (OnigCodePoint* )(&p11->to.code[k]), 1, arg);
if (r != 0) return r;
r = (*f)(p11->to.code[k], (OnigCodePoint* )(&p11->to.code[j]), 1, arg);
if (r != 0) return r;
r = (*f)(p11->to.code[k], (OnigCodePoint* )(&p11->to.code[j]), 1, arg);
if (r != 0) return r;
}
}
}
@@ -2319,23 +2319,23 @@ onigenc_unicode_apply_all_case_fold(OnigCaseFoldType flag,
for (i = 0; i < numberof(CaseUnfold_11_Locale); i++) {
p11 = &CaseUnfold_11_Locale[i];
for (j = 0; j < p11->to.n; j++) {
code = p11->from;
r = (*f)(p11->to.code[j], &code, 1, arg);
if (r != 0) return r;
code = p11->from;
r = (*f)(p11->to.code[j], &code, 1, arg);
if (r != 0) return r;
code = p11->to.code[j];
r = (*f)(p11->from, &code, 1, arg);
if (r != 0) return r;
code = p11->to.code[j];
r = (*f)(p11->from, &code, 1, arg);
if (r != 0) return r;
for (k = 0; k < j; k++) {
r = (*f)(p11->to.code[j], (OnigCodePoint* )(&p11->to.code[k]),
1, arg);
if (r != 0) return r;
for (k = 0; k < j; k++) {
r = (*f)(p11->to.code[j], (OnigCodePoint* )(&p11->to.code[k]),
1, arg);
if (r != 0) return r;
r = (*f)(p11->to.code[k], (OnigCodePoint* )(&p11->to.code[j]),
1, arg);
if (r != 0) return r;
}
r = (*f)(p11->to.code[k], (OnigCodePoint* )(&p11->to.code[j]),
1, arg);
if (r != 0) return r;
}
}
}
#ifdef USE_UNICODE_CASE_FOLD_TURKISH_AZERI
@@ -2345,17 +2345,17 @@ onigenc_unicode_apply_all_case_fold(OnigCaseFoldType flag,
if ((flag & INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR) != 0) {
for (i = 0; i < numberof(CaseUnfold_12); i++) {
for (j = 0; j < CaseUnfold_12[i].to.n; j++) {
r = (*f)(CaseUnfold_12[i].to.code[j],
(OnigCodePoint* )CaseUnfold_12[i].from, 2, arg);
if (r != 0) return r;
r = (*f)(CaseUnfold_12[i].to.code[j],
(OnigCodePoint* )CaseUnfold_12[i].from, 2, arg);
if (r != 0) return r;
for (k = 0; k < CaseUnfold_12[i].to.n; k++) {
if (k == j) continue;
for (k = 0; k < CaseUnfold_12[i].to.n; k++) {
if (k == j) continue;
r = (*f)(CaseUnfold_12[i].to.code[j],
(OnigCodePoint* )(&CaseUnfold_12[i].to.code[k]), 1, arg);
if (r != 0) return r;
}
r = (*f)(CaseUnfold_12[i].to.code[j],
(OnigCodePoint* )(&CaseUnfold_12[i].to.code[k]), 1, arg);
if (r != 0) return r;
}
}
}
@@ -2363,20 +2363,20 @@ onigenc_unicode_apply_all_case_fold(OnigCaseFoldType flag,
if ((flag & ONIGENC_CASE_FOLD_TURKISH_AZERI) == 0) {
#endif
for (i = 0; i < numberof(CaseUnfold_12_Locale); i++) {
for (j = 0; j < CaseUnfold_12_Locale[i].to.n; j++) {
r = (*f)(CaseUnfold_12_Locale[i].to.code[j],
(OnigCodePoint* )CaseUnfold_12_Locale[i].from, 2, arg);
if (r != 0) return r;
for (j = 0; j < CaseUnfold_12_Locale[i].to.n; j++) {
r = (*f)(CaseUnfold_12_Locale[i].to.code[j],
(OnigCodePoint* )CaseUnfold_12_Locale[i].from, 2, arg);
if (r != 0) return r;
for (k = 0; k < CaseUnfold_12_Locale[i].to.n; k++) {
if (k == j) continue;
for (k = 0; k < CaseUnfold_12_Locale[i].to.n; k++) {
if (k == j) continue;
r = (*f)(CaseUnfold_12_Locale[i].to.code[j],
(OnigCodePoint* )(&CaseUnfold_12_Locale[i].to.code[k]),
1, arg);
if (r != 0) return r;
}
}
r = (*f)(CaseUnfold_12_Locale[i].to.code[j],
(OnigCodePoint* )(&CaseUnfold_12_Locale[i].to.code[k]),
1, arg);
if (r != 0) return r;
}
}
}
#ifdef USE_UNICODE_CASE_FOLD_TURKISH_AZERI
}
@@ -2384,17 +2384,17 @@ onigenc_unicode_apply_all_case_fold(OnigCaseFoldType flag,
for (i = 0; i < numberof(CaseUnfold_13); i++) {
for (j = 0; j < CaseUnfold_13[i].to.n; j++) {
r = (*f)(CaseUnfold_13[i].to.code[j],
(OnigCodePoint* )CaseUnfold_13[i].from, 3, arg);
if (r != 0) return r;
r = (*f)(CaseUnfold_13[i].to.code[j],
(OnigCodePoint* )CaseUnfold_13[i].from, 3, arg);
if (r != 0) return r;
for (k = 0; k < CaseUnfold_13[i].to.n; k++) {
if (k == j) continue;
for (k = 0; k < CaseUnfold_13[i].to.n; k++) {
if (k == j) continue;
r = (*f)(CaseUnfold_13[i].to.code[j],
(OnigCodePoint* )(&CaseUnfold_13[i].to.code[k]), 1, arg);
if (r != 0) return r;
}
r = (*f)(CaseUnfold_13[i].to.code[j],
(OnigCodePoint* )(&CaseUnfold_13[i].to.code[k]), 1, arg);
if (r != 0) return r;
}
}
}
}
@@ -2459,14 +2459,14 @@ onigenc_unicode_get_case_fold_codes_by_str(OnigEncoding enc,
code = to->code[0];
if (onig_st_lookup(Unfold1Table, (st_data_t )code, (void* )&to) != 0) {
for (i = 0; i < to->n; i++) {
if (to->code[i] != orig_code) {
items[n].byte_len = len;
items[n].code_len = 1;
items[n].code[0] = to->code[i];
n++;
}
}
for (i = 0; i < to->n; i++) {
if (to->code[i] != orig_code) {
items[n].byte_len = len;
items[n].code_len = 1;
items[n].code[0] = to->code[i];
n++;
}
}
}
}
else if ((flag & INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR) != 0) {
@@ -2474,66 +2474,66 @@ onigenc_unicode_get_case_fold_codes_by_str(OnigEncoding enc,
int fn, ncs[3];
for (fn = 0; fn < to->n; fn++) {
cs[fn][0] = to->code[fn];
if (onig_st_lookup(Unfold1Table, (st_data_t )cs[fn][0],
(void* )&z3) != 0) {
for (i = 0; i < z3->n; i++) {
cs[fn][i+1] = z3->code[i];
}
ncs[fn] = z3->n + 1;
}
else
ncs[fn] = 1;
cs[fn][0] = to->code[fn];
if (onig_st_lookup(Unfold1Table, (st_data_t )cs[fn][0],
(void* )&z3) != 0) {
for (i = 0; i < z3->n; i++) {
cs[fn][i+1] = z3->code[i];
}
ncs[fn] = z3->n + 1;
}
else
ncs[fn] = 1;
}
if (fn == 2) {
for (i = 0; i < ncs[0]; i++) {
for (j = 0; j < ncs[1]; j++) {
items[n].byte_len = len;
items[n].code_len = 2;
items[n].code[0] = cs[0][i];
items[n].code[1] = cs[1][j];
n++;
}
}
for (i = 0; i < ncs[0]; i++) {
for (j = 0; j < ncs[1]; j++) {
items[n].byte_len = len;
items[n].code_len = 2;
items[n].code[0] = cs[0][i];
items[n].code[1] = cs[1][j];
n++;
}
}
if (onig_st_lookup(Unfold2Table, (st_data_t )to->code,
(void* )&z2) != 0) {
for (i = 0; i < z2->n; i++) {
if (z2->code[i] == code) continue;
if (onig_st_lookup(Unfold2Table, (st_data_t )to->code,
(void* )&z2) != 0) {
for (i = 0; i < z2->n; i++) {
if (z2->code[i] == code) continue;
items[n].byte_len = len;
items[n].code_len = 1;
items[n].code[0] = z2->code[i];
n++;
}
}
items[n].byte_len = len;
items[n].code_len = 1;
items[n].code[0] = z2->code[i];
n++;
}
}
}
else {
for (i = 0; i < ncs[0]; i++) {
for (j = 0; j < ncs[1]; j++) {
for (k = 0; k < ncs[2]; k++) {
items[n].byte_len = len;
items[n].code_len = 3;
items[n].code[0] = cs[0][i];
items[n].code[1] = cs[1][j];
items[n].code[2] = cs[2][k];
n++;
}
}
}
for (i = 0; i < ncs[0]; i++) {
for (j = 0; j < ncs[1]; j++) {
for (k = 0; k < ncs[2]; k++) {
items[n].byte_len = len;
items[n].code_len = 3;
items[n].code[0] = cs[0][i];
items[n].code[1] = cs[1][j];
items[n].code[2] = cs[2][k];
n++;
}
}
}
if (onig_st_lookup(Unfold3Table, (st_data_t )to->code,
(void* )&z2) != 0) {
for (i = 0; i < z2->n; i++) {
if (z2->code[i] == code) continue;
if (onig_st_lookup(Unfold3Table, (st_data_t )to->code,
(void* )&z2) != 0) {
for (i = 0; i < z2->n; i++) {
if (z2->code[i] == code) continue;
items[n].byte_len = len;
items[n].code_len = 1;
items[n].code[0] = z2->code[i];
n++;
}
}
items[n].byte_len = len;
items[n].code_len = 1;
items[n].code[0] = z2->code[i];
n++;
}
}
}
/* multi char folded code is not head of another folded multi char */
@@ -2543,10 +2543,10 @@ onigenc_unicode_get_case_fold_codes_by_str(OnigEncoding enc,
else {
if (onig_st_lookup(Unfold1Table, (st_data_t )code, (void* )&to) != 0) {
for (i = 0; i < to->n; i++) {
items[n].byte_len = len;
items[n].code_len = 1;
items[n].code[0] = to->code[i];
n++;
items[n].byte_len = len;
items[n].code_len = 1;
items[n].code[0] = to->code[i];
n++;
}
}
}
@@ -2560,44 +2560,44 @@ onigenc_unicode_get_case_fold_codes_by_str(OnigEncoding enc,
codes[0] = code;
code = ONIGENC_MBC_TO_CODE(enc, p, end);
if (onig_st_lookup(FoldTable, (st_data_t )code, (void* )&to) != 0
&& to->n == 1) {
codes[1] = to->code[0];
&& to->n == 1) {
codes[1] = to->code[0];
}
else
codes[1] = code;
codes[1] = code;
clen = enclen(enc, p, end);
len += clen;
if (onig_st_lookup(Unfold2Table, (st_data_t )codes, (void* )&z2) != 0) {
for (i = 0; i < z2->n; i++) {
items[n].byte_len = len;
items[n].code_len = 1;
items[n].code[0] = z2->code[i];
n++;
}
for (i = 0; i < z2->n; i++) {
items[n].byte_len = len;
items[n].code_len = 1;
items[n].code[0] = z2->code[i];
n++;
}
}
p += clen;
if (p < end) {
code = ONIGENC_MBC_TO_CODE(enc, p, end);
if (onig_st_lookup(FoldTable, (st_data_t )code, (void* )&to) != 0
&& to->n == 1) {
codes[2] = to->code[0];
}
else
codes[2] = code;
code = ONIGENC_MBC_TO_CODE(enc, p, end);
if (onig_st_lookup(FoldTable, (st_data_t )code, (void* )&to) != 0
&& to->n == 1) {
codes[2] = to->code[0];
}
else
codes[2] = code;
clen = enclen(enc, p, end);
len += clen;
if (onig_st_lookup(Unfold3Table, (st_data_t )codes,
(void* )&z2) != 0) {
for (i = 0; i < z2->n; i++) {
items[n].byte_len = len;
items[n].code_len = 1;
items[n].code[0] = z2->code[i];
n++;
}
}
clen = enclen(enc, p, end);
len += clen;
if (onig_st_lookup(Unfold3Table, (st_data_t )codes,
(void* )&z2) != 0) {
for (i = 0; i < z2->n; i++) {
items[n].byte_len = len;
items[n].code_len = 1;
items[n].code[0] = z2->code[i];
n++;
}
}
}
}
}
+18 -18
View File
@@ -86,7 +86,7 @@ static const signed char trans[][0x100] = {
/* c */ F, F, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
/* d */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
/* e */ 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 3, 3,
/* f */ 5, 6, 6, 6, 7, F, F, F, F, F, F, F, F, F, F, F
/* f */ 5, 6, 6, 6, 7, F, F, F, F, F, F, F, F, F, F, F
},
{ /* S1 0 1 2 3 4 5 6 7 8 9 a b c d e f */
/* 0 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F,
@@ -104,7 +104,7 @@ static const signed char trans[][0x100] = {
/* c */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F,
/* d */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F,
/* e */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F,
/* f */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F
/* f */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F
},
{ /* S2 0 1 2 3 4 5 6 7 8 9 a b c d e f */
/* 0 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F,
@@ -122,7 +122,7 @@ static const signed char trans[][0x100] = {
/* c */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F,
/* d */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F,
/* e */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F,
/* f */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F
/* f */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F
},
{ /* S3 0 1 2 3 4 5 6 7 8 9 a b c d e f */
/* 0 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F,
@@ -140,7 +140,7 @@ static const signed char trans[][0x100] = {
/* c */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F,
/* d */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F,
/* e */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F,
/* f */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F
/* f */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F
},
{ /* S4 0 1 2 3 4 5 6 7 8 9 a b c d e f */
/* 0 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F,
@@ -158,7 +158,7 @@ static const signed char trans[][0x100] = {
/* c */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F,
/* d */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F,
/* e */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F,
/* f */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F
/* f */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F
},
{ /* S5 0 1 2 3 4 5 6 7 8 9 a b c d e f */
/* 0 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F,
@@ -176,7 +176,7 @@ static const signed char trans[][0x100] = {
/* c */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F,
/* d */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F,
/* e */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F,
/* f */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F
/* f */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F
},
{ /* S6 0 1 2 3 4 5 6 7 8 9 a b c d e f */
/* 0 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F,
@@ -194,7 +194,7 @@ static const signed char trans[][0x100] = {
/* c */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F,
/* d */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F,
/* e */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F,
/* f */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F
/* f */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F
},
{ /* S7 0 1 2 3 4 5 6 7 8 9 a b c d e f */
/* 0 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F,
@@ -212,7 +212,7 @@ static const signed char trans[][0x100] = {
/* c */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F,
/* d */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F,
/* e */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F,
/* f */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F
/* f */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F
},
};
#undef A
@@ -255,11 +255,11 @@ is_mbc_newline(const UChar* p, const UChar* end, OnigEncoding enc)
#endif
if (p + 1 < end) {
if (*(p+1) == 0x85 && *p == 0xc2) /* U+0085 */
return 1;
return 1;
if (p + 2 < end) {
if ((*(p+2) == 0xa8 || *(p+2) == 0xa9)
&& *(p+1) == 0x80 && *p == 0xe2) /* U+2028, U+2029 */
return 1;
if ((*(p+2) == 0xa8 || *(p+2) == 0xa9)
&& *(p+1) == 0x80 && *p == 0xe2) /* U+2028, U+2029 */
return 1;
}
}
#endif
@@ -371,7 +371,7 @@ code_to_mbc(OnigCodePoint code, UChar *buf, OnigEncoding enc ARG_UNUSED)
static int
mbc_case_fold(OnigCaseFoldType flag, const UChar** pp,
const UChar* end, UChar* fold, OnigEncoding enc)
const UChar* end, UChar* fold, OnigEncoding enc)
{
const UChar* p = *pp;
@@ -379,10 +379,10 @@ mbc_case_fold(OnigCaseFoldType flag, const UChar** pp,
#ifdef USE_UNICODE_CASE_FOLD_TURKISH_AZERI
if ((flag & ONIGENC_CASE_FOLD_TURKISH_AZERI) != 0) {
if (*p == 0x49) {
*fold++ = 0xc4;
*fold = 0xb1;
(*pp)++;
return 2;
*fold++ = 0xc4;
*fold = 0xb1;
(*pp)++;
return 2;
}
}
#endif
@@ -399,7 +399,7 @@ mbc_case_fold(OnigCaseFoldType flag, const UChar** pp,
static int
get_ctype_code_range(OnigCtype ctype, OnigCodePoint *sb_out,
const OnigCodePoint* ranges[], OnigEncoding enc ARG_UNUSED)
const OnigCodePoint* ranges[], OnigEncoding enc ARG_UNUSED)
{
*sb_out = 0x80;
return onigenc_unicode_ctype_code_range(ctype, ranges);
+7 -7
View File
@@ -1,6 +1,6 @@
/*
** variable.c - mruby variables
**
**
** See Copyright Notice in mruby.h
*/
@@ -165,7 +165,7 @@ mrb_vm_cv_get(mrb_state *mrb, mrb_sym sym)
khiter_t k = kh_get(iv, h, sym);
if (k != kh_end(h))
return kh_value(h, k);
return kh_value(h, k);
}
c = c->super;
}
@@ -184,8 +184,8 @@ mrb_vm_cv_set(mrb_state *mrb, mrb_sym sym, mrb_value v)
h = c->iv;
k = kh_get(iv, h, sym);
if (k != kh_end(h)) {
k = kh_put(iv, h, sym);
kh_value(h, k) = v;
k = kh_put(iv, h, sym);
kh_value(h, k) = v;
}
}
c = c->super;
@@ -244,7 +244,7 @@ const_get(mrb_state *mrb, struct RClass *base, mrb_sym sym)
h = c->iv;
k = kh_get(iv, h, sym);
if (k != kh_end(h)) {
return kh_value(h, k);
return kh_value(h, k);
}
}
}
@@ -254,13 +254,13 @@ const_get(mrb_state *mrb, struct RClass *base, mrb_sym sym)
h = c->iv;
k = kh_get(iv, h, sym);
if (k != kh_end(h)) {
return kh_value(h, k);
return kh_value(h, k);
}
}
c = c->super;
}
mrb_raise(mrb, E_NAME_ERROR, "uninitialized constant %s",
mrb_sym2name(mrb, sym));
mrb_sym2name(mrb, sym));
/* not reached */
return mrb_nil_value();
}
+1 -1
View File
@@ -1,6 +1,6 @@
/*
** version.c - version information
**
**
** See Copyright Notice in mruby.h
*/
+1 -1
View File
@@ -1,6 +1,6 @@
/*
** version.h - version information
**
**
** See Copyright Notice in mruby.h
*/
+408 -408
View File
File diff suppressed because it is too large Load Diff
+16 -16
View File
@@ -1,6 +1,6 @@
/*
** vm_core.h - RiteVM core
**
**
** See Copyright Notice in mruby.h
*/
@@ -130,12 +130,12 @@ typedef struct mrb_compile_option_struct {
} mrb_compile_option_t;
struct iseq_inline_cache_entry {
mrb_value ic_vmstat;
mrb_value ic_class;
mrb_value ic_vmstat;
mrb_value ic_class;
union {
mrb_value value;
mrb_method_entry_t *method;
long index;
mrb_value value;
mrb_method_entry_t *method;
long index;
} ic_value;
};
@@ -168,9 +168,9 @@ void mrb_objspace_free(struct mrb_objspace *);
#endif
typedef struct mrb_block_struct {
mrb_value self; /* share with method frame if it's only block */
mrb_value *lfp; /* share with method frame if it's only block */
mrb_value *dfp; /* share with method frame if it's only block */
mrb_value self; /* share with method frame if it's only block */
mrb_value *lfp; /* share with method frame if it's only block */
mrb_value *dfp; /* share with method frame if it's only block */
mrb_iseq_t *iseq;
mrb_value proc;
} mrb_block_t;
@@ -217,7 +217,7 @@ RUBY_EXTERN mrb_value mrb_mRubyVMFrozenCore;
typedef struct {
mrb_block_t block;
mrb_value envval; /* for GC mark */
mrb_value envval; /* for GC mark */
mrb_value blockprocval;
int safe_level;
int is_from_method;
@@ -231,11 +231,11 @@ typedef struct {
mrb_value *env;
int env_size;
int local_size;
mrb_value prev_envval; /* for GC mark */
mrb_value prev_envval; /* for GC mark */
mrb_block_t block;
} mrb_env_t;
//#define GetBindingPtr(obj, ptr)
//#define GetBindingPtr(obj, ptr)
// GetCoreDataFromValue(obj, mrb_binding_t, ptr)
//typedef struct {
@@ -330,7 +330,7 @@ void mrb_disable_interrupt(void);
//int mrb_thread_method_id_and_class(mrb_thread_t *th, mrb_sym *idp, mrb_value *klassp);
mrb_value mrb_vm_invoke_proc(mrb_thread_t *th, mrb_proc_t *proc, mrb_value self,
int argc, const mrb_value *argv, const mrb_block_t *blockptr);
int argc, const mrb_value *argv, const mrb_block_t *blockptr);
mrb_value mrb_vm_make_proc(mrb_thread_t *th, const mrb_block_t *block, mrb_value klass);
mrb_value mrb_vm_make_env_object(mrb_thread_t *th, mrb_control_frame_t *cfp);
@@ -400,9 +400,9 @@ void mrb_thread_lock_destroy(mrb_thread_lock_t *);
#define EXEC_EVENT_HOOK(th, flag, self, id, klass) do { \
mrb_event_flag_t wait_event__ = th->event_flags; \
if (UNLIKELY(wait_event__)) { \
if (wait_event__ & (flag | RUBY_EVENT_VM)) { \
mrb_threadptr_exec_event_hooks(th, flag, self, id, klass); \
} \
if (wait_event__ & (flag | RUBY_EVENT_VM)) { \
mrb_threadptr_exec_event_hooks(th, flag, self, id, klass); \
} \
} \
} while (0)
#endif
+18 -18
View File
@@ -65,23 +65,23 @@ parse_args(mrb_state *mrb, int argc, char **argv, struct _args *args)
break;
case 'e':
if (argc > 1) {
argc--; argv++;
if (!args->cmdline) {
char *buf;
argc--; argv++;
if (!args->cmdline) {
char *buf;
buf = mrb_malloc(mrb, strlen(argv[0])+1);
strcpy(buf, argv[0]);
args->cmdline = buf;
}
else {
args->cmdline = mrb_realloc(mrb, args->cmdline, strlen(args->cmdline)+strlen(argv[0])+2);
strcat(args->cmdline, "\n");
strcat(args->cmdline, argv[0]);
}
buf = mrb_malloc(mrb, strlen(argv[0])+1);
strcpy(buf, argv[0]);
args->cmdline = buf;
}
else {
args->cmdline = mrb_realloc(mrb, args->cmdline, strlen(args->cmdline)+strlen(argv[0])+2);
strcat(args->cmdline, "\n");
strcat(args->cmdline, argv[0]);
}
}
else {
printf("%s: No code specified for -e\n", *origargv);
return 0;
printf("%s: No code specified for -e\n", *origargv);
return 0;
}
break;
case 'v':
@@ -90,14 +90,14 @@ parse_args(mrb_state *mrb, int argc, char **argv, struct _args *args)
break;
case '-':
if (strcmp((*argv) + 2, "version") == 0) {
ruby_show_version(mrb);
ruby_show_version(mrb);
}
else if (strcmp((*argv) + 2, "verbose") == 0) {
args->verbose = 1;
break;
args->verbose = 1;
break;
}
else if (strcmp((*argv) + 2, "copyright") == 0) {
ruby_show_copyright(mrb);
ruby_show_copyright(mrb);
}
else return -3;
return 0;