The Battle for Wesnoth  1.17.0-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->next ? L->ci->next : luaE_extendCI(L))


void luaD_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, StkId oldstack, StkId newstack)
int luaD_reallocstack (lua_State *L, int newsize, int raiseerror)
int luaD_growstack (lua_State *L, int n, int raiseerror)
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, int ftransfer, int ntransfer)
void luaD_hookcall (lua_State *L, CallInfo *ci)
static StkId rethook (lua_State *L, CallInfo *ci, StkId firstres, int nres)
void luaD_tryfuncTM (lua_State *L, StkId func)
static void moveresults (lua_State *L, StkId res, int nres, int wanted)
void luaD_poscall (lua_State *L, CallInfo *ci, int nres)
void luaD_pretailcall (lua_State *L, CallInfo *ci, StkId func, int narg1)
CallInfoluaD_precall (lua_State *L, StkId func, int nresults)
static void ccall (lua_State *L, StkId func, int nResults, int inc)
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, int *nresults)
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



Definition at line 181 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->next ? L->ci->next : luaE_extendCI(L))

Definition at line 444 of file ldo.cpp.

Referenced by luaD_precall().

Function Documentation

◆ ccall()

static void ccall ( lua_State L,
StkId  func,
int  nResults,
int  inc 

◆ checkmode()

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

Definition at line 812 of file ldo.cpp.

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

Referenced by f_parser().

◆ correctstack()

static void correctstack ( lua_State L,
StkId  oldstack,
StkId  newstack 

◆ f_parser()

static void f_parser ( lua_State L,
void *  ud 

◆ findpcall()

static CallInfo* findpcall ( lua_State L)

Definition at line 623 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 736 of file ldo.cpp.

References yieldable.

Referenced by luaB_yieldable().

◆ lua_resume()

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

◆ 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 

Definition at line 557 of file ldo.cpp.

References ccall().

Referenced by lua_callk(), lua_pcallk(), luaT_callTM(), luaT_callTMres(), and luaV_execute().

◆ luaD_callnoyield()

void luaD_callnoyield ( lua_State L,
StkId  func,
int  nResults 

Definition at line 565 of file ldo.cpp.

References ccall(), and nyci.

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

◆ luaD_growstack()

int luaD_growstack ( lua_State L,
int  n,
int  raiseerror 

◆ luaD_hook()

void luaD_hook ( lua_State L,
int  event,
int  line,
int  ftransfer,
int  ntransfer 

◆ luaD_hookcall()

void luaD_hookcall ( lua_State L,
CallInfo ci 

◆ luaD_inctop()

void luaD_inctop ( lua_State L)

Definition at line 281 of file ldo.cpp.

References luaD_checkstack, and lua_State::top.

Referenced by loadStringN(), luaU_undump(), and luaY_parser().

◆ luaD_pcall()

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

◆ luaD_poscall()

void luaD_poscall ( lua_State L,
CallInfo ci,
int  nres 

◆ luaD_precall()

CallInfo* luaD_precall ( lua_State L,
StkId  func,
int  nresults 

◆ luaD_pretailcall()

void luaD_pretailcall ( lua_State L,
CallInfo ci,
StkId  func,
int  narg1 

◆ 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()

int luaD_reallocstack ( lua_State L,
int  newsize,
int  raiseerror 

◆ luaD_seterrorobj()

void luaD_seterrorobj ( lua_State L,
int  errcode,
StkId  oldtop 

◆ luaD_shrinkstack()

void luaD_shrinkstack ( lua_State L)

◆ luaD_throw()

l_noret luaD_throw ( lua_State L,
int  errcode 

◆ luaD_tryfuncTM()

void luaD_tryfuncTM ( lua_State L,
StkId  func 

Definition at line 374 of file ldo.cpp.

References luaG_typeerror(), luaT_gettmbyobj(), p, s2v, setobj2s, setobjs2s, TM_CALL, lua_State::top, ttisnil, and unlikely.

Referenced by luaD_precall(), and luaV_execute().

◆ moveresults()

static void moveresults ( lua_State L,
StkId  res,
int  nres,
int  wanted 

◆ 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 660 of file ldo.cpp.

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

Referenced by lua_resume().

◆ rethook()

static StkId rethook ( lua_State L,
CallInfo ci,
StkId  firstres,
int  nres 

◆ stackinuse()

static int stackinuse ( lua_State L)

◆ unroll()

static void unroll ( lua_State L,
void *  ud 

Definition at line 604 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().