diff options
author | David Robillard <d@drobilla.net> | 2009-01-25 19:57:37 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2009-01-25 19:57:37 +0000 |
commit | 6992b1689e5848d6f882c461bea722b6f734bb46 (patch) | |
tree | 4b22ef994de45becc5d43c99ed373ad29ced7b00 | |
parent | 084bc9a548dad23c9e097fa807b7aba1a2b5f79c (diff) | |
download | resp-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.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -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); |