aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2005-05-20 16:09:05 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2005-05-20 16:09:05 -0300
commit38da9d568a4702a6f9405882db56c2a2aa3189c1 (patch)
tree2be313995c06dd80b8dcf6ccf8434b6ba7df1b30
parentf21e9c172f9f15d8d7501e35635e78dc11f5ff58 (diff)
downloadlua-38da9d568a4702a6f9405882db56c2a2aa3189c1.tar.gz
lua-38da9d568a4702a6f9405882db56c2a2aa3189c1.tar.bz2
lua-38da9d568a4702a6f9405882db56c2a2aa3189c1.zip
better use defined/undefined as flag values for macros
-rw-r--r--lauxlib.h4
-rw-r--r--ldo.c4
-rw-r--r--loadlib.c6
-rw-r--r--luaconf.h26
4 files changed, 20 insertions, 20 deletions
diff --git a/lauxlib.h b/lauxlib.h
index bbd96345..323798bc 100644
--- a/lauxlib.h
+++ b/lauxlib.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lauxlib.h,v 1.74 2005/01/10 17:31:50 roberto Exp roberto $ 2** $Id: lauxlib.h,v 1.75 2005/03/29 16:20:48 roberto Exp roberto $
3** Auxiliary functions for building Lua libraries 3** Auxiliary functions for building Lua libraries
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -15,7 +15,7 @@
15#include "lua.h" 15#include "lua.h"
16 16
17 17
18#if !LUA_COMPAT_GETN 18#if !defined(LUA_COMPAT_GETN)
19#define luaL_getn(L,i) lua_objsize(L, i) 19#define luaL_getn(L,i) lua_objsize(L, i)
20#define luaL_setn(L,i,j) ((void)0) /* no op! */ 20#define luaL_setn(L,i,j) ((void)0) /* no op! */
21#endif 21#endif
diff --git a/ldo.c b/ldo.c
index dc6da54f..d9e5a889 100644
--- a/ldo.c
+++ b/ldo.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldo.c,v 2.22 2005/04/05 13:41:29 roberto Exp roberto $ 2** $Id: ldo.c,v 2.23 2005/05/03 19:01:17 roberto Exp roberto $
3** Stack and Call structure of Lua 3** Stack and Call structure of Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -198,7 +198,7 @@ static StkId adjust_varargs (lua_State *L, int nfixargs, int actual,
198 for (; actual < nfixargs; ++actual) 198 for (; actual < nfixargs; ++actual)
199 setnilvalue(L->top++); 199 setnilvalue(L->top++);
200 } 200 }
201#if LUA_COMPAT_VARARG 201#if defined(LUA_COMPAT_VARARG)
202 if (style != NEWSTYLEVARARG) { /* compatibility with old-style vararg */ 202 if (style != NEWSTYLEVARARG) { /* compatibility with old-style vararg */
203 int nvar = actual - nfixargs; /* number of extra arguments */ 203 int nvar = actual - nfixargs; /* number of extra arguments */
204 luaC_checkGC(L); 204 luaC_checkGC(L);
diff --git a/loadlib.c b/loadlib.c
index 178be245..4b70054e 100644
--- a/loadlib.c
+++ b/loadlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: loadlib.c,v 1.27 2005/05/16 21:19:00 roberto Exp roberto $ 2** $Id: loadlib.c,v 1.28 2005/05/17 19:49:15 roberto Exp roberto $
3** Dynamic library loader for Lua 3** Dynamic library loader for Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5** 5**
@@ -315,7 +315,7 @@ static int loader_Lua (lua_State *L) {
315 const char *name = luaL_checkstring(L, 1); 315 const char *name = luaL_checkstring(L, 1);
316 const char *fname = luaL_gsub(L, name, ".", LUA_DIRSEP); 316 const char *fname = luaL_gsub(L, name, ".", LUA_DIRSEP);
317 const char *path = NULL; 317 const char *path = NULL;
318#if LUA_COMPAT_PATH 318#if defined(LUA_COMPAT_PATH)
319 /* try first `LUA_PATH' for compatibility */ 319 /* try first `LUA_PATH' for compatibility */
320 lua_pushstring(L, "LUA_PATH"); 320 lua_pushstring(L, "LUA_PATH");
321 lua_rawget(L, LUA_GLOBALSINDEX); 321 lua_rawget(L, LUA_GLOBALSINDEX);
@@ -508,7 +508,7 @@ LUALIB_API int luaopen_loadlib (lua_State *L) {
508 lua_setfield(L, -2, "preload"); 508 lua_setfield(L, -2, "preload");
509 /* create `loadlib' function */ 509 /* create `loadlib' function */
510 lua_pushcfunction(L, ll_loadlib); 510 lua_pushcfunction(L, ll_loadlib);
511#if LUA_COMPAT_LOADLIB 511#if defined(LUA_COMPAT_LOADLIB)
512 lua_pushvalue(L, -1); 512 lua_pushvalue(L, -1);
513 lua_setfield(L, LUA_GLOBALSINDEX, "loadlib"); 513 lua_setfield(L, LUA_GLOBALSINDEX, "loadlib");
514#endif 514#endif
diff --git a/luaconf.h b/luaconf.h
index eec37606..56eb89d6 100644
--- a/luaconf.h
+++ b/luaconf.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: luaconf.h,v 1.49 2005/05/17 19:49:15 roberto Exp roberto $ 2** $Id: luaconf.h,v 1.50 2005/05/20 15:53:42 roberto Exp roberto $
3** Configuration file for Lua 3** Configuration file for Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -257,31 +257,31 @@
257 257
258/* 258/*
259@@ LUA_COMPAT_GETN controls compatibility with old getn behavior. 259@@ LUA_COMPAT_GETN controls compatibility with old getn behavior.
260** CHANGE it to 1 if you want exact compatibility with the behavior of 260** CHANGE it (define it) if you want exact compatibility with the
261** setn/getn in Lua 5.0. 261** behavior of setn/getn in Lua 5.0.
262*/ 262*/
263#define LUA_COMPAT_GETN 0 263#undef LUA_COMPAT_GETN
264 264
265/* 265/*
266@@ LUA_COMPAT_PATH controls compatibility about LUA_PATH. 266@@ LUA_COMPAT_PATH controls compatibility about LUA_PATH.
267** CHANGE it to 1 if you want 'require' to look for global LUA_PATH 267** CHANGE it (define it) if you want 'require' to look for global
268** before checking package.path. 268** LUA_PATH before checking package.path.
269*/ 269*/
270#define LUA_COMPAT_PATH 0 270#undef LUA_COMPAT_PATH
271 271
272/* 272/*
273@@ LUA_COMPAT_LOADLIB controls compatibility about global loadlib. 273@@ LUA_COMPAT_LOADLIB controls compatibility about global loadlib.
274** CHANGE it to 1 if you want a global 'loadlib' function (otherwise 274** CHANGE it to undefined as soon as you do not need a global 'loadlib'
275** the function is only available as 'package.loadlib'). 275** function (the function is still available as 'package.loadlib').
276*/ 276*/
277#define LUA_COMPAT_LOADLIB 1 277#define LUA_COMPAT_LOADLIB
278 278
279/* 279/*
280@@ LUA_COMPAT_VARARG controls compatibility with old vararg feature. 280@@ LUA_COMPAT_VARARG controls compatibility with old vararg feature.
281** CHANGE it to 1 if you want vararg functions that do not use '...' 281** CHANGE it to undefined as soon as your programs use '...' to access
282** to get an 'arg' table with their extra arguments. 282** vararg parameters (instead of the old 'arg' table).
283*/ 283*/
284#define LUA_COMPAT_VARARG 1 284#define LUA_COMPAT_VARARG
285 285
286/* 286/*
287@@ LUA_COMPAT_LSTR controls compatibility with old long string nesting 287@@ LUA_COMPAT_LSTR controls compatibility with old long string nesting