Grumblemumble goddamn Xeo grumbleMumble

This commit is contained in:
ThePhD 2016-08-07 14:04:07 -04:00
parent 9c67e9310e
commit 57333bb529
4 changed files with 16 additions and 12 deletions

View File

@ -12,7 +12,7 @@ In general, we always insert a T* in the first `sizeof(T*)` bytes, so the any fr
For ``T``
---------
These are classified with the metatable from ``
These are classified with the metatable name from :ref:`usertype_traits\<T><usertype-traits>`.
The data layout for references is as follows::
@ -44,4 +44,4 @@ The data layout for these kinds of types is as follows::
| T* | void(*)(void*) function_pointer | T |
^-sizeof(T*) bytes-^-sizeof(void(*)(void*)) bytes, deleter-^- sizeof(T) bytes, actal data -^
Note that we put a special deleter function before the actual data. This is because the custom deleter must know where the offset to the data is, not the rest of the library. Sol just needs to know about ``T*`` and the userdata (and userdata metatable) to work, everything else is for preserving construction / destruction syntax.
Note that we put a special deleter function before the actual data. This is because the custom deleter must know where the offset to the data is, not the rest of the library. Sol just needs to know about ``T*`` and the userdata (and userdata metatable) to work, everything else is for preserving construction / destruction semantics.

View File

@ -3,6 +3,10 @@ run-time type information (rtti)
because somebody's going to want to shut this off, too...
---------------------------------------------------------
Sol does not use RTTI anymore.
*THE BELOW IS NO LONGER NEEDED.*
Not compiling with C++'s run-time type information? Do a ``#define SOL_NO_RTII`` before you include ``sol.hpp`` or define ``SOL_NO_RTTI`` on your command line. Be sure to understand the :ref:`implications<usertype-inheritance>` of doing so if you also turn off exceptions.
If you come across bugs or can't compile because there's a stray `typeid` or `typeinfo` that wasn't hidden behind a ``#ifndef SOL_NO_RTTI``, please file `an issue`_ or even make a pull request so it can be fixed for everyone.

View File

@ -6,12 +6,12 @@ Sol was designed to be correct and fast, and in the pursuit of both uses the reg
Note that you can obtain safety with regards to functions you bind by using the :doc:`protect<api/protect>` wrapper around function/variable bindings you set into Lua.
``SOL_SAFE_USERTYPE`` triggers the following change:
* If the userdata to a usertype function is nill, will trigger an error instead of letting things go through and letting the system segfault
* If the userdata to a usertype function is nil, will trigger an error instead of letting things go through and letting the system segfault.
``SOL_CHECK_ARGUMENTS`` triggers the following changes:
* ``sol::stack::get`` (used everywhere) defaults to using ``sol::stack::check_get`` and dereferencing the argument. It uses ``sol::type_panic`` as the handler if something goes wrong.
* ``sol::stack::call`` and its variants will, if no templated boolean is specified, check all of the arguments for a function call.
* If ``SOL_SAFE_USERTYPE`` is not defined, it gets defined to turn it on
* If ``SOL_SAFE_USERTYPE`` is not defined, it gets defined to turn being on.
Remember that if you want these features, you must explicitly turn them on. Additionally, you can have basic boolean checks when using the API by just converting to a :doc:`sol::optional\<T><api/optional>` when necessary. Tests are compiled with this on to ensure everythign is going as expected.

View File

@ -62,11 +62,11 @@ namespace sol {
return name;
}
#elif defined(__GNUC__) || defined(__clang__)
template <typename T>
template <typename T, class seperator_mark = int>
inline std::string ctti_get_type_name() {
const static std::array<std::string, 2> removals = { { "{anonymous}", "(anonymous namespace)" } };
std::string name = __PRETTY_FUNCTION__;
std::size_t start = name.find_last_of('[');
std::string name = __PRETTY_FUNCTION__;
std::size_t start = name.find_first_of('[');
start = name.find_first_of('=', start);
std::size_t end = name.find_last_of(']');
if (end == std::string::npos)
@ -76,21 +76,21 @@ namespace sol {
if (start < name.size() - 1)
start += 1;
name = name.substr(start, end - start);
start = name.find(";");
start = name.rfind("seperator_mark");
if (start != std::string::npos) {
name.erase(start, name.length());
name.erase(start - 2, name.length());
}
while (!name.empty() && std::isblank(name.front())) name.erase(name.begin());
while (!name.empty() && std::isblank(name.back())) name.pop_back();
for (std::size_t r = 0; r < removals.size(); ++r) {
auto found = name.find(removals[r]);
for (std::size_t r = 0; r < removals.size(); ++r) {
auto found = name.find(removals[r]);
while (found != std::string::npos) {
name.erase(found, removals[r].size());
found = name.find(removals[r]);
}
}
return name;
}
#else