Allow access to raw error messages from outside lj_err.c.

This commit is contained in:
Mike Pall 2010-12-01 12:54:32 +01:00
parent 0ffd06aba8
commit d98cd19bb0
2 changed files with 4 additions and 3 deletions

View File

@ -72,13 +72,11 @@
/* -- Error messages ------------------------------------------------------ */ /* -- Error messages ------------------------------------------------------ */
/* Error message strings. */ /* Error message strings. */
static const char *lj_err_allmsg = LJ_DATADEF const char *lj_err_allmsg =
#define ERRDEF(name, msg) msg "\0" #define ERRDEF(name, msg) msg "\0"
#include "lj_errmsg.h" #include "lj_errmsg.h"
; ;
#define err2msg(em) (lj_err_allmsg+(int)(em))
/* -- Frame and function introspection ------------------------------------ */ /* -- Frame and function introspection ------------------------------------ */
static BCPos currentpc(lua_State *L, GCfunc *fn, cTValue *nextframe) static BCPos currentpc(lua_State *L, GCfunc *fn, cTValue *nextframe)

View File

@ -17,6 +17,9 @@ typedef enum {
LJ_ERR__MAX LJ_ERR__MAX
} ErrMsg; } ErrMsg;
LJ_DATA const char *lj_err_allmsg;
#define err2msg(em) (lj_err_allmsg+(int)(em))
LJ_FUNC GCstr *lj_err_str(lua_State *L, ErrMsg em); LJ_FUNC GCstr *lj_err_str(lua_State *L, ErrMsg em);
LJ_FUNCA_NORET void LJ_FASTCALL lj_err_throw(lua_State *L, int errcode); LJ_FUNCA_NORET void LJ_FASTCALL lj_err_throw(lua_State *L, int errcode);
LJ_FUNC_NORET void lj_err_mem(lua_State *L); LJ_FUNC_NORET void lj_err_mem(lua_State *L);