aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1996-02-08 15:03:20 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1996-02-08 15:03:20 -0200
commit826d70fcba11a46de74a316b76caf94eb5a5acc5 (patch)
treef3b050e29578dd8bfe3a2af0d55fa59ab7f911cb
parentbbb23048e399aa9ebcc22f83104de35aab6bbe14 (diff)
downloadlua-826d70fcba11a46de74a316b76caf94eb5a5acc5.tar.gz
lua-826d70fcba11a46de74a316b76caf94eb5a5acc5.tar.bz2
lua-826d70fcba11a46de74a316b76caf94eb5a5acc5.zip
new type lua_Function for activation records
-rw-r--r--luadebug.h14
-rw-r--r--opcode.c10
2 files changed, 13 insertions, 11 deletions
diff --git a/luadebug.h b/luadebug.h
index 876e45f0..157d1402 100644
--- a/luadebug.h
+++ b/luadebug.h
@@ -2,7 +2,7 @@
2** LUA - Linguagem para Usuarios de Aplicacao 2** LUA - Linguagem para Usuarios de Aplicacao
3** Grupo de Tecnologia em Computacao Grafica 3** Grupo de Tecnologia em Computacao Grafica
4** TeCGraf - PUC-Rio 4** TeCGraf - PUC-Rio
5** $Id: luadebug.h,v 1.3 1996/01/09 20:22:44 roberto Exp roberto $ 5** $Id: luadebug.h,v 1.4 1996/02/07 18:10:27 roberto Exp roberto $
6*/ 6*/
7 7
8 8
@@ -11,18 +11,20 @@
11 11
12#include "lua.h" 12#include "lua.h"
13 13
14typedef lua_Object lua_Function;
15
14typedef void (*lua_LHFunction) (int line); 16typedef void (*lua_LHFunction) (int line);
15typedef void (*lua_CHFunction) (lua_Object func, char *file, int line); 17typedef void (*lua_CHFunction) (lua_Function func, char *file, int line);
16 18
17lua_Object lua_stackedfunction (int level); 19lua_Function lua_stackedfunction (int level);
18void lua_funcinfo (lua_Object func, char **filename, int *linedefined); 20void lua_funcinfo (lua_Object func, char **filename, int *linedefined);
19int lua_currentline (lua_Object func); 21int lua_currentline (lua_Function func);
20char *lua_getobjname (lua_Object o, char **name); 22char *lua_getobjname (lua_Object o, char **name);
21lua_LHFunction lua_setlinehook (lua_LHFunction hook); 23lua_LHFunction lua_setlinehook (lua_LHFunction hook);
22lua_CHFunction lua_setcallhook (lua_CHFunction hook); 24lua_CHFunction lua_setcallhook (lua_CHFunction hook);
23 25
24lua_Object lua_getlocal (lua_Object func, int local_number, char **name); 26lua_Object lua_getlocal (lua_Function func, int local_number, char **name);
25int lua_setlocal (lua_Object func, int local_number); 27int lua_setlocal (lua_Function func, int local_number);
26 28
27extern int lua_debug; 29extern int lua_debug;
28 30
diff --git a/opcode.c b/opcode.c
index ff91cba9..5999d7a6 100644
--- a/opcode.c
+++ b/opcode.c
@@ -3,7 +3,7 @@
3** TecCGraf - PUC-Rio 3** TecCGraf - PUC-Rio
4*/ 4*/
5 5
6char *rcs_opcode="$Id: opcode.c,v 3.54 1996/01/30 15:25:23 roberto Exp roberto $"; 6char *rcs_opcode="$Id: opcode.c,v 3.55 1996/02/07 18:10:27 roberto Exp roberto $";
7 7
8#include <setjmp.h> 8#include <setjmp.h>
9#include <stdlib.h> 9#include <stdlib.h>
@@ -423,7 +423,7 @@ void lua_error (char *s)
423} 423}
424 424
425 425
426lua_Object lua_stackedfunction (int level) 426lua_Function lua_stackedfunction (int level)
427{ 427{
428 Object *p = top; 428 Object *p = top;
429 while (--p >= stack) 429 while (--p >= stack)
@@ -434,14 +434,14 @@ lua_Object lua_stackedfunction (int level)
434} 434}
435 435
436 436
437int lua_currentline (lua_Object func) 437int lua_currentline (lua_Function func)
438{ 438{
439 Object *f = Address(func); 439 Object *f = Address(func);
440 return (f+1 < top && (f+1)->tag == LUA_T_LINE) ? (f+1)->value.i : -1; 440 return (f+1 < top && (f+1)->tag == LUA_T_LINE) ? (f+1)->value.i : -1;
441} 441}
442 442
443 443
444lua_Object lua_getlocal (lua_Object func, int local_number, char **name) 444lua_Object lua_getlocal (lua_Function func, int local_number, char **name)
445{ 445{
446 Object *f = luaI_Address(func); 446 Object *f = luaI_Address(func);
447 *name = luaI_getlocalname(f->value.tf, local_number, lua_currentline(func)); 447 *name = luaI_getlocalname(f->value.tf, local_number, lua_currentline(func));
@@ -455,7 +455,7 @@ lua_Object lua_getlocal (lua_Object func, int local_number, char **name)
455 return LUA_NOOBJECT; 455 return LUA_NOOBJECT;
456} 456}
457 457
458int lua_setlocal (lua_Object func, int local_number) 458int lua_setlocal (lua_Function func, int local_number)
459{ 459{
460 Object *f = Address(func); 460 Object *f = Address(func);
461 char *name = luaI_getlocalname(f->value.tf, local_number, lua_currentline(func)); 461 char *name = luaI_getlocalname(f->value.tf, local_number, lua_currentline(func));