annotate src/lua/ldo.h @ 262:868783405ac2

script: left oak's lab.
author Robert McIntyre <rlm@mit.edu>
date Mon, 26 Mar 2012 21:00:23 -0500
parents 27763b933818
children
rev   line source
rlm@1 1 /*
rlm@1 2 ** $Id: ldo.h,v 2.7.1.1 2007/12/27 13:02:25 roberto Exp $
rlm@1 3 ** Stack and Call structure of Lua
rlm@1 4 ** See Copyright Notice in lua.h
rlm@1 5 */
rlm@1 6
rlm@1 7 #ifndef ldo_h
rlm@1 8 #define ldo_h
rlm@1 9
rlm@1 10
rlm@1 11 #include "lobject.h"
rlm@1 12 #include "lstate.h"
rlm@1 13 #include "lzio.h"
rlm@1 14
rlm@1 15
rlm@1 16 #define luaD_checkstack(L,n) \
rlm@1 17 if ((char *)L->stack_last - (char *)L->top <= (n)*(int)sizeof(TValue)) \
rlm@1 18 luaD_growstack(L, n); \
rlm@1 19 else condhardstacktests(luaD_reallocstack(L, L->stacksize - EXTRA_STACK - 1));
rlm@1 20
rlm@1 21
rlm@1 22 #define incr_top(L) {luaD_checkstack(L,1); L->top++;}
rlm@1 23
rlm@1 24 #define savestack(L,p) ((char *)(p) - (char *)L->stack)
rlm@1 25 #define restorestack(L,n) ((TValue *)((char *)L->stack + (n)))
rlm@1 26
rlm@1 27 #define saveci(L,p) ((char *)(p) - (char *)L->base_ci)
rlm@1 28 #define restoreci(L,n) ((CallInfo *)((char *)L->base_ci + (n)))
rlm@1 29
rlm@1 30
rlm@1 31 /* results from luaD_precall */
rlm@1 32 #define PCRLUA 0 /* initiated a call to a Lua function */
rlm@1 33 #define PCRC 1 /* did a call to a C function */
rlm@1 34 #define PCRYIELD 2 /* C funtion yielded */
rlm@1 35
rlm@1 36
rlm@1 37 /* type of protected functions, to be ran by `runprotected' */
rlm@1 38 typedef void (*Pfunc) (lua_State *L, void *ud);
rlm@1 39
rlm@1 40 LUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name);
rlm@1 41 LUAI_FUNC void luaD_callhook (lua_State *L, int event, int line);
rlm@1 42 LUAI_FUNC int luaD_precall (lua_State *L, StkId func, int nresults);
rlm@1 43 LUAI_FUNC void luaD_call (lua_State *L, StkId func, int nResults);
rlm@1 44 LUAI_FUNC int luaD_pcall (lua_State *L, Pfunc func, void *u,
rlm@1 45 ptrdiff_t oldtop, ptrdiff_t ef);
rlm@1 46 LUAI_FUNC int luaD_poscall (lua_State *L, StkId firstResult);
rlm@1 47 LUAI_FUNC void luaD_reallocCI (lua_State *L, int newsize);
rlm@1 48 LUAI_FUNC void luaD_reallocstack (lua_State *L, int newsize);
rlm@1 49 LUAI_FUNC void luaD_growstack (lua_State *L, int n);
rlm@1 50
rlm@1 51 LUAI_FUNC void luaD_throw (lua_State *L, int errcode);
rlm@1 52 LUAI_FUNC int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud);
rlm@1 53
rlm@1 54 LUAI_FUNC void luaD_seterrorobj (lua_State *L, int errcode, StkId oldtop);
rlm@1 55
rlm@1 56 #endif
rlm@1 57