aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--model.cpp3
-rw-r--r--model.h7
-rw-r--r--types.cpp4
-rw-r--r--types.h2
4 files changed, 13 insertions, 3 deletions
diff --git a/model.cpp b/model.cpp
index 938deca..cb3d5c6 100644
--- a/model.cpp
+++ b/model.cpp
@@ -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) {
+}
diff --git a/model.h b/model.h
index 7fb9fc8..1ace1c9 100644
--- a/model.h
+++ b/model.h
@@ -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
*/
diff --git a/types.cpp b/types.cpp
index 449da5e..7988c59 100644
--- a/types.cpp
+++ b/types.cpp
@@ -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);
diff --git a/types.h b/types.h
index a364e55..93dac66 100644
--- a/types.h
+++ b/types.h
@@ -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) */