pic_sym -> symbol, pic_id -> identifier
This commit is contained in:
parent
684eb6502d
commit
bfe6cef4c8
|
@ -94,7 +94,7 @@ internal_equal_p(pic_state *pic, pic_value x, pic_value y, int depth, khash_t(m)
|
|||
|
||||
switch (pic_type(pic, x)) {
|
||||
case PIC_TYPE_ID: {
|
||||
pic_id *id1, *id2;
|
||||
identifier *id1, *id2;
|
||||
pic_value s1, s2;
|
||||
|
||||
id1 = pic_id_ptr(pic, x);
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include "picrin/extra.h"
|
||||
#include "picrin/private/object.h"
|
||||
|
||||
KHASH_DEFINE(dict, pic_sym *, pic_value, kh_ptr_hash_func, kh_ptr_hash_equal)
|
||||
KHASH_DEFINE(dict, symbol *, pic_value, kh_ptr_hash_func, kh_ptr_hash_equal)
|
||||
|
||||
pic_value
|
||||
pic_make_dict(pic_state *pic)
|
||||
|
|
|
@ -620,7 +620,7 @@ gc_sweep_phase(pic_state *pic)
|
|||
int it;
|
||||
khash_t(weak) *h;
|
||||
khash_t(oblist) *s = &pic->oblist;
|
||||
pic_sym *sym;
|
||||
symbol *sym;
|
||||
struct pic_object *obj;
|
||||
size_t total = 0, inuse = 0;
|
||||
|
||||
|
|
|
@ -11,11 +11,11 @@ extern "C" {
|
|||
|
||||
#include "picrin/private/khash.h"
|
||||
|
||||
typedef struct pic_identifier pic_id;
|
||||
typedef pic_id pic_sym;
|
||||
typedef struct pic_identifier identifier;
|
||||
typedef identifier symbol;
|
||||
|
||||
KHASH_DECLARE(env, pic_id *, pic_sym *)
|
||||
KHASH_DECLARE(dict, pic_sym *, pic_value)
|
||||
KHASH_DECLARE(env, identifier *, symbol *)
|
||||
KHASH_DECLARE(dict, symbol *, pic_value)
|
||||
KHASH_DECLARE(weak, struct pic_object *, pic_value)
|
||||
|
||||
#define PIC_OBJECT_HEADER \
|
||||
|
@ -119,7 +119,7 @@ struct pic_record {
|
|||
|
||||
struct pic_error {
|
||||
PIC_OBJECT_HEADER
|
||||
pic_sym *type;
|
||||
symbol *type;
|
||||
struct pic_string *msg;
|
||||
pic_value irrs;
|
||||
struct pic_string *stack;
|
||||
|
@ -140,8 +140,8 @@ struct pic_checkpoint {
|
|||
|
||||
struct pic_object *pic_obj_ptr(pic_value);
|
||||
|
||||
#define pic_id_ptr(pic, o) (assert(pic_id_p(pic, o)), (pic_id *)pic_obj_ptr(o))
|
||||
#define pic_sym_ptr(pic, o) (assert(pic_sym_p(pic, o)), (pic_sym *)pic_obj_ptr(o))
|
||||
#define pic_id_ptr(pic, o) (assert(pic_id_p(pic, o)), (identifier *)pic_obj_ptr(o))
|
||||
#define pic_sym_ptr(pic, o) (assert(pic_sym_p(pic, o)), (symbol *)pic_obj_ptr(o))
|
||||
#define pic_str_ptr(pic, o) (assert(pic_str_p(pic, o)), (struct pic_string *)pic_obj_ptr(o))
|
||||
#define pic_blob_ptr(pic, o) (assert(pic_blob_p(pic, o)), (struct pic_blob *)pic_obj_ptr(o))
|
||||
#define pic_pair_ptr(pic, o) (assert(pic_pair_p(pic, o)), (struct pic_pair *)pic_obj_ptr(o))
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "picrin/private/object.h"
|
||||
#include "picrin/private/state.h"
|
||||
|
||||
KHASH_DEFINE(env, pic_id *, pic_sym *, kh_ptr_hash_func, kh_ptr_hash_equal)
|
||||
KHASH_DEFINE(env, identifier *, symbol *, kh_ptr_hash_func, kh_ptr_hash_equal)
|
||||
|
||||
pic_value
|
||||
pic_make_env(pic_state *pic, pic_value up)
|
||||
|
|
|
@ -10,13 +10,13 @@
|
|||
#define kh_pic_str_hash(a) (pic_str_hash(pic, pic_obj_value(a)))
|
||||
#define kh_pic_str_cmp(a, b) (pic_str_cmp(pic, pic_obj_value(a), pic_obj_value(b)) == 0)
|
||||
|
||||
KHASH_DEFINE(oblist, struct pic_string *, pic_sym *, kh_pic_str_hash, kh_pic_str_cmp)
|
||||
KHASH_DEFINE(oblist, struct pic_string *, symbol *, kh_pic_str_hash, kh_pic_str_cmp)
|
||||
|
||||
pic_value
|
||||
pic_intern(pic_state *pic, pic_value str)
|
||||
{
|
||||
khash_t(oblist) *h = &pic->oblist;
|
||||
pic_sym *sym;
|
||||
symbol *sym;
|
||||
int it;
|
||||
int ret;
|
||||
|
||||
|
@ -29,7 +29,7 @@ pic_intern(pic_state *pic, pic_value str)
|
|||
|
||||
kh_val(h, it) = NULL; /* dummy */
|
||||
|
||||
sym = (pic_sym *)pic_obj_alloc(pic, offsetof(pic_sym, env), PIC_TYPE_SYMBOL);
|
||||
sym = (symbol *)pic_obj_alloc(pic, offsetof(symbol, env), PIC_TYPE_SYMBOL);
|
||||
sym->u.str = pic_str_ptr(pic, str);
|
||||
kh_val(h, it) = sym;
|
||||
|
||||
|
@ -39,9 +39,9 @@ pic_intern(pic_state *pic, pic_value str)
|
|||
pic_value
|
||||
pic_make_identifier(pic_state *pic, pic_value base, pic_value env)
|
||||
{
|
||||
pic_id *id;
|
||||
identifier *id;
|
||||
|
||||
id = (pic_id *)pic_obj_alloc(pic, sizeof(pic_id), PIC_TYPE_ID);
|
||||
id = (identifier *)pic_obj_alloc(pic, sizeof(identifier), PIC_TYPE_ID);
|
||||
id->u.id = pic_id_ptr(pic, base);
|
||||
id->env = pic_env_ptr(pic, env);
|
||||
|
||||
|
|
Loading…
Reference in New Issue