diff --git a/contrib/20.r7rs/src/file.c b/contrib/20.r7rs/src/file.c index dd94803c..9aeae3d4 100644 --- a/contrib/20.r7rs/src/file.c +++ b/contrib/20.r7rs/src/file.c @@ -11,7 +11,7 @@ file_error(pic_state *pic, const char *msg) { struct pic_error *e; - e = pic_make_error(pic, pic_intern_cstr(pic, "file"), msg, pic_nil_value()); + e = pic_make_error(pic, pic_intern(pic, "file"), msg, pic_nil_value()); pic_raise(pic, pic_obj_value(e)); } diff --git a/contrib/20.r7rs/src/load.c b/contrib/20.r7rs/src/load.c index f0d65b6e..15cc6cae 100644 --- a/contrib/20.r7rs/src/load.c +++ b/contrib/20.r7rs/src/load.c @@ -4,27 +4,20 @@ #include "picrin.h" -void -pic_load(pic_state *pic, const char *filename) -{ - struct pic_port *port; - - port = pic_open_file(pic, filename, PIC_PORT_IN | PIC_PORT_TEXT); - - pic_load_port(pic, port); - - pic_close_port(pic, port); -} - static pic_value pic_load_load(pic_state *pic) { pic_value envid; char *fn; + struct pic_port *port; pic_get_args(pic, "z|o", &fn, &envid); - pic_load(pic, fn); + port = pic_open_file(pic, fn, PIC_PORT_IN | PIC_PORT_TEXT); + + pic_load(pic, port); + + pic_close_port(pic, port); return pic_undef_value(); } diff --git a/contrib/20.r7rs/src/mutable-string.c b/contrib/20.r7rs/src/mutable-string.c index 85db9be0..01887976 100644 --- a/contrib/20.r7rs/src/mutable-string.c +++ b/contrib/20.r7rs/src/mutable-string.c @@ -4,13 +4,16 @@ void pic_str_set(pic_state *pic, pic_str *str, size_t i, char c) { pic_str *x, *y, *z, *tmp; + char buf[1]; if (pic_str_len(str) <= i) { pic_errorf(pic, "index out of range %d", i); } + buf[0] = c; + x = pic_str_sub(pic, str, 0, i); - y = pic_make_str_fill(pic, 1, c); + y = pic_make_str(pic, buf, 1); z = pic_str_sub(pic, str, i + 1, pic_str_len(str)); tmp = pic_str_cat(pic, x, pic_str_cat(pic, y, z)); diff --git a/extlib/benz/attr.c b/extlib/benz/attr.c index 3e0bb192..ca11fa07 100644 --- a/extlib/benz/attr.c +++ b/extlib/benz/attr.c @@ -22,13 +22,13 @@ pic_attr(pic_state *pic, pic_value obj) pic_value pic_attr_ref(pic_state *pic, pic_value obj, const char *key) { - return pic_dict_ref(pic, pic_attr(pic, obj), pic_intern_cstr(pic, key)); + return pic_dict_ref(pic, pic_attr(pic, obj), pic_intern(pic, key)); } void pic_attr_set(pic_state *pic, pic_value obj, const char *key, pic_value v) { - pic_dict_set(pic, pic_attr(pic, obj), pic_intern_cstr(pic, key), v); + pic_dict_set(pic, pic_attr(pic, obj), pic_intern(pic, key), v); } static pic_value diff --git a/extlib/benz/debug.c b/extlib/benz/debug.c index 040b12a8..7d682f0f 100644 --- a/extlib/benz/debug.c +++ b/extlib/benz/debug.c @@ -45,7 +45,7 @@ pic_print_backtrace(pic_state *pic, xFILE *file) pic_value elem, it; e = pic_error_ptr(pic->err); - if (e->type != pic_intern_cstr(pic, "")) { + if (e->type != pic_intern(pic, "")) { pic_fwrite(pic, pic_obj_value(e->type), file); xfprintf(pic, file, " "); } diff --git a/extlib/benz/error.c b/extlib/benz/error.c index 1386ab63..c50fc85d 100644 --- a/extlib/benz/error.c +++ b/extlib/benz/error.c @@ -47,22 +47,6 @@ pic_errorf(pic_state *pic, const char *fmt, ...) pic_error(pic, msg, irrs); } -const char * -pic_errmsg(pic_state *pic) -{ - pic_str *str; - - assert(! pic_invalid_p(pic->err)); - - if (! pic_error_p(pic->err)) { - str = pic_format(pic, "~s", pic->err); - } else { - str = pic_error_ptr(pic->err)->msg; - } - - return pic_str_cstr(pic, str); -} - pic_value pic_native_exception_handler(pic_state *pic) { @@ -158,7 +142,7 @@ pic_error(pic_state *pic, const char *msg, pic_value irrs) { struct pic_error *e; - e = pic_make_error(pic, pic_intern_cstr(pic, ""), msg, irrs); + e = pic_make_error(pic, pic_intern(pic, ""), msg, irrs); pic_raise(pic, pic_obj_value(e)); } @@ -212,22 +196,6 @@ pic_error_error(pic_state *pic) pic_error(pic, str, pic_list_by_array(pic, argc, argv)); } -static pic_value -pic_error_make_error_object(pic_state *pic) -{ - struct pic_error *e; - pic_sym *type; - pic_str *msg; - size_t argc; - pic_value *argv; - - pic_get_args(pic, "ms*", &type, &msg, &argc, &argv); - - e = pic_make_error(pic, type, pic_str_cstr(pic, msg), pic_list_by_array(pic, argc, argv)); - - return pic_obj_value(e); -} - static pic_value pic_error_error_object_p(pic_state *pic) { @@ -275,7 +243,6 @@ pic_init_error(pic_state *pic) pic_defun(pic, "raise", pic_error_raise); pic_defun(pic, "raise-continuable", pic_error_raise_continuable); pic_defun(pic, "error", pic_error_error); - pic_defun(pic, "make-error-object", pic_error_make_error_object); pic_defun(pic, "error-object?", pic_error_error_object_p); pic_defun(pic, "error-object-message", pic_error_error_object_message); pic_defun(pic, "error-object-irritants", pic_error_error_object_irritants); diff --git a/extlib/benz/gc.c b/extlib/benz/gc.c index 878c500e..4651ff35 100644 --- a/extlib/benz/gc.c +++ b/extlib/benz/gc.c @@ -487,12 +487,6 @@ gc_mark_object(pic_state *pic, struct pic_object *obj) } break; } - case PIC_TT_BOX: { - struct pic_box *box = (struct pic_box *)obj; - - gc_mark(pic, box->value); - break; - } case PIC_TT_NIL: case PIC_TT_BOOL: #if PIC_ENABLE_FLOAT @@ -739,9 +733,6 @@ gc_finalize_object(pic_state *pic, struct pic_object *obj) case PIC_TT_CP: { break; } - case PIC_TT_BOX: { - break; - } case PIC_TT_NIL: case PIC_TT_BOOL: #if PIC_ENABLE_FLOAT diff --git a/extlib/benz/include/picrin.h b/extlib/benz/include/picrin.h index 585a5dec..54c68494 100644 --- a/extlib/benz/include/picrin.h +++ b/extlib/benz/include/picrin.h @@ -144,7 +144,6 @@ void *pic_malloc(pic_state *, size_t); void *pic_realloc(pic_state *, void *, size_t); void *pic_calloc(pic_state *, size_t, size_t); struct pic_object *pic_obj_alloc(pic_state *, size_t, enum pic_tt); -struct pic_object *pic_obj_alloc_unsafe(pic_state *, size_t, enum pic_tt); void pic_free(pic_state *, void *); void pic_gc_run(pic_state *); @@ -173,14 +172,14 @@ bool pic_eq_p(pic_value, pic_value); bool pic_eqv_p(pic_value, pic_value); bool pic_equal_p(pic_state *, pic_value, pic_value); -pic_sym *pic_intern(pic_state *, pic_str *); -pic_sym *pic_intern_cstr(pic_state *, const char *); +pic_sym *pic_intern(pic_state *, const char *); +pic_sym *pic_intern_str(pic_state *, pic_str *); const char *pic_symbol_name(pic_state *, pic_sym *); pic_value pic_read(pic_state *, struct pic_port *); pic_value pic_read_cstr(pic_state *, const char *); -void pic_load_port(pic_state *, struct pic_port *); +void pic_load(pic_state *, struct pic_port *); void pic_load_cstr(pic_state *, const char *); void pic_define(pic_state *, const char *, pic_value); @@ -209,7 +208,6 @@ pic_value pic_apply5(pic_state *, struct pic_proc *, pic_value, pic_value, pic_v pic_value pic_apply_trampoline(pic_state *, struct pic_proc *, size_t, pic_value *); pic_value pic_apply_trampoline_list(pic_state *, struct pic_proc *, pic_value); pic_value pic_eval(pic_state *, pic_value, struct pic_env *); -struct pic_proc *pic_compile(pic_state *, pic_value, struct pic_env *); struct pic_proc *pic_make_var(pic_state *, pic_value, struct pic_proc *); @@ -233,9 +231,9 @@ void pic_export(pic_state *, pic_sym *); PIC_NORETURN void pic_panic(pic_state *, const char *); PIC_NORETURN void pic_errorf(pic_state *, const char *, ...); void pic_warnf(pic_state *, const char *, ...); -const char *pic_errmsg(pic_state *); pic_str *pic_get_backtrace(pic_state *); void pic_print_backtrace(pic_state *, xFILE *); + struct pic_dict *pic_attr(pic_state *, pic_value); pic_value pic_attr_ref(pic_state *, pic_value, const char *); void pic_attr_set(pic_state *, pic_value, const char *, pic_value); @@ -271,7 +269,6 @@ pic_value pic_fdisplay(pic_state *, pic_value, xFILE *); #include "picrin/symbol.h" #include "picrin/vector.h" #include "picrin/reg.h" -#include "picrin/box.h" #if defined(__cplusplus) } diff --git a/extlib/benz/include/picrin/box.h b/extlib/benz/include/picrin/box.h deleted file mode 100644 index edce0f0d..00000000 --- a/extlib/benz/include/picrin/box.h +++ /dev/null @@ -1,53 +0,0 @@ -/** - * See Copyright Notice in picrin.h - */ - -#ifndef PICRIN_BOX_H -#define PICRIN_BOX_H - -#if defined(__cplusplus) -extern "C" { -#endif - -struct pic_box { - PIC_OBJECT_HEADER - pic_value value; -}; - -#define pic_box_p(v) (pic_type(v) == PIC_TT_BOX) -#define pic_box_ptr(o) ((struct pic_box *)pic_ptr(o)) - -PIC_INLINE pic_value -pic_box(pic_state *pic, pic_value value) -{ - struct pic_box *box; - - box = (struct pic_box *)pic_obj_alloc(pic, sizeof(struct pic_box), PIC_TT_BOX); - box->value = value; - - return pic_obj_value(box); -} - -PIC_INLINE pic_value -pic_unbox(pic_state *pic, pic_value box) -{ - if (! pic_box_p(box)) { - pic_errorf(pic, "box required"); - } - return pic_box_ptr(box)->value; -} - -PIC_INLINE void -pic_set_box(pic_state *pic, pic_value box, pic_value value) -{ - if (! pic_box_p(box)) { - pic_errorf(pic, "box required"); - } - pic_box_ptr(box)->value = value; -} - -#if defined(__cplusplus) -} -#endif - -#endif diff --git a/extlib/benz/include/picrin/irep.h b/extlib/benz/include/picrin/irep.h index aa230848..246a84e2 100644 --- a/extlib/benz/include/picrin/irep.h +++ b/extlib/benz/include/picrin/irep.h @@ -35,6 +35,7 @@ pic_sym *pic_resolve(pic_state *, pic_value, struct pic_env *); pic_value pic_expand(pic_state *, pic_value, struct pic_env *); pic_value pic_analyze(pic_state *, pic_value); struct pic_irep *pic_codegen(pic_state *, pic_value); +struct pic_proc *pic_compile(pic_state *, pic_value, struct pic_env *); #if defined(__cplusplus) } diff --git a/extlib/benz/include/picrin/string.h b/extlib/benz/include/picrin/string.h index 2728e97b..b7448783 100644 --- a/extlib/benz/include/picrin/string.h +++ b/extlib/benz/include/picrin/string.h @@ -22,7 +22,6 @@ void pic_rope_decref(pic_state *, struct pic_rope *); pic_str *pic_make_str(pic_state *, const char * /* nullable */, size_t); pic_str *pic_make_str_cstr(pic_state *, const char *); -pic_str *pic_make_str_fill(pic_state *, size_t, char); char pic_str_ref(pic_state *, pic_str *, size_t); size_t pic_str_len(pic_str *); diff --git a/extlib/benz/include/picrin/type.h b/extlib/benz/include/picrin/type.h index 65156780..e6626960 100644 --- a/extlib/benz/include/picrin/type.h +++ b/extlib/benz/include/picrin/type.h @@ -2,8 +2,8 @@ * See Copyright Notice in picrin.h */ -#ifndef PICRIN_VALUE_H -#define PICRIN_VALUE_H +#ifndef PICRIN_TYPE_H +#define PICRIN_TYPE_H #if defined(__cplusplus) extern "C" { @@ -163,7 +163,6 @@ enum pic_tt { PIC_TT_DATA, PIC_TT_DICT, PIC_TT_REG, - PIC_TT_BOX, PIC_TT_RECORD, PIC_TT_CXT, PIC_TT_IREP, @@ -338,8 +337,6 @@ pic_type_repr(enum pic_tt tt) return "reg"; case PIC_TT_RECORD: return "record"; - case PIC_TT_BOX: - return "box"; case PIC_TT_CP: return "checkpoint"; } diff --git a/extlib/benz/include/picrin/vector.h b/extlib/benz/include/picrin/vector.h index 514ecb4b..2d845308 100644 --- a/extlib/benz/include/picrin/vector.h +++ b/extlib/benz/include/picrin/vector.h @@ -18,8 +18,7 @@ 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_make_vec(pic_state *, size_t); -struct pic_vector *pic_make_vec_from_list(pic_state *, pic_value); +pic_vec *pic_make_vec(pic_state *, size_t); #if defined(__cplusplus) } diff --git a/extlib/benz/load.c b/extlib/benz/load.c index cd609afe..32e6f152 100644 --- a/extlib/benz/load.c +++ b/extlib/benz/load.c @@ -5,7 +5,7 @@ #include "picrin.h" void -pic_load_port(pic_state *pic, struct pic_port *port) +pic_load(pic_state *pic, struct pic_port *port) { pic_value form; size_t ai = pic_gc_arena_preserve(pic); @@ -23,7 +23,7 @@ pic_load_cstr(pic_state *pic, const char *src) struct pic_port *port = pic_open_input_string(pic, src); pic_try { - pic_load_port(pic, port); + pic_load(pic, port); } pic_catch { pic_close_port(pic, port); diff --git a/extlib/benz/macro.c b/extlib/benz/macro.c index cac07fd5..8bca193f 100644 --- a/extlib/benz/macro.c +++ b/extlib/benz/macro.c @@ -56,7 +56,7 @@ pic_uniq(pic_state *pic, pic_value var) str = pic_format(pic, "%s.%d", pic_symbol_name(pic, pic_var_name(pic, var)), pic->ucnt++); - return pic_intern(pic, str); + return pic_intern_str(pic, str); } pic_sym * diff --git a/extlib/benz/port.c b/extlib/benz/port.c index 337d0ecd..9b4b605d 100644 --- a/extlib/benz/port.c +++ b/extlib/benz/port.c @@ -103,7 +103,7 @@ file_error(pic_state *pic, const char *msg) { struct pic_error *e; - e = pic_make_error(pic, pic_intern_cstr(pic, "file"), msg, pic_nil_value()); + e = pic_make_error(pic, pic_intern(pic, "file"), msg, pic_nil_value()); pic_raise(pic, pic_obj_value(e)); } diff --git a/extlib/benz/proc.c b/extlib/benz/proc.c index 4c00885b..d7a5bca1 100644 --- a/extlib/benz/proc.c +++ b/extlib/benz/proc.c @@ -42,19 +42,19 @@ pic_proc_env(pic_state *pic, struct pic_proc *proc) bool pic_proc_env_has(pic_state *pic, struct pic_proc *proc, const char *key) { - return pic_dict_has(pic, pic_proc_env(pic, proc), pic_intern_cstr(pic, key)); + return pic_dict_has(pic, pic_proc_env(pic, proc), pic_intern(pic, key)); } pic_value pic_proc_env_ref(pic_state *pic, struct pic_proc *proc, const char *key) { - return pic_dict_ref(pic, pic_proc_env(pic, proc), pic_intern_cstr(pic, key)); + return pic_dict_ref(pic, pic_proc_env(pic, proc), pic_intern(pic, key)); } void pic_proc_env_set(pic_state *pic, struct pic_proc *proc, const char *key, pic_value val) { - pic_dict_set(pic, pic_proc_env(pic, proc), pic_intern_cstr(pic, key), val); + pic_dict_set(pic, pic_proc_env(pic, proc), pic_intern(pic, key), val); } static pic_value diff --git a/extlib/benz/read.c b/extlib/benz/read.c index 77cce237..3c13fd03 100644 --- a/extlib/benz/read.c +++ b/extlib/benz/read.c @@ -14,7 +14,7 @@ read_error(pic_state *pic, const char *msg) { struct pic_error *e; - e = pic_make_error(pic, pic_intern_cstr(pic, "read"), msg, pic_nil_value()); + e = pic_make_error(pic, pic_intern(pic, "read"), msg, pic_nil_value()); pic_raise(pic, pic_obj_value(e)); } @@ -216,7 +216,7 @@ read_symbol(pic_state *pic, struct pic_port *port, int c) buf[len] = 0; } - sym = pic_intern_cstr(pic, buf); + sym = pic_intern(pic, buf); pic_free(pic, buf); return pic_obj_value(sym); @@ -537,7 +537,7 @@ read_pipe(pic_state *pic, struct pic_port *port, int c) } buf[cnt] = '\0'; - sym = pic_intern_cstr(pic, buf); + sym = pic_intern(pic, buf); pic_free(pic, buf); return pic_obj_value(sym); @@ -643,11 +643,19 @@ read_pair(pic_state *pic, struct pic_port *port, int c) static pic_value read_vector(pic_state *pic, struct pic_port *port, int c) { - pic_value list; + pic_value list, it, elem; + pic_vec *vec; + size_t i = 0; list = read(pic, port, c); - return pic_obj_value(pic_make_vec_from_list(pic, list)); + vec = pic_make_vec(pic, pic_length(pic, list)); + + pic_for_each (elem, list, it) { + vec->data[i++] = elem; + } + + return pic_obj_value(vec); } static pic_value diff --git a/extlib/benz/record.c b/extlib/benz/record.c index dfa21908..db14159e 100644 --- a/extlib/benz/record.c +++ b/extlib/benz/record.c @@ -15,7 +15,7 @@ pic_make_record(pic_state *pic, pic_value rectype) rec = (struct pic_record *)pic_obj_alloc(pic, sizeof(struct pic_record), PIC_TT_RECORD); rec->data = data; - pic_record_set(pic, rec, pic_intern_cstr(pic, "@@type"), rectype); + pic_record_set(pic, rec, pic_intern(pic, "@@type"), rectype); return rec; } @@ -23,7 +23,7 @@ pic_make_record(pic_state *pic, pic_value rectype) pic_value pic_record_type(pic_state *pic, struct pic_record *rec) { - return pic_record_ref(pic, rec, pic_intern_cstr(pic, "@@type")); + return pic_record_ref(pic, rec, pic_intern(pic, "@@type")); } pic_value diff --git a/extlib/benz/state.c b/extlib/benz/state.c index 2fb447a3..8e03f6c4 100644 --- a/extlib/benz/state.c +++ b/extlib/benz/state.c @@ -15,7 +15,7 @@ pic_set_argv(pic_state *pic, int argc, char *argv[], char **envp) void pic_add_feature(pic_state *pic, const char *feature) { - pic_push(pic, pic_obj_value(pic_intern_cstr(pic, feature)), pic->features); + pic_push(pic, pic_obj_value(pic_intern(pic, feature)), pic->features); } void pic_init_undef(pic_state *); @@ -113,10 +113,10 @@ pic_features(pic_state *pic) #define DONE pic_gc_arena_restore(pic, ai); #define define_builtin_syntax(uid, name) \ - pic_define_syntactic_keyword_(pic, pic->lib->env, pic_intern_cstr(pic, name), uid) + pic_define_syntactic_keyword_(pic, pic->lib->env, pic_intern(pic, name), uid) #define VM(uid, name) \ - pic_define_syntactic_keyword_(pic, pic->lib->env, pic_intern_cstr(pic, name), uid) + pic_define_syntactic_keyword_(pic, pic->lib->env, pic_intern(pic, name), uid) #define VM3(name) \ pic->c##name = pic_vm_gref_slot(pic, pic->u##name); @@ -343,7 +343,7 @@ pic_open(pic_allocf allocf, void *userdata) ai = pic_gc_arena_preserve(pic); -#define S(slot,name) pic->slot = pic_intern_cstr(pic, name) +#define S(slot,name) pic->slot = pic_intern(pic, name) S(sQUOTE, "quote"); S(sQUASIQUOTE, "quasiquote"); @@ -364,7 +364,7 @@ pic_open(pic_allocf allocf, void *userdata) pic_gc_arena_restore(pic, ai); -#define U(slot,name) pic->slot = pic_uniq(pic, pic_obj_value(pic_intern_cstr(pic, name))) +#define U(slot,name) pic->slot = pic_uniq(pic, pic_obj_value(pic_intern(pic, name))) U(uDEFINE, "define"); U(uLAMBDA, "lambda"); diff --git a/extlib/benz/string.c b/extlib/benz/string.c index 9d1060c3..f94dfd50 100644 --- a/extlib/benz/string.c +++ b/extlib/benz/string.c @@ -240,25 +240,6 @@ pic_make_str_cstr(pic_state *pic, const char *cstr) return pic_make_str(pic, cstr, strlen(cstr)); } -pic_str * -pic_make_str_fill(pic_state *pic, size_t len, char fill) -{ - size_t i; - char *buf = pic_malloc(pic, len); - pic_str *str; - - for (i = 0; i < len; ++i) { - buf[i] = fill; - } - buf[i] = '\0'; - - str = pic_make_str(pic, buf, len); - - pic_free(pic, buf); - - return str; -} - size_t pic_str_len(pic_str *str) { @@ -471,10 +452,18 @@ pic_str_make_string(pic_state *pic) { size_t len; char c = ' '; + char *buf; + pic_value ret; pic_get_args(pic, "k|c", &len, &c); - return pic_obj_value(pic_make_str_fill(pic, len, c)); + buf = pic_malloc(pic, len); + memset(buf, c, len); + + ret = pic_obj_value(pic_make_str(pic, buf, len)); + + pic_free(pic, buf); + return ret; } static pic_value diff --git a/extlib/benz/symbol.c b/extlib/benz/symbol.c index ba5fb47c..5dec1035 100644 --- a/extlib/benz/symbol.c +++ b/extlib/benz/symbol.c @@ -7,13 +7,13 @@ KHASH_DEFINE(s, const char *, pic_sym *, kh_str_hash_func, kh_str_hash_equal) pic_sym * -pic_intern(pic_state *pic, pic_str *str) +pic_intern_str(pic_state *pic, pic_str *str) { - return pic_intern_cstr(pic, pic_str_cstr(pic, str)); + return pic_intern(pic, pic_str_cstr(pic, str)); } pic_sym * -pic_intern_cstr(pic_state *pic, const char *cstr) +pic_intern(pic_state *pic, const char *cstr) { khash_t(s) *h = &pic->syms; pic_sym *sym; @@ -93,7 +93,7 @@ pic_symbol_string_to_symbol(pic_state *pic) pic_get_args(pic, "s", &str); - return pic_obj_value(pic_intern(pic, str)); + return pic_obj_value(pic_intern_str(pic, str)); } void diff --git a/extlib/benz/vector.c b/extlib/benz/vector.c index c3b914c1..a270ad69 100644 --- a/extlib/benz/vector.c +++ b/extlib/benz/vector.c @@ -19,22 +19,6 @@ pic_make_vec(pic_state *pic, size_t len) return vec; } -struct pic_vector * -pic_make_vec_from_list(pic_state *pic, pic_value data) -{ - struct pic_vector *vec; - size_t len, i; - - len = pic_length(pic, data); - - vec = pic_make_vec(pic, len); - for (i = 0; i < len; ++i) { - vec->data[i] = pic_car(pic, data); - data = pic_cdr(pic, data); - } - return vec; -} - static pic_value pic_vec_vector_p(pic_state *pic) { diff --git a/extlib/benz/vm.c b/extlib/benz/vm.c index 23a6ef46..4ab5a644 100644 --- a/extlib/benz/vm.c +++ b/extlib/benz/vm.c @@ -1114,7 +1114,7 @@ pic_define_(pic_state *pic, const char *name, pic_value val) { pic_sym *sym, *uid; - sym = pic_intern_cstr(pic, name); + sym = pic_intern(pic, name); if ((uid = pic_find_variable(pic, pic->lib->env, pic_obj_value(sym))) == NULL) { uid = pic_add_variable(pic, pic->lib->env, pic_obj_value(sym)); @@ -1131,7 +1131,7 @@ void pic_define(pic_state *pic, const char *name, pic_value val) { pic_define_(pic, name, val); - pic_export(pic, pic_intern_cstr(pic, name)); + pic_export(pic, pic_intern(pic, name)); } void @@ -1144,7 +1144,7 @@ void pic_defun(pic_state *pic, const char *name, pic_func_t cfunc) { pic_defun_(pic, name, cfunc); - pic_export(pic, pic_intern_cstr(pic, name)); + pic_export(pic, pic_intern(pic, name)); } void @@ -1157,7 +1157,7 @@ void pic_defvar(pic_state *pic, const char *name, pic_value init, struct pic_proc *conv) { pic_defvar_(pic, name, init, conv); - pic_export(pic, pic_intern_cstr(pic, name)); + pic_export(pic, pic_intern(pic, name)); } pic_value @@ -1165,7 +1165,7 @@ pic_ref(pic_state *pic, struct pic_lib *lib, const char *name) { pic_sym *sym, *uid; - sym = pic_intern_cstr(pic, name); + sym = pic_intern(pic, name); if ((uid = pic_find_variable(pic, lib->env, pic_obj_value(sym))) == NULL) { pic_errorf(pic, "symbol \"%s\" not defined in library ~s", name, lib->name); @@ -1179,7 +1179,7 @@ pic_set(pic_state *pic, struct pic_lib *lib, const char *name, pic_value val) { pic_sym *sym, *uid; - sym = pic_intern_cstr(pic, name); + sym = pic_intern(pic, name); if ((uid = pic_find_variable(pic, lib->env, pic_obj_value(sym))) == NULL) { pic_errorf(pic, "symbol \"%s\" not defined in library ~s", name, lib->name);