Revert "add box type"

This reverts commit d53f0cf9e4.
This commit is contained in:
Yuichi Nishiwaki 2015-07-13 08:24:06 +09:00
parent 42ec53d73f
commit 5c5066bfa0
4 changed files with 1 additions and 67 deletions

View File

@ -487,12 +487,6 @@ gc_mark_object(pic_state *pic, struct pic_object *obj)
}
break;
}
case PIC_TT_BOX: {
struct pic_box *box = (struct pic_box *)obj;
gc_mark(pic, box->value);
break;
}
case PIC_TT_NIL:
case PIC_TT_BOOL:
#if PIC_ENABLE_FLOAT
@ -739,9 +733,6 @@ gc_finalize_object(pic_state *pic, struct pic_object *obj)
case PIC_TT_CP: {
break;
}
case PIC_TT_BOX: {
break;
}
case PIC_TT_NIL:
case PIC_TT_BOOL:
#if PIC_ENABLE_FLOAT

View File

@ -269,7 +269,6 @@ pic_value pic_fdisplay(pic_state *, pic_value, xFILE *);
#include "picrin/symbol.h"
#include "picrin/vector.h"
#include "picrin/reg.h"
#include "picrin/box.h"
#if defined(__cplusplus)
}

View File

@ -1,53 +0,0 @@
/**
* See Copyright Notice in picrin.h
*/
#ifndef PICRIN_BOX_H
#define PICRIN_BOX_H
#if defined(__cplusplus)
extern "C" {
#endif
struct pic_box {
PIC_OBJECT_HEADER
pic_value value;
};
#define pic_box_p(v) (pic_type(v) == PIC_TT_BOX)
#define pic_box_ptr(o) ((struct pic_box *)pic_ptr(o))
PIC_INLINE pic_value
pic_box(pic_state *pic, pic_value value)
{
struct pic_box *box;
box = (struct pic_box *)pic_obj_alloc(pic, sizeof(struct pic_box), PIC_TT_BOX);
box->value = value;
return pic_obj_value(box);
}
PIC_INLINE pic_value
pic_unbox(pic_state *pic, pic_value box)
{
if (! pic_box_p(box)) {
pic_errorf(pic, "box required");
}
return pic_box_ptr(box)->value;
}
PIC_INLINE void
pic_set_box(pic_state *pic, pic_value box, pic_value value)
{
if (! pic_box_p(box)) {
pic_errorf(pic, "box required");
}
pic_box_ptr(box)->value = value;
}
#if defined(__cplusplus)
}
#endif
#endif

View File

@ -163,11 +163,10 @@ enum pic_tt {
PIC_TT_DATA,
PIC_TT_DICT,
PIC_TT_REG,
PIC_TT_BOX,
PIC_TT_RECORD,
PIC_TT_CXT,
PIC_TT_IREP,
PIC_TT_CP,
PIC_TT_CP
};
#define PIC_OBJECT_HEADER \
@ -338,8 +337,6 @@ pic_type_repr(enum pic_tt tt)
return "reg";
case PIC_TT_RECORD:
return "record";
case PIC_TT_BOX:
return "box";
case PIC_TT_CP:
return "checkpoint";
}