diff options
Diffstat (limited to 'ldblib.c')
-rw-r--r-- | ldblib.c | 20 |
1 files changed, 10 insertions, 10 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldblib.c,v 1.4 1999/02/04 17:47:59 roberto Exp roberto $ | 2 | ** $Id: ldblib.c,v 1.5 1999/03/04 21:17:26 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 | */ |
@@ -15,7 +15,7 @@ | |||
15 | 15 | ||
16 | 16 | ||
17 | 17 | ||
18 | static void settabss (lua_Object t, char *i, char *v) { | 18 | static void settabss (lua_Object t, const char *i, const char *v) { |
19 | lua_pushobject(t); | 19 | lua_pushobject(t); |
20 | lua_pushstring(i); | 20 | lua_pushstring(i); |
21 | lua_pushstring(v); | 21 | lua_pushstring(v); |
@@ -23,7 +23,7 @@ static void settabss (lua_Object t, char *i, char *v) { | |||
23 | } | 23 | } |
24 | 24 | ||
25 | 25 | ||
26 | static void settabsi (lua_Object t, char *i, int v) { | 26 | static void settabsi (lua_Object t, const char *i, int v) { |
27 | lua_pushobject(t); | 27 | lua_pushobject(t); |
28 | lua_pushstring(i); | 28 | lua_pushstring(i); |
29 | lua_pushnumber(v); | 29 | lua_pushnumber(v); |
@@ -33,7 +33,7 @@ static void settabsi (lua_Object t, char *i, int v) { | |||
33 | 33 | ||
34 | static lua_Object getfuncinfo (lua_Object func) { | 34 | static lua_Object getfuncinfo (lua_Object func) { |
35 | lua_Object result = lua_createtable(); | 35 | lua_Object result = lua_createtable(); |
36 | char *str; | 36 | const char *str; |
37 | int line; | 37 | int line; |
38 | lua_funcinfo(func, &str, &line); | 38 | lua_funcinfo(func, &str, &line); |
39 | if (line == -1) /* C function? */ | 39 | if (line == -1) /* C function? */ |
@@ -48,7 +48,7 @@ static lua_Object getfuncinfo (lua_Object func) { | |||
48 | settabss(result, "source", str); | 48 | settabss(result, "source", str); |
49 | } | 49 | } |
50 | if (line != 0) { /* is it not a "main"? */ | 50 | if (line != 0) { /* is it not a "main"? */ |
51 | char *kind = lua_getobjname(func, &str); | 51 | const char *kind = lua_getobjname(func, &str); |
52 | if (*kind) { | 52 | if (*kind) { |
53 | settabss(result, "name", str); | 53 | settabss(result, "name", str); |
54 | settabss(result, "where", kind); | 54 | settabss(result, "where", kind); |
@@ -86,10 +86,10 @@ static int findlocal (lua_Object func, int arg) { | |||
86 | if (lua_isnumber(v)) | 86 | if (lua_isnumber(v)) |
87 | return (int)lua_getnumber(v); | 87 | return (int)lua_getnumber(v); |
88 | else { | 88 | else { |
89 | char *name = luaL_check_string(arg); | 89 | const char *name = luaL_check_string(arg); |
90 | int i = 0; | 90 | int i = 0; |
91 | int result = -1; | 91 | int result = -1; |
92 | char *vname; | 92 | const char *vname; |
93 | while (lua_getlocal(func, ++i, &vname) != LUA_NOOBJECT) { | 93 | while (lua_getlocal(func, ++i, &vname) != LUA_NOOBJECT) { |
94 | if (strcmp(name, vname) == 0) | 94 | if (strcmp(name, vname) == 0) |
95 | result = i; /* keep looping to get the last var with this name */ | 95 | result = i; /* keep looping to get the last var with this name */ |
@@ -104,7 +104,7 @@ static int findlocal (lua_Object func, int arg) { | |||
104 | static void getlocal (void) { | 104 | static void getlocal (void) { |
105 | lua_Object func = lua_stackedfunction(luaL_check_int(1)); | 105 | lua_Object func = lua_stackedfunction(luaL_check_int(1)); |
106 | lua_Object val; | 106 | lua_Object val; |
107 | char *name; | 107 | const char *name; |
108 | if (func == LUA_NOOBJECT) /* level out of range? */ | 108 | if (func == LUA_NOOBJECT) /* level out of range? */ |
109 | return; /* return nil */ | 109 | return; /* return nil */ |
110 | else if (lua_getparam(2) != LUA_NOOBJECT) { /* 2nd argument? */ | 110 | else if (lua_getparam(2) != LUA_NOOBJECT) { /* 2nd argument? */ |
@@ -161,7 +161,7 @@ static void linef (int line) { | |||
161 | } | 161 | } |
162 | 162 | ||
163 | 163 | ||
164 | static void callf (lua_Function func, char *file, int line) { | 164 | static void callf (lua_Function func, const char *file, int line) { |
165 | if (func != LUA_NOOBJECT) { | 165 | if (func != LUA_NOOBJECT) { |
166 | lua_pushobject(func); | 166 | lua_pushobject(func); |
167 | lua_pushstring(file); | 167 | lua_pushstring(file); |
@@ -201,7 +201,7 @@ static void setlinehook (void) { | |||
201 | } | 201 | } |
202 | 202 | ||
203 | 203 | ||
204 | static struct luaL_reg dblib[] = { | 204 | static const struct luaL_reg dblib[] = { |
205 | {"funcinfo", funcinfo}, | 205 | {"funcinfo", funcinfo}, |
206 | {"getlocal", getlocal}, | 206 | {"getlocal", getlocal}, |
207 | {"getstack", getstack}, | 207 | {"getstack", getstack}, |