Permalink
Browse files

Updated luabind to 0.9.1

  • Loading branch information...
1 parent 0b388fc commit f90c3b93521a6f7c7f3f82b5430c18e3d228df62 Yohann Ferreira committed Aug 20, 2012
Showing with 277 additions and 471 deletions.
  1. 0 src/luabind/INSTALL
  2. 0 src/luabind/LICENSE
  3. 0 src/luabind/doc/building.rst
  4. 0 src/luabind/doc/changes.txt
  5. +205 −205 src/luabind/doc/docs.html
  6. 0 src/luabind/doc/index.html
  7. BIN src/luabind/doc/luabind-logo-label.ps
  8. 0 src/luabind/doc/style.css
  9. +1 −1 src/luabind/doc/version.rst
  10. 0 src/luabind/examples/cln/README
  11. 0 src/luabind/examples/cln/cln_test.lua
  12. 0 src/luabind/examples/filesystem/directory_iterator.hpp
  13. 0 src/luabind/examples/filesystem/filesystem.cpp
  14. 0 src/luabind/examples/glut/glut_bindings.lua
  15. 0 src/luabind/examples/hello_world/README
  16. 0 src/luabind/examples/hello_world/hello_world.cpp
  17. 0 src/luabind/examples/hello_world/project-root.jam
  18. 0 src/luabind/examples/regexp/regex.lua
  19. 0 src/luabind/luabind/back_reference.hpp
  20. 0 src/luabind/luabind/back_reference_fwd.hpp
  21. +0 −1 src/luabind/luabind/class.hpp
  22. 0 src/luabind/luabind/class_info.hpp
  23. 0 src/luabind/luabind/detail/call_operator_iterate.hpp
  24. 0 src/luabind/luabind/detail/class_cache.hpp
  25. +3 −1 src/luabind/luabind/detail/constructor.hpp
  26. 0 src/luabind/luabind/detail/debug.hpp
  27. +2 −9 src/luabind/luabind/detail/format_signature.hpp
  28. +0 −218 src/luabind/luabind/detail/get_signature.hpp
  29. 0 src/luabind/luabind/detail/has_get_pointer.hpp
  30. +1 −1 src/luabind/luabind/detail/instance_holder.hpp
  31. 0 src/luabind/luabind/detail/is_indirect_const.hpp
  32. 0 src/luabind/luabind/detail/link_compatibility.hpp
  33. 0 src/luabind/luabind/detail/most_derived.hpp
  34. 0 src/luabind/luabind/detail/object_call.hpp
  35. +1 −1 src/luabind/luabind/detail/object_rep.hpp
  36. 0 src/luabind/luabind/detail/pcall.hpp
  37. 0 src/luabind/luabind/detail/pointee_sizeof.hpp
  38. 0 src/luabind/luabind/detail/pointee_typeid.hpp
  39. 0 src/luabind/luabind/detail/stack_utils.hpp
  40. 0 src/luabind/luabind/detail/yes_no.hpp
  41. 0 src/luabind/luabind/error.hpp
  42. 0 src/luabind/luabind/from_stack.hpp
  43. 0 src/luabind/luabind/get_pointer.hpp
  44. +9 −0 src/luabind/luabind/handle.hpp
  45. 0 src/luabind/luabind/iterator_policy.hpp
  46. +6 −0 src/luabind/luabind/lua_include.hpp
  47. +6 −1 src/luabind/luabind/make_function.hpp
  48. +2 −2 src/luabind/luabind/object.hpp
  49. 0 src/luabind/luabind/open.hpp
  50. +1 −1 src/luabind/luabind/operator.hpp
  51. 0 src/luabind/luabind/prefix.hpp
  52. 0 src/luabind/luabind/raw_policy.hpp
  53. +2 −0 src/luabind/luabind/scope.hpp
  54. +1 −1 src/luabind/luabind/shared_ptr_converter.hpp
  55. 0 src/luabind/luabind/value_wrapper.hpp
  56. +1 −1 src/luabind/luabind/weak_ref.hpp
  57. 0 src/luabind/luabind/wrapper_base.hpp
  58. 0 src/luabind/luabind/yield_policy.hpp
  59. +1 −1 src/luabind/src/class.cpp
  60. 0 src/luabind/src/class_info.cpp
  61. 0 src/luabind/src/class_registry.cpp
  62. +1 −7 src/luabind/src/class_rep.cpp
  63. 0 src/luabind/src/create_class.cpp
  64. 0 src/luabind/src/error.cpp
  65. +7 −7 src/luabind/src/inheritance.cpp
  66. 0 src/luabind/src/link_compatibility.cpp
  67. 0 src/luabind/src/object_rep.cpp
  68. +3 −3 src/luabind/src/open.cpp
  69. 0 src/luabind/src/pcall.cpp
  70. +8 −0 src/luabind/src/scope.cpp
  71. 0 src/luabind/src/stack_content_by_name.cpp
  72. +9 −9 src/luabind/src/weak_ref.cpp
  73. 0 src/luabind/src/wrapper_base.cpp
  74. 0 src/luabind/test/test.hpp
  75. 0 src/luabind/test/test_abstract_base.cpp
  76. 0 src/luabind/test/test_back_reference.cpp
  77. 0 src/luabind/test/test_def_from_base.cpp
  78. +7 −1 src/luabind/test/test_exceptions.cpp
  79. 0 src/luabind/test/test_has_get_pointer.cpp
  80. 0 src/luabind/test/test_iterator.cpp
  81. 0 src/luabind/test/test_scope.cpp
  82. 0 src/luabind/test/test_separation.cpp
  83. 0 src/luabind/test/test_simple_class.cpp
  84. 0 src/luabind/test/test_value_wrapper.cpp
  85. 0 src/luabind/test/test_vector_of_object.cpp
  86. 0 src/luabind/test/test_yield.cpp
View
0 src/luabind/INSTALL 100755 → 100644
No changes.
View
0 src/luabind/LICENSE 100755 → 100644
No changes.
View
0 src/luabind/doc/building.rst 100755 → 100644
No changes.
View
0 src/luabind/doc/changes.txt 100755 → 100644
No changes.
View
410 src/luabind/doc/docs.html 100755 → 100644
Oops, something went wrong.
View
0 src/luabind/doc/index.html 100755 → 100644
No changes.
View
No changes.
View
0 src/luabind/doc/style.css 100755 → 100644
No changes.
View
2 src/luabind/doc/version.rst 100755 → 100644
@@ -1 +1 @@
-.. |version| replace:: 0.9
+.. |version| replace:: 0.9.1
View
No changes.
View
No changes.
No changes.
View
No changes.
View
No changes.
View
No changes.
No changes.
No changes.
View
No changes.
View
No changes.
View
No changes.
@@ -106,7 +106,6 @@
#include <luabind/detail/calc_arity.hpp>
#include <luabind/detail/call_member.hpp>
#include <luabind/detail/enum_maker.hpp>
-#include <luabind/detail/get_signature.hpp>
#include <luabind/detail/operator_id.hpp>
#include <luabind/detail/pointee_typeid.hpp>
#include <luabind/detail/link_compatibility.hpp>
View
No changes.
No changes.
View
No changes.
@@ -25,7 +25,7 @@ inline void inject_backref(lua_State*, void*, void*)
template <class T>
void inject_backref(lua_State* L, T* p, wrap_base*)
{
- weak_ref(get_main_thread(L), 1).swap(wrap_access::ref(*p));
+ weak_ref(get_main_thread(L), L, 1).swap(wrap_access::ref(*p));
}
template <std::size_t Arity, class T, class Pointer, class Signature>
@@ -105,5 +105,7 @@ struct construct_aux<N, T, Pointer, Signature>
}
};
+# undef N
+
#endif
View
No changes.
@@ -13,20 +13,13 @@
# include <boost/mpl/next.hpp>
# include <boost/mpl/size.hpp>
-namespace luabind { namespace adl
-{
+namespace luabind {
class object;
class argument;
template <class Base>
struct table;
-} // namespace adl
-
-using adl::object;
-using adl::argument;
-using adl::table;
-
} // namespace luabind
namespace luabind { namespace detail {
@@ -146,7 +139,7 @@ void format_signature(lua_State* L, char const* function, Signature)
);
lua_pushstring(L, ")");
- lua_concat(L, mpl::size<Signature>() * 2 + 2);
+ lua_concat(L, static_cast<int>(mpl::size<Signature>()) * 2 + 2);
}
}} // namespace luabind::detail
@@ -1,218 +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_NO_ERROR_CHECKING
-
-#if !BOOST_PP_IS_ITERATING
-
-#ifndef LUABIND_GET_SIGNATURE_HPP_INCLUDED
-#define LUABIND_GET_SIGNATURE_HPP_INCLUDED
-
-#include <boost/config.hpp>
-#include <boost/preprocessor/repeat.hpp>
-#include <boost/preprocessor/iteration/iterate.hpp>
-#include <boost/preprocessor/repetition/enum.hpp>
-#include <boost/preprocessor/repetition/enum_params.hpp>
-#include <boost/preprocessor/punctuation/comma_if.hpp>
-#include <boost/preprocessor/cat.hpp>
-
-#include <luabind/config.hpp>
-#include <luabind/detail/signature_match.hpp>
-#include <luabind/typeid.hpp>
-
-
-namespace luabind { namespace detail
-{
-
- std::string LUABIND_API get_class_name(lua_State* L, type_id const& i);
-
- template<class T>
- std::string name_of_type(by_value<T>, lua_State* L, int) { return luabind::detail::get_class_name(L, typeid(T)); };
- template<class T>
- std::string name_of_type(by_reference<T>, lua_State* L, int) { return name_of_type(LUABIND_DECORATE_TYPE(T), L, 0L) + "&"; };
- template<class T>
- std::string name_of_type(by_pointer<T>, lua_State* L, int) { return name_of_type(LUABIND_DECORATE_TYPE(T), L, 0L) + "*"; };
- template<class T>
- std::string name_of_type(by_const_reference<T>, lua_State* L, int) { return "const " + name_of_type(LUABIND_DECORATE_TYPE(T), L, 0L) + "&"; };
- template<class T>
- std::string name_of_type(by_const_pointer<T>, lua_State* L, int) { return "const " + name_of_type(LUABIND_DECORATE_TYPE(T), L, 0L) + "*"; };
-
- inline std::string name_of_type(by_value<luabind::object>, lua_State*, int) { return "object"; };
- inline std::string name_of_type(by_const_reference<luabind::object>, lua_State*, int) { return "object"; };
- inline std::string name_of_type(by_value<bool>, lua_State*, int) { return "boolean"; }
- inline std::string name_of_type(by_value<char>, lua_State*, int) { return "number"; }
- inline std::string name_of_type(by_value<short>, lua_State*, int) { return "number"; }
- inline std::string name_of_type(by_value<int>, lua_State*, int) { return "number"; }
- inline std::string name_of_type(by_value<long>, lua_State*, int) { return "number"; }
- inline std::string name_of_type(by_value<unsigned char>, lua_State*, int) { return "number"; }
- inline std::string name_of_type(by_value<unsigned short>, lua_State*, int) { return "number"; }
- inline std::string name_of_type(by_value<unsigned int>, lua_State*, int) { return "number"; }
- inline std::string name_of_type(by_value<unsigned long>, lua_State*, int) { return "number"; }
-
- inline std::string name_of_type(by_value<const bool>, lua_State*, int) { return "boolean"; }
- inline std::string name_of_type(by_value<const char>, lua_State*, int) { return "number"; }
- inline std::string name_of_type(by_value<const short>, lua_State*, int) { return "number"; }
- inline std::string name_of_type(by_value<const int>, lua_State*, int) { return "number"; }
- inline std::string name_of_type(by_value<const long>, lua_State*, int) { return "number"; }
- inline std::string name_of_type(by_value<const unsigned char>, lua_State*, int) { return "number"; }
- inline std::string name_of_type(by_value<const unsigned short>, lua_State*, int) { return "number"; }
- inline std::string name_of_type(by_value<const unsigned int>, lua_State*, int) { return "number"; }
- inline std::string name_of_type(by_value<const unsigned long>, lua_State*, int) { return "number"; }
-
-// template<class T>
-// inline std::string name_of_type(by_value<luabind::functor<T> >, lua_State* L, long) { return "function<" + name_of_type(LUABIND_DECORATE_TYPE(T), L, 0L) + ">"; }
-
- inline std::string name_of_type(by_value<std::string>, lua_State*, int) { return "string"; }
- inline std::string name_of_type(by_const_pointer<char>, lua_State*, int) { return "string"; }
- inline std::string name_of_type(by_pointer<lua_State>, lua_State*, int) { return "lua_State*"; }
-
- template<class T>
- struct type_name_unless_void
- {
- inline static void apply(std::string& s, lua_State* L, bool first)
- {
- if (!first) s += ", ";
- s += name_of_type(LUABIND_DECORATE_TYPE(T), L, 0L);
- }
- };
-
- template<>
- struct type_name_unless_void<null_type>
- {
- inline static void apply(std::string&, lua_State*, bool) {}
- };
-
-#define LUABIND_ADD_LUA_TYPE_NAME(z, n, _) type_name_unless_void<BOOST_PP_CAT(A, BOOST_PP_INC(n))>::apply(s, L, false);
-
- #define BOOST_PP_ITERATION_PARAMS_1 (4, (0, LUABIND_MAX_ARITY, <luabind/detail/get_signature.hpp>, 1))
- #include BOOST_PP_ITERATE()
-
- template<class F>
- struct get_member_signature
- {
- static inline void apply(lua_State* L, std::string& s)
- {
- get_member_signature_impl(static_cast<F>(0), L, s);
- }
- };
-
- template<class F>
- struct get_free_function_signature
- {
- static inline void apply(lua_State* L, std::string& s)
- {
- get_free_function_signature_impl(static_cast<F>(0), L, s);
- }
- };
-
-
- template<class Sig>
- struct get_signature
- {
- static inline void apply(lua_State* L, std::string& s)
- {
- get_signature_impl(static_cast<const Sig*>(0), L, s);
- }
- };
-
- template<BOOST_PP_ENUM_PARAMS(LUABIND_MAX_ARITY, class A)>
- inline void get_signature_impl(const constructor<BOOST_PP_ENUM_PARAMS(LUABIND_MAX_ARITY, A)>*, lua_State* L, std::string& s)
- {
- s += "(";
- type_name_unless_void<A0>::apply(s, L, true);
- BOOST_PP_REPEAT(BOOST_PP_DEC(LUABIND_MAX_ARITY), LUABIND_ADD_LUA_TYPE_NAME, _)
- s += ")";
- }
-
-#undef LUABIND_ADD_LUA_TYPE_NAME
-
- template<class T>
- struct get_setter_signature
- {
- static void apply(lua_State* L, std::string& s)
- {
- s += "(";
- s += name_of_type(LUABIND_DECORATE_TYPE(T), L, 0L);
- s += ")";
- }
- };
-
-}}
-
-#endif // LUABIND_GET_SIGNATURE_HPP_INCLUDED
-
-#else
-#if BOOST_PP_ITERATION_FLAGS() == 1
-
- // member functions
- template<class T, class C BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), class A)>
- inline void get_member_signature_impl(T(C::*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), A)), lua_State* L, std::string& s)
- {
- s += "(";
-#if BOOST_PP_ITERATION() > 0
- s += name_of_type(LUABIND_DECORATE_TYPE(A0), L, 0L);
- BOOST_PP_REPEAT(BOOST_PP_DEC(BOOST_PP_ITERATION()), LUABIND_ADD_LUA_TYPE_NAME, _)
-#endif
- s += ")";
- }
-
- template<class T, class C BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), class A)>
- inline void get_member_signature_impl(T(C::*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), A)) const, lua_State* L, std::string& s)
- {
- (void)L;
- s += "(";
-#if BOOST_PP_ITERATION() > 0
- s += name_of_type(LUABIND_DECORATE_TYPE(A0), L, 0L);
- BOOST_PP_REPEAT(BOOST_PP_DEC(BOOST_PP_ITERATION()), LUABIND_ADD_LUA_TYPE_NAME, _)
-#endif
- s += ") const";
- }
-
- // const C& obj
- template<class T BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), class A)>
- inline void get_member_signature_impl(T(*f)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), A)), lua_State* L, std::string& s)
- {
- s += "(";
-#if BOOST_PP_ITERATION() > 0
- s += name_of_type(LUABIND_DECORATE_TYPE(A0), L, 0L);
- BOOST_PP_REPEAT(BOOST_PP_DEC(BOOST_PP_ITERATION()), LUABIND_ADD_LUA_TYPE_NAME, _)
-#endif
- s += ")";
- }
-
- // free functions
- template<class T BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), class A)>
- inline void get_free_function_signature_impl(T(*f)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), A)), lua_State* L, std::string& s)
- {
- (void)f;
- s += "(";
-#if BOOST_PP_ITERATION() > 0
- s += name_of_type(LUABIND_DECORATE_TYPE(A0), L, 0L);
- BOOST_PP_REPEAT(BOOST_PP_DEC(BOOST_PP_ITERATION()), LUABIND_ADD_LUA_TYPE_NAME, _)
-#endif
- s += ")";
- }
-
-#endif
-#endif
-
-#endif // LUABIND_NO_ERROR_CHECKING
View
No changes.
@@ -98,7 +98,7 @@ class pointer_holder : public instance_holder
weak ? weak : get_pointer(p)));
if (!naked_ptr)
- return std::pair<void*, int>(0, 0);
+ return std::pair<void*, int>((void*)0, 0);
return get_class()->casts().cast(
naked_ptr
No changes.
No changes.
View
No changes.
View
No changes.
@@ -55,7 +55,7 @@ namespace luabind { namespace detail
std::pair<void*, int> get_instance(class_id target) const
{
if (m_instance == 0)
- return std::pair<void*, int>(0, -1);
+ return std::pair<void*, int>((void*)0, -1);
return m_instance->get(target);
}
View
No changes.
View
No changes.
View
No changes.
View
No changes.
View
No changes.
View
No changes.
View
No changes.
View
No changes.
View
@@ -35,6 +35,7 @@ class handle
public:
handle();
handle(lua_State* interpreter, int stack_index);
+ handle(lua_State* main, lua_State* interpreter, int stack_index);
handle(handle const& other);
~handle();
@@ -74,6 +75,14 @@ inline handle::handle(lua_State* interpreter, int stack_index)
m_index = luaL_ref(interpreter, LUA_REGISTRYINDEX);
}
+inline handle::handle(lua_State* main, lua_State* interpreter, int stack_index)
+ : m_interpreter(main)
+ , m_index(LUA_NOREF)
+{
+ lua_pushvalue(interpreter, stack_index);
+ m_index = luaL_ref(interpreter, LUA_REGISTRYINDEX);
+}
+
inline handle::~handle()
{
if (m_interpreter && m_index != LUA_NOREF)
View
No changes.
View
@@ -23,11 +23,17 @@
#ifndef LUA_INCLUDE_HPP_INCLUDED
#define LUA_INCLUDE_HPP_INCLUDED
+#ifndef LUABIND_CPLUSPLUS_LUA
extern "C"
{
+#endif
+
#include "lua.h"
#include "lauxlib.h"
+
+#ifndef LUABIND_CPLUSPLUS_LUA
}
+#endif
#endif
@@ -56,16 +56,21 @@ namespace detail
int results = 0;
# ifndef LUABIND_NO_EXCEPTIONS
+ bool exception_caught = false;
+
try
{
results = invoke(
L, *impl, ctx, impl->f, Signature(), impl->policies);
}
catch (...)
{
+ exception_caught = true;
handle_exception_aux(L);
- lua_error(L);
}
+
+ if (exception_caught)
+ lua_error(L);
# else
results = invoke(L, *impl, ctx, impl->f, Signature(), impl->policies);
# endif
@@ -225,7 +225,7 @@ LUABIND_BINARY_OP_DEF(<, lua_lessthan)
value_wrapper_traits<ValueWrapper>::unwrap(interpreter
, static_cast<ValueWrapper const&>(v));
char const* p = lua_tostring(interpreter, -1);
- int len = lua_strlen(interpreter, -1);
+ std::size_t len = lua_strlen(interpreter, -1);
std::copy(p, p + len, std::ostream_iterator<char>(os));
return os;
}
@@ -257,7 +257,7 @@ LUABIND_BINARY_OP_DEF(<, lua_lessthan)
typename enable_binary<bool,LHS,RHS>::type
operator!=(LHS const& lhs, RHS const& rhs)
{
- return !(lhs < rhs);
+ return !(lhs == rhs);
}
template<class ValueWrapper, class Arguments>
View
0 src/luabind/luabind/open.hpp 100644 → 100755
No changes.
View
@@ -335,7 +335,7 @@ namespace luabind {
s << x;
#endif
return s.str();
- };
+ }
LUABIND_UNARY_OPERATOR(tostring, tostring_operator, tostring)
LUABIND_UNARY_OPERATOR(unm, -, operator-)
View
No changes.
View
No changes.
View
@@ -60,6 +60,8 @@ namespace luabind {
scope(scope const& other_);
~scope();
+ scope& operator=(scope const& other_);
+
scope& operator,(scope s);
void register_(lua_State* L) const;
Oops, something went wrong.

0 comments on commit f90c3b9

Please sign in to comment.