From 9366c223a8c8e61e27568d665ec0485a731db4d8 Mon Sep 17 00:00:00 2001 From: Jason Turner Date: Wed, 27 May 2009 03:52:46 +0000 Subject: [PATCH] Add some bootstrapping of known types and operators --- boxedcpp/boxedcpp.hpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/boxedcpp/boxedcpp.hpp b/boxedcpp/boxedcpp.hpp index 4c0fa41f..139a2314 100644 --- a/boxedcpp/boxedcpp.hpp +++ b/boxedcpp/boxedcpp.hpp @@ -122,12 +122,37 @@ void dump_system(const BoxedCPP_System &s) std::cout << std::endl; } +template +Ret add(const P1 &p1, const P2 &p2) +{ + return p1 + p2; +} + +template +Ret multiply(const P1 &p1, const P2 &p2) +{ + return p1 * p2; +} + + void bootstrap(BoxedCPP_System &s) { s.register_type("void"); s.register_type("double"); s.register_type("int"); s.register_type("string"); + + s.register_function(boost::function(&add), "+"); + + s.register_function(boost::function(&add), "+"); + s.register_function(boost::function(&add), "+"); + s.register_function(boost::function(&add), "+"); + s.register_function(boost::function(&add), "+"); + + s.register_function(boost::function(&multiply), "*"); + s.register_function(boost::function(&multiply), "*"); + s.register_function(boost::function(&multiply), "*"); + s.register_function(boost::function(&multiply), "*"); } #endif