Update of /cvsroot/luabind/luabind/luabind/luabind/detail
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25897/detail
Modified Files:
call.hpp call_function.hpp call_member.hpp constructor.hpp
convert_to_lua.hpp object_funs.hpp policy.hpp property.hpp
signature_match.hpp
Log Message:
Made it work on VC6.5 again. This involves changing generate_converter
into apply.
Index: call_member.hpp
===================================================================
RCS file: /cvsroot/luabind/luabind/luabind/luabind/detail/call_member.hpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- call_member.hpp 28 Nov 2005 20:55:34 -0000 1.12
+++ call_member.hpp 4 Dec 2005 13:56:15 -0000 1.13
@@ -38,13 +38,14 @@
#include <boost/preprocessor/control/if.hpp>
#include <boost/preprocessor/facilities/expand.hpp>
+#include <boost/mpl/apply_wrap.hpp>
+
namespace luabind
{
namespace detail
{
-
-
+ namespace mpl = boost::mpl;
// if the proxy_member_caller returns non-void
template<class Ret, class Tuple>
@@ -102,7 +103,7 @@
operator Ret()
{
- typename default_policy::template generate_converter<Ret, lua_to_cpp>::type converter;
+ typename mpl::apply_wrap2<default_policy,Ret,lua_to_cpp>::type converter;
m_called = true;
@@ -155,7 +156,7 @@
Ret operator[](const Policies& p)
{
typedef typename find_conversion_policy<0, Policies>::type converter_policy;
- typename converter_policy::template generate_converter<Ret, lua_to_cpp>::type converter;
+ typename mpl::apply_wrap2<converter_policy,Ret,lua_to_cpp>::type converter;
m_called = true;
Index: convert_to_lua.hpp
===================================================================
RCS file: /cvsroot/luabind/luabind/luabind/luabind/detail/convert_to_lua.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- convert_to_lua.hpp 14 Jun 2003 21:05:02 -0000 1.2
+++ convert_to_lua.hpp 4 Dec 2005 13:56:16 -0000 1.3
@@ -28,6 +28,8 @@
#include <luabind/detail/policy.hpp>
#include <boost/ref.hpp>
+#include <boost/mpl/apply_wrap.hpp>
+
namespace luabind { namespace detail
{
template<bool IsReferenceWrapper = false>
@@ -56,11 +58,17 @@
};
};
+ namespace mpl = boost::mpl;
+
template<class T>
void convert_to_lua(lua_State* L, const T& v)
{
- typedef typename unwrap_ref<boost::is_reference_wrapper<T>::value>::template apply<T>::type value_type;
- typename default_policy::template generate_converter<value_type, cpp_to_lua>::type converter;
+ typedef typename mpl::apply_wrap1<
+ unwrap_ref<boost::is_reference_wrapper<T>::value>
+ , T
+ >::type value_type;
+
+ typename mpl::apply_wrap2<default_policy,value_type,cpp_to_lua>::type converter;
converter.apply(L, unwrap_ref<boost::is_reference_wrapper<T>::value>::get(v));
}
@@ -68,9 +76,13 @@
template<int Index, class T, class Policies>
void convert_to_lua_p(lua_State* L, const T& v, const Policies&)
{
- typedef typename unwrap_ref<boost::is_reference_wrapper<T>::value>::template apply<T>::type value_type;
+ typedef typename mpl::apply_wrap1<
+ unwrap_ref<boost::is_reference_wrapper<T>::value>
+ , T
+ >::type value_type;
+
typedef typename find_conversion_policy<Index, Policies>::type converter_policy;
- typename converter_policy::template generate_converter<value_type, cpp_to_lua>::type converter;
+ typename mpl::apply_wrap2<converter_policy,value_type,cpp_to_lua>::type converter;
converter.apply(L, unwrap_ref<boost::is_reference_wrapper<T>::value>::get(v));
}
Index: property.hpp
===================================================================
RCS file: /cvsroot/luabind/luabind/luabind/luabind/detail/property.hpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- property.hpp 28 Nov 2005 20:55:34 -0000 1.12
+++ property.hpp 4 Dec 2005 13:56:16 -0000 1.13
@@ -27,10 +27,14 @@
#include <luabind/config.hpp>
#include <boost/type_traits/add_reference.hpp>
#include <boost/mpl/eval_if.hpp>
+#include <boost/mpl/apply_wrap.hpp>
+#include <boost/mpl/identity.hpp>
#include <luabind/dependency_policy.hpp>
namespace luabind { namespace detail
{
+ namespace mpl = boost::mpl;
+
class object_rep;
/*
template<class R, class T, class Policies>
@@ -112,7 +116,7 @@
static int apply(lua_State* L, int index)
{
typedef typename find_conversion_policy<1, Policies>::type converter_policy;
- typedef typename converter_policy::template generate_converter<T, lua_to_cpp>::type converter;
+ typedef typename mpl::apply_wrap2<converter_policy,T,lua_to_cpp>::type converter;
return converter::match(L, LUABIND_DECORATE_TYPE(T), index);
}
};
@@ -156,7 +160,7 @@
T* ptr = reinterpret_cast<T*>(static_cast<char*>(raw_ptr) + pointer_offset);
typedef typename find_conversion_policy<1,Policies>::type converter_policy;
- typename converter_policy::template generate_converter<D,lua_to_cpp>::type converter;
+ typename mpl::apply_wrap2<converter_policy,D,lua_to_cpp>::type converter;
ptr->*member = converter.apply(L, LUABIND_DECORATE_TYPE(D), 3);
int nret = lua_gettop(L) - nargs;
@@ -174,8 +178,11 @@
template<class ConverterPolicy, class D>
struct make_reference_converter
{
- typedef typename ConverterPolicy::template generate_converter<
- typename boost::add_reference<D>::type, cpp_to_lua>::type type;
+ typedef typename mpl::apply_wrap2<
+ ConverterPolicy
+ , typename boost::add_reference<D>::type
+ , cpp_to_lua
+ >::type type;
};
template<class T, class D, class Policies>
@@ -204,20 +211,22 @@
T* ptr = reinterpret_cast<T*>(static_cast<char*>(raw_ptr) + pointer_offset);
typedef typename find_conversion_policy<0,Policies>::type converter_policy;
- typedef typename converter_policy::template generate_converter<D,cpp_to_lua>::type converter1_t;
+ typedef typename mpl::apply_wrap2<converter_policy,D,cpp_to_lua>::type converter1_t;
// if the converter is a valua converer, return a reference instead
typedef typename boost::mpl::eval_if<
- typename converter1_t::is_value_converter
+ BOOST_DEDUCED_TYPENAME converter1_t::is_value_converter
, make_reference_converter<converter_policy, D>
- , converter1_t>::type converter2_t;
+ , mpl::identity<converter1_t>
+ >::type converter2_t;
// If this yields a reference converter, the dependency policy
// is automatically added
typedef typename boost::mpl::if_<
- typename converter1_t::is_value_converter
+ BOOST_DEDUCED_TYPENAME converter1_t::is_value_converter
, policy_cons<dependency_policy<1, 0>, Policies>
- , Policies>::type policy_list;
+ , Policies
+ >::type policy_list;
converter2_t converter;
converter.apply(L, ptr->*member);
Index: signature_match.hpp
===================================================================
RCS file: /cvsroot/luabind/luabind/luabind/luabind/detail/signature_match.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- signature_match.hpp 28 Nov 2005 20:55:34 -0000 1.4
+++ signature_match.hpp 4 Dec 2005 13:56:16 -0000 1.5
@@ -88,10 +88,9 @@
, Policies \
>::type BOOST_PP_CAT(converter_policy, N); \
\
- typedef typename BOOST_PP_CAT(converter_policy, N) \
- ::template generate_converter< \
- BOOST_PP_CAT(A, N), lua_to_cpp \
- >::type BOOST_PP_CAT(converter, N); \
+ typedef typename mpl::apply_wrap2< \
+ BOOST_PP_CAT(converter_policy, N), BOOST_PP_CAT(A, N), lua_to_cpp \
+ >::type BOOST_PP_CAT(converter, N); \
\
int BOOST_PP_CAT(r, N) = BOOST_PP_CAT(converter, N)::match( \
L \
Index: call.hpp
===================================================================
RCS file: /cvsroot/luabind/luabind/luabind/luabind/detail/call.hpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- call.hpp 28 Nov 2005 20:55:34 -0000 1.7
+++ call.hpp 4 Dec 2005 13:56:15 -0000 1.8
@@ -36,6 +36,7 @@
#include <boost/preprocessor/punctuation/comma_if.hpp>
#include <boost/preprocessor/cat.hpp>
#include <boost/mpl/bool.hpp>
+#include <boost/mpl/apply_wrap.hpp>
#include <luabind/config.hpp>
#include <luabind/detail/policy.hpp>
@@ -48,9 +49,9 @@
n + off \
, Policies \
>::type BOOST_PP_CAT(converter_policy,n); \
- typename BOOST_PP_CAT(converter_policy,n)::template generate_converter< \
- A##n \
- , lua_to_cpp \
+\
+ typename mpl::apply_wrap2< \
+ BOOST_PP_CAT(converter_policy,n), BOOST_PP_CAT(A,n), lua_to_cpp \
>::type BOOST_PP_CAT(c,n);
#define LUABIND_ADD_INDEX(z,n,text) \
@@ -75,6 +76,9 @@
namespace luabind { namespace detail
{
+
+ namespace mpl = boost::mpl;
+
template<class Policies>
struct maybe_yield
{
@@ -141,7 +145,7 @@
pointer_converter<lua_to_cpp> self_cv;
typedef typename find_conversion_policy<0, Policies>::type converter_policy_ret;
- typename converter_policy_ret::template generate_converter<T, cpp_to_lua>::type converter_ret;
+ typename mpl::apply_wrap2<converter_policy_ret,T,cpp_to_lua>::type converter_ret;
BOOST_PP_REPEAT(BOOST_PP_ITERATION(), LUABIND_DECL, 2)
@@ -187,7 +191,7 @@
const_pointer_converter<lua_to_cpp> self_cv;
typedef typename find_conversion_policy<0, Policies>::type converter_policy_ret;
- typename converter_policy_ret::template generate_converter<T, cpp_to_lua>::type converter_ret;
+ typename mpl::apply_wrap2<converter_policy_ret,T,cpp_to_lua>::type converter_ret;
BOOST_PP_REPEAT(BOOST_PP_ITERATION(), LUABIND_DECL, 2)
@@ -227,7 +231,7 @@
{
int nargs = lua_gettop(L);
typedef typename find_conversion_policy<0, Policies>::type converter_policy_ret;
- typename converter_policy_ret::template generate_converter<T, cpp_to_lua>::type converter_ret;
+ typename mpl::apply_wrap2<converter_policy_ret,T,cpp_to_lua>::type converter_ret;
BOOST_PP_REPEAT(BOOST_PP_ITERATION(), LUABIND_DECL, 1)
converter_ret.apply(L, f
(
Index: object_funs.hpp
===================================================================
RCS file: /cvsroot/luabind/luabind/luabind/luabind/detail/object_funs.hpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- object_funs.hpp 7 Aug 2004 13:37:10 -0000 1.14
+++ object_funs.hpp 4 Dec 2005 13:56:16 -0000 1.15
@@ -32,12 +32,16 @@
#include <luabind/detail/debug.hpp>
#include <luabind/detail/stack_utils.hpp>
+#include <boost/mpl/apply_wrap.hpp>
+
namespace luabind
{
namespace detail
{
+ namespace mpl = boost::mpl;
+
template<class T, class Obj, class Policies>
inline T object_cast_impl(const Obj& obj, const Policies&)
{
@@ -58,7 +62,7 @@
LUABIND_CHECK_STACK(obj.lua_state());
typedef typename detail::find_conversion_policy<0, Policies>::type converter_policy;
- typename converter_policy::template generate_converter<T, lua_to_cpp>::type converter;
+ typename mpl::apply_wrap2<converter_policy,T,lua_to_cpp>::type converter;
obj.pushvalue();
@@ -88,7 +92,7 @@
boost::optional<T> object_cast_nothrow_impl(const Obj& obj, const Policies&)
{
typedef typename detail::find_conversion_policy<0, Policies>::type converter_policy;
- typename converter_policy::template generate_converter<T, lua_to_cpp>::type converter;
+ typename mpl::apply_wrap2<converter_policy,T,lua_to_cpp>::type converter;
if (obj.lua_state() == 0) return boost::optional<T>();
LUABIND_CHECK_STACK(obj.lua_state());
Index: constructor.hpp
===================================================================
RCS file: /cvsroot/luabind/luabind/luabind/luabind/detail/constructor.hpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- constructor.hpp 28 Nov 2005 20:55:34 -0000 1.8
+++ constructor.hpp 4 Dec 2005 13:56:16 -0000 1.9
@@ -33,6 +33,8 @@
#include <boost/preprocessor/repeat.hpp>
#include <boost/preprocessor/comma_if.hpp>
+#include <boost/mpl/apply_wrap.hpp>
+
#include <luabind/config.hpp>
#include <luabind/wrapper_base.hpp>
#include <luabind/detail/policy.hpp>
@@ -46,6 +48,8 @@
template<int N>
struct constructor_helper;
+ namespace mpl = boost::mpl;
+
template<int N>
struct wrapped_constructor_helper;
@@ -93,10 +97,15 @@
#elif BOOST_PP_ITERATION_FLAGS() == 1
-#define LUABIND_DECL(z, n, text) typedef typename find_conversion_policy<n+1,Policies>::type BOOST_PP_CAT(converter_policy,n); \
- typedef typename BOOST_PP_CAT(converter_policy,n)::template generate_converter<A##n, lua_to_cpp>::type BOOST_PP_CAT(c_t,n); \
- typename BOOST_PP_CAT(converter_policy,n)::template generate_converter<A##n, lua_to_cpp>::type BOOST_PP_CAT(c,n);
-#define LUABIND_PARAM(z,n,text) BOOST_PP_CAT(c,n).BOOST_PP_CAT(c_t,n)::apply(L, LUABIND_DECORATE_TYPE(A##n), n + 2)
+#define LUABIND_DECL(z, n, text) \
+ typedef typename find_conversion_policy<n+1,Policies>::type BOOST_PP_CAT(converter_policy,n); \
+\
+ typename mpl::apply_wrap2< \
+ BOOST_PP_CAT(converter_policy,n), BOOST_PP_CAT(A,n), lua_to_cpp \
+ >::type BOOST_PP_CAT(c,n);
+
+#define LUABIND_PARAM(z,n,text) \
+ BOOST_PP_CAT(c,n).apply(L, LUABIND_DECORATE_TYPE(BOOST_PP_CAT(A,n)), n + 2)
template<>
struct constructor_helper<BOOST_PP_ITERATION()>
Index: call_function.hpp
===================================================================
RCS file: /cvsroot/luabind/luabind/luabind/luabind/detail/call_function.hpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- call_function.hpp 28 Nov 2005 20:55:34 -0000 1.14
+++ call_function.hpp 4 Dec 2005 13:56:15 -0000 1.15
@@ -111,7 +111,7 @@
operator Ret()
{
- typename default_policy::template generate_converter<Ret, lua_to_cpp>::type converter;
+ typename mpl::apply_wrap2<default_policy,Ret,lua_to_cpp>::type converter;
m_called = true;
lua_State* L = m_state;
@@ -161,7 +161,7 @@
Ret operator[](const Policies& p)
{
typedef typename detail::find_conversion_policy<0, Policies>::type converter_policy;
- typename converter_policy::template generate_converter<Ret, lua_to_cpp>::type converter;
+ typename mpl::apply_wrap2<converter_policy,Ret,lua_to_cpp>::type converter;
m_called = true;
lua_State* L = m_state;
Index: policy.hpp
===================================================================
RCS file: /cvsroot/luabind/luabind/luabind/luabind/detail/policy.hpp,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -d -r1.51 -r1.52
--- policy.hpp 28 Nov 2005 20:55:34 -0000 1.51
+++ policy.hpp 4 Dec 2005 13:56:16 -0000 1.52
@@ -42,6 +42,7 @@
#include <boost/bind/arg.hpp>
#include <boost/limits.hpp>
#include <boost/tuple/tuple.hpp>
+#include <boost/version.hpp>
#include <luabind/detail/class_registry.hpp>
#include <luabind/detail/primitives.hpp>
@@ -1126,7 +1127,7 @@
static void precall(lua_State*, T, int) {}
template<class T, class Direction>
- struct generate_converter
+ struct apply
: eval_if<
is_user_defined<T>
, user_defined_converter<Direction>
@@ -1293,10 +1294,28 @@
}} // namespace luabind::detail
-namespace luabind { namespace
+namespace luabind { namespace
{
- LUABIND_ANONYMOUS_FIX boost::arg<0> return_value;
- LUABIND_ANONYMOUS_FIX boost::arg<0> result;
+#if defined(__BORLANDC__) || (BOOST_VERSION < 103400 && defined(__GNUC__))
+ static inline boost::arg<0> return_value()
+ {
+ return boost::arg<0>();
+ }
+
+ static inline boost::arg<0> result()
+ {
+ return boost::arg<0>();
+ }
+# define LUABIND_PLACEHOLDER_ARG(N) boost::arg<N>(*)()
+#elif defined(BOOST_MSVC) || defined(__MWERKS__)
+ static boost::arg<0> return_value;
+ static boost::arg<0> result;
+# define LUABIND_PLACEHOLDER_ARG(N) boost::arg<N>
+#else
+ boost::arg<0> return_value;
+ boost::arg<0> result;
+# define LUABIND_PLACEHOLDER_ARG(N) boost::arg<N>
+#endif
}}
#endif // LUABIND_POLICY_HPP_INCLUDED
|