mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Merge branch 'master' of git://github.com/mruby/mruby into XCode
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
# makefile discription.
|
||||
# basic build file for mruby
|
||||
|
||||
# compiler, linker (gcc)
|
||||
CC = gcc
|
||||
LL = gcc
|
||||
# compiler, linker (gcc), archiver, parser generator
|
||||
export CC = gcc
|
||||
export LL = gcc
|
||||
export AR = ar
|
||||
export YACC = bison
|
||||
|
||||
DEBUG_MODE = 1
|
||||
ifeq ($(DEBUG_MODE),1)
|
||||
CFLAGS = -g -O3
|
||||
@@ -17,6 +20,16 @@ else
|
||||
MAKE_FLAGS = --no-print-directory CC='$(CC)' LL='$(LL)' ALL_CFLAGS='$(ALL_CFLAGS)'
|
||||
endif
|
||||
|
||||
##############################
|
||||
# internal variables
|
||||
|
||||
export MSG_BEGIN = @for line in
|
||||
export MSG_END = ; do echo "$$line"; done
|
||||
|
||||
export CP := cp
|
||||
export RM_F := rm -f
|
||||
export CAT := cat
|
||||
|
||||
##############################
|
||||
# generic build targets, rules
|
||||
|
||||
@@ -39,3 +52,29 @@ clean :
|
||||
@$(MAKE) clean -C tools/mruby $(MAKE_FLAGS)
|
||||
@$(MAKE) clean -C tools/mirb $(MAKE_FLAGS)
|
||||
@$(MAKE) clean -C test $(MAKE_FLAGS)
|
||||
|
||||
# display help for build configuration and interesting targets
|
||||
.PHONY : showconfig
|
||||
showconfig :
|
||||
$(MSG_BEGIN) \
|
||||
"" \
|
||||
" CC = $(CC)" \
|
||||
" LL = $(LL)" \
|
||||
" MAKE = $(MAKE)" \
|
||||
"" \
|
||||
" CFLAGS = $(CFLAGS)" \
|
||||
" ALL_CFLAGS = $(ALL_CFLAGS)" \
|
||||
$(MSG_END)
|
||||
|
||||
.PHONY : help
|
||||
help :
|
||||
$(MSG_BEGIN) \
|
||||
"" \
|
||||
" Basic mruby Makefile" \
|
||||
"" \
|
||||
"targets:" \
|
||||
" all (default): build all targets, install (locally) in-repo" \
|
||||
" clean: clean all built and in-repo installed artifacts" \
|
||||
" showconfig: show build config summary" \
|
||||
" test: run all mruby tests" \
|
||||
$(MSG_END)
|
||||
|
||||
@@ -45,12 +45,10 @@ else()
|
||||
endif()
|
||||
|
||||
|
||||
add_library(mrblib_object OBJECT mrblib.c)
|
||||
|
||||
# generate final static libmruby archive library
|
||||
add_library(libmruby_static STATIC
|
||||
mrblib.c
|
||||
$<TARGET_OBJECTS:mruby_object>
|
||||
$<TARGET_OBJECTS:mrblib_object>
|
||||
)
|
||||
set_target_properties(libmruby_static PROPERTIES OUTPUT_NAME mruby)
|
||||
|
||||
|
||||
+8
-9
@@ -15,17 +15,15 @@ MRBS := $(MRB1)
|
||||
LIBR0 := ../lib/libmruby_core.a
|
||||
LIBR := ../lib/libmruby.a
|
||||
|
||||
# C compiler (gcc)
|
||||
CC = gcc
|
||||
LL = gcc
|
||||
AR = ar
|
||||
# libraries, includes
|
||||
INCLUDES = -I../src -I../include
|
||||
|
||||
DEBUG_MODE = 1
|
||||
ifeq ($(DEBUG_MODE),1)
|
||||
CFLAGS = -g
|
||||
else
|
||||
CFLAGS = -O3
|
||||
endif
|
||||
INCLUDES = -I../src -I../include
|
||||
ALL_CFLAGS = -Wall -Werror-implicit-function-declaration $(CFLAGS)
|
||||
ifeq ($(OS),Windows_NT)
|
||||
MAKE_FLAGS = CC=$(CC) LL=$(LL) ALL_CFLAGS="$(ALL_CFLAGS)"
|
||||
@@ -40,6 +38,7 @@ else
|
||||
MRBC = ../bin/mrbc
|
||||
endif
|
||||
|
||||
|
||||
##############################
|
||||
# generic build targets, rules
|
||||
|
||||
@@ -48,7 +47,7 @@ all : $(LIBR)
|
||||
|
||||
# update libmruby.a
|
||||
$(LIBR) : $(MLIB) $(LIBR0)
|
||||
cp $(LIBR0) $(LIBR)
|
||||
$(CP) $(LIBR0) $(LIBR)
|
||||
$(AR) r $(LIBR) $(MLIB)
|
||||
|
||||
# Compile mrblib source
|
||||
@@ -57,17 +56,17 @@ $(MLIB) : $(CLIB)
|
||||
|
||||
# Compile C source from merged mruby source
|
||||
$(CLIB) : $(RLIB) $(MRBC)
|
||||
$(MRBC) -Bmrblib_irep -o$(DLIB) $(RLIB); cat init_$(TARGET).c $(DLIB) > $@
|
||||
$(MRBC) -Bmrblib_irep -o$(DLIB) $(RLIB); $(CAT) init_$(TARGET).c $(DLIB) > $@
|
||||
|
||||
$(MRBC) : ../src/opcode.h ../src/codegen.c ../src/parse.y
|
||||
$(MAKE) -C ../tools/mrbc $(MAKE_FLAGS)
|
||||
|
||||
# merge mruby sources
|
||||
$(RLIB) : $(MRBS)
|
||||
cat $? > $@
|
||||
$(CAT) $(MRBS) > $@
|
||||
|
||||
# clean up
|
||||
.PHONY : clean
|
||||
clean :
|
||||
@echo "make: removing targets, objects and depend files of `pwd`"
|
||||
-rm -f $(MRBC) $(MLIB) $(CLIB) $(RLIB) $(DLIB) $(DEPLIB) $(LIBR)
|
||||
-$(RM_F) $(MRBC) $(MLIB) $(CLIB) $(RLIB) $(DLIB) $(DEPLIB) $(LIBR)
|
||||
|
||||
+44
-8
@@ -1,5 +1,15 @@
|
||||
##
|
||||
# Comparable
|
||||
#
|
||||
# ISO 15.3.3
|
||||
module Comparable
|
||||
# 15.3.3.2.1
|
||||
|
||||
##
|
||||
# Return true if +self+ is less
|
||||
# than +other+. Otherwise return
|
||||
# false.
|
||||
#
|
||||
# ISO 15.3.3.2.1
|
||||
def < other
|
||||
cmp = self <=> other
|
||||
if cmp.nil?
|
||||
@@ -11,7 +21,12 @@ module Comparable
|
||||
end
|
||||
end
|
||||
|
||||
# 15.3.3.2.2
|
||||
##
|
||||
# Return true if +self+ is less
|
||||
# than or equal to +other+.
|
||||
# Otherwise return false.
|
||||
#
|
||||
# ISO 15.3.3.2.2
|
||||
def <= other
|
||||
cmp = self <=> other
|
||||
if cmp.nil?
|
||||
@@ -23,7 +38,12 @@ module Comparable
|
||||
end
|
||||
end
|
||||
|
||||
# 15.3.3.2.3
|
||||
##
|
||||
# Return true if +self+ is equal
|
||||
# to +other+. Otherwise return
|
||||
# false.
|
||||
#
|
||||
# ISO 15.3.3.2.3
|
||||
def == other
|
||||
cmp = self <=> other
|
||||
if cmp == 0
|
||||
@@ -33,7 +53,12 @@ module Comparable
|
||||
end
|
||||
end
|
||||
|
||||
# 15.3.3.2.4
|
||||
##
|
||||
# Return true if +self+ is greater
|
||||
# than +other+. Otherwise return
|
||||
# false.
|
||||
#
|
||||
# ISO 15.3.3.2.4
|
||||
def > other
|
||||
cmp = self <=> other
|
||||
if cmp.nil?
|
||||
@@ -45,9 +70,14 @@ module Comparable
|
||||
end
|
||||
end
|
||||
|
||||
# 15.3.3.2.5
|
||||
##
|
||||
# Return true if +self+ is greater
|
||||
# than or equal to +other+.
|
||||
# Otherwise return false.
|
||||
#
|
||||
# ISO 15.3.3.2.5
|
||||
def >= other
|
||||
cmp = self <=> other
|
||||
cmp = self <=> other
|
||||
if cmp.nil?
|
||||
false
|
||||
elsif cmp >= 0
|
||||
@@ -57,8 +87,14 @@ module Comparable
|
||||
end
|
||||
end
|
||||
|
||||
# 15.3.3.2.6
|
||||
def between?(min,max)
|
||||
##
|
||||
# Return true if +self+ is greater
|
||||
# than or equal to +min+ and
|
||||
# less than or equal to +max+.
|
||||
# Otherwise return false.
|
||||
#
|
||||
# ISO 15.3.3.2.6
|
||||
def between?(min, max)
|
||||
if self < min or self > max
|
||||
false
|
||||
else
|
||||
|
||||
@@ -7,6 +7,5 @@ file(GLOB MRUBY_SRC_C "*.c")
|
||||
list(APPEND MRUBY_SRC_C "${CMAKE_CURRENT_BINARY_DIR}/parse.c")
|
||||
|
||||
add_library(mruby_object OBJECT ${MRUBY_SRC_C} ${BISON_mruby_OUTPUTS})
|
||||
add_library(mruby_static STATIC EXCLUDE_FROM_ALL $<TARGET_OBJECTS:mruby_object>)
|
||||
|
||||
# vim: ts=2 sts=2 sw=2 et
|
||||
|
||||
+4
-9
@@ -19,12 +19,6 @@ OBJS := $(OBJ1) $(OBJ2) $(OBJ3)
|
||||
# libraries, includes
|
||||
INCLUDES = -I$(BASEDIR) -I$(BASEDIR)/../include
|
||||
|
||||
# compiler, linker (gcc)
|
||||
CC = gcc
|
||||
LL = gcc
|
||||
AR = ar
|
||||
YACC = bison
|
||||
|
||||
DEBUG_MODE = 1
|
||||
ifeq ($(DEBUG_MODE),1)
|
||||
CFLAGS = -g -O3
|
||||
@@ -33,6 +27,7 @@ CFLAGS = -O3
|
||||
endif
|
||||
ALL_CFLAGS = -Wall -Werror-implicit-function-declaration $(CFLAGS)
|
||||
|
||||
|
||||
##############################
|
||||
# generic build targets, rules
|
||||
|
||||
@@ -64,6 +59,6 @@ $(LDEF) : $(KWD)
|
||||
.PHONY : clean #cleandep
|
||||
clean :
|
||||
@echo "make: removing targets, objects and depend files of `pwd`"
|
||||
-rm -f $(TARGET) $(OBJS) $(OBJY) $(YC)
|
||||
-rm -f $(OBJS:.o=.d) $(OBJY:.o=.d)
|
||||
-rm -f $(patsubst %.c,%.o,$(EXCEPT1)) $(patsubst %.c,%.d,$(EXCEPT1))
|
||||
-$(RM_F) $(TARGET) $(OBJS) $(OBJY) $(YC)
|
||||
-$(RM_F) $(OBJS:.o=.d) $(OBJY:.o=.d)
|
||||
-$(RM_F) $(patsubst %.c,%.o,$(EXCEPT1)) $(patsubst %.c,%.d,$(EXCEPT1))
|
||||
|
||||
+3
-15
@@ -917,22 +917,10 @@ mrb_ary_join(mrb_state *mrb, mrb_value ary, mrb_value sep)
|
||||
static mrb_value
|
||||
mrb_ary_join_m(mrb_state *mrb, mrb_value ary)
|
||||
{
|
||||
mrb_value *argv;
|
||||
int argc;
|
||||
mrb_value sep = mrb_nil_value();
|
||||
|
||||
mrb_get_args(mrb, "*", &argv, &argc);
|
||||
switch(argc) {
|
||||
case 0:
|
||||
return mrb_ary_join(mrb, ary, mrb_nil_value());
|
||||
|
||||
case 1:
|
||||
return mrb_ary_join(mrb, ary, argv[0]);
|
||||
|
||||
default:
|
||||
mrb_raise(mrb, E_ARGUMENT_ERROR, "wrong number of arguments");
|
||||
}
|
||||
|
||||
return mrb_nil_value(); /* dummy */
|
||||
mrb_get_args(mrb, "|o", &sep);
|
||||
return mrb_ary_join(mrb, ary, sep);
|
||||
}
|
||||
|
||||
static mrb_value
|
||||
|
||||
+1
-1
@@ -578,7 +578,7 @@ mrb_get_args(mrb_state *mrb, const char *format, ...)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!*format && argc > i) {
|
||||
if (!c && argc > i) {
|
||||
mrb_raise(mrb, E_ARGUMENT_ERROR, "wrong number of arguments");
|
||||
}
|
||||
va_end(ap);
|
||||
|
||||
+10
-7
@@ -64,6 +64,7 @@ typedef struct scope {
|
||||
|
||||
int nlocals;
|
||||
int nregs;
|
||||
int ai;
|
||||
|
||||
int idx;
|
||||
} codegen_scope;
|
||||
@@ -1234,25 +1235,25 @@ codegen(codegen_scope *s, node *tree, int val)
|
||||
int idx = new_msym(s, sym);
|
||||
|
||||
if (name[0] == '+' && strlen(name) == 1) {
|
||||
genop(s, MKOP_ABC(OP_ADD, cursp(), idx, 2));
|
||||
genop(s, MKOP_ABC(OP_ADD, cursp(), idx, 1));
|
||||
}
|
||||
else if (name[0] == '-' && strlen(name) == 1) {
|
||||
genop(s, MKOP_ABC(OP_SUB, cursp(), idx, 2));
|
||||
genop(s, MKOP_ABC(OP_SUB, cursp(), idx, 1));
|
||||
}
|
||||
else if (name[0] == '<' && strlen(name) == 1) {
|
||||
genop(s, MKOP_ABC(OP_LT, cursp(), idx, 2));
|
||||
genop(s, MKOP_ABC(OP_LT, cursp(), idx, 1));
|
||||
}
|
||||
else if (name[0] == '<' && strlen(name) == 2 && name[1] == '=') {
|
||||
genop(s, MKOP_ABC(OP_LE, cursp(), idx, 2));
|
||||
genop(s, MKOP_ABC(OP_LE, cursp(), idx, 1));
|
||||
}
|
||||
else if (name[0] == '>' && strlen(name) == 1) {
|
||||
genop(s, MKOP_ABC(OP_GT, cursp(), idx, 2));
|
||||
genop(s, MKOP_ABC(OP_GT, cursp(), idx, 1));
|
||||
}
|
||||
else if (name[0] == '>' && strlen(name) == 2 && name[1] == '=') {
|
||||
genop(s, MKOP_ABC(OP_GE, cursp(), idx, 2));
|
||||
genop(s, MKOP_ABC(OP_GE, cursp(), idx, 1));
|
||||
}
|
||||
else {
|
||||
genop(s, MKOP_ABC(OP_SEND, cursp(), idx, 2));
|
||||
genop(s, MKOP_ABC(OP_SEND, cursp(), idx, 1));
|
||||
}
|
||||
}
|
||||
gen_assignment(s, tree->car, cursp(), val);
|
||||
@@ -1849,6 +1850,7 @@ scope_new(mrb_state *mrb, codegen_scope *prev, node *lv)
|
||||
p->lv = lv;
|
||||
p->sp += node_len(lv)+2;
|
||||
p->nlocals = p->sp;
|
||||
p->ai = mrb->arena_idx;
|
||||
|
||||
p->idx = mrb->irep_len++;
|
||||
|
||||
@@ -1882,6 +1884,7 @@ scope_finish(codegen_scope *s, int idx)
|
||||
irep->nlocals = s->nlocals;
|
||||
irep->nregs = s->nregs;
|
||||
|
||||
s->mrb->arena_idx = s->ai;
|
||||
mrb_pool_close(s->mpool);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -443,7 +443,7 @@ mrb_init_exception(mrb_state *mrb)
|
||||
#ifdef INCLUDE_ENCODING
|
||||
mrb_define_class(mrb, "EncodingError", mrb->eStandardError_class);
|
||||
#endif
|
||||
mrb_define_class(mrb, "ZeroDivisionError", mrb->eStandardError_class); /* 15.2.30 */
|
||||
// mrb_define_class(mrb, "ZeroDivisionError", mrb->eStandardError_class); /* 15.2.30 */
|
||||
|
||||
mrb_define_class(mrb, "FloatDomainError", eRangeError);
|
||||
mrb_define_class(mrb, "KeyError", eIndexError);
|
||||
|
||||
@@ -261,12 +261,13 @@ mrb_obj_alloc(mrb_state *mrb, enum mrb_vtype ttype, struct RClass *cls)
|
||||
}
|
||||
|
||||
mrb->live++;
|
||||
if (mrb->arena_idx > MRB_ARENA_SIZE) {
|
||||
/* arena overflow error */
|
||||
mrb->arena_idx = MRB_ARENA_SIZE - 2; /* force room in arena */
|
||||
mrb_raise(mrb, mrb->eRuntimeError_class, "arena overflow error");
|
||||
}
|
||||
mrb->arena[mrb->arena_idx++] = p;
|
||||
memset(p, 0, sizeof(RVALUE));
|
||||
if (mrb->arena_idx >= MRB_ARENA_SIZE) {
|
||||
/* arena overflow error */
|
||||
mrb_raise(mrb, E_TYPE_ERROR, "arena overflow error");
|
||||
}
|
||||
p->tt = ttype;
|
||||
p->c = cls;
|
||||
paint_partial_white(mrb, p);
|
||||
|
||||
+1
-3
@@ -1007,14 +1007,12 @@ mrb_hash_keys(mrb_state *mrb, mrb_value hash)
|
||||
{
|
||||
khash_t(ht) *h = RHASH_TBL(hash);
|
||||
khiter_t k;
|
||||
mrb_value ary = mrb_ary_new(mrb);
|
||||
mrb_value ary = mrb_ary_new_capa(mrb, kh_size(h));
|
||||
|
||||
if (!h) return ary;
|
||||
for (k = kh_begin(h); k != kh_end(h); k++) {
|
||||
if (kh_exist(h, k)) {
|
||||
mrb_value v = kh_key(h,k);
|
||||
if ( !mrb_special_const_p(v) )
|
||||
v = mrb_obj_dup(mrb, v);
|
||||
mrb_ary_push(mrb, ary, v);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -337,6 +337,7 @@ read_rite_irep_record(mrb_state *mrb, unsigned char *src, mrb_irep *irep, uint32
|
||||
mrb_int fix_num;
|
||||
mrb_float f;
|
||||
mrb_value str;
|
||||
int ai = mrb_gc_arena_save(mrb);
|
||||
|
||||
recordStart = src;
|
||||
buf = mrb_malloc(mrb, bufsize);
|
||||
@@ -489,6 +490,7 @@ read_rite_irep_record(mrb_state *mrb, unsigned char *src, mrb_irep *irep, uint32
|
||||
|
||||
*len = src - recordStart;
|
||||
error_exit:
|
||||
mrb_gc_arena_restore(mrb, ai);
|
||||
if (buf)
|
||||
mrb_free(mrb, buf);
|
||||
|
||||
@@ -537,7 +539,6 @@ mrb_read_irep(mrb_state *mrb, const char *bin)
|
||||
}
|
||||
|
||||
mrb->irep_len += nirep;
|
||||
|
||||
error_exit:
|
||||
if (ret != MRB_DUMP_OK) {
|
||||
for (n=0,i=sirep; n<nirep; n++,i++) {
|
||||
|
||||
@@ -37,12 +37,6 @@
|
||||
#define fmod(x,y) fmodf(x,y)
|
||||
#endif
|
||||
|
||||
void
|
||||
mrb_num_zerodiv(mrb_state *mrb)
|
||||
{
|
||||
mrb_raise(mrb, E_ZERODIVISION_ERROR, "divided by 0");
|
||||
}
|
||||
|
||||
static mrb_float
|
||||
mrb_to_flo(mrb_state *mrb, mrb_value val)
|
||||
{
|
||||
@@ -252,7 +246,6 @@ flodivmod(mrb_state *mrb, mrb_float x, mrb_float y, mrb_float *divp, mrb_float *
|
||||
{
|
||||
mrb_float div, mod;
|
||||
|
||||
if (y == 0.0) mrb_num_zerodiv(mrb);
|
||||
mod = fmod(x, y);
|
||||
if (isinf(x) && !isinf(y) && !isnan(y))
|
||||
div = x;
|
||||
@@ -744,7 +737,6 @@ fixdivmod(mrb_state *mrb, mrb_int x, mrb_int y, mrb_int *divp, mrb_int *modp)
|
||||
{
|
||||
mrb_int div, mod;
|
||||
|
||||
if (y == 0) mrb_num_zerodiv(mrb);
|
||||
if (y < 0) {
|
||||
if (x < 0)
|
||||
div = -x / -y;
|
||||
@@ -1042,24 +1034,6 @@ fix_to_f(mrb_state *mrb, mrb_value num)
|
||||
return mrb_float_value(val);
|
||||
}
|
||||
|
||||
/*
|
||||
* Document-class: ZeroDivisionError
|
||||
*
|
||||
* Raised when attempting to divide an integer by 0.
|
||||
*
|
||||
* 42 / 0
|
||||
*
|
||||
* <em>raises the exception:</em>
|
||||
*
|
||||
* ZeroDivisionError: divided by 0
|
||||
*
|
||||
* Note that only division by an exact 0 will raise that exception:
|
||||
*
|
||||
* 42 / 0.0 #=> Float::INFINITY
|
||||
* 42 / -0.0 #=> -Float::INFINITY
|
||||
* 0 / 0.0 #=> NaN
|
||||
*/
|
||||
|
||||
/*
|
||||
* Document-class: FloatDomainError
|
||||
*
|
||||
|
||||
+14
-8
@@ -41,8 +41,13 @@ static void backref_error(parser_state *p, node *n);
|
||||
|
||||
#define identchar(c) (isalnum(c) || (c) == '_' || !isascii(c))
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
typedef unsigned int stack_type;
|
||||
|
||||
@@ -1003,7 +1008,7 @@ top_stmts : none
|
||||
}
|
||||
| error top_stmt
|
||||
{
|
||||
$$ = $2;
|
||||
$$ = new_begin(p, 0);
|
||||
}
|
||||
;
|
||||
|
||||
@@ -2925,10 +2930,10 @@ yyerror(parser_state *p, const char *s)
|
||||
|
||||
if (! p->capture_errors) {
|
||||
if (p->filename) {
|
||||
fprintf(stderr, "%s:%d:%d: %s\n", p->filename, p->lineno, p->column+1, s);
|
||||
fprintf(stderr, "%s:%d:%d: %s\n", p->filename, p->lineno, p->column, s);
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "line %d:%d: %s\n", p->lineno, p->column+1, s);
|
||||
fprintf(stderr, "line %d:%d: %s\n", p->lineno, p->column, s);
|
||||
}
|
||||
}
|
||||
else if (p->nerr < sizeof(p->error_buffer) / sizeof(p->error_buffer[0])) {
|
||||
@@ -2937,7 +2942,7 @@ yyerror(parser_state *p, const char *s)
|
||||
memcpy(c, s, n + 1);
|
||||
p->error_buffer[p->nerr].message = c;
|
||||
p->error_buffer[p->nerr].lineno = p->lineno;
|
||||
p->error_buffer[p->nerr].column = p->column+1;
|
||||
p->error_buffer[p->nerr].column = p->column;
|
||||
}
|
||||
p->nerr++;
|
||||
}
|
||||
@@ -2959,10 +2964,10 @@ yywarn(parser_state *p, const char *s)
|
||||
|
||||
if (! p->capture_errors) {
|
||||
if (p->filename) {
|
||||
fprintf(stderr, "%s:%d:%d: %s\n", p->filename, p->lineno, p->column+1, s);
|
||||
fprintf(stderr, "%s:%d:%d: %s\n", p->filename, p->lineno, p->column, s);
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "line %d:%d: %s\n", p->lineno, p->column+1, s);
|
||||
fprintf(stderr, "line %d:%d: %s\n", p->lineno, p->column, s);
|
||||
}
|
||||
}
|
||||
else if (p->nerr < sizeof(p->warn_buffer) / sizeof(p->warn_buffer[0])) {
|
||||
@@ -3035,8 +3040,8 @@ nextc(parser_state *p)
|
||||
if (c == '\n') {
|
||||
// must understand heredoc
|
||||
}
|
||||
p->column++;
|
||||
}
|
||||
p->column++;
|
||||
return c;
|
||||
}
|
||||
|
||||
@@ -3564,8 +3569,8 @@ parser_yylex(parser_state *p)
|
||||
if (p->column == 1) {
|
||||
if (peeks(p, "begin\n")) {
|
||||
skips(p, "\n=end\n");
|
||||
goto retry;
|
||||
}
|
||||
goto retry;
|
||||
}
|
||||
switch (p->lstate) {
|
||||
case EXPR_FNAME: case EXPR_DOT:
|
||||
@@ -4694,6 +4699,7 @@ mrb_parser_new(mrb_state *mrb)
|
||||
p->capture_errors = 0;
|
||||
|
||||
p->lineno = 1;
|
||||
p->column = 0;
|
||||
#if defined(PARSER_TEST) || defined(PARSER_DEBUG)
|
||||
yydebug = 1;
|
||||
#endif
|
||||
|
||||
@@ -222,8 +222,13 @@
|
||||
|
||||
#include "regenc.h"
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(a,b) (((a)>(b))?(b):(a))
|
||||
#endif
|
||||
|
||||
#ifndef MAX
|
||||
#define MAX(a,b) (((a)<(b))?(b):(a))
|
||||
#endif
|
||||
|
||||
#define IS_NULL(p) (((void*)(p)) == (void*)0)
|
||||
#define IS_NOT_NULL(p) (((void*)(p)) != (void*)0)
|
||||
|
||||
+10
-3
@@ -54,7 +54,7 @@ remove_sign_bits(char *str, int base)
|
||||
static char
|
||||
sign_bits(int base, const char *p)
|
||||
{
|
||||
char c = '.';
|
||||
char c;
|
||||
|
||||
switch (base) {
|
||||
case 16:
|
||||
@@ -65,6 +65,8 @@ sign_bits(int base, const char *p)
|
||||
c = '7'; break;
|
||||
case 2:
|
||||
c = '1'; break;
|
||||
default:
|
||||
c = '.'; break;
|
||||
}
|
||||
return c;
|
||||
}
|
||||
@@ -74,7 +76,7 @@ mrb_fix2binstr(mrb_state *mrb, mrb_value x, int base)
|
||||
{
|
||||
char buf[64], *b = buf + sizeof buf;
|
||||
unsigned long val = mrb_fixnum(x);
|
||||
char d = 0;
|
||||
char d;
|
||||
|
||||
if (base != 2) {
|
||||
mrb_raise(mrb, E_ARGUMENT_ERROR, "invalid radix %d", base);
|
||||
@@ -97,6 +99,7 @@ mrb_fix2binstr(mrb_state *mrb, mrb_value x, int base)
|
||||
case 16: d = 'f'; break;
|
||||
case 8: d = '7'; break;
|
||||
case 2: d = '1'; break;
|
||||
default: d = 0; break;
|
||||
}
|
||||
|
||||
if (d && *b != d) {
|
||||
@@ -793,6 +796,8 @@ format_s:
|
||||
case 'B':
|
||||
if (flags&(FPLUS|FSPACE)) sign = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (flags & FSHARP) {
|
||||
switch (*p) {
|
||||
@@ -801,6 +806,7 @@ format_s:
|
||||
case 'X': prefix = "0X"; break;
|
||||
case 'b': prefix = "0b"; break;
|
||||
case 'B': prefix = "0B"; break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -884,13 +890,14 @@ bin_retry:
|
||||
snprintf(fbuf, sizeof(fbuf), "%%l%c", c);
|
||||
snprintf(++s, sizeof(nbuf) - 1, fbuf, v);
|
||||
if (v < 0) {
|
||||
char d = 0;
|
||||
char d;
|
||||
|
||||
s = remove_sign_bits(s, base);
|
||||
switch (base) {
|
||||
case 16: d = 'f'; break;
|
||||
case 8: d = '7'; break;
|
||||
case 2: d = '1'; break;
|
||||
default: d = 0; break;
|
||||
}
|
||||
|
||||
if (d && *s != d) {
|
||||
|
||||
+9
-1
@@ -4400,9 +4400,17 @@ mrb_str_conv_enc_opts(mrb_state *mrb, mrb_value str, mrb_encoding *from, mrb_enc
|
||||
mrb_enc_associate(mrb, newstr, to);
|
||||
return newstr;
|
||||
|
||||
default:
|
||||
case econv_invalid_byte_sequence:
|
||||
case econv_undefined_conversion:
|
||||
case econv_source_buffer_empty:
|
||||
case econv_after_output:
|
||||
case econv_incomplete_input:
|
||||
/* some error, return original */
|
||||
return str;
|
||||
|
||||
default:
|
||||
mrb_bug("Internal Error: Invalid return value mrb_econv_convert.");
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+14
-1
@@ -543,6 +543,7 @@ transcode_restartable0(mrb_state *mrb,
|
||||
case 32: goto resume_label32;
|
||||
case 33: goto resume_label33;
|
||||
case 34: goto resume_label34;
|
||||
default: break;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
@@ -1197,6 +1198,10 @@ trans_sweep(mrb_state *mrb, mrb_econv_t *ec,
|
||||
case econv_finished:
|
||||
ec->num_finished = i+1;
|
||||
break;
|
||||
|
||||
default:
|
||||
mrb_bug("Internal Error: invalid return value from mrb_transcoding_convert().");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1507,8 +1512,12 @@ mrb_econv_convert(mrb_state *mrb, mrb_econv_t *ec,
|
||||
/* todo: add more alternative behaviors */
|
||||
switch (ec->flags & ECONV_INVALID_MASK) {
|
||||
case ECONV_INVALID_REPLACE:
|
||||
if (output_replacement_character(mrb, ec) == 0)
|
||||
if (output_replacement_character(mrb, ec) == 0)
|
||||
goto resume;
|
||||
|
||||
default:
|
||||
mrb_bug("Internal error: Unhandled ECONV_INVALID_xxx.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1526,6 +1535,10 @@ mrb_econv_convert(mrb_state *mrb, mrb_econv_t *ec,
|
||||
if (output_hex_charref(mrb, ec) == 0)
|
||||
goto resume;
|
||||
break;
|
||||
|
||||
default:
|
||||
mrb_bug("Internal error: Unhandled ECONV_UNDEF_xxx.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+5
-1
@@ -186,12 +186,16 @@ mrb_vm_cv_set(mrb_state *mrb, mrb_sym sym, mrb_value v)
|
||||
if (k != kh_end(h)) {
|
||||
k = kh_put(iv, h, sym);
|
||||
kh_value(h, k) = v;
|
||||
return;
|
||||
}
|
||||
}
|
||||
c = c->super;
|
||||
}
|
||||
c = mrb->ci->target_class;
|
||||
h = c->iv = kh_init(iv, mrb);
|
||||
h = c->iv;
|
||||
if (!h) {
|
||||
c->iv = h = kh_init(iv, mrb);
|
||||
}
|
||||
k = kh_put(iv, h, sym);
|
||||
kh_value(h, k) = v;
|
||||
}
|
||||
|
||||
@@ -980,7 +980,10 @@ mrb_run(mrb_state *mrb, struct RProc *proc, mrb_value self)
|
||||
cipop(mrb);
|
||||
ci = mrb->ci;
|
||||
if (ci == mrb->cibase) {
|
||||
if (ci->ridx == 0) goto L_STOP;
|
||||
if (ci->ridx == 0) {
|
||||
mrb->stack = mrb->stbase;
|
||||
goto L_STOP;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+8
-23
@@ -16,17 +16,16 @@ ASSLIB := $(BASEDIR)/assert.rb
|
||||
MRBS := $(BASEDIR)/t/*.rb
|
||||
OBJS := driver.o $(MLIB)
|
||||
|
||||
# C compiler (gcc)
|
||||
CC = gcc
|
||||
LL = gcc
|
||||
AR = ar
|
||||
# libraries, includes
|
||||
LIBS = -lm
|
||||
INCLUDES = -I$(BASEDIR)/../src -I$(BASEDIR)/../include
|
||||
|
||||
DEBUG_MODE = 1
|
||||
ifeq ($(DEBUG_MODE),1)
|
||||
CFLAGS = -g
|
||||
else
|
||||
CFLAGS = -O3
|
||||
endif
|
||||
INCLUDES = -I../src -I../include
|
||||
ALL_CFLAGS = -Wall -Werror-implicit-function-declaration $(CFLAGS)
|
||||
ifeq ($(OS),Windows_NT)
|
||||
MAKE_FLAGS = CC=$(CC) LL=$(LL) ALL_CFLAGS="$(ALL_CFLAGS)"
|
||||
@@ -43,20 +42,6 @@ MRBC = ../bin/mrbc
|
||||
EXE := $(TARGET)
|
||||
endif
|
||||
|
||||
# libraries, includes
|
||||
LIBS = -lm
|
||||
|
||||
# compiler, linker (gcc)
|
||||
CC = gcc
|
||||
LL = gcc
|
||||
YACC = bison
|
||||
DEBUG_MODE = 1
|
||||
ifeq ($(DEBUG_MODE),1)
|
||||
CFLAGS = -g -O3
|
||||
else
|
||||
CFLAGS = -O3
|
||||
endif
|
||||
ALL_CFLAGS = -Wall -Werror-implicit-function-declaration $(CFLAGS)
|
||||
|
||||
##############################
|
||||
# generic build targets, rules
|
||||
@@ -66,7 +51,7 @@ all : $(EXE)
|
||||
./$(EXE)
|
||||
|
||||
# executable constructed using linker from object files
|
||||
$(EXE) : $(OBJS)
|
||||
$(EXE) : $(OBJS) $(LIBR)
|
||||
$(LL) -o $@ $(CFLAGS) $(OBJS) $(LIBR) $(LIBS)
|
||||
|
||||
-include $(OBJS:.o=.d)
|
||||
@@ -77,14 +62,14 @@ $(OBJS) : %.o : %.c
|
||||
|
||||
# Compile C source from merged mruby source
|
||||
$(CLIB) : $(RLIB) $(MRBC) $(INIT)
|
||||
$(MRBC) -Bmrbtest_irep -o$(DLIB) $(RLIB); cat $(INIT) $(DLIB) > $@
|
||||
$(MRBC) -Bmrbtest_irep -o$(DLIB) $(RLIB); $(CAT) $(INIT) $(DLIB) > $@
|
||||
|
||||
# merge mruby sources
|
||||
$(RLIB) : $(ASSLIB) $(MRBS)
|
||||
cat $(ASSLIB) $(MRBS) > $@
|
||||
$(CAT) $(ASSLIB) $(MRBS) > $@
|
||||
|
||||
# clean up
|
||||
.PHONY : clean
|
||||
clean :
|
||||
@echo "make: removing targets, objects and depend files of `pwd`"
|
||||
-rm -f $(MLIB) $(CLIB) $(RLIB) $(DLIB) $(DEPLIB) $(OBJS) $(EXE)
|
||||
-$(RM_F) $(MLIB) $(CLIB) $(RLIB) $(DLIB) $(DEPLIB) $(OBJS) $(EXE)
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
##
|
||||
# ArgumentError ISO Test
|
||||
|
||||
assert('ArgumentError', '15.2.24') do
|
||||
e2 = nil
|
||||
a = []
|
||||
begin
|
||||
# this will cause an exception due to the wrong arguments
|
||||
a[]
|
||||
rescue => e1
|
||||
e2 = e1
|
||||
end
|
||||
|
||||
ArgumentError.class == Class and e2.class == ArgumentError
|
||||
end
|
||||
+38
-4
@@ -22,11 +22,47 @@ assert('Array#<<', '15.2.12.5.3') do
|
||||
end
|
||||
|
||||
assert('Array#[]', '15.2.12.5.4') do
|
||||
[1,2,3].[](1) == 2
|
||||
e2 = nil
|
||||
e3 = nil
|
||||
a = Array.new
|
||||
begin
|
||||
# this will cause an exception due to the wrong arguments
|
||||
a.[]()
|
||||
rescue => e1
|
||||
e2 = e1
|
||||
end
|
||||
begin
|
||||
# this will cause an exception due to the wrong arguments
|
||||
a.[](1,2,3)
|
||||
rescue => e1
|
||||
e3 = e1
|
||||
end
|
||||
|
||||
[1,2,3].[](1) == 2 and
|
||||
e2.class == ArgumentError and
|
||||
e3.class == ArgumentError
|
||||
end
|
||||
|
||||
assert('Array#[]=', '15.2.12.5.5') do
|
||||
[1,2,3].[]=(1,4) == [1, 4, 3]
|
||||
e2 = nil
|
||||
e3 = nil
|
||||
a = Array.new
|
||||
begin
|
||||
# this will cause an exception due to the wrong arguments
|
||||
a.[]=()
|
||||
rescue => e1
|
||||
e2 = e1
|
||||
end
|
||||
begin
|
||||
# this will cause an exception due to the wrong arguments
|
||||
a.[]=(1,2,3,4)
|
||||
rescue => e1
|
||||
e3 = e1
|
||||
end
|
||||
|
||||
[1,2,3].[]=(1,4) == [1, 4, 3] and
|
||||
e2.class == ArgumentError and
|
||||
e3.class == ArgumentError
|
||||
end
|
||||
|
||||
assert('Array#clear', '15.2.12.5.6') do
|
||||
@@ -193,5 +229,3 @@ assert('Array#unshift', '15.2.12.5.30') do
|
||||
end
|
||||
|
||||
# Not ISO specified
|
||||
|
||||
|
||||
|
||||
@@ -388,4 +388,3 @@ assert('BS Block [ruby-core:14395]') do
|
||||
t = Controller.new
|
||||
t.test_for_bug
|
||||
end
|
||||
|
||||
|
||||
@@ -36,4 +36,3 @@ end
|
||||
assert('BS Literal 9') do
|
||||
Fixnum == 1234.class
|
||||
end
|
||||
|
||||
|
||||
@@ -1,121 +1,126 @@
|
||||
##
|
||||
# Bootstrap tests for Class
|
||||
# Class ISO Test
|
||||
|
||||
assert('BS Class 1') do
|
||||
assert('Class', '15.2.3') do
|
||||
Class.class == Class
|
||||
end
|
||||
|
||||
# Not ISO specified
|
||||
|
||||
assert('Class 1') do
|
||||
class C; end
|
||||
C.class == Class
|
||||
end
|
||||
|
||||
assert('BS Class 2') do
|
||||
assert('Class 2') do
|
||||
class C; end
|
||||
C.new.class == C
|
||||
end
|
||||
|
||||
assert('BS Class 3') do
|
||||
assert('Class 3') do
|
||||
class C; end
|
||||
C.new.class.class == Class
|
||||
end
|
||||
|
||||
assert('BS Class 4') do
|
||||
assert('Class 4') do
|
||||
class A; end
|
||||
class C < A; end
|
||||
C.class == Class
|
||||
end
|
||||
|
||||
assert('BS Class 5') do
|
||||
assert('Class 5') do
|
||||
class A; end
|
||||
class C < A; end
|
||||
C.new.class == C
|
||||
end
|
||||
|
||||
assert('BS Class 6') do
|
||||
assert('Class 6') do
|
||||
class A; end
|
||||
class C < A; end
|
||||
C.new.class.class == Class
|
||||
end
|
||||
|
||||
assert('BS Class Module 1') do
|
||||
assert('Class Module 1') do
|
||||
module M; end
|
||||
M.class == Module
|
||||
end
|
||||
|
||||
assert('BS Class Module 2') do
|
||||
assert('Class Module 2') do
|
||||
module M; end
|
||||
class C; include M; end
|
||||
C.new.class == C
|
||||
end
|
||||
|
||||
# nested class
|
||||
assert('BS Class Nested 1') do
|
||||
assert('Class Nested 1') do
|
||||
class A; end
|
||||
class A::B; end
|
||||
A::B == A::B
|
||||
end
|
||||
|
||||
assert('BS Class Nested 2') do
|
||||
assert('Class Nested 2') do
|
||||
class A; end
|
||||
class A::B; end
|
||||
A::B.new.class == A::B
|
||||
end
|
||||
|
||||
assert('BS Class Nested 3') do
|
||||
assert('Class Nested 3') do
|
||||
class A; end
|
||||
class A::B; end
|
||||
A::B.new.class.class == Class
|
||||
end
|
||||
|
||||
assert('BS Class Nested 4') do
|
||||
assert('Class Nested 4') do
|
||||
class A; end
|
||||
class A::B; end
|
||||
class A::B::C; end
|
||||
A::B::C == A::B::C
|
||||
end
|
||||
|
||||
assert('BS Class Nested 5') do
|
||||
assert('Class Nested 5') do
|
||||
class A; end
|
||||
class A::B; end
|
||||
class A::B::C; end
|
||||
A::B::C.class == Class
|
||||
end
|
||||
|
||||
assert('BS Class Nested 6') do
|
||||
assert('Class Nested 6') do
|
||||
class A; end
|
||||
class A::B; end
|
||||
class A::B::C; end
|
||||
A::B::C.new.class == A::B::C
|
||||
end
|
||||
|
||||
assert('BS Class Nested 7') do
|
||||
assert('Class Nested 7') do
|
||||
class A; end
|
||||
class A::B; end
|
||||
class A::B2 < A::B; end
|
||||
A::B2 == A::B2
|
||||
end
|
||||
|
||||
assert('BS Class Nested 8') do
|
||||
assert('Class Nested 8') do
|
||||
class A; end
|
||||
class A::B; end
|
||||
class A::B2 < A::B; end
|
||||
A::B2.class == Class
|
||||
end
|
||||
|
||||
assert('BS Class Colon 1') do
|
||||
assert('Class Colon 1') do
|
||||
class A; end; A::C = 1; A::C == 1
|
||||
end
|
||||
|
||||
assert('BS Class Colon 2') do
|
||||
assert('Class Colon 2') do
|
||||
class A; class ::C; end end; C == C
|
||||
end
|
||||
|
||||
assert('BS Class Colon 3') do
|
||||
assert('Class Colon 3') do
|
||||
class A; class ::C; end end; C.class == Class
|
||||
end
|
||||
|
||||
assert('BS Class Dup 1') do
|
||||
assert('Class Dup 1') do
|
||||
class C; end; C.dup.class == Class
|
||||
end
|
||||
|
||||
assert('BS Class Dup 2') do
|
||||
assert('Class Dup 2') do
|
||||
module M; end; M.dup.class == Module
|
||||
end
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
##
|
||||
# Enumerable ISO Test
|
||||
|
||||
assert('Enumerable', '15.3.2') do
|
||||
Enumerable.class == Module
|
||||
end
|
||||
|
||||
assert('Enumerable#all?', '15.3.2.2.1') do
|
||||
[1,2,3].all? and not [1,false,3].all?
|
||||
end
|
||||
|
||||
assert('Enumerable#any?', '15.3.2.2.2') do
|
||||
[false,true,false].any? and not [false,false,false].any?
|
||||
end
|
||||
|
||||
assert('Enumerable#collect', '15.3.2.2.3') do
|
||||
[1,2,3].collect { |i| i + i } == [2,4,6]
|
||||
end
|
||||
|
||||
assert('Enumerable#detect', '15.3.2.2.4') do
|
||||
[1,2,3].detect() { true } and [1,2,3].detect("a") { false } == 'a'
|
||||
end
|
||||
|
||||
assert('Array#each_with_index', '15.3.2.2.5') do
|
||||
a = nil
|
||||
b = nil
|
||||
|
||||
[1].each_with_index {|e,i| a = e; b = i}
|
||||
|
||||
a == 1 and b == 0
|
||||
end
|
||||
|
||||
assert('Enumerable#entries', '15.3.2.2.6') do
|
||||
[1].entries == [1]
|
||||
end
|
||||
|
||||
assert('Enumerable#find', '15.3.2.2.7') do
|
||||
[1,2,3].find() { true } and [1,2,3].find("a") { false } == 'a'
|
||||
end
|
||||
|
||||
assert('Enumerable#find_all', '15.3.2.2.8') do
|
||||
[1,2,3,4,5,6,7,8,9].find_all() {|i| i%2 == 0} == [2,4,6,8]
|
||||
end
|
||||
|
||||
assert('Enumerable#grep', '15.3.2.2.9') do
|
||||
[1,2,3,4,5,6,7,8,9].grep(4..6) == [4,5,6]
|
||||
end
|
||||
|
||||
assert('Enumerable#include?', '15.3.2.2.10') do
|
||||
[1,2,3,4,5,6,7,8,9].include?(5) and
|
||||
not [1,2,3,4,5,6,7,8,9].include?(0)
|
||||
end
|
||||
|
||||
assert('Enumerable#inject', '15.3.2.2.11') do
|
||||
[1,2,3,4,5,6].inject() {|s, n| s + n} == 21 and
|
||||
[1,2,3,4,5,6].inject(1) {|s, n| s + n} == 22
|
||||
end
|
||||
|
||||
assert('Enumerable#map', '15.3.2.2.12') do
|
||||
[1,2,3].map { |i| i + i } == [2,4,6]
|
||||
end
|
||||
|
||||
assert('Enumerable#max', '15.3.2.2.13') do
|
||||
a = ['aaa', 'bb', 'c']
|
||||
a.max == 'c' and
|
||||
a.max {|i1,i2| i1.length <=> i2.length} == 'aaa'
|
||||
end
|
||||
|
||||
assert('Enumerable#min', '15.3.2.2.14') do
|
||||
a = ['aaa', 'bb', 'c']
|
||||
a.min == 'aaa' and
|
||||
a.min {|i1,i2| i1.length <=> i2.length} == 'c'
|
||||
end
|
||||
|
||||
assert('Enumerable#member?', '15.3.2.2.15') do
|
||||
[1,2,3,4,5,6,7,8,9].member?(5) and
|
||||
not [1,2,3,4,5,6,7,8,9].member?(0)
|
||||
end
|
||||
|
||||
assert('Enumerable#partion', '15.3.2.2.16') do
|
||||
[0,1,2,3,4,5,6,7,8,9].partition do |i|
|
||||
i % 2 == 0
|
||||
end == [[0,2,4,6,8], [1,3,5,7,9]]
|
||||
end
|
||||
|
||||
assert('Enumerable#reject', '15.3.2.2.17') do
|
||||
[0,1,2,3,4,5,6,7,8,9].reject do |i|
|
||||
i % 2 == 0
|
||||
end == [1,3,5,7,9]
|
||||
end
|
||||
|
||||
assert('Enumerable#select', '15.3.2.2.18') do
|
||||
[1,2,3,4,5,6,7,8,9].select() {|i| i%2 == 0} == [2,4,6,8]
|
||||
end
|
||||
|
||||
assert('Enumerable#sort', '15.3.2.2.19') do
|
||||
[7,3,1,2,6,4].sort == [1,2,3,4,6,7] and
|
||||
[7,3,1,2,6,4].sort {|e1,e2| e2<=>e1} == [7,6,4,3,2,1]
|
||||
end
|
||||
|
||||
assert('Enumerable#to_a', '15.3.2.2.20') do
|
||||
[1].to_a == [1]
|
||||
end
|
||||
@@ -1,7 +1,45 @@
|
||||
##
|
||||
# Bootstrap tests for Exceptions
|
||||
# Exception ISO Test
|
||||
|
||||
assert('BS Exception 1') do
|
||||
assert('Exception', '15.2.22') do
|
||||
Exception.class == Class
|
||||
end
|
||||
|
||||
assert('Exception.exception', '15.2.22.4.1') do
|
||||
e = Exception.exception('a')
|
||||
|
||||
e.class == Exception
|
||||
end
|
||||
|
||||
assert('Exception#exception', '15.2.22.5.1') do
|
||||
e1 = Exception.exception()
|
||||
e2 = Exception.exception('b')
|
||||
|
||||
e1.class == Exception and e2.class == Exception
|
||||
end
|
||||
|
||||
assert('Exception#message', '15.2.22.5.2') do
|
||||
e = Exception.exception('a')
|
||||
|
||||
e.message == 'a'
|
||||
end
|
||||
|
||||
assert('Exception#to_s', '15.2.22.5.3') do
|
||||
e = Exception.exception('a')
|
||||
|
||||
e.to_s == 'a'
|
||||
end
|
||||
|
||||
assert('Exception.exception', '15.2.22.4.1') do
|
||||
e = Exception.exception()
|
||||
e.initialize('a')
|
||||
|
||||
e.message == 'a'
|
||||
end
|
||||
|
||||
# Not ISO specified
|
||||
|
||||
assert('Exception 1') do
|
||||
begin
|
||||
1+1
|
||||
ensure
|
||||
@@ -9,7 +47,7 @@ assert('BS Exception 1') do
|
||||
end == 2
|
||||
end
|
||||
|
||||
assert('BS Exception 2') do
|
||||
assert('Exception 2') do
|
||||
begin
|
||||
1+1
|
||||
begin
|
||||
@@ -22,7 +60,7 @@ assert('BS Exception 2') do
|
||||
end == 4
|
||||
end
|
||||
|
||||
assert('BS Exception 3') do
|
||||
assert('Exception 3') do
|
||||
begin
|
||||
1+1
|
||||
begin
|
||||
@@ -40,7 +78,7 @@ assert('BS Exception 3') do
|
||||
end == 4
|
||||
end
|
||||
|
||||
assert('BS Exception 4') do
|
||||
assert('Exception 4') do
|
||||
a = nil
|
||||
1.times{|e|
|
||||
begin
|
||||
@@ -51,7 +89,7 @@ assert('BS Exception 4') do
|
||||
a == NilClass
|
||||
end
|
||||
|
||||
assert('BS Exception 5') do
|
||||
assert('Exception 5') do
|
||||
$ans = []
|
||||
def m
|
||||
$!
|
||||
@@ -69,7 +107,7 @@ assert('BS Exception 5') do
|
||||
$ans == [nil]
|
||||
end
|
||||
|
||||
assert('BS Exception 6') do
|
||||
assert('Exception 6') do
|
||||
$i = 0
|
||||
def m
|
||||
iter{
|
||||
@@ -95,7 +133,7 @@ assert('BS Exception 6') do
|
||||
$i == 7
|
||||
end
|
||||
|
||||
assert('BS Exception 7') do
|
||||
assert('Exception 7') do
|
||||
$i = 0
|
||||
def m
|
||||
begin
|
||||
@@ -115,7 +153,7 @@ assert('BS Exception 7') do
|
||||
$i == 10
|
||||
end
|
||||
|
||||
assert('BS Exception 8') do
|
||||
assert('Exception 8') do
|
||||
begin
|
||||
1
|
||||
rescue
|
||||
@@ -125,7 +163,7 @@ assert('BS Exception 8') do
|
||||
end == 3
|
||||
end
|
||||
|
||||
assert('BS Exception 9') do
|
||||
assert('Exception 9') do
|
||||
begin
|
||||
1+1
|
||||
rescue
|
||||
@@ -137,7 +175,7 @@ assert('BS Exception 9') do
|
||||
end == 6
|
||||
end
|
||||
|
||||
assert('BS Exception 10') do
|
||||
assert('Exception 10') do
|
||||
begin
|
||||
1+1
|
||||
begin
|
||||
@@ -155,4 +193,3 @@ assert('BS Exception 10') do
|
||||
7+7
|
||||
end == 12
|
||||
end
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
##
|
||||
# FalseClass ISO Test
|
||||
|
||||
assert('FalseClass', '15.2.6') do
|
||||
FalseClass.class == Class
|
||||
end
|
||||
|
||||
assert('FalseClass false', '15.2.6.1') do
|
||||
not false
|
||||
end
|
||||
|
||||
assert('FalseClass#&', '15.2.6.3.1') do
|
||||
not FalseClass.new.&(true) and not FalseClass.new.&(false)
|
||||
end
|
||||
|
||||
assert('FalseClass#^', '15.2.6.3.2') do
|
||||
FalseClass.new.^(true) and not FalseClass.new.^(false)
|
||||
end
|
||||
|
||||
assert('FalseClass#to_s', '15.2.6.3.3') do
|
||||
FalseClass.new.to_s == 'false'
|
||||
end
|
||||
|
||||
assert('FalseClass#|', '15.2.6.3.4') do
|
||||
FalseClass.new.|(true) and not FalseClass.new.|(false)
|
||||
end
|
||||
@@ -99,4 +99,3 @@ end
|
||||
assert('Float#truncate', '15.2.9.3.15') do
|
||||
3.123456789.truncate == 3
|
||||
end
|
||||
|
||||
|
||||
@@ -224,4 +224,3 @@ assert('Hash#values', '15.2.13.4.28') do
|
||||
|
||||
a.values == ['abc_value']
|
||||
end
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
##
|
||||
# IndexError ISO Test
|
||||
|
||||
assert('IndexError', '15.2.33') do
|
||||
IndexError.class == Class
|
||||
end
|
||||
@@ -168,4 +168,3 @@ assert('Integer#upto', '15.2.8.3.27') do
|
||||
end
|
||||
a == 6
|
||||
end
|
||||
|
||||
|
||||
@@ -0,0 +1,124 @@
|
||||
##
|
||||
# Kernel ISO Test
|
||||
|
||||
assert('Kernel', '15.3.1') do
|
||||
Kernel.class == Module
|
||||
end
|
||||
|
||||
assert('Kernel.block_given?', '15.3.1.2.2') do
|
||||
Kernel.block_given? == false
|
||||
end
|
||||
|
||||
assert('Kernel.global_variables', '15.3.1.2.4') do
|
||||
Kernel.global_variables.class == Array
|
||||
end
|
||||
|
||||
assert('Kernel.iterator?', '15.3.1.2.5') do
|
||||
Kernel.iterator? == false
|
||||
end
|
||||
|
||||
assert('Kernel.lambda', '15.3.1.2.6') do
|
||||
l = Kernel.lambda do
|
||||
true
|
||||
end
|
||||
|
||||
l.call and l.class == Proc
|
||||
end
|
||||
|
||||
assert('Kernel.local_variables', '15.3.1.2.7') do
|
||||
Kernel.local_variables.class == Array
|
||||
end
|
||||
|
||||
assert('Kernel.loop', '15.3.1.2.8') do
|
||||
i = 0
|
||||
|
||||
Kernel.loop do
|
||||
i += 1
|
||||
break if i == 100
|
||||
end
|
||||
|
||||
i == 100
|
||||
end
|
||||
|
||||
assert('Kernel.p', '15.3.1.2.9') do
|
||||
# TODO search for a way to test p to stdio
|
||||
true
|
||||
end
|
||||
|
||||
assert('Kernel.print', '15.3.1.2.10') do
|
||||
# TODO search for a way to test print to stdio
|
||||
true
|
||||
end
|
||||
|
||||
assert('Kernel.puts', '15.3.1.2.11') do
|
||||
# TODO search for a way to test puts to stdio
|
||||
true
|
||||
end
|
||||
|
||||
# TODO fails at the moment without arguments
|
||||
assert('Kernel.raise', '15.3.1.2.12') do
|
||||
e_list = []
|
||||
|
||||
begin
|
||||
raise RuntimeError.new
|
||||
rescue => e
|
||||
e_list << e
|
||||
end
|
||||
|
||||
e_list[0].class == RuntimeError
|
||||
end
|
||||
|
||||
assert('Kernel#hash', '15.3.1.2.15') do
|
||||
hash == hash
|
||||
end
|
||||
|
||||
assert('Kernel#local_variables', '15.3.1.2.28') do
|
||||
local_variables.class == Array
|
||||
end
|
||||
|
||||
assert('Kernel#loop', '15.3.1.2.29') do
|
||||
i = 0
|
||||
|
||||
loop do
|
||||
i += 1
|
||||
break if i == 100
|
||||
end
|
||||
|
||||
i == 100
|
||||
end
|
||||
|
||||
assert('Kernel#methods', '15.3.1.2.31') do
|
||||
methods.class == Array
|
||||
end
|
||||
|
||||
assert('Kernel#nil?', '15.3.1.2.32') do
|
||||
# TODO why is Kernel nil ????
|
||||
nil? == true
|
||||
end
|
||||
|
||||
assert('Kernel#private_methods', '15.3.1.2.36') do
|
||||
private_methods.class == Array
|
||||
end
|
||||
|
||||
assert('Kernel#protected_methods', '15.3.1.2.37') do
|
||||
protected_methods.class == Array
|
||||
end
|
||||
|
||||
assert('Kernel#public_methods', '15.3.1.2.38') do
|
||||
public_methods.class == Array
|
||||
end
|
||||
|
||||
assert('Kernel#respond_to?', '15.3.1.2.43') do
|
||||
respond_to? :nil?
|
||||
end
|
||||
|
||||
# TODO at the moment doesn't comply to ISO assert('Kernel#send', '15.3.1.2.44') do
|
||||
|
||||
assert('Kernel#singleton_methods', '15.3.1.2.45') do
|
||||
singleton_methods.class == Array
|
||||
end
|
||||
|
||||
assert('Kernel#to_s', '15.3.1.2.46') do
|
||||
# TODO looks strange..
|
||||
to_s == ''
|
||||
end
|
||||
@@ -0,0 +1,67 @@
|
||||
##
|
||||
# Literals ISO Test
|
||||
|
||||
assert('Literals Numerical', '8.7.6.2') do
|
||||
# signed and unsigned integer
|
||||
1 == 1 and -1 == -1 and +1 == +1 and
|
||||
# signed and unsigned float
|
||||
1.0 == 1.0 and -1.0 == -1.0 and
|
||||
# binary
|
||||
0b10000000 == 128 and 0B10000000 == 128
|
||||
# octal
|
||||
0o10 == 8 and 0O10 == 8 and 0_10 == 8
|
||||
# hex
|
||||
0xff == 255 and 0Xff == 255 and
|
||||
# decimal
|
||||
0d999 == 999 and 0D999 == 999 and
|
||||
# decimal seperator
|
||||
10_000_000 == 10000000 and 1_0 == 10 and
|
||||
# integer with exponent
|
||||
1e1 == 10.0 and 1e-1 == 0.1 and 1e+1 == 10.0
|
||||
# float with exponent
|
||||
1.0e1 == 10.0 and 1.0e-1 == 0.1 and 1.0e+1 == 10.0
|
||||
end
|
||||
|
||||
assert('Literals Strings Single Quoted', '8.7.6.3.2') do
|
||||
'abc' == 'abc' and '\'' == '\'' and '\\' == '\\'
|
||||
end
|
||||
|
||||
assert('Literals Strings Double Quoted', '8.7.6.3.3') do
|
||||
a = "abc"
|
||||
|
||||
"abc" == "abc" and "\"" == "\"" and "\\" == "\\" and
|
||||
"#{a}" == "abc"
|
||||
end
|
||||
|
||||
assert('Literals Strings Quoted Non-Expanded', '8.7.6.3.4') do
|
||||
a = %q{abc}
|
||||
b = %q(abc)
|
||||
c = %q[abc]
|
||||
d = %q<abc>
|
||||
e = %q/abc/
|
||||
f = %q/ab\/c/
|
||||
|
||||
a == 'abc' and b == 'abc' and c == 'abc' and d == 'abc' and
|
||||
e == 'abc' and f == 'ab/c'
|
||||
end
|
||||
|
||||
assert('Literals Strings Quoted Expanded', '8.7.6.3.5') do
|
||||
a = %Q{abc}
|
||||
b = %Q(abc)
|
||||
c = %Q[abc]
|
||||
d = %Q<abc>
|
||||
e = %Q/abc/
|
||||
f = %Q/ab\/c/
|
||||
g = %Q{#{a}}
|
||||
|
||||
a == 'abc' and b == 'abc' and c == 'abc' and d == 'abc' and
|
||||
e == 'abc' and f == 'ab/c' and g == 'abc'
|
||||
end
|
||||
|
||||
# Not Implemented ATM assert('Literals Strings Here documents', '8.7.6.3.6') do
|
||||
|
||||
# Not Implemented ATM assert('Literals Array', '8.7.6.4') do
|
||||
|
||||
# Not Implemented ATM assert('Literals Regular expression', '8.7.6.5') do
|
||||
|
||||
# Not Implemented ATM assert('Literals Symbol', '8.7.6.6') do
|
||||
@@ -0,0 +1,9 @@
|
||||
##
|
||||
# LocalJumpError ISO Test
|
||||
|
||||
assert('LocalJumoError', '15.2.25') do
|
||||
LocalJumpError.class == Class
|
||||
end
|
||||
|
||||
# TODO 15.2.25.2.1 LocalJumpError#exit_value
|
||||
# TODO 15.2.25.2.2 LocalJumpError#reason
|
||||
@@ -0,0 +1,10 @@
|
||||
##
|
||||
# Module ISO Test
|
||||
|
||||
assert('Module', '15.2.2') do
|
||||
Module.class == Class
|
||||
end
|
||||
|
||||
# TODO not implemented ATM assert('Module.constants', '15.2.2') do
|
||||
|
||||
# TODO not implemented ATM assert('Module.nesting', '15.2.2') do
|
||||
@@ -0,0 +1,14 @@
|
||||
##
|
||||
# NameError ISO Test
|
||||
|
||||
assert('NameError', '15.2.31') do
|
||||
NameError.class == Class
|
||||
end
|
||||
|
||||
# TODO 15.2.31.2.1 NameError#name
|
||||
|
||||
assert('NameError#initialize', '15.2.31.2.2') do
|
||||
e = NameError.new.initialize('a')
|
||||
|
||||
e.class == NameError and e.message == 'a'
|
||||
end
|
||||
@@ -0,0 +1,26 @@
|
||||
##
|
||||
# NilClass ISO Test
|
||||
|
||||
assert('NilClass', '15.2.4') do
|
||||
NilClass.class == Class
|
||||
end
|
||||
|
||||
assert('NilClass#&', '15.2.4.3.1') do
|
||||
not NilClass.new.& and not NilClass.new.&(nil)
|
||||
end
|
||||
|
||||
assert('NilClass#^', '15.2.4.3.2') do
|
||||
NilClass.new.^(true) and not NilClass.new.^(false)
|
||||
end
|
||||
|
||||
assert('NilClass#|', '15.2.4.3.3') do
|
||||
NilClass.new.|(true) and not NilClass.new.|(false)
|
||||
end
|
||||
|
||||
assert('NilClass#nil?', '15.2.4.3.4') do
|
||||
NilClass.new.nil?
|
||||
end
|
||||
|
||||
assert('NilClass#to_s', '15.2.4.3.5') do
|
||||
NilClass.new.to_s == ''
|
||||
end
|
||||
@@ -0,0 +1,13 @@
|
||||
##
|
||||
# NoMethodError ISO Test
|
||||
|
||||
assert('NoMethodError', '15.2.32') do
|
||||
e2 = nil
|
||||
begin
|
||||
doesNotExistAsAMethodNameForVerySure("")
|
||||
rescue => e1
|
||||
e2 = e1
|
||||
end
|
||||
|
||||
NoMethodError.class == Class and e2.class == NoMethodError
|
||||
end
|
||||
@@ -22,4 +22,3 @@ end
|
||||
assert('Numeric#**') do
|
||||
2.0**3 == 8.0
|
||||
end
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
##
|
||||
# Object ISO Test
|
||||
|
||||
assert('Object', '15.2.1') do
|
||||
Object.class == Class
|
||||
end
|
||||
@@ -0,0 +1,44 @@
|
||||
##
|
||||
# Proc ISO Test
|
||||
|
||||
assert('Proc', '15.2.17') do
|
||||
Proc.class == Class
|
||||
end
|
||||
|
||||
assert('Proc.new', '15.2.17.3.1') do
|
||||
a = nil
|
||||
|
||||
begin
|
||||
Proc.new
|
||||
rescue => e
|
||||
a = e
|
||||
end
|
||||
|
||||
b = Proc.new {}
|
||||
|
||||
a.class == ArgumentError and b.class == Proc
|
||||
end
|
||||
|
||||
assert('Proc#[]', '15.2.17.4.1') do
|
||||
a = 0
|
||||
b = Proc.new { a += 1 }
|
||||
b.[]
|
||||
|
||||
a2 = 0
|
||||
b2 = Proc.new { |i| a2 += i }
|
||||
b2.[](5)
|
||||
|
||||
a == 1 and a2 == 5
|
||||
end
|
||||
|
||||
assert('Proc#call', '15.2.17.4.3') do
|
||||
a = 0
|
||||
b = Proc.new { a += 1 }
|
||||
b.call
|
||||
|
||||
a2 = 0
|
||||
b2 = Proc.new { |i| a2 += i }
|
||||
b2.call(5)
|
||||
|
||||
a == 1 and a2 == 5
|
||||
end
|
||||
@@ -62,4 +62,3 @@ assert('Range#member?', '15.2.14.4.11') do
|
||||
|
||||
a.member?(5) and not a.member?(20)
|
||||
end
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
##
|
||||
# RangeError ISO Test
|
||||
|
||||
assert('RangeError', '15.2.26') do
|
||||
RangeError.class == Class
|
||||
end
|
||||
@@ -0,0 +1,4 @@
|
||||
##
|
||||
# RegexpError ISO Test
|
||||
|
||||
# TODO broken ATM assert('RegexpError', '15.2.27') do
|
||||
@@ -0,0 +1,14 @@
|
||||
##
|
||||
# RuntimeError ISO Test
|
||||
|
||||
assert('RuntimeError', '15.2.28') do
|
||||
e2 = nil
|
||||
begin
|
||||
# this will cause an exception due to the wrong location
|
||||
retry
|
||||
rescue => e1
|
||||
e2 = e1
|
||||
end
|
||||
|
||||
RuntimeError.class == Class and e2.class == RuntimeError
|
||||
end
|
||||
@@ -0,0 +1,6 @@
|
||||
##
|
||||
# StandardError ISO Test
|
||||
|
||||
assert('StandardError', '15.2.23') do
|
||||
StandardError.class == Class
|
||||
end
|
||||
@@ -319,4 +319,3 @@ assert('String#upcase!', '15.2.10.5.43') do
|
||||
|
||||
a == 'ABC'
|
||||
end
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
##
|
||||
# Struct ISO Test
|
||||
|
||||
assert('Struct', '15.2.18') do
|
||||
Struct.class == Class
|
||||
end
|
||||
@@ -20,4 +20,3 @@ end
|
||||
assert('Symbol#to_sym', '15.2.11.3.4') do
|
||||
:abc.to_sym == :abc
|
||||
end
|
||||
|
||||
|
||||
@@ -71,4 +71,3 @@ end
|
||||
assert('Time#new') do
|
||||
Time.new.class == Time
|
||||
end
|
||||
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
##
|
||||
# TrueClass ISO Test
|
||||
|
||||
assert('TrueClass', '15.2.5') do
|
||||
TrueClass.class == Class
|
||||
end
|
||||
|
||||
assert('TrueClass true', '15.2.5.1') do
|
||||
true
|
||||
end
|
||||
|
||||
assert('TrueClass#&', '15.2.5.3.1') do
|
||||
TrueClass.new.&(true) and not TrueClass.new.&(false)
|
||||
end
|
||||
|
||||
assert('TrueClass#^', '15.2.5.3.2') do
|
||||
not TrueClass.new.^(true) and TrueClass.new.^(false)
|
||||
end
|
||||
|
||||
assert('TrueClass#to_s', '15.2.5.3.3') do
|
||||
TrueClass.new.to_s == 'true'
|
||||
end
|
||||
|
||||
assert('TrueClass#|', '15.2.5.3.4') do
|
||||
TrueClass.new.|(true) and TrueClass.new.|(false)
|
||||
end
|
||||
@@ -0,0 +1,6 @@
|
||||
##
|
||||
# TypeError ISO Test
|
||||
|
||||
assert('TypeError', '15.2.29') do
|
||||
TypeError.class == Class
|
||||
end
|
||||
+2
-6
@@ -21,10 +21,6 @@ EXTS := $(EXT1)
|
||||
LIBS = -lm
|
||||
INCLUDES = -I$(BASEDIR) -I$(BASEDIR)/../include
|
||||
|
||||
# compiler, linker (gcc)
|
||||
CC = gcc
|
||||
LL = gcc
|
||||
YACC = bison
|
||||
DEBUG_MODE = 1
|
||||
ifeq ($(DEBUG_MODE),1)
|
||||
CFLAGS = -g -O3
|
||||
@@ -69,5 +65,5 @@ clean :
|
||||
$(MAKE) clean -C ../../mrblib $(MAKE_FLAGS)
|
||||
$(MAKE) clean -C ../mrbc $(MAKE_FLAGS)
|
||||
@echo "make: removing targets, objects and depend files of `pwd`"
|
||||
-rm -f $(EXE) $(OBJS)
|
||||
-rm -f $(OBJS:.o=.d)
|
||||
-$(RM_F) $(EXE) $(OBJS)
|
||||
-$(RM_F) $(OBJS:.o=.d)
|
||||
|
||||
+2
-1
@@ -162,7 +162,8 @@ main(void)
|
||||
|
||||
last_code_line[char_index] = '\0';
|
||||
|
||||
if (strcmp(last_code_line, "quit") == 0) {
|
||||
if ((strcmp(last_code_line, "quit") == 0) ||
|
||||
(strcmp(last_code_line, "exit") == 0)) {
|
||||
if (code_block_open) {
|
||||
/* cancel the current block and reset */
|
||||
code_block_open = FALSE;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# build tools/mrbc executable
|
||||
|
||||
file(GLOB MRBC_SRC_C "*.c")
|
||||
add_executable(mrbc ${MRBC_SRC_C})
|
||||
target_link_libraries(mrbc mruby_static ${MRUBY_LIBS})
|
||||
add_executable(mrbc ${MRBC_SRC_C} $<TARGET_OBJECTS:mruby_object>)
|
||||
target_link_libraries(mrbc ${MRUBY_LIBS})
|
||||
|
||||
install(TARGETS mrbc RUNTIME DESTINATION bin)
|
||||
|
||||
|
||||
+3
-5
@@ -23,9 +23,6 @@ LIBS = -lm
|
||||
INCLUDES = -I$(BASEDIR) -I$(BASEDIR)/../include
|
||||
|
||||
# compiler, linker (gcc)
|
||||
CC = gcc
|
||||
LL = gcc
|
||||
YACC = bison
|
||||
DEBUG_MODE = 1
|
||||
ifeq ($(DEBUG_MODE),1)
|
||||
CFLAGS = -g -O3
|
||||
@@ -39,6 +36,7 @@ else
|
||||
MAKE_FLAGS = CC='$(CC)' LL='$(LL)' ALL_CFLAGS='$(ALL_CFLAGS)'
|
||||
endif
|
||||
|
||||
|
||||
##############################
|
||||
# generic build targets, rules
|
||||
|
||||
@@ -63,5 +61,5 @@ $(LIBR) :
|
||||
.PHONY : clean
|
||||
clean :
|
||||
@echo "make: removing targets, objects and depend files of `pwd`"
|
||||
-rm -f $(EXE) $(OBJS)
|
||||
-rm -f $(OBJS:.o=.d)
|
||||
-$(RM_F) $(EXE) $(OBJS)
|
||||
-$(RM_F) $(OBJS:.o=.d)
|
||||
|
||||
@@ -204,11 +204,6 @@ main(int argc, char **argv)
|
||||
return n;
|
||||
}
|
||||
|
||||
void
|
||||
mrb_init_ext(mrb_state *mrb)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
mrb_init_mrblib(mrb_state *mrb)
|
||||
{
|
||||
|
||||
@@ -26,9 +26,6 @@ LIBS = -lm
|
||||
INCLUDES = -I$(BASEDIR) -I$(BASEDIR)/../include
|
||||
|
||||
# compiler, linker (gcc)
|
||||
CC = gcc
|
||||
LL = gcc
|
||||
YACC = bison
|
||||
DEBUG_MODE = 1
|
||||
ifeq ($(DEBUG_MODE),1)
|
||||
CFLAGS = -g -O3
|
||||
@@ -73,5 +70,5 @@ clean :
|
||||
$(MAKE) clean -C ../../mrblib $(MAKE_FLAGS)
|
||||
$(MAKE) clean -C ../mrbc $(MAKE_FLAGS)
|
||||
@echo "make: removing targets, objects and depend files of `pwd`"
|
||||
-rm -f $(EXE) $(OBJS)
|
||||
-rm -f $(OBJS:.o=.d)
|
||||
-$(RM_F) $(EXE) $(OBJS)
|
||||
-$(RM_F) $(OBJS:.o=.d)
|
||||
|
||||
Reference in New Issue
Block a user