new macro LUA_NUMTAGS
This commit is contained in:
4
lgc.c
4
lgc.c
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: lgc.c,v 2.76 2010/04/02 14:37:41 roberto Exp roberto $
|
** $Id: lgc.c,v 2.77 2010/04/05 14:15:35 roberto Exp roberto $
|
||||||
** Garbage Collector
|
** Garbage Collector
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@@ -213,7 +213,7 @@ static void reallymarkobject (global_State *g, GCObject *o) {
|
|||||||
|
|
||||||
static void markmt (global_State *g) {
|
static void markmt (global_State *g) {
|
||||||
int i;
|
int i;
|
||||||
for (i=0; i<NUM_TAGS; i++)
|
for (i=0; i < LUA_NUMTAGS; i++)
|
||||||
markobject(g, g->mt[i]);
|
markobject(g, g->mt[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
14
lobject.h
14
lobject.h
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: lobject.h,v 2.35 2010/03/12 19:14:06 roberto Exp roberto $
|
** $Id: lobject.h,v 2.36 2010/03/26 20:58:11 roberto Exp roberto $
|
||||||
** Type definitions for Lua objects
|
** Type definitions for Lua objects
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@@ -16,18 +16,12 @@
|
|||||||
#include "lua.h"
|
#include "lua.h"
|
||||||
|
|
||||||
|
|
||||||
/* tags for values visible from Lua */
|
|
||||||
#define LAST_TAG LUA_TTHREAD
|
|
||||||
|
|
||||||
#define NUM_TAGS (LAST_TAG+1)
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Extra tags for non-values
|
** Extra tags for non-values
|
||||||
*/
|
*/
|
||||||
#define LUA_TPROTO (LAST_TAG+1)
|
#define LUA_TPROTO LUA_NUMTAGS
|
||||||
#define LUA_TUPVAL (LAST_TAG+2)
|
#define LUA_TUPVAL (LUA_NUMTAGS+1)
|
||||||
#define LUA_TDEADKEY (LAST_TAG+3)
|
#define LUA_TDEADKEY (LUA_NUMTAGS+2)
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
4
lstate.c
4
lstate.c
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: lstate.c,v 2.77 2010/04/05 16:35:37 roberto Exp roberto $
|
** $Id: lstate.c,v 2.78 2010/04/08 17:16:46 roberto Exp roberto $
|
||||||
** Global State
|
** Global State
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@@ -268,7 +268,7 @@ LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) {
|
|||||||
g->totalbytes = sizeof(LG);
|
g->totalbytes = sizeof(LG);
|
||||||
g->gcpause = LUAI_GCPAUSE;
|
g->gcpause = LUAI_GCPAUSE;
|
||||||
g->gcstepmul = LUAI_GCMUL;
|
g->gcstepmul = LUAI_GCMUL;
|
||||||
for (i=0; i<NUM_TAGS; i++) g->mt[i] = NULL;
|
for (i=0; i < LUA_NUMTAGS; i++) g->mt[i] = NULL;
|
||||||
if (luaD_rawrunprotected(L, f_luaopen, NULL) != LUA_OK) {
|
if (luaD_rawrunprotected(L, f_luaopen, NULL) != LUA_OK) {
|
||||||
/* memory allocation error: free partial state */
|
/* memory allocation error: free partial state */
|
||||||
close_state(L);
|
close_state(L);
|
||||||
|
|||||||
4
lstate.h
4
lstate.h
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: lstate.h,v 2.60 2010/04/05 16:35:37 roberto Exp roberto $
|
** $Id: lstate.h,v 2.61 2010/04/08 17:16:46 roberto Exp roberto $
|
||||||
** Global State
|
** Global State
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@@ -144,7 +144,7 @@ typedef struct global_State {
|
|||||||
const lua_Number *version; /* pointer to version number */
|
const lua_Number *version; /* pointer to version number */
|
||||||
TString *memerrmsg; /* memory-error message */
|
TString *memerrmsg; /* memory-error message */
|
||||||
TString *tmname[TM_N]; /* array with tag-method names */
|
TString *tmname[TM_N]; /* array with tag-method names */
|
||||||
struct Table *mt[NUM_TAGS]; /* metatables for basic types */
|
struct Table *mt[LUA_NUMTAGS]; /* metatables for basic types */
|
||||||
} global_State;
|
} global_State;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
4
ltests.h
4
ltests.h
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: ltests.h,v 2.29 2009/12/17 12:26:09 roberto Exp roberto $
|
** $Id: ltests.h,v 2.30 2010/01/11 17:33:09 roberto Exp roberto $
|
||||||
** Internal Header for Debugging of the Lua Implementation
|
** Internal Header for Debugging of the Lua Implementation
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@@ -30,7 +30,7 @@ typedef struct Memcontrol {
|
|||||||
unsigned long total;
|
unsigned long total;
|
||||||
unsigned long maxmem;
|
unsigned long maxmem;
|
||||||
unsigned long memlimit;
|
unsigned long memlimit;
|
||||||
unsigned long objcount[5];
|
unsigned long objcount[LUA_NUMTAGS];
|
||||||
} Memcontrol;
|
} Memcontrol;
|
||||||
|
|
||||||
extern Memcontrol l_memcontrol;
|
extern Memcontrol l_memcontrol;
|
||||||
|
|||||||
4
lua.h
4
lua.h
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: lua.h,v 1.265 2010/03/26 20:58:11 roberto Exp roberto $
|
** $Id: lua.h,v 1.266 2010/04/02 15:19:19 roberto Exp roberto $
|
||||||
** Lua - A Scripting Language
|
** Lua - A Scripting Language
|
||||||
** Lua.org, PUC-Rio, Brazil (http://www.lua.org)
|
** Lua.org, PUC-Rio, Brazil (http://www.lua.org)
|
||||||
** See Copyright Notice at the end of this file
|
** See Copyright Notice at the end of this file
|
||||||
@@ -81,6 +81,8 @@ typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize);
|
|||||||
#define LUA_TUSERDATA 7
|
#define LUA_TUSERDATA 7
|
||||||
#define LUA_TTHREAD 8
|
#define LUA_TTHREAD 8
|
||||||
|
|
||||||
|
#define LUA_NUMTAGS 9
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* minimum Lua stack available to a C function */
|
/* minimum Lua stack available to a C function */
|
||||||
|
|||||||
Reference in New Issue
Block a user