Commit 4eb8fca1 authored by Hiroshi Mimaki's avatar Hiroshi Mimaki

Merge branch 'master' into stable

parents 4c91adc4 fa85f91e
...@@ -52,7 +52,7 @@ mrb_break_value_get(struct RBreak *brk) ...@@ -52,7 +52,7 @@ mrb_break_value_get(struct RBreak *brk)
{ {
mrb_value val; mrb_value val;
val.value = brk->value; val.value = brk->value;
val.tt = brk->flags & RBREAK_VALUE_TT_MASK; val.tt = (enum mrb_vtype)(brk->flags & RBREAK_VALUE_TT_MASK);
return val; return val;
} }
static inline void static inline void
......
...@@ -327,7 +327,9 @@ module MRuby ...@@ -327,7 +327,9 @@ module MRuby
infiles.each do |f| infiles.each do |f|
_pp "MRBC", f.relative_path, nil, :indent => 2 _pp "MRBC", f.relative_path, nil, :indent => 2
end end
IO.popen("#{filename @command} #{@compile_options % {:funcname => funcname}} #{filename(infiles).join(' ')}", 'r+') do |io| cmd = "#{filename @command} #{@compile_options % {:funcname => funcname}} #{filename(infiles).join(' ')}"
print("#{cmd}\n") if $verbose
IO.popen(cmd, 'r+') do |io|
out.puts io.read out.puts io.read
end end
# if mrbc execution fail, drop the file # if mrbc execution fail, drop the file
......
...@@ -28,8 +28,4 @@ module Kernel ...@@ -28,8 +28,4 @@ module Kernel
def gets(*args) def gets(*args)
$stdin.gets(*args) $stdin.gets(*args)
end end
def getc(*args)
$stdin.getc(*args)
end
end end
...@@ -284,12 +284,13 @@ mrb_io_alloc(mrb_state *mrb) ...@@ -284,12 +284,13 @@ mrb_io_alloc(mrb_state *mrb)
#endif #endif
static int static int
option_to_fd(mrb_state *mrb, mrb_value obj, const char *key) option_to_fd(mrb_state *mrb, mrb_value hash, const char *key)
{ {
mrb_value opt = mrb_funcall(mrb, obj, "[]", 1, mrb_symbol_value(mrb_intern_static(mrb, key, strlen(key)))); mrb_value opt;
if (mrb_nil_p(opt)) {
return -1; if (!mrb_hash_p(hash)) return -1;
} opt = mrb_hash_fetch(mrb, hash, mrb_symbol_value(mrb_intern_static(mrb, key, strlen(key))), mrb_nil_value());
if (mrb_nil_p(opt)) return -1;
switch (mrb_type(opt)) { switch (mrb_type(opt)) {
case MRB_TT_DATA: /* IO */ case MRB_TT_DATA: /* IO */
...@@ -907,11 +908,7 @@ mrb_io_syswrite(mrb_state *mrb, mrb_value io) ...@@ -907,11 +908,7 @@ mrb_io_syswrite(mrb_state *mrb, mrb_value io)
} }
mrb_get_args(mrb, "S", &str); mrb_get_args(mrb, "S", &str);
if (!mrb_string_p(str)) {
buf = mrb_funcall(mrb, str, "to_s", 0);
} else {
buf = str; buf = str;
}
if (fptr->fd2 == -1) { if (fptr->fd2 == -1) {
fd = fptr->fd; fd = fptr->fd;
......
...@@ -174,8 +174,8 @@ mrb_str_concat_m(mrb_state *mrb, mrb_value self) ...@@ -174,8 +174,8 @@ mrb_str_concat_m(mrb_state *mrb, mrb_value self)
str = int_chr_binary(mrb, str); str = int_chr_binary(mrb, str);
#endif #endif
else else
str = mrb_ensure_string_type(mrb, str); mrb_ensure_string_type(mrb, str);
mrb_str_concat(mrb, self, str); mrb_str_cat_str(mrb, self, str);
return self; return self;
} }
......
...@@ -145,7 +145,7 @@ class_name_str(mrb_state *mrb, struct RClass* c) ...@@ -145,7 +145,7 @@ class_name_str(mrb_state *mrb, struct RClass* c)
if (mrb_nil_p(path)) { if (mrb_nil_p(path)) {
path = c->tt == MRB_TT_MODULE ? mrb_str_new_lit(mrb, "#<Module:") : path = c->tt == MRB_TT_MODULE ? mrb_str_new_lit(mrb, "#<Module:") :
mrb_str_new_lit(mrb, "#<Class:"); mrb_str_new_lit(mrb, "#<Class:");
mrb_str_concat(mrb, path, mrb_ptr_to_str(mrb, c)); mrb_str_cat_str(mrb, path, mrb_ptr_to_str(mrb, c));
mrb_str_cat_lit(mrb, path, ">"); mrb_str_cat_lit(mrb, path, ">");
} }
return path; return path;
...@@ -1885,7 +1885,8 @@ mrb_mod_to_s(mrb_state *mrb, mrb_value klass) ...@@ -1885,7 +1885,8 @@ mrb_mod_to_s(mrb_state *mrb, mrb_value klass)
return mrb_str_cat_lit(mrb, str, ">"); return mrb_str_cat_lit(mrb, str, ">");
} }
else { else {
return class_name_str(mrb, mrb_class_ptr(klass)); mrb_value str = class_name_str(mrb, mrb_class_ptr(klass));
return mrb_frozen_p(mrb_basic_ptr(str)) ? mrb_str_dup(mrb, str) : str;
} }
} }
......
...@@ -423,7 +423,7 @@ mrb_any_to_s(mrb_state *mrb, mrb_value obj) ...@@ -423,7 +423,7 @@ mrb_any_to_s(mrb_state *mrb, mrb_value obj)
mrb_str_cat_cstr(mrb, str, cname); mrb_str_cat_cstr(mrb, str, cname);
if (!mrb_immediate_p(obj)) { if (!mrb_immediate_p(obj)) {
mrb_str_cat_lit(mrb, str, ":"); mrb_str_cat_lit(mrb, str, ":");
mrb_str_concat(mrb, str, mrb_ptr_to_str(mrb, mrb_ptr(obj))); mrb_str_cat_str(mrb, str, mrb_ptr_to_str(mrb, mrb_ptr(obj)));
} }
mrb_str_cat_lit(mrb, str, ">"); mrb_str_cat_lit(mrb, str, ">");
......
...@@ -1388,8 +1388,13 @@ str_escape(mrb_state *mrb, mrb_value str, mrb_bool inspect) ...@@ -1388,8 +1388,13 @@ str_escape(mrb_state *mrb, mrb_value str, mrb_bool inspect)
} }
mrb_str_cat_lit(mrb, result, "\""); mrb_str_cat_lit(mrb, result, "\"");
#ifdef MRB_UTF8_STRING #ifdef MRB_UTF8_STRING
if (inspect) {
mrb_str_ptr(str)->flags |= ascii_flag; mrb_str_ptr(str)->flags |= ascii_flag;
mrb_str_ptr(result)->flags |= ascii_flag; mrb_str_ptr(result)->flags |= ascii_flag;
}
else {
RSTR_SET_ASCII_FLAG(mrb_str_ptr(result));
}
#endif #endif
return result; return result;
......
...@@ -509,7 +509,7 @@ mrb_obj_iv_inspect(mrb_state *mrb, struct RObject *obj) ...@@ -509,7 +509,7 @@ mrb_obj_iv_inspect(mrb_state *mrb, struct RObject *obj)
mrb_str_cat_lit(mrb, str, "-<"); mrb_str_cat_lit(mrb, str, "-<");
mrb_str_cat_cstr(mrb, str, cn); mrb_str_cat_cstr(mrb, str, cn);
mrb_str_cat_lit(mrb, str, ":"); mrb_str_cat_lit(mrb, str, ":");
mrb_str_concat(mrb, str, mrb_ptr_to_str(mrb, obj)); mrb_str_cat_str(mrb, str, mrb_ptr_to_str(mrb, obj));
iv_foreach(mrb, t, inspect_i, &str); iv_foreach(mrb, t, inspect_i, &str);
mrb_str_cat_lit(mrb, str, ">"); mrb_str_cat_lit(mrb, str, ">");
......
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