summaryrefslogtreecommitdiffstats
path: root/cpp/sca/modules/eval/driver.hpp
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2009-11-01 05:24:54 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2009-11-01 05:24:54 +0000
commit9f187b46ae761e8275362d6c1533e9fe79028c7b (patch)
treee2625f63e0c84f172c877e1fe2cbe75adf678208 /cpp/sca/modules/eval/driver.hpp
parent24021bd09a0d5c9664565a244c24e0bdef0908b8 (diff)
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
Diffstat (limited to '')
-rw-r--r--cpp/sca/modules/eval/driver.hpp12
1 files changed, 7 insertions, 5 deletions
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;
}