force indirect reference to pic_value vtype

This commit is contained in:
Yuichi Nishiwaki 2013-11-04 23:37:08 -05:00
parent 3aa7fe8294
commit 5850699d75
3 changed files with 14 additions and 11 deletions

View File

@ -27,6 +27,9 @@ typedef struct {
} u;
} pic_value;
#define pic_vtype(v) \
((v).type)
enum pic_tt {
/* immediate */
PIC_TT_NIL,
@ -100,14 +103,14 @@ pic_value pic_char_value(char c);
#define pic_sym(v) ((v).u.sym)
#define pic_char(v) ((v).u.c)
#define pic_nil_p(v) ((v).type == PIC_VTYPE_NIL)
#define pic_true_p(v) ((v).type == PIC_VTYPE_TRUE)
#define pic_false_p(v) ((v).type == PIC_VTYPE_FALSE)
#define pic_undef_p(v) ((v).type == PIC_VTYPE_UNDEF)
#define pic_float_p(v) ((v).type == PIC_VTYPE_FLOAT)
#define pic_int_p(v) ((v).type == PIC_VTYPE_INT)
#define pic_symbol_p(v) ((v).type == PIC_VTYPE_SYMBOL)
#define pic_char_p(v) ((v).type == PIC_VTYPE_CHAR)
#define pic_nil_p(v) (pic_vtype(v) == PIC_VTYPE_NIL)
#define pic_true_p(v) (pic_vtype(v) == PIC_VTYPE_TRUE)
#define pic_false_p(v) (pic_vtype(v) == PIC_VTYPE_FALSE)
#define pic_undef_p(v) (pic_vtype(v) == PIC_VTYPE_UNDEF)
#define pic_float_p(v) (pic_vtype(v) == PIC_VTYPE_FLOAT)
#define pic_int_p(v) (pic_vtype(v) == PIC_VTYPE_INT)
#define pic_symbol_p(v) (pic_vtype(v) == PIC_VTYPE_SYMBOL)
#define pic_char_p(v) (pic_vtype(v) == PIC_VTYPE_CHAR)
#define pic_pair_p(v) (pic_type(v) == PIC_TT_PAIR)
#define pic_str_p(v) (pic_type(v) == PIC_TT_STRING)
#define pic_vec_p(v) (pic_type(v) == PIC_TT_VECTOR)

View File

@ -89,7 +89,7 @@ pic_gc_protect(pic_state *pic, pic_value v)
{
struct pic_object *obj;
if (v.type != PIC_VTYPE_HEAP) {
if (pic_vtype(v) != PIC_VTYPE_HEAP) {
return;
}
obj = pic_obj_ptr(v);
@ -208,7 +208,7 @@ gc_mark(pic_state *pic, pic_value v)
{
struct pic_object *obj;
if (v.type != PIC_VTYPE_HEAP)
if (pic_vtype(v) != PIC_VTYPE_HEAP)
return;
obj = pic_obj_ptr(v);

View File

@ -249,7 +249,7 @@ pic_port_eof_object_p(pic_state *pic)
pic_get_args(pic, "o", &v);
if (v.type == PIC_VTYPE_EOF) {
if (pic_vtype(v) == PIC_VTYPE_EOF) {
return pic_true_value();
}
else {