The Battle for Wesnoth  1.17.0+dev
Classes | Macros | Typedefs | Functions
lstate.cpp File Reference
#include "lprefix.h"
#include <stddef.h>
#include <string.h>
#include "lua.h"
#include "lapi.h"
#include "ldebug.h"
#include "ldo.h"
#include "lfunc.h"
#include "lgc.h"
#include "llex.h"
#include "lmem.h"
#include "lstate.h"
#include "lstring.h"
#include "ltable.h"
#include "ltm.h"
#include <time.h>
Include dependency graph for lstate.cpp:

Go to the source code of this file.


struct  LX
struct  LG


#define lstate_c
#define LUA_CORE
#define fromstate(L)   (cast(LX *, cast(lu_byte *, (L)) - offsetof(LX, l)))
#define addbuff(b, p, e)


typedef struct LX LX
typedef struct LG LG


static unsigned int luai_makeseed (lua_State *L)
void luaE_setdebt (global_State *g, l_mem debt)
LUA_API int lua_setcstacklimit (lua_State *L, unsigned int limit)
CallInfoluaE_extendCI (lua_State *L)
void luaE_freeCI (lua_State *L)
void luaE_shrinkCI (lua_State *L)
void luaE_checkcstack (lua_State *L)
LUAI_FUNC void luaE_incCstack (lua_State *L)
static void stack_init (lua_State *L1, lua_State *L)
static void freestack (lua_State *L)
static void init_registry (lua_State *L, global_State *g)
static void f_luaopen (lua_State *L, void *ud)
static void preinit_thread (lua_State *L, global_State *g)
static void close_state (lua_State *L)
LUA_API lua_Statelua_newthread (lua_State *L)
void luaE_freethread (lua_State *L, lua_State *L1)
int lua_resetthread (lua_State *L)
LUA_API lua_Statelua_newstate (lua_Alloc f, void *ud)
LUA_API void lua_close (lua_State *L)
void luaE_warning (lua_State *L, const char *msg, int tocont)
void luaE_warnerror (lua_State *L, const char *where)

Macro Definition Documentation

◆ addbuff

#define addbuff (   b,
{ size_t t = cast_sizet(e); \
memcpy(b + p, &t, sizeof(t)); p += sizeof(t); }
#define b
mock_party p
double t
Definition: astarsearch.cpp:65
#define cast_sizet(i)
Definition: llimits.h:134
#define e

Definition at line 67 of file lstate.cpp.

Referenced by luai_makeseed().

◆ fromstate

#define fromstate (   L)    (cast(LX *, cast(lu_byte *, (L)) - offsetof(LX, l)))

Definition at line 51 of file lstate.cpp.

Referenced by close_state(), and luaE_freethread().

◆ lstate_c

#define lstate_c

Definition at line 7 of file lstate.cpp.


#define LUA_CORE

Definition at line 8 of file lstate.cpp.

Typedef Documentation

◆ LG

typedef struct LG LG

◆ LX

typedef struct LX LX

Function Documentation

◆ close_state()

static void close_state ( lua_State L)

◆ f_luaopen()

static void f_luaopen ( lua_State L,
void *  ud 

◆ freestack()

static void freestack ( lua_State L)

◆ init_registry()

static void init_registry ( lua_State L,
global_State g 

◆ lua_close()

LUA_API void lua_close ( lua_State L)

Definition at line 405 of file lstate.cpp.

References close_state(), G, and lua_lock.

Referenced by os_exit(), and lua_kernel_base::~lua_kernel_base().

◆ lua_newstate()

LUA_API lua_State* lua_newstate ( lua_Alloc  f,
void *  ud 

Definition at line 349 of file lstate.cpp.

References global_State::allgc, global_State::allweak, bitmask, cast, close_state(), global_State::currentwhite, global_State::ephemeron, f, f_luaopen(), global_State::finobj, global_State::finobjold1, global_State::finobjrold, global_State::finobjsur, global_State::firstold1, global_State::fixedgc, global_State::frealloc, LG::g, g, global_State::GCdebt, global_State::gcemergency, global_State::gckind, global_State::gcpause, global_State::gcrunning, GCSpause, global_State::gcstate, global_State::gcstepmul, global_State::gcstepsize, global_State::genmajormul, global_State::genminormul, global_State::gray, global_State::grayagain, stringtable::hash, i, incnny, KGC_INC, LX::l, LG::l, global_State::l_registry, global_State::lastatomic, LUA_NUMTAGS, LUA_OK, LUA_TTHREAD, LUA_VTHREAD, luaC_white, luaD_rawrunprotected(), LUAI_GCMUL, LUAI_GCPAUSE, LUAI_GCSTEPSIZE, LUAI_GENMAJORMUL, LUAI_GENMINORMUL, luai_makeseed(), global_State::mainthread, global_State::mt, lua_State::nCcalls, global_State::nilvalue, stringtable::nuse, obj2gco, global_State::old1, global_State::panic, preinit_thread(), global_State::reallyold, global_State::seed, setgcparam, setivalue, setnilvalue, stringtable::size, global_State::strt, global_State::survival, global_State::sweepgc, global_State::tobefnz, global_State::totalbytes, global_State::twups, global_State::ud, global_State::ud_warn, global_State::warnf, global_State::weak, and WHITE0BIT.

Referenced by luai_makeseed(), and luaL_newstate().

◆ lua_newthread()

LUA_API lua_State* lua_newthread ( lua_State L)

◆ lua_resetthread()

int lua_resetthread ( lua_State L)

◆ lua_setcstacklimit()

LUA_API int lua_setcstacklimit ( lua_State L,
unsigned int  limit 

Definition at line 99 of file lstate.cpp.


Referenced by db_setcstacklimit().

◆ luaE_checkcstack()

void luaE_checkcstack ( lua_State L)

Definition at line 165 of file lstate.cpp.

References getCcalls, LUA_ERRERR, luaD_throw(), luaG_runerror(), and LUAI_MAXCCALLS.

Referenced by ccall(), and luaE_incCstack().

◆ luaE_extendCI()

CallInfo* luaE_extendCI ( lua_State L)

◆ luaE_freeCI()

void luaE_freeCI ( lua_State L)

Definition at line 122 of file lstate.cpp.

References lua_State::ci, luaM_free, lua_State::nci, next, and CallInfo::next.

Referenced by freestack().

◆ luaE_freethread()

void luaE_freethread ( lua_State L,
lua_State L1 

◆ luaE_incCstack()

LUAI_FUNC void luaE_incCstack ( lua_State L)

Definition at line 173 of file lstate.cpp.

References getCcalls, luaE_checkcstack(), LUAI_MAXCCALLS, lua_State::nCcalls, and unlikely.

Referenced by resume().

◆ luaE_setdebt()

void luaE_setdebt ( global_State g,
l_mem  debt 

◆ luaE_shrinkCI()

void luaE_shrinkCI ( lua_State L)

Definition at line 138 of file lstate.cpp.

References lua_State::ci, luaM_free, lua_State::nci, next, CallInfo::next, and CallInfo::previous.

Referenced by luaD_shrinkstack().

◆ luaE_warnerror()

void luaE_warnerror ( lua_State L,
const char *  where 

Definition at line 422 of file lstate.cpp.

References luaE_warning(), wfl::msg(), s2v, svalue, lua_State::top, and ttisstring.

Referenced by callclosemth(), and GCTM().

◆ luaE_warning()

void luaE_warning ( lua_State L,
const char *  msg,
int  tocont 

Definition at line 412 of file lstate.cpp.

References G.

Referenced by lua_warning(), and luaE_warnerror().

◆ luai_makeseed()

static unsigned int luai_makeseed ( lua_State L)

Definition at line 71 of file lstate.cpp.

References addbuff, cast_uint, h, lua_assert, lua_newstate(), luaS_hash(), and p.

Referenced by lua_newstate().

◆ preinit_thread()

static void preinit_thread ( lua_State L,
global_State g 

◆ stack_init()

static void stack_init ( lua_State L1,
lua_State L