config.hpp 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. // Copyright (c) 2003 Daniel Wallin and Arvid Norberg
  2. // Permission is hereby granted, free of charge, to any person obtaining a
  3. // copy of this software and associated documentation files (the "Software"),
  4. // to deal in the Software without restriction, including without limitation
  5. // the rights to use, copy, modify, merge, publish, distribute, sublicense,
  6. // and/or sell copies of the Software, and to permit persons to whom the
  7. // Software is furnished to do so, subject to the following conditions:
  8. // The above copyright notice and this permission notice shall be included
  9. // in all copies or substantial portions of the Software.
  10. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
  11. // ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
  12. // TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
  13. // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
  14. // SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
  15. // ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  16. // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  17. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
  18. // OR OTHER DEALINGS IN THE SOFTWARE.
  19. #ifndef LUABIND_CONFIG_HPP_INCLUDED
  20. #define LUABIND_CONFIG_HPP_INCLUDED
  21. #include <boost/config.hpp>
  22. #ifdef BOOST_MSVC
  23. #define LUABIND_ANONYMOUS_FIX static
  24. #else
  25. #define LUABIND_ANONYMOUS_FIX
  26. #endif
  27. #if defined (BOOST_MSVC) && (BOOST_MSVC <= 1200)
  28. #define for if (false) {} else for
  29. #include <cstring>
  30. namespace std
  31. {
  32. using ::strlen;
  33. using ::strcmp;
  34. using ::type_info;
  35. }
  36. #endif
  37. #if defined (BOOST_MSVC) && (BOOST_MSVC <= 1300)
  38. #define LUABIND_MSVC_TYPENAME
  39. #else
  40. #define LUABIND_MSVC_TYPENAME typename
  41. #endif
  42. // the maximum number of arguments of functions that's
  43. // registered. Must at least be 2
  44. #ifndef LUABIND_MAX_ARITY
  45. #define LUABIND_MAX_ARITY 10
  46. #elif LUABIND_MAX_ARITY <= 1
  47. #undef LUABIND_MAX_ARITY
  48. #define LUABIND_MAX_ARITY 2
  49. #endif
  50. // the maximum number of classes one class
  51. // can derive from
  52. // max bases must at least be 1
  53. #ifndef LUABIND_MAX_BASES
  54. #define LUABIND_MAX_BASES 4
  55. #elif LUABIND_MAX_BASES <= 0
  56. #undef LUABIND_MAX_BASES
  57. #define LUABIND_MAX_BASES 1
  58. #endif
  59. // LUABIND_NO_ERROR_CHECKING
  60. // define this to remove all error checks
  61. // this will improve performance and memory
  62. // footprint.
  63. // if it is defined matchers will only be called on
  64. // overloaded functions, functions that's
  65. // not overloaded will be called directly. The
  66. // parameters on the lua stack are assumed
  67. // to match those of the function.
  68. // exceptions will still be catched when there's
  69. // no error checking.
  70. // LUABIND_NOT_THREADSAFE
  71. // this define will make luabind non-thread safe. That is,
  72. // it will rely on a static variable. You can still have
  73. // multiple lua states and use coroutines, but only
  74. // one of your real threads may run lua code.
  75. // LUABIND_NO_EXCEPTIONS
  76. // this define will disable all usage of try, catch and throw in
  77. // luabind. This will in many cases disable runtime-errors, such
  78. // as invalid casts, when calling lua-functions that fails or
  79. // returns values that cannot be converted by the given policy.
  80. // Luabind requires that no function called directly or indirectly
  81. // by luabind throws an exception (throwing exceptions through
  82. // C code has undefined behavior, lua is written in C).
  83. #ifdef LUABIND_DYNAMIC_LINK
  84. # ifdef BOOST_WINDOWS
  85. # ifdef LUABIND_BUILDING
  86. # define LUABIND_API __declspec(dllexport)
  87. # else
  88. # define LUABIND_API __declspec(dllimport)
  89. # endif
  90. # else
  91. # if defined(_GNUC_) && _GNUC_ >=4
  92. # define LUABIND_API __attribute__ ((visibility("default")))
  93. # endif
  94. # endif
  95. #endif
  96. #ifndef LUABIND_API
  97. # define LUABIND_API
  98. #endif
  99. #if !defined(LUABIND_CPP0x) \
  100. && !defined(BOOST_NO_DECLTYPE) \
  101. && !defined(BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS) \
  102. && !defined(BOOST_NO_VARIADIC_TEMPLATES)
  103. # define LUABIND_CPP0x
  104. #endif
  105. namespace luabind {
  106. LUABIND_API void disable_super_deprecation();
  107. } // namespace luabind
  108. #endif // LUABIND_CONFIG_HPP_INCLUDED