diff options
-rw-r--r-- | model.cpp | 3 | ||||
-rw-r--r-- | model.h | 7 | ||||
-rw-r--r-- | types.cpp | 4 | ||||
-rw-r--r-- | types.h | 2 |
4 files changed, 13 insertions, 3 deletions
@@ -132,3 +132,6 @@ string EvalObj::ext_repr() { RetAddr::RetAddr(Pair *_addr, Pair *_state) : FrameObj(CLS_RET_ADDR), addr(_addr), state(_state) {} + +Container::Container(int otype) : EvalObj(otype | CLS_CONTAINER) { +} @@ -15,6 +15,7 @@ const int CLS_PAR_BRA = 1 << 2; const int CLS_SIM_OBJ = 1 << 0; const int CLS_PAIR_OBJ = 1 << 1; +const int CLS_CONTAINER = 1 << 20; #define TO_PAIR(ptr) \ (static_cast<Pair*>(ptr)) @@ -101,6 +102,12 @@ class EvalObj : public FrameObj { virtual ReprCons *get_repr_cons() = 0; }; +class Container: public EvalObj { + public: + size_t gc_refs; + Container(int otype); +}; + /** @class RetAddr * Tracking the caller's Pair pointer */ @@ -15,8 +15,8 @@ const int PREC = 16; extern EmptyList *empty_list; extern UnspecObj *unspec_obj; -Pair::Pair(EvalObj *_car, EvalObj *_cdr) : EvalObj(CLS_PAIR_OBJ), - car(_car), cdr(_cdr), next(NULL) { +Pair::Pair(EvalObj *_car, EvalObj *_cdr) : +Container(CLS_PAIR_OBJ), car(_car), cdr(_cdr), next(NULL) { gc.attach(car); gc.attach(cdr); @@ -44,7 +44,7 @@ class PairReprCons; * more, a syntax tree * (car . cdr) in Scheme */ -class Pair : public EvalObj {/*{{{*/ +class Pair : public Container {/*{{{*/ public: EvalObj *car; /**< car (as in Scheme) */ EvalObj *cdr; /**< cdr (as in Scheme) */ |