New type 'TStatus' for thread status/error codes

This commit is contained in:
Roberto Ierusalimschy
2025-01-30 11:41:39 -03:00
parent f7439112a5
commit d1e677c52b
10 changed files with 56 additions and 46 deletions

View File

@@ -339,8 +339,8 @@ typedef struct global_State {
*/
struct lua_State {
CommonHeader;
lu_byte status;
lu_byte allowhook;
TStatus status;
unsigned short nci; /* number of items in 'ci' list */
StkIdRel top; /* first free slot in the stack */
global_State *l_G;
@@ -352,10 +352,10 @@ struct lua_State {
GCObject *gclist;
struct lua_State *twups; /* list of threads with open upvalues */
struct lua_longjmp *errorJmp; /* current error recover point */
CallInfo base_ci; /* CallInfo for first level (C calling Lua) */
CallInfo base_ci; /* CallInfo for first level (C host) */
volatile lua_Hook hook;
ptrdiff_t errfunc; /* current error handling function (stack index) */
l_uint32 nCcalls; /* number of nested (non-yieldable | C) calls */
l_uint32 nCcalls; /* number of nested non-yieldable or C calls */
int oldpc; /* last pc traced */
int basehookcount;
int hookcount;
@@ -438,7 +438,7 @@ LUAI_FUNC void luaE_checkcstack (lua_State *L);
LUAI_FUNC void luaE_incCstack (lua_State *L);
LUAI_FUNC void luaE_warning (lua_State *L, const char *msg, int tocont);
LUAI_FUNC void luaE_warnerror (lua_State *L, const char *where);
LUAI_FUNC int luaE_resetthread (lua_State *L, int status);
LUAI_FUNC TStatus luaE_resetthread (lua_State *L, TStatus status);
#endif