#include <cstdio>
#include "model.h"
#include "exc.h"
#include "consts.h"
FrameObj::FrameObj(ClassType _ftype) : ftype(_ftype) {}
EmptyList *empty_list = new EmptyList();
EmptyList::EmptyList() : Cons(NULL, NULL) {}
string EmptyList::ext_repr() { return string("()"); }
#ifdef DEBUG
string EmptyList::_debug_repr() { return ext_repr(); }
#endif
bool FrameObj::is_ret_addr() {
return ftype & CLS_RET_ADDR;
}
EvalObj::EvalObj(ClassType _otype) : FrameObj(CLS_EVAL_OBJ), otype(_otype) {}
void EvalObj::prepare(Cons *pc) {}
bool EvalObj::is_simple_obj() {
return otype & CLS_SIM_OBJ;
}
bool EvalObj::is_sym_obj() {
return otype & CLS_SYM_OBJ;
}
bool EvalObj::is_opt_obj() {
return otype & CLS_OPT_OBJ;
}
bool EvalObj::is_cons_obj() {
return otype & CLS_CONS_OBJ;
}
#ifdef DEBUG
void EvalObj::_debug_print() {
printf("mem: 0x%llX\n%s\n\n", (unsigned long long)this,
_debug_repr().c_str());
}
#endif
bool EvalObj::is_true() {
return true;
}
Cons::Cons(EvalObj *_car, EvalObj *_cdr) :
EvalObj(CLS_CONS_OBJ), car(_car), cdr(_cdr), skip(false),