From 9f187b46ae761e8275362d6c1533e9fe79028c7b Mon Sep 17 00:00:00 2001 From: jsdelfino Date: Sun, 1 Nov 2009 05:24:54 +0000 Subject: Improved memory management using APR memory pools, changed frame allocation in eval library to support forward references and fixed memory leak in XML parsing code. Also simplified a bit the printing of lists to make them easier to read. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@831639 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/sca/modules/eval/driver.hpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'cpp/sca/modules/eval/driver.hpp') diff --git a/cpp/sca/modules/eval/driver.hpp b/cpp/sca/modules/eval/driver.hpp index 064213706c..f777973ebf 100644 --- a/cpp/sca/modules/eval/driver.hpp +++ b/cpp/sca/modules/eval/driver.hpp @@ -53,21 +53,23 @@ const bool userPrint(std::ostream& out, const value object) { return true; } -const value evalDriverLoop(std::istream& in, std::ostream& out, Env& globalEnv) { +const value evalDriverLoop(std::istream& in, std::ostream& out, Env& globalEnv, const gc_pool& pool) { promptForInput(out, evalInputPrompt); value input = read(in); if (isNil(input)) return input; - const value output = evalApply(input, globalEnv); + const value output = evalExpr(input, globalEnv, pool); announceOutput(out, evalOutputPrompt); userPrint(out, output); - return evalDriverLoop(in, out, globalEnv); + return evalDriverLoop(in, out, globalEnv, pool); } const bool evalDriverRun(std::istream& in, std::ostream& out) { + gc_pool pool; setupEvalOut(out); - Env globalEnv = setupEnvironment(); - evalDriverLoop(in, out, globalEnv); + Env globalEnv = setupEnvironment(pool); + evalDriverLoop(in, out, globalEnv, pool); + cleanupEnvironment(globalEnv); return true; } -- cgit v1.2.3