From 77a28298d480dde3941ebcb01e7b0faaab3c0366 Mon Sep 17 00:00:00 2001 From: Daniel Wallin Date: Sat, 20 Mar 2004 19:58:07 +0000 Subject: [PATCH] *** empty log message *** --- doc/docs.rst | 32 ++++++++++++++++++++++++++++++++ luabind/detail/call_function.hpp | 13 +++++++------ luabind/detail/call_member.hpp | 23 ++++++++++++----------- luabind/detail/property.hpp | 8 ++++---- luabind/functor.hpp | 11 ++++++----- luabind/object.hpp | 9 +++++---- 6 files changed, 66 insertions(+), 30 deletions(-) diff --git a/doc/docs.rst b/doc/docs.rst index f9bfc11..49908fb 100755 --- a/doc/docs.rst +++ b/doc/docs.rst @@ -2146,3 +2146,35 @@ I cannot register a function with a non-const parameter This is because there is no way to get a reference to a lua value. Have a look at out_value and pure_out_value policies. + +Known issues +============ + +- You cannot use strings with extra nulls in them as member names that refers + to C++ members. + +- If one class registers two functions with the same name and the same + signature, there's currently no error. The last registered function will + be the one that's used. + +- In vc7, classes can not be called test. + +.. remove? - Visual studio have problems selecting the correct overload of std::swap() + for luabind::object. + +- If you register a function and later rename it, error messages will use the + original function name. + + +Acknowledgments +=============== + +This library was written by Daniel Wallin and Arvid Norberg. © Copyright 2003. +All rights reserved. + +This library was inspired by Dave Abrahams' Boost.Python library which can be +found in the boost_ library. + +Evan Wies has contributed with thorough testing and countless bug reports and +feature ideas. + diff --git a/luabind/detail/call_function.hpp b/luabind/detail/call_function.hpp index 48cddb6..c4951fb 100644 --- a/luabind/detail/call_function.hpp +++ b/luabind/detail/call_function.hpp @@ -38,8 +38,9 @@ #include #include -#include #include +#include +#include namespace luabind { @@ -84,7 +85,7 @@ namespace luabind lua_gettable(L, LUA_GLOBALSINDEX); push_args_from_tuple<1>::apply(L, m_args); - if (lua_pcall(L, boost::tuples::length::value, 0, 0)) + if (pcall(L, boost::tuples::length::value, 0)) { #ifndef LUABIND_NO_EXCEPTIONS throw luabind::error(L); @@ -113,7 +114,7 @@ namespace luabind lua_gettable(L, LUA_GLOBALSINDEX); push_args_from_tuple<1>::apply(L, m_args); - if (lua_pcall(L, boost::tuples::length::value, 1, 0)) + if (pcall(L, boost::tuples::length::value, 1)) { #ifndef LUABIND_NO_EXCEPTIONS throw luabind::error(L); @@ -162,7 +163,7 @@ namespace luabind lua_gettable(L, LUA_GLOBALSINDEX); detail::push_args_from_tuple<1>::apply(L, m_args, p); - if (lua_pcall(L, boost::tuples::length::value, 1, 0)) + if (pcall(L, boost::tuples::length::value, 1)) { #ifndef LUABIND_NO_EXCEPTIONS throw error(L); @@ -241,7 +242,7 @@ namespace luabind lua_gettable(L, LUA_GLOBALSINDEX); push_args_from_tuple<1>::apply(L, m_args); - if (lua_pcall(L, boost::tuples::length::value, 0, 0)) + if (pcall(L, boost::tuples::length::value, 0)) { #ifndef LUABIND_NO_EXCEPTIONS throw luabind::error(L); @@ -267,7 +268,7 @@ namespace luabind lua_gettable(L, LUA_GLOBALSINDEX); detail::push_args_from_tuple<1>::apply(L, m_args, p); - if (lua_pcall(L, boost::tuples::length::value, 0, 0)) + if (pcall(L, boost::tuples::length::value, 0)) { #ifndef LUABIND_NO_EXCEPTIONS throw error(L); diff --git a/luabind/detail/call_member.hpp b/luabind/detail/call_member.hpp index 72f49ad..29c2e3b 100644 --- a/luabind/detail/call_member.hpp +++ b/luabind/detail/call_member.hpp @@ -28,6 +28,7 @@ #include #include +#include #include namespace luabind @@ -45,7 +46,7 @@ namespace luabind // friend class luabind::object; public: - proxy_member_caller(luabind::object* o, const char* name, const Tuple args) + proxy_member_caller(luabind::object const* o, const char* name, const Tuple args) : m_obj(o) , m_member_name(name) , m_args(args) @@ -79,7 +80,7 @@ namespace luabind m_obj->pushvalue(); push_args_from_tuple<1>::apply(L, m_args); - if (lua_pcall(L, boost::tuples::length::value + 1, 0, 0)) + if (pcall(L, boost::tuples::length::value + 1, 0)) { #ifndef LUABIND_NO_EXCEPTIONS throw luabind::error(L); @@ -111,7 +112,7 @@ namespace luabind m_obj->pushvalue(); push_args_from_tuple<1>::apply(L, m_args); - if (lua_pcall(L, boost::tuples::length::value + 1, 1, 0)) + if (pcall(L, boost::tuples::length::value + 1, 1)) { #ifndef LUABIND_NO_EXCEPTIONS throw luabind::error(L); @@ -163,7 +164,7 @@ namespace luabind m_obj->pushvalue(); detail::push_args_from_tuple<1>::apply(L, m_args, p); - if (lua_pcall(L, boost::tuples::length::value + 1, 1, 0)) + if (pcall(L, boost::tuples::length::value + 1, 1)) { #ifndef LUABIND_NO_EXCEPTIONS throw error(L); @@ -198,7 +199,7 @@ namespace luabind private: - luabind::object* m_obj; + luabind::object const* m_obj; const char* m_member_name; Tuple m_args; mutable bool m_called; @@ -212,7 +213,7 @@ namespace luabind friend class luabind::object; public: - proxy_member_void_caller(luabind::object* o, const char* name, const Tuple args) + proxy_member_void_caller(luabind::object const* o, const char* name, const Tuple args) : m_obj(o) , m_member_name(name) , m_args(args) @@ -246,7 +247,7 @@ namespace luabind m_obj->pushvalue(); push_args_from_tuple<1>::apply(L, m_args); - if (lua_pcall(L, boost::tuples::length::value + 1, 0, 0)) + if (pcall(L, boost::tuples::length::value + 1, 0)) { #ifndef LUABIND_NO_EXCEPTIONS throw luabind::error(L); @@ -278,7 +279,7 @@ namespace luabind detail::push_args_from_tuple<1>::apply(L, m_args, p); - if (lua_pcall(L, boost::tuples::length::value + 1, 0, 0)) + if (pcall(L, boost::tuples::length::value + 1, 0)) { #ifndef LUABIND_NO_EXCEPTIONS throw error(L); @@ -295,7 +296,7 @@ namespace luabind private: - luabind::object* m_obj; + luabind::object const* m_obj; const char* m_member_name; Tuple m_args; mutable bool m_called; @@ -321,7 +322,7 @@ namespace luabind typename boost::mpl::if_ , luabind::detail::proxy_member_void_caller > , luabind::detail::proxy_member_caller > >::type - call_member(luabind::object& obj, const char* name BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_OPERATOR_PARAMS, _)) + call_member(luabind::object const& obj, const char* name BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_OPERATOR_PARAMS, _)) { typedef boost::tuples::tuple tuple_t; #if BOOST_PP_ITERATION() == 0 @@ -334,7 +335,7 @@ namespace luabind , luabind::detail::proxy_member_void_caller > , luabind::detail::proxy_member_caller > >::type proxy_type; - return proxy_type(const_cast(&obj), name, args); + return proxy_type(&obj, name, args); } #undef LUABIND_OPERATOR_PARAMS diff --git a/luabind/detail/property.hpp b/luabind/detail/property.hpp index 39597ca..68f1257 100644 --- a/luabind/detail/property.hpp +++ b/luabind/detail/property.hpp @@ -72,8 +72,8 @@ namespace luabind { namespace detail } }; - template - int set(void(T::*f)(A1), T* obj, lua_State* L, Policies* policies) { return returns::call(f, obj, L, policies); } + template + int set(R(T::*f)(A1), T* obj, lua_State* L, Policies* policies) { return returns::call(f, obj, L, policies); } /* template int set(void(*f)(T*, A1), T* obj, lua_State* L, Policies* policies) { return returns::call(f, obj, L, policies); } @@ -82,8 +82,8 @@ namespace luabind { namespace detail int set(void(*f)(T&, A1), T* obj, lua_State* L, Policies* policies) { return returns::call(f, obj, L, policies); } */ - template - int set(void(*f)(T, A1), U* obj, lua_State* L, Policies* policies) { return returns::call(f, obj, L, policies); } + template + int set(R(*f)(T, A1), U* obj, lua_State* L, Policies* policies) { return returns::call(f, obj, L, policies); } template struct set_caller : Policies diff --git a/luabind/functor.hpp b/luabind/functor.hpp index 86df01f..b0deeb1 100644 --- a/luabind/functor.hpp +++ b/luabind/functor.hpp @@ -36,6 +36,7 @@ #include #include #include +#include #include namespace luabind @@ -82,7 +83,7 @@ namespace luabind m_func->pushvalue(); push_args_from_tuple<1>::apply(L, m_args); - if (lua_pcall(L, boost::tuples::length::value, 0, 0)) + if (pcall(L, boost::tuples::length::value, 0)) { #ifndef LUABIND_NO_EXCEPTIONS throw luabind::error(L); @@ -126,7 +127,7 @@ namespace luabind m_func->pushvalue(); push_args_from_tuple<1>::apply(L, m_args); - if (lua_pcall(L, boost::tuples::length::value, 1, 0)) + if (pcall(L, boost::tuples::length::value, 1)) { #ifndef LUABIND_NO_EXCEPTIONS throw luabind::error(L); @@ -189,7 +190,7 @@ namespace luabind m_func->pushvalue(); detail::push_args_from_tuple<1>::apply(L, m_args, p); - if (lua_pcall(L, boost::tuples::length::value, 1, 0)) + if (pcall(L, boost::tuples::length::value, 1)) { #ifndef LUABIND_NO_EXCEPTIONS throw error(L); @@ -279,7 +280,7 @@ namespace luabind m_func->pushvalue(); push_args_from_tuple<1>::apply(L, m_args); - if (lua_pcall(L, boost::tuples::length::value, 0, 0)) + if (pcall(L, boost::tuples::length::value, 0)) { #ifndef LUABIND_NO_EXCEPTIONS throw luabind::error(L); @@ -320,7 +321,7 @@ namespace luabind m_func->pushvalue(); detail::push_args_from_tuple<1>::apply(L, m_args, p); - if (lua_pcall(L, boost::tuples::length::value, 0, 0)) + if (pcall(L, boost::tuples::length::value, 0)) { #ifndef LUABIND_NO_EXCEPTIONS throw error(L); diff --git a/luabind/object.hpp b/luabind/object.hpp index ceb0b5e..8798dc9 100644 --- a/luabind/object.hpp +++ b/luabind/object.hpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -116,7 +117,7 @@ namespace luabind lua_State* L = m_obj->lua_state(); m_obj->pushvalue(); detail::push_args_from_tuple<1>::apply(L, m_args, p); - if (lua_pcall(L, boost::tuples::length::value, 1, 0)) + if (pcall(L, boost::tuples::length::value, 1)) { #ifndef LUABIND_NO_EXCEPTIONS throw error(L); @@ -1181,7 +1182,7 @@ private: lua_State* L = m_obj->lua_state(); m_obj->pushvalue(); detail::push_args_from_tuple<1>::apply(L, m_args, p); - if (lua_pcall(L, boost::tuples::length::value, 1, 0)) + if (pcall(L, boost::tuples::length::value, 1)) { #ifndef LUABIND_NO_EXCEPTIONS throw error(L); @@ -1303,7 +1304,7 @@ private: m_obj->pushvalue(); push_args_from_tuple<1>::apply(L, m_args); - if (lua_pcall(L, boost::tuples::length::value, 0, 0)) + if (pcall(L, boost::tuples::length::value, 0)) { #ifndef LUABIND_NO_EXCEPTIONS throw luabind::error(L); @@ -1326,7 +1327,7 @@ private: m_obj->pushvalue(); push_args_from_tuple<1>::apply(L, m_args); - if (lua_pcall(L, boost::tuples::length::value, 1, 0)) + if (pcall(L, boost::tuples::length::value, 1)) { #ifndef LUABIND_NO_EXCEPTIONS throw luabind::error(L); -- 2.11.4.GIT