[truetype] Minor code refactoring.
Two benefits: The allocated FDEF (and IDEF) array gets slightly smaller, and the `ttdebug' demo program has access to function numbers without additional costs. Fortunately, no changes to FontForge are necessary – this is the only external TrueType debugger I know of, but others may exist and should check the code accordingly. * src/truetype/ttinterp.h (TT_CallRec): Replace `Cur_Restart' and `Cur_End' with a pointer to the corresponding `TT_DefRecord' structure. * src/truetype/ttinterp.c (DO_JROT, DO_JMPR, DO_JROF, Ins_ENDF, Ins_CALL, Ins_LOOPCALL, Ins_UNKNOWN, TT_RunIns <Invalid_Opcode>): Updated.
This commit is contained in:
parent
e921bdebde
commit
ebf52d6a90
20
ChangeLog
20
ChangeLog
|
@ -1,3 +1,23 @@
|
||||||
|
2013-11-01 Werner Lemberg <wl@gnu.org>
|
||||||
|
|
||||||
|
[truetype] Minor code refactoring.
|
||||||
|
|
||||||
|
Two benefits: The allocated FDEF (and IDEF) array gets slightly
|
||||||
|
smaller, and the `ttdebug' demo program has access to function
|
||||||
|
numbers without additional costs.
|
||||||
|
|
||||||
|
Fortunately, no changes to FontForge are necessary – this is the
|
||||||
|
only external TrueType debugger I know of, but others may exist and
|
||||||
|
should check the code accordingly.
|
||||||
|
|
||||||
|
* src/truetype/ttinterp.h (TT_CallRec): Replace `Cur_Restart' and
|
||||||
|
`Cur_End' with a pointer to the corresponding `TT_DefRecord'
|
||||||
|
structure.
|
||||||
|
|
||||||
|
* src/truetype/ttinterp.c (DO_JROT, DO_JMPR, DO_JROF, Ins_ENDF,
|
||||||
|
Ins_CALL, Ins_LOOPCALL, Ins_UNKNOWN, TT_RunIns <Invalid_Opcode>):
|
||||||
|
Updated.
|
||||||
|
|
||||||
2013-10-27 Werner Lemberg <wl@gnu.org>
|
2013-10-27 Werner Lemberg <wl@gnu.org>
|
||||||
|
|
||||||
[sfnt] Implement support for `OS/2' table version 5.
|
[sfnt] Implement support for `OS/2' table version 5.
|
||||||
|
|
|
@ -3151,42 +3151,42 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define DO_JROT \
|
#define DO_JROT \
|
||||||
if ( args[1] != 0 ) \
|
if ( args[1] != 0 ) \
|
||||||
{ \
|
{ \
|
||||||
if ( args[0] == 0 && CUR.args == 0 ) \
|
if ( args[0] == 0 && CUR.args == 0 ) \
|
||||||
CUR.error = FT_THROW( Bad_Argument ); \
|
CUR.error = FT_THROW( Bad_Argument ); \
|
||||||
CUR.IP += args[0]; \
|
CUR.IP += args[0]; \
|
||||||
if ( CUR.IP < 0 || \
|
if ( CUR.IP < 0 || \
|
||||||
( CUR.callTop > 0 && \
|
( CUR.callTop > 0 && \
|
||||||
CUR.IP > CUR.callStack[CUR.callTop - 1].Cur_End ) ) \
|
CUR.IP > CUR.callStack[CUR.callTop - 1].Def->end ) ) \
|
||||||
CUR.error = FT_THROW( Bad_Argument ); \
|
CUR.error = FT_THROW( Bad_Argument ); \
|
||||||
CUR.step_ins = FALSE; \
|
CUR.step_ins = FALSE; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define DO_JMPR \
|
#define DO_JMPR \
|
||||||
if ( args[0] == 0 && CUR.args == 0 ) \
|
if ( args[0] == 0 && CUR.args == 0 ) \
|
||||||
CUR.error = FT_THROW( Bad_Argument ); \
|
CUR.error = FT_THROW( Bad_Argument ); \
|
||||||
CUR.IP += args[0]; \
|
CUR.IP += args[0]; \
|
||||||
if ( CUR.IP < 0 || \
|
if ( CUR.IP < 0 || \
|
||||||
( CUR.callTop > 0 && \
|
( CUR.callTop > 0 && \
|
||||||
CUR.IP > CUR.callStack[CUR.callTop - 1].Cur_End ) ) \
|
CUR.IP > CUR.callStack[CUR.callTop - 1].Def->end ) ) \
|
||||||
CUR.error = FT_THROW( Bad_Argument ); \
|
CUR.error = FT_THROW( Bad_Argument ); \
|
||||||
CUR.step_ins = FALSE;
|
CUR.step_ins = FALSE;
|
||||||
|
|
||||||
|
|
||||||
#define DO_JROF \
|
#define DO_JROF \
|
||||||
if ( args[1] == 0 ) \
|
if ( args[1] == 0 ) \
|
||||||
{ \
|
{ \
|
||||||
if ( args[0] == 0 && CUR.args == 0 ) \
|
if ( args[0] == 0 && CUR.args == 0 ) \
|
||||||
CUR.error = FT_THROW( Bad_Argument ); \
|
CUR.error = FT_THROW( Bad_Argument ); \
|
||||||
CUR.IP += args[0]; \
|
CUR.IP += args[0]; \
|
||||||
if ( CUR.IP < 0 || \
|
if ( CUR.IP < 0 || \
|
||||||
( CUR.callTop > 0 && \
|
( CUR.callTop > 0 && \
|
||||||
CUR.IP > CUR.callStack[CUR.callTop - 1].Cur_End ) ) \
|
CUR.IP > CUR.callStack[CUR.callTop - 1].Def->end ) ) \
|
||||||
CUR.error = FT_THROW( Bad_Argument ); \
|
CUR.error = FT_THROW( Bad_Argument ); \
|
||||||
CUR.step_ins = FALSE; \
|
CUR.step_ins = FALSE; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -4902,7 +4902,7 @@
|
||||||
if ( pRec->Cur_Count > 0 )
|
if ( pRec->Cur_Count > 0 )
|
||||||
{
|
{
|
||||||
CUR.callTop++;
|
CUR.callTop++;
|
||||||
CUR.IP = pRec->Cur_Restart;
|
CUR.IP = pRec->Def->start;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
/* Loop through the current function */
|
/* Loop through the current function */
|
||||||
|
@ -4992,8 +4992,7 @@
|
||||||
pCrec->Caller_Range = CUR.curRange;
|
pCrec->Caller_Range = CUR.curRange;
|
||||||
pCrec->Caller_IP = CUR.IP + 1;
|
pCrec->Caller_IP = CUR.IP + 1;
|
||||||
pCrec->Cur_Count = 1;
|
pCrec->Cur_Count = 1;
|
||||||
pCrec->Cur_Restart = def->start;
|
pCrec->Def = def;
|
||||||
pCrec->Cur_End = def->end;
|
|
||||||
|
|
||||||
CUR.callTop++;
|
CUR.callTop++;
|
||||||
|
|
||||||
|
@ -5081,8 +5080,7 @@
|
||||||
pCrec->Caller_Range = CUR.curRange;
|
pCrec->Caller_Range = CUR.curRange;
|
||||||
pCrec->Caller_IP = CUR.IP + 1;
|
pCrec->Caller_IP = CUR.IP + 1;
|
||||||
pCrec->Cur_Count = (FT_Int)args[0];
|
pCrec->Cur_Count = (FT_Int)args[0];
|
||||||
pCrec->Cur_Restart = def->start;
|
pCrec->Def = def;
|
||||||
pCrec->Cur_End = def->end;
|
|
||||||
|
|
||||||
CUR.callTop++;
|
CUR.callTop++;
|
||||||
|
|
||||||
|
@ -7917,8 +7915,7 @@
|
||||||
call->Caller_Range = CUR.curRange;
|
call->Caller_Range = CUR.curRange;
|
||||||
call->Caller_IP = CUR.IP + 1;
|
call->Caller_IP = CUR.IP + 1;
|
||||||
call->Cur_Count = 1;
|
call->Cur_Count = 1;
|
||||||
call->Cur_Restart = def->start;
|
call->Def = def;
|
||||||
call->Cur_End = def->end;
|
|
||||||
|
|
||||||
INS_Goto_CodeRange( def->range, def->start );
|
INS_Goto_CodeRange( def->range, def->start );
|
||||||
|
|
||||||
|
@ -8974,8 +8971,7 @@
|
||||||
callrec->Caller_Range = CUR.curRange;
|
callrec->Caller_Range = CUR.curRange;
|
||||||
callrec->Caller_IP = CUR.IP + 1;
|
callrec->Caller_IP = CUR.IP + 1;
|
||||||
callrec->Cur_Count = 1;
|
callrec->Cur_Count = 1;
|
||||||
callrec->Cur_Restart = def->start;
|
callrec->Def = def;
|
||||||
callrec->Cur_End = def->end;
|
|
||||||
|
|
||||||
if ( INS_Goto_CodeRange( def->range, def->start ) == FAILURE )
|
if ( INS_Goto_CodeRange( def->range, def->start ) == FAILURE )
|
||||||
goto LErrorLabel_;
|
goto LErrorLabel_;
|
||||||
|
|
|
@ -101,8 +101,8 @@ FT_BEGIN_HEADER
|
||||||
FT_Int Caller_Range;
|
FT_Int Caller_Range;
|
||||||
FT_Long Caller_IP;
|
FT_Long Caller_IP;
|
||||||
FT_Long Cur_Count;
|
FT_Long Cur_Count;
|
||||||
FT_Long Cur_Restart;
|
|
||||||
FT_Long Cur_End;
|
TT_DefRecord *Def; /* either FDEF or IDEF */
|
||||||
|
|
||||||
} TT_CallRec, *TT_CallStack;
|
} TT_CallRec, *TT_CallStack;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue