diff --git a/boxedcpp/bootstrap.hpp b/boxedcpp/bootstrap.hpp index 232304b..f6df879 100644 --- a/boxedcpp/bootstrap.hpp +++ b/boxedcpp/bootstrap.hpp @@ -460,6 +460,11 @@ void bootstrap_pod_type(BoxedCPP_System &s, const std::string &name) register_function(s, &to_string, "to_string"); } +void print(const std::string &s) +{ + std::cout << s << std::endl; +} + void bootstrap(BoxedCPP_System &s) { s.register_type("void"); @@ -488,6 +493,11 @@ void bootstrap(BoxedCPP_System &s) add_oper_add(s); add_oper_add_equals (s); + register_function(s, &print, "print"); + + s.register_function(boost::function(boost::bind(&dump_system, boost::ref(s))), "dump_system"); + s.register_function(boost::function(boost::bind(&dump_object, _1)), "dump_object"); + register_function(s, &bool_and, "&&"); register_function(s, &bool_or, "||"); diff --git a/boxedcpp/test.cpp b/boxedcpp/test.cpp index 431c811..2e8fe4e 100644 --- a/boxedcpp/test.cpp +++ b/boxedcpp/test.cpp @@ -30,11 +30,6 @@ struct Test }; -//A function that prints any string passed to it -void print(const std::string &s) -{ - std::cout << "Printed: " << s << std::endl; -} Boxed_Value named_func_call(BoxedCPP_System &ss, const std::string &nametocall, const std::vector ¶ms) @@ -108,7 +103,6 @@ int main() //Register a new function, this one with typing for us, so we don't have to ubox anything //right here - register_function(ss, &print, "print"); //Now we have a print method, let's try to print out the earlier example: //so, we dispatch the to_string and pass its result as a param to "print" diff --git a/wesley/wesley_engine.hpp b/wesley/wesley_engine.hpp index e55b5f0..08480a6 100644 --- a/wesley/wesley_engine.hpp +++ b/wesley/wesley_engine.hpp @@ -8,22 +8,6 @@ //A function that prints any string passed to it -template -void print(const T &t) -{ - std::cout << t << std::endl; -} - -template<> void print(const bool &t) -{ - if (t) { - std::cout << "true" << std::endl; - } - else { - std::cout << "false" << std::endl; - } -} - template class Wesley_System { Lexer lexer; @@ -203,17 +187,6 @@ public: bootstrap_vector >(ss, "Vector"); //dump_system(ss); - //Register a new function, this one with typing for us, so we don't have to ubox anything - //right here - register_function(ss, &print, "print"); - register_function(ss, &print, "print"); - register_function(ss, &print, "print"); - register_function(ss, &print, "print"); - register_function(ss, &print, "print"); - - ss.register_function(boost::function(boost::bind(&dump_system, boost::ref(ss))), "dump_system"); - ss.register_function(boost::function(boost::bind(&dump_object, _1)), "dump_object"); - ss.register_function(boost::shared_ptr( new Dynamic_Proxy_Function(boost::bind(&Wesley_System::eval, boost::ref(*this), _1), 1)), "eval");