update benz (new->make)

This commit is contained in:
Yuichi Nishiwaki 2014-09-12 20:02:41 +09:00
parent 8117a95b0d
commit b84004770a
3 changed files with 15 additions and 15 deletions

View File

@ -28,7 +28,7 @@ pic_rl_readline(pic_state *pic)
result = readline(prompt); result = readline(prompt);
if(result) if(result)
return pic_obj_value(pic_str_new_cstr(pic, result)); return pic_obj_value(pic_make_str_cstr(pic, result));
else else
return pic_eof_object(); return pic_eof_object();
} }
@ -96,7 +96,7 @@ pic_rl_current_history(pic_state *pic)
{ {
pic_get_args(pic, ""); pic_get_args(pic, "");
return pic_obj_value(pic_str_new_cstr(pic, current_history()->line)); return pic_obj_value(pic_make_str_cstr(pic, current_history()->line));
} }
static pic_value static pic_value
@ -109,7 +109,7 @@ pic_rl_history_get(pic_state *pic)
e = history_get(i); e = history_get(i);
return e ? pic_obj_value(pic_str_new_cstr(pic, e->line)) return e ? pic_obj_value(pic_make_str_cstr(pic, e->line))
: pic_false_value(); : pic_false_value();
} }
@ -123,7 +123,7 @@ pic_rl_remove_history(pic_state *pic)
e = remove_history(i); e = remove_history(i);
return e ? pic_obj_value(pic_str_new_cstr(pic, e->line)) return e ? pic_obj_value(pic_make_str_cstr(pic, e->line))
: pic_false_value(); : pic_false_value();
} }
@ -157,7 +157,7 @@ pic_rl_previous_history(pic_state *pic)
e = previous_history(); e = previous_history();
return e ? pic_obj_value(pic_str_new_cstr(pic, e->line)) return e ? pic_obj_value(pic_make_str_cstr(pic, e->line))
: pic_false_value(); : pic_false_value();
} }
@ -170,7 +170,7 @@ pic_rl_next_history(pic_state *pic)
e = next_history(); e = next_history();
return e ? pic_obj_value(pic_str_new_cstr(pic, e->line)) return e ? pic_obj_value(pic_make_str_cstr(pic, e->line))
: pic_false_value(); : pic_false_value();
} }
@ -249,7 +249,7 @@ pic_rl_history_expand(pic_state *pic)
if(status == -1 || status == 2) if(status == -1 || status == 2)
pic_errorf(pic, "%s\n", result); pic_errorf(pic, "%s\n", result);
return pic_obj_value(pic_str_new_cstr(pic, result)); return pic_obj_value(pic_make_str_cstr(pic, result));
} }
void void

View File

@ -101,7 +101,7 @@ pic_regexp_regexp_match(pic_state *pic)
offset = 0; offset = 0;
while (regexec(&pic_regexp_data_ptr(reg)->reg, input, 1, match, 0) != REG_NOMATCH) { while (regexec(&pic_regexp_data_ptr(reg)->reg, input, 1, match, 0) != REG_NOMATCH) {
pic_push(pic, pic_obj_value(pic_str_new(pic, input, match[0].rm_eo - match[0].rm_so)), matches); pic_push(pic, pic_obj_value(pic_make_str(pic, input, match[0].rm_eo - match[0].rm_so)), matches);
pic_push(pic, pic_int_value(offset), positions); pic_push(pic, pic_int_value(offset), positions);
offset += match[0].rm_eo; offset += match[0].rm_eo;
@ -115,7 +115,7 @@ pic_regexp_regexp_match(pic_state *pic)
if (match[i].rm_so == -1) { if (match[i].rm_so == -1) {
break; break;
} }
str = pic_str_new(pic, input + match[i].rm_so, match[i].rm_eo - match[i].rm_so); str = pic_make_str(pic, input + match[i].rm_so, match[i].rm_eo - match[i].rm_so);
pic_push(pic, pic_obj_value(str), matches); pic_push(pic, pic_obj_value(str), matches);
pic_push(pic, pic_int_value(match[i].rm_so), positions); pic_push(pic, pic_int_value(match[i].rm_so), positions);
} }
@ -145,12 +145,12 @@ pic_regexp_regexp_split(pic_state *pic)
pic_assert_type(pic, reg, regexp); pic_assert_type(pic, reg, regexp);
while (regexec(&pic_regexp_data_ptr(reg)->reg, input, 1, &match, 0) != REG_NOMATCH) { while (regexec(&pic_regexp_data_ptr(reg)->reg, input, 1, &match, 0) != REG_NOMATCH) {
pic_push(pic, pic_obj_value(pic_str_new(pic, input, match.rm_so)), output); pic_push(pic, pic_obj_value(pic_make_str(pic, input, match.rm_so)), output);
input += match.rm_eo; input += match.rm_eo;
} }
pic_push(pic, pic_obj_value(pic_str_new_cstr(pic, input)), output); pic_push(pic, pic_obj_value(pic_make_str_cstr(pic, input)), output);
return pic_reverse(pic, output); return pic_reverse(pic, output);
} }
@ -161,20 +161,20 @@ pic_regexp_regexp_replace(pic_state *pic)
pic_value reg; pic_value reg;
const char *input; const char *input;
regmatch_t match; regmatch_t match;
pic_str *txt, *output = pic_str_new(pic, NULL, 0); pic_str *txt, *output = pic_make_str(pic, NULL, 0);
pic_get_args(pic, "ozs", &reg, &input, &txt); pic_get_args(pic, "ozs", &reg, &input, &txt);
pic_assert_type(pic, reg, regexp); pic_assert_type(pic, reg, regexp);
while (regexec(&pic_regexp_data_ptr(reg)->reg, input, 1, &match, 0) != REG_NOMATCH) { while (regexec(&pic_regexp_data_ptr(reg)->reg, input, 1, &match, 0) != REG_NOMATCH) {
output = pic_strcat(pic, output, pic_str_new(pic, input, match.rm_so)); output = pic_strcat(pic, output, pic_make_str(pic, input, match.rm_so));
output = pic_strcat(pic, output, txt); output = pic_strcat(pic, output, txt);
input += match.rm_eo; input += match.rm_eo;
} }
output = pic_strcat(pic, output, pic_str_new(pic, input, strlen(input))); output = pic_strcat(pic, output, pic_make_str(pic, input, strlen(input)));
return pic_obj_value(output); return pic_obj_value(output);
} }

@ -1 +1 @@
Subproject commit e58f216b2da6f4a14a35825f2878728872484e30 Subproject commit a2f0d7f7ac4647e3ffbe488169300abb5fedbf16