vec_new -> make_vec

This commit is contained in:
Yuichi Nishiwaki 2014-09-12 19:55:32 +09:00
parent 642bd10fb3
commit 49f09b19bc
3 changed files with 11 additions and 11 deletions

View File

@ -18,8 +18,8 @@ struct pic_vector {
#define pic_vec_p(v) (pic_type(v) == PIC_TT_VECTOR)
#define pic_vec_ptr(o) ((struct pic_vector *)pic_ptr(o))
struct pic_vector *pic_vec_new(pic_state *, size_t);
struct pic_vector *pic_vec_new_from_list(pic_state *, pic_value);
struct pic_vector *pic_make_vec(pic_state *, size_t);
struct pic_vector *pic_make_vec_from_list(pic_state *, pic_value);
#if defined(__cplusplus)
}

4
read.c
View File

@ -588,7 +588,7 @@ read_vector(pic_state *pic, struct pic_port *port, const char *str)
list = read(pic, port, str[1]);
return pic_obj_value(pic_vec_new_from_list(pic, list));
return pic_obj_value(pic_make_vec_from_list(pic, list));
}
static pic_value
@ -625,7 +625,7 @@ read_label_set(pic_state *pic, struct pic_port *port, int i)
if (vect) {
pic_vec *tmp;
val = pic_obj_value(pic_vec_new(pic, 0));
val = pic_obj_value(pic_make_vec(pic, 0));
xh_put_int(&pic->reader->labels, i, &val);

View File

@ -7,7 +7,7 @@
#include "picrin/pair.h"
struct pic_vector *
pic_vec_new(pic_state *pic, size_t len)
pic_make_vec(pic_state *pic, size_t len)
{
struct pic_vector *vec;
size_t i;
@ -22,14 +22,14 @@ pic_vec_new(pic_state *pic, size_t len)
}
struct pic_vector *
pic_vec_new_from_list(pic_state *pic, pic_value data)
pic_make_vec_from_list(pic_state *pic, pic_value data)
{
struct pic_vector *vec;
size_t i, len;
len = pic_length(pic, data);
vec = pic_vec_new(pic, len);
vec = pic_make_vec(pic, len);
for (i = 0; i < len; ++i) {
vec->data[i] = pic_car(pic, data);
data = pic_cdr(pic, data);
@ -57,7 +57,7 @@ pic_vec_make_vector(pic_state *pic)
n = pic_get_args(pic, "i|o", &k, &v);
vec = pic_vec_new(pic, k);
vec = pic_make_vec(pic, k);
if (n == 2) {
for (i = 0; i < (size_t)k; ++i) {
vec->data[i] = v;
@ -152,7 +152,7 @@ pic_vec_vector_copy(pic_state *pic)
end = vec->len;
}
to = pic_vec_new(pic, end - start);
to = pic_make_vec(pic, end - start);
while (start < end) {
to->data[i++] = vec->data[start++];
}
@ -175,7 +175,7 @@ pic_vec_vector_append(pic_state *pic)
len += pic_vec_ptr(argv[i])->len;
}
vec = pic_vec_new(pic, len);
vec = pic_make_vec(pic, len);
len = 0;
for (i = 0; i < argc; ++i) {
@ -219,7 +219,7 @@ pic_vec_list_to_vector(pic_state *pic)
pic_get_args(pic, "o", &list);
vec = pic_vec_new(pic, pic_length(pic, list));
vec = pic_make_vec(pic, pic_length(pic, list));
data = vec->data;