diff options
author | David Robillard <d@drobilla.net> | 2009-06-20 21:13:06 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2009-06-20 21:13:06 +0000 |
commit | 29e8db3d7c260d43d3721faea145cec1fbbf4144 (patch) | |
tree | 296e27cf335afb535e194e92e2c180ea87fe8955 /tuplr.cpp | |
parent | d5556bc9a81ba5f5bd16f9c9d1d945f3e41355b7 (diff) | |
download | resp-29e8db3d7c260d43d3721faea145cec1fbbf4144.tar.gz resp-29e8db3d7c260d43d3721faea145cec1fbbf4144.tar.bz2 resp-29e8db3d7c260d43d3721faea145cec1fbbf4144.zip |
Make backend an object.
git-svn-id: http://svn.drobilla.net/resp/tuplr@142 ad02d1e2-f140-0410-9f75-f8b11f17cedd
Diffstat (limited to 'tuplr.cpp')
-rw-r--r-- | tuplr.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
@@ -264,21 +264,21 @@ eval(CEnv& cenv, const string& name, istream& is) } // Create function for top-level of program - CFunction f = startFunction(cenv, "main", resultType, ATuple(cursor)); + CFunction f = cenv.engine()->startFunction(cenv, "main", resultType, ATuple(cursor)); // Compile all expressions into it CValue val = NULL; for (list< pair<SExp, AST*> >::const_iterator i = exprs.begin(); i != exprs.end(); ++i) val = cenv.compile(i->second); - finishFunction(cenv, f, val); + cenv.engine()->finishFunction(cenv, f, val); - cenv.out << call(cenv, f, resultType) << " : " << resultType << endl; + cenv.out << cenv.engine()->call(cenv, f, resultType) << " : " << resultType << endl; Object::pool.collect(Object::pool.roots()); if (cenv.args.find("-d") != cenv.args.end()) - writeModule(cenv, cenv.out); + cenv.engine()->writeModule(cenv, cenv.out); } catch (Error& e) { cenv.err << e.what() << endl; @@ -315,17 +315,17 @@ repl(CEnv& cenv) CFunction f = NULL; try { // Create anonymous function to insert code into - f = startFunction(cenv, cenv.gensym("_repl"), bodyT, ATuple(cursor)); + f = cenv.engine()->startFunction(cenv, cenv.gensym("_repl"), bodyT, ATuple(cursor)); CValue retVal = cenv.compile(body); - finishFunction(cenv, f, retVal); - cenv.out << call(cenv, f, bodyT); + cenv.engine()->finishFunction(cenv, f, retVal); + cenv.out << cenv.engine()->call(cenv, f, bodyT); } catch (Error& e) { ADef* def = body->to<ADef*>(); if (def) cenv.out << def->sym(); else cenv.out << "?"; - eraseFunction(cenv, f); + cenv.engine()->eraseFunction(cenv, f); } cenv.out << " : " << cenv.type(body) << endl; @@ -337,7 +337,7 @@ repl(CEnv& cenv) cenv.tsubst = oldSubst; if (cenv.args.find("-d") != cenv.args.end()) - writeModule(cenv, cenv.out); + cenv.engine()->writeModule(cenv, cenv.out); } catch (Error& e) { cenv.err << e.what() << endl; @@ -375,7 +375,7 @@ main(int argc, char** argv) TEnv tenv(penv); initLang(penv, tenv); - CEngine engine = tuplr_new_engine(); + Engine* engine = tuplr_new_engine(); CEnv* cenv = new CEnv(penv, tenv, engine); cenv->push(); @@ -445,7 +445,7 @@ main(int argc, char** argv) if (output != "") { ofstream os(output.c_str()); if (os.good()) { - writeModule(*cenv, os); + cenv->engine()->writeModule(*cenv, os); } else { cerr << argv[0] << ": " << a->second << ": " << strerror(errno) << endl; ++ret; |