diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1995-10-26 12:21:56 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1995-10-26 12:21:56 -0200 |
| commit | 15d48576ea737d51e579f101a870e37f62b81f22 (patch) | |
| tree | ed2390188cfb5304d366696262ccda593f3e8589 /table.c | |
| parent | 39b071f7b13e6ed6eff4a0f0471d2450a9c48084 (diff) | |
| download | lua-15d48576ea737d51e579f101a870e37f62b81f22.tar.gz lua-15d48576ea737d51e579f101a870e37f62b81f22.tar.bz2 lua-15d48576ea737d51e579f101a870e37f62b81f22.zip | |
functions now may be declared with any "var" as a name;
therefore they do not have a "baptism" name.
Changes in debug API to acomodate that.
Diffstat (limited to 'table.c')
| -rw-r--r-- | table.c | 52 |
1 files changed, 21 insertions, 31 deletions
| @@ -3,9 +3,9 @@ | |||
| 3 | ** Module to control static tables | 3 | ** Module to control static tables |
| 4 | */ | 4 | */ |
| 5 | 5 | ||
| 6 | char *rcs_table="$Id: table.c,v 2.35 1995/10/17 11:58:41 roberto Exp roberto $"; | 6 | char *rcs_table="$Id: table.c,v 2.36 1995/10/23 13:53:48 roberto Exp roberto $"; |
| 7 | 7 | ||
| 8 | #include <string.h> | 8 | /*#include <string.h>*/ |
| 9 | 9 | ||
| 10 | #include "mem.h" | 10 | #include "mem.h" |
| 11 | #include "opcode.h" | 11 | #include "opcode.h" |
| @@ -15,6 +15,7 @@ char *rcs_table="$Id: table.c,v 2.35 1995/10/17 11:58:41 roberto Exp roberto $"; | |||
| 15 | #include "inout.h" | 15 | #include "inout.h" |
| 16 | #include "lua.h" | 16 | #include "lua.h" |
| 17 | #include "fallback.h" | 17 | #include "fallback.h" |
| 18 | #include "luadebug.h" | ||
| 18 | 19 | ||
| 19 | 20 | ||
| 20 | #define BUFFER_BLOCK 256 | 21 | #define BUFFER_BLOCK 256 |
| @@ -254,39 +255,28 @@ static void getglobal (void) | |||
| 254 | } | 255 | } |
| 255 | 256 | ||
| 256 | 257 | ||
| 257 | static lua_CFunction cfunc = NULL; | 258 | static Object *functofind; |
| 258 | static int checkfunc (Object *o) | 259 | static int checkfunc (Object *o) |
| 259 | { | 260 | { |
| 260 | return ((o->tag == LUA_T_CMARK || o->tag == LUA_T_CFUNCTION) && | 261 | if (o->tag == LUA_T_FUNCTION) |
| 261 | o->value.f == cfunc); | 262 | return |
| 263 | ((functofind->tag == LUA_T_FUNCTION || functofind->tag == LUA_T_MARK) | ||
| 264 | && (functofind->value.tf == o->value.tf)); | ||
| 265 | if (o->tag == LUA_T_CFUNCTION) | ||
| 266 | return | ||
| 267 | ((functofind->tag == LUA_T_CFUNCTION || functofind->tag == LUA_T_CMARK) | ||
| 268 | && (functofind->value.f == o->value.f)); | ||
| 269 | return 0; | ||
| 262 | } | 270 | } |
| 263 | 271 | ||
| 264 | 272 | ||
| 265 | void luaI_funcInfo (struct Object *func, char **filename, char **funcname, | 273 | char *getobjname (lua_Object o, char **name) |
| 266 | char **objname, int *linedefined) | 274 | { /* try to find a name for given function */ |
| 267 | { | 275 | functofind = luaI_Address(o); |
| 268 | if (func->tag == LUA_T_MARK || func->tag == LUA_T_FUNCTION) | 276 | if ((*name = lua_travsymbol(checkfunc)) != NULL) |
| 269 | { | 277 | return "global"; |
| 270 | TFunc *f = func->value.tf; | 278 | else if ((*name = luaI_travfallbacks(checkfunc)) != NULL) |
| 271 | *filename = f->fileName; | 279 | return "fallback"; |
| 272 | *funcname = f->name1; | 280 | else return ""; |
| 273 | *objname = f->name2; | ||
| 274 | *linedefined = f->lineDefined; | ||
| 275 | } | ||
| 276 | else if (func->tag == LUA_T_CMARK || func->tag == LUA_T_CFUNCTION) | ||
| 277 | { | ||
| 278 | /* temporario: */ | ||
| 279 | cfunc = func->value.f; | ||
| 280 | *filename = "(C)"; | ||
| 281 | *linedefined = 0; | ||
| 282 | *funcname = lua_travsymbol(checkfunc); | ||
| 283 | if (*funcname) | ||
| 284 | *objname = 0; | ||
| 285 | else | ||
| 286 | { | ||
| 287 | *funcname = luaI_travfallbacks(checkfunc); | ||
| 288 | *objname = "(FB)"; | ||
| 289 | } | ||
| 290 | } | ||
| 291 | } | 281 | } |
| 292 | 282 | ||
