diff options
Diffstat (limited to 'ldblib.c')
-rw-r--r-- | ldblib.c | 54 |
1 files changed, 27 insertions, 27 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldblib.c,v 1.92 2005/01/18 17:23:25 roberto Exp roberto $ | 2 | ** $Id: ldblib.c,v 1.93 2005/02/18 12:40:02 roberto Exp roberto $ |
3 | ** Interface from Lua to its debug API | 3 | ** Interface from Lua to its debug API |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -19,7 +19,7 @@ | |||
19 | 19 | ||
20 | 20 | ||
21 | 21 | ||
22 | static int getmetatable (lua_State *L) { | 22 | static int db_getmetatable (lua_State *L) { |
23 | luaL_checkany(L, 1); | 23 | luaL_checkany(L, 1); |
24 | if (!lua_getmetatable(L, 1)) { | 24 | if (!lua_getmetatable(L, 1)) { |
25 | lua_pushnil(L); /* no metatable */ | 25 | lua_pushnil(L); /* no metatable */ |
@@ -28,7 +28,7 @@ static int getmetatable (lua_State *L) { | |||
28 | } | 28 | } |
29 | 29 | ||
30 | 30 | ||
31 | static int setmetatable (lua_State *L) { | 31 | static int db_setmetatable (lua_State *L) { |
32 | int t = lua_type(L, 2); | 32 | int t = lua_type(L, 2); |
33 | luaL_argcheck(L, t == LUA_TNIL || t == LUA_TTABLE, 2, | 33 | luaL_argcheck(L, t == LUA_TNIL || t == LUA_TTABLE, 2, |
34 | "nil or table expected"); | 34 | "nil or table expected"); |
@@ -38,13 +38,13 @@ static int setmetatable (lua_State *L) { | |||
38 | } | 38 | } |
39 | 39 | ||
40 | 40 | ||
41 | static int getfenv (lua_State *L) { | 41 | static int db_getfenv (lua_State *L) { |
42 | lua_getfenv(L, 1); | 42 | lua_getfenv(L, 1); |
43 | return 1; | 43 | return 1; |
44 | } | 44 | } |
45 | 45 | ||
46 | 46 | ||
47 | static int setfenv (lua_State *L) { | 47 | static int db_setfenv (lua_State *L) { |
48 | luaL_checktype(L, 2, LUA_TTABLE); | 48 | luaL_checktype(L, 2, LUA_TTABLE); |
49 | lua_settop(L, 2); | 49 | lua_settop(L, 2); |
50 | if (lua_setfenv(L, 1) == 0) | 50 | if (lua_setfenv(L, 1) == 0) |
@@ -77,7 +77,7 @@ static lua_State *getthread (lua_State *L, int *arg) { | |||
77 | } | 77 | } |
78 | 78 | ||
79 | 79 | ||
80 | static int getinfo (lua_State *L) { | 80 | static int db_getinfo (lua_State *L) { |
81 | lua_Debug ar; | 81 | lua_Debug ar; |
82 | int arg; | 82 | int arg; |
83 | lua_State *L1 = getthread(L, &arg); | 83 | lua_State *L1 = getthread(L, &arg); |
@@ -130,7 +130,7 @@ static int getinfo (lua_State *L) { | |||
130 | } | 130 | } |
131 | 131 | ||
132 | 132 | ||
133 | static int getlocal (lua_State *L) { | 133 | static int db_getlocal (lua_State *L) { |
134 | int arg; | 134 | int arg; |
135 | lua_State *L1 = getthread(L, &arg); | 135 | lua_State *L1 = getthread(L, &arg); |
136 | lua_Debug ar; | 136 | lua_Debug ar; |
@@ -151,7 +151,7 @@ static int getlocal (lua_State *L) { | |||
151 | } | 151 | } |
152 | 152 | ||
153 | 153 | ||
154 | static int setlocal (lua_State *L) { | 154 | static int db_setlocal (lua_State *L) { |
155 | int arg; | 155 | int arg; |
156 | lua_State *L1 = getthread(L, &arg); | 156 | lua_State *L1 = getthread(L, &arg); |
157 | lua_Debug ar; | 157 | lua_Debug ar; |
@@ -178,12 +178,12 @@ static int auxupvalue (lua_State *L, int get) { | |||
178 | } | 178 | } |
179 | 179 | ||
180 | 180 | ||
181 | static int getupvalue (lua_State *L) { | 181 | static int db_getupvalue (lua_State *L) { |
182 | return auxupvalue(L, 1); | 182 | return auxupvalue(L, 1); |
183 | } | 183 | } |
184 | 184 | ||
185 | 185 | ||
186 | static int setupvalue (lua_State *L) { | 186 | static int db_setupvalue (lua_State *L) { |
187 | luaL_checkany(L, 3); | 187 | luaL_checkany(L, 3); |
188 | return auxupvalue(L, 0); | 188 | return auxupvalue(L, 0); |
189 | } | 189 | } |
@@ -244,7 +244,7 @@ static void gethooktable (lua_State *L) { | |||
244 | } | 244 | } |
245 | 245 | ||
246 | 246 | ||
247 | static int sethook (lua_State *L) { | 247 | static int db_sethook (lua_State *L) { |
248 | int arg; | 248 | int arg; |
249 | lua_State *L1 = getthread(L, &arg); | 249 | lua_State *L1 = getthread(L, &arg); |
250 | if (lua_isnoneornil(L, arg+1)) { | 250 | if (lua_isnoneornil(L, arg+1)) { |
@@ -267,7 +267,7 @@ static int sethook (lua_State *L) { | |||
267 | } | 267 | } |
268 | 268 | ||
269 | 269 | ||
270 | static int gethook (lua_State *L) { | 270 | static int db_gethook (lua_State *L) { |
271 | int arg; | 271 | int arg; |
272 | lua_State *L1 = getthread(L, &arg); | 272 | lua_State *L1 = getthread(L, &arg); |
273 | char buff[5]; | 273 | char buff[5]; |
@@ -288,7 +288,7 @@ static int gethook (lua_State *L) { | |||
288 | } | 288 | } |
289 | 289 | ||
290 | 290 | ||
291 | static int debug (lua_State *L) { | 291 | static int db_debug (lua_State *L) { |
292 | for (;;) { | 292 | for (;;) { |
293 | char buffer[250]; | 293 | char buffer[250]; |
294 | fputs("lua_debug> ", stderr); | 294 | fputs("lua_debug> ", stderr); |
@@ -308,7 +308,7 @@ static int debug (lua_State *L) { | |||
308 | #define LEVELS1 12 /* size of the first part of the stack */ | 308 | #define LEVELS1 12 /* size of the first part of the stack */ |
309 | #define LEVELS2 10 /* size of the second part of the stack */ | 309 | #define LEVELS2 10 /* size of the second part of the stack */ |
310 | 310 | ||
311 | static int errorfb (lua_State *L) { | 311 | static int db_errorfb (lua_State *L) { |
312 | int level; | 312 | int level; |
313 | int firstpart = 1; /* still before eventual `...' */ | 313 | int firstpart = 1; /* still before eventual `...' */ |
314 | int arg; | 314 | int arg; |
@@ -362,19 +362,19 @@ static int errorfb (lua_State *L) { | |||
362 | 362 | ||
363 | 363 | ||
364 | static const luaL_reg dblib[] = { | 364 | static const luaL_reg dblib[] = { |
365 | {"getmetatable", getmetatable}, | 365 | {"getmetatable", db_getmetatable}, |
366 | {"setmetatable", setmetatable}, | 366 | {"setmetatable", db_setmetatable}, |
367 | {"getfenv", getfenv}, | 367 | {"getfenv", db_getfenv}, |
368 | {"setfenv", setfenv}, | 368 | {"setfenv", db_setfenv}, |
369 | {"getlocal", getlocal}, | 369 | {"getlocal", db_getlocal}, |
370 | {"getinfo", getinfo}, | 370 | {"getinfo", db_getinfo}, |
371 | {"gethook", gethook}, | 371 | {"gethook", db_gethook}, |
372 | {"getupvalue", getupvalue}, | 372 | {"getupvalue", db_getupvalue}, |
373 | {"sethook", sethook}, | 373 | {"sethook", db_sethook}, |
374 | {"setlocal", setlocal}, | 374 | {"setlocal", db_setlocal}, |
375 | {"setupvalue", setupvalue}, | 375 | {"setupvalue", db_setupvalue}, |
376 | {"debug", debug}, | 376 | {"debug", db_debug}, |
377 | {"traceback", errorfb}, | 377 | {"traceback", db_errorfb}, |
378 | {NULL, NULL} | 378 | {NULL, NULL} |
379 | }; | 379 | }; |
380 | 380 | ||