aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2009-01-25 19:57:37 +0000
committerDavid Robillard <d@drobilla.net>2009-01-25 19:57:37 +0000
commit6992b1689e5848d6f882c461bea722b6f734bb46 (patch)
tree4b22ef994de45becc5d43c99ed373ad29ced7b00
parent084bc9a548dad23c9e097fa807b7aba1a2b5f79c (diff)
downloadresp-6992b1689e5848d6f882c461bea722b6f734bb46.tar.gz
resp-6992b1689e5848d6f882c461bea722b6f734bb46.tar.bz2
resp-6992b1689e5848d6f882c461bea722b6f734bb46.zip
Execute and print REPL code with type safety (i.e. print int and bool correctly).
git-svn-id: http://svn.drobilla.net/resp/llvm-lisp@13 ad02d1e2-f140-0410-9f75-f8b11f17cedd
-rw-r--r--ll.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/ll.cpp b/ll.cpp
index f3082e1..0b81628 100644
--- a/ll.cpp
+++ b/ll.cpp
@@ -765,8 +765,14 @@ main()
}
void* fp = engine->getPointerToFunction(f);
- double (*cfunc)() = (double (*)())fp;
- std::cout << cfunc();
+ if (bodyT->ctype == Type::Int32Ty)
+ std::cout << ((int32_t (*)())fp)();
+ else if (bodyT->ctype == Type::FloatTy)
+ std::cout << ((float (*)())fp)();
+ else if (bodyT->ctype == Type::Int1Ty)
+ std::cout << ((bool (*)())fp)();
+ else
+ std::cout << "?";
} else {
Value* val = body->compile(cenv);