The Battle for Wesnoth  1.17.0-dev
Macros | Functions
lfunc.cpp File Reference
#include "lprefix.h"
#include <stddef.h>
#include "lua.h"
#include "ldebug.h"
#include "ldo.h"
#include "lfunc.h"
#include "lgc.h"
#include "lmem.h"
#include "lobject.h"
#include "lstate.h"
Include dependency graph for lfunc.cpp:

Go to the source code of this file.

Macros

#define lfunc_c
 
#define LUA_CORE
 

Functions

CClosureluaF_newCclosure (lua_State *L, int nupvals)
 
LClosureluaF_newLclosure (lua_State *L, int nupvals)
 
void luaF_initupvals (lua_State *L, LClosure *cl)
 
static UpValnewupval (lua_State *L, int tbc, StkId level, UpVal **prev)
 
UpValluaF_findupval (lua_State *L, StkId level)
 
static void callclose (lua_State *L, void *ud)
 
static int prepclosingmethod (lua_State *L, TValue *obj, TValue *err)
 
static void varerror (lua_State *L, StkId level, const char *msg)
 
static int callclosemth (lua_State *L, StkId level, int status)
 
static void trynewtbcupval (lua_State *L, void *ud)
 
void luaF_newtbcupval (lua_State *L, StkId level)
 
void luaF_unlinkupval (UpVal *uv)
 
int luaF_close (lua_State *L, StkId level, int status)
 
ProtoluaF_newproto (lua_State *L)
 
void luaF_freeproto (lua_State *L, Proto *f)
 
const char * luaF_getlocalname (const Proto *f, int local_number, int pc)
 

Macro Definition Documentation

◆ lfunc_c

#define lfunc_c

Definition at line 7 of file lfunc.cpp.

◆ LUA_CORE

#define LUA_CORE

Definition at line 8 of file lfunc.cpp.

Function Documentation

◆ callclose()

static void callclose ( lua_State L,
void *  ud 
)
static

Definition at line 103 of file lfunc.cpp.

References luaD_callnoyield(), lua_State::top, and UNUSED.

Referenced by callclosemth(), and luaF_newtbcupval().

◆ callclosemth()

static int callclosemth ( lua_State L,
StkId  level,
int  status 
)
static

◆ luaF_close()

int luaF_close ( lua_State L,
StkId  level,
int  status 
)

◆ luaF_findupval()

UpVal* luaF_findupval ( lua_State L,
StkId  level 
)

Definition at line 88 of file lfunc.cpp.

References G, isdead, isintwups, lua_assert, newupval(), UpVal::open, lua_State::openupval, p, UpVal::u, and uplevel.

Referenced by pushclosure().

◆ luaF_freeproto()

void luaF_freeproto ( lua_State L,
Proto f 
)

◆ luaF_getlocalname()

const char* luaF_getlocalname ( const Proto f,
int  local_number,
int  pc 
)

Definition at line 289 of file lfunc.cpp.

References getstr, i, Proto::locvars, Proto::sizelocvars, LocVar::startpc, and LocVar::varname.

Referenced by getobjname(), lua_getlocal(), and luaG_findlocal().

◆ luaF_initupvals()

void luaF_initupvals ( lua_State L,
LClosure cl 
)

Definition at line 48 of file lfunc.cpp.

References gco2upv, i, LUA_VUPVAL, luaC_newobj(), luaC_objbarrier, setnilvalue, UpVal::u, LClosure::upvals, UpVal::v, and UpVal::value.

Referenced by f_parser().

◆ luaF_newCclosure()

CClosure* luaF_newCclosure ( lua_State L,
int  nupvals 
)

Definition at line 27 of file lfunc.cpp.

References c, cast_byte, gco2ccl, LUA_VCCL, luaC_newobj(), and sizeCclosure.

Referenced by lua_pushcclosure().

◆ luaF_newLclosure()

LClosure* luaF_newLclosure ( lua_State L,
int  nupvals 
)

Definition at line 35 of file lfunc.cpp.

References c, cast_byte, gco2lcl, LUA_VLCL, luaC_newobj(), LClosure::p, sizeLclosure, and LClosure::upvals.

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

◆ luaF_newproto()

Proto* luaF_newproto ( lua_State L)

◆ luaF_newtbcupval()

void luaF_newtbcupval ( lua_State L,
StkId  level 
)

◆ luaF_unlinkupval()

void luaF_unlinkupval ( UpVal uv)

Definition at line 215 of file lfunc.cpp.

References lua_assert, UpVal::open, UpVal::u, and upisopen.

Referenced by freeupval(), and luaF_close().

◆ newupval()

static UpVal* newupval ( lua_State L,
int  tbc,
StkId  level,
UpVal **  prev 
)
static

◆ prepclosingmethod()

static int prepclosingmethod ( lua_State L,
TValue obj,
TValue err 
)
static

Definition at line 113 of file lfunc.cpp.

References luaT_gettmbyobj(), setobj2s, TM_CLOSE, lua_State::top, and ttisnil.

Referenced by callclosemth(), and luaF_newtbcupval().

◆ trynewtbcupval()

static void trynewtbcupval ( lua_State L,
void *  ud 
)
static

Definition at line 184 of file lfunc.cpp.

References cast, newupval(), and lua_State::openupval.

Referenced by luaF_newtbcupval().

◆ varerror()

static void varerror ( lua_State L,
StkId  level,
const char *  msg 
)
static

Definition at line 130 of file lfunc.cpp.

References cast_int, lua_State::ci, CallInfo::func, luaG_findlocal(), and luaG_runerror().

Referenced by callclosemth(), and luaF_newtbcupval().