Fixed the variable code, replacing it with simpler arguments and using exceptions...
[fridhskrift.git] / variable / logical_operator.cpp
blob2a4eeccb811fa91c313574e26efeff8e71ffb7ec
1 #include <fridh/symbol.hpp>
3 namespace fridh
5 #define LOGICAL_OPERATOR(name, description, operator) \
6 void variable::name(variable const & argument, variable & output) \
7 { \
8 bool \
9 left_value, \
10 right_value; \
11 if(get_boolean_value(left_value) && argument.get_boolean_value(right_value)) \
12 output.new_boolean(left_value operator right_value); \
13 else \
14 unary_argument_type_error(description, type); \
17 LOGICAL_OPERATOR(logical_and, "Logical and", &&)
18 LOGICAL_OPERATOR(logical_or, "Logical or", ||)