- Main Page
- Classes
- Files

# ldo.h

Go to the documentation of this file.

    00001 /*
    00002 ** $Id: ldo.h,v 2.7.1.1 2007/12/27 13:02:25 roberto Exp $
    00003 ** Stack and Call structure of Lua
    00004 ** See Copyright Notice in lua.h
    00005 */
    00006
    00007 #ifndef ldo_h
    00008 #define ldo_h
    00009
    00010
    00011 #include "lobject.h"
    00012 #include "lstate.h"
    00013 #include "lzio.h"
    00014
    00015
    00016 #define luaD_checkstack(L,n)    \
    00017   if ((char *)L->stack_last - (char *)L->top <= (n)*(int)sizeof(TValue)) \
    00018     luaD_growstack(L, n); \
    00019   else condhardstacktests(luaD_reallocstack(L, L->stacksize - EXTRA_STACK - 1));
    00020
    00021
    00022 #define incr_top(L) {luaD_checkstack(L,1); L->top++;}
    00023
    00024 #define savestack(L,p)          ((char *)(p) - (char *)L->stack)
    00025 #define restorestack(L,n)       ((TValue *)((char *)L->stack + (n)))
    00026
    00027 #define saveci(L,p)             ((char *)(p) - (char *)L->base_ci)
    00028 #define restoreci(L,n)          ((CallInfo *)((char *)L->base_ci + (n)))
    00029
    00030
    00031 /* results from luaD_precall */
    00032 #define PCRLUA          0       /* initiated a call to a Lua function */
    00033 #define PCRC            1       /* did a call to a C function */
    00034 #define PCRYIELD        2       /* C funtion yielded */
    00035
    00036
    00037 /* type of protected functions, to be ran by `runprotected' */
    00038 typedef void (*Pfunc) (lua_State *L, void *ud);
    00039
    00040 LUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name);
    00041 LUAI_FUNC void luaD_callhook (lua_State *L, int event, int line);
    00042 LUAI_FUNC int luaD_precall (lua_State *L, StkId func, int nresults);
    00043 LUAI_FUNC void luaD_call (lua_State *L, StkId func, int nResults);
    00044 LUAI_FUNC int luaD_pcall (lua_State *L, Pfunc func, void *u,
    00045                                         ptrdiff_t oldtop, ptrdiff_t ef);
    00046 LUAI_FUNC int luaD_poscall (lua_State *L, StkId firstResult);
    00047 LUAI_FUNC void luaD_reallocCI (lua_State *L, int newsize);
    00048 LUAI_FUNC void luaD_reallocstack (lua_State *L, int newsize);
    00049 LUAI_FUNC void luaD_growstack (lua_State *L, int n);
    00050
    00051 LUAI_FUNC void luaD_throw (lua_State *L, int errcode);
    00052 LUAI_FUNC int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud);
    00053
    00054 LUAI_FUNC void luaD_seterrorobj (lua_State *L, int errcode, StkId oldtop);
    00055
    00056 #endif
    00057