Fix build errors and warnings for VS2010

This commit is contained in:
Jason Turner
2011-04-02 11:21:11 -06:00
parent 8dec35ba19
commit d22a77503c
5 changed files with 187 additions and 170 deletions

View File

@@ -17,6 +17,8 @@
namespace chaiscript namespace chaiscript
{ {
namespace dispatch
{
namespace detail namespace detail
{ {
/** /**
@@ -145,7 +147,7 @@ namespace chaiscript
return Boxed_Value(Boxed_Value::Void_Type()); return Boxed_Value(Boxed_Value::Void_Type());
} }
}; };
}
} }
} }

View File

@@ -20,7 +20,7 @@
namespace chaiscript namespace chaiscript
{ {
struct Boxed_POD_Value; class Boxed_POD_Value;
struct AST_Node; struct AST_Node;
typedef boost::shared_ptr<struct AST_Node> AST_NodePtr; typedef boost::shared_ptr<struct AST_Node> AST_NodePtr;
@@ -141,7 +141,7 @@ namespace chaiscript
|| (!bv.get_type_info().is_undef() || (!bv.get_type_info().is_undef()
&& (ti.bare_equal(user_type<Boxed_POD_Value>()) && (ti.bare_equal(user_type<Boxed_POD_Value>())
|| ti.bare_equal(bv.get_type_info()) || ti.bare_equal(bv.get_type_info())
|| 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> >())
) )
) )
@@ -289,13 +289,13 @@ namespace chaiscript
std::vector<Type_Info> types; std::vector<Type_Info> types;
// For the return type // For the return type
types.push_back(detail::Get_Type_Info<Boxed_Value>::get()); types.push_back(chaiscript::detail::Get_Type_Info<Boxed_Value>::get());
if (arity >= 0) if (arity >= 0)
{ {
for (int i = 0; i < arity; ++i) for (int i = 0; i < arity; ++i)
{ {
types.push_back(detail::Get_Type_Info<Boxed_Value>::get()); types.push_back(chaiscript::detail::Get_Type_Info<Boxed_Value>::get());
} }
} }
@@ -371,7 +371,7 @@ namespace chaiscript
while (!(parg == params.end() && barg == m_args.end())) while (!(parg == params.end() && barg == m_args.end()))
{ {
while (barg != m_args.end() while (barg != m_args.end()
&& !(barg->get_type_info() == detail::Get_Type_Info<Placeholder_Object>::get())) && !(barg->get_type_info() == chaiscript::detail::Get_Type_Info<Placeholder_Object>::get()))
{ {
args.push_back(*barg); args.push_back(*barg);
++barg; ++barg;
@@ -384,7 +384,7 @@ namespace chaiscript
} }
if (barg != m_args.end() if (barg != m_args.end()
&& barg->get_type_info() == detail::Get_Type_Info<Placeholder_Object>::get()) && barg->get_type_info() == chaiscript::detail::Get_Type_Info<Placeholder_Object>::get())
{ {
++barg; ++barg;
} }
@@ -416,7 +416,7 @@ namespace chaiscript
retval.push_back(types[0]); retval.push_back(types[0]);
for (size_t i = 0; i < types.size()-1; ++i) for (size_t i = 0; i < types.size()-1; ++i)
{ {
if (t_args[i].get_type_info() == detail::Get_Type_Info<Placeholder_Object>::get()) if (t_args[i].get_type_info() == chaiscript::detail::Get_Type_Info<Placeholder_Object>::get())
{ {
retval.push_back(types[i+1]); retval.push_back(types[i+1]);
} }

View File

@@ -6,7 +6,7 @@
#include <boost/preprocessor.hpp> #include <boost/preprocessor.hpp>
#define gettypeinfo(z,n,text) ti.push_back(detail::Get_Type_Info<Param ## n>::get()); #define gettypeinfo(z,n,text) ti.push_back(chaiscript::detail::Get_Type_Info<Param ## n>::get());
#define casthelper(z,n,text) BOOST_PP_COMMA_IF(n) chaiscript::boxed_cast< Param ## n >(params[n]) #define casthelper(z,n,text) BOOST_PP_COMMA_IF(n) chaiscript::boxed_cast< Param ## n >(params[n])
#define trycast(z,n,text) chaiscript::boxed_cast<Param ## n>(params[n]); #define trycast(z,n,text) chaiscript::boxed_cast<Param ## n>(params[n]);
@@ -62,6 +62,8 @@ namespace chaiscript
namespace chaiscript namespace chaiscript
{ {
namespace dispatch
{
namespace detail namespace detail
{ {
/** /**
@@ -72,7 +74,7 @@ namespace chaiscript
std::vector<Type_Info> build_param_type_list(Ret (*)(BOOST_PP_ENUM_PARAMS(n, Param))) std::vector<Type_Info> build_param_type_list(Ret (*)(BOOST_PP_ENUM_PARAMS(n, Param)))
{ {
std::vector<Type_Info> ti; std::vector<Type_Info> ti;
ti.push_back(detail::Get_Type_Info<Ret>::get()); ti.push_back(chaiscript::detail::Get_Type_Info<Ret>::get());
BOOST_PP_REPEAT(n, gettypeinfo, ~) BOOST_PP_REPEAT(n, gettypeinfo, ~)
@@ -115,6 +117,7 @@ namespace chaiscript
return true; return true;
} }
} }
}
} }
#undef n #undef n
@@ -126,6 +129,8 @@ namespace chaiscript
namespace chaiscript namespace chaiscript
{ {
namespace dispatch
{
namespace detail namespace detail
{ {
template<typename Ret> template<typename Ret>
@@ -134,7 +139,7 @@ namespace chaiscript
template<typename Fun> template<typename Fun>
static Boxed_Value go(const boost::function<Fun> &fun, const std::vector<Boxed_Value> &params) static Boxed_Value go(const boost::function<Fun> &fun, const std::vector<Boxed_Value> &params)
{ {
return Handle_Return<Ret>::handle(chaiscript::detail::call_func(fun, params)); return Handle_Return<Ret>::handle(call_func(fun, params));
} }
}; };
@@ -144,11 +149,12 @@ namespace chaiscript
template<typename Fun> template<typename Fun>
static Boxed_Value go(const boost::function<Fun> &fun, const std::vector<Boxed_Value> &params) static Boxed_Value go(const boost::function<Fun> &fun, const std::vector<Boxed_Value> &params)
{ {
chaiscript::detail::call_func(fun, params); call_func(fun, params);
return Handle_Return<void>::handle(); return Handle_Return<void>::handle();
} }
}; };
} }
}
} }
#endif #endif

View File

@@ -163,6 +163,11 @@ namespace chaiscript
{ {
throw std::runtime_error("Undispatched ast_node (internal error)"); throw std::runtime_error("Undispatched ast_node (internal error)");
} }
private:
// Copy and assignment explicitly unimplemented
AST_Node(const AST_Node &);
AST_Node& operator=(const AST_Node &);
}; };
@@ -203,6 +208,10 @@ namespace chaiscript
private: private:
// explicitly unimplemented copy and assignment
Scope_Push_Pop(const Scope_Push_Pop &);
Scope_Push_Pop& operator=(const Scope_Push_Pop &);
chaiscript::detail::Dispatch_Engine &m_de; chaiscript::detail::Dispatch_Engine &m_de;
}; };

View File

@@ -70,7 +70,7 @@ namespace chaiscript
public: public:
Int_AST_Node(const std::string &t_ast_node_text = "", int t_id = AST_Node_Type::Int, const boost::shared_ptr<std::string> &t_fname=boost::shared_ptr<std::string>(), int t_start_line = 0, int t_start_col = 0, int t_end_line = 0, int t_end_col = 0) : Int_AST_Node(const std::string &t_ast_node_text = "", int t_id = AST_Node_Type::Int, const boost::shared_ptr<std::string> &t_fname=boost::shared_ptr<std::string>(), int t_start_line = 0, int t_start_col = 0, int t_end_line = 0, int t_end_col = 0) :
AST_Node(t_ast_node_text, t_id, t_fname, t_start_line, t_start_col, t_end_line, t_end_col), AST_Node(t_ast_node_text, t_id, t_fname, t_start_line, t_start_col, t_end_line, t_end_col),
m_value(const_var(int(atoi(this->text.c_str())))) { } m_value(const_var(int(atoi(t_ast_node_text.c_str())))) { }
virtual ~Int_AST_Node() {} virtual ~Int_AST_Node() {}
virtual Boxed_Value eval_internal(chaiscript::detail::Dispatch_Engine &){ virtual Boxed_Value eval_internal(chaiscript::detail::Dispatch_Engine &){
return m_value; return m_value;
@@ -85,7 +85,7 @@ namespace chaiscript
public: public:
Float_AST_Node(const std::string &t_ast_node_text = "", int t_id = AST_Node_Type::Float, const boost::shared_ptr<std::string> &t_fname=boost::shared_ptr<std::string>(), int t_start_line = 0, int t_start_col = 0, int t_end_line = 0, int t_end_col = 0) : Float_AST_Node(const std::string &t_ast_node_text = "", int t_id = AST_Node_Type::Float, const boost::shared_ptr<std::string> &t_fname=boost::shared_ptr<std::string>(), int t_start_line = 0, int t_start_col = 0, int t_end_line = 0, int t_end_col = 0) :
AST_Node(t_ast_node_text, t_id, t_fname, t_start_line, t_start_col, t_end_line, t_end_col), AST_Node(t_ast_node_text, t_id, t_fname, t_start_line, t_start_col, t_end_line, t_end_col),
m_value(const_var(double(atof(this->text.c_str())))) { } m_value(const_var(double(atof(t_ast_node_text.c_str())))) { }
virtual ~Float_AST_Node() {} virtual ~Float_AST_Node() {}
virtual Boxed_Value eval_internal(chaiscript::detail::Dispatch_Engine &){ virtual Boxed_Value eval_internal(chaiscript::detail::Dispatch_Engine &){
return m_value; return m_value;
@@ -200,7 +200,7 @@ namespace chaiscript
throw; throw;
} }
} }
catch(exception::eval_error &ee) { catch(exception::eval_error &) {
t_ss.set_stack(prev_stack); t_ss.set_stack(prev_stack);
throw; throw;
} }
@@ -438,7 +438,7 @@ namespace chaiscript
public: public:
Quoted_String_AST_Node(const std::string &t_ast_node_text = "", int t_id = AST_Node_Type::Quoted_String, const boost::shared_ptr<std::string> &t_fname=boost::shared_ptr<std::string>(), int t_start_line = 0, int t_start_col = 0, int t_end_line = 0, int t_end_col = 0) : Quoted_String_AST_Node(const std::string &t_ast_node_text = "", int t_id = AST_Node_Type::Quoted_String, const boost::shared_ptr<std::string> &t_fname=boost::shared_ptr<std::string>(), int t_start_line = 0, int t_start_col = 0, int t_end_line = 0, int t_end_col = 0) :
AST_Node(t_ast_node_text, t_id, t_fname, t_start_line, t_start_col, t_end_line, t_end_col), AST_Node(t_ast_node_text, t_id, t_fname, t_start_line, t_start_col, t_end_line, t_end_col),
m_value(const_var(this->text)) { } m_value(const_var(t_ast_node_text)) { }
virtual ~Quoted_String_AST_Node() {} virtual ~Quoted_String_AST_Node() {}
virtual Boxed_Value eval_internal(chaiscript::detail::Dispatch_Engine &) { virtual Boxed_Value eval_internal(chaiscript::detail::Dispatch_Engine &) {
return m_value; return m_value;
@@ -453,7 +453,7 @@ namespace chaiscript
public: public:
Single_Quoted_String_AST_Node(const std::string &t_ast_node_text = "", int t_id = AST_Node_Type::Single_Quoted_String, const boost::shared_ptr<std::string> &t_fname=boost::shared_ptr<std::string>(), int t_start_line = 0, int t_start_col = 0, int t_end_line = 0, int t_end_col = 0) : Single_Quoted_String_AST_Node(const std::string &t_ast_node_text = "", int t_id = AST_Node_Type::Single_Quoted_String, const boost::shared_ptr<std::string> &t_fname=boost::shared_ptr<std::string>(), int t_start_line = 0, int t_start_col = 0, int t_end_line = 0, int t_end_col = 0) :
AST_Node(t_ast_node_text, t_id, t_fname, t_start_line, t_start_col, t_end_line, t_end_col), AST_Node(t_ast_node_text, t_id, t_fname, t_start_line, t_start_col, t_end_line, t_end_col),
m_value(const_var(char(this->text[0]))) { } m_value(const_var(char(t_ast_node_text.at(0)))) { }
virtual ~Single_Quoted_String_AST_Node() {} virtual ~Single_Quoted_String_AST_Node() {}
virtual Boxed_Value eval_internal(chaiscript::detail::Dispatch_Engine &){ virtual Boxed_Value eval_internal(chaiscript::detail::Dispatch_Engine &){
return m_value; return m_value;
@@ -850,7 +850,7 @@ namespace chaiscript
try { try {
retval = this->children[0]->eval(t_ss); retval = this->children[0]->eval(t_ss);
} }
catch (exception::eval_error &ee) { catch (exception::eval_error &) {
if (this->children.back()->identifier == AST_Node_Type::Finally) { if (this->children.back()->identifier == AST_Node_Type::Finally) {
this->children.back()->children[0]->eval(t_ss); this->children.back()->children[0]->eval(t_ss);
} }