Update of /cvsroot/luabind/luabind/luabind/luabind
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15879/luabind/luabind
Modified Files:
adopt_policy.hpp back_reference.hpp back_reference_fwd.hpp
class.hpp class_info.hpp config.hpp dependency_policy.hpp
iterator_policy.hpp luabind.hpp object.hpp scope.hpp
wrapper_base.hpp
Added Files:
from_stack.hpp get_pointer.hpp handle.hpp value_wrapper.hpp
Removed Files:
functor.hpp
Log Message:
merged in changes from beta7-devel2 (tag: beta7-devel2-merge)
Index: object.hpp
===================================================================
RCS file: /cvsroot/luabind/luabind/luabind/luabind/object.hpp,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- object.hpp 7 Aug 2004 13:37:10 -0000 1.34
+++ object.hpp 28 Nov 2005 20:55:34 -0000 1.35
@@ -1,4 +1,4 @@
-// Copyright (c) 2003 Daniel Wallin and Arvid Norberg
+// Copyright (c) 2005 Daniel Wallin and Arvid Norberg
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
@@ -20,1481 +20,1045 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
// OR OTHER DEALINGS IN THE SOFTWARE.
-#if !BOOST_PP_IS_ITERATING
-
[...2311 lines suppressed...]
- template<BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), class A)>
-#endif
- detail::proxy_caller<boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> >
- operator()(BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_OPERATOR_PARAMS, _)) const
- {
- typedef boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> tuple_t;
-#if BOOST_PP_ITERATION() == 0
- tuple_t args;
-#else
- tuple_t args(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), &a));
-#endif
- return detail::proxy_caller<tuple_t>(const_cast<luabind::object*>(this), args);
- }
+} // namespace luabind
-#undef LUABIND_OPERATOR_PARAMS
-#undef LUABIND_TUPLE_PARAMS
+#endif // LUABIND_OBJECT_050419_HPP
-#endif
Index: config.hpp
===================================================================
RCS file: /cvsroot/luabind/luabind/luabind/luabind/config.hpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- config.hpp 7 Aug 2004 13:37:10 -0000 1.10
+++ config.hpp 28 Nov 2005 20:55:34 -0000 1.11
@@ -129,6 +129,10 @@
// you can set LUABIND_EXPORT to __declspec(dllexport)
// and LUABIND_IMPORT to __declspec(dllimport)
+#if _GNUC_ >= 4
+#define LUABIND_API __attribute__ ((visibility("default")))
+#else
+
// this define is set if we're currently building a luabind file
// select import or export depending on it
#ifdef LUABIND_BUILDING
@@ -145,5 +149,7 @@
#endif
#endif
+#endif
+
#endif // LUABIND_CONFIG_HPP_INCLUDED
Index: dependency_policy.hpp
===================================================================
RCS file: /cvsroot/luabind/luabind/luabind/luabind/dependency_policy.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- dependency_policy.hpp 29 Aug 2003 10:55:40 -0000 1.5
+++ dependency_policy.hpp 28 Nov 2005 20:55:34 -0000 1.6
@@ -73,12 +73,22 @@
}
template<class A, class B>
- detail::policy_cons<detail::dependency_policy<detail::get_index_workaround<A>::value, detail::get_index_workaround<B>::value>, detail::null_type> dependency(A,B) { return detail::policy_cons<detail::dependency_policy<detail::get_index_workaround<A>::value, detail::get_index_workaround<B>::value>, detail::null_type>(); }
+ detail::policy_cons<detail::dependency_policy<detail::get_index_workaround<A>::value
+ , detail::get_index_workaround<B>::value>, detail::null_type> dependency(A,B)
+ {
+ return detail::policy_cons<detail::dependency_policy<
+ detail::get_index_workaround<A>::value, detail::get_index_workaround<B>::value>
+ , detail::null_type>();
+ }
template<class A>
- detail::policy_cons<detail::dependency_policy<0, detail::get_index_workaround<A>::value>, detail::null_type>
+ detail::policy_cons<detail::dependency_policy<0
+ , detail::get_index_workaround<A>::value>, detail::null_type>
return_internal_reference(A)
- { return detail::policy_cons<detail::dependency_policy<0, detail::get_index_workaround<A>::value>, detail::null_type>(); }
+ {
+ return detail::policy_cons<detail::dependency_policy<0
+ , detail::get_index_workaround<A>::value>, detail::null_type>();
+ }
}
#else
--- functor.hpp DELETED ---
Index: wrapper_base.hpp
===================================================================
RCS file: /cvsroot/luabind/luabind/luabind/luabind/wrapper_base.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- wrapper_base.hpp 7 Aug 2004 13:37:10 -0000 1.2
+++ wrapper_base.hpp 28 Nov 2005 20:55:34 -0000 1.3
@@ -96,7 +96,7 @@
typename boost::mpl::if_<boost::is_void<R>
, luabind::detail::proxy_member_void_caller<boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> >
, luabind::detail::proxy_member_caller<R, boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> > >::type
- call(char const* name BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_OPERATOR_PARAMS, _), detail::type<R>* = 0) const
+ call(char const* name BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_OPERATOR_PARAMS, _), detail::type_<R>* = 0) const
{
typedef boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> tuple_t;
#if BOOST_PP_ITERATION() == 0
@@ -164,13 +164,13 @@
wrap_base const* self
, char const* fn
BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(N, A, &a)
- , detail::type<R>* = 0
+ , detail::type_<R>* = 0
)
{
return self->call(
fn
BOOST_PP_ENUM_TRAILING_PARAMS(N, a)
- , (detail::type<R>*)0
+ , (detail::type_<R>*)0
);
}
Index: back_reference.hpp
===================================================================
RCS file: /cvsroot/luabind/luabind/luabind/luabind/back_reference.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- back_reference.hpp 7 Aug 2004 13:37:10 -0000 1.2
+++ back_reference.hpp 28 Nov 2005 20:55:34 -0000 1.3
@@ -20,175 +20,93 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
// OR OTHER DEALINGS IN THE SOFTWARE.
-#ifndef BACK_REFERENCE_040510_HPP
-#define BACK_REFERENCE_040510_HPP
+#ifndef LUABIND_BACK_REFERENCE_040510_HPP
+#define LUABIND_BACK_REFERENCE_040510_HPP
#include <luabind/lua_include.hpp>
#include <luabind/wrapper_base.hpp>
+#include <luabind/detail/has_get_pointer.hpp>
+#include <luabind/get_pointer.hpp>
#include <boost/type_traits/is_polymorphic.hpp>
+#include <boost/type_traits/is_const.hpp>
#include <boost/mpl/if.hpp>
namespace luabind {
-#if !(defined(BOOST_MSVC) && BOOST_MSVC <= 1300)
- template<class T>
- T* get_pointer(T& ref)
- {
- return &ref;
- }
-
- namespace detail {
-#else
- namespace detail {
-
- struct no_overload_tag {};
-
- } // namespace detail
-
- detail::no_overload_tag get_pointer(...);
-
- namespace detail {
-
- typedef char(&yes_overload)[1];
- typedef char(&no_overload)[2];
-
- no_overload check_overload(no_overload_tag);
- template<class T>
- yes_overload check_overload(T const&);
-
-#endif
-
- template<class T>
- struct extract_wrap_base
- {
-# if defined(BOOST_MSVC) && BOOST_MSVC <= 1300
- BOOST_STATIC_CONSTANT(bool,
- value = sizeof(check_overload(get_pointer(*(T*)0)))
- == sizeof(yes_overload)
- );
-
- static wrap_base const* extract(T const* ptr)
- {
- return extract_impl(ptr, boost::mpl::bool_<value>());
- }
-
- static wrap_base const* extract_impl(T const* ptr, boost::mpl::true_)
- {
- return dynamic_cast<wrap_base const*>(
- get_pointer(*ptr));
- }
-
- static wrap_base const* extract_impl(T const* ptr, boost::mpl::false_)
- {
- return dynamic_cast<wrap_base const*>(ptr);
- }
-
- static wrap_base* extract(T* ptr)
- {
- return extract_impl(ptr, boost::mpl::bool_<value>());
- }
-
- static wrap_base* extract_impl(T* ptr, boost::mpl::true_)
- {
- return dynamic_cast<wrap_base*>(
- get_pointer(*ptr));
- }
-
- static wrap_base* extract_impl(T* ptr, boost::mpl::false_)
- {
- return dynamic_cast<wrap_base*>(ptr);
- }
-# else
- static wrap_base const* extract(T const* ptr)
- {
- return dynamic_cast<wrap_base const*>(get_pointer(*ptr));
- }
-
- static wrap_base* extract(T* ptr)
- {
- return dynamic_cast<wrap_base*>(get_pointer(*ptr));
- }
-# endif
- };
-
- struct default_back_reference {};
-
- template<class T>
- struct back_reference_impl : default_back_reference
- {
- static bool extract(lua_State* L, T const* ptr)
- {
- if (!has_wrapper) return false;
-
- if (wrap_base const* p = extract_wrap_base<T>::extract(ptr))
- {
- wrap_access::ref(*p).get(L);
- return true;
- }
-
- return false;
- }
-
- static bool move(lua_State* L, T* ptr)
- {
- if (!has_wrapper) return false;
-
- if (wrap_base* p = extract_wrap_base<T>::extract(ptr))
- {
- assert(wrap_access::ref(*p).m_strong_ref.is_valid());
- wrap_access::ref(*p).get(L);
- wrap_access::ref(*p).m_strong_ref.reset();
- return true;
- }
-
- return false;
- }
+namespace detail
+{
+ namespace mpl = boost::mpl;
+
+ template<class T>
+ wrap_base const* get_back_reference_aux0(T const* p, mpl::true_)
+ {
+ return dynamic_cast<wrap_base const*>(p);
+ }
- static bool has_wrapper;
- };
+ template<class T>
+ wrap_base const* get_back_reference_aux0(T const* p, mpl::false_)
+ {
+ return 0;
+ }
- template<class T>
- bool back_reference_impl<T>::has_wrapper = false;
+ template<class T>
+ wrap_base const* get_back_reference_aux(T const* p)
+ {
+ return get_back_reference_aux0(p, boost::is_polymorphic<T>());
+ }
- template<class T>
- struct back_reference_do_nothing
- {
- static bool extract(lua_State*, T const*)
- {
- return false;
- }
+ template<class T>
+ wrap_base const* get_back_reference_aux(T const& x, mpl::true_)
+ {
+ return get_back_reference_aux(get_pointer(x));
+ }
- static bool move(lua_State*, T*)
- {
- return false;
- }
- };
+ template<class T>
+ wrap_base const* get_back_reference_aux(T const& x, mpl::false_)
+ {
+ return get_back_reference_aux(&x);
+ }
- } // namespace detail
+ template<class T>
+ wrap_base const* get_back_reference(T const& x)
+ {
+ return detail::get_back_reference_aux(
+ x
+ , has_get_pointer<T>()
+ );
+ }
+
+} // namespace detail
+template<class T>
+bool get_back_reference(lua_State* L, T const& x)
+{
#ifndef LUABIND_NO_RTTI
-
- template<class T>
- struct back_reference
- : boost::mpl::if_<
- boost::is_polymorphic<T>
- , detail::back_reference_impl<T>
- , detail::back_reference_do_nothing<T>
- >::type
+ if (wrap_base const* w = detail::get_back_reference(x))
{
- };
-
-#else
+ detail::wrap_access::ref(*w).get(L);
+ return true;
+ }
+#endif
+ return false;
+}
- template<class T>
- struct back_reference
- : detail::back_reference_do_nothing<T>
+template<class T>
+bool move_back_reference(lua_State* L, T const& x)
+{
+#ifndef LUABIND_NO_RTTI
+ if (wrap_base* w = const_cast<wrap_base*>(detail::get_back_reference(x)))
{
- };
-
+ assert(detail::wrap_access::ref(*w).m_strong_ref.is_valid());
+ detail::wrap_access::ref(*w).get(L);
+ detail::wrap_access::ref(*w).m_strong_ref.reset();
+ return true;
+ }
#endif
+ return false;
+}
} // namespace luabind
-#endif // BACK_REFERENCE_040510_HPP
+#endif // LUABIND_BACK_REFERENCE_040510_HPP
--- NEW FILE: value_wrapper.hpp ---
// Copyright (c) 2005 Daniel Wallin and Arvid Norberg
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
// OR OTHER DEALINGS IN THE SOFTWARE.
#ifndef LUABIND_VALUE_WRAPPER_050419_HPP
#define LUABIND_VALUE_WRAPPER_050419_HPP
#include <boost/mpl/integral_c.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/aux_/msvc_eti_base.hpp>
#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
# define LUABIND_USE_VALUE_WRAPPER_TAG
#else
#endif
#ifdef LUABIND_USE_VALUE_WRAPPER_TAG
# include <boost/mpl/identity.hpp>
# include <boost/mpl/eval_if.hpp>
# include <boost/mpl/has_xxx.hpp>
# include <boost/mpl/not.hpp>
# include <boost/mpl/and.hpp>
# include <boost/mpl/or.hpp>
# include <boost/type_traits/is_reference.hpp>
# include <boost/type_traits/is_pointer.hpp>
# include <boost/type_traits/is_array.hpp>
#endif
namespace luabind {
//
// Concept ``ValueWrapper``
//
#ifdef LUABIND_USE_VALUE_WRAPPER_TAG
template<class T>
struct value_wrapper_traits;
namespace detail
{
BOOST_MPL_HAS_XXX_TRAIT_DEF(value_wrapper_tag);
struct unspecialized_value_wrapper_traits
{
typedef boost::mpl::false_ is_specialized;
};
template<class T>
struct value_wrapper_traits_aux
{
typedef value_wrapper_traits<typename T::value_wrapper_tag> type;
};
} // namespace detail
#endif
template<class T>
struct value_wrapper_traits
#ifdef LUABIND_USE_VALUE_WRAPPER_TAG
: boost::mpl::eval_if<
boost::mpl::and_<
boost::mpl::not_<
boost::mpl::or_<
boost::is_reference<T>
, boost::is_pointer<T>
, boost::is_array<T>
>
>
, detail::has_value_wrapper_tag<T>
>
, detail::value_wrapper_traits_aux<T>
, boost::mpl::identity<detail::unspecialized_value_wrapper_traits>
>::type
{};
#else
{
typedef boost::mpl::false_ is_specialized;
};
#endif
template<class T>
struct is_value_wrapper
: boost::mpl::aux::msvc_eti_base<
typename value_wrapper_traits<T>::is_specialized
>::type
{};
} // namespace luabind
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
# include <boost/type_traits/remove_const.hpp>
# include <boost/type_traits/remove_reference.hpp>
namespace luabind {
template<class T>
struct is_value_wrapper_arg
: is_value_wrapper<
typename boost::remove_const<
typename boost::remove_reference<T>::type
>::type
>
{};
} // namespace luabind
#else
# include <luabind/detail/yes_no.hpp>
# include <boost/type_traits/add_reference.hpp>
namespace luabind {
namespace detail
{
template<class T>
typename is_value_wrapper<T>::type is_value_wrapper_arg_check(T const*);
yes_t to_yesno(boost::mpl::true_);
no_t to_yesno(boost::mpl::false_);
template<class T>
struct is_value_wrapper_arg_aux
{
static typename boost::add_reference<T>::type x;
BOOST_STATIC_CONSTANT(bool, value =
sizeof(to_yesno(is_value_wrapper_arg_check(&x)))
== sizeof(yes_t)
);
typedef boost::mpl::bool_<value> type;
};
} // namespace detail
template<class T>
struct is_value_wrapper_arg
: detail::is_value_wrapper_arg_aux<T>::type
{
};
} // namespace luabind
#endif
#endif // LUABIND_VALUE_WRAPPER_050419_HPP
Index: back_reference_fwd.hpp
===================================================================
RCS file: /cvsroot/luabind/luabind/luabind/luabind/back_reference_fwd.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- back_reference_fwd.hpp 7 Aug 2004 13:37:10 -0000 1.2
+++ back_reference_fwd.hpp 28 Nov 2005 20:55:34 -0000 1.3
@@ -20,14 +20,18 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
// OR OTHER DEALINGS IN THE SOFTWARE.
-#ifndef BACK_REFERENCE_FWD_040510_HPP
-#define BACK_REFERENCE_FWD_040510_HPP
+#ifndef LUABIND_BACK_REFERENCE_FWD_040510_HPP
+#define LUABIND_BACK_REFERENCE_FWD_040510_HPP
namespace luabind {
- template<class T> struct back_reference;
+template<class T>
+bool get_back_reference(lua_State* L, T const& x);
+
+template<class T>
+bool move_back_reference(lua_State* L, T const& x);
} // namespace luabind
-#endif // BACK_REFERENCE_FWD_040510_HPP
+#endif // LUABIND_BACK_REFERENCE_FWD_040510_HPP
Index: class_info.hpp
===================================================================
RCS file: /cvsroot/luabind/luabind/luabind/luabind/class_info.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- class_info.hpp 18 Feb 2004 01:18:58 -0000 1.3
+++ class_info.hpp 28 Nov 2005 20:55:34 -0000 1.4
@@ -27,15 +27,12 @@
#include <luabind/prefix.hpp>
#include <luabind/lua_include.hpp>
#include <luabind/luabind.hpp>
+#include <luabind/object.hpp>
namespace luabind
{
struct class_info
- {
- class_info(lua_State* L)
- : methods(L)
- {}
-
+ {
std::string name;
object methods;
object attributes;
Index: adopt_policy.hpp
===================================================================
RCS file: /cvsroot/luabind/luabind/luabind/luabind/adopt_policy.hpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- adopt_policy.hpp 7 Aug 2004 13:37:10 -0000 1.10
+++ adopt_policy.hpp 28 Nov 2005 20:55:34 -0000 1.11
@@ -27,12 +27,17 @@
#include <luabind/config.hpp>
#include <luabind/detail/policy.hpp>
#include <luabind/detail/implicit_cast.hpp>
+#include <boost/mpl/bool.hpp>
+#include <luabind/back_reference_fwd.hpp>
namespace luabind { namespace detail
{
template<class Direction = lua_to_cpp>
struct adopt_pointer
{
+ typedef boost::mpl::bool_<false> is_value_converter;
+ typedef adopt_pointer type;
+
template<class T>
T* apply(lua_State* L, by_pointer<T>, int index)
{
@@ -75,6 +80,9 @@
template<>
struct adopt_pointer<cpp_to_lua>
{
+ typedef boost::mpl::bool_<false> is_value_converter;
+ typedef adopt_pointer type;
+
template<class T>
void apply(lua_State* L, T* ptr)
{
@@ -87,7 +95,7 @@
// if there is a back_reference, then the
// ownership will be removed from the
// back reference and put on the lua stack.
- if (back_reference<T>::move(L, ptr))
+ if (luabind::move_back_reference(L, ptr))
{
object_rep* obj = static_cast<object_rep*>(lua_touserdata(L, -1));
obj->set_flags(obj->flags() | object_rep::owner);
Index: class.hpp
===================================================================
RCS file: /cvsroot/luabind/luabind/luabind/luabind/class.hpp,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -d -r1.63 -r1.64
--- class.hpp 3 Jan 2005 11:15:21 -0000 1.63
+++ class.hpp 28 Nov 2005 20:55:34 -0000 1.64
@@ -93,6 +93,7 @@
#include <luabind/config.hpp>
#include <luabind/scope.hpp>
+#include <luabind/raw_policy.hpp>
#include <luabind/back_reference.hpp>
#include <luabind/detail/constructor.hpp>
#include <luabind/detail/call.hpp>
@@ -127,16 +128,17 @@
struct unspecified {};
template<class Derived> struct operator_;
- }
- using detail::type;
+ struct you_need_to_define_a_get_const_holder_function_for_your_smart_ptr {};
+ }
template<class T, class X1 = detail::unspecified, class X2 = detail::unspecified, class X3 = detail::unspecified>
struct class_;
// TODO: this function will only be invoked if the user hasn't defined a correct overload
// maybe we should have a static assert in here?
- inline detail::null_type* get_const_holder(...)
+ inline detail::you_need_to_define_a_get_const_holder_function_for_your_smart_ptr*
+ get_const_holder(...)
{
return 0;
}
@@ -301,7 +303,7 @@
typedef void*(*extractor_fun)(void*);
template<class T>
- static extractor_fun apply(detail::type<T>)
+ static extractor_fun apply(detail::type_<T>)
{
return &detail::extract_underlying_type<T, HeldType>::extract;
}
@@ -313,7 +315,7 @@
typedef void*(*extractor_fun)(void*);
template<class T>
- static extractor_fun apply(detail::type<T>)
+ static extractor_fun apply(detail::type_<T>)
{
return 0;
}
@@ -363,13 +365,13 @@
typedef const void*(*extractor_fun)(void*);
template<class T>
- static extractor_fun apply(detail::type<T>)
+ static extractor_fun apply(detail::type_<T>)
{
- return get_extractor(detail::type<T>(), luabind::get_const_holder(static_cast<HeldType*>(0)));
+ return get_extractor(detail::type_<T>(), get_const_holder(static_cast<HeldType*>(0)));
}
private:
template<class T, class ConstHolderType>
- static extractor_fun get_extractor(detail::type<T>, ConstHolderType*)
+ static extractor_fun get_extractor(detail::type_<T>, ConstHolderType*)
{
return &detail::extract_underlying_const_type<T, ConstHolderType>::extract;
}
@@ -381,7 +383,7 @@
typedef const void*(*extractor_fun)(void*);
template<class T>
- static extractor_fun apply(detail::type<T>)
+ static extractor_fun apply(detail::type_<T>)
{
return 0;
}
@@ -439,7 +441,7 @@
{
typedef void(*constructor)(void*,void*);
template<class T>
- static constructor apply(detail::type<T>)
+ static constructor apply(detail::type_<T>)
{
return &internal_construct_holder<HeldType, T>::apply;
}
@@ -450,7 +452,7 @@
{
typedef void(*constructor)(void*,void*);
template<class T>
- static constructor apply(detail::type<T>)
+ static constructor apply(detail::type_<T>)
{
return 0;
}
@@ -464,15 +466,15 @@
{
typedef void(*constructor)(void*,void*);
template<class T>
- static constructor apply(detail::type<T>)
+ static constructor apply(detail::type_<T>)
{
- return get_const_holder_constructor(detail::type<T>(), luabind::get_const_holder(static_cast<HolderType*>(0)));
+ return get_const_holder_constructor(detail::type_<T>(), get_const_holder(static_cast<HolderType*>(0)));
}
private:
template<class T, class ConstHolderType>
- static constructor get_const_holder_constructor(detail::type<T>, ConstHolderType*)
+ static constructor get_const_holder_constructor(detail::type_<T>, ConstHolderType*)
{
return &internal_construct_holder<ConstHolderType, T>::apply;
}
@@ -483,7 +485,7 @@
{
typedef void(*constructor)(void*,void*);
template<class T>
- static constructor apply(detail::type<T>)
+ static constructor apply(detail::type_<T>)
{
return 0;
}
@@ -498,7 +500,7 @@
{
typedef void(*constructor)(void*);
template<class T>
- static constructor apply(detail::type<T>)
+ static constructor apply(detail::type_<T>)
{
return &internal_default_construct_holder<HeldType, T>::apply;
}
@@ -509,7 +511,7 @@
{
typedef void(*constructor)(void*);
template<class T>
- static constructor apply(detail::type<T>)
+ static constructor apply(detail::type_<T>)
{
return 0;
}
@@ -525,15 +527,15 @@
{
typedef void(*constructor)(void*);
template<class T>
- static constructor apply(detail::type<T>)
+ static constructor apply(detail::type_<T>)
{
- return get_const_holder_default_constructor(detail::type<T>(), luabind::get_const_holder(static_cast<HolderType*>(0)));
+ return get_const_holder_default_constructor(detail::type_<T>(), get_const_holder(static_cast<HolderType*>(0)));
}
private:
template<class T, class ConstHolderType>
- static constructor get_const_holder_default_constructor(detail::type<T>, ConstHolderType*)
+ static constructor get_const_holder_default_constructor(detail::type_<T>, ConstHolderType*)
{
return &internal_default_construct_holder<ConstHolderType, T>::apply;
}
@@ -544,7 +546,7 @@
{
typedef void(*constructor)(void*);
template<class T>
- static constructor apply(detail::type<T>)
+ static constructor apply(detail::type_<T>)
{
return 0;
}
@@ -558,7 +560,7 @@
template <class HolderType>
struct internal_holder_size
{
- static int apply() { return get_internal_holder_size(luabind::get_const_holder(static_cast<HolderType*>(0))); }
+ static int apply() { return get_internal_holder_size(get_const_holder(static_cast<HolderType*>(0))); }
private:
template<class ConstHolderType>
static int get_internal_holder_size(ConstHolderType*)
@@ -582,7 +584,7 @@
{
typedef void(*destructor_t)(void*);
template<class T>
- static destructor_t apply(detail::type<T>)
+ static destructor_t apply(detail::type_<T>)
{
return &detail::destruct_only_s<HeldType>::apply;
}
@@ -594,7 +596,7 @@
{
typedef void(*destructor_t)(void*);
template<class T>
- static destructor_t apply(detail::type<T>)
+ static destructor_t apply(detail::type_<T>)
{
return &detail::delete_s<T>::apply;
}
@@ -607,9 +609,9 @@
{
typedef void(*destructor_t)(void*);
template<class T>
- static destructor_t apply(detail::type<T>)
+ static destructor_t apply(detail::type_<T>)
{
- return const_holder_type_destructor(luabind::get_const_holder(static_cast<HolderType*>(0)));
+ return const_holder_type_destructor(get_const_holder(static_cast<HolderType*>(0)));
}
private:
@@ -628,7 +630,7 @@
{
typedef void(*destructor_t)(void*);
template<class T>
- static destructor_t apply(detail::type<T>)
+ static destructor_t apply(detail::type_<T>)
{
return 0;
}
@@ -642,7 +644,7 @@
{
static int apply()
{
- return internal_alignment(luabind::get_const_holder(static_cast<HolderType*>(0)));
+ return internal_alignment(get_const_holder(static_cast<HolderType*>(0)));
}
private:
@@ -820,7 +822,7 @@
// in the given class_rep structure. It will be able
// to implicitly cast to the given template type
template<class To>
- void gen_base_info(detail::type<To>)
+ void gen_base_info(detail::type_<To>)
{
// fist, make sure the given base class is registered.
// if it's not registered we can't push it's lua table onto
@@ -833,17 +835,17 @@
// store the information in this class' base class-vector
base_desc base;
base.type = LUABIND_TYPEID(To);
- base.ptr_offset = detail::ptr_offset(detail::type<T>(), detail::type<To>());
+ base.ptr_offset = detail::ptr_offset(detail::type_<T>(), detail::type_<To>());
add_base(base);
}
- void gen_base_info(detail::type<detail::null_type>)
+ void gen_base_info(detail::type_<detail::null_type>)
{}
-#define LUABIND_GEN_BASE_INFO(z, n, text) gen_base_info(detail::type<B##n>());
+#define LUABIND_GEN_BASE_INFO(z, n, text) gen_base_info(detail::type_<B##n>());
template<BOOST_PP_ENUM_PARAMS(LUABIND_MAX_BASES, class B)>
- void generate_baseclass_list(detail::type<bases<BOOST_PP_ENUM_PARAMS(LUABIND_MAX_BASES, B)> >)
+ void generate_baseclass_list(detail::type_<bases<BOOST_PP_ENUM_PARAMS(LUABIND_MAX_BASES, B)> >)
{
BOOST_PP_REPEAT(LUABIND_MAX_BASES, LUABIND_GEN_BASE_INFO, _)
}
@@ -1139,8 +1141,6 @@
void init()
{
- set_back_reference((back_reference<T>*)0);
-
typedef typename detail::extract_parameter<
boost::mpl::list3<X1,X2,X3>
, boost::mpl::or_<
@@ -1160,21 +1160,21 @@
, detail::internal_holder_type<HeldType>::apply()
, detail::pointee_typeid(
get_const_holder(static_cast<HeldType*>(0)))
- , detail::internal_holder_extractor<HeldType>::apply(detail::type<T>())
- , detail::internal_const_holder_extractor<HeldType>::apply(detail::type<T>())
+ , detail::internal_holder_extractor<HeldType>::apply(detail::type_<T>())
+ , detail::internal_const_holder_extractor<HeldType>::apply(detail::type_<T>())
, detail::const_converter<HeldType>::apply(
- luabind::get_const_holder((HeldType*)0))
- , detail::holder_constructor<HeldType>::apply(detail::type<T>())
- , detail::const_holder_constructor<HeldType>::apply(detail::type<T>())
- , detail::holder_default_constructor<HeldType>::apply(detail::type<T>())
- , detail::const_holder_default_constructor<HeldType>::apply(detail::type<T>())
+ get_const_holder((HeldType*)0))
+ , detail::holder_constructor<HeldType>::apply(detail::type_<T>())
+ , detail::const_holder_constructor<HeldType>::apply(detail::type_<T>())
+ , detail::holder_default_constructor<HeldType>::apply(detail::type_<T>())
+ , detail::const_holder_default_constructor<HeldType>::apply(detail::type_<T>())
, get_adopt_fun((WrappedType*)0) // adopt fun
- , detail::internal_holder_destructor<HeldType>::apply(detail::type<T>())
- , detail::internal_const_holder_destructor<HeldType>::apply(detail::type<T>())
+ , detail::internal_holder_destructor<HeldType>::apply(detail::type_<T>())
+ , detail::internal_const_holder_destructor<HeldType>::apply(detail::type_<T>())
, detail::internal_holder_size<HeldType>::apply()
, detail::get_holder_alignment<HeldType>::apply());
- generate_baseclass_list(detail::type<Base>());
+ generate_baseclass_list(detail::type_<Base>());
}
template<class Getter, class GetPolicies>
@@ -1209,7 +1209,7 @@
// these handle default implementation of virtual functions
template<class F, class Policies>
class_& virtual_def(char const* name, F const& fn
- , Policies const& policies, detail::null_type, boost::mpl::true_)
+ , Policies const&, detail::null_type, boost::mpl::true_)
{
// normal def() call
detail::overload_rep o(fn, static_cast<Policies*>(0));
@@ -1226,7 +1226,7 @@
template<class F, class Default, class Policies>
class_& virtual_def(char const* name, F const& fn
- , Default const& default_, Policies const& policies, boost::mpl::false_)
+ , Default const& default_, Policies const&, boost::mpl::false_)
{
// default_ is a default implementation
// policies is either null_type or a policy list
@@ -1253,7 +1253,7 @@
class_& def_constructor(
boost::mpl::true_ /* HasWrapper */
, Signature*
- , Policies const& policies)
+ , Policies const&)
{
detail::construct_rep::overload_t o;
@@ -1283,7 +1283,7 @@
class_& def_constructor(
boost::mpl::false_ /* !HasWrapper */
, Signature*
- , Policies const& policies)
+ , Policies const&)
{
detail::construct_rep::overload_t o;
@@ -1310,16 +1310,6 @@
return *this;
}
- void set_back_reference(detail::default_back_reference*)
- {
- back_reference<T>::has_wrapper
- = !boost::is_same<WrappedType, detail::null_type>::value;
- }
-
- void set_back_reference(void*)
- {
- }
-
typedef void(*adopt_fun_t)(void*);
template<class W>
--- NEW FILE: from_stack.hpp ---
// Copyright (c) 2005 Daniel Wallin and Arvid Norberg
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
// OR OTHER DEALINGS IN THE SOFTWARE.
#ifndef LUABIND_FROM_STACK_050715_HPP
#define LUABIND_FROM_STACK_050715_HPP
namespace luabind {
struct from_stack
{
from_stack(lua_State* interpreter, int index)
: interpreter(interpreter)
, index(index)
{}
lua_State* interpreter;
int index;
};
} // namespace luabind
#endif // LUABIND_FROM_STACK_050715_HPP
Index: luabind.hpp
===================================================================
RCS file: /cvsroot/luabind/luabind/luabind/luabind/luabind.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- luabind.hpp 17 Feb 2004 21:56:21 -0000 1.3
+++ luabind.hpp 28 Nov 2005 20:55:34 -0000 1.4
@@ -27,7 +27,6 @@
#include <luabind/config.hpp>
#include <luabind/class.hpp>
#include <luabind/function.hpp>
-#include <luabind/functor.hpp>
#include <luabind/open.hpp>
#endif // LUABIND_BIND_HPP_INCLUDED
--- NEW FILE: get_pointer.hpp ---
// Copyright (c) 2005 Daniel Wallin
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
// OR OTHER DEALINGS IN THE SOFTWARE.
#ifndef LUABIND_GET_POINTER_051023_HPP
# define LUABIND_GET_POINTER_051023_HPP
//
// We need these overloads in the luabind namespace.
//
# include <boost/get_pointer.hpp>
namespace luabind {
using boost::get_pointer;
} // namespace luabind
#endif // LUABIND_GET_POINTER_051023_HPP
--- NEW FILE: handle.hpp ---
// Copyright (c) 2005 Daniel Wallin and Arvid Norberg
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
// OR OTHER DEALINGS IN THE SOFTWARE.
#ifndef LUABIND_HANDLE_050420_HPP
#define LUABIND_HANDLE_050420_HPP
#include <luabind/lua_include.hpp>
#include <luabind/value_wrapper.hpp>
#include <luabind/detail/ref.hpp>
namespace luabind {
// A reference to a Lua value. Represents an entry in the
// registry table.
class handle
{
public:
handle();
handle(lua_State* interpreter, int stack_index);
handle(handle const& other);
~handle();
handle& operator=(handle const& other);
void swap(handle& other);
void push(lua_State* interpreter) const;
lua_State* interpreter() const;
void replace(lua_State* interpreter, int stack_index);
private:
lua_State* m_interpreter;
int m_index;
};
inline handle::handle()
: m_interpreter(0)
, m_index(LUA_NOREF)
{}
inline handle::handle(handle const& other)
: m_interpreter(other.m_interpreter)
, m_index(LUA_NOREF)
{
detail::getref(m_interpreter, other.m_index);
m_index = detail::ref(m_interpreter);
}
inline handle::handle(lua_State* interpreter, int stack_index)
: m_interpreter(interpreter)
, m_index(LUA_NOREF)
{
lua_pushvalue(interpreter, stack_index);
m_index = detail::ref(interpreter);
}
inline handle::~handle()
{
if (m_interpreter && m_index != LUA_NOREF)
detail::unref(m_interpreter, m_index);
}
inline handle& handle::operator=(handle const& other)
{
handle(other).swap(*this);
return *this;
}
inline void handle::swap(handle& other)
{
std::swap(m_interpreter, other.m_interpreter);
std::swap(m_index, other.m_index);
}
inline void handle::push(lua_State* interpreter) const
{
detail::getref(interpreter, m_index);
}
inline lua_State* handle::interpreter() const
{
return m_interpreter;
}
inline void handle::replace(lua_State* interpreter, int stack_index)
{
lua_pushvalue(interpreter, stack_index);
lua_rawseti(interpreter, LUA_REGISTRYINDEX, m_index);
}
template<>
struct value_wrapper_traits<handle>
{
typedef boost::mpl::true_ is_specialized;
static lua_State* interpreter(handle const& value)
{
return value.interpreter();
}
static void unwrap(lua_State* interpreter, handle const& value)
{
value.push(interpreter);
}
static bool check(...)
{
return true;
}
};
} // namespace luabind
#endif // LUABIND_HANDLE_050420_HPP
Index: iterator_policy.hpp
===================================================================
RCS file: /cvsroot/luabind/luabind/luabind/luabind/iterator_policy.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- iterator_policy.hpp 5 Jul 2003 22:13:59 -0000 1.3
+++ iterator_policy.hpp 28 Nov 2005 20:55:34 -0000 1.4
@@ -28,6 +28,7 @@
#include <luabind/detail/policy.hpp>
#include <luabind/detail/implicit_cast.hpp>
#include <luabind/detail/convert_to_lua.hpp>
+#include <boost/mpl/bool.hpp>
namespace luabind { namespace detail
{
@@ -64,6 +65,9 @@
struct iterator_converter
{
+ typedef boost::mpl::bool_<false> is_value_converter;
+ typedef iterator_converter type;
+
template<class T>
void apply(lua_State* L, const T& c)
{
Index: scope.hpp
===================================================================
RCS file: /cvsroot/luabind/luabind/luabind/luabind/scope.hpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- scope.hpp 20 Feb 2004 15:04:54 -0000 1.16
+++ scope.hpp 28 Nov 2005 20:55:34 -0000 1.17
@@ -45,7 +45,7 @@
virtual void register_(lua_State*) const = 0;
private:
- friend struct scope;
+ friend struct ::luabind::scope;
registration* m_next;
};
|