This commit is contained in:
Yuichi Nishiwaki 2013-11-05 00:27:59 -05:00
parent 5850699d75
commit 46fccff806
5 changed files with 13 additions and 13 deletions

View File

@ -8,7 +8,7 @@ struct pic_blob {
};
#define pic_blob_p(v) (pic_type(v) == PIC_TT_BLOB)
#define pic_blob_ptr(v) ((struct pic_blob *)(v).u.data)
#define pic_blob_ptr(v) ((struct pic_blob *)pic_ptr(v))
struct pic_blob *pic_blob_new(pic_state *, char *, int len);

View File

@ -23,6 +23,6 @@ struct pic_port {
};
#define pic_port_p(v) (pic_type(v) == PIC_TT_PORT)
#define pic_port_ptr(v) ((struct pic_port *)(v).u.data)
#define pic_port_ptr(v) ((struct pic_port *)pic_ptr(v))
#endif

View File

@ -21,8 +21,8 @@ struct pic_proc {
#define pic_proc_p(o) (pic_type(o) == PIC_TT_PROC)
#define pic_env_p(o) (pic_type(o) == PIC_TT_ENV)
#define pic_proc_ptr(o) ((struct pic_proc *)(o).u.data)
#define pic_env_ptr(o) ((struct pic_env *)(o).u.data)
#define pic_proc_ptr(o) ((struct pic_proc *)pic_ptr(o))
#define pic_env_ptr(o) ((struct pic_env *)pic_ptr(o))
#define pic_proc_cfunc_p(o) (pic_proc_ptr(o)->cfunc_p)

View File

@ -4,7 +4,7 @@
typedef int pic_sym;
enum pic_vtype {
PIC_VTYPE_NIL,
PIC_VTYPE_NIL = 1,
PIC_VTYPE_TRUE,
PIC_VTYPE_FALSE,
PIC_VTYPE_UNDEF,
@ -27,8 +27,8 @@ typedef struct {
} u;
} pic_value;
#define pic_vtype(v) \
((v).type)
#define pic_ptr(v) ((v).u.data)
#define pic_vtype(v) ((v).type)
enum pic_tt {
/* immediate */
@ -79,10 +79,10 @@ struct pic_proc;
struct pic_port;
struct pic_blob;
#define pic_obj_ptr(o) ((struct pic_object *)(o).u.data)
#define pic_pair_ptr(o) ((struct pic_pair *)(o).u.data)
#define pic_str_ptr(o) ((struct pic_string *)(o).u.data)
#define pic_vec_ptr(o) ((struct pic_vector *)(o).u.data)
#define pic_obj_ptr(o) ((struct pic_object *)pic_ptr(o))
#define pic_pair_ptr(o) ((struct pic_pair *)pic_ptr(o))
#define pic_str_ptr(o) ((struct pic_string *)pic_ptr(o))
#define pic_vec_ptr(o) ((struct pic_vector *)pic_ptr(o))
enum pic_tt pic_type(pic_value);
const char *pic_type_repr(enum pic_tt);

View File

@ -23,7 +23,7 @@ pic_car(pic_state *pic, pic_value obj)
if (! pic_pair_p(obj)) {
pic_error(pic, "pair required");
}
pair = (struct pic_pair *)obj.u.data;
pair = pic_pair_ptr(obj);
return pair->car;
}
@ -36,7 +36,7 @@ pic_cdr(pic_state *pic, pic_value obj)
if (! pic_pair_p(obj)) {
pic_error(pic, "pair required");
}
pair = (struct pic_pair *)obj.u.data;
pair = pic_pair_ptr(obj);
return pair->cdr;
}