diff options
author | Teddy <ted.sybil@gmail.com> | 2013-08-13 00:31:11 +0800 |
---|---|---|
committer | Teddy <ted.sybil@gmail.com> | 2013-08-13 00:31:11 +0800 |
commit | 79a2ecc929b30ae40f9324c258d8ded99ecde259 (patch) | |
tree | d90ca620d8b5ffb805add4aa3c044326ab459cdc /main.cpp | |
parent | ca12d00e80d76214d44443bf4f5e62554e526089 (diff) |
gc can now work
Diffstat (limited to 'main.cpp')
-rw-r--r-- | main.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -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) |