remove box

This commit is contained in:
Yuichi Nishiwaki 2014-07-17 16:38:18 +09:00
parent f23aebb29a
commit 32174d7855
7 changed files with 0 additions and 74 deletions

View File

@ -1,28 +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(v) ((struct pic_box *)pic_ptr(v))
pic_value pic_box(pic_state *, pic_value);
pic_value pic_unbox(pic_state *, pic_value);
void pic_set_box(pic_state *, pic_value, pic_value);
#if defined(__cplusplus)
}
#endif
#endif

View File

@ -115,7 +115,6 @@ enum pic_tt {
PIC_TT_VAR,
PIC_TT_IREP,
PIC_TT_DATA,
PIC_TT_BOX,
PIC_TT_DICT
};
@ -267,8 +266,6 @@ pic_type_repr(enum pic_tt tt)
return "irep";
case PIC_TT_DATA:
return "data";
case PIC_TT_BOX:
return "box";
case PIC_TT_DICT:
return "dict";
}

View File

@ -1,30 +0,0 @@
#include "picrin.h"
#include "picrin/box.h"
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_value
pic_unbox(pic_state *pic, pic_value box)
{
if (! pic_box_p(box)) {
pic_errorf(pic, "expected box, but got ~s", box);
}
return pic_box_ptr(box)->value;
}
void
pic_set_box(pic_state *pic, pic_value box, pic_value value)
{
if (! pic_box_p(box)) {
pic_errorf(pic, "expected box, but got ~s", box);
}
pic_box_ptr(box)->value = value;
}

View File

@ -830,7 +830,6 @@ analyze_node(analyze_state *state, pic_value obj, bool tailpos)
case PIC_TT_VAR:
case PIC_TT_IREP:
case PIC_TT_DATA:
case PIC_TT_BOX:
case PIC_TT_DICT:
pic_errorf(pic, "invalid expression given: ~s", obj);
}

View File

@ -494,11 +494,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_DICT: {
struct pic_dict *dict = (struct pic_dict *)obj;
xh_iter it;
@ -656,9 +651,6 @@ gc_finalize_object(pic_state *pic, struct pic_object *obj)
xh_destroy(&data->storage);
break;
}
case PIC_TT_BOX: {
break;
}
case PIC_TT_DICT: {
struct pic_dict *dict = (struct pic_dict *)obj;
xh_destroy(&dict->hash);

View File

@ -524,7 +524,6 @@ macroexpand_node(pic_state *pic, pic_value expr, struct pic_senv *senv)
case PIC_TT_VAR:
case PIC_TT_IREP:
case PIC_TT_DATA:
case PIC_TT_BOX:
case PIC_TT_DICT:
pic_errorf(pic, "unexpected value type: ~s", expr);
}

View File

@ -330,9 +330,6 @@ write_core(struct writer_control *p, pic_value obj)
case PIC_TT_DATA:
xfprintf(file, "#<data %p>", pic_ptr(obj));
break;
case PIC_TT_BOX:
xfprintf(file, "#<box %p>", pic_ptr(obj));
break;
case PIC_TT_DICT:
xfprintf(file, "#<dict %p>", pic_ptr(obj));
break;