aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-08-30 17:00:59 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-08-30 17:00:59 -0300
commit2c670baf24115d9c59b5869b89873b93af8b779d (patch)
tree30ec1b85988ea36bd74403bd32a29a362def36d4
parentfdafd4f4a88d1584dea900517445a17d87f8b82f (diff)
downloadlua-2c670baf24115d9c59b5869b89873b93af8b779d.tar.gz
lua-2c670baf24115d9c59b5869b89873b93af8b779d.tar.bz2
lua-2c670baf24115d9c59b5869b89873b93af8b779d.zip
avoid the use of "obvious" names in header files to avoid conflicts
-rw-r--r--lauxlib.c20
-rw-r--r--lauxlib.h24
-rw-r--r--lua.h78
3 files changed, 60 insertions, 62 deletions
diff --git a/lauxlib.c b/lauxlib.c
index 4ad7e0a2..65b1def3 100644
--- a/lauxlib.c
+++ b/lauxlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lauxlib.c,v 1.82 2002/08/06 18:01:50 roberto Exp roberto $ 2** $Id: lauxlib.c,v 1.83 2002/08/08 20:08:41 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*/
@@ -208,27 +208,27 @@ static int emptybuffer (luaL_Buffer *B) {
208 else { 208 else {
209 lua_pushlstring(B->L, B->buffer, l); 209 lua_pushlstring(B->L, B->buffer, l);
210 B->p = B->buffer; 210 B->p = B->buffer;
211 B->level++; 211 B->lvl++;
212 return 1; 212 return 1;
213 } 213 }
214} 214}
215 215
216 216
217static void adjuststack (luaL_Buffer *B) { 217static void adjuststack (luaL_Buffer *B) {
218 if (B->level > 1) { 218 if (B->lvl > 1) {
219 lua_State *L = B->L; 219 lua_State *L = B->L;
220 int toget = 1; /* number of levels to concat */ 220 int toget = 1; /* number of levels to concat */
221 size_t toplen = lua_strlen(L, -1); 221 size_t toplen = lua_strlen(L, -1);
222 do { 222 do {
223 size_t l = lua_strlen(L, -(toget+1)); 223 size_t l = lua_strlen(L, -(toget+1));
224 if (B->level - toget + 1 >= LIMIT || toplen > l) { 224 if (B->lvl - toget + 1 >= LIMIT || toplen > l) {
225 toplen += l; 225 toplen += l;
226 toget++; 226 toget++;
227 } 227 }
228 else break; 228 else break;
229 } while (toget < B->level); 229 } while (toget < B->lvl);
230 lua_concat(L, toget); 230 lua_concat(L, toget);
231 B->level = B->level - toget + 1; 231 B->lvl = B->lvl - toget + 1;
232 } 232 }
233} 233}
234 234
@@ -253,8 +253,8 @@ LUALIB_API void luaL_addstring (luaL_Buffer *B, const char *s) {
253 253
254LUALIB_API void luaL_pushresult (luaL_Buffer *B) { 254LUALIB_API void luaL_pushresult (luaL_Buffer *B) {
255 emptybuffer(B); 255 emptybuffer(B);
256 lua_concat(B->L, B->level); 256 lua_concat(B->L, B->lvl);
257 B->level = 1; 257 B->lvl = 1;
258} 258}
259 259
260 260
@@ -269,7 +269,7 @@ LUALIB_API void luaL_addvalue (luaL_Buffer *B) {
269 else { 269 else {
270 if (emptybuffer(B)) 270 if (emptybuffer(B))
271 lua_insert(L, -2); /* put buffer before new value */ 271 lua_insert(L, -2); /* put buffer before new value */
272 B->level++; /* add new value into B stack */ 272 B->lvl++; /* add new value into B stack */
273 adjuststack(B); 273 adjuststack(B);
274 } 274 }
275} 275}
@@ -278,7 +278,7 @@ LUALIB_API void luaL_addvalue (luaL_Buffer *B) {
278LUALIB_API void luaL_buffinit (lua_State *L, luaL_Buffer *B) { 278LUALIB_API void luaL_buffinit (lua_State *L, luaL_Buffer *B) {
279 B->L = L; 279 B->L = L;
280 B->p = B->buffer; 280 B->p = B->buffer;
281 B->level = 0; 281 B->lvl = 0;
282} 282}
283 283
284/* }====================================================== */ 284/* }====================================================== */
diff --git a/lauxlib.h b/lauxlib.h
index f3010626..7687f25e 100644
--- a/lauxlib.h
+++ b/lauxlib.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lauxlib.h,v 1.51 2002/07/01 19:23:58 roberto Exp roberto $ 2** $Id: lauxlib.h,v 1.52 2002/08/08 20:08:41 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*/
@@ -30,31 +30,29 @@ typedef struct luaL_reg {
30LUALIB_API void luaL_openlib (lua_State *L, const luaL_reg *l, int nup); 30LUALIB_API void luaL_openlib (lua_State *L, const luaL_reg *l, int nup);
31LUALIB_API void luaL_opennamedlib (lua_State *L, const char *libname, 31LUALIB_API void luaL_opennamedlib (lua_State *L, const char *libname,
32 const luaL_reg *l, int nup); 32 const luaL_reg *l, int nup);
33LUALIB_API int luaL_callmeta (lua_State *L, int obj, const char *event); 33LUALIB_API int luaL_callmeta (lua_State *L, int obj, const char *e);
34LUALIB_API int luaL_typerror (lua_State *L, int narg, const char *tname); 34LUALIB_API int luaL_typerror (lua_State *L, int narg, const char *tname);
35LUALIB_API int luaL_argerror (lua_State *L, int numarg, const char *extramsg); 35LUALIB_API int luaL_argerror (lua_State *L, int numarg, const char *extramsg);
36LUALIB_API const char *luaL_check_lstr (lua_State *L, int numArg, 36LUALIB_API const char *luaL_check_lstr (lua_State *L, int numArg, size_t *l);
37 size_t *len);
38LUALIB_API const char *luaL_opt_lstr (lua_State *L, int numArg, 37LUALIB_API const char *luaL_opt_lstr (lua_State *L, int numArg,
39 const char *def, size_t *len); 38 const char *def, size_t *l);
40LUALIB_API lua_Number luaL_check_number (lua_State *L, int numArg); 39LUALIB_API lua_Number luaL_check_number (lua_State *L, int numArg);
41LUALIB_API lua_Number luaL_opt_number (lua_State *L, int nArg, lua_Number def); 40LUALIB_API lua_Number luaL_opt_number (lua_State *L, int nArg, lua_Number def);
42 41
43LUALIB_API void luaL_check_stack (lua_State *L, int space, const char *msg); 42LUALIB_API void luaL_check_stack (lua_State *L, int sz, const char *msg);
44LUALIB_API void luaL_check_type (lua_State *L, int narg, int t); 43LUALIB_API void luaL_check_type (lua_State *L, int narg, int t);
45LUALIB_API void luaL_check_any (lua_State *L, int narg); 44LUALIB_API void luaL_check_any (lua_State *L, int narg);
46 45
47LUALIB_API void luaL_where (lua_State *L, int level); 46LUALIB_API void luaL_where (lua_State *L, int lvl);
48LUALIB_API int luaL_error (lua_State *L, const char *fmt, ...); 47LUALIB_API int luaL_error (lua_State *L, const char *fmt, ...);
49 48
50LUALIB_API int luaL_findstring (const char *name, 49LUALIB_API int luaL_findstring (const char *st, const char *const lst[]);
51 const char *const list[]);
52 50
53LUALIB_API int luaL_ref (lua_State *L, int t); 51LUALIB_API int luaL_ref (lua_State *L, int t);
54LUALIB_API void luaL_unref (lua_State *L, int t, int ref); 52LUALIB_API void luaL_unref (lua_State *L, int t, int ref);
55 53
56LUALIB_API int luaL_loadfile (lua_State *L, const char *filename); 54LUALIB_API int luaL_loadfile (lua_State *L, const char *filename);
57LUALIB_API int luaL_loadbuffer (lua_State *L, const char *buff, size_t size, 55LUALIB_API int luaL_loadbuffer (lua_State *L, const char *buff, size_t sz,
58 const char *name); 56 const char *name);
59 57
60 58
@@ -89,7 +87,7 @@ LUALIB_API int luaL_loadbuffer (lua_State *L, const char *buff, size_t size,
89 87
90typedef struct luaL_Buffer { 88typedef struct luaL_Buffer {
91 char *p; /* current position in buffer */ 89 char *p; /* current position in buffer */
92 int level; 90 int lvl; /* number of strings in the stack (level) */
93 lua_State *L; 91 lua_State *L;
94 char buffer[LUAL_BUFFERSIZE]; 92 char buffer[LUAL_BUFFERSIZE];
95} luaL_Buffer; 93} luaL_Buffer;
@@ -121,8 +119,8 @@ LUALIB_API void luaL_pushresult (luaL_Buffer *B);
121 119
122LUALIB_API int lua_dofile (lua_State *L, const char *filename); 120LUALIB_API int lua_dofile (lua_State *L, const char *filename);
123LUALIB_API int lua_dostring (lua_State *L, const char *str); 121LUALIB_API int lua_dostring (lua_State *L, const char *str);
124LUALIB_API int lua_dobuffer (lua_State *L, const char *buff, size_t size, 122LUALIB_API int lua_dobuffer (lua_State *L, const char *buff, size_t sz,
125 const char *name); 123 const char *n);
126 124
127 125
128#endif 126#endif
diff --git a/lua.h b/lua.h
index 28b7c504..eb961e06 100644
--- a/lua.h
+++ b/lua.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lua.h,v 1.154 2002/08/12 17:23:12 roberto Exp roberto $ 2** $Id: lua.h,v 1.155 2002/08/30 19:09:21 roberto Exp roberto $
3** Lua - An Extensible Extension Language 3** Lua - An Extensible Extension Language
4** Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil 4** Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil
5** http://www.lua.org mailto:info@lua.org 5** http://www.lua.org mailto:info@lua.org
@@ -54,7 +54,7 @@ typedef int (*lua_CFunction) (lua_State *L);
54/* 54/*
55** functions that read blocks when loading Lua chunk 55** functions that read blocks when loading Lua chunk
56*/ 56*/
57typedef const char * (*lua_Chunkreader) (lua_State *L, void *ud, size_t *size); 57typedef const char * (*lua_Chunkreader) (lua_State *L, void *ud, size_t *sz);
58 58
59 59
60/* 60/*
@@ -103,7 +103,7 @@ typedef LUA_NUMBER lua_Number;
103LUA_API lua_State *lua_open (void); 103LUA_API lua_State *lua_open (void);
104LUA_API void lua_close (lua_State *L); 104LUA_API void lua_close (lua_State *L);
105LUA_API lua_State *lua_newthread (lua_State *L); 105LUA_API lua_State *lua_newthread (lua_State *L);
106LUA_API void lua_closethread (lua_State *L, lua_State *thread); 106LUA_API void lua_closethread (lua_State *L, lua_State *t);
107 107
108LUA_API lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf); 108LUA_API lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf);
109 109
@@ -112,36 +112,36 @@ LUA_API lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf);
112** basic stack manipulation 112** basic stack manipulation
113*/ 113*/
114LUA_API int lua_gettop (lua_State *L); 114LUA_API int lua_gettop (lua_State *L);
115LUA_API void lua_settop (lua_State *L, int index); 115LUA_API void lua_settop (lua_State *L, int idx);
116LUA_API void lua_pushvalue (lua_State *L, int index); 116LUA_API void lua_pushvalue (lua_State *L, int idx);
117LUA_API void lua_remove (lua_State *L, int index); 117LUA_API void lua_remove (lua_State *L, int idx);
118LUA_API void lua_insert (lua_State *L, int index); 118LUA_API void lua_insert (lua_State *L, int idx);
119LUA_API void lua_replace (lua_State *L, int index); 119LUA_API void lua_replace (lua_State *L, int idx);
120LUA_API int lua_checkstack (lua_State *L, int size); 120LUA_API int lua_checkstack (lua_State *L, int sz);
121 121
122 122
123/* 123/*
124** access functions (stack -> C) 124** access functions (stack -> C)
125*/ 125*/
126 126
127LUA_API int lua_isnumber (lua_State *L, int index); 127LUA_API int lua_isnumber (lua_State *L, int idx);
128LUA_API int lua_isstring (lua_State *L, int index); 128LUA_API int lua_isstring (lua_State *L, int idx);
129LUA_API int lua_iscfunction (lua_State *L, int index); 129LUA_API int lua_iscfunction (lua_State *L, int idx);
130LUA_API int lua_isuserdata (lua_State *L, int index); 130LUA_API int lua_isuserdata (lua_State *L, int idx);
131LUA_API int lua_type (lua_State *L, int index); 131LUA_API int lua_type (lua_State *L, int idx);
132LUA_API const char *lua_typename (lua_State *L, int type); 132LUA_API const char *lua_typename (lua_State *L, int tp);
133 133
134LUA_API int lua_equal (lua_State *L, int index1, int index2); 134LUA_API int lua_equal (lua_State *L, int idx1, int idx2);
135LUA_API int lua_rawequal (lua_State *L, int index1, int index2); 135LUA_API int lua_rawequal (lua_State *L, int idx1, int idx2);
136LUA_API int lua_lessthan (lua_State *L, int index1, int index2); 136LUA_API int lua_lessthan (lua_State *L, int idx1, int idx2);
137 137
138LUA_API lua_Number lua_tonumber (lua_State *L, int index); 138LUA_API lua_Number lua_tonumber (lua_State *L, int idx);
139LUA_API int lua_toboolean (lua_State *L, int index); 139LUA_API int lua_toboolean (lua_State *L, int idx);
140LUA_API const char *lua_tostring (lua_State *L, int index); 140LUA_API const char *lua_tostring (lua_State *L, int idx);
141LUA_API size_t lua_strlen (lua_State *L, int index); 141LUA_API size_t lua_strlen (lua_State *L, int idx);
142LUA_API lua_CFunction lua_tocfunction (lua_State *L, int index); 142LUA_API lua_CFunction lua_tocfunction (lua_State *L, int idx);
143LUA_API void *lua_touserdata (lua_State *L, int index); 143LUA_API void *lua_touserdata (lua_State *L, int idx);
144LUA_API const void *lua_topointer (lua_State *L, int index); 144LUA_API const void *lua_topointer (lua_State *L, int idx);
145 145
146 146
147/* 147/*
@@ -149,7 +149,7 @@ LUA_API const void *lua_topointer (lua_State *L, int index);
149*/ 149*/
150LUA_API void lua_pushnil (lua_State *L); 150LUA_API void lua_pushnil (lua_State *L);
151LUA_API void lua_pushnumber (lua_State *L, lua_Number n); 151LUA_API void lua_pushnumber (lua_State *L, lua_Number n);
152LUA_API void lua_pushlstring (lua_State *L, const char *s, size_t len); 152LUA_API void lua_pushlstring (lua_State *L, const char *s, size_t l);
153LUA_API void lua_pushstring (lua_State *L, const char *s); 153LUA_API void lua_pushstring (lua_State *L, const char *s);
154LUA_API const char *lua_pushvfstring (lua_State *L, const char *fmt, 154LUA_API const char *lua_pushvfstring (lua_State *L, const char *fmt,
155 va_list argp); 155 va_list argp);
@@ -162,24 +162,24 @@ LUA_API void lua_pushlightuserdata (lua_State *L, void *p);
162/* 162/*
163** get functions (Lua -> stack) 163** get functions (Lua -> stack)
164*/ 164*/
165LUA_API void lua_gettable (lua_State *L, int index); 165LUA_API void lua_gettable (lua_State *L, int idx);
166LUA_API void lua_rawget (lua_State *L, int index); 166LUA_API void lua_rawget (lua_State *L, int idx);
167LUA_API void lua_rawgeti (lua_State *L, int index, int n); 167LUA_API void lua_rawgeti (lua_State *L, int idx, int n);
168LUA_API void lua_newtable (lua_State *L); 168LUA_API void lua_newtable (lua_State *L);
169LUA_API int lua_getmetatable (lua_State *L, int objindex); 169LUA_API int lua_getmetatable (lua_State *L, int objindex);
170LUA_API const char *lua_getmode (lua_State *L, int index); 170LUA_API const char *lua_getmode (lua_State *L, int idx);
171LUA_API void lua_getglobals (lua_State *L, int index); 171LUA_API void lua_getglobals (lua_State *L, int idx);
172 172
173 173
174/* 174/*
175** set functions (stack -> Lua) 175** set functions (stack -> Lua)
176*/ 176*/
177LUA_API void lua_settable (lua_State *L, int index); 177LUA_API void lua_settable (lua_State *L, int idx);
178LUA_API void lua_rawset (lua_State *L, int index); 178LUA_API void lua_rawset (lua_State *L, int idx);
179LUA_API void lua_rawseti (lua_State *L, int index, int n); 179LUA_API void lua_rawseti (lua_State *L, int idx, int n);
180LUA_API void lua_setmode (lua_State *L, int index, const char *mode); 180LUA_API void lua_setmode (lua_State *L, int idx, const char *md);
181LUA_API int lua_setmetatable (lua_State *L, int objindex); 181LUA_API int lua_setmetatable (lua_State *L, int objindex);
182LUA_API int lua_setglobals (lua_State *L, int index); 182LUA_API int lua_setglobals (lua_State *L, int idx);
183 183
184 184
185/* 185/*
@@ -187,7 +187,7 @@ LUA_API int lua_setglobals (lua_State *L, int index);
187*/ 187*/
188LUA_API void lua_call (lua_State *L, int nargs, int nresults); 188LUA_API void lua_call (lua_State *L, int nargs, int nresults);
189LUA_API int lua_pcall (lua_State *L, int nargs, int nresults, int errfunc); 189LUA_API int lua_pcall (lua_State *L, int nargs, int nresults, int errfunc);
190LUA_API int lua_load (lua_State *L, lua_Chunkreader reader, void *data, 190LUA_API int lua_load (lua_State *L, lua_Chunkreader reader, void *dt,
191 const char *chunkname); 191 const char *chunkname);
192 192
193 193
@@ -211,11 +211,11 @@ LUA_API void lua_setgcthreshold (lua_State *L, int newthreshold);
211 211
212LUA_API int lua_error (lua_State *L); 212LUA_API int lua_error (lua_State *L);
213 213
214LUA_API int lua_next (lua_State *L, int index); 214LUA_API int lua_next (lua_State *L, int idx);
215 215
216LUA_API void lua_concat (lua_State *L, int n); 216LUA_API void lua_concat (lua_State *L, int n);
217 217
218LUA_API void *lua_newuserdata (lua_State *L, size_t size); 218LUA_API void *lua_newuserdata (lua_State *L, size_t sz);
219 219
220 220
221 221