add example.cpp to build for VC++, fix minor bug in passing of & parameters to functor<>, move bootstrap functions into bootstrap namespace and clean up function names and add "retro" support for reversing of ranges.
This commit is contained in:
@@ -12,6 +12,8 @@
|
||||
|
||||
namespace chaiscript
|
||||
{
|
||||
namespace bootstrap
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
/**
|
||||
@@ -215,7 +217,7 @@ namespace chaiscript
|
||||
* Add canonical form of "=" for type T
|
||||
*/
|
||||
template<typename T>
|
||||
ModulePtr add_oper_equals(ModulePtr m = ModulePtr(new Module()))
|
||||
ModulePtr oper_equals(ModulePtr m = ModulePtr(new Module()))
|
||||
{
|
||||
m->add(fun(&detail::equals<const T&, const T&>), "=");
|
||||
return m;
|
||||
@@ -225,7 +227,7 @@ namespace chaiscript
|
||||
* Add canonical form of "+" for type T
|
||||
*/
|
||||
template<typename T>
|
||||
ModulePtr add_oper_add(ModulePtr m = ModulePtr(new Module()))
|
||||
ModulePtr oper_add(ModulePtr m = ModulePtr(new Module()))
|
||||
{
|
||||
m->add(fun(&detail::add<T, const T&, const T&>), "+");
|
||||
return m;
|
||||
@@ -235,7 +237,7 @@ namespace chaiscript
|
||||
* Add canonical form of "+=" for type T
|
||||
*/
|
||||
template<typename T>
|
||||
ModulePtr add_oper_add_equals(ModulePtr m = ModulePtr(new Module()))
|
||||
ModulePtr oper_add_equals(ModulePtr m = ModulePtr(new Module()))
|
||||
{
|
||||
m->add(fun(&detail::addsequal<T, T>), "+=");
|
||||
return m;
|
||||
@@ -245,7 +247,7 @@ namespace chaiscript
|
||||
* Add canonical form of "-" for type T
|
||||
*/
|
||||
template<typename T>
|
||||
ModulePtr add_oper_subtract(ModulePtr m = ModulePtr(new Module()))
|
||||
ModulePtr oper_subtract(ModulePtr m = ModulePtr(new Module()))
|
||||
{
|
||||
m->add(fun(&detail::subtract<T, const T&, const T&>), "-");
|
||||
return m;
|
||||
@@ -255,7 +257,7 @@ namespace chaiscript
|
||||
* Add canonical form of "/" for type T
|
||||
*/
|
||||
template<typename T>
|
||||
ModulePtr add_oper_divide(ModulePtr m = ModulePtr(new Module()))
|
||||
ModulePtr oper_divide(ModulePtr m = ModulePtr(new Module()))
|
||||
{
|
||||
m->add(fun(&detail::divide<T, const T&, const T&>), "/");
|
||||
return m;
|
||||
@@ -265,7 +267,7 @@ namespace chaiscript
|
||||
* Add canonical form of "*" for type T
|
||||
*/
|
||||
template<typename T>
|
||||
ModulePtr add_oper_multiply(ModulePtr m = ModulePtr(new Module()))
|
||||
ModulePtr oper_multiply(ModulePtr m = ModulePtr(new Module()))
|
||||
{
|
||||
m->add(fun(&detail::multiply<T, const T&, const T&>), "*");
|
||||
return m;
|
||||
@@ -275,7 +277,7 @@ namespace chaiscript
|
||||
* Add canonical form of "!=" for type T
|
||||
*/
|
||||
template<typename T>
|
||||
ModulePtr add_oper_not_equals(ModulePtr m = ModulePtr(new Module()))
|
||||
ModulePtr oper_not_equals(ModulePtr m = ModulePtr(new Module()))
|
||||
{
|
||||
m->add(fun(&detail::not_equals<const T&, const T&>), "!=");
|
||||
return m;
|
||||
@@ -285,7 +287,7 @@ namespace chaiscript
|
||||
* Add user defined assignment operator for T = U
|
||||
*/
|
||||
template<typename T, typename U>
|
||||
ModulePtr add_oper_assign_overload(ModulePtr m = ModulePtr(new Module()))
|
||||
ModulePtr oper_assign_overload(ModulePtr m = ModulePtr(new Module()))
|
||||
{
|
||||
m->add(fun(&detail::assign<T,U>), "=");
|
||||
return m;
|
||||
@@ -296,7 +298,7 @@ namespace chaiscript
|
||||
* Add canonical form of "=" for type T
|
||||
*/
|
||||
template<typename T>
|
||||
ModulePtr add_oper_assign(ModulePtr m = ModulePtr(new Module()))
|
||||
ModulePtr oper_assign(ModulePtr m = ModulePtr(new Module()))
|
||||
{
|
||||
m->add(fun(&detail::assign<T,T>), "=");
|
||||
return m;
|
||||
@@ -307,7 +309,7 @@ namespace chaiscript
|
||||
* Add assignment operator for T = POD.
|
||||
*/
|
||||
template<typename T>
|
||||
ModulePtr add_oper_assign_pod(ModulePtr m = ModulePtr(new Module()))
|
||||
ModulePtr oper_assign_pod(ModulePtr m = ModulePtr(new Module()))
|
||||
{
|
||||
m->add(fun(&detail::assign_pod<T>), "=");
|
||||
return m;
|
||||
@@ -318,7 +320,7 @@ namespace chaiscript
|
||||
* Add canonical form of "<" for type T
|
||||
*/
|
||||
template<typename T>
|
||||
ModulePtr add_oper_less_than(ModulePtr m = ModulePtr(new Module()))
|
||||
ModulePtr oper_less_than(ModulePtr m = ModulePtr(new Module()))
|
||||
{
|
||||
m->add(fun(&detail::less_than<const T&, const T&>), "<");
|
||||
return m;
|
||||
@@ -328,7 +330,7 @@ namespace chaiscript
|
||||
* Add canonical form of ">" for type T
|
||||
*/
|
||||
template<typename T>
|
||||
ModulePtr add_oper_greater_than(ModulePtr m = ModulePtr(new Module()))
|
||||
ModulePtr oper_greater_than(ModulePtr m = ModulePtr(new Module()))
|
||||
{
|
||||
m->add(fun(&detail::greater_than<const T&, const T&>), ">");
|
||||
return m;
|
||||
@@ -338,7 +340,7 @@ namespace chaiscript
|
||||
* Add canonical form of "<=" for type T
|
||||
*/
|
||||
template<typename T>
|
||||
ModulePtr add_oper_less_than_equals(ModulePtr m = ModulePtr(new Module()))
|
||||
ModulePtr oper_less_than_equals(ModulePtr m = ModulePtr(new Module()))
|
||||
{
|
||||
m->add(fun(&detail::less_than_equals<const T&, const T&>), "<=");
|
||||
return m;
|
||||
@@ -348,7 +350,7 @@ namespace chaiscript
|
||||
* Add canonical form of ">=" for type T
|
||||
*/
|
||||
template<typename T>
|
||||
ModulePtr add_oper_greater_than_equals(ModulePtr m = ModulePtr(new Module()))
|
||||
ModulePtr oper_greater_than_equals(ModulePtr m = ModulePtr(new Module()))
|
||||
{
|
||||
m->add(fun(&detail::greater_than_equals<const T&, const T&>), ">=");
|
||||
return m;
|
||||
@@ -359,7 +361,7 @@ namespace chaiscript
|
||||
* Examples: T < R, T == R, etc.
|
||||
*/
|
||||
template<typename T, typename R>
|
||||
ModulePtr add_opers_comparison_overload(ModulePtr m = ModulePtr(new Module()))
|
||||
ModulePtr opers_comparison_overload(ModulePtr m = ModulePtr(new Module()))
|
||||
{
|
||||
m->add(fun(&detail::equals<const T&, const R&>), "==");
|
||||
m->add(fun(&detail::not_equals<const T&, const R&>), "!=");
|
||||
@@ -374,9 +376,9 @@ namespace chaiscript
|
||||
* Add canonical forms of all comparison operators for type T
|
||||
*/
|
||||
template<typename T>
|
||||
ModulePtr add_opers_comparison(ModulePtr m = ModulePtr(new Module()))
|
||||
ModulePtr opers_comparison(ModulePtr m = ModulePtr(new Module()))
|
||||
{
|
||||
add_opers_comparison_overload<T, T>(m);
|
||||
opers_comparison_overload<T, T>(m);
|
||||
return m;
|
||||
}
|
||||
|
||||
@@ -388,7 +390,7 @@ namespace chaiscript
|
||||
* T *= R;
|
||||
*/
|
||||
template<typename Ret, typename T, typename R>
|
||||
ModulePtr add_opers_arithmetic_overload(ModulePtr m = ModulePtr(new Module()))
|
||||
ModulePtr opers_arithmetic_overload(ModulePtr m = ModulePtr(new Module()))
|
||||
{
|
||||
m->add(fun(&detail::add<Ret, T, R>), "+");
|
||||
m->add(fun(&detail::subtract<Ret, T, R>), "-");
|
||||
@@ -410,7 +412,7 @@ namespace chaiscript
|
||||
* example: POD *= T, POD /= T
|
||||
*/
|
||||
template<typename T>
|
||||
ModulePtr add_opers_arithmetic_modify_pod(ModulePtr m = ModulePtr(new Module()))
|
||||
ModulePtr opers_arithmetic_modify_pod(ModulePtr m = ModulePtr(new Module()))
|
||||
{
|
||||
m->add(fun(&detail::timesequal_pod<T>), "*=");
|
||||
m->add(fun(&detail::dividesequal_pod<T>), "/=");
|
||||
@@ -425,7 +427,7 @@ namespace chaiscript
|
||||
* the copy constructor.
|
||||
*/
|
||||
template<typename T>
|
||||
ModulePtr add_copy_constructor(const std::string &type, ModulePtr m = ModulePtr(new Module()))
|
||||
ModulePtr copy_constructor(const std::string &type, ModulePtr m = ModulePtr(new Module()))
|
||||
{
|
||||
m->add(constructor<T (const T &)>(), type);
|
||||
m->add(constructor<T (const T &)>(), "clone");
|
||||
@@ -436,10 +438,10 @@ namespace chaiscript
|
||||
* Add default and copy constructors (including "clone") for type T
|
||||
*/
|
||||
template<typename T>
|
||||
ModulePtr add_basic_constructors(const std::string &type, ModulePtr m = ModulePtr(new Module()))
|
||||
ModulePtr basic_constructors(const std::string &type, ModulePtr m = ModulePtr(new Module()))
|
||||
{
|
||||
m->add(constructor<T ()>(), type);
|
||||
add_copy_constructor<T>(type, m);
|
||||
copy_constructor<T>(type, m);
|
||||
return m;
|
||||
}
|
||||
|
||||
@@ -447,7 +449,7 @@ namespace chaiscript
|
||||
* Add POD type constructor for type T. ie: T = type(POD)
|
||||
*/
|
||||
template<typename T>
|
||||
ModulePtr add_construct_pod(const std::string &type, ModulePtr m = ModulePtr(new Module()))
|
||||
ModulePtr construct_pod(const std::string &type, ModulePtr m = ModulePtr(new Module()))
|
||||
{
|
||||
m->add(fun(&detail::construct_pod<T>), type);
|
||||
return m;
|
||||
@@ -458,7 +460,7 @@ namespace chaiscript
|
||||
* T = type(const U &)
|
||||
*/
|
||||
template<typename T, typename U>
|
||||
ModulePtr add_constructor_overload(const std::string &type, ModulePtr m = ModulePtr(new Module()))
|
||||
ModulePtr constructor_overload(const std::string &type, ModulePtr m = ModulePtr(new Module()))
|
||||
{
|
||||
m->add(constructor<T (const U &)>(), type);
|
||||
return m;
|
||||
@@ -468,9 +470,9 @@ namespace chaiscript
|
||||
* Add canonical forms of all arithmetic operators for type T
|
||||
*/
|
||||
template<typename T>
|
||||
ModulePtr add_opers_arithmetic(ModulePtr m = ModulePtr(new Module()))
|
||||
ModulePtr opers_arithmetic(ModulePtr m = ModulePtr(new Module()))
|
||||
{
|
||||
add_opers_arithmetic_overload<T, T, T>(m);
|
||||
opers_arithmetic_overload<T, T, T>(m);
|
||||
return m;
|
||||
}
|
||||
|
||||
@@ -514,12 +516,12 @@ namespace chaiscript
|
||||
ModulePtr bootstrap_pod_type(const std::string &name, ModulePtr m = ModulePtr(new Module()))
|
||||
{
|
||||
m->add(user_type<T>(), name);
|
||||
add_basic_constructors<T>(name, m);
|
||||
add_oper_assign<T>(m);
|
||||
add_oper_assign_pod<T>(m);
|
||||
add_construct_pod<T>(name, m);
|
||||
add_opers_arithmetic<T>(m);
|
||||
add_opers_arithmetic_modify_pod<T>(m);
|
||||
basic_constructors<T>(name, m);
|
||||
oper_assign<T>(m);
|
||||
oper_assign_pod<T>(m);
|
||||
construct_pod<T>(name, m);
|
||||
opers_arithmetic<T>(m);
|
||||
opers_arithmetic_modify_pod<T>(m);
|
||||
m->add(fun(&to_string<T>), "to_string");
|
||||
m->add(fun(&parse_string<T>), "to_" + name);
|
||||
return m;
|
||||
@@ -584,7 +586,7 @@ namespace chaiscript
|
||||
/**
|
||||
* Add all comparison operators for POD types
|
||||
*/
|
||||
static void add_opers_comparison_pod(ModulePtr m = ModulePtr(new Module()))
|
||||
static void opers_comparison_pod(ModulePtr m = ModulePtr(new Module()))
|
||||
{
|
||||
m->add(fun(&detail::equals<Boxed_POD_Value, Boxed_POD_Value>), "==");
|
||||
m->add(fun(&detail::not_equals<Boxed_POD_Value, Boxed_POD_Value>), "!=");
|
||||
@@ -597,7 +599,7 @@ namespace chaiscript
|
||||
/**
|
||||
* Add all arithmetic operators for PODs
|
||||
*/
|
||||
static void add_opers_arithmetic_pod(ModulePtr m = ModulePtr(new Module()))
|
||||
static void opers_arithmetic_pod(ModulePtr m = ModulePtr(new Module()))
|
||||
{
|
||||
m->add(fun(&detail::add<Boxed_Value, Boxed_POD_Value, Boxed_POD_Value>), "+");
|
||||
m->add(fun(&detail::subtract<Boxed_Value, Boxed_POD_Value, Boxed_POD_Value>), "-");
|
||||
@@ -657,9 +659,9 @@ namespace chaiscript
|
||||
m->add(user_type<Boxed_POD_Value>(), "PODObject");
|
||||
m->add(user_type<Proxy_Function>(), "function");
|
||||
|
||||
add_basic_constructors<bool>("bool", m);
|
||||
add_oper_assign<std::string>(m);
|
||||
add_oper_assign<bool>(m);
|
||||
basic_constructors<bool>("bool", m);
|
||||
oper_assign<std::string>(m);
|
||||
oper_assign<bool>(m);
|
||||
|
||||
m->add(fun(&to_string<const std::string &>), "internal_to_string");
|
||||
m->add(fun(&to_string<bool>), "internal_to_string");
|
||||
@@ -671,8 +673,8 @@ namespace chaiscript
|
||||
bootstrap_pod_type<char>("char", m);
|
||||
bootstrap_pod_type<boost::int64_t>("int64_t", m);
|
||||
|
||||
add_opers_comparison_pod(m);
|
||||
add_opers_arithmetic_pod(m);
|
||||
opers_comparison_pod(m);
|
||||
opers_arithmetic_pod(m);
|
||||
|
||||
m->add(fun(&detail::modulus<int, int, int>), "%");
|
||||
|
||||
@@ -693,6 +695,7 @@ namespace chaiscript
|
||||
return m;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@@ -5,13 +5,13 @@
|
||||
// http://www.chaiscript.com
|
||||
|
||||
/**
|
||||
* This file contains utility functions for registration of STL container
|
||||
* classes. The methodology used is based on the SGI STL concepts.
|
||||
* http://www.sgi.com/tech/stl/table_of_contents.html
|
||||
*/
|
||||
* This file contains utility functions for registration of STL container
|
||||
* classes. The methodology used is based on the SGI STL concepts.
|
||||
* http://www.sgi.com/tech/stl/table_of_contents.html
|
||||
*/
|
||||
|
||||
#ifndef __stl_hpp_type
|
||||
#define __stl_hpp___type
|
||||
#ifndef __bootstrap_stl_hpp__
|
||||
#define __bootstrap_stl_hpp__
|
||||
|
||||
#include "dispatchkit.hpp"
|
||||
#include "register_function.hpp"
|
||||
@@ -19,25 +19,29 @@
|
||||
|
||||
namespace chaiscript
|
||||
{
|
||||
namespace bootstrap
|
||||
{
|
||||
/**
|
||||
* Input_Range, based on the D concept of ranges.
|
||||
* Bidir_Range, based on the D concept of ranges.
|
||||
* \todo Update the Range code to base its capabilities on
|
||||
* the user_typetraits of the iterator passed in
|
||||
*/
|
||||
template<typename Container>
|
||||
struct Input_Range
|
||||
struct Bidir_Range
|
||||
{
|
||||
Input_Range(Container &c)
|
||||
typedef typename std::iterator_traits<typename Container::iterator>::reference reference_type;
|
||||
|
||||
Bidir_Range(Container &c)
|
||||
: m_begin(c.begin()), m_end(c.end())
|
||||
{
|
||||
}
|
||||
|
||||
Input_Range(typename Container::iterator itr)
|
||||
Bidir_Range(typename Container::iterator itr)
|
||||
: m_begin(itr), m_end(itr)
|
||||
{
|
||||
}
|
||||
|
||||
Input_Range(const std::pair<typename Container::iterator, typename Container::iterator> &t_p)
|
||||
Bidir_Range(const std::pair<typename Container::iterator, typename Container::iterator> &t_p)
|
||||
: m_begin(t_p.first), m_end(t_p.second)
|
||||
{
|
||||
}
|
||||
@@ -56,7 +60,16 @@ namespace chaiscript
|
||||
++m_begin;
|
||||
}
|
||||
|
||||
typename std::iterator_traits<typename Container::iterator>::reference front() const
|
||||
void pop_back()
|
||||
{
|
||||
if (empty())
|
||||
{
|
||||
throw std::range_error("Range empty");
|
||||
}
|
||||
--m_end;
|
||||
}
|
||||
|
||||
reference_type front() const
|
||||
{
|
||||
if (empty())
|
||||
{
|
||||
@@ -65,33 +78,76 @@ namespace chaiscript
|
||||
return *m_begin;
|
||||
}
|
||||
|
||||
reference_type back() const
|
||||
{
|
||||
if (empty())
|
||||
{
|
||||
throw std::range_error("Range empty");
|
||||
}
|
||||
Container::iterator pos = m_end;
|
||||
--pos;
|
||||
return *(pos);
|
||||
}
|
||||
|
||||
typename Container::iterator m_begin;
|
||||
typename Container::iterator m_end;
|
||||
};
|
||||
|
||||
template<typename Range>
|
||||
struct Retro
|
||||
{
|
||||
Retro(const Range &r)
|
||||
: m_r(r)
|
||||
{}
|
||||
|
||||
bool empty() { return m_r.empty(); }
|
||||
void pop_front() { m_r.pop_back(); }
|
||||
void pop_back() { m_r.pop_front(); }
|
||||
typename Range::reference_type front() { return m_r.back(); }
|
||||
typename Range::reference_type back() { return m_r.front(); }
|
||||
|
||||
private:
|
||||
Range m_r;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Add Input_Range support for the given ContainerType
|
||||
* Add Bidir_Range support for the given ContainerType
|
||||
*/
|
||||
template<typename ContainerType>
|
||||
ModulePtr input_range_type(const std::string &type, ModulePtr m = ModulePtr(new Module()))
|
||||
{
|
||||
m->add(user_type<Input_Range<ContainerType> >(), type + "_Range");
|
||||
m->add(user_type<Bidir_Range<ContainerType> >(), type + "_Range");
|
||||
m->add(user_type<Retro<Bidir_Range<ContainerType> > >(), type + "_Retro_Range");
|
||||
m->add(user_type<typename ContainerType::iterator>(), type+"_Iterator");
|
||||
|
||||
m->add(constructor<Input_Range<ContainerType> (ContainerType &)>(), "range");
|
||||
m->add(constructor<Input_Range<ContainerType> (typename ContainerType::iterator)>(), "range");
|
||||
m->add(constructor<Bidir_Range<ContainerType> (ContainerType &)>(), "range");
|
||||
m->add(constructor<Bidir_Range<ContainerType> (typename ContainerType::iterator)>(), "range");
|
||||
|
||||
typedef std::pair<typename ContainerType::iterator, typename ContainerType::iterator> ItrPair;
|
||||
|
||||
m->add(constructor<Input_Range<ContainerType> (const ItrPair &)>(), "range");
|
||||
m->add(constructor<Bidir_Range<ContainerType> (const ItrPair &)>(), "range");
|
||||
|
||||
m->add(user_type<ItrPair>(), type+"_Iterator_Pair");
|
||||
|
||||
m->add(fun(&Input_Range<ContainerType>::empty), "empty");
|
||||
m->add(fun(&Input_Range<ContainerType>::pop_front), "pop_front");
|
||||
m->add(fun(&Input_Range<ContainerType>::front), "front");
|
||||
m->add(constructor<Input_Range<ContainerType> (const Input_Range<ContainerType> &)>(), "clone");
|
||||
m->add(fun(&Bidir_Range<ContainerType>::empty), "empty");
|
||||
m->add(fun(&Bidir_Range<ContainerType>::pop_front), "pop_front");
|
||||
m->add(fun(&Bidir_Range<ContainerType>::front), "front");
|
||||
m->add(fun(&Bidir_Range<ContainerType>::pop_back), "pop_back");
|
||||
m->add(fun(&Bidir_Range<ContainerType>::back), "back");
|
||||
|
||||
m->add(fun(&Retro<Bidir_Range<ContainerType> >::empty), "empty");
|
||||
m->add(fun(&Retro<Bidir_Range<ContainerType> >::pop_front), "pop_front");
|
||||
m->add(fun(&Retro<Bidir_Range<ContainerType> >::front), "front");
|
||||
m->add(fun(&Retro<Bidir_Range<ContainerType> >::pop_back), "pop_back");
|
||||
m->add(fun(&Retro<Bidir_Range<ContainerType> >::back), "back");
|
||||
|
||||
m->add(constructor<Retro<Bidir_Range<ContainerType> > (const Bidir_Range<ContainerType> &)>(), "retro");
|
||||
|
||||
|
||||
m->add(constructor<Bidir_Range<ContainerType> (const Bidir_Range<ContainerType> &)>(), "clone");
|
||||
m->add(constructor<Retro<Bidir_Range<ContainerType> > (const Retro<Bidir_Range<ContainerType> > &)>(), "clone");
|
||||
|
||||
return m;
|
||||
}
|
||||
|
||||
@@ -132,8 +188,8 @@ namespace chaiscript
|
||||
template<typename ContainerType>
|
||||
ModulePtr assignable_type(const std::string &type, ModulePtr m = ModulePtr(new Module()))
|
||||
{
|
||||
add_basic_constructors<ContainerType>(type, m);
|
||||
add_oper_assign<ContainerType>(m);
|
||||
basic_constructors<ContainerType>(type, m);
|
||||
oper_assign<ContainerType>(m);
|
||||
return m;
|
||||
}
|
||||
|
||||
@@ -389,9 +445,9 @@ namespace chaiscript
|
||||
ModulePtr string_type(const std::string &type, ModulePtr m = ModulePtr(new Module()))
|
||||
{
|
||||
m->add(user_type<String>(), type);
|
||||
add_oper_add<String>(m);
|
||||
add_oper_add_equals<String>(m);
|
||||
add_opers_comparison<String>(m);
|
||||
oper_add<String>(m);
|
||||
oper_add_equals<String>(m);
|
||||
opers_comparison<String>(m);
|
||||
random_access_container_type<String>(type, m);
|
||||
sequence_type<String>(type, m);
|
||||
typedef typename String::size_type (String::*find_func)(const String &, typename String::size_type) const;
|
||||
@@ -404,6 +460,7 @@ namespace chaiscript
|
||||
|
||||
return m;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@@ -6,7 +6,7 @@
|
||||
|
||||
#include <boost/preprocessor.hpp>
|
||||
|
||||
#define addparam(z,n,text) params.push_back(Boxed_Value(BOOST_PP_CAT(p, n) ));
|
||||
#define addparam(z,n,text) params.push_back(boost::is_reference<Param ## n>::value?Boxed_Value(boost::ref(BOOST_PP_CAT(p, n))):Boxed_Value(BOOST_PP_CAT(p, n) ));
|
||||
#define curry(z,n,text) BOOST_PP_CAT(_, BOOST_PP_INC(n))
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace chaiscript
|
||||
boost::function<FunctionType>
|
||||
functor(const std::vector<std::pair<std::string, Proxy_Function > > &funcs)
|
||||
{
|
||||
FunctionType *p;
|
||||
FunctionType *p=0;
|
||||
return build_function_caller_helper(p, funcs);
|
||||
}
|
||||
|
||||
|
@@ -140,6 +140,7 @@ namespace chaiscript
|
||||
* Builds all the requirements for ChaiScript, including its evaluator and a run of its prelude.
|
||||
*/
|
||||
void build_eval_system() {
|
||||
using namespace bootstrap;
|
||||
engine.add(Bootstrap::bootstrap());
|
||||
|
||||
engine.add(fun(boost::function<void ()>(boost::bind(&dump_system, boost::ref(engine)))), "dump_system");
|
||||
|
196
msvc/chai-example/chai-example.vcproj
Normal file
196
msvc/chai-example/chai-example.vcproj
Normal file
@@ -0,0 +1,196 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Name="chai-example"
|
||||
ProjectGUID="{CE422E94-B360-4588-8C65-6A9BE80798F9}"
|
||||
RootNamespace="chaiexample"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="196613"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="..\chaiscript\Boost.vsprops"
|
||||
CharacterSet="0"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="C:\Programming\chaiscript\trunk\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="..\chaiscript\Boost.vsprops"
|
||||
CharacterSet="0"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
EnableIntrinsicFunctions="true"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\src\example.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
||||
>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
@@ -8,4 +8,12 @@
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""C:\Programming\Boost\include\boost-1_38""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
AdditionalLibraryDirectories="C:\Programming\Boost\lib"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalLibraryDirectories="C:\Programming\Boost\lib"
|
||||
/>
|
||||
</VisualStudioPropertySheet>
|
||||
|
@@ -3,6 +3,8 @@ Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual C++ Express 2008
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "chaiscript", "chaiscript.vcproj", "{46FD9DC7-2DA9-4C17-ADE4-E3A18C46E87B}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "chai-example", "..\chai-example\chai-example.vcproj", "{CE422E94-B360-4588-8C65-6A9BE80798F9}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
@@ -13,6 +15,10 @@ Global
|
||||
{46FD9DC7-2DA9-4C17-ADE4-E3A18C46E87B}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{46FD9DC7-2DA9-4C17-ADE4-E3A18C46E87B}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{46FD9DC7-2DA9-4C17-ADE4-E3A18C46E87B}.Release|Win32.Build.0 = Release|Win32
|
||||
{CE422E94-B360-4588-8C65-6A9BE80798F9}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{CE422E94-B360-4588-8C65-6A9BE80798F9}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{CE422E94-B360-4588-8C65-6A9BE80798F9}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{CE422E94-B360-4588-8C65-6A9BE80798F9}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@@ -125,7 +125,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
//Ability to create our own container types when needed. std::vector and std::map are
|
||||
//mostly supported currently
|
||||
chai.add(vector_type<std::vector<int> >("IntVector"));
|
||||
chai.add(bootstrap::vector_type<std::vector<int> >("IntVector"));
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user