Rename of numeric to number
This commit is contained in:
parent
6d4041b2a1
commit
7a9baeb350
@ -563,7 +563,7 @@
|
|||||||
#include "dispatchkit/bootstrap_stl.hpp"
|
#include "dispatchkit/bootstrap_stl.hpp"
|
||||||
#include "dispatchkit/function_call.hpp"
|
#include "dispatchkit/function_call.hpp"
|
||||||
#include "dispatchkit/dynamic_object.hpp"
|
#include "dispatchkit/dynamic_object.hpp"
|
||||||
#include "dispatchkit/boxed_numeric.hpp"
|
#include "dispatchkit/boxed_number.hpp"
|
||||||
|
|
||||||
#ifdef BOOST_HAS_DECLSPEC
|
#ifdef BOOST_HAS_DECLSPEC
|
||||||
#define CHAISCRIPT_MODULE_EXPORT extern "C" __declspec(dllexport)
|
#define CHAISCRIPT_MODULE_EXPORT extern "C" __declspec(dllexport)
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#include "dynamic_object.hpp"
|
#include "dynamic_object.hpp"
|
||||||
#include "register_function.hpp"
|
#include "register_function.hpp"
|
||||||
#include "operators.hpp"
|
#include "operators.hpp"
|
||||||
#include "boxed_numeric.hpp"
|
#include "boxed_number.hpp"
|
||||||
#include <boost/function_types/result_type.hpp>
|
#include <boost/function_types/result_type.hpp>
|
||||||
|
|
||||||
namespace chaiscript
|
namespace chaiscript
|
||||||
@ -21,15 +21,15 @@ namespace chaiscript
|
|||||||
{
|
{
|
||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
/// \brief Constructs a new POD value object from a Boxed_Numeric
|
/// \brief Constructs a new POD value object from a Boxed_Number
|
||||||
/// \param[in] v Boxed_Numeric to copy into the new object
|
/// \param[in] v Boxed_Number to copy into the new object
|
||||||
/// \returns The newly created object.
|
/// \returns The newly created object.
|
||||||
template<typename P1>
|
template<typename P1>
|
||||||
boost::shared_ptr<P1> construct_pod(Boxed_Numeric v)
|
boost::shared_ptr<P1> construct_pod(Boxed_Number v)
|
||||||
{
|
{
|
||||||
boost::shared_ptr<P1> p(new P1());
|
boost::shared_ptr<P1> p(new P1());
|
||||||
Boxed_Value bv(p);
|
Boxed_Value bv(p);
|
||||||
Boxed_Numeric nb(bv);
|
Boxed_Number nb(bv);
|
||||||
nb = v;
|
nb = v;
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
@ -210,41 +210,41 @@ namespace chaiscript
|
|||||||
*/
|
*/
|
||||||
static void opers_arithmetic_pod(ModulePtr m = ModulePtr(new Module()))
|
static void opers_arithmetic_pod(ModulePtr m = ModulePtr(new Module()))
|
||||||
{
|
{
|
||||||
m->add(fun(&Boxed_Numeric::operator&=), "&=");
|
m->add(fun(&Boxed_Number::operator&=), "&=");
|
||||||
m->add(fun(&Boxed_Numeric::operator|=), "|=");
|
m->add(fun(&Boxed_Number::operator|=), "|=");
|
||||||
m->add(fun(&Boxed_Numeric::operator%=), "%=");
|
m->add(fun(&Boxed_Number::operator%=), "%=");
|
||||||
m->add(fun(&Boxed_Numeric::operator^=), "^=");
|
m->add(fun(&Boxed_Number::operator^=), "^=");
|
||||||
m->add(fun(&Boxed_Numeric::operator<<=), "<<=");
|
m->add(fun(&Boxed_Number::operator<<=), "<<=");
|
||||||
m->add(fun(&Boxed_Numeric::operator>>=), ">>=");
|
m->add(fun(&Boxed_Number::operator>>=), ">>=");
|
||||||
|
|
||||||
m->add(fun(&Boxed_Numeric::operator&), "&");
|
m->add(fun(&Boxed_Number::operator&), "&");
|
||||||
m->add(fun(&Boxed_Numeric::operator~), "~");
|
m->add(fun(&Boxed_Number::operator~), "~");
|
||||||
m->add(fun(&Boxed_Numeric::operator^), "^");
|
m->add(fun(&Boxed_Number::operator^), "^");
|
||||||
m->add(fun(&Boxed_Numeric::operator|), "|");
|
m->add(fun(&Boxed_Number::operator|), "|");
|
||||||
m->add(fun(&Boxed_Numeric::operator<<), "<<");
|
m->add(fun(&Boxed_Number::operator<<), "<<");
|
||||||
m->add(fun(&Boxed_Numeric::operator%), "%");
|
m->add(fun(&Boxed_Number::operator%), "%");
|
||||||
m->add(fun(&Boxed_Numeric::operator>>), ">>");
|
m->add(fun(&Boxed_Number::operator>>), ">>");
|
||||||
|
|
||||||
m->add(fun<Boxed_Value (Boxed_Numeric::*)(const Boxed_Numeric &) const>(&Boxed_Numeric::operator=), "=");
|
m->add(fun<Boxed_Value (Boxed_Number::*)(const Boxed_Number &) const>(&Boxed_Number::operator=), "=");
|
||||||
m->add(fun(&Boxed_Numeric::operator*=), "*=");
|
m->add(fun(&Boxed_Number::operator*=), "*=");
|
||||||
m->add(fun(&Boxed_Numeric::operator/=), "/=");
|
m->add(fun(&Boxed_Number::operator/=), "/=");
|
||||||
m->add(fun(&Boxed_Numeric::operator+=), "+=");
|
m->add(fun(&Boxed_Number::operator+=), "+=");
|
||||||
m->add(fun(&Boxed_Numeric::operator-=), "-=");
|
m->add(fun(&Boxed_Number::operator-=), "-=");
|
||||||
m->add(fun(&Boxed_Numeric::operator--), "--");
|
m->add(fun(&Boxed_Number::operator--), "--");
|
||||||
m->add(fun(&Boxed_Numeric::operator++), "++");
|
m->add(fun(&Boxed_Number::operator++), "++");
|
||||||
m->add(fun(&Boxed_Numeric::operator/), "/");
|
m->add(fun(&Boxed_Number::operator/), "/");
|
||||||
m->add(fun(&Boxed_Numeric::operator*), "*");
|
m->add(fun(&Boxed_Number::operator*), "*");
|
||||||
m->add(fun<Boxed_Value (Boxed_Numeric::*)() const>(&Boxed_Numeric::operator+), "+");
|
m->add(fun<Boxed_Value (Boxed_Number::*)() const>(&Boxed_Number::operator+), "+");
|
||||||
m->add(fun<Boxed_Value (Boxed_Numeric::*)() const>(&Boxed_Numeric::operator-), "-");
|
m->add(fun<Boxed_Value (Boxed_Number::*)() const>(&Boxed_Number::operator-), "-");
|
||||||
m->add(fun<Boxed_Value (Boxed_Numeric::*)(const Boxed_Numeric &) const>(&Boxed_Numeric::operator+), "+");
|
m->add(fun<Boxed_Value (Boxed_Number::*)(const Boxed_Number &) const>(&Boxed_Number::operator+), "+");
|
||||||
m->add(fun<Boxed_Value (Boxed_Numeric::*)(const Boxed_Numeric &) const>(&Boxed_Numeric::operator-), "-");
|
m->add(fun<Boxed_Value (Boxed_Number::*)(const Boxed_Number &) const>(&Boxed_Number::operator-), "-");
|
||||||
|
|
||||||
m->add(fun(&Boxed_Numeric::operator==), "==");
|
m->add(fun(&Boxed_Number::operator==), "==");
|
||||||
m->add(fun(&Boxed_Numeric::operator>), ">");
|
m->add(fun(&Boxed_Number::operator>), ">");
|
||||||
m->add(fun(&Boxed_Numeric::operator>=), ">=");
|
m->add(fun(&Boxed_Number::operator>=), ">=");
|
||||||
m->add(fun(&Boxed_Numeric::operator<), "<");
|
m->add(fun(&Boxed_Number::operator<), "<");
|
||||||
m->add(fun(&Boxed_Numeric::operator<=), "<=");
|
m->add(fun(&Boxed_Number::operator<=), "<=");
|
||||||
m->add(fun(&Boxed_Numeric::operator!=), "!=");
|
m->add(fun(&Boxed_Number::operator!=), "!=");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -369,7 +369,7 @@ namespace chaiscript
|
|||||||
m->add(user_type<void>(), "void");
|
m->add(user_type<void>(), "void");
|
||||||
m->add(user_type<bool>(), "bool");
|
m->add(user_type<bool>(), "bool");
|
||||||
m->add(user_type<Boxed_Value>(), "Object");
|
m->add(user_type<Boxed_Value>(), "Object");
|
||||||
m->add(user_type<Boxed_Numeric>(), "PODObject");
|
m->add(user_type<Boxed_Number>(), "Number");
|
||||||
m->add(user_type<Proxy_Function>(), "Function");
|
m->add(user_type<Proxy_Function>(), "Function");
|
||||||
m->add(user_type<std::exception>(), "exception");
|
m->add(user_type<std::exception>(), "exception");
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ namespace chaiscript
|
|||||||
{
|
{
|
||||||
|
|
||||||
/// \brief Represents any numeric type, generically. Used internally for generic operations between POD values
|
/// \brief Represents any numeric type, generically. Used internally for generic operations between POD values
|
||||||
class Boxed_Numeric
|
class Boxed_Number
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
struct boolean
|
struct boolean
|
||||||
@ -301,7 +301,7 @@ namespace chaiscript
|
|||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Boxed_Numeric(const Boxed_Value &v)
|
Boxed_Number(const Boxed_Value &v)
|
||||||
: bv(v)
|
: bv(v)
|
||||||
{
|
{
|
||||||
const Type_Info &inp_ = v.get_type_info();
|
const Type_Info &inp_ = v.get_type_info();
|
||||||
@ -317,32 +317,32 @@ namespace chaiscript
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool operator==(const Boxed_Numeric &t_rhs) const
|
bool operator==(const Boxed_Number &t_rhs) const
|
||||||
{
|
{
|
||||||
return boxed_cast<bool>(oper(Operators::equals, this->bv, t_rhs.bv));
|
return boxed_cast<bool>(oper(Operators::equals, this->bv, t_rhs.bv));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator<(const Boxed_Numeric &t_rhs) const
|
bool operator<(const Boxed_Number &t_rhs) const
|
||||||
{
|
{
|
||||||
return boxed_cast<bool>(oper(Operators::less_than, this->bv, t_rhs.bv));
|
return boxed_cast<bool>(oper(Operators::less_than, this->bv, t_rhs.bv));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator>(const Boxed_Numeric &t_rhs) const
|
bool operator>(const Boxed_Number &t_rhs) const
|
||||||
{
|
{
|
||||||
return boxed_cast<bool>(oper(Operators::greater_than, this->bv, t_rhs.bv));
|
return boxed_cast<bool>(oper(Operators::greater_than, this->bv, t_rhs.bv));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator>=(const Boxed_Numeric &t_rhs) const
|
bool operator>=(const Boxed_Number &t_rhs) const
|
||||||
{
|
{
|
||||||
return boxed_cast<bool>(oper(Operators::greater_than_equal, this->bv, t_rhs.bv));
|
return boxed_cast<bool>(oper(Operators::greater_than_equal, this->bv, t_rhs.bv));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator<=(const Boxed_Numeric &t_rhs) const
|
bool operator<=(const Boxed_Number &t_rhs) const
|
||||||
{
|
{
|
||||||
return boxed_cast<bool>(oper(Operators::less_than_equal, this->bv, t_rhs.bv));
|
return boxed_cast<bool>(oper(Operators::less_than_equal, this->bv, t_rhs.bv));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(const Boxed_Numeric &t_rhs) const
|
bool operator!=(const Boxed_Number &t_rhs) const
|
||||||
{
|
{
|
||||||
return boxed_cast<bool>(oper(Operators::not_equal, this->bv, t_rhs.bv));
|
return boxed_cast<bool>(oper(Operators::not_equal, this->bv, t_rhs.bv));
|
||||||
}
|
}
|
||||||
@ -357,7 +357,7 @@ namespace chaiscript
|
|||||||
return oper(Operators::pre_increment, this->bv, var(0));
|
return oper(Operators::pre_increment, this->bv, var(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
Boxed_Value operator+(const Boxed_Numeric &t_rhs) const
|
Boxed_Value operator+(const Boxed_Number &t_rhs) const
|
||||||
{
|
{
|
||||||
return oper(Operators::sum, this->bv, t_rhs.bv);
|
return oper(Operators::sum, this->bv, t_rhs.bv);
|
||||||
}
|
}
|
||||||
@ -372,47 +372,47 @@ namespace chaiscript
|
|||||||
return oper(Operators::unary_minus, this->bv, Boxed_Value(0));
|
return oper(Operators::unary_minus, this->bv, Boxed_Value(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
Boxed_Value operator-(const Boxed_Numeric &t_rhs) const
|
Boxed_Value operator-(const Boxed_Number &t_rhs) const
|
||||||
{
|
{
|
||||||
return oper(Operators::difference, this->bv, t_rhs.bv);
|
return oper(Operators::difference, this->bv, t_rhs.bv);
|
||||||
}
|
}
|
||||||
|
|
||||||
Boxed_Value operator&=(const Boxed_Numeric &t_rhs) const
|
Boxed_Value operator&=(const Boxed_Number &t_rhs) const
|
||||||
{
|
{
|
||||||
return oper(Operators::assign_bitwise_and, this->bv, t_rhs.bv);
|
return oper(Operators::assign_bitwise_and, this->bv, t_rhs.bv);
|
||||||
}
|
}
|
||||||
|
|
||||||
Boxed_Value operator=(const Boxed_Numeric &t_rhs) const
|
Boxed_Value operator=(const Boxed_Number &t_rhs) const
|
||||||
{
|
{
|
||||||
return oper(Operators::assign, this->bv, t_rhs.bv);
|
return oper(Operators::assign, this->bv, t_rhs.bv);
|
||||||
}
|
}
|
||||||
|
|
||||||
Boxed_Value operator|=(const Boxed_Numeric &t_rhs) const
|
Boxed_Value operator|=(const Boxed_Number &t_rhs) const
|
||||||
{
|
{
|
||||||
return oper(Operators::assign_bitwise_or, this->bv, t_rhs.bv);
|
return oper(Operators::assign_bitwise_or, this->bv, t_rhs.bv);
|
||||||
}
|
}
|
||||||
|
|
||||||
Boxed_Value operator^=(const Boxed_Numeric &t_rhs) const
|
Boxed_Value operator^=(const Boxed_Number &t_rhs) const
|
||||||
{
|
{
|
||||||
return oper(Operators::assign_bitwise_xor, this->bv, t_rhs.bv);
|
return oper(Operators::assign_bitwise_xor, this->bv, t_rhs.bv);
|
||||||
}
|
}
|
||||||
|
|
||||||
Boxed_Value operator%=(const Boxed_Numeric &t_rhs) const
|
Boxed_Value operator%=(const Boxed_Number &t_rhs) const
|
||||||
{
|
{
|
||||||
return oper(Operators::assign_remainder, this->bv, t_rhs.bv);
|
return oper(Operators::assign_remainder, this->bv, t_rhs.bv);
|
||||||
}
|
}
|
||||||
|
|
||||||
Boxed_Value operator<<=(const Boxed_Numeric &t_rhs) const
|
Boxed_Value operator<<=(const Boxed_Number &t_rhs) const
|
||||||
{
|
{
|
||||||
return oper(Operators::assign_shift_left, this->bv, t_rhs.bv);
|
return oper(Operators::assign_shift_left, this->bv, t_rhs.bv);
|
||||||
}
|
}
|
||||||
|
|
||||||
Boxed_Value operator>>=(const Boxed_Numeric &t_rhs) const
|
Boxed_Value operator>>=(const Boxed_Number &t_rhs) const
|
||||||
{
|
{
|
||||||
return oper(Operators::assign_shift_right, this->bv, t_rhs.bv);
|
return oper(Operators::assign_shift_right, this->bv, t_rhs.bv);
|
||||||
}
|
}
|
||||||
|
|
||||||
Boxed_Value operator&(const Boxed_Numeric &t_rhs) const
|
Boxed_Value operator&(const Boxed_Number &t_rhs) const
|
||||||
{
|
{
|
||||||
return oper(Operators::bitwise_and, this->bv, t_rhs.bv);
|
return oper(Operators::bitwise_and, this->bv, t_rhs.bv);
|
||||||
}
|
}
|
||||||
@ -422,54 +422,54 @@ namespace chaiscript
|
|||||||
return oper(Operators::bitwise_complement, this->bv, Boxed_Value(0));
|
return oper(Operators::bitwise_complement, this->bv, Boxed_Value(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
Boxed_Value operator^(const Boxed_Numeric &t_rhs) const
|
Boxed_Value operator^(const Boxed_Number &t_rhs) const
|
||||||
{
|
{
|
||||||
return oper(Operators::bitwise_xor, this->bv, t_rhs.bv);
|
return oper(Operators::bitwise_xor, this->bv, t_rhs.bv);
|
||||||
}
|
}
|
||||||
|
|
||||||
Boxed_Value operator|(const Boxed_Numeric &t_rhs) const
|
Boxed_Value operator|(const Boxed_Number &t_rhs) const
|
||||||
{
|
{
|
||||||
return oper(Operators::bitwise_or, this->bv, t_rhs.bv);
|
return oper(Operators::bitwise_or, this->bv, t_rhs.bv);
|
||||||
}
|
}
|
||||||
|
|
||||||
Boxed_Value operator*=(const Boxed_Numeric &t_rhs) const
|
Boxed_Value operator*=(const Boxed_Number &t_rhs) const
|
||||||
{
|
{
|
||||||
return oper(Operators::assign_product, this->bv, t_rhs.bv);
|
return oper(Operators::assign_product, this->bv, t_rhs.bv);
|
||||||
}
|
}
|
||||||
Boxed_Value operator/=(const Boxed_Numeric &t_rhs) const
|
Boxed_Value operator/=(const Boxed_Number &t_rhs) const
|
||||||
{
|
{
|
||||||
return oper(Operators::assign_quotient, this->bv, t_rhs.bv);
|
return oper(Operators::assign_quotient, this->bv, t_rhs.bv);
|
||||||
}
|
}
|
||||||
Boxed_Value operator+=(const Boxed_Numeric &t_rhs) const
|
Boxed_Value operator+=(const Boxed_Number &t_rhs) const
|
||||||
{
|
{
|
||||||
return oper(Operators::assign_sum, this->bv, t_rhs.bv);
|
return oper(Operators::assign_sum, this->bv, t_rhs.bv);
|
||||||
}
|
}
|
||||||
Boxed_Value operator-=(const Boxed_Numeric &t_rhs) const
|
Boxed_Value operator-=(const Boxed_Number &t_rhs) const
|
||||||
{
|
{
|
||||||
return oper(Operators::assign_difference, this->bv, t_rhs.bv);
|
return oper(Operators::assign_difference, this->bv, t_rhs.bv);
|
||||||
}
|
}
|
||||||
|
|
||||||
Boxed_Value operator/(const Boxed_Numeric &t_rhs) const
|
Boxed_Value operator/(const Boxed_Number &t_rhs) const
|
||||||
{
|
{
|
||||||
return oper(Operators::quotient, this->bv, t_rhs.bv);
|
return oper(Operators::quotient, this->bv, t_rhs.bv);
|
||||||
}
|
}
|
||||||
|
|
||||||
Boxed_Value operator<<(const Boxed_Numeric &t_rhs) const
|
Boxed_Value operator<<(const Boxed_Number &t_rhs) const
|
||||||
{
|
{
|
||||||
return oper(Operators::shift_left, this->bv, t_rhs.bv);
|
return oper(Operators::shift_left, this->bv, t_rhs.bv);
|
||||||
}
|
}
|
||||||
|
|
||||||
Boxed_Value operator*(const Boxed_Numeric &t_rhs) const
|
Boxed_Value operator*(const Boxed_Number &t_rhs) const
|
||||||
{
|
{
|
||||||
return oper(Operators::product, this->bv, t_rhs.bv);
|
return oper(Operators::product, this->bv, t_rhs.bv);
|
||||||
}
|
}
|
||||||
|
|
||||||
Boxed_Value operator%(const Boxed_Numeric &t_rhs) const
|
Boxed_Value operator%(const Boxed_Number &t_rhs) const
|
||||||
{
|
{
|
||||||
return oper(Operators::remainder, this->bv, t_rhs.bv);
|
return oper(Operators::remainder, this->bv, t_rhs.bv);
|
||||||
}
|
}
|
||||||
|
|
||||||
Boxed_Value operator>>(const Boxed_Numeric &t_rhs) const
|
Boxed_Value operator>>(const Boxed_Number &t_rhs) const
|
||||||
{
|
{
|
||||||
return oper(Operators::shift_right, this->bv, t_rhs.bv);
|
return oper(Operators::shift_right, this->bv, t_rhs.bv);
|
||||||
}
|
}
|
||||||
@ -490,32 +490,32 @@ namespace chaiscript
|
|||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Cast_Helper for converting from Boxed_Value to Boxed_Numeric
|
* Cast_Helper for converting from Boxed_Value to Boxed_Number
|
||||||
*/
|
*/
|
||||||
template<>
|
template<>
|
||||||
struct Cast_Helper<Boxed_Numeric>
|
struct Cast_Helper<Boxed_Number>
|
||||||
{
|
{
|
||||||
typedef Boxed_Numeric Result_Type;
|
typedef Boxed_Number Result_Type;
|
||||||
|
|
||||||
static Result_Type cast(const Boxed_Value &ob)
|
static Result_Type cast(const Boxed_Value &ob)
|
||||||
{
|
{
|
||||||
return Boxed_Numeric(ob);
|
return Boxed_Number(ob);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cast_Helper for converting from Boxed_Value to Boxed_Numeric
|
* Cast_Helper for converting from Boxed_Value to Boxed_Number
|
||||||
*/
|
*/
|
||||||
template<>
|
template<>
|
||||||
struct Cast_Helper<const Boxed_Numeric &> : Cast_Helper<Boxed_Numeric>
|
struct Cast_Helper<const Boxed_Number &> : Cast_Helper<Boxed_Number>
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cast_Helper for converting from Boxed_Value to Boxed_Numeric
|
* Cast_Helper for converting from Boxed_Value to Boxed_Number
|
||||||
*/
|
*/
|
||||||
template<>
|
template<>
|
||||||
struct Cast_Helper<const Boxed_Numeric> : Cast_Helper<Boxed_Numeric>
|
struct Cast_Helper<const Boxed_Number> : Cast_Helper<Boxed_Number>
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
}
|
}
|
@ -811,7 +811,7 @@ namespace chaiscript
|
|||||||
const size_t rhssize = rhsparamtypes.size();
|
const size_t rhssize = rhsparamtypes.size();
|
||||||
|
|
||||||
const Type_Info boxed_type = user_type<Boxed_Value>();
|
const Type_Info boxed_type = user_type<Boxed_Value>();
|
||||||
const Type_Info boxed_pod_type = user_type<Boxed_Numeric>();
|
const Type_Info boxed_pod_type = user_type<Boxed_Number>();
|
||||||
|
|
||||||
boost::shared_ptr<const dispatch::Dynamic_Proxy_Function> dynamic_lhs(boost::dynamic_pointer_cast<const dispatch::Dynamic_Proxy_Function>(lhs));
|
boost::shared_ptr<const dispatch::Dynamic_Proxy_Function> dynamic_lhs(boost::dynamic_pointer_cast<const dispatch::Dynamic_Proxy_Function>(lhs));
|
||||||
boost::shared_ptr<const dispatch::Dynamic_Proxy_Function> dynamic_rhs(boost::dynamic_pointer_cast<const dispatch::Dynamic_Proxy_Function>(rhs));
|
boost::shared_ptr<const dispatch::Dynamic_Proxy_Function> dynamic_rhs(boost::dynamic_pointer_cast<const dispatch::Dynamic_Proxy_Function>(rhs));
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
namespace chaiscript
|
namespace chaiscript
|
||||||
{
|
{
|
||||||
class Boxed_Numeric;
|
class Boxed_Number;
|
||||||
struct AST_Node;
|
struct AST_Node;
|
||||||
|
|
||||||
typedef boost::shared_ptr<struct AST_Node> AST_NodePtr;
|
typedef boost::shared_ptr<struct AST_Node> AST_NodePtr;
|
||||||
@ -139,7 +139,7 @@ namespace chaiscript
|
|||||||
if (ti.is_undef()
|
if (ti.is_undef()
|
||||||
|| ti.bare_equal(user_type<Boxed_Value>())
|
|| ti.bare_equal(user_type<Boxed_Value>())
|
||||||
|| (!bv.get_type_info().is_undef()
|
|| (!bv.get_type_info().is_undef()
|
||||||
&& (ti.bare_equal(user_type<Boxed_Numeric>())
|
&& (ti.bare_equal(user_type<Boxed_Number>())
|
||||||
|| ti.bare_equal(bv.get_type_info())
|
|| ti.bare_equal(bv.get_type_info())
|
||||||
|| chaiscript::detail::dynamic_cast_converts(ti, bv.get_type_info())
|
|| chaiscript::detail::dynamic_cast_converts(ti, bv.get_type_info())
|
||||||
|| bv.get_type_info().bare_equal(user_type<boost::shared_ptr<const Proxy_Function_Base> >())
|
|| bv.get_type_info().bare_equal(user_type<boost::shared_ptr<const Proxy_Function_Base> >())
|
||||||
|
@ -58,7 +58,7 @@ namespace chaiscript
|
|||||||
{
|
{
|
||||||
// If it's an arithmetic operation we want to short circuit dispatch
|
// If it's an arithmetic operation we want to short circuit dispatch
|
||||||
try{
|
try{
|
||||||
return Boxed_Numeric::do_oper(t_oper, t_lhs, t_rhs);
|
return Boxed_Number::do_oper(t_oper, t_lhs, t_rhs);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
throw exception::eval_error("Error with numeric operator calling: " + t_oper_string);
|
throw exception::eval_error("Error with numeric operator calling: " + t_oper_string);
|
||||||
}
|
}
|
||||||
@ -288,7 +288,7 @@ namespace chaiscript
|
|||||||
retval.get_type_info().is_arithmetic())
|
retval.get_type_info().is_arithmetic())
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
retval = Boxed_Numeric::do_oper(oper, lhs, retval);
|
retval = Boxed_Number::do_oper(oper, lhs, retval);
|
||||||
} catch (const std::exception &) {
|
} catch (const std::exception &) {
|
||||||
throw exception::eval_error("Error with unsupported arithmetic assignment operation");
|
throw exception::eval_error("Error with unsupported arithmetic assignment operation");
|
||||||
}
|
}
|
||||||
@ -862,7 +862,7 @@ namespace chaiscript
|
|||||||
try {
|
try {
|
||||||
if (bv.get_type_info().is_arithmetic() && oper != Operators::invalid)
|
if (bv.get_type_info().is_arithmetic() && oper != Operators::invalid)
|
||||||
{
|
{
|
||||||
return Boxed_Numeric::do_oper(oper, bv);
|
return Boxed_Number::do_oper(oper, bv);
|
||||||
} else {
|
} else {
|
||||||
return t_ss.call_function(this->children[0]->text, bv);
|
return t_ss.call_function(this->children[0]->text, bv);
|
||||||
}
|
}
|
||||||
|
@ -58,8 +58,8 @@ bool do_test(const Boxed_Value &bv, bool T, bool ConstT, bool TRef, bool ConstTR
|
|||||||
bool ConstTPtrConst, bool SharedPtrT, bool SharedConstPtrT,
|
bool ConstTPtrConst, bool SharedPtrT, bool SharedConstPtrT,
|
||||||
bool ConstSharedPtrT, bool ConstSharedConstPtrT, bool ConstSharedPtrTRef, bool ConstSharedPtrTConstRef,
|
bool ConstSharedPtrT, bool ConstSharedConstPtrT, bool ConstSharedPtrTRef, bool ConstSharedPtrTConstRef,
|
||||||
bool BoostRef, bool BoostConstRef, bool ConstBoostRef, bool ConstBoostConstRef,
|
bool BoostRef, bool BoostConstRef, bool ConstBoostRef, bool ConstBoostConstRef,
|
||||||
bool ConstBoostRefRef, bool ConstBoostConstRefRef, bool PODValue,
|
bool ConstBoostRefRef, bool ConstBoostConstRefRef, bool Number,
|
||||||
bool ConstPODValue, bool ConstPODValueRef, bool TPtrConstRef, bool ConstTPtrConstRef)
|
bool ConstNumber, bool ConstNumberRef, bool TPtrConstRef, bool ConstTPtrConstRef)
|
||||||
{
|
{
|
||||||
bool passed = true;
|
bool passed = true;
|
||||||
passed &= test_type_conversion<Type>(bv, T);
|
passed &= test_type_conversion<Type>(bv, T);
|
||||||
@ -86,14 +86,14 @@ bool do_test(const Boxed_Value &bv, bool T, bool ConstT, bool TRef, bool ConstTR
|
|||||||
passed &= test_type_conversion<const boost::reference_wrapper<const Type> >(bv, ConstBoostConstRef);
|
passed &= test_type_conversion<const boost::reference_wrapper<const Type> >(bv, ConstBoostConstRef);
|
||||||
passed &= test_type_conversion<const boost::reference_wrapper<Type> &>(bv, ConstBoostRefRef);
|
passed &= test_type_conversion<const boost::reference_wrapper<Type> &>(bv, ConstBoostRefRef);
|
||||||
passed &= test_type_conversion<const boost::reference_wrapper<const Type> &>(bv, ConstBoostConstRefRef);
|
passed &= test_type_conversion<const boost::reference_wrapper<const Type> &>(bv, ConstBoostConstRefRef);
|
||||||
passed &= test_type_conversion<Boxed_Numeric>(bv, PODValue);
|
passed &= test_type_conversion<Boxed_Number>(bv, Number);
|
||||||
passed &= test_type_conversion<const Boxed_Numeric>(bv, ConstPODValue);
|
passed &= test_type_conversion<const Boxed_Number>(bv, ConstNumber);
|
||||||
passed &= test_type_conversion<Boxed_Numeric &>(bv, false);
|
passed &= test_type_conversion<Boxed_Number &>(bv, false);
|
||||||
passed &= test_type_conversion<const Boxed_Numeric &>(bv, ConstPODValueRef);
|
passed &= test_type_conversion<const Boxed_Number &>(bv, ConstNumberRef);
|
||||||
passed &= test_type_conversion<Boxed_Numeric *>(bv, false);
|
passed &= test_type_conversion<Boxed_Number *>(bv, false);
|
||||||
passed &= test_type_conversion<const Boxed_Numeric *>(bv, false);
|
passed &= test_type_conversion<const Boxed_Number *>(bv, false);
|
||||||
passed &= test_type_conversion<Boxed_Numeric * const>(bv, false);
|
passed &= test_type_conversion<Boxed_Number * const>(bv, false);
|
||||||
passed &= test_type_conversion<const Boxed_Numeric *const>(bv, false);
|
passed &= test_type_conversion<const Boxed_Number *const>(bv, false);
|
||||||
passed &= test_type_conversion<Type *&>(bv, false);
|
passed &= test_type_conversion<Type *&>(bv, false);
|
||||||
passed &= test_type_conversion<const Type *&>(bv, false);
|
passed &= test_type_conversion<const Type *&>(bv, false);
|
||||||
passed &= test_type_conversion<Type * const&>(bv, TPtrConstRef);
|
passed &= test_type_conversion<Type * const&>(bv, TPtrConstRef);
|
||||||
@ -295,7 +295,7 @@ int main()
|
|||||||
bool ConstTPtr, bool TPtrConst, bool ConstTPtrConst, bool SharedPtrT, bool SharedConstPtrT,
|
bool ConstTPtr, bool TPtrConst, bool ConstTPtrConst, bool SharedPtrT, bool SharedConstPtrT,
|
||||||
bool ConstSharedPtrT, bool ConstSharedConstPtrT, bool ConstSharedPtrTRef, bool ConstSharedPtrTConstRef, bool BoostRef,
|
bool ConstSharedPtrT, bool ConstSharedConstPtrT, bool ConstSharedPtrTRef, bool ConstSharedPtrTConstRef, bool BoostRef,
|
||||||
bool BoostConstRef, bool ConstBoostRef, bool ConstBoostConstRef, bool ConstBoostRefRef, bool ConstBoostConstRefRef,
|
bool BoostConstRef, bool ConstBoostRef, bool ConstBoostConstRef, bool ConstBoostRefRef, bool ConstBoostConstRefRef,
|
||||||
bool PODValue, bool ConstPODValue, bool ConstPODValueRef
|
bool Number, bool ConstNumber, bool ConstNumberRef
|
||||||
*/
|
*/
|
||||||
|
|
||||||
passed &= built_in_type_test<int>(5, true);
|
passed &= built_in_type_test<int>(5, true);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user