lua/ldo.c File Reference

#include <setjmp.h>
#include <stdlib.h>
#include <string.h>
#include "lua.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"

Go to the source code of this file.

Data Structures

struct  lua_longjmp
struct  SParser

Defines

#define ldo_c

Functions

static void seterrorobj (lua_State *L, int errcode, StkId oldtop)
void luaD_throw (lua_State *L, int errcode)
int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud)
static void restore_stack_limit (lua_State *L)
static void correctstack (lua_State *L, TObject *oldstack)
void luaD_reallocstack (lua_State *L, int newsize)
void luaD_reallocCI (lua_State *L, int newsize)
void luaD_growstack (lua_State *L, int n)
static void luaD_growCI (lua_State *L)
void luaD_callhook (lua_State *L, int event, int line)
static void adjust_varargs (lua_State *L, int nfixargs, StkId base)
static StkId tryfuncTM (lua_State *L, StkId func)
StkId luaD_precall (lua_State *L, StkId func)
static StkId callrethooks (lua_State *L, StkId firstResult)
void luaD_poscall (lua_State *L, int wanted, StkId firstResult)
void luaD_call (lua_State *L, StkId func, int nResults)
static void resume (lua_State *L, void *ud)
static int resume_error (lua_State *L, const char *msg)
LUA_API int lua_resume (lua_State *L, int nargs)
LUA_API int lua_yield (lua_State *L, int nresults)
int luaD_pcall (lua_State *L, Pfunc func, void *u, ptrdiff_t old_top, ptrdiff_t ef)
static void f_parser (lua_State *L, void *ud)
int luaD_protectedparser (lua_State *L, ZIO *z, int bin)


Define Documentation

#define ldo_c

Definition at line 12 of file ldo.c.


Function Documentation

static void adjust_varargs ( lua_State L,
int  nfixargs,
StkId  base 
) [static]

Definition at line 191 of file ldo.c.

References cast, incr_top, luaD_checkstack, luaH_new(), luaH_set(), luaH_setnum(), luaS_newliteral, sethvalue, setnilvalue, setnvalue, setobj2n, setsvalue, and lua_State::top.

Referenced by luaD_precall().

static StkId callrethooks ( lua_State L,
StkId  firstResult 
) [static]

Definition at line 281 of file ldo.c.

References lua_State::ci, CI_C, CallInfo::l, luaD_callhook(), restorestack, savestack, CallInfo::state, and CallInfo::u.

Referenced by luaD_poscall().

static void correctstack ( lua_State L,
TObject oldstack 
) [static]

Definition at line 110 of file ldo.c.

References lua_State::base, CallInfo::base, lua_State::base_ci, lua_State::ci, GCObject::gch, gcotouv, GCheader::next, lua_State::openupval, lua_State::stack, CallInfo::top, and lua_State::top.

Referenced by luaD_reallocstack().

static void f_parser ( lua_State L,
void *  ud 
) [static]

Definition at line 466 of file ldo.c.

References SParser::bin, SParser::buff, cast, gt, incr_top, Closure::l, luaC_checkGC, luaF_newLclosure(), luaU_undump(), luaY_parser(), LClosure::p, setclvalue, lua_State::top, and SParser::z.

Referenced by luaD_protectedparser().

LUA_API int lua_resume ( lua_State L,
int  nargs 
)

Definition at line 379 of file ldo.c.

References lua_State::base, lua_State::base_ci, lua_State::ci, CI_YIELD, lua_assert, lua_lock, lua_unlock, luaD_rawrunprotected(), luaF_close(), restore_stack_limit(), resume(), resume_error(), seterrorobj(), CallInfo::state, lua_longjmp::status, and lua_State::top.

LUA_API int lua_yield ( lua_State L,
int  nresults 
)

Definition at line 408 of file ldo.c.

References lua_State::ci, CI_C, CI_YIELD, lua_lock, lua_unlock, luaG_runerror(), lua_State::nCcalls, setobjs2s, and CallInfo::state.

void luaD_call ( lua_State L,
StkId  func,
int  nResults 
)

Definition at line 318 of file ldo.c.

References lua_State::ci, CI_CALLING, lua_assert, LUA_MAXCCALLS, luaC_checkGC, luaD_poscall(), luaD_precall(), luaD_throw(), luaG_runerror(), luaV_execute(), lua_State::nCcalls, and CallInfo::state.

Referenced by callTM(), callTMres(), do1gcTM(), f_call(), f_Ccall(), lua_call(), and luaG_errormsg().

void luaD_callhook ( lua_State L,
int  event,
int  line 
)

Definition at line 165 of file ldo.c.

References lua_State::allowhook, ar, lua_State::base_ci, lua_State::ci, lua_State::hook, lua_assert, lua_lock, lua_unlock, luaD_checkstack, restorestack, savestack, lua_State::top, and CallInfo::top.

Referenced by callrethooks(), luaD_precall(), luaV_execute(), and traceexec().

static void luaD_growCI ( lua_State L  )  [static]

Definition at line 152 of file ldo.c.

References LUA_MAXCALLS, luaD_reallocCI(), luaD_throw(), luaG_runerror(), and lua_State::size_ci.

Referenced by luaD_precall().

void luaD_growstack ( lua_State L,
int  n 
)

Definition at line 144 of file ldo.c.

References EXTRA_STACK, luaD_reallocstack(), and lua_State::stacksize.

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

Definition at line 432 of file ldo.c.

References lua_State::allowhook, lua_State::base, CallInfo::base, lua_State::ci, lua_State::errfunc, luaD_rawrunprotected(), luaF_close(), lua_State::nCcalls, restore_stack_limit(), restoreci, restorestack, saveci, seterrorobj(), and lua_longjmp::status.

Referenced by lua_cpcall(), and lua_pcall().

void luaD_poscall ( lua_State L,
int  wanted,
StkId  firstResult 
)

Definition at line 294 of file ldo.c.

References lua_State::base, CallInfo::base, callrethooks(), lua_State::ci, lua_State::hookmask, setnilvalue, setobjs2s, and lua_State::top.

Referenced by luaD_call(), and resume().

StkId luaD_precall ( lua_State L,
StkId  func 
)

Definition at line 234 of file ldo.c.

References adjust_varargs(), lua_State::base, CallInfo::base, lua_State::ci, CI_C, CI_SAVEDPC, clvalue, Proto::code, condhardstacktests, lua_State::end_ci, lua_State::hookmask, Proto::is_vararg, LClosure::isC, CallInfo::l, lua_lock, lua_pushupvalues(), lua_unlock, luaD_callhook(), luaD_checkstack, luaD_growCI(), luaD_reallocCI(), Proto::maxstacksize, Proto::numparams, LClosure::p, restorestack, savestack, setnilvalue, lua_State::size_ci, CallInfo::state, CallInfo::top, lua_State::top, tryfuncTM(), ttisfunction, and CallInfo::u.

Referenced by luaD_call(), and resume().

int luaD_protectedparser ( lua_State L,
ZIO z,
int  bin 
)

Definition at line 482 of file ldo.c.

References SParser::bin, SParser::buff, f_parser(), luaD_rawrunprotected(), luaZ_freebuffer, luaZ_initbuffer, restorestack, savestack, seterrorobj(), lua_State::top, and SParser::z.

Referenced by lua_load().

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

Definition at line 84 of file ldo.c.

References lua_longjmp::b, lua_State::errorJmp, lua_longjmp::previous, and lua_longjmp::status.

Referenced by lua_close(), lua_open(), lua_resume(), luaD_pcall(), and luaD_protectedparser().

void luaD_reallocCI ( lua_State L,
int  newsize 
)

Definition at line 135 of file ldo.c.

References lua_State::base_ci, cast, lua_State::ci, lua_State::end_ci, luaM_reallocvector, and lua_State::size_ci.

Referenced by checkstacksizes(), luaD_growCI(), luaD_precall(), and restore_stack_limit().

void luaD_reallocstack ( lua_State L,
int  newsize 
)

Definition at line 126 of file ldo.c.

References correctstack(), EXTRA_STACK, luaM_reallocvector, lua_State::stack, lua_State::stack_last, and lua_State::stacksize.

Referenced by checkstacksizes(), and luaD_growstack().

void luaD_throw ( lua_State L,
int  errcode 
)

Definition at line 72 of file ldo.c.

References lua_longjmp::b, lua_State::errorJmp, EXIT_FAILURE, G, and lua_longjmp::status.

Referenced by f_luaopen(), luaD_call(), luaD_growCI(), luaG_errormsg(), luaM_realloc(), and luaX_errorline().

static void restore_stack_limit ( lua_State L  )  [static]

Definition at line 96 of file ldo.c.

References lua_State::base_ci, lua_State::ci, LUA_MAXCALLS, luaD_reallocCI(), lua_State::size_ci, lua_State::stack, lua_State::stack_last, and lua_State::stacksize.

Referenced by lua_resume(), and luaD_pcall().

static void resume ( lua_State L,
void *  ud 
) [static]

Definition at line 336 of file ldo.c.

References lua_State::base, lua_State::base_ci, cast, lua_State::ci, CI_C, CI_SAVEDPC, CI_YIELD, GET_OPCODE, GETARG_C, lua_assert, luaD_poscall(), luaD_precall(), luaV_execute(), OP_CALL, OP_TAILCALL, CallInfo::state, CallInfo::top, and lua_State::top.

Referenced by lua_resume().

static int resume_error ( lua_State L,
const char *  msg 
) [static]

Definition at line 368 of file ldo.c.

References CallInfo::base, lua_State::ci, incr_top, lua_unlock, luaS_new, setsvalue2s, and lua_State::top.

Referenced by lua_resume().

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

Definition at line 50 of file ldo.c.

References luaS_new, MEMERRMSG, setobjs2s, setsvalue2s, and lua_State::top.

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

static StkId tryfuncTM ( lua_State L,
StkId  func 
) [static]

Definition at line 217 of file ldo.c.

References incr_top, luaG_typeerror(), luaT_gettmbyobj(), restorestack, savestack, setobj2s, setobjs2s, TM_CALL, and ttisfunction.

Referenced by luaD_precall().


Generated on Fri Oct 12 08:44:55 2007 for rpm by  doxygen 1.5.2