aboutsummaryrefslogtreecommitdiffstats
path: root/llvm.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2009-03-07 03:52:55 +0000
committerDavid Robillard <d@drobilla.net>2009-03-07 03:52:55 +0000
commit311e3b43b68209648fe9561d1aaff93d9a4d4f0f (patch)
tree7eeed8e2019a19c9cf42a0e3952f5f2a72d5b55c /llvm.cpp
parent0ef506f38e4a18d11e50fb96c7d6d6c3323a76e0 (diff)
downloadresp-311e3b43b68209648fe9561d1aaff93d9a4d4f0f.tar.gz
resp-311e3b43b68209648fe9561d1aaff93d9a4d4f0f.tar.bz2
resp-311e3b43b68209648fe9561d1aaff93d9a4d4f0f.zip
Make out and error streams fields of CEnv instead of static globals.
git-svn-id: http://svn.drobilla.net/resp/tuplr@73 ad02d1e2-f140-0410-9f75-f8b11f17cedd
Diffstat (limited to 'llvm.cpp')
-rw-r--r--llvm.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/llvm.cpp b/llvm.cpp
index e94a806..8eeab42 100644
--- a/llvm.cpp
+++ b/llvm.cpp
@@ -92,8 +92,8 @@ struct CEnvPimpl {
Function* alloc;
};
-CEnv::CEnv(PEnv& p, TEnv& t, CEngine& eng)
- : engine(eng), penv(p), tenv(t), symID(0), _pimpl(new CEnvPimpl(eng))
+CEnv::CEnv(PEnv& p, TEnv& t, CEngine& e, ostream& os, ostream& es)
+ : engine(e), penv(p), tenv(t), symID(0), alloc(0), log(os, es), _pimpl(new CEnvPimpl(e))
{
}
@@ -539,10 +539,10 @@ eval(CEnv& cenv, const string& name, istream& is)
cenv.engine.builder.CreateRet(val);
cenv.optimise(f);
- out << call(resultType, cenv.engine.engine->getPointerToFunction(f))
+ cenv.log.out << call(resultType, cenv.engine.engine->getPointerToFunction(f))
<< " : " << resultType->str() << endl;
} catch (Error& e) {
- err << e.what() << endl;
+ cenv.log.err << e.what() << endl;
return 1;
}
return 0;
@@ -552,8 +552,8 @@ int
repl(CEnv& cenv)
{
while (1) {
- out << "() ";
- out.flush();
+ cenv.log.out << "() ";
+ cenv.log.out.flush();
Cursor cursor("(stdin)");
try {
SExp exp = readExpression(cursor, std::cin);
@@ -580,13 +580,13 @@ repl(CEnv& cenv)
f->eraseFromParent(); // Error reading body, remove function
throw e;
}
- out << call(bodyT, cenv.engine.engine->getPointerToFunction(f));
+ cenv.log.out << call(bodyT, cenv.engine.engine->getPointerToFunction(f));
} else {
- out << "; " << cenv.compile(body);
+ cenv.log.out << "; " << cenv.compile(body);
}
- out << " : " << cenv.tenv.type(body)->str() << endl;
+ cenv.log.out << " : " << cenv.tenv.type(body)->str() << endl;
} catch (Error& e) {
- err << e.what() << endl;
+ cenv.log.err << e.what() << endl;
}
}
return 0;