aboutsummaryrefslogtreecommitdiff
path: root/lvm.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-08-08 15:26:05 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-08-08 15:26:05 -0300
commitf90bc248b3c3c18941a96038b2a7517ad571d8b1 (patch)
tree696583e7b4f462d01b07b8510faecd47b9baaf62 /lvm.c
parentd9e61e8ceafe8c3f6ad936979719ca7c446ce228 (diff)
downloadlua-f90bc248b3c3c18941a96038b2a7517ad571d8b1.tar.gz
lua-f90bc248b3c3c18941a96038b2a7517ad571d8b1.tar.bz2
lua-f90bc248b3c3c18941a96038b2a7517ad571d8b1.zip
new structure for line information
Diffstat (limited to 'lvm.c')
-rw-r--r--lvm.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/lvm.c b/lvm.c
index ed29602c..0ea8ea9f 100644
--- a/lvm.c
+++ b/lvm.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lvm.c,v 1.119 2000/06/28 20:20:36 roberto Exp roberto $ 2** $Id: lvm.c,v 1.120 2000/06/30 14:35:17 roberto Exp roberto $
3** Lua virtual machine 3** Lua virtual machine
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -69,14 +69,20 @@ int luaV_tostring (lua_State *L, TObject *obj) { /* LUA_NUMBER */
69 69
70static void traceexec (lua_State *L, StkId base, StkId top, lua_Hook linehook) { 70static void traceexec (lua_State *L, StkId base, StkId top, lua_Hook linehook) {
71 CallInfo *ci = infovalue(base-1); 71 CallInfo *ci = infovalue(base-1);
72 int *lines = ci->func->f.l->lines; 72 int *lineinfo = ci->func->f.l->lineinfo;
73 int pc = (*ci->pc - 1) - ci->func->f.l->code; 73 int pc = (*ci->pc - 1) - ci->func->f.l->code;
74 if (lines) { 74 if (lineinfo) {
75 int newline;
76 if (ci->line == 0) { /* first time? */
77 ci->line = 1;
78 ci->refi = 0;
79 }
80 newline = luaG_getline(lineinfo, pc, ci->line, &ci->refi);
75 /* calls linehook when enters a new line or jumps back (loop) */ 81 /* calls linehook when enters a new line or jumps back (loop) */
76 if (lines[pc] != ci->line || pc <= ci->lastpc) { 82 if (newline != ci->line || pc <= ci->lastpc) {
77 ci->line = lines[pc]; 83 ci->line = newline;
78 L->top = top; 84 L->top = top;
79 luaD_lineHook(L, base-2, lines[pc], linehook); 85 luaD_lineHook(L, base-2, newline, linehook);
80 } 86 }
81 } 87 }
82 ci->lastpc = pc; 88 ci->lastpc = pc;