Github User Fetcher 1.0.0
C Application with Server and GUI
Loading...
Searching...
No Matches
lstate.h File Reference
#include "lua.h"
#include "lobject.h"
#include "ltm.h"
#include "lzio.h"
#include <signal.h>

Go to the source code of this file.

Data Structures

struct  stringtable
 
struct  CallInfo
 
struct  global_State
 
struct  lua_State
 
union  GCUnion
 

Macros

#define l_signalT   sig_atomic_t
 
#define EXTRA_STACK   5
 
#define BASIC_STACK_SIZE   (2*LUA_MINSTACK)
 
#define KGC_NORMAL   0
 
#define KGC_EMERGENCY   1 /* gc was forced by an allocation failure */
 
#define CIST_OAH   (1<<0) /* original value of 'allowhook' */
 
#define CIST_LUA   (1<<1) /* call is running a Lua function */
 
#define CIST_HOOKED   (1<<2) /* call is running a debug hook */
 
#define CIST_FRESH
 
#define CIST_YPCALL   (1<<4) /* call is a yieldable protected call */
 
#define CIST_TAIL   (1<<5) /* call was tail called */
 
#define CIST_HOOKYIELD   (1<<6) /* last hook called yielded */
 
#define CIST_LEQ   (1<<7) /* using __lt for __le */
 
#define CIST_FIN   (1<<8) /* call is running a finalizer */
 
#define isLua(ci)   ((ci)->callstatus & CIST_LUA)
 
#define setoah(st, v)   ((st) = ((st) & ~CIST_OAH) | (v))
 
#define getoah(st)   ((st) & CIST_OAH)
 
#define G(L)   (L->l_G)
 
#define cast_u(o)   cast(union GCUnion *, (o))
 
#define gco2ts(o)    check_exp(novariant((o)->tt) == LUA_TSTRING, &((cast_u(o))->ts))
 
#define gco2u(o)   check_exp((o)->tt == LUA_TUSERDATA, &((cast_u(o))->u))
 
#define gco2lcl(o)   check_exp((o)->tt == LUA_TLCL, &((cast_u(o))->cl.l))
 
#define gco2ccl(o)   check_exp((o)->tt == LUA_TCCL, &((cast_u(o))->cl.c))
 
#define gco2cl(o)    check_exp(novariant((o)->tt) == LUA_TFUNCTION, &((cast_u(o))->cl))
 
#define gco2t(o)   check_exp((o)->tt == LUA_TTABLE, &((cast_u(o))->h))
 
#define gco2p(o)   check_exp((o)->tt == LUA_TPROTO, &((cast_u(o))->p))
 
#define gco2th(o)   check_exp((o)->tt == LUA_TTHREAD, &((cast_u(o))->th))
 
#define obj2gco(v)    check_exp(novariant((v)->tt) < LUA_TDEADKEY, (&(cast_u(v)->gc)))
 
#define gettotalbytes(g)   cast(lu_mem, (g)->totalbytes + (g)->GCdebt)
 

Typedefs

typedef struct stringtable stringtable
 
typedef struct CallInfo CallInfo
 
typedef struct global_State global_State
 

Functions

LUAI_FUNC void luaE_setdebt (global_State *g, l_mem debt)
 
LUAI_FUNC void luaE_freethread (lua_State *L, lua_State *L1)
 
LUAI_FUNC CallInfoluaE_extendCI (lua_State *L)
 
LUAI_FUNC void luaE_freeCI (lua_State *L)
 
LUAI_FUNC void luaE_shrinkCI (lua_State *L)
 

Macro Definition Documentation

◆ BASIC_STACK_SIZE

#define BASIC_STACK_SIZE   (2*LUA_MINSTACK)

Definition at line 68 of file lua-5.3.6/src/lstate.h.

◆ cast_u

#define cast_u ( o)    cast(union GCUnion *, (o))

Definition at line 221 of file lua-5.3.6/src/lstate.h.

◆ CIST_FIN

#define CIST_FIN   (1<<8) /* call is running a finalizer */

Definition at line 124 of file lua-5.3.6/src/lstate.h.

Referenced by GCTM(), GCTM(), getfuncname(), getfuncname(), and luaD_poscall().

◆ CIST_FRESH

#define CIST_FRESH
Value:
(1<<3) /* call is running on a fresh invocation
of luaV_execute */

Definition at line 119 of file lua-5.3.6/src/lstate.h.

Referenced by ccall(), luaV_execute(), and luaV_execute().

◆ CIST_HOOKED

#define CIST_HOOKED   (1<<2) /* call is running a debug hook */

Definition at line 118 of file lua-5.3.6/src/lstate.h.

◆ CIST_HOOKYIELD

#define CIST_HOOKYIELD   (1<<6) /* last hook called yielded */

Definition at line 122 of file lua-5.3.6/src/lstate.h.

◆ CIST_LEQ

#define CIST_LEQ   (1<<7) /* using __lt for __le */

Definition at line 123 of file lua-5.3.6/src/lstate.h.

Referenced by luaT_callorderTM(), luaV_finishOp(), and luaV_lessequal().

◆ CIST_LUA

#define CIST_LUA   (1<<1) /* call is running a Lua function */

Definition at line 117 of file lua-5.3.6/src/lstate.h.

◆ CIST_OAH

#define CIST_OAH   (1<<0) /* original value of 'allowhook' */

Definition at line 116 of file lua-5.3.6/src/lstate.h.

◆ CIST_TAIL

#define CIST_TAIL   (1<<5) /* call was tail called */

Definition at line 121 of file lua-5.3.6/src/lstate.h.

◆ CIST_YPCALL

#define CIST_YPCALL   (1<<4) /* call is a yieldable protected call */

Definition at line 120 of file lua-5.3.6/src/lstate.h.

◆ EXTRA_STACK

#define EXTRA_STACK   5

Definition at line 65 of file lua-5.3.6/src/lstate.h.

◆ G

#define G ( L)    (L->l_G)

Definition at line 204 of file lua-5.3.6/src/lstate.h.

◆ gco2ccl

#define gco2ccl ( o)    check_exp((o)->tt == LUA_TCCL, &((cast_u(o))->cl.c))

Definition at line 228 of file lua-5.3.6/src/lstate.h.

◆ gco2cl

#define gco2cl ( o)     check_exp(novariant((o)->tt) == LUA_TFUNCTION, &((cast_u(o))->cl))

Definition at line 229 of file lua-5.3.6/src/lstate.h.

229#define gco2ccl(o) check_exp((o)->tt == LUA_TCCL, &((cast_u(o))->cl.c))
230#define gco2cl(o) \

◆ gco2lcl

#define gco2lcl ( o)    check_exp((o)->tt == LUA_TLCL, &((cast_u(o))->cl.l))

Definition at line 227 of file lua-5.3.6/src/lstate.h.

◆ gco2p

#define gco2p ( o)    check_exp((o)->tt == LUA_TPROTO, &((cast_u(o))->p))

Definition at line 232 of file lua-5.3.6/src/lstate.h.

◆ gco2t

#define gco2t ( o)    check_exp((o)->tt == LUA_TTABLE, &((cast_u(o))->h))

Definition at line 231 of file lua-5.3.6/src/lstate.h.

◆ gco2th

#define gco2th ( o)    check_exp((o)->tt == LUA_TTHREAD, &((cast_u(o))->th))

Definition at line 233 of file lua-5.3.6/src/lstate.h.

◆ gco2ts

#define gco2ts ( o)     check_exp(novariant((o)->tt) == LUA_TSTRING, &((cast_u(o))->ts))

Definition at line 224 of file lua-5.3.6/src/lstate.h.

224/* macros to convert a GCObject into a specific value */
225#define gco2ts(o) \

◆ gco2u

#define gco2u ( o)    check_exp((o)->tt == LUA_TUSERDATA, &((cast_u(o))->u))

Definition at line 226 of file lua-5.3.6/src/lstate.h.

◆ getoah

#define getoah ( st)    ((st) & CIST_OAH)

Definition at line 130 of file lua-5.3.6/src/lstate.h.

Referenced by finishpcallk(), and recover().

◆ gettotalbytes

#define gettotalbytes ( g)    cast(lu_mem, (g)->totalbytes + (g)->GCdebt)

Definition at line 242 of file lua-5.3.6/src/lstate.h.

◆ isLua

#define isLua ( ci)    ((ci)->callstatus & CIST_LUA)

Definition at line 126 of file lua-5.3.6/src/lstate.h.

◆ KGC_EMERGENCY

#define KGC_EMERGENCY   1 /* gc was forced by an allocation failure */

Definition at line 73 of file lua-5.3.6/src/lstate.h.

◆ KGC_NORMAL

#define KGC_NORMAL   0

Definition at line 72 of file lua-5.3.6/src/lstate.h.

◆ l_signalT

#define l_signalT   sig_atomic_t

Definition at line 60 of file lua-5.3.6/src/lstate.h.

◆ obj2gco

#define obj2gco ( v)     check_exp(novariant((v)->tt) < LUA_TDEADKEY, (&(cast_u(v)->gc)))

Definition at line 237 of file lua-5.3.6/src/lstate.h.

237/* macro to convert a Lua object into a GCObject */
238#define obj2gco(v) \

◆ setoah

#define setoah ( st,
v )   ((st) = ((st) & ~CIST_OAH) | (v))

Definition at line 129 of file lua-5.3.6/src/lstate.h.

Referenced by lua_pcallk().

Typedef Documentation

◆ CallInfo

typedef struct CallInfo CallInfo

◆ global_State

typedef struct global_State global_State

◆ stringtable

typedef struct stringtable stringtable

Function Documentation

◆ luaE_extendCI()

LUAI_FUNC CallInfo * luaE_extendCI ( lua_State * L)

Definition at line 112 of file lua-5.2.4/src/lstate.c.

112 {
113 CallInfo *ci = luaM_new(L, CallInfo);
114 lua_assert(L->ci->next == NULL);
115 L->ci->next = ci;
116 ci->previous = L->ci;
117 ci->next = NULL;
118 return ci;
119}
#define NULL
Definition gmacros.h:924
#define lua_assert(c)
#define luaM_new(L, t)
struct CallInfo * previous
struct CallInfo * next

◆ luaE_freeCI()

LUAI_FUNC void luaE_freeCI ( lua_State * L)

Definition at line 122 of file lua-5.2.4/src/lstate.c.

122 {
123 CallInfo *ci = L->ci;
124 CallInfo *next = ci->next;
125 ci->next = NULL;
126 while ((ci = next) != NULL) {
127 next = ci->next;
128 luaM_free(L, ci);
129 }
130}
#define next(ls)
#define luaM_free(L, b)

◆ luaE_freethread()

LUAI_FUNC void luaE_freethread ( lua_State * L,
lua_State * L1 )

Definition at line 134 of file lua-5.1.5/src/lstate.c.

134 {
135 luaF_close(L1, L1->stack); /* close all upvalues for this thread */
136 lua_assert(L1->openupval == NULL);
138 freestack(L, L1);
140}
void luaF_close(lua_State *L, StkId level)
#define luaM_freemem(L, b, s)
#define state_size(x)
static void freestack(lua_State *L, lua_State *L1)
#define fromstate(l)
#define luai_userstatefree(L)
GCObject * openupval

◆ luaE_setdebt()

LUAI_FUNC void luaE_setdebt ( global_State * g,
l_mem debt )

Definition at line 106 of file lua-5.2.4/src/lstate.c.

106 {
107 g->totalbytes -= (debt - g->GCdebt);
108 g->GCdebt = debt;
109}

◆ luaE_shrinkCI()

LUAI_FUNC void luaE_shrinkCI ( lua_State * L)

Definition at line 137 of file lua-5.3.6/src/lstate.c.

137 {
138 CallInfo *ci = L->ci;
139 CallInfo *next2; /* next's next */
140 /* while there are two nexts */
141 while (ci->next != NULL && (next2 = ci->next->next) != NULL) {
142 luaM_free(L, ci->next); /* free next */
143 L->nci--;
144 ci->next = next2; /* remove 'next' from the list */
145 next2->previous = ci;
146 ci = next2; /* keep next's next */
147 }
148}
unsigned short nci