diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-04-12 13:07:29 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-04-12 13:07:29 -0300 |
commit | d20ff60615c3839ee14dd35c7aef0ca084fc24b4 (patch) | |
tree | 5f8a2decb76f82618e4fc340fcf952bcab166fa9 | |
parent | d41b467320e3962b36cf6011245e924a512a5f9a (diff) | |
download | lua-d20ff60615c3839ee14dd35c7aef0ca084fc24b4.tar.gz lua-d20ff60615c3839ee14dd35c7aef0ca084fc24b4.tar.bz2 lua-d20ff60615c3839ee14dd35c7aef0ca084fc24b4.zip |
new macro LUA_NUMTAGS
-rw-r--r-- | lgc.c | 4 | ||||
-rw-r--r-- | lobject.h | 14 | ||||
-rw-r--r-- | lstate.c | 4 | ||||
-rw-r--r-- | lstate.h | 4 | ||||
-rw-r--r-- | ltests.h | 4 | ||||
-rw-r--r-- | lua.h | 4 |
6 files changed, 15 insertions, 19 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lgc.c,v 2.76 2010/04/02 14:37:41 roberto Exp roberto $ | 2 | ** $Id: lgc.c,v 2.77 2010/04/05 14:15:35 roberto Exp roberto $ |
3 | ** Garbage Collector | 3 | ** Garbage Collector |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -213,7 +213,7 @@ static void reallymarkobject (global_State *g, GCObject *o) { | |||
213 | 213 | ||
214 | static void markmt (global_State *g) { | 214 | static void markmt (global_State *g) { |
215 | int i; | 215 | int i; |
216 | for (i=0; i<NUM_TAGS; i++) | 216 | for (i=0; i < LUA_NUMTAGS; i++) |
217 | markobject(g, g->mt[i]); | 217 | markobject(g, g->mt[i]); |
218 | } | 218 | } |
219 | 219 | ||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lobject.h,v 2.35 2010/03/12 19:14:06 roberto Exp roberto $ | 2 | ** $Id: lobject.h,v 2.36 2010/03/26 20:58:11 roberto Exp roberto $ |
3 | ** Type definitions for Lua objects | 3 | ** Type definitions for Lua objects |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -16,18 +16,12 @@ | |||
16 | #include "lua.h" | 16 | #include "lua.h" |
17 | 17 | ||
18 | 18 | ||
19 | /* tags for values visible from Lua */ | ||
20 | #define LAST_TAG LUA_TTHREAD | ||
21 | |||
22 | #define NUM_TAGS (LAST_TAG+1) | ||
23 | |||
24 | |||
25 | /* | 19 | /* |
26 | ** Extra tags for non-values | 20 | ** Extra tags for non-values |
27 | */ | 21 | */ |
28 | #define LUA_TPROTO (LAST_TAG+1) | 22 | #define LUA_TPROTO LUA_NUMTAGS |
29 | #define LUA_TUPVAL (LAST_TAG+2) | 23 | #define LUA_TUPVAL (LUA_NUMTAGS+1) |
30 | #define LUA_TDEADKEY (LAST_TAG+3) | 24 | #define LUA_TDEADKEY (LUA_NUMTAGS+2) |
31 | 25 | ||
32 | 26 | ||
33 | /* | 27 | /* |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstate.c,v 2.77 2010/04/05 16:35:37 roberto Exp roberto $ | 2 | ** $Id: lstate.c,v 2.78 2010/04/08 17:16:46 roberto Exp roberto $ |
3 | ** Global State | 3 | ** Global State |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -268,7 +268,7 @@ LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) { | |||
268 | g->totalbytes = sizeof(LG); | 268 | g->totalbytes = sizeof(LG); |
269 | g->gcpause = LUAI_GCPAUSE; | 269 | g->gcpause = LUAI_GCPAUSE; |
270 | g->gcstepmul = LUAI_GCMUL; | 270 | g->gcstepmul = LUAI_GCMUL; |
271 | for (i=0; i<NUM_TAGS; i++) g->mt[i] = NULL; | 271 | for (i=0; i < LUA_NUMTAGS; i++) g->mt[i] = NULL; |
272 | if (luaD_rawrunprotected(L, f_luaopen, NULL) != LUA_OK) { | 272 | if (luaD_rawrunprotected(L, f_luaopen, NULL) != LUA_OK) { |
273 | /* memory allocation error: free partial state */ | 273 | /* memory allocation error: free partial state */ |
274 | close_state(L); | 274 | close_state(L); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstate.h,v 2.60 2010/04/05 16:35:37 roberto Exp roberto $ | 2 | ** $Id: lstate.h,v 2.61 2010/04/08 17:16:46 roberto Exp roberto $ |
3 | ** Global State | 3 | ** Global State |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -144,7 +144,7 @@ typedef struct global_State { | |||
144 | const lua_Number *version; /* pointer to version number */ | 144 | const lua_Number *version; /* pointer to version number */ |
145 | TString *memerrmsg; /* memory-error message */ | 145 | TString *memerrmsg; /* memory-error message */ |
146 | TString *tmname[TM_N]; /* array with tag-method names */ | 146 | TString *tmname[TM_N]; /* array with tag-method names */ |
147 | struct Table *mt[NUM_TAGS]; /* metatables for basic types */ | 147 | struct Table *mt[LUA_NUMTAGS]; /* metatables for basic types */ |
148 | } global_State; | 148 | } global_State; |
149 | 149 | ||
150 | 150 | ||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltests.h,v 2.29 2009/12/17 12:26:09 roberto Exp roberto $ | 2 | ** $Id: ltests.h,v 2.30 2010/01/11 17:33:09 roberto Exp roberto $ |
3 | ** Internal Header for Debugging of the Lua Implementation | 3 | ** Internal Header for Debugging of the Lua Implementation |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -30,7 +30,7 @@ typedef struct Memcontrol { | |||
30 | unsigned long total; | 30 | unsigned long total; |
31 | unsigned long maxmem; | 31 | unsigned long maxmem; |
32 | unsigned long memlimit; | 32 | unsigned long memlimit; |
33 | unsigned long objcount[5]; | 33 | unsigned long objcount[LUA_NUMTAGS]; |
34 | } Memcontrol; | 34 | } Memcontrol; |
35 | 35 | ||
36 | extern Memcontrol l_memcontrol; | 36 | extern Memcontrol l_memcontrol; |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lua.h,v 1.265 2010/03/26 20:58:11 roberto Exp roberto $ | 2 | ** $Id: lua.h,v 1.266 2010/04/02 15:19:19 roberto Exp roberto $ |
3 | ** Lua - A Scripting Language | 3 | ** Lua - A Scripting Language |
4 | ** Lua.org, PUC-Rio, Brazil (http://www.lua.org) | 4 | ** Lua.org, PUC-Rio, Brazil (http://www.lua.org) |
5 | ** See Copyright Notice at the end of this file | 5 | ** 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); | |||
81 | #define LUA_TUSERDATA 7 | 81 | #define LUA_TUSERDATA 7 |
82 | #define LUA_TTHREAD 8 | 82 | #define LUA_TTHREAD 8 |
83 | 83 | ||
84 | #define LUA_NUMTAGS 9 | ||
85 | |||
84 | 86 | ||
85 | 87 | ||
86 | /* minimum Lua stack available to a C function */ | 88 | /* minimum Lua stack available to a C function */ |