[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: struct Proto.lineinfo difference between Lua 5.3 and 5.4
- From: Wilfred Nilsen <realtimelogic@...>
- Date: Tue, 19 Oct 2021 14:34:58 -0700
After more carefully studying the 5.4 base, I believe the code should be
as follows. Can anyone verify this?
static void
printLines(lua_State* L, Proto* p)
{
int i;
int absLineIx = 0;
int line = p->linedefined;
for (i = 0; i < p->sizelineinfo; i++)
{
int lineDiff=p->lineinfo[i];
if(ABSLINEINFO == lineDiff )
{
if(absLineIx < p->sizeabslineinfo)
{
line = p->abslineinfo[absLineIx++].line;
}
else
{
assert(0); /* should not be possible ?? */
return;
}
}
else
{
line += lineDiff;
}
printf("\t%4d : %4d\n", line, lineDiff);
}
for (i = 0; i < p->sizep; i++)
{
printf("Func %d", i);
printLines(L, p->p[i]);
}
}
Hello,
I have some code coverage code I used with Lua 5.3 that no longer
works with 5.4. I am trying to wrap my head around the new Proto
structure.
The original 5.3 compatible recursive code used lineinfo as follows:
addActiveLines(lua_State* L, Proto *p)
{
int i;
for (i = 0; i < p->sizelineinfo; i++)
{
>>>>> SAVE the line p->lineinfo[i]
}
for (i = 0; i < p->sizep; i++)
{
addActiveLines(L, p->p[i]);
}
}
How do I make the above compatible with 5.4?
Thanks,
Wilfred