Browse Source

new type lua_Function for activation records

v5-2
Roberto Ierusalimschy 29 years ago
parent
commit
826d70fcba
  1. 14
      luadebug.h
  2. 10
      opcode.c

14
luadebug.h

@ -2,7 +2,7 @@
** LUA - Linguagem para Usuarios de Aplicacao ** LUA - Linguagem para Usuarios de Aplicacao
** Grupo de Tecnologia em Computacao Grafica ** Grupo de Tecnologia em Computacao Grafica
** TeCGraf - PUC-Rio ** TeCGraf - PUC-Rio
** $Id: luadebug.h,v 1.3 1996/01/09 20:22:44 roberto Exp roberto $ ** $Id: luadebug.h,v 1.4 1996/02/07 18:10:27 roberto Exp roberto $
*/ */
@ -11,18 +11,20 @@
#include "lua.h" #include "lua.h"
typedef lua_Object lua_Function;
typedef void (*lua_LHFunction) (int line); typedef void (*lua_LHFunction) (int line);
typedef void (*lua_CHFunction) (lua_Object func, char *file, int line); typedef void (*lua_CHFunction) (lua_Function func, char *file, int line);
lua_Object lua_stackedfunction (int level); lua_Function lua_stackedfunction (int level);
void lua_funcinfo (lua_Object func, char **filename, int *linedefined); void lua_funcinfo (lua_Object func, char **filename, int *linedefined);
int lua_currentline (lua_Object func); int lua_currentline (lua_Function func);
char *lua_getobjname (lua_Object o, char **name); char *lua_getobjname (lua_Object o, char **name);
lua_LHFunction lua_setlinehook (lua_LHFunction hook); lua_LHFunction lua_setlinehook (lua_LHFunction hook);
lua_CHFunction lua_setcallhook (lua_CHFunction hook); lua_CHFunction lua_setcallhook (lua_CHFunction hook);
lua_Object lua_getlocal (lua_Object func, int local_number, char **name); lua_Object lua_getlocal (lua_Function func, int local_number, char **name);
int lua_setlocal (lua_Object func, int local_number); int lua_setlocal (lua_Function func, int local_number);
extern int lua_debug; extern int lua_debug;

10
opcode.c

@ -3,7 +3,7 @@
** TecCGraf - PUC-Rio ** TecCGraf - PUC-Rio
*/ */
char *rcs_opcode="$Id: opcode.c,v 3.54 1996/01/30 15:25:23 roberto Exp roberto $"; char *rcs_opcode="$Id: opcode.c,v 3.55 1996/02/07 18:10:27 roberto Exp roberto $";
#include <setjmp.h> #include <setjmp.h>
#include <stdlib.h> #include <stdlib.h>
@ -423,7 +423,7 @@ void lua_error (char *s)
} }
lua_Object lua_stackedfunction (int level) lua_Function lua_stackedfunction (int level)
{ {
Object *p = top; Object *p = top;
while (--p >= stack) while (--p >= stack)
@ -434,14 +434,14 @@ lua_Object lua_stackedfunction (int level)
} }
int lua_currentline (lua_Object func) int lua_currentline (lua_Function func)
{ {
Object *f = Address(func); Object *f = Address(func);
return (f+1 < top && (f+1)->tag == LUA_T_LINE) ? (f+1)->value.i : -1; return (f+1 < top && (f+1)->tag == LUA_T_LINE) ? (f+1)->value.i : -1;
} }
lua_Object lua_getlocal (lua_Object func, int local_number, char **name) lua_Object lua_getlocal (lua_Function func, int local_number, char **name)
{ {
Object *f = luaI_Address(func); Object *f = luaI_Address(func);
*name = luaI_getlocalname(f->value.tf, local_number, lua_currentline(func)); *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)
return LUA_NOOBJECT; return LUA_NOOBJECT;
} }
int lua_setlocal (lua_Object func, int local_number) int lua_setlocal (lua_Function func, int local_number)
{ {
Object *f = Address(func); Object *f = Address(func);
char *name = luaI_getlocalname(f->value.tf, local_number, lua_currentline(func)); char *name = luaI_getlocalname(f->value.tf, local_number, lua_currentline(func));

Loading…
Cancel
Save