aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1997-11-28 14:56:05 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1997-11-28 14:56:05 -0200
commit03160920cf51a06bbb4406ec5ddb4f5dd52f0d7c (patch)
tree14f120f212e50a3a00661904d75c48c6e95796fa
parentb42cc6a4d2fc1b3982cb8086aebc2e8cbe9ed577 (diff)
downloadlua-03160920cf51a06bbb4406ec5ddb4f5dd52f0d7c.tar.gz
lua-03160920cf51a06bbb4406ec5ddb4f5dd52f0d7c.tar.bz2
lua-03160920cf51a06bbb4406ec5ddb4f5dd52f0d7c.zip
store "functofind" in stack top, so doesn't need this field in
global state.
-rw-r--r--lapi.c12
-rw-r--r--lstate.h3
2 files changed, 7 insertions, 8 deletions
diff --git a/lapi.c b/lapi.c
index ebbae483..b813d73d 100644
--- a/lapi.c
+++ b/lapi.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lapi.c,v 1.9 1997/11/27 15:59:25 roberto Exp roberto $ 2** $Id: lapi.c,v 1.10 1997/11/27 18:25:14 roberto Exp roberto $
3** Lua API 3** Lua API
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -463,16 +463,16 @@ void lua_funcinfo (lua_Object func, char **filename, int *linedefined)
463 463
464static int checkfunc (TObject *o) 464static int checkfunc (TObject *o)
465{ 465{
466 return (o->ttype == LUA_T_FUNCTION) && 466 return o->ttype == LUA_T_FUNCTION &&
467 ((L->functofind->ttype == LUA_T_FUNCTION) || 467 (ttype(L->stack.top) == LUA_T_FUNCTION ||
468 (L->functofind->ttype == LUA_T_MARK)) && 468 ttype(L->stack.top) == LUA_T_MARK) &&
469 (L->functofind->value.cl == o->value.cl); 469 clvalue(L->stack.top) == o->value.cl;
470} 470}
471 471
472 472
473char *lua_getobjname (lua_Object o, char **name) 473char *lua_getobjname (lua_Object o, char **name)
474{ /* try to find a name for given function */ 474{ /* try to find a name for given function */
475 L->functofind = Address(o); 475 *(L->stack.top) = *Address(o); /* to be accessed by "checkfunc */
476 if ((*name = luaT_travtagmethods(checkfunc)) != NULL) 476 if ((*name = luaT_travtagmethods(checkfunc)) != NULL)
477 return "tag-method"; 477 return "tag-method";
478 else if ((*name = luaS_travsymbol(checkfunc)) != NULL) 478 else if ((*name = luaS_travsymbol(checkfunc)) != NULL)
diff --git a/lstate.h b/lstate.h
index c1005817..9388b444 100644
--- a/lstate.h
+++ b/lstate.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstate.h,v 1.3 1997/11/26 20:28:22 roberto Exp roberto $ 2** $Id: lstate.h,v 1.4 1997/11/27 15:59:25 roberto Exp roberto $
3** Global State 3** Global State
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -51,7 +51,6 @@ typedef struct LState {
51 TObject errorim; /* error tag method */ 51 TObject errorim; /* error tag method */
52 struct C_Lua_Stack Cblocks[MAX_C_BLOCKS]; 52 struct C_Lua_Stack Cblocks[MAX_C_BLOCKS];
53 int numCblocks; /* number of nested Cblocks */ 53 int numCblocks; /* number of nested Cblocks */
54 TObject *functofind; /* auxiliar */
55 GCnode rootproto; /* list of all prototypes */ 54 GCnode rootproto; /* list of all prototypes */
56 GCnode rootcl; /* list of all closures */ 55 GCnode rootcl; /* list of all closures */
57 GCnode roottable; /* list of all tables */ 56 GCnode roottable; /* list of all tables */