The Battle for Wesnoth  1.15.9+dev
Classes | Macros | Functions
ldo.cpp File Reference
#include "lprefix.h"
#include <setjmp.h>
#include <stdlib.h>
#include <string.h>
#include "lua.h"
#include "lapi.h"
#include "ldebug.h"
#include "ldo.h"
#include "lfunc.h"
#include "lgc.h"
#include "lmem.h"
#include "lobject.h"
#include "lopcodes.h"
#include "lparser.h"
#include "lstate.h"
#include "lstring.h"
#include "ltable.h"
#include "ltm.h"
#include "lundump.h"
#include "lvm.h"
#include "lzio.h"
Include dependency graph for ldo.cpp:

Go to the source code of this file.


struct  lua_longjmp
struct  SParser


#define ldo_c
#define LUA_CORE
#define errorstatus(s)   ((s) > LUA_YIELD)
#define LUAI_THROW(L, c)   longjmp((c)->b, 1)
#define LUAI_TRY(L, c, a)   if (setjmp((c)->b) == 0) { a }
#define luai_jmpbuf   jmp_buf
#define next_ci(L)   (L->ci = (L->ci->next ? L->ci->next : luaE_extendCI(L)))
#define checkstackp(L, n, p)


static void seterrorobj (lua_State *L, int errcode, StkId oldtop)
l_noret luaD_throw (lua_State *L, int errcode)
int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud)
static void correctstack (lua_State *L, TValue *oldstack)
void luaD_reallocstack (lua_State *L, int newsize)
void luaD_growstack (lua_State *L, int n)
static int stackinuse (lua_State *L)
void luaD_shrinkstack (lua_State *L)
void luaD_inctop (lua_State *L)
void luaD_hook (lua_State *L, int event, int line)
static void callhook (lua_State *L, CallInfo *ci)
static StkId adjust_varargs (lua_State *L, Proto *p, int actual)
static void tryfuncTM (lua_State *L, StkId func)
static int moveresults (lua_State *L, const TValue *firstResult, StkId res, int nres, int wanted)
int luaD_poscall (lua_State *L, CallInfo *ci, StkId firstResult, int nres)
int luaD_precall (lua_State *L, StkId func, int nresults)
static void stackerror (lua_State *L)
void luaD_call (lua_State *L, StkId func, int nResults)
void luaD_callnoyield (lua_State *L, StkId func, int nResults)
static void finishCcall (lua_State *L, int status)
static void unroll (lua_State *L, void *ud)
static CallInfofindpcall (lua_State *L)
static int recover (lua_State *L, int status)
static int resume_error (lua_State *L, const char *msg, int narg)
static void resume (lua_State *L, void *ud)
LUA_API int lua_resume (lua_State *L, lua_State *from, int nargs)
LUA_API int lua_isyieldable (lua_State *L)
LUA_API int lua_yieldk (lua_State *L, int nresults, lua_KContext ctx, lua_KFunction k)
int luaD_pcall (lua_State *L, Pfunc func, void *u, ptrdiff_t old_top, ptrdiff_t ef)
static void checkmode (lua_State *L, const char *mode, const char *x)
static void f_parser (lua_State *L, void *ud)
int luaD_protectedparser (lua_State *L, ZIO *z, const char *name, const char *mode)

Macro Definition Documentation

◆ checkstackp

#define checkstackp (   L,
ptrdiff_t t__ = savestack(L, p); /* save 'p' */ \
luaC_checkGC(L), /* stack grow uses memory */ \
p = restorestack(L, t__)) /* 'pos' part: restore 'p' */
#define restorestack(L, n)
Definition: ldo.h:33
#define luaD_checkstackaux(L, n, pre, pos)
Definition: ldo.h:23
mock_party p
#define savestack(L, p)
Definition: ldo.h:32
static map_location::DIRECTION n

Definition at line 399 of file ldo.cpp.

Referenced by luaD_precall().



Definition at line 174 of file ldo.cpp.

Referenced by luaD_growstack(), and luaD_reallocstack().

◆ errorstatus

#define errorstatus (   s)    ((s) > LUA_YIELD)

Definition at line 38 of file ldo.cpp.

Referenced by lua_resume().

◆ ldo_c

#define ldo_c

Definition at line 7 of file ldo.cpp.


#define LUA_CORE

Definition at line 8 of file ldo.cpp.

◆ luai_jmpbuf

#define luai_jmpbuf   jmp_buf

Definition at line 75 of file ldo.cpp.


#define LUAI_THROW (   L,
)    longjmp((c)->b, 1)

Definition at line 73 of file ldo.cpp.

Referenced by luaD_throw().


#define LUAI_TRY (   L,
)    if (setjmp((c)->b) == 0) { a }

Definition at line 74 of file ldo.cpp.

Referenced by luaD_rawrunprotected().

◆ next_ci

#define next_ci (   L)    (L->ci = (L->ci->next ? L->ci->next : luaE_extendCI(L)))

Definition at line 395 of file ldo.cpp.

Referenced by luaD_precall().

Function Documentation

◆ adjust_varargs()

static StkId adjust_varargs ( lua_State L,
Proto p,
int  actual 

Definition at line 293 of file ldo.cpp.

References i, Proto::numparams, setnilvalue, setobjs2s, and lua_State::top.

Referenced by luaD_precall().

◆ callhook()

static void callhook ( lua_State L,
CallInfo ci 

◆ checkmode()

static void checkmode ( lua_State L,
const char *  mode,
const char *  x 

Definition at line 757 of file ldo.cpp.

References LUA_ERRSYNTAX, luaD_throw(), and luaO_pushfstring().

Referenced by f_parser().

◆ correctstack()

static void correctstack ( lua_State L,
TValue oldstack 

◆ f_parser()

static void f_parser ( lua_State L,
void *  ud 

◆ findpcall()

static CallInfo* findpcall ( lua_State L)

Definition at line 566 of file ldo.cpp.

References CallInfo::callstatus, lua_State::ci, CIST_YPCALL, and CallInfo::previous.

Referenced by recover().

◆ finishCcall()

static void finishCcall ( lua_State L,
int  status 

◆ lua_isyieldable()

LUA_API int lua_isyieldable ( lua_State L)

Definition at line 687 of file ldo.cpp.

References lua_State::nny.

Referenced by luaB_yieldable().

◆ lua_resume()

LUA_API int lua_resume ( lua_State L,
lua_State from,
int  nargs 

◆ lua_yieldk()

LUA_API int lua_yieldk ( lua_State L,
int  nresults,
lua_KContext  ctx,
lua_KFunction  k 

◆ luaD_call()

void luaD_call ( lua_State L,
StkId  func,
int  nResults 

◆ luaD_callnoyield()

void luaD_callnoyield ( lua_State L,
StkId  func,
int  nResults 

Definition at line 507 of file ldo.cpp.

References luaD_call(), and lua_State::nny.

Referenced by dothecall(), f_call(), lua_callk(), luaG_errormsg(), and luaT_callTM().

◆ luaD_growstack()

void luaD_growstack ( lua_State L,
int  n 

◆ luaD_hook()

void luaD_hook ( lua_State L,
int  event,
int  line 

◆ luaD_inctop()

void luaD_inctop ( lua_State L)

Definition at line 240 of file ldo.cpp.

References luaD_checkstack, and lua_State::top.

Referenced by LoadString(), luaO_pushvfstring(), luaU_undump(), luaY_parser(), and pushstr().

◆ luaD_pcall()

int luaD_pcall ( lua_State L,
Pfunc  func,
void *  u,
ptrdiff_t  old_top,
ptrdiff_t  ef 

◆ luaD_poscall()

int luaD_poscall ( lua_State L,
CallInfo ci,
StkId  firstResult,
int  nres 

◆ luaD_precall()

int luaD_precall ( lua_State L,
StkId  func,
int  nresults 

◆ luaD_protectedparser()

int luaD_protectedparser ( lua_State L,
ZIO z,
const char *  name,
const char *  mode 

◆ luaD_rawrunprotected()

int luaD_rawrunprotected ( lua_State L,
Pfunc  f,
void *  ud 

◆ luaD_reallocstack()

void luaD_reallocstack ( lua_State L,
int  newsize 

◆ luaD_shrinkstack()

void luaD_shrinkstack ( lua_State L)

◆ luaD_throw()

l_noret luaD_throw ( lua_State L,
int  errcode 

◆ moveresults()

static int moveresults ( lua_State L,
const TValue firstResult,
StkId  res,
int  nres,
int  wanted 

Definition at line 334 of file ldo.cpp.

References i, LUA_MULTRET, luaO_nilobject, setnilvalue, setobjs2s, and lua_State::top.

Referenced by luaD_poscall().

◆ recover()

static int recover ( lua_State L,
int  status 

◆ resume()

static void resume ( lua_State L,
void *  ud 

◆ resume_error()

static int resume_error ( lua_State L,
const char *  msg,
int  narg 

Definition at line 603 of file ldo.cpp.

References api_incr_top, LUA_ERRRUN, lua_unlock, luaS_new(), setsvalue2s, and lua_State::top.

Referenced by lua_resume().

◆ seterrorobj()

static void seterrorobj ( lua_State L,
int  errcode,
StkId  oldtop 

Definition at line 91 of file ldo.cpp.

References G, LUA_ERRERR, LUA_ERRMEM, luaS_newliteral, setobjs2s, setsvalue2s, and lua_State::top.

Referenced by lua_resume(), luaD_pcall(), luaD_throw(), and recover().

◆ stackerror()

static void stackerror ( lua_State L)

Definition at line 481 of file ldo.cpp.

References LUA_ERRERR, luaD_throw(), luaG_runerror(), LUAI_MAXCCALLS, and lua_State::nCcalls.

Referenced by luaD_call().

◆ stackinuse()

static int stackinuse ( lua_State L)

◆ tryfuncTM()

static void tryfuncTM ( lua_State L,
StkId  func 

Definition at line 315 of file ldo.cpp.

References luaG_typeerror(), luaT_gettmbyobj(), p, setobj2s, setobjs2s, TM_CALL, lua_State::top, and ttisfunction.

Referenced by luaD_precall().

◆ unroll()

static void unroll ( lua_State L,
void *  ud 

Definition at line 548 of file ldo.cpp.

References lua_State::base_ci, lua_State::ci, finishCcall(), isLua, LUA_YIELD, luaV_execute(), and luaV_finishOp().

Referenced by lua_resume(), and resume().