aboutsummaryrefslogtreecommitdiffstats
path: root/src/c.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-12-02 06:16:29 +0000
committerDavid Robillard <d@drobilla.net>2010-12-02 06:16:29 +0000
commit563a807be78bfe12e5bfbb9ff0d6da44242696c4 (patch)
tree13cf7ce3b90d072d6e7106c7d2eb4da33209acb0 /src/c.cpp
parent32ac40a9ef62d2109563e36fb7cd478426c3489f (diff)
downloadresp-563a807be78bfe12e5bfbb9ff0d6da44242696c4.tar.gz
resp-563a807be78bfe12e5bfbb9ff0d6da44242696c4.tar.bz2
resp-563a807be78bfe12e5bfbb9ff0d6da44242696c4.zip
Represent code as list structure (i.e. traditional LISP lists built from pairs), rather than tuple structure.
Remove unused/crufty depoly stage. Remove cps from AST interface (but keep cps.cpp code around for later). Improved command line interface for compilation stages (options -T -L -S). git-svn-id: http://svn.drobilla.net/resp/resp@277 ad02d1e2-f140-0410-9f75-f8b11f17cedd
Diffstat (limited to 'src/c.cpp')
-rw-r--r--src/c.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/c.cpp b/src/c.cpp
index e8f7c2a..b1eafe5 100644
--- a/src/c.cpp
+++ b/src/c.cpp
@@ -73,7 +73,7 @@ llType(const AType* t)
return ret;
} else if (t->kind == AType::EXPR && t->head()->str() == "Tup") {
Type* ret = new Type("struct { void* me; ");
- for (AType::const_iterator i = t->begin() + 1; i != t->end(); ++i) {
+ for (AType::const_iterator i = t->iter_at(1); i != t->end(); ++i) {
const Type* lt = llType((*i)->to<const AType*>());
if (!lt)
return NULL;
@@ -104,11 +104,11 @@ struct CEngine : public Engine {
const std::string& name, const ATuple* args, const AType* type)
{
const AType* argsT = type->prot()->as<const AType*>();
- const AType* retT = type->last()->as<const AType*>();
+ const AType* retT = type->list_ref(2)->as<const AType*>();
vector<const Type*> cprot;
FOREACHP(ATuple::const_iterator, i, argsT) {
- AType* at = (*i)->as<AType*>();
+ const AType* at = (*i)->as<const AType*>();
THROW_IF(!llType(at), Cursor(), string("non-concrete parameter :: ")
+ at->str())
cprot.push_back(llType(at));
@@ -222,10 +222,10 @@ CEngine::pushFunctionArgs(CEnv& cenv, const AFn* fn, const AType* type, CFunc f)
AFn::const_iterator p = fn->prot()->begin();
ATuple::const_iterator pT = argsT->begin();
for (; p != fn->prot()->end(); ++p, ++pT) {
- AType* t = (*pT)->as<AType*>();
+ const AType* t = (*pT)->as<const AType*>();
const Type* lt = llType(t);
THROW_IF(!lt, fn->loc, "untyped parameter\n");
- cenv.def((*p)->as<ASymbol*>(), *p, t, new string((*p)->str()));
+ cenv.def((*p)->as<const ASymbol*>(), *p, t, new string((*p)->str()));
}
}
@@ -235,7 +235,7 @@ CEngine::compileIf(CEnv& cenv, const AIf* aif)
Value* varname = new string(cenv.penv.gensymstr("if"));
out += (format("%s %s;\n") % *llType(cenv.type(aif)) % *varname).str();
size_t idx = 1;
- for (AIf::const_iterator i = aif->begin() + 1; ; ++i, idx += 2) {
+ for (AIf::const_iterator i = aif->iter_at(1); ; ++i, idx += 2) {
AIf::const_iterator next = i;
if (++next == aif->end())
break;
@@ -252,7 +252,7 @@ CEngine::compileIf(CEnv& cenv, const AIf* aif)
// Emit final else block
out += "else {\n";
- Value* elseV = llVal(aif->last()->compile(cenv));
+ Value* elseV = llVal(aif->list_last()->compile(cenv));
out += (format("%s = %s;\n}\n") % *varname % *elseV).str();
for (size_t i = 1; i < idx / 2; ++i)