mirror of https://github.com/rusefi/lua.git
(much) better handling of memory alloction errors
This commit is contained in:
parent
435f587ed0
commit
397905ef86
3
ldo.h
3
ldo.h
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
** $Id: ldo.h,v 1.20 2000/04/14 18:12:35 roberto Exp $
|
** $Id: ldo.h,v 1.21 2000/06/28 20:21:06 roberto Exp roberto $
|
||||||
** Stack and Call structure of Lua
|
** Stack and Call structure of Lua
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
|
@ -25,6 +25,7 @@ void luaD_openstack (lua_State *L, StkId pos);
|
||||||
void luaD_lineHook (lua_State *L, StkId func, int line, lua_Hook linehook);
|
void luaD_lineHook (lua_State *L, StkId func, int line, lua_Hook linehook);
|
||||||
void luaD_call (lua_State *L, StkId func, int nResults);
|
void luaD_call (lua_State *L, StkId func, int nResults);
|
||||||
void luaD_callTM (lua_State *L, const TObject *f, int nParams, int nResults);
|
void luaD_callTM (lua_State *L, const TObject *f, int nParams, int nResults);
|
||||||
|
void luaD_breakrun (lua_State *L, int errcode);
|
||||||
int luaD_protectedrun (lua_State *L);
|
int luaD_protectedrun (lua_State *L);
|
||||||
void luaD_checkstack (lua_State *L, int n);
|
void luaD_checkstack (lua_State *L, int n);
|
||||||
|
|
||||||
|
|
6
lmem.h
6
lmem.h
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
** $Id: lmem.h,v 1.13 2000/03/16 20:35:07 roberto Exp roberto $
|
** $Id: lmem.h,v 1.14 2000/05/24 13:54:49 roberto Exp roberto $
|
||||||
** Interface to Memory Manager
|
** Interface to Memory Manager
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
|
@ -13,9 +13,6 @@
|
||||||
#include "llimits.h"
|
#include "llimits.h"
|
||||||
#include "lua.h"
|
#include "lua.h"
|
||||||
|
|
||||||
/* memory error message */
|
|
||||||
#define memEM "not enough memory"
|
|
||||||
|
|
||||||
void *luaM_realloc (lua_State *L, void *oldblock, lint32 size);
|
void *luaM_realloc (lua_State *L, void *oldblock, lint32 size);
|
||||||
void *luaM_growaux (lua_State *L, void *block, size_t nelems,
|
void *luaM_growaux (lua_State *L, void *block, size_t nelems,
|
||||||
int inc, size_t size, const char *errormsg,
|
int inc, size_t size, const char *errormsg,
|
||||||
|
@ -37,6 +34,7 @@ void *luaM_growaux (lua_State *L, void *block, size_t nelems,
|
||||||
extern unsigned long memdebug_numblocks;
|
extern unsigned long memdebug_numblocks;
|
||||||
extern unsigned long memdebug_total;
|
extern unsigned long memdebug_total;
|
||||||
extern unsigned long memdebug_maxmem;
|
extern unsigned long memdebug_maxmem;
|
||||||
|
extern unsigned long memdebug_memlimit;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
9
lstate.h
9
lstate.h
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
** $Id: lstate.h,v 1.33 2000/05/10 16:33:20 roberto Exp roberto $
|
** $Id: lstate.h,v 1.34 2000/05/24 13:54:49 roberto Exp roberto $
|
||||||
** Global State
|
** Global State
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
|
@ -19,11 +19,14 @@ typedef TObject *StkId; /* index to stack elements */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** `jmp_buf' may be an array, so it is better to make sure it has an
|
** chain list of long jumps
|
||||||
** address (and not that it *is* an address...)
|
|
||||||
*/
|
*/
|
||||||
struct lua_longjmp {
|
struct lua_longjmp {
|
||||||
jmp_buf b;
|
jmp_buf b;
|
||||||
|
struct lua_longjmp *previous;
|
||||||
|
volatile int status; /* error code */
|
||||||
|
StkId base;
|
||||||
|
int numCblocks;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
14
lua.h
14
lua.h
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
** $Id: lua.h,v 1.54 2000/05/26 19:17:57 roberto Exp roberto $
|
** $Id: lua.h,v 1.55 2000/06/30 19:17:08 roberto Exp roberto $
|
||||||
** Lua - An Extensible Extension Language
|
** Lua - An Extensible Extension Language
|
||||||
** TeCGraf: Grupo de Tecnologia em Computacao Grafica, PUC-Rio, Brazil
|
** TeCGraf: Grupo de Tecnologia em Computacao Grafica, PUC-Rio, Brazil
|
||||||
** e-mail: lua@tecgraf.puc-rio.br
|
** e-mail: lua@tecgraf.puc-rio.br
|
||||||
|
@ -30,6 +30,14 @@
|
||||||
|
|
||||||
#define LUA_ANYTAG (-1)
|
#define LUA_ANYTAG (-1)
|
||||||
|
|
||||||
|
|
||||||
|
/* error code for lua_do* */
|
||||||
|
#define LUA_ERRFILE 2
|
||||||
|
#define LUA_ERRSYNTAX 3
|
||||||
|
#define LUA_ERRRUN 1
|
||||||
|
#define LUA_ERRMEM 4
|
||||||
|
|
||||||
|
|
||||||
typedef struct lua_State lua_State;
|
typedef struct lua_State lua_State;
|
||||||
|
|
||||||
typedef void (*lua_CFunction) (lua_State *L);
|
typedef void (*lua_CFunction) (lua_State *L);
|
||||||
|
@ -58,7 +66,7 @@ int lua_dostring (lua_State *L, const char *str);
|
||||||
int lua_dobuffer (lua_State *L, const char *buff, size_t size,
|
int lua_dobuffer (lua_State *L, const char *buff, size_t size,
|
||||||
const char *name); /* Out: returns */
|
const char *name); /* Out: returns */
|
||||||
int lua_callfunction (lua_State *L, lua_Object f);
|
int lua_callfunction (lua_State *L, lua_Object f);
|
||||||
/* In: parameters; Out: returns */
|
/* In: arguments; Out: returns */
|
||||||
|
|
||||||
void lua_beginblock (lua_State *L);
|
void lua_beginblock (lua_State *L);
|
||||||
void lua_endblock (lua_State *L);
|
void lua_endblock (lua_State *L);
|
||||||
|
@ -111,7 +119,7 @@ lua_Object lua_rawget (lua_State *L); /* In: table, index */
|
||||||
int lua_tag (lua_State *L, lua_Object obj);
|
int lua_tag (lua_State *L, lua_Object obj);
|
||||||
|
|
||||||
int lua_next (lua_State *L, lua_Object o, int i);
|
int lua_next (lua_State *L, lua_Object o, int i);
|
||||||
/* Out: ref, value */
|
/* Out: index, value */
|
||||||
|
|
||||||
int lua_ref (lua_State *L, int lock); /* In: value */
|
int lua_ref (lua_State *L, int lock); /* In: value */
|
||||||
lua_Object lua_getref (lua_State *L, int ref);
|
lua_Object lua_getref (lua_State *L, int ref);
|
||||||
|
|
Loading…
Reference in New Issue