aboutsummaryrefslogtreecommitdiff
path: root/main.cpp
diff options
context:
space:
mode:
authorTeddy <ted.sybil@gmail.com>2013-08-13 00:31:11 +0800
committerTeddy <ted.sybil@gmail.com>2013-08-13 00:31:11 +0800
commit79a2ecc929b30ae40f9324c258d8ded99ecde259 (patch)
treed90ca620d8b5ffb805add4aa3c044326ab459cdc /main.cpp
parentca12d00e80d76214d44443bf4f5e62554e526089 (diff)
gc can now work
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/main.cpp b/main.cpp
index 7549daa..15a877e 100644
--- a/main.cpp
+++ b/main.cpp
@@ -27,12 +27,14 @@ void load_file(const char *fname) {
{
Pair *tree = ast.absorb(&tk);
if (!tree) break;
- eval.run_expr(tree);
+ EvalObj *ret = eval.run_expr(tree);
+ gc.expose(ret);
}
catch (GeneralError &e)
{
fprintf(stderr, "An error occured: %s\n", e.get_msg().c_str());
}
+ gc.force();
}
}
@@ -53,7 +55,7 @@ UnspecObj *unspec_obj = new UnspecObj();
int main(int argc, char **argv) {
- freopen("in.scm", "r", stdin);
+ //freopen("in.scm", "r", stdin);
gc.attach(empty_list);
gc.attach(unspec_obj);
@@ -96,7 +98,9 @@ int main(int argc, char **argv) {
{
Pair *tree = ast.absorb(&tk);
if (!tree) break;
- string output = eval.run_expr(tree)->ext_repr();
+ EvalObj *ret = eval.run_expr(tree);
+ string output = ret->ext_repr();
+ gc.expose(ret);
fprintf(stderr, "Ret> $%d = %s\n", rcnt++, output.c_str());
}
catch (GeneralError &e)