The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Classes | Macros | Functions
ldo.cpp File Reference
#include <cassert>
#include <setjmp.h>
#include <stdlib.h>
#include <string.h>
#include "../lua_jailbreak_exception.hpp"
#include <exception>
#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.

Classes

struct  lua_longjmp
 
struct  SParser
 

Macros

#define ldo_c
 
#define LUA_CORE
 
#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 ERRORSTACKSIZE   (LUAI_MAXSTACK + 200)
 
#define next_ci(L)   (L->ci = (L->ci->next ? L->ci->next : luaE_extendCI(L)))
 

Functions

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_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 StkId tryfuncTM (lua_State *L, StkId func)
 
int luaD_precall (lua_State *L, StkId func, int nresults)
 
int luaD_poscall (lua_State *L, StkId firstResult)
 
void luaD_call (lua_State *L, StkId func, int nResults, int allowyield)
 
static void finishCcall (lua_State *L)
 
static void unroll (lua_State *L, void *ud)
 
static CallInfofindpcall (lua_State *L)
 
static int recover (lua_State *L, int status)
 
static l_noret resume_error (lua_State *L, const char *msg, StkId firstArg)
 
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_yieldk (lua_State *L, int nresults, int ctx, lua_CFunction 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

#define ERRORSTACKSIZE   (LUAI_MAXSTACK + 200)

Definition at line 180 of file ldo.cpp.

Referenced by luaD_growstack(), and luaD_reallocstack().

#define ldo_c

Definition at line 11 of file ldo.cpp.

#define LUA_CORE

Definition at line 12 of file ldo.cpp.

#define luai_jmpbuf   jmp_buf

Definition at line 92 of file ldo.cpp.

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

Definition at line 90 of file ldo.cpp.

Referenced by luaD_throw().

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

Definition at line 91 of file ldo.cpp.

Referenced by luaD_rawrunprotected().

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

Definition at line 312 of file ldo.cpp.

Referenced by luaD_precall().

Function Documentation

static StkId adjust_varargs ( lua_State L,
Proto p,
int  actual 
)
static
static void callhook ( lua_State L,
CallInfo ci 
)
static
static void checkmode ( lua_State L,
const char *  mode,
const char *  x 
)
static

Definition at line 653 of file ldo.cpp.

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

Referenced by f_parser().

static void correctstack ( lua_State L,
TValue oldstack 
)
static
static void f_parser ( lua_State L,
void ud 
)
static
static CallInfo* findpcall ( lua_State L)
static

Definition at line 473 of file ldo.cpp.

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

Referenced by recover().

static void finishCcall ( lua_State L)
static
LUA_API int lua_resume ( lua_State L,
lua_State from,
int  nargs 
)
LUA_API int lua_yieldk ( lua_State L,
int  nresults,
int  ctx,
lua_CFunction  k 
)
void luaD_call ( lua_State L,
StkId  func,
int  nResults,
int  allowyield 
)
void luaD_growstack ( lua_State L,
int  n 
)
void luaD_hook ( lua_State L,
int  event,
int  line 
)
int luaD_pcall ( lua_State L,
Pfunc  func,
void u,
ptrdiff_t  old_top,
ptrdiff_t  ef 
)
int luaD_poscall ( lua_State L,
StkId  firstResult 
)
int luaD_precall ( lua_State L,
StkId  func,
int  nresults 
)
int luaD_protectedparser ( lua_State L,
ZIO z,
const char *  name,
const char *  mode 
)
int luaD_rawrunprotected ( lua_State L,
Pfunc  f,
void ud 
)
void luaD_reallocstack ( lua_State L,
int  newsize 
)
void luaD_shrinkstack ( lua_State L)
l_noret luaD_throw ( lua_State L,
int  errcode 
)
static int recover ( lua_State L,
int  status 
)
static
static void resume ( lua_State L,
void ud 
)
static
static l_noret resume_error ( lua_State L,
const char *  msg,
StkId  firstArg 
)
static

Definition at line 507 of file ldo.cpp.

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

Referenced by resume().

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

Definition at line 106 of file ldo.cpp.

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

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

static int stackinuse ( lua_State L)
static
static StkId tryfuncTM ( lua_State L,
StkId  func 
)
static
static void unroll ( lua_State L,
void ud 
)
static

Definition at line 455 of file ldo.cpp.

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

Referenced by lua_resume(), and resume().