parent
4958bf3612
commit
416b9809c8
3 changed files with 14 additions and 8 deletions
|
@ -16,21 +16,27 @@
|
|||
|
||||
#include <libaegisub/fs.h>
|
||||
|
||||
#include <boost/exception/detail/attribute_noreturn.hpp>
|
||||
#include <lua.hpp>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <type_traits>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#ifndef BOOST_NORETURN
|
||||
#include <boost/exception/detail/attribute_noreturn.hpp>
|
||||
#define BOOST_NORETURN BOOST_ATTRIBUTE_NORETURN
|
||||
#endif
|
||||
|
||||
namespace agi { namespace lua {
|
||||
// Exception type for errors where the error details are on the lua stack
|
||||
struct error_tag {};
|
||||
|
||||
// Below are functionally equivalent to the luaL_ functions, but using a C++
|
||||
// exception for stack unwinding
|
||||
int BOOST_ATTRIBUTE_NORETURN error(lua_State *L, const char *fmt, ...);
|
||||
int BOOST_ATTRIBUTE_NORETURN argerror(lua_State *L, int narg, const char *extramsg);
|
||||
int BOOST_ATTRIBUTE_NORETURN typerror(lua_State *L, int narg, const char *tname);
|
||||
int BOOST_NORETURN error(lua_State *L, const char *fmt, ...);
|
||||
int BOOST_NORETURN argerror(lua_State *L, int narg, const char *extramsg);
|
||||
int BOOST_NORETURN typerror(lua_State *L, int narg, const char *tname);
|
||||
void argcheck(lua_State *L, bool cond, int narg, const char *msg);
|
||||
|
||||
inline void push_value(lua_State *L, bool value) { lua_pushboolean(L, value); }
|
||||
|
|
|
@ -181,7 +181,7 @@ int add_stack_trace(lua_State *L) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
int BOOST_ATTRIBUTE_NORETURN error(lua_State *L, const char *fmt, ...) {
|
||||
int BOOST_NORETURN error(lua_State *L, const char *fmt, ...) {
|
||||
va_list argp;
|
||||
va_start(argp, fmt);
|
||||
luaL_where(L, 1);
|
||||
|
@ -191,7 +191,7 @@ int BOOST_ATTRIBUTE_NORETURN error(lua_State *L, const char *fmt, ...) {
|
|||
throw error_tag();
|
||||
}
|
||||
|
||||
int BOOST_ATTRIBUTE_NORETURN argerror(lua_State *L, int narg, const char *extramsg) {
|
||||
int BOOST_NORETURN argerror(lua_State *L, int narg, const char *extramsg) {
|
||||
lua_Debug ar;
|
||||
if (!lua_getstack(L, 0, &ar))
|
||||
error(L, "bad argument #%d (%s)", narg, extramsg);
|
||||
|
@ -203,7 +203,7 @@ int BOOST_ATTRIBUTE_NORETURN argerror(lua_State *L, int narg, const char *extram
|
|||
narg, ar.name, extramsg);
|
||||
}
|
||||
|
||||
int BOOST_ATTRIBUTE_NORETURN typerror(lua_State *L, int narg, const char *tname) {
|
||||
int BOOST_NORETURN typerror(lua_State *L, int narg, const char *tname) {
|
||||
const char *msg = lua_pushfstring(L, "%s expected, got %s",
|
||||
tname, luaL_typename(L, narg));
|
||||
argerror(L, narg, msg);
|
||||
|
|
2
vendor/boost
vendored
2
vendor/boost
vendored
|
@ -1 +1 @@
|
|||
Subproject commit 614aac8fef2a0551610f72e5c4a61085c8c06e35
|
||||
Subproject commit c038171a340eac748b2d14882f6f79e803d292f4
|
Loading…
Reference in a new issue