Browse Source

avoid the use of "obvious" names in header files to avoid conflicts

v5-2
Roberto Ierusalimschy 23 years ago
parent
commit
2c670baf24
  1. 20
      lauxlib.c
  2. 24
      lauxlib.h
  3. 78
      lua.h

20
lauxlib.c

@ -1,5 +1,5 @@
/*
** $Id: lauxlib.c,v 1.82 2002/08/06 18:01:50 roberto Exp roberto $
** $Id: lauxlib.c,v 1.83 2002/08/08 20:08:41 roberto Exp roberto $
** Auxiliary functions for building Lua libraries
** See Copyright Notice in lua.h
*/
@ -208,27 +208,27 @@ static int emptybuffer (luaL_Buffer *B) {
else {
lua_pushlstring(B->L, B->buffer, l);
B->p = B->buffer;
B->level++;
B->lvl++;
return 1;
}
}
static void adjuststack (luaL_Buffer *B) {
if (B->level > 1) {
if (B->lvl > 1) {
lua_State *L = B->L;
int toget = 1; /* number of levels to concat */
size_t toplen = lua_strlen(L, -1);
do {
size_t l = lua_strlen(L, -(toget+1));
if (B->level - toget + 1 >= LIMIT || toplen > l) {
if (B->lvl - toget + 1 >= LIMIT || toplen > l) {
toplen += l;
toget++;
}
else break;
} while (toget < B->level);
} while (toget < B->lvl);
lua_concat(L, toget);
B->level = B->level - toget + 1;
B->lvl = B->lvl - toget + 1;
}
}
@ -253,8 +253,8 @@ LUALIB_API void luaL_addstring (luaL_Buffer *B, const char *s) {
LUALIB_API void luaL_pushresult (luaL_Buffer *B) {
emptybuffer(B);
lua_concat(B->L, B->level);
B->level = 1;
lua_concat(B->L, B->lvl);
B->lvl = 1;
}
@ -269,7 +269,7 @@ LUALIB_API void luaL_addvalue (luaL_Buffer *B) {
else {
if (emptybuffer(B))
lua_insert(L, -2); /* put buffer before new value */
B->level++; /* add new value into B stack */
B->lvl++; /* add new value into B stack */
adjuststack(B);
}
}
@ -278,7 +278,7 @@ LUALIB_API void luaL_addvalue (luaL_Buffer *B) {
LUALIB_API void luaL_buffinit (lua_State *L, luaL_Buffer *B) {
B->L = L;
B->p = B->buffer;
B->level = 0;
B->lvl = 0;
}
/* }====================================================== */

24
lauxlib.h

@ -1,5 +1,5 @@
/*
** $Id: lauxlib.h,v 1.51 2002/07/01 19:23:58 roberto Exp roberto $
** $Id: lauxlib.h,v 1.52 2002/08/08 20:08:41 roberto Exp roberto $
** Auxiliary functions for building Lua libraries
** See Copyright Notice in lua.h
*/
@ -30,31 +30,29 @@ typedef struct luaL_reg {
LUALIB_API void luaL_openlib (lua_State *L, const luaL_reg *l, int nup);
LUALIB_API void luaL_opennamedlib (lua_State *L, const char *libname,
const luaL_reg *l, int nup);
LUALIB_API int luaL_callmeta (lua_State *L, int obj, const char *event);
LUALIB_API int luaL_callmeta (lua_State *L, int obj, const char *e);
LUALIB_API int luaL_typerror (lua_State *L, int narg, const char *tname);
LUALIB_API int luaL_argerror (lua_State *L, int numarg, const char *extramsg);
LUALIB_API const char *luaL_check_lstr (lua_State *L, int numArg,
size_t *len);
LUALIB_API const char *luaL_check_lstr (lua_State *L, int numArg, size_t *l);
LUALIB_API const char *luaL_opt_lstr (lua_State *L, int numArg,
const char *def, size_t *len);
const char *def, size_t *l);
LUALIB_API lua_Number luaL_check_number (lua_State *L, int numArg);
LUALIB_API lua_Number luaL_opt_number (lua_State *L, int nArg, lua_Number def);
LUALIB_API void luaL_check_stack (lua_State *L, int space, const char *msg);
LUALIB_API void luaL_check_stack (lua_State *L, int sz, const char *msg);
LUALIB_API void luaL_check_type (lua_State *L, int narg, int t);
LUALIB_API void luaL_check_any (lua_State *L, int narg);
LUALIB_API void luaL_where (lua_State *L, int level);
LUALIB_API void luaL_where (lua_State *L, int lvl);
LUALIB_API int luaL_error (lua_State *L, const char *fmt, ...);
LUALIB_API int luaL_findstring (const char *name,
const char *const list[]);
LUALIB_API int luaL_findstring (const char *st, const char *const lst[]);
LUALIB_API int luaL_ref (lua_State *L, int t);
LUALIB_API void luaL_unref (lua_State *L, int t, int ref);
LUALIB_API int luaL_loadfile (lua_State *L, const char *filename);
LUALIB_API int luaL_loadbuffer (lua_State *L, const char *buff, size_t size,
LUALIB_API int luaL_loadbuffer (lua_State *L, const char *buff, size_t sz,
const char *name);
@ -89,7 +87,7 @@ LUALIB_API int luaL_loadbuffer (lua_State *L, const char *buff, size_t size,
typedef struct luaL_Buffer {
char *p; /* current position in buffer */
int level;
int lvl; /* number of strings in the stack (level) */
lua_State *L;
char buffer[LUAL_BUFFERSIZE];
} luaL_Buffer;
@ -121,8 +119,8 @@ LUALIB_API void luaL_pushresult (luaL_Buffer *B);
LUALIB_API int lua_dofile (lua_State *L, const char *filename);
LUALIB_API int lua_dostring (lua_State *L, const char *str);
LUALIB_API int lua_dobuffer (lua_State *L, const char *buff, size_t size,
const char *name);
LUALIB_API int lua_dobuffer (lua_State *L, const char *buff, size_t sz,
const char *n);
#endif

78
lua.h

@ -1,5 +1,5 @@
/*
** $Id: lua.h,v 1.154 2002/08/12 17:23:12 roberto Exp roberto $
** $Id: lua.h,v 1.155 2002/08/30 19:09:21 roberto Exp roberto $
** Lua - An Extensible Extension Language
** Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil
** http://www.lua.org mailto:info@lua.org
@ -54,7 +54,7 @@ typedef int (*lua_CFunction) (lua_State *L);
/*
** functions that read blocks when loading Lua chunk
*/
typedef const char * (*lua_Chunkreader) (lua_State *L, void *ud, size_t *size);
typedef const char * (*lua_Chunkreader) (lua_State *L, void *ud, size_t *sz);
/*
@ -103,7 +103,7 @@ typedef LUA_NUMBER lua_Number;
LUA_API lua_State *lua_open (void);
LUA_API void lua_close (lua_State *L);
LUA_API lua_State *lua_newthread (lua_State *L);
LUA_API void lua_closethread (lua_State *L, lua_State *thread);
LUA_API void lua_closethread (lua_State *L, lua_State *t);
LUA_API lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf);
@ -112,36 +112,36 @@ LUA_API lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf);
** basic stack manipulation
*/
LUA_API int lua_gettop (lua_State *L);
LUA_API void lua_settop (lua_State *L, int index);
LUA_API void lua_pushvalue (lua_State *L, int index);
LUA_API void lua_remove (lua_State *L, int index);
LUA_API void lua_insert (lua_State *L, int index);
LUA_API void lua_replace (lua_State *L, int index);
LUA_API int lua_checkstack (lua_State *L, int size);
LUA_API void lua_settop (lua_State *L, int idx);
LUA_API void lua_pushvalue (lua_State *L, int idx);
LUA_API void lua_remove (lua_State *L, int idx);
LUA_API void lua_insert (lua_State *L, int idx);
LUA_API void lua_replace (lua_State *L, int idx);
LUA_API int lua_checkstack (lua_State *L, int sz);
/*
** access functions (stack -> C)
*/
LUA_API int lua_isnumber (lua_State *L, int index);
LUA_API int lua_isstring (lua_State *L, int index);
LUA_API int lua_iscfunction (lua_State *L, int index);
LUA_API int lua_isuserdata (lua_State *L, int index);
LUA_API int lua_type (lua_State *L, int index);
LUA_API const char *lua_typename (lua_State *L, int type);
LUA_API int lua_isnumber (lua_State *L, int idx);
LUA_API int lua_isstring (lua_State *L, int idx);
LUA_API int lua_iscfunction (lua_State *L, int idx);
LUA_API int lua_isuserdata (lua_State *L, int idx);
LUA_API int lua_type (lua_State *L, int idx);
LUA_API const char *lua_typename (lua_State *L, int tp);
LUA_API int lua_equal (lua_State *L, int index1, int index2);
LUA_API int lua_rawequal (lua_State *L, int index1, int index2);
LUA_API int lua_lessthan (lua_State *L, int index1, int index2);
LUA_API int lua_equal (lua_State *L, int idx1, int idx2);
LUA_API int lua_rawequal (lua_State *L, int idx1, int idx2);
LUA_API int lua_lessthan (lua_State *L, int idx1, int idx2);
LUA_API lua_Number lua_tonumber (lua_State *L, int index);
LUA_API int lua_toboolean (lua_State *L, int index);
LUA_API const char *lua_tostring (lua_State *L, int index);
LUA_API size_t lua_strlen (lua_State *L, int index);
LUA_API lua_CFunction lua_tocfunction (lua_State *L, int index);
LUA_API void *lua_touserdata (lua_State *L, int index);
LUA_API const void *lua_topointer (lua_State *L, int index);
LUA_API lua_Number lua_tonumber (lua_State *L, int idx);
LUA_API int lua_toboolean (lua_State *L, int idx);
LUA_API const char *lua_tostring (lua_State *L, int idx);
LUA_API size_t lua_strlen (lua_State *L, int idx);
LUA_API lua_CFunction lua_tocfunction (lua_State *L, int idx);
LUA_API void *lua_touserdata (lua_State *L, int idx);
LUA_API const void *lua_topointer (lua_State *L, int idx);
/*
@ -149,7 +149,7 @@ LUA_API const void *lua_topointer (lua_State *L, int index);
*/
LUA_API void lua_pushnil (lua_State *L);
LUA_API void lua_pushnumber (lua_State *L, lua_Number n);
LUA_API void lua_pushlstring (lua_State *L, const char *s, size_t len);
LUA_API void lua_pushlstring (lua_State *L, const char *s, size_t l);
LUA_API void lua_pushstring (lua_State *L, const char *s);
LUA_API const char *lua_pushvfstring (lua_State *L, const char *fmt,
va_list argp);
@ -162,24 +162,24 @@ LUA_API void lua_pushlightuserdata (lua_State *L, void *p);
/*
** get functions (Lua -> stack)
*/
LUA_API void lua_gettable (lua_State *L, int index);
LUA_API void lua_rawget (lua_State *L, int index);
LUA_API void lua_rawgeti (lua_State *L, int index, int n);
LUA_API void lua_gettable (lua_State *L, int idx);
LUA_API void lua_rawget (lua_State *L, int idx);
LUA_API void lua_rawgeti (lua_State *L, int idx, int n);
LUA_API void lua_newtable (lua_State *L);
LUA_API int lua_getmetatable (lua_State *L, int objindex);
LUA_API const char *lua_getmode (lua_State *L, int index);
LUA_API void lua_getglobals (lua_State *L, int index);
LUA_API const char *lua_getmode (lua_State *L, int idx);
LUA_API void lua_getglobals (lua_State *L, int idx);
/*
** set functions (stack -> Lua)
*/
LUA_API void lua_settable (lua_State *L, int index);
LUA_API void lua_rawset (lua_State *L, int index);
LUA_API void lua_rawseti (lua_State *L, int index, int n);
LUA_API void lua_setmode (lua_State *L, int index, const char *mode);
LUA_API void lua_settable (lua_State *L, int idx);
LUA_API void lua_rawset (lua_State *L, int idx);
LUA_API void lua_rawseti (lua_State *L, int idx, int n);
LUA_API void lua_setmode (lua_State *L, int idx, const char *md);
LUA_API int lua_setmetatable (lua_State *L, int objindex);
LUA_API int lua_setglobals (lua_State *L, int index);
LUA_API int lua_setglobals (lua_State *L, int idx);
/*
@ -187,7 +187,7 @@ LUA_API int lua_setglobals (lua_State *L, int index);
*/
LUA_API void lua_call (lua_State *L, int nargs, int nresults);
LUA_API int lua_pcall (lua_State *L, int nargs, int nresults, int errfunc);
LUA_API int lua_load (lua_State *L, lua_Chunkreader reader, void *data,
LUA_API int lua_load (lua_State *L, lua_Chunkreader reader, void *dt,
const char *chunkname);
@ -211,11 +211,11 @@ LUA_API void lua_setgcthreshold (lua_State *L, int newthreshold);
LUA_API int lua_error (lua_State *L);
LUA_API int lua_next (lua_State *L, int index);
LUA_API int lua_next (lua_State *L, int idx);
LUA_API void lua_concat (lua_State *L, int n);
LUA_API void *lua_newuserdata (lua_State *L, size_t size);
LUA_API void *lua_newuserdata (lua_State *L, size_t sz);

Loading…
Cancel
Save