The Battle for Wesnoth  1.15.2+dev
Macros | Functions | Variables
ldblib.cpp File Reference
#include "lprefix.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
Include dependency graph for ldblib.cpp:

Go to the source code of this file.

Macros

#define ldblib_c
 
#define LUA_LIB
 

Functions

static void checkstack (lua_State *L, lua_State *L1, int n)
 
static int db_getregistry (lua_State *L)
 
static int db_getmetatable (lua_State *L)
 
static int db_setmetatable (lua_State *L)
 
static int db_getuservalue (lua_State *L)
 
static int db_setuservalue (lua_State *L)
 
static lua_Stategetthread (lua_State *L, int *arg)
 
static void settabss (lua_State *L, const char *k, const char *v)
 
static void settabsi (lua_State *L, const char *k, int v)
 
static void settabsb (lua_State *L, const char *k, int v)
 
static void treatstackoption (lua_State *L, lua_State *L1, const char *fname)
 
static int db_getinfo (lua_State *L)
 
static int db_getlocal (lua_State *L)
 
static int db_setlocal (lua_State *L)
 
static int auxupvalue (lua_State *L, int get)
 
static int db_getupvalue (lua_State *L)
 
static int db_setupvalue (lua_State *L)
 
static int checkupval (lua_State *L, int argf, int argnup)
 
static int db_upvalueid (lua_State *L)
 
static int db_upvaluejoin (lua_State *L)
 
static void hookf (lua_State *L, lua_Debug *ar)
 
static int makemask (const char *smask, int count)
 
static char * unmakemask (int mask, char *smask)
 
static int db_sethook (lua_State *L)
 
static int db_gethook (lua_State *L)
 
static int db_debug (lua_State *L)
 
static int db_traceback (lua_State *L)
 
LUAMOD_API int luaopen_debug (lua_State *L)
 

Variables

static const int HOOKKEY = 0
 
static const luaL_Reg dblib []
 

Macro Definition Documentation

◆ ldblib_c

#define ldblib_c

Definition at line 7 of file ldblib.cpp.

◆ LUA_LIB

#define LUA_LIB

Definition at line 8 of file ldblib.cpp.

Function Documentation

◆ auxupvalue()

static int auxupvalue ( lua_State L,
int  get 
)
static

◆ checkstack()

static void checkstack ( lua_State L,
lua_State L1,
int  n 
)
static

Definition at line 35 of file ldblib.cpp.

References lua_checkstack(), and luaL_error().

Referenced by db_gethook(), db_getinfo(), db_getlocal(), db_sethook(), and db_setlocal().

◆ checkupval()

static int checkupval ( lua_State L,
int  argf,
int  argnup 
)
static

◆ db_debug()

static int db_debug ( lua_State L)
static

Definition at line 402 of file ldblib.cpp.

References lua_pcall, lua_settop(), lua_tostring, lua_writestringerror, and luaL_loadbuffer.

◆ db_gethook()

static int db_gethook ( lua_State L)
static

◆ db_getinfo()

static int db_getinfo ( lua_State L)
static

◆ db_getlocal()

static int db_getlocal ( lua_State L)
static

◆ db_getmetatable()

static int db_getmetatable ( lua_State L)
static

Definition at line 47 of file ldblib.cpp.

References lua_getmetatable(), lua_pushnil(), and luaL_checkany().

◆ db_getregistry()

static int db_getregistry ( lua_State L)
static

Definition at line 41 of file ldblib.cpp.

References lua_pushvalue(), and LUA_REGISTRYINDEX.

◆ db_getupvalue()

static int db_getupvalue ( lua_State L)
static

Definition at line 260 of file ldblib.cpp.

References auxupvalue().

◆ db_getuservalue()

static int db_getuservalue ( lua_State L)
static

Definition at line 66 of file ldblib.cpp.

References lua_getuservalue(), lua_pushnil(), LUA_TUSERDATA, and lua_type().

◆ db_sethook()

static int db_sethook ( lua_State L)
static

◆ db_setlocal()

static int db_setlocal ( lua_State L)
static

◆ db_setmetatable()

static int db_setmetatable ( lua_State L)
static

Definition at line 56 of file ldblib.cpp.

References lua_setmetatable(), lua_settop(), LUA_TNIL, LUA_TTABLE, lua_type(), luaL_argcheck, and t.

◆ db_setupvalue()

static int db_setupvalue ( lua_State L)
static

Definition at line 265 of file ldblib.cpp.

References auxupvalue(), and luaL_checkany().

◆ db_setuservalue()

static int db_setuservalue ( lua_State L)
static

◆ db_traceback()

static int db_traceback ( lua_State L)
static

◆ db_upvalueid()

static int db_upvalueid ( lua_State L)
static

Definition at line 284 of file ldblib.cpp.

References checkupval(), lua_pushlightuserdata(), lua_upvalueid(), and n.

◆ db_upvaluejoin()

static int db_upvaluejoin ( lua_State L)
static

Definition at line 291 of file ldblib.cpp.

References checkupval(), lua_iscfunction(), lua_upvaluejoin(), and luaL_argcheck.

◆ getthread()

static lua_State* getthread ( lua_State L,
int *  arg 
)
static

Definition at line 90 of file ldblib.cpp.

References lua_isthread, and lua_tothread().

Referenced by db_gethook(), db_getinfo(), db_getlocal(), db_sethook(), db_setlocal(), and db_traceback().

◆ hookf()

static void hookf ( lua_State L,
lua_Debug ar 
)
static

◆ luaopen_debug()

LUAMOD_API int luaopen_debug ( lua_State L)

Definition at line 452 of file ldblib.cpp.

References luaL_newlib.

Referenced by lua_kernel_base::lua_kernel_base().

◆ makemask()

static int makemask ( const char *  smask,
int  count 
)
static

Definition at line 324 of file ldblib.cpp.

References LUA_MASKCALL, LUA_MASKCOUNT, LUA_MASKLINE, and LUA_MASKRET.

Referenced by db_sethook().

◆ settabsb()

static void settabsb ( lua_State L,
const char *  k,
int  v 
)
static

Definition at line 117 of file ldblib.cpp.

References lua_pushboolean(), and lua_setfield().

Referenced by db_getinfo().

◆ settabsi()

static void settabsi ( lua_State L,
const char *  k,
int  v 
)
static

Definition at line 112 of file ldblib.cpp.

References lua_pushinteger(), and lua_setfield().

Referenced by db_getinfo().

◆ settabss()

static void settabss ( lua_State L,
const char *  k,
const char *  v 
)
static

Definition at line 107 of file ldblib.cpp.

References lua_pushstring(), and lua_setfield().

Referenced by db_getinfo().

◆ treatstackoption()

static void treatstackoption ( lua_State L,
lua_State L1,
const char *  fname 
)
static

Definition at line 130 of file ldblib.cpp.

References lua_rotate(), lua_setfield(), and lua_xmove().

Referenced by db_getinfo().

◆ unmakemask()

static char* unmakemask ( int  mask,
char *  smask 
)
static

Definition at line 337 of file ldblib.cpp.

References i, LUA_MASKCALL, LUA_MASKLINE, and LUA_MASKRET.

Referenced by db_gethook().

Variable Documentation

◆ dblib

const luaL_Reg dblib[]
static
Initial value:
= {
{"debug", db_debug},
{"getuservalue", db_getuservalue},
{"gethook", db_gethook},
{"getinfo", db_getinfo},
{"getlocal", db_getlocal},
{"getregistry", db_getregistry},
{"getmetatable", db_getmetatable},
{"getupvalue", db_getupvalue},
{"upvaluejoin", db_upvaluejoin},
{"upvalueid", db_upvalueid},
{"setuservalue", db_setuservalue},
{"sethook", db_sethook},
{"setlocal", db_setlocal},
{"setmetatable", db_setmetatable},
{"setupvalue", db_setupvalue},
{"traceback", db_traceback},
{NULL, NULL}
}
static int db_setmetatable(lua_State *L)
Definition: ldblib.cpp:56
static int db_setuservalue(lua_State *L)
Definition: ldblib.cpp:75
static int db_setupvalue(lua_State *L)
Definition: ldblib.cpp:265
static int db_getinfo(lua_State *L)
Definition: ldblib.cpp:145
static int db_traceback(lua_State *L)
Definition: ldblib.cpp:417
static int db_gethook(lua_State *L)
Definition: ldblib.cpp:379
static int db_debug(lua_State *L)
Definition: ldblib.cpp:402
static int db_upvaluejoin(lua_State *L)
Definition: ldblib.cpp:291
static int db_getuservalue(lua_State *L)
Definition: ldblib.cpp:66
static int db_getregistry(lua_State *L)
Definition: ldblib.cpp:41
static int db_upvalueid(lua_State *L)
Definition: ldblib.cpp:284
static int db_sethook(lua_State *L)
Definition: ldblib.cpp:347
static int db_getmetatable(lua_State *L)
Definition: ldblib.cpp:47
static int db_setlocal(lua_State *L)
Definition: ldblib.cpp:224
static int db_getlocal(lua_State *L)
Definition: ldblib.cpp:193
static int db_getupvalue(lua_State *L)
Definition: ldblib.cpp:260

Definition at line 431 of file ldblib.cpp.

◆ HOOKKEY

const int HOOKKEY = 0
static

Definition at line 27 of file ldblib.cpp.

Referenced by db_gethook(), db_sethook(), and hookf().