99 #define yieldable(L) (((L)->nCcalls & 0xffff0000) == 0) 102 #define getCcalls(L) ((L)->nCcalls & 0xffff) 106 #define incnny(L) ((L)->nCcalls += 0x10000) 109 #define decnny(L) ((L)->nCcalls -= 0x10000) 112 #define nyci (0x10000 | 1) 124 #if !defined(l_signalT) 126 #define l_signalT sig_atomic_t 137 #define EXTRA_STACK 5 140 #define BASIC_STACK_SIZE (2*LUA_MINSTACK) 142 #define stacksize(th) cast_int((th)->stack_last - (th)->stack) 150 typedef struct stringtable {
160 typedef struct CallInfo {
163 struct CallInfo *previous, *next;
166 const Instruction *savedpc;
167 volatile l_signalT trap;
172 ptrdiff_t old_errfunc;
180 unsigned short ftransfer;
181 unsigned short ntransfer;
185 unsigned short callstatus;
192 #define CIST_OAH (1<<0) 193 #define CIST_C (1<<1) 194 #define CIST_FRESH (1<<2) 195 #define CIST_HOOKED (1<<3) 196 #define CIST_YPCALL (1<<4) 197 #define CIST_TAIL (1<<5) 198 #define CIST_HOOKYIELD (1<<6) 199 #define CIST_FIN (1<<7) 200 #define CIST_TRAN (1<<8) 201 #if defined(LUA_COMPAT_LT_LE) 202 #define CIST_LEQ (1<<9) 206 #define isLua(ci) (!((ci)->callstatus & CIST_C)) 209 #define isLuacode(ci) (!((ci)->callstatus & (CIST_C | CIST_HOOKED))) 212 #define setoah(st,v) ((st) = ((st) & ~CIST_OAH) | (v)) 213 #define getoah(st) ((st) & CIST_OAH) 219 typedef struct global_State {
230 lu_byte currentwhite;
256 GCObject *finobjold1;
257 GCObject *finobjrold;
258 struct lua_State *twups;
260 struct lua_State *mainthread;
262 TString *tmname[TM_N];
263 struct Table *mt[LUA_NUMTAGS];
264 TString *strcache[STRCACHE_N][STRCACHE_M];
265 lua_WarnFunction warnf;
285 struct lua_State *twups;
286 struct lua_longjmp *errorJmp;
288 volatile lua_Hook hook;
294 volatile l_signalT hookmask;
298 #define G(L) (L->l_G) 327 #define cast_u(o) cast(union GCUnion *, (o)) 331 check_exp(novariant((o)->tt) == LUA_TSTRING, &((cast_u(o))->ts)) 332 #define gco2u(o) check_exp((o)->tt == LUA_VUSERDATA, &((cast_u(o))->u)) 333 #define gco2lcl(o) check_exp((o)->tt == LUA_VLCL, &((cast_u(o))->cl.l)) 334 #define gco2ccl(o) check_exp((o)->tt == LUA_VCCL, &((cast_u(o))->cl.c)) 336 check_exp(novariant((o)->tt) == LUA_TFUNCTION, &((cast_u(o))->cl)) 337 #define gco2t(o) check_exp((o)->tt == LUA_VTABLE, &((cast_u(o))->h)) 338 #define gco2p(o) check_exp((o)->tt == LUA_VPROTO, &((cast_u(o))->p)) 339 #define gco2th(o) check_exp((o)->tt == LUA_VTHREAD, &((cast_u(o))->th)) 340 #define gco2upv(o) check_exp((o)->tt == LUA_VUPVAL, &((cast_u(o))->upv)) 347 #define obj2gco(v) check_exp((v)->tt >= LUA_TSTRING, &(cast_u(v)->gc)) 351 #define gettotalbytes(g) cast(lu_mem, (g)->totalbytes + (g)->GCdebt) 353 LUAI_FUNC
void luaE_setdebt (global_State *g, l_mem debt);
354 LUAI_FUNC
void luaE_freethread (lua_State *L, lua_State *L1);
355 LUAI_FUNC CallInfo *luaE_extendCI (lua_State *L);
356 LUAI_FUNC
void luaE_freeCI (lua_State *L);
357 LUAI_FUNC
void luaE_shrinkCI (lua_State *L);
358 LUAI_FUNC
void luaE_checkcstack (lua_State *L);
359 LUAI_FUNC
void luaE_incCstack (lua_State *L);
360 LUAI_FUNC
void luaE_warning (lua_State *L,
const char *msg,
int tocont);
361 LUAI_FUNC
void luaE_warnerror (lua_State *L,
const char *where);