Commit 7c908030 authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto

Merge pull request #79 from rystyle/whitespace

rm whitespace mix
parents 6b739d91 4ec6d41f
/*
** 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 */
/*
** 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 */
/*
** 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 */
/*
** cdump.h - mruby binary dumper (C source format)
**
**
** See Copyright Notice in mruby.h
*/
......
/*
** 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 */
/*
** 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*);
};
......
/*
** dump.h - mruby binary dumper (Rite binary format)
**
**
** See Copyright Notice in mruby.h
*/
......
/*
** 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};
......
/*
** 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 */
/*
** ritehash.c - Rite Hash for mruby
**
**
** See Copyright Notice in mruby.h
*/
......
/*
** 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 */
/*
** 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 */
/*
** 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 */
/*
** 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 */
/*
** string.h - String class
**
**
** See Copyright Notice in mruby.h
*/
......
/*
** struct.h - Struct class
**
**
** See Copyright Notice in mruby.h
*/
......
/*
** 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 */
/*
** array.c - Array class
**
**
** See Copyright Notice in mruby.h
*/
......
/*
** 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
......
/*
** 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 */
......
This diff is collapsed.
/*
** 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
......
/*
** 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
};
......
/*
** crc.c - calculate CRC
**
**
** See Copyright Notice in mruby.h
*/
......
/*
** 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;
}
......
/*
** 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";
......
/*
** 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
......
/*
** enum.c - Enumerable module
**
**
** See Copyright Notice in mruby.h
*/
......
/*
** 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
......
/*
** error.h - Exception class
**
**
** See Copyright Notice in mruby.h
*/
......
/*
** etc.c -
**
** etc.c -
**
** See Copyright Notice in mruby.h
*/
......
/*
** 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);
......
/*
** 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 */
......
/*
** gc.h - garbage collector for RiteVM
**
**
** See Copyright Notice in mruby.h
*/
......
/*
** hash.c - Hash class
**
**
** See Copyright Notice in mruby.h
*/
......
/*
** init.c - initialize mruby core
**
**
** See Copyright Notice in mruby.h
*/
......
/*
** init_ext.c - initialize extend libraries
**
**
** See Copyright Notice in mruby.h
*/
......
/*
** 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);
/* 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));
}
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));
}
}
}
}
......@@ -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;
......
/*
** 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;
......
/*
** method.h - method structures and functions
**
**
** See Copyright Notice in mruby.h
*/
......
/*
** 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;
......
This diff is collapsed.
/*
** node.h - nodes of abstract syntax tree
**
**
** See Copyright Notice in mruby.h
*/
......
/*
** numeric.c - Numeric, Integer, Float, Fixnum class
**
**
** See Copyright Notice in mruby.h
*/
......
/*
** object.c - Object, NilClass, TrueClass, FalseClass class
**
**
** See Copyright Notice in mruby.h
*/
......
This diff is collapsed.
/*
** 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;
......
/*
** pool.h - memory pool
**
**
** See Copyright Notice in mruby.h
*/
......
/*
** print.c - Kernel.#p
**
**
** See Copyright Notice in mruby.h
*/
......
/*
** proc.c - Proc class
**
**
** See Copyright Notice in mruby.h
*/
......
/*
** range.c - Range class
**
**
** See Copyright Notice in mruby.h
*/
......
/*
** re.c - Regexp class
**
**
** See Copyright Notice in mruby.h
*/
......
/*
** re.h - Regexp class
**
**
** See Copyright Notice in mruby.h
*/
......
This diff is collapsed.
......@@ -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;
}
......
......@@ -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
......
......@@ -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
/*
** regex.h - Regexp class
**
**
** See Copyright Notice in mruby.h
*/
......
This diff is collapsed.
......@@ -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 \
......
This diff is collapsed.
/*
** 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) \
......
This diff is collapsed.
......@@ -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();
......
/*
** state.c - RiteVM open/close functions
**
**
** See Copyright Notice in mruby.h
*/
......
/*
** string.c - String class
**
**
** See Copyright Notice in mruby.h
*/
......
/*
** struct.c - Struct class
**
**
** See Copyright Notice in mruby.h
*/
......
/*
** symbol.c - Symbol class
**
**
** See Copyright Notice in mruby.h
*/
......
......@@ -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;
......
......@@ -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 */
......
This diff is collapsed.
......@@ -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);
......
/*
** 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();
}
......
/*
** version.c - version information
**
**
** See Copyright Notice in mruby.h
*/
......
/*
** version.h - version information
**
**
** See Copyright Notice in mruby.h
*/
......
This diff is collapsed.
/*
** 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
......
......@@ -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;
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]);
}
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]);
}
}
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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment