diff --git a/dispatchkit/bootstrap.hpp b/dispatchkit/bootstrap.hpp index 677d7e45..598f8091 100644 --- a/dispatchkit/bootstrap.hpp +++ b/dispatchkit/bootstrap.hpp @@ -2,7 +2,7 @@ #define __bootstrap_hpp__ #include "dispatchkit.hpp" -#include "bootstrap_pod.hpp" +#include "register_function.hpp" namespace dispatchkit { @@ -420,6 +420,24 @@ namespace dispatchkit std::cout << s << std::endl; } + static void add_opers_comparison_pod(Dispatch_Engine &s) + { + register_function(s, &equals, "=="); + register_function(s, ¬_equals, "!="); + register_function(s, &less_than, "<"); + register_function(s, &greater_than, ">"); + register_function(s, &less_than_equals, "<="); + register_function(s, &greater_than_equals, ">="); + } + + static void add_opers_arithmetic_pod(Dispatch_Engine &s) + { + register_function(s, &add, "+"); + register_function(s, &subtract, "-"); + register_function(s, ÷, "/"); + register_function(s, &multiply, "*"); + } + static void bootstrap(Dispatch_Engine &s) { s.register_type("void"); @@ -441,9 +459,8 @@ namespace dispatchkit bootstrap_pod_type(s, "int64_t"); - - Pod_Bootstrap::add_opers_comparison(s); - Pod_Bootstrap::add_opers_arithmetic(s); + add_opers_comparison_pod(s); + add_opers_arithmetic_pod(s); add_oper_add(s); add_oper_add_equals (s); diff --git a/dispatchkit/bootstrap_pod.hpp b/dispatchkit/bootstrap_pod.hpp deleted file mode 100644 index d5ca600e..00000000 --- a/dispatchkit/bootstrap_pod.hpp +++ /dev/null @@ -1,82 +0,0 @@ -#ifndef __dispatchkit_bootstrap_pod_hpp__ -#define __dispatchkit_bootstrap_pod_hpp__ - - -#include "register_function.hpp" - -namespace dispatchkit -{ - struct Pod_Bootstrap - { - static Boxed_Value add(Boxed_POD_Value l, Boxed_POD_Value r) - { - return l + r; - } - - static Boxed_Value subtract(Boxed_POD_Value l, Boxed_POD_Value r) - { - return l - r; - } - - static Boxed_Value divide(Boxed_POD_Value l, Boxed_POD_Value r) - { - return l / r; - } - - static Boxed_Value multiply(Boxed_POD_Value l, Boxed_POD_Value r) - { - return l * r; - } - - static bool equals(Boxed_POD_Value l, Boxed_POD_Value r) - { - return l == r; - } - - static bool not_equals(Boxed_POD_Value l, Boxed_POD_Value r) - { - return l != r; - } - - static bool less_than(Boxed_POD_Value l, Boxed_POD_Value r) - { - return l < r; - } - - static bool greater_than(Boxed_POD_Value l, Boxed_POD_Value r) - { - return l > r; - } - - static bool less_than_equals(Boxed_POD_Value l, Boxed_POD_Value r) - { - return l <= r; - } - - static bool greater_than_equals(Boxed_POD_Value l, Boxed_POD_Value r) - { - return l >= r; - } - - static void add_opers_comparison(Dispatch_Engine &s) - { - register_function(s, &equals, "=="); - register_function(s, ¬_equals, "!="); - register_function(s, &less_than, "<"); - register_function(s, &greater_than, ">"); - register_function(s, &less_than_equals, "<="); - register_function(s, &greater_than_equals, ">="); - } - - static void add_opers_arithmetic(Dispatch_Engine &s) - { - register_function(s, &add, "+"); - register_function(s, &subtract, "-"); - register_function(s, ÷, "/"); - register_function(s, &multiply, "*"); - } - }; -} - -#endif -