aboutsummaryrefslogtreecommitdiff
path: root/types.h
diff options
context:
space:
mode:
authorTeddy <ted.sybil@gmail.com>2013-08-12 19:37:57 +0800
committerTeddy <ted.sybil@gmail.com>2013-08-12 19:37:57 +0800
commit4d3ed205fc2b86180f81fea388e488f5fa96cef9 (patch)
tree31f8ad22e11da45a439d5aad873ba08a1896be81 /types.h
parent301c949362d243bb6b69956355e0e7ecccc43ce4 (diff)
basic gc
Diffstat (limited to 'types.h')
-rw-r--r--types.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/types.h b/types.h
index 11776ab..e6a541c 100644
--- a/types.h
+++ b/types.h
@@ -25,6 +25,9 @@ const int CLS_CHAR_OBJ = 1 << 6;
const int CLS_STR_OBJ = 1 << 7;
const int CLS_VECT_OBJ = 1 << 8;
+const int CLS_CONT_OBJ = 1 << 9;
+const int CLS_ENVT_OBJ = 1 << 10;
+
static const int NUM_LVL_COMP = 0;
static const int NUM_LVL_REAL = 1;
static const int NUM_LVL_RAT = 2;
@@ -323,7 +326,7 @@ class PromObj: public EvalObj {/*{{{*/
/** @class Environment
* The environment of current evaluation, i.e. the local variable binding
*/
-class Environment {/*{{{*/
+class Environment : public EvalObj{/*{{{*/
private:
Environment *prev_envt; /**< Pointer to the upper-level environment */
Str2EvalObj binding; /**< Store all pairs of identifier and its
@@ -333,6 +336,7 @@ class Environment {/*{{{*/
* @param prev_envt the outer environment
*/
Environment(Environment *prev_envt);
+ ~Environment();
/** Add a binding entry which binds sym_obj to eval_obj
* @param def true to force the assignment
* @return when def is set to false, this return value is true iff. the
@@ -344,6 +348,7 @@ class Environment {/*{{{*/
* @param obj the object as request
* */
EvalObj *get_obj(EvalObj *obj);
+ ReprCons *get_repr_cons();
};/*}}}*/
/** @class Continuation
@@ -351,7 +356,7 @@ class Environment {/*{{{*/
* being made (Behave like a stack frame in C). When the call has accomplished,
* the system will restore all the registers according to the continuation.
*/
-class Continuation {/*{{{*/
+class Continuation : public EvalObj {/*{{{*/
public:
/** Linking the previous continuation on the chain */
Continuation *prev_cont;
@@ -365,6 +370,8 @@ class Continuation {/*{{{*/
/** Create a continuation */
Continuation(Environment *envt, Pair *pc, Continuation *prev_cont,
Pair *proc_body);
+ ~Continuation();
+ ReprCons *get_repr_cons();
};/*}}}*/
/** @class InexactNumObj