add pic_data_type_p

This commit is contained in:
Yuichi Nishiwaki 2014-03-31 08:26:55 +09:00
parent 6d80ee8b96
commit ed0146e7a9
1 changed files with 4 additions and 0 deletions

View File

@ -24,6 +24,10 @@ struct pic_data {
#define pic_data_p(o) (pic_type(o) == PIC_TT_DATA) #define pic_data_p(o) (pic_type(o) == PIC_TT_DATA)
#define pic_data_ptr(o) ((struct pic_data *)pic_ptr(o)) #define pic_data_ptr(o) ((struct pic_data *)pic_ptr(o))
static inline bool pic_data_type_p(const pic_value obj, const pic_data_type *type) {
return pic_data_p(obj) && pic_data_ptr(obj)->type == type;
}
struct pic_data *pic_data_alloc(pic_state *, const pic_data_type *, void *); struct pic_data *pic_data_alloc(pic_state *, const pic_data_type *, void *);
#if defined(__cplusplus) #if defined(__cplusplus)