From 16dafdd032de9deda6171cec1bc7d12c33aa41f4 Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Thu, 6 Apr 2017 22:29:02 +0900 Subject: [PATCH] remove pic_ prefix from pic_*_ptr family --- lib/blob.c | 5 +++-- lib/data.c | 4 ++-- lib/debug.c | 2 +- lib/dict.c | 20 ++++++++++---------- lib/error.c | 12 ++++++------ lib/ext/load.c | 2 +- lib/ext/read.c | 8 ++++---- lib/object.h | 10 +++++----- lib/pair.c | 14 +++++++------- lib/port.c | 38 +++++++++++++++++++------------------- lib/proc.c | 10 +++++----- lib/record.c | 4 ++-- lib/string.c | 14 +++++++------- lib/symbol.c | 8 ++++---- lib/vector.c | 12 ++++++------ lib/weak.c | 8 ++++---- 16 files changed, 86 insertions(+), 85 deletions(-) diff --git a/lib/blob.c b/lib/blob.c index 4a936093..22a9c7ed 100644 --- a/lib/blob.c +++ b/lib/blob.c @@ -22,10 +22,11 @@ pic_blob_value(pic_state *pic, const unsigned char *buf, int len) unsigned char * pic_blob(pic_state *pic, pic_value blob, int *len) { + struct blob *bv = blob_ptr(pic, blob); if (len) { - *len = pic_blob_ptr(pic, blob)->len; + *len = bv->len; } - return pic_blob_ptr(pic, blob)->data; + return bv->data; } static pic_value diff --git a/lib/data.c b/lib/data.c index 9a5ad178..571a41aa 100644 --- a/lib/data.c +++ b/lib/data.c @@ -11,13 +11,13 @@ pic_data_p(pic_state *pic, pic_value obj, const pic_data_type *type) if (pic_type(pic, obj) != PIC_TYPE_DATA) { return false; } - return type == NULL || pic_data_ptr(pic, obj)->type == type; + return type == NULL || data_ptr(pic, obj)->type == type; } void * pic_data(pic_state *PIC_UNUSED(pic), pic_value data) { - return pic_data_ptr(pic, data)->data; + return data_ptr(pic, data)->data; } pic_value diff --git a/lib/debug.c b/lib/debug.c index 85ffa351..b76d37e0 100644 --- a/lib/debug.c +++ b/lib/debug.c @@ -45,7 +45,7 @@ pic_print_error(pic_state *pic, pic_value port, pic_value err) struct error *e; pic_value elem, it; - e = pic_error_ptr(pic, err); + e = error_ptr(pic, err); if (! pic_eq_p(pic, obj_value(pic, e->type), pic_intern_lit(pic, ""))) { pic_fprintf(pic, port, "~s-", obj_value(pic, e->type)); } diff --git a/lib/dict.c b/lib/dict.c index 4b453e9a..eb7a6710 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -20,10 +20,10 @@ pic_make_dict(pic_state *pic) pic_value pic_dict_ref(pic_state *pic, pic_value dict, pic_value key) { - khash_t(dict) *h = &pic_dict_ptr(pic, dict)->hash; + khash_t(dict) *h = &dict_ptr(pic, dict)->hash; int it; - it = kh_get(dict, h, pic_sym_ptr(pic, key)); + it = kh_get(dict, h, sym_ptr(pic, key)); if (it == kh_end(h)) { pic_error(pic, "element not found for given key", 1, key); } @@ -33,35 +33,35 @@ pic_dict_ref(pic_state *pic, pic_value dict, pic_value key) void pic_dict_set(pic_state *pic, pic_value dict, pic_value key, pic_value val) { - khash_t(dict) *h = &pic_dict_ptr(pic, dict)->hash; + khash_t(dict) *h = &dict_ptr(pic, dict)->hash; int ret; int it; - it = kh_put(dict, h, pic_sym_ptr(pic, key), &ret); + it = kh_put(dict, h, sym_ptr(pic, key), &ret); kh_val(h, it) = val; } int pic_dict_size(pic_state *PIC_UNUSED(pic), pic_value dict) { - return kh_size(&pic_dict_ptr(pic, dict)->hash); + return kh_size(&dict_ptr(pic, dict)->hash); } bool pic_dict_has(pic_state *pic, pic_value dict, pic_value key) { - khash_t(dict) *h = &pic_dict_ptr(pic, dict)->hash; + khash_t(dict) *h = &dict_ptr(pic, dict)->hash; - return kh_get(dict, h, pic_sym_ptr(pic, key)) != kh_end(h); + return kh_get(dict, h, sym_ptr(pic, key)) != kh_end(h); } void pic_dict_del(pic_state *pic, pic_value dict, pic_value key) { - khash_t(dict) *h = &pic_dict_ptr(pic, dict)->hash; + khash_t(dict) *h = &dict_ptr(pic, dict)->hash; int it; - it = kh_get(dict, h, pic_sym_ptr(pic, key)); + it = kh_get(dict, h, sym_ptr(pic, key)); if (it == kh_end(h)) { pic_error(pic, "element not found for given key", 1, key); } @@ -71,7 +71,7 @@ pic_dict_del(pic_state *pic, pic_value dict, pic_value key) bool pic_dict_next(pic_state *PIC_UNUSED(pic), pic_value dict, int *iter, pic_value *key, pic_value *val) { - khash_t(dict) *h = &pic_dict_ptr(pic, dict)->hash; + khash_t(dict) *h = &dict_ptr(pic, dict)->hash; int it = *iter; for (it = *iter; it != kh_end(h); ++it) { diff --git a/lib/error.c b/lib/error.c index 98e77f22..d96c3e5b 100644 --- a/lib/error.c +++ b/lib/error.c @@ -88,10 +88,10 @@ pic_make_error(pic_state *pic, const char *type, const char *msg, pic_value irrs stack = pic_get_backtrace(pic); e = (struct error *)pic_obj_alloc(pic, sizeof(struct error), PIC_TYPE_ERROR); - e->type = pic_sym_ptr(pic, ty); - e->msg = pic_str_ptr(pic, pic_cstr_value(pic, msg)); + e->type = sym_ptr(pic, ty); + e->msg = str_ptr(pic, pic_cstr_value(pic, msg)); e->irrs = irrs; - e->stack = pic_str_ptr(pic, stack); + e->stack = str_ptr(pic, stack); return obj_value(pic, e); } @@ -228,7 +228,7 @@ pic_error_error_object_message(pic_state *pic) TYPE_CHECK(pic, e, error); - return obj_value(pic, pic_error_ptr(pic, e)->msg); + return obj_value(pic, error_ptr(pic, e)->msg); } static pic_value @@ -240,7 +240,7 @@ pic_error_error_object_irritants(pic_state *pic) TYPE_CHECK(pic, e, error); - return pic_error_ptr(pic, e)->irrs; + return error_ptr(pic, e)->irrs; } static pic_value @@ -252,7 +252,7 @@ pic_error_error_object_type(pic_state *pic) TYPE_CHECK(pic, e, error); - return obj_value(pic, pic_error_ptr(pic, e)->type); + return obj_value(pic, error_ptr(pic, e)->type); } void diff --git a/lib/ext/load.c b/lib/ext/load.c index 104b1210..9b6a033b 100644 --- a/lib/ext/load.c +++ b/lib/ext/load.c @@ -535,7 +535,7 @@ index_global(pic_state *pic, codegen_context *cxt, pic_value name) check_pool_size(pic, cxt); pidx = (int)cxt->plen++; - cxt->pool[pidx] = (struct object *)pic_sym_ptr(pic, name); + cxt->pool[pidx] = (struct object *)sym_ptr(pic, name); return pidx; } diff --git a/lib/ext/read.c b/lib/ext/read.c index d20e9ff6..e79f5204 100644 --- a/lib/ext/read.c +++ b/lib/ext/read.c @@ -531,8 +531,8 @@ read_label_set(pic_state *pic, pic_value port, int i, struct reader_control *p) kh_val(h, it) = val = pic_cons(pic, pic_undef_value(pic), pic_undef_value(pic)); tmp = read_value(pic, port, c, p); - pic_pair_ptr(pic, val)->car = pic_car(pic, tmp); - pic_pair_ptr(pic, val)->cdr = pic_cdr(pic, tmp); + pair_ptr(pic, val)->car = pic_car(pic, tmp); + pair_ptr(pic, val)->cdr = pic_cdr(pic, tmp); return val; } @@ -552,8 +552,8 @@ read_label_set(pic_state *pic, pic_value port, int i, struct reader_control *p) kh_val(h, it) = val = pic_make_vec(pic, 0, NULL); tmp = read_value(pic, port, c, p); - PIC_SWAP(pic_value *, pic_vec_ptr(pic, tmp)->data, pic_vec_ptr(pic, val)->data); - PIC_SWAP(int, pic_vec_ptr(pic, tmp)->len, pic_vec_ptr(pic, val)->len); + PIC_SWAP(pic_value *, vec_ptr(pic, tmp)->data, vec_ptr(pic, val)->data); + PIC_SWAP(int, vec_ptr(pic, tmp)->len, vec_ptr(pic, val)->len); return val; } diff --git a/lib/object.h b/lib/object.h index 19321862..1b0e7d75 100644 --- a/lib/object.h +++ b/lib/object.h @@ -233,11 +233,11 @@ obj_value(pic_state *PIC_UNUSED(pic), void *ptr) #endif /* NAN_BOXING */ -#define DEFPTR(name,type) \ - PIC_STATIC_INLINE type * \ - pic_##name##_ptr(pic_state *PIC_UNUSED(pic), pic_value o) { \ - assert(pic_##name##_p(pic,o)); \ - return (type *) obj_ptr(pic, o); \ +#define DEFPTR(name,type) \ + PIC_STATIC_INLINE type * \ + name##_ptr(pic_state *PIC_UNUSED(pic), pic_value o) { \ + assert(pic_##name##_p(pic,o)); \ + return (type *) obj_ptr(pic, o); \ } #define pic_data_p(pic,o) (pic_data_p(pic,o,NULL)) diff --git a/lib/pair.c b/lib/pair.c index 04ee7218..a1380e99 100644 --- a/lib/pair.c +++ b/lib/pair.c @@ -23,7 +23,7 @@ pic_car(pic_state *pic, pic_value obj) if (! pic_pair_p(pic, obj)) { pic_error(pic, "car: pair required", 1, obj); } - return pic_pair_ptr(pic, obj)->car; + return pair_ptr(pic, obj)->car; } pic_value @@ -32,7 +32,7 @@ pic_cdr(pic_state *pic, pic_value obj) if (! pic_pair_p(pic, obj)) { pic_error(pic, "cdr: pair required", 1, obj); } - return pic_pair_ptr(pic, obj)->cdr; + return pair_ptr(pic, obj)->cdr; } void @@ -41,7 +41,7 @@ pic_set_car(pic_state *pic, pic_value obj, pic_value val) if (! pic_pair_p(pic, obj)) { pic_error(pic, "pair required", 0); } - pic_pair_ptr(pic, obj)->car = val; + pair_ptr(pic, obj)->car = val; } void @@ -50,7 +50,7 @@ pic_set_cdr(pic_state *pic, pic_value obj, pic_value val) if (! pic_pair_p(pic, obj)) { pic_error(pic, "pair required", 0); } - pic_pair_ptr(pic, obj)->cdr = val; + pair_ptr(pic, obj)->cdr = val; } pic_value @@ -91,7 +91,7 @@ pic_list_p(pic_state *pic, pic_value obj) /* advance rapid fast-forward; runs 2x faster than local */ for (i = 0; i < 2; ++i) { if (pic_pair_p(pic, rapid)) { - rapid = pic_pair_ptr(pic, rapid)->cdr; + rapid = pair_ptr(pic, rapid)->cdr; } else { return pic_nil_p(pic, rapid); @@ -99,7 +99,7 @@ pic_list_p(pic_state *pic, pic_value obj) } /* advance local */ - local = pic_pair_ptr(pic, local)->cdr; + local = pair_ptr(pic, local)->cdr; if (pic_eq_p(pic, local, rapid)) { return false; @@ -153,7 +153,7 @@ pic_list_ref(pic_state *pic, pic_value list, int i) void pic_list_set(pic_state *pic, pic_value list, int i, pic_value obj) { - pic_pair_ptr(pic, pic_list_tail(pic, list, i))->car = obj; + pair_ptr(pic, pic_list_tail(pic, list, i))->car = obj; } pic_value diff --git a/lib/port.c b/lib/port.c index b17a6184..07af1bd5 100644 --- a/lib/port.c +++ b/lib/port.c @@ -16,7 +16,7 @@ pic_port_p(pic_state *pic, pic_value obj, const pic_port_type *type) if (pic_type(pic, obj) != PIC_TYPE_PORT) { return false; } - return type == NULL || pic_port_ptr(pic, obj)->file.vtable == type; + return type == NULL || port_ptr(pic, obj)->file.vtable == type; } pic_value @@ -37,7 +37,7 @@ pic_funopen(pic_state *pic, void *cookie, const pic_port_type *type) int pic_fclose(pic_state *pic, pic_value port) { - struct file *fp = &pic_port_ptr(pic, port)->file; + struct file *fp = &port_ptr(pic, port)->file; if (fp->flag == 0) return 0; @@ -51,7 +51,7 @@ pic_fclose(pic_state *pic, pic_value port) void pic_clearerr(pic_state *PIC_UNUSED(pic), pic_value port) { - struct file *fp = &pic_port_ptr(pic, port)->file; + struct file *fp = &port_ptr(pic, port)->file; fp->flag &= ~(FILE_EOF | FILE_ERR); } @@ -59,7 +59,7 @@ pic_clearerr(pic_state *PIC_UNUSED(pic), pic_value port) int pic_feof(pic_state *PIC_UNUSED(pic), pic_value port) { - struct file *fp = &pic_port_ptr(pic, port)->file; + struct file *fp = &port_ptr(pic, port)->file; return (fp->flag & FILE_EOF) != 0; } @@ -67,7 +67,7 @@ pic_feof(pic_state *PIC_UNUSED(pic), pic_value port) int pic_ferror(pic_state *PIC_UNUSED(pic), pic_value port) { - struct file *fp = &pic_port_ptr(pic, port)->file; + struct file *fp = &port_ptr(pic, port)->file; return (fp->flag & FILE_ERR) != 0; } @@ -164,7 +164,7 @@ flushbuf(pic_state *pic, int x, struct file *fp) int pic_fflush(pic_state *pic, pic_value port) { - struct file *fp = &pic_port_ptr(pic, port)->file; + struct file *fp = &port_ptr(pic, port)->file; int retval; retval = 0; @@ -188,7 +188,7 @@ pic_fflush(pic_state *pic, pic_value port) int pic_fputc(pic_state *pic, int x, pic_value port) { - struct file *fp = &pic_port_ptr(pic, port)->file; + struct file *fp = &port_ptr(pic, port)->file; return putc_(pic, x, fp); } @@ -196,7 +196,7 @@ pic_fputc(pic_state *pic, int x, pic_value port) int pic_fgetc(pic_state *pic, pic_value port) { - struct file *fp = &pic_port_ptr(pic, port)->file; + struct file *fp = &port_ptr(pic, port)->file; return getc_(pic, fp); } @@ -204,7 +204,7 @@ pic_fgetc(pic_state *pic, pic_value port) int pic_fputs(pic_state *pic, const char *s, pic_value port) { - struct file *fp = &pic_port_ptr(pic, port)->file; + struct file *fp = &port_ptr(pic, port)->file; const char *ptr = s; while(*ptr != '\0') { @@ -218,7 +218,7 @@ pic_fputs(pic_state *pic, const char *s, pic_value port) char * pic_fgets(pic_state *pic, char *s, int size, pic_value port) { - struct file *fp = &pic_port_ptr(pic, port)->file; + struct file *fp = &port_ptr(pic, port)->file; int c = 0; char *buf; @@ -240,7 +240,7 @@ pic_fgets(pic_state *pic, char *s, int size, pic_value port) int pic_ungetc(pic_state *PIC_UNUSED(pic), int c, pic_value port) { - struct file *fp = &pic_port_ptr(pic, port)->file; + struct file *fp = &port_ptr(pic, port)->file; unsigned char uc = c; if (c == EOF || fp->base == fp->ptr) { @@ -253,7 +253,7 @@ pic_ungetc(pic_state *PIC_UNUSED(pic), int c, pic_value port) size_t pic_fread(pic_state *pic, void *ptr, size_t size, size_t count, pic_value port) { - struct file *fp = &pic_port_ptr(pic, port)->file; + struct file *fp = &port_ptr(pic, port)->file; char *bptr = ptr; long nbytes; int c; @@ -279,7 +279,7 @@ pic_fread(pic_state *pic, void *ptr, size_t size, size_t count, pic_value port) size_t pic_fwrite(pic_state *pic, const void *ptr, size_t size, size_t count, pic_value port) { - struct file *fp = &pic_port_ptr(pic, port)->file; + struct file *fp = &port_ptr(pic, port)->file; const char *bptr = ptr; long nbytes; @@ -302,7 +302,7 @@ pic_fwrite(pic_state *pic, const void *ptr, size_t size, size_t count, pic_value long pic_fseek(pic_state *pic, pic_value port, long offset, int whence) { - struct file *fp = &pic_port_ptr(pic, port)->file; + struct file *fp = &port_ptr(pic, port)->file; long s; pic_fflush(pic, port); @@ -520,7 +520,7 @@ pic_fmemopen(pic_state *pic, const char *data, int size, const char *mode) int pic_fgetbuf(pic_state *pic, pic_value port, const char **buf, int *len) { - struct file *fp = &pic_port_ptr(pic, port)->file; + struct file *fp = &port_ptr(pic, port)->file; xbuf_t *s; pic_fflush(pic, port); @@ -541,7 +541,7 @@ pic_port_input_port_p(pic_state *pic) pic_get_args(pic, "o", &v); - if (pic_port_p(pic, v, NULL) && (pic_port_ptr(pic, v)->file.flag & FILE_READ) != 0) { + if (pic_port_p(pic, v, NULL) && (port_ptr(pic, v)->file.flag & FILE_READ) != 0) { return pic_true_value(pic); } else { return pic_false_value(pic); @@ -555,7 +555,7 @@ pic_port_output_port_p(pic_state *pic) pic_get_args(pic, "o", &v); - if (pic_port_p(pic, v, NULL) && (pic_port_ptr(pic, v)->file.flag & FILE_WRITE) != 0) { + if (pic_port_p(pic, v, NULL) && (port_ptr(pic, v)->file.flag & FILE_WRITE) != 0) { return pic_true_value(pic); } else { @@ -598,7 +598,7 @@ pic_port_port_open_p(pic_state *pic) pic_get_args(pic, "p", &port); - return pic_bool_value(pic, pic_port_ptr(pic, port)->file.flag != 0); + return pic_bool_value(pic, port_ptr(pic, port)->file.flag != 0); } static pic_value @@ -614,7 +614,7 @@ pic_port_close_port(pic_state *pic) } #define assert_port_profile(port, flags, caller) do { \ - int flag = pic_port_ptr(pic, port)->file.flag; \ + int flag = port_ptr(pic, port)->file.flag; \ if ((flag & (flags)) != (flags)) { \ switch (flags) { \ case FILE_WRITE: \ diff --git a/lib/proc.c b/lib/proc.c index 392e27e5..d6c7b053 100644 --- a/lib/proc.c +++ b/lib/proc.c @@ -268,10 +268,10 @@ pic_closure_ref(pic_state *pic, int n) { pic_value self = GET_PROC(pic); - if (n < 0 || pic_proc_ptr(pic, self)->u.f.localc <= n) { + if (n < 0 || proc_ptr(pic, self)->u.f.localc <= n) { pic_error(pic, "pic_closure_ref: index out of range", 1, pic_int_value(pic, n)); } - return pic_proc_ptr(pic, self)->locals[n]; + return proc_ptr(pic, self)->locals[n]; } void @@ -279,10 +279,10 @@ pic_closure_set(pic_state *pic, int n, pic_value v) { pic_value self = GET_PROC(pic); - if (n < 0 || pic_proc_ptr(pic, self)->u.f.localc <= n) { + if (n < 0 || proc_ptr(pic, self)->u.f.localc <= n) { pic_error(pic, "pic_closure_ref: index out of range", 1, pic_int_value(pic, n)); } - pic_proc_ptr(pic, self)->locals[n] = v; + proc_ptr(pic, self)->locals[n] = v; } static void @@ -525,7 +525,7 @@ pic_apply(pic_state *pic, pic_value proc, int argc, pic_value *argv) if (! pic_proc_p(pic, x)) { pic_error(pic, "invalid application", 1, x); } - proc = pic_proc_ptr(pic, x); + proc = proc_ptr(pic, x); if (pic->sp >= pic->stend) { pic_panic(pic, "VM stack overflow"); diff --git a/lib/record.c b/lib/record.c index 36e85216..2a2dccb7 100644 --- a/lib/record.c +++ b/lib/record.c @@ -20,13 +20,13 @@ pic_make_record(pic_state *pic, pic_value type, pic_value datum) pic_value pic_record_type(pic_state *pic, pic_value rec) { - return pic_rec_ptr(pic, rec)->type; + return rec_ptr(pic, rec)->type; } pic_value pic_record_datum(pic_state *pic, pic_value rec) { - return pic_rec_ptr(pic, rec)->datum; + return rec_ptr(pic, rec)->datum; } static pic_value diff --git a/lib/string.c b/lib/string.c index 78379d1e..b7933340 100644 --- a/lib/string.c +++ b/lib/string.c @@ -192,9 +192,9 @@ flatten(pic_state *pic, struct rope *rope, struct rope *owner, char *buf) static void str_update(pic_state *pic, pic_value dst, pic_value src) { - pic_rope_incref(pic_str_ptr(pic, src)->rope); - pic_rope_decref(pic, pic_str_ptr(pic, dst)->rope); - pic_str_ptr(pic, dst)->rope = pic_str_ptr(pic, src)->rope; + pic_rope_incref(str_ptr(pic, src)->rope); + pic_rope_decref(pic, str_ptr(pic, dst)->rope); + str_ptr(pic, dst)->rope = str_ptr(pic, src)->rope; } pic_value @@ -251,25 +251,25 @@ pic_vstrf_value(pic_state *pic, const char *fmt, va_list ap) int pic_str_len(pic_state *PIC_UNUSED(pic), pic_value str) { - return pic_str_ptr(pic, str)->rope->weight; + return str_ptr(pic, str)->rope->weight; } pic_value pic_str_cat(pic_state *pic, pic_value a, pic_value b) { - return make_str(pic, merge(pic, pic_str_ptr(pic, a)->rope, pic_str_ptr(pic, b)->rope)); + return make_str(pic, merge(pic, str_ptr(pic, a)->rope, str_ptr(pic, b)->rope)); } pic_value pic_str_sub(pic_state *pic, pic_value str, int s, int e) { - return make_str(pic, slice(pic, pic_str_ptr(pic, str)->rope, s, e)); + return make_str(pic, slice(pic, str_ptr(pic, str)->rope, s, e)); } const char * pic_str(pic_state *pic, pic_value str, int *len) { - struct rope *rope = pic_str_ptr(pic, str)->rope, *r; + struct rope *rope = str_ptr(pic, str)->rope, *r; if (len) { *len = rope->weight; diff --git a/lib/symbol.c b/lib/symbol.c index 6b45a4fb..0f99660e 100644 --- a/lib/symbol.c +++ b/lib/symbol.c @@ -20,7 +20,7 @@ pic_intern(pic_state *pic, pic_value str) int it; int ret; - it = kh_put(oblist, h, pic_str_ptr(pic, str), &ret); + it = kh_put(oblist, h, str_ptr(pic, str), &ret); if (ret == 0) { /* if exists */ sym = kh_val(h, it); pic_protect(pic, obj_value(pic, sym)); @@ -30,16 +30,16 @@ pic_intern(pic_state *pic, pic_value str) kh_val(h, it) = NULL; /* dummy */ sym = (struct symbol *)pic_obj_alloc(pic, sizeof(struct symbol), PIC_TYPE_SYMBOL); - sym->str = pic_str_ptr(pic, str); + sym->str = str_ptr(pic, str); kh_val(h, it) = sym; return obj_value(pic, sym); } pic_value -pic_sym_name(pic_state *PIC_UNUSED(pic), pic_value sym) +pic_sym_name(pic_state *pic, pic_value sym) { - return obj_value(pic, pic_sym_ptr(pic, sym)->str); + return obj_value(pic, sym_ptr(pic, sym)->str); } static pic_value diff --git a/lib/vector.c b/lib/vector.c index 94e87d58..2925f884 100644 --- a/lib/vector.c +++ b/lib/vector.c @@ -27,19 +27,19 @@ pic_make_vec(pic_state *pic, int len, pic_value *argv) pic_value pic_vec_ref(pic_state *PIC_UNUSED(pic), pic_value vec, int k) { - return pic_vec_ptr(pic, vec)->data[k]; + return vec_ptr(pic, vec)->data[k]; } void pic_vec_set(pic_state *PIC_UNUSED(pic), pic_value vec, int k, pic_value val) { - pic_vec_ptr(pic, vec)->data[k] = val; + vec_ptr(pic, vec)->data[k] = val; } int pic_vec_len(pic_state *PIC_UNUSED(pic), pic_value vec) { - return pic_vec_ptr(pic, vec)->len; + return vec_ptr(pic, vec)->len; } static pic_value @@ -142,7 +142,7 @@ pic_vec_vector_copy_i(pic_state *pic) VALID_ATRANGE(pic, tolen, at, fromlen, start, end); - memmove(pic_vec_ptr(pic, to)->data + at, pic_vec_ptr(pic, from)->data + start, sizeof(pic_value) * (end - start)); + memmove(vec_ptr(pic, to)->data + at, vec_ptr(pic, from)->data + start, sizeof(pic_value) * (end - start)); return pic_undef_value(pic); } @@ -166,7 +166,7 @@ pic_vec_vector_copy(pic_state *pic) VALID_RANGE(pic, fromlen, start, end); - return pic_make_vec(pic, end - start, pic_vec_ptr(pic, from)->data + start); + return pic_make_vec(pic, end - start, vec_ptr(pic, from)->data + start); } static pic_value @@ -188,7 +188,7 @@ pic_vec_vector_append(pic_state *pic) len = 0; for (i = 0; i < argc; ++i) { int l = pic_vec_len(pic, argv[i]); - memcpy(pic_vec_ptr(pic, vec)->data + len, pic_vec_ptr(pic, argv[i])->data, sizeof(pic_value) * l); + memcpy(vec_ptr(pic, vec)->data + len, vec_ptr(pic, argv[i])->data, sizeof(pic_value) * l); len += l; } diff --git a/lib/weak.c b/lib/weak.c index b130f6f2..7308722a 100644 --- a/lib/weak.c +++ b/lib/weak.c @@ -22,7 +22,7 @@ pic_make_weak(pic_state *pic) pic_value pic_weak_ref(pic_state *pic, pic_value weak, pic_value key) { - khash_t(weak) *h = &pic_weak_ptr(pic, weak)->hash; + khash_t(weak) *h = &weak_ptr(pic, weak)->hash; int it; it = kh_get(weak, h, obj_ptr(pic, key)); @@ -35,7 +35,7 @@ pic_weak_ref(pic_state *pic, pic_value weak, pic_value key) void pic_weak_set(pic_state *pic, pic_value weak, pic_value key, pic_value val) { - khash_t(weak) *h = &pic_weak_ptr(pic, weak)->hash; + khash_t(weak) *h = &weak_ptr(pic, weak)->hash; int ret; int it; @@ -46,7 +46,7 @@ pic_weak_set(pic_state *pic, pic_value weak, pic_value key, pic_value val) bool pic_weak_has(pic_state *pic, pic_value weak, pic_value key) { - khash_t(weak) *h = &pic_weak_ptr(pic, weak)->hash; + khash_t(weak) *h = &weak_ptr(pic, weak)->hash; return kh_get(weak, h, obj_ptr(pic, key)) != kh_end(h); } @@ -54,7 +54,7 @@ pic_weak_has(pic_state *pic, pic_value weak, pic_value key) void pic_weak_del(pic_state *pic, pic_value weak, pic_value key) { - khash_t(weak) *h = &pic_weak_ptr(pic, weak)->hash; + khash_t(weak) *h = &weak_ptr(pic, weak)->hash; int it; it = kh_get(weak, h, obj_ptr(pic, key));