pic_intern_cstr -> pic_intern

This commit is contained in:
Yuichi Nishiwaki 2015-07-13 08:16:04 +09:00
parent 81c38d8fa2
commit 71d1d4837d
13 changed files with 32 additions and 32 deletions

View File

@ -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));
}

View File

@ -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

View File

@ -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, " ");
}

View File

@ -158,7 +158,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));
}

View File

@ -172,8 +172,8 @@ 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 *);

View File

@ -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 *

View File

@ -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));
}

View File

@ -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

View File

@ -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);

View File

@ -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

View File

@ -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");

View File

@ -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

View File

@ -1113,7 +1113,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));
@ -1130,7 +1130,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
@ -1143,7 +1143,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
@ -1156,7 +1156,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
@ -1164,7 +1164,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);
@ -1178,7 +1178,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);