misc/liblua/ldo.h
author sheepluva
Sun, 09 Aug 2015 04:30:41 +0200
changeset 11043 79a77bef4c61
parent 10017 de822cd3df3a
permissions -rw-r--r--
Hammer had been accessing dangling pointers under particular circumstances (e.g. when hitting a mine/barrel right when it exploded)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     1
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     2
** $Id: ldo.h,v 2.7.1.1 2007/12/27 13:02:25 roberto Exp $
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     3
** Stack and Call structure of Lua
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     4
** See Copyright Notice in lua.h
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     5
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     6
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     7
#ifndef ldo_h
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     8
#define ldo_h
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     9
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    10
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    11
#include "lobject.h"
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    12
#include "lstate.h"
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    13
#include "lzio.h"
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    14
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    15
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    16
#define luaD_checkstack(L,n)    \
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    17
  if ((char *)L->stack_last - (char *)L->top <= (n)*(int)sizeof(TValue)) \
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    18
    luaD_growstack(L, n); \
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    19
  else condhardstacktests(luaD_reallocstack(L, L->stacksize - EXTRA_STACK - 1));
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    20
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    21
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    22
#define incr_top(L) {luaD_checkstack(L,1); L->top++;}
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    23
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    24
#define savestack(L,p)      ((char *)(p) - (char *)L->stack)
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    25
#define restorestack(L,n)   ((TValue *)((char *)L->stack + (n)))
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    26
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    27
#define saveci(L,p)     ((char *)(p) - (char *)L->base_ci)
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    28
#define restoreci(L,n)      ((CallInfo *)((char *)L->base_ci + (n)))
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    29
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    30
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    31
/* results from luaD_precall */
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    32
#define PCRLUA      0   /* initiated a call to a Lua function */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    33
#define PCRC        1   /* did a call to a C function */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    34
#define PCRYIELD    2   /* C funtion yielded */
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    35
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    36
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    37
/* type of protected functions, to be ran by `runprotected' */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    38
typedef void (*Pfunc) (lua_State *L, void *ud);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    39
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    40
LUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    41
LUAI_FUNC void luaD_callhook (lua_State *L, int event, int line);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    42
LUAI_FUNC int luaD_precall (lua_State *L, StkId func, int nresults);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    43
LUAI_FUNC void luaD_call (lua_State *L, StkId func, int nResults);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    44
LUAI_FUNC int luaD_pcall (lua_State *L, Pfunc func, void *u,
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    45
                                        ptrdiff_t oldtop, ptrdiff_t ef);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    46
LUAI_FUNC int luaD_poscall (lua_State *L, StkId firstResult);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    47
LUAI_FUNC void luaD_reallocCI (lua_State *L, int newsize);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    48
LUAI_FUNC void luaD_reallocstack (lua_State *L, int newsize);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    49
LUAI_FUNC void luaD_growstack (lua_State *L, int n);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    50
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    51
LUAI_FUNC void luaD_throw (lua_State *L, int errcode);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    52
LUAI_FUNC int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    53
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    54
LUAI_FUNC void luaD_seterrorobj (lua_State *L, int errcode, StkId oldtop);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    55
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    56
#endif
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    57