From 01200f9382e00390195943af2c9de2c6eeedfd91 Mon Sep 17 00:00:00 2001 From: Daniel Wallin Date: Sun, 4 Jan 2009 15:53:59 +0100 Subject: [PATCH] Remove a lot of unused code. --- Jamroot | 2 - luabind/class.hpp | 125 -------------------------- luabind/detail/class_rep.hpp | 56 +----------- luabind/detail/construct_rep.hpp | 86 ------------------ luabind/detail/find_best_match.hpp | 59 ------------- luabind/detail/get_overload_signature.hpp | 54 ------------ luabind/detail/overload_rep.hpp | 141 ------------------------------ luabind/detail/overload_rep_base.hpp | 81 ----------------- luabind/detail/policy.hpp | 1 + luabind/make_function.hpp | 1 + src/class.cpp | 82 ----------------- src/class_info.cpp | 10 --- src/class_rep.cpp | 63 ------------- src/overload_rep.cpp | 39 --------- 14 files changed, 4 insertions(+), 796 deletions(-) delete mode 100644 luabind/detail/construct_rep.hpp delete mode 100644 luabind/detail/find_best_match.hpp delete mode 100644 luabind/detail/get_overload_signature.hpp delete mode 100644 luabind/detail/overload_rep.hpp delete mode 100644 luabind/detail/overload_rep_base.hpp delete mode 100644 src/overload_rep.cpp diff --git a/Jamroot b/Jamroot index a8c999d..ce46287 100755 --- a/Jamroot +++ b/Jamroot @@ -117,13 +117,11 @@ SOURCES = create_class.cpp error.cpp exception_handler.cpp - find_best_match.cpp function.cpp implicit_cast.cpp link_compatibility.cpp object_rep.cpp open.cpp - overload_rep.cpp pcall.cpp ref.cpp scope.cpp diff --git a/luabind/class.hpp b/luabind/class.hpp index a7dddf3..e67ddc6 100644 --- a/luabind/class.hpp +++ b/luabind/class.hpp @@ -107,7 +107,6 @@ #include #include #include -#include #include #include #include @@ -737,40 +736,7 @@ namespace luabind , int holder_size , int holder_alignment); - void add_getter( - const char* name - , const boost::function2& g); - -#ifdef LUABIND_NO_ERROR_CHECKING - void add_setter( - const char* name - , const boost::function2& s); -#else - void add_setter( - const char* name - , const boost::function2& s - , int (*match)(lua_State*, int) - , void (*get_sig_ptr)(lua_State*, std::string&)); -#endif - void add_base(const base_desc& b); - void add_constructor(const detail::construct_rep::overload_t& o); - -#ifndef LUABIND_NO_ERROR_CHECKING - void add_operator( - int op_id - , int(*func)(lua_State*) - , int(*matcher)(lua_State*) - , void(*sig)(lua_State* - , std::string&) - , int arity); -#else - void add_operator( - int op_id - , int(*func)(lua_State*) - , int(*matcher)(lua_State*) - , int arity); -#endif void add_member(registration* member); void add_default_member(registration* member); @@ -1213,97 +1179,6 @@ namespace luabind ); } -/* - template - class_& def(detail::operator_, const Policies& policies) - { - typedef typename detail::operator_unwrapper op_type; -#ifndef LUABIND_NO_ERROR_CHECKING - add_operator(op_type::get_id() - , &op_type::execute - , &op_type::match - , &detail::get_signature >::apply - , detail::is_unary(op_type::get_id()) ? 1 : 2); -#else - add_operator(op_type::get_id() - , &op_type::execute - , &op_type::match - , detail::is_unary(op_type::get_id()) ? 1 : 2); -#endif - return *this; - } - - template - class_& def(detail::operator_) - { - typedef typename detail::operator_unwrapper op_type; - -#ifndef LUABIND_NO_ERROR_CHECKING - add_operator(op_type::get_id() - , &op_type::execute - , &op_type::match - , &detail::get_signature >::apply - , detail::is_unary(op_type::get_id()) ? 1 : 2); -#else - add_operator(op_type::get_id() - , &op_type::execute - , &op_type::match - , detail::is_unary(op_type::get_id()) ? 1 : 2); -#endif - return *this; - } - - template - class_& def(detail::application_operator*) - { - typedef detail::application_operator op_t; - - int arity = detail::calc_arity::apply( - Signature(), static_cast(0)); - -#ifndef LUABIND_NO_ERROR_CHECKING - add_operator( - detail::op_call - , &op_t::template apply::execute - , &op_t::match - , &detail::get_signature::apply - , arity + 1); -#else - add_operator( - detail::op_call - , &op_t::template apply::execute - , &op_t::match - , arity + 1); -#endif - - return *this; - } - - template - class_& def(detail::application_operator*, const Policies& policies) - { - typedef detail::application_operator op_t; - - int arity = detail::calc_arity::apply(Signature(), static_cast(0)); - -#ifndef LUABIND_NO_ERROR_CHECKING - add_operator( - detail::op_call - , &op_t::template apply::execute - , &op_t::match - , &detail::get_signature::apply - , arity + 1); -#else - add_operator( - detail::op_call - , &op_t::template apply::execute - , &op_t::match - , arity + 1); -#endif - - return *this; - } -*/ detail::enum_maker enum_(const char*) { return detail::enum_maker(*this); diff --git a/luabind/detail/class_rep.hpp b/luabind/detail/class_rep.hpp index b158081..d032fe8 100644 --- a/luabind/detail/class_rep.hpp +++ b/luabind/detail/class_rep.hpp @@ -27,17 +27,15 @@ #include #include +#include #include -#include +#include #include #include -#include #include #include #include -#include -#include #include #include #include @@ -141,8 +139,6 @@ namespace luabind { namespace detail // this is called as metamethod __call on the class_rep. static int constructor_dispatcher(lua_State* L); - static int function_dispatcher(lua_State* L); - struct base_info { int pointer_offset; // the offset added to the pointer to obtain a basepointer (due to multiple-inheritance) @@ -161,9 +157,6 @@ namespace luabind { namespace detail const char* name() const throw() { return m_name; } - // the lua reference to this class_rep - // TODO: remove -// int self_ref() const throw() { return m_self_ref; } // the lua reference to the metatable for this class' instances int metatable_ref() const throw() { return m_instance_metatable; } @@ -195,14 +188,6 @@ namespace luabind { namespace detail // called from the metamethod for __index // obj is the object pointer - static int lua_class_gettable(lua_State* L); - - // called from the metamethod for __newindex - // obj is the object pointer - static int lua_class_settable(lua_State* L); - - // called from the metamethod for __index - // obj is the object pointer static int static_class_gettable(lua_State* L); void* convert_to( @@ -211,22 +196,6 @@ namespace luabind { namespace detail bool has_operator_in_lua(lua_State*, int id); - // this is used to describe setters and getters - struct callback - { - boost::function2 func; -#ifndef LUABIND_NO_ERROR_CHECKING - int (*match)(lua_State*, int); - - typedef void(*get_sig_ptr)(lua_State*, std::string&); - get_sig_ptr sig; -#endif - int pointer_offset; - }; - - const std::map& properties() const; - typedef std::map property_map; - int holder_alignment() const { return m_holder_alignment; @@ -263,16 +232,6 @@ namespace luabind { namespace detail m_default_construct_const_holder = base->m_default_construct_const_holder; } - struct operator_callback: public overload_rep_base - { - inline void set_fun(int (*f)(lua_State*)) { func = f; } - inline int call(lua_State* L) { return func(L); } - inline void set_arity(int arity) { m_arity = arity; } - - private: - int(*func)(lua_State*); - }; - private: void cache_operators(lua_State*); @@ -326,10 +285,6 @@ namespace luabind { namespace detail // the class' name (as given when registered to lua with class_) const char* m_name; - // contains signatures and construction functions - // for all constructors - construct_rep m_constructor; - // a reference to this structure itself. Since this struct // is kept inside lua (to let lua collect it when lua_close() // is called) we need to lock it to prevent collection. @@ -357,13 +312,6 @@ namespace luabind { namespace detail // ***** the maps below contains all members in this class ***** - // datamembers, some members may be readonly, and - // only have a getter function - std::map m_getters; - std::map m_setters; - - std::vector m_operators[number_of_operators]; // the operators in lua - void(*m_destructor)(void*); void(*m_const_holder_destructor)(void*); diff --git a/luabind/detail/construct_rep.hpp b/luabind/detail/construct_rep.hpp deleted file mode 100644 index a7729bb..0000000 --- a/luabind/detail/construct_rep.hpp +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright (c) 2003 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_CONSTRUCT_REP_HPP_INCLUDED -#define LUABIND_CONSTRUCT_REP_HPP_INCLUDED - -#include - -#include -#include - -#include -#include -#include - -//#include -#include -#include - -namespace luabind { namespace detail -{ - - - struct construct_rep - { - struct overload_t: public overload_rep_base - { - overload_t(): wrapped_construct_fun(0) - { - } - - typedef void*(*construct_ptr)(lua_State*, weak_ref const&); - typedef void*(*wrapped_construct_ptr)(lua_State*, weak_ref const&); - typedef void(*get_signature_ptr)(lua_State*, std::string&); - - inline void set_constructor(construct_ptr f) { construct_fun = f; } - inline void set_wrapped_constructor(wrapped_construct_ptr f) { wrapped_construct_fun = f; } - - inline void* construct(lua_State* L, weak_ref const& backref) - { - return construct_fun(L, backref); - } - - inline void* construct_wrapped(lua_State* L, weak_ref const& ref) { return wrapped_construct_fun(L, ref); } - inline bool has_wrapped_construct() { return wrapped_construct_fun != 0; } - - inline void set_arity(int arity) { m_arity = arity; } - - private: - - construct_ptr construct_fun; - wrapped_construct_ptr wrapped_construct_fun; - - }; - - void swap(construct_rep& x) - { - std::swap(x.overloads, overloads); - } - - std::vector overloads; - }; - -}} - -#endif // LUABIND_CONSTRUCT_REP_HPP_INCLUDED diff --git a/luabind/detail/find_best_match.hpp b/luabind/detail/find_best_match.hpp deleted file mode 100644 index 2612e95..0000000 --- a/luabind/detail/find_best_match.hpp +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) 2003 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_FIND_BEST_MATCH_HPP_INCLUDED -#define LUABIND_FIND_BEST_MATCH_HPP_INCLUDED - -#include - -#include - -namespace luabind { namespace detail -{ - - // expects that a match function can be accesed through the iterator - // as int match_fun(lua_State*) - // returns true if it found a match better than the given. If it finds a - // better match match_index is updated to contain the new index to the best - // match (this index now refers to the list given to this call). - // orep_size is supposed to tell the size of the actual structures that - // start and end points to ambiguous is set to true if the match was - // ambiguous min_match should be initialized to the currently best match - // value (the number of implicit casts to get a perfect match). If there - // are no previous matches, set min_match to - // std::numeric_limits::max() - - LUABIND_API bool find_best_match(lua_State* L - , detail::overload_rep_base const* start, int num_overloads - , size_t orep_size, bool& ambiguous, int& min_match, int& match_index - , int num_params); - - LUABIND_API void find_exact_match(lua_State* L - , detail::overload_rep_base const* start, int num_overloads - , size_t orep_size, int cmp_match, int num_params - , std::vector& dest); - -}} - -#endif // LUABIND_FIND_BEST_MATCH_HPP_INCLUDED - diff --git a/luabind/detail/get_overload_signature.hpp b/luabind/detail/get_overload_signature.hpp deleted file mode 100644 index f4c151c..0000000 --- a/luabind/detail/get_overload_signature.hpp +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) 2003 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_GET_OVERLOAD_SIGNATURE_HPP_INCLUDED -#define LUABIND_GET_OVERLOAD_SIGNATURE_HPP_INCLUDED - -#include - -namespace luabind { namespace detail -{ - - template - std::string get_overload_signatures(lua_State* L, It start, It end, std::string name) - { - std::string s; - for (; start != end; ++start) - { - s += name; - start->get_signature(L, s); - s += "\n"; - } - return s; - } - - -#ifndef LUABIND_NO_ERROR_CHECKING - - std::string get_overload_signatures_candidates(lua_State* L, std::vector::iterator start, std::vector::iterator end, std::string name); - -#endif - -}} - -#endif // LUABIND_GET_OVERLOAD_SIGNATURE_HPP_INCLUDED - diff --git a/luabind/detail/overload_rep.hpp b/luabind/detail/overload_rep.hpp deleted file mode 100644 index 483b2fc..0000000 --- a/luabind/detail/overload_rep.hpp +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright (c) 2003 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. - - -#if !BOOST_PP_IS_ITERATING - -#ifndef LUABIND_OVERLOAD_REP_HPP_INCLUDED -#define LUABIND_OVERLOAD_REP_HPP_INCLUDED - -#include - -#include -#include -#include -#include -#include - -#include - -#include - -#ifndef BOOST_MSVC -#include -#endif - -namespace luabind { namespace detail -{ - struct dummy_ {}; - - // this class represents a specific overload of a member-function. - struct overload_rep: public overload_rep_base - { - #define BOOST_PP_ITERATION_PARAMS_1 (4 \ - , (0, LUABIND_MAX_ARITY, , 1)) - #include BOOST_PP_ITERATE() - - bool operator==(const overload_rep& o) - { - if (o.m_const != m_const) return false; - if (o.m_arity != m_arity) return false; - if (o.m_params_.size() != m_params_.size()) return false; - for (int i = 0; i < (int)m_params_.size(); ++i) - { - if (!(LUABIND_TYPE_INFO_EQUAL(m_params_[i], o.m_params_[i]))) - return false; - } - return true; - } - - void set_fun(boost::function1 const& f) - { call_fun = f; } - - void set_fun_static(boost::function1 const& f) - { call_fun_static = f; } - - int call(lua_State* L, bool force_static_call) const; - - bool has_static() const { return !call_fun_static.empty(); } - - private: - - // this is the normal function pointer that may be a virtual - boost::function1 call_fun; - - // this is the optional function pointer that is only set if - // the first function pointer is virtual. This must always point - // to a static function. - boost::function1 call_fun_static; - - // the types of the parameter it takes - std::vector m_params_; - // is true if the overload is const (this is a part of the signature) - bool m_const; - }; - -}} // namespace luabind::detail - -#endif // LUABIND_OVERLOAD_REP_HPP_INCLUDED - -#elif BOOST_PP_ITERATION_FLAGS() == 1 - -#define LUABIND_PARAM(z, n, _) m_params_.push_back(LUABIND_TYPEID(A##n)); -#define LUABIND_POLICY_DECL(z,n,offset) typedef typename detail::find_conversion_policy::type BOOST_PP_CAT(p,n); -#define LUABIND_ARITY(z,n,text) + BOOST_PP_CAT(p,n)::has_arg - - // overloaded template funtion that initializes the parameter list - // called m_params and the m_arity member. - template - overload_rep(R(T::*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), A)), Policies*) - : m_const(false) - { - m_params_.reserve(BOOST_PP_ITERATION()); - BOOST_PP_REPEAT(BOOST_PP_ITERATION(), LUABIND_PARAM, _) - BOOST_PP_REPEAT(BOOST_PP_ITERATION(), LUABIND_POLICY_DECL, 2) - m_arity = 1 BOOST_PP_REPEAT(BOOST_PP_ITERATION(), LUABIND_ARITY, 0); - } - - template - overload_rep(R(T::*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), A)) const, Policies*) - : m_const(true) - { - m_params_.reserve(BOOST_PP_ITERATION()); - BOOST_PP_REPEAT(BOOST_PP_ITERATION(), LUABIND_PARAM, _) - BOOST_PP_REPEAT(BOOST_PP_ITERATION(), LUABIND_POLICY_DECL, 2) - m_arity = 1 BOOST_PP_REPEAT(BOOST_PP_ITERATION(), LUABIND_ARITY, 0); - } - - template - overload_rep(R(*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), A)), Policies*) - : m_const(false/*is_indirect_const::value*/) - { - m_params_.reserve(BOOST_PP_ITERATION()); - BOOST_PP_REPEAT(BOOST_PP_ITERATION(), LUABIND_PARAM, _) - BOOST_PP_REPEAT(BOOST_PP_ITERATION(), LUABIND_POLICY_DECL, 1) - m_arity = 0 BOOST_PP_REPEAT(BOOST_PP_ITERATION(), LUABIND_ARITY, 0); - } - -#undef LUABIND_ARITY -#undef LUABIND_POLICY_DECL -#undef LUABIND_PARAM - -#endif diff --git a/luabind/detail/overload_rep_base.hpp b/luabind/detail/overload_rep_base.hpp deleted file mode 100644 index 774461f..0000000 --- a/luabind/detail/overload_rep_base.hpp +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) 2003 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_OVERLOAD_REP_BASE_HPP_INCLUDED -#define LUABIND_OVERLOAD_REP_BASE_HPP_INCLUDED - -#include -#include - -struct lua_State; - -namespace luabind { namespace detail -{ - // this class represents a specific overload of a member-function. - struct overload_rep_base - { -#if !defined(NDEBUG) && !defined(LUABIND_NO_ERROR_CHECKING) - overload_rep_base(): m_get_signature_fun(0), m_match_fun(0), m_arity(-1) {} -#else - overload_rep_base(): m_match_fun(0), m_arity(-1) {} -#endif - - typedef boost::function1 match_fun_t; - typedef void(*get_sig_ptr)(lua_State*, std::string&); - - inline int match(lua_State* L, int num_params) const - { - if (num_params != m_arity) return -1; - return m_match_fun(L); - } - - inline void set_match_fun(match_fun_t const& fn) - { - m_match_fun = fn; - } - -#ifndef LUABIND_NO_ERROR_CHECKING - inline void get_signature(lua_State* L, std::string& s) const - { - m_get_signature_fun(L, s); - } - - inline void set_sig_fun(get_sig_ptr f) - { - m_get_signature_fun = f; - } -#endif - - protected: - -#ifndef LUABIND_NO_ERROR_CHECKING - get_sig_ptr m_get_signature_fun; -#endif - -// match_ptr m_match_fun; - match_fun_t m_match_fun; - int m_arity; - }; - -}} // namespace luabind::detail - -#endif // LUABIND_OVERLOAD_REP_BASE_HPP_INCLUDED diff --git a/luabind/detail/policy.hpp b/luabind/detail/policy.hpp index c0475f7..5fdb3b2 100644 --- a/luabind/detail/policy.hpp +++ b/luabind/detail/policy.hpp @@ -28,6 +28,7 @@ #include #include +#include #include #include diff --git a/luabind/make_function.hpp b/luabind/make_function.hpp index 0bfed63..4f8d2a0 100644 --- a/luabind/make_function.hpp +++ b/luabind/make_function.hpp @@ -13,6 +13,7 @@ # include # include +# include namespace luabind { diff --git a/src/class.cpp b/src/class.cpp index 5568c9b..2182ec6 100755 --- a/src/class.cpp +++ b/src/class.cpp @@ -46,17 +46,9 @@ namespace luabind { namespace detail { const char* m_name; - // datamembers, some members may be readonly, and - // only have a getter function - mutable std::map m_getters; - mutable std::map m_setters; - - // the operators in lua - mutable std::vector m_operators[detail::number_of_operators]; mutable std::map m_static_constants; mutable std::vector m_bases; - mutable detail::construct_rep m_constructor; void(*m_destructor)(void*); void(*m_const_holder_destructor)(void*); @@ -147,15 +139,6 @@ namespace luabind { namespace detail { } } - // constructors - m_constructor.swap(crep->m_constructor); - - crep->m_getters.swap(m_getters); - crep->m_setters.swap(m_setters); - - for (int i = 0; i < detail::number_of_operators; ++i) - crep->m_operators[i].swap(m_operators[i]); - crep->m_static_constants.swap(m_static_constants); detail::class_registry* registry = detail::class_registry::get_registry(L); @@ -279,53 +262,11 @@ namespace luabind { namespace detail { m_registration->m_holder_alignment = holder_alignment; } - void class_base::add_getter( - const char* name, const boost::function2& g) - { - detail::class_rep::callback c; - c.func = g; - c.pointer_offset = 0; - - const char* key = name; - m_registration->m_getters[key] = c; - } - -#ifdef LUABIND_NO_ERROR_CHECKING - void class_base::add_setter( - const char* name - , const boost::function2& s) -#else - void class_base::add_setter( - const char* name - , const boost::function2& s - , int (*match)(lua_State*, int) - , void (*get_sig_ptr)(lua_State*, std::string&)) -#endif - { - detail::class_rep::callback c; - c.func = s; - c.pointer_offset = 0; - -#ifndef LUABIND_NO_ERROR_CHECKING - c.match = match; - c.sig = get_sig_ptr; -#endif - - - const char* key = name; - m_registration->m_setters[key] = c; - } - void class_base::add_base(const base_desc& b) { m_registration->m_bases.push_back(b); } - void class_base::add_constructor(const detail::construct_rep::overload_t& o) - { - m_registration->m_constructor.overloads.push_back(o); - } - void class_base::add_member(registration* member) { std::auto_ptr ptr(member); @@ -338,29 +279,6 @@ namespace luabind { namespace detail { m_registration->m_default_members.operator,(scope(ptr)); } -#ifndef LUABIND_NO_ERROR_CHECKING - void class_base::add_operator( - int op_id, int(*func)(lua_State*), int(*matcher)(lua_State*) - , void(*sig)(lua_State*, std::string&), int arity) -#else - void class_base::add_operator( - int op_id, int(*func)(lua_State*) - , int(*matcher)(lua_State*), int arity) -#endif - { - detail::class_rep::operator_callback o; - o.set_fun(func); - o.set_match_fun(matcher); - o.set_arity(arity); - -#ifndef LUABIND_NO_ERROR_CHECKING - - o.set_sig_fun(sig); - -#endif - m_registration->m_operators[op_id].push_back(o); - } - const char* class_base::name() const { return m_registration->m_name; diff --git a/src/class_info.cpp b/src/class_info.cpp index 3a8bc5e..15a73cd 100755 --- a/src/class_info.cpp +++ b/src/class_info.cpp @@ -49,16 +49,6 @@ namespace luabind result.attributes = newtable(L); - typedef detail::class_rep::property_map map_type; - - std::size_t index = 1; - - for (map_type::const_iterator i = obj->crep()->properties().begin(); - i != obj->crep()->properties().end(); ++i, ++index) - { - result.attributes[index] = i->first; - } - return result; } diff --git a/src/class_rep.cpp b/src/class_rep.cpp index 3655cb4..8a68df2 100755 --- a/src/class_rep.cpp +++ b/src/class_rep.cpp @@ -42,27 +42,6 @@ namespace luabind { namespace detail } }} -#ifndef LUABIND_NO_ERROR_CHECKING - - std::string luabind::detail::get_overload_signatures_candidates( - lua_State* L - , std::vector::iterator start - , std::vector::iterator end - , std::string name) - { - std::string s; - for (; start != end; ++start) - { - s += name; - (*start)->get_signature(L, s); - s += "\n"; - } - return s; - } - -#endif - - luabind::detail::class_rep::class_rep(LUABIND_TYPE_INFO type , const char* name , lua_State* L @@ -467,34 +446,6 @@ void luabind::detail::class_rep::add_base_class(const luabind::detail::class_rep class_rep* bcrep = binfo.base; - // import all getters from the base - for (std::map::const_iterator i = bcrep->m_getters.begin(); - i != bcrep->m_getters.end(); ++i) - { - callback& m = m_getters[i->first]; - m.pointer_offset = i->second.pointer_offset + binfo.pointer_offset; - m.func = i->second.func; - -#ifndef LUABIND_NO_ERROR_CHECKING - m.match = i->second.match; - m.sig = i->second.sig; -#endif - } - - // import all setters from the base - for (std::map::const_iterator i = bcrep->m_setters.begin(); - i != bcrep->m_setters.end(); ++i) - { - callback& m = m_setters[i->first]; - m.pointer_offset = i->second.pointer_offset + binfo.pointer_offset; - m.func = i->second.func; - -#ifndef LUABIND_NO_ERROR_CHECKING - m.match = i->second.match; - m.sig = i->second.sig; -#endif - } - // import all static constants for (std::map::const_iterator i = bcrep->m_static_constants.begin(); i != bcrep->m_static_constants.end(); ++i) @@ -503,14 +454,6 @@ void luabind::detail::class_rep::add_base_class(const luabind::detail::class_rep v = i->second; } - // import all operators - for (int i = 0; i < number_of_operators; ++i) - { - for (std::vector::const_iterator j = bcrep->m_operators[i].begin(); - j != bcrep->m_operators[i].end(); ++j) - m_operators[i].push_back(*j); - } - // also, save the baseclass info to be used for typecasts m_bases.push_back(binfo); @@ -812,9 +755,3 @@ bool luabind::detail::class_rep::has_operator_in_lua(lua_State* L, int id) return (m_operator_cache & mask) != 0; } - -const class_rep::property_map& luabind::detail::class_rep::properties() const -{ - return m_getters; -} - diff --git a/src/overload_rep.cpp b/src/overload_rep.cpp deleted file mode 100644 index 9bddbcd..0000000 --- a/src/overload_rep.cpp +++ /dev/null @@ -1,39 +0,0 @@ -// 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. - -#define LUABIND_BUILDING - -#include - -namespace luabind { namespace detail -{ - int overload_rep::call(lua_State* L, bool force_static_call) const - { - if (force_static_call) - return call_fun_static(L); - else - return call_fun(L); - } - -}} // namespace luabind::detail - - -- 2.11.4.GIT