Get chaiscript compiling with LLVM/clang. Resulting code crashes, however.

This commit is contained in:
Jason Turner 2010-09-20 03:24:48 +00:00
parent a39d70dbca
commit 22c2be835a
3 changed files with 100 additions and 95 deletions

View File

@ -156,8 +156,8 @@ namespace chaiscript
detail::Get_Type_Info<T>::get(), detail::Get_Type_Info<T>::get(),
boost::any(obj), boost::any(obj),
false, false,
&Data::unique<T>, boost::function<bool (boost::any *)>(&Data::unique<T>),
&Data::is_null<T>) boost::function<bool (boost::any *)>(&Data::is_null<T>))
); );
std::map<Object_Cache_Key, Data>::iterator itr std::map<Object_Cache_Key, Data>::iterator itr
@ -219,8 +219,8 @@ namespace chaiscript
detail::Get_Type_Info<T>::get(), detail::Get_Type_Info<T>::get(),
boost::any(boost::shared_ptr<T>(new T(t))), boost::any(boost::shared_ptr<T>(new T(t))),
false, false,
&Data::unique<T>, boost::function<bool (boost::any *)>(&Data::unique<T>),
&Data::is_null<T>) boost::function<bool (boost::any *)>(&Data::is_null<T>))
); );
boost::shared_ptr<T> *ptr = boost::any_cast<boost::shared_ptr<T> >(&data->m_obj); boost::shared_ptr<T> *ptr = boost::any_cast<boost::shared_ptr<T> >(&data->m_obj);

View File

@ -287,8 +287,9 @@ namespace chaiscript
Bound_Function(const Const_Proxy_Function &t_f, Bound_Function(const Const_Proxy_Function &t_f,
const std::vector<Boxed_Value> &t_args) const std::vector<Boxed_Value> &t_args)
: Proxy_Function_Base(std::vector<Type_Info>()), : Proxy_Function_Base(std::vector<Type_Info>()),
m_f(t_f), m_args(t_args), m_arity(m_f->get_arity()<0?-1:(m_f->get_arity() - m_args.size())) m_f(t_f), m_args(t_args), m_arity(m_f->get_arity()<0?-1:(m_f->get_arity() - static_cast<int>(m_args.size())))
{ {
assert(m_f->get_arity() >= static_cast<int>(m_args.size()));
} }
virtual bool operator==(const Proxy_Function_Base &) const virtual bool operator==(const Proxy_Function_Base &) const

View File

@ -51,6 +51,10 @@ std::string get_next_command() {
#endif #endif
} }
void myexit(int return_val) {
exit(return_val);
}
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
std::string input; std::string input;
@ -88,7 +92,7 @@ int main(int argc, char *argv[]) {
chaiscript::ChaiScript chai(modulepaths,usepaths); chaiscript::ChaiScript chai(modulepaths,usepaths);
chai.add(chaiscript::fun(&exit), "exit"); chai.add(chaiscript::fun(&myexit), "exit");
chai.add(chaiscript::fun(&throws_exception), "throws_exception"); chai.add(chaiscript::fun(&throws_exception), "throws_exception");
if (argc < 2) { if (argc < 2) {