From e313376a00df43fe01ce72c674e7e1ff230c3e09 Mon Sep 17 00:00:00 2001 From: Jonathan Turner Date: Thu, 11 Jun 2009 13:40:50 +0000 Subject: [PATCH] Move print to being script-bootstrapped --- boxedcpp/bootstrap.hpp | 26 ++------------------------ wesley/wesley_engine.hpp | 2 ++ 2 files changed, 4 insertions(+), 24 deletions(-) diff --git a/boxedcpp/bootstrap.hpp b/boxedcpp/bootstrap.hpp index 8500b8f..88f5a5e 100644 --- a/boxedcpp/bootstrap.hpp +++ b/boxedcpp/bootstrap.hpp @@ -453,7 +453,7 @@ std::string to_string(Input i) return boost::lexical_cast(i); } -std::string to_string(bool b) +template<> std::string to_string(bool b) { if (b) { @@ -475,28 +475,10 @@ 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; } -*/ - -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; - } -} void bootstrap(BoxedCPP_System &s) { @@ -526,11 +508,7 @@ void bootstrap(BoxedCPP_System &s) add_oper_add(s); add_oper_add_equals (s); - register_function(s, &print, "print"); - register_function(s, &print, "print"); - register_function(s, &print, "print"); - register_function(s, &print, "print"); - register_function(s, &print, "print"); + register_function(s, &print, "print_string"); 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"); diff --git a/wesley/wesley_engine.hpp b/wesley/wesley_engine.hpp index 2418d40..7262d3a 100644 --- a/wesley/wesley_engine.hpp +++ b/wesley/wesley_engine.hpp @@ -194,6 +194,8 @@ public: ss.register_function(boost::shared_ptr( new Dynamic_Proxy_Function(boost::bind(&Wesley_System::eval, boost::ref(*this), _1), 1)), "eval"); + evaluate_string("def print(x) { print_string(x.to_string()) } "); + return ss; }