Merge branch 'master' into stable

This commit is contained in:
Hiroshi Mimaki
2019-10-23 15:44:21 +09:00
9 changed files with 25 additions and 24 deletions
+1 -1
View File
@@ -52,7 +52,7 @@ mrb_break_value_get(struct RBreak *brk)
{
mrb_value val;
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;
}
static inline void
+3 -1
View File
@@ -327,7 +327,9 @@ module MRuby
infiles.each do |f|
_pp "MRBC", f.relative_path, nil, :indent => 2
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
end
# if mrbc execution fail, drop the file
-4
View File
@@ -28,8 +28,4 @@ module Kernel
def gets(*args)
$stdin.gets(*args)
end
def getc(*args)
$stdin.getc(*args)
end
end
+7 -10
View File
@@ -284,12 +284,13 @@ mrb_io_alloc(mrb_state *mrb)
#endif
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))));
if (mrb_nil_p(opt)) {
return -1;
}
mrb_value opt;
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)) {
case MRB_TT_DATA: /* IO */
@@ -907,11 +908,7 @@ mrb_io_syswrite(mrb_state *mrb, mrb_value io)
}
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) {
fd = fptr->fd;
+2 -2
View File
@@ -174,8 +174,8 @@ mrb_str_concat_m(mrb_state *mrb, mrb_value self)
str = int_chr_binary(mrb, str);
#endif
else
str = mrb_ensure_string_type(mrb, str);
mrb_str_concat(mrb, self, str);
mrb_ensure_string_type(mrb, str);
mrb_str_cat_str(mrb, self, str);
return self;
}
+3 -2
View File
@@ -145,7 +145,7 @@ class_name_str(mrb_state *mrb, struct RClass* c)
if (mrb_nil_p(path)) {
path = c->tt == MRB_TT_MODULE ? mrb_str_new_lit(mrb, "#<Module:") :
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, ">");
}
return path;
@@ -1885,7 +1885,8 @@ mrb_mod_to_s(mrb_state *mrb, mrb_value klass)
return mrb_str_cat_lit(mrb, str, ">");
}
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;
}
}
+1 -1
View File
@@ -423,7 +423,7 @@ mrb_any_to_s(mrb_state *mrb, mrb_value obj)
mrb_str_cat_cstr(mrb, str, cname);
if (!mrb_immediate_p(obj)) {
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, ">");
+7 -2
View File
@@ -1388,8 +1388,13 @@ str_escape(mrb_state *mrb, mrb_value str, mrb_bool inspect)
}
mrb_str_cat_lit(mrb, result, "\"");
#ifdef MRB_UTF8_STRING
mrb_str_ptr(str)->flags |= ascii_flag;
mrb_str_ptr(result)->flags |= ascii_flag;
if (inspect) {
mrb_str_ptr(str)->flags |= ascii_flag;
mrb_str_ptr(result)->flags |= ascii_flag;
}
else {
RSTR_SET_ASCII_FLAG(mrb_str_ptr(result));
}
#endif
return result;
+1 -1
View File
@@ -509,7 +509,7 @@ mrb_obj_iv_inspect(mrb_state *mrb, struct RObject *obj)
mrb_str_cat_lit(mrb, str, "-<");
mrb_str_cat_cstr(mrb, str, cn);
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);
mrb_str_cat_lit(mrb, str, ">");