diff src/lua/src/ldo.h @ 1:f9f4f1b99eed

importing src directory
author Robert McIntyre <rlm@mit.edu>
date Sat, 03 Mar 2012 10:31:27 -0600
parents
children
line wrap: on
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/lua/src/ldo.h	Sat Mar 03 10:31:27 2012 -0600
     1.3 @@ -0,0 +1,57 @@
     1.4 +/*
     1.5 +** $Id: ldo.h,v 2.7.1.1 2007/12/27 13:02:25 roberto Exp $
     1.6 +** Stack and Call structure of Lua
     1.7 +** See Copyright Notice in lua.h
     1.8 +*/
     1.9 +
    1.10 +#ifndef ldo_h
    1.11 +#define ldo_h
    1.12 +
    1.13 +
    1.14 +#include "lobject.h"
    1.15 +#include "lstate.h"
    1.16 +#include "lzio.h"
    1.17 +
    1.18 +
    1.19 +#define luaD_checkstack(L,n)	\
    1.20 +  if ((char *)L->stack_last - (char *)L->top <= (n)*(int)sizeof(TValue)) \
    1.21 +    luaD_growstack(L, n); \
    1.22 +  else condhardstacktests(luaD_reallocstack(L, L->stacksize - EXTRA_STACK - 1));
    1.23 +
    1.24 +
    1.25 +#define incr_top(L) {luaD_checkstack(L,1); L->top++;}
    1.26 +
    1.27 +#define savestack(L,p)		((char *)(p) - (char *)L->stack)
    1.28 +#define restorestack(L,n)	((TValue *)((char *)L->stack + (n)))
    1.29 +
    1.30 +#define saveci(L,p)		((char *)(p) - (char *)L->base_ci)
    1.31 +#define restoreci(L,n)		((CallInfo *)((char *)L->base_ci + (n)))
    1.32 +
    1.33 +
    1.34 +/* results from luaD_precall */
    1.35 +#define PCRLUA		0	/* initiated a call to a Lua function */
    1.36 +#define PCRC		1	/* did a call to a C function */
    1.37 +#define PCRYIELD	2	/* C funtion yielded */
    1.38 +
    1.39 +
    1.40 +/* type of protected functions, to be ran by `runprotected' */
    1.41 +typedef void (*Pfunc) (lua_State *L, void *ud);
    1.42 +
    1.43 +LUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name);
    1.44 +LUAI_FUNC void luaD_callhook (lua_State *L, int event, int line);
    1.45 +LUAI_FUNC int luaD_precall (lua_State *L, StkId func, int nresults);
    1.46 +LUAI_FUNC void luaD_call (lua_State *L, StkId func, int nResults);
    1.47 +LUAI_FUNC int luaD_pcall (lua_State *L, Pfunc func, void *u,
    1.48 +                                        ptrdiff_t oldtop, ptrdiff_t ef);
    1.49 +LUAI_FUNC int luaD_poscall (lua_State *L, StkId firstResult);
    1.50 +LUAI_FUNC void luaD_reallocCI (lua_State *L, int newsize);
    1.51 +LUAI_FUNC void luaD_reallocstack (lua_State *L, int newsize);
    1.52 +LUAI_FUNC void luaD_growstack (lua_State *L, int n);
    1.53 +
    1.54 +LUAI_FUNC void luaD_throw (lua_State *L, int errcode);
    1.55 +LUAI_FUNC int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud);
    1.56 +
    1.57 +LUAI_FUNC void luaD_seterrorobj (lua_State *L, int errcode, StkId oldtop);
    1.58 +
    1.59 +#endif
    1.60 +