summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graemeg@gmail.com>2009-11-07 15:42:57 +0200
committerGraeme Geldenhuys <graemeg@gmail.com>2009-11-07 15:42:57 +0200
commit0511852534c17faad6e22d2fe5823cc23a490280 (patch)
tree7e014619a7d4737d709c9e5bf4094320c21625d5
parentf38cceca3d15256a6d071a39bd511f2d8ba3600d (diff)
downloadfpGUI-0511852534c17faad6e22d2fe5823cc23a490280.tar.xz
docdump: new outputs extended toc entry information.
-rw-r--r--src/docdump/readheader.pas2
-rw-r--r--src/docdump/readtoc.pas67
2 files changed, 60 insertions, 9 deletions
diff --git a/src/docdump/readheader.pas b/src/docdump/readheader.pas
index eb639873..201fcb86 100644
--- a/src/docdump/readheader.pas
+++ b/src/docdump/readheader.pas
@@ -83,7 +83,7 @@ begin
AOut.WriteLn(Format(' ipfheader.icmdSize: %8.8x (%0:7d bytes) : size of icmd index table', [hdr.icmdSize]));
t1 := TOverlaySearchStart(hdr.searchstart);
i := t1.SearchOffset;
- AOut.WriteLn(Format(' ipfheader.searchstart :31 %8.8x (%0:7d bytes) : 31 bit file offset of full text search table', [i, i]));
+ AOut.WriteLn(Format(' ipfheader.searchstart :31 %8.8x (%0:7d bytes) : 31bit file offset of full text search table', [i, i]));
if t1.IsRec16bitSize then
s := 'search rec is 16bit size'
else
diff --git a/src/docdump/readtoc.pas b/src/docdump/readtoc.pas
index d1b08e22..0cfae395 100644
--- a/src/docdump/readtoc.pas
+++ b/src/docdump/readtoc.pas
@@ -15,7 +15,7 @@ procedure ProcessTOC(AIn: TFileStream; AOut: TFileTextStream);
implementation
uses
- IPFFileFormatUnit, readheader;
+ IPFFileFormatUnit, readheader, u_Tools;
type
TTOCOverlay = bitpacked record
@@ -29,6 +29,23 @@ type
end;
+ TTOCExtendedOverlay = bitpacked record
+ setPos: boolean;
+ setSize: boolean;
+ setView: boolean;
+ setStyle: boolean;
+ noSearch: boolean;
+ noPrint: boolean;
+ setCtrl: boolean;
+ setTutor: boolean;
+ clear: boolean;
+ unknown1: Unsigned_1;
+ setGroup: boolean;
+ isParent: boolean;
+ unknown2: Unsigned_4;
+ end;
+
+
procedure ProcessTOC(AIn: TFileStream; AOut: TFileTextStream);
var
Count: integer;
@@ -36,10 +53,14 @@ var
pOffsets: UInt32ArrayPointer;
toc: TTOCEntryStart;
olay: TTOCOverlay;
+ tocextolay: TTOCExtendedOverlay;
pData: pointer;
pEntry: pTTOCEntryStart;
pExtendedInfo: pExtendedTOCEntry;
p: PByte;
+ i: integer;
+ titleLen: integer;
+ title: string;
begin
AOut.WriteLn('');
AOut.WriteLn('Table of Contents');
@@ -52,30 +73,49 @@ begin
GetMem(pData, hdr.toclen);
AIn.Read(pData^, hdr.toclen);
pEntry := pData;
- for count := 0 to hdr.ntoc-1 do
+ for count := 1 to hdr.ntoc do
begin
// AIn.Read(toc, SizeOf(TTOCEntryStart));
// FillChar(olay, SizeOf(TTOCOverlay), 0);
p := PByte(pEntry) + sizeof(TTOCEntryStart);
+ i := Longint(p^);
olay.extended := (pEntry^.flags and TOCEntryExtended ) = TOCEntryExtended;
olay.nestlevel := (pEntry^.flags and TOCEntryLevelMask);
olay.hidden := (pEntry^.flags and TOCEntryHidden) = TOCEntryHidden;
olay.haschildren := (pEntry^.flags and TOCEntryHasChildren) = TOCEntryHasChildren;
- AOut.WriteLn(Format(' TOC Entry #%d at offset %8.8p (1:d)', [count+1, pEntry]));
+ AOut.WriteLn(Format(' TOC Entry #%d at offset %8.8x (%d bytes)', [count, p^, i]));
AOut.WriteLn(Format(' tocentry.length: %2.2x (%0:d bytes)', [pEntry^.length]));
AOut.WriteLn(Format(' tocentry.nestlevel: %d', [olay.nestlevel]));
- AOut.WriteLn(Format(' tocentry.unknown: %s', [BoolToStr(olay.unknown, True)]));
- AOut.WriteLn(Format(' tocentry.extended: %s', [BoolToStr(olay.extended, True)]));
- AOut.WriteLn(Format(' tocentry.hidden: %s', [BoolToStr(olay.hidden, True)]));
- AOut.WriteLn(Format(' tocentry.haschildren: %s', [BoolToStr(olay.haschildren, True)]));
+ AOut.WriteLn(Format(' tocentry.unknown: %s', [iif(olay.unknown, 'set', 'clear')]));
+ AOut.WriteLn(Format(' tocentry.extended: %s', [iif(olay.extended, 'yes', 'no')]));
+ AOut.WriteLn(Format(' tocentry.hidden: %s', [iif(olay.hidden, 'yes', 'no')]));
+ AOut.WriteLn(Format(' tocentry.haschildren: %s', [iif(olay.haschildren, 'yes', 'no')]));
AOut.WriteLn(Format(' tocentry.numSlots: %d', [pEntry^.numSlots]));
if not olay.hidden then
inc(VisCount);
if olay.extended then
begin
pExtendedInfo := pExtendedTOCEntry( p ); // next data to follow must be Extended TOC Entry
+
+ AOut.WriteLn(' Extended TOC Entry');
+ tocextolay := TTOCExtendedOverlay(pExtendedInfo^);
+
+ AOut.Writeln(Format(' ExtTocEntry.setPos: %s', [iif(tocextolay.setPos, 'yes', 'no')]));
+ AOut.Writeln(Format(' ExtTocEntry.setSize: %s', [iif(tocextolay.setSize, 'yes', 'no')]));
+ AOut.Writeln(Format(' ExtTocEntry.setView: %s', [iif(tocextolay.setView, 'yes', 'no')]));
+ AOut.Writeln(Format(' ExtTocEntry.setStyle: %s', [iif(tocextolay.setStyle, 'yes', 'no')]));
+ AOut.Writeln(Format(' ExtTocEntry.noSearch: %s', [iif(tocextolay.noSearch, 'yes', 'no')]));
+ AOut.Writeln(Format(' ExtTocEntry.noPrint: %s', [iif(tocextolay.noPrint, 'yes', 'no')]));
+ AOut.Writeln(Format(' ExtTocEntry.setCtrl: %s', [iif(tocextolay.setCtrl, 'yes', 'no')]));
+ AOut.Writeln(Format(' ExtTocEntry.setTutor: %s', [iif(tocextolay.setTutor, 'yes', 'no')]));
+ AOut.Writeln(Format(' ExtTocEntry.clear: %s', [iif(tocextolay.clear, 'clear', 'set')]));
+ AOut.Writeln(Format(' ExtTocEntry.unknown1: %1.1x', [tocextolay.unknown1]));
+ AOut.Writeln(Format(' ExtTocEntry.setGroup: %s', [iif(tocextolay.setGroup, 'yes', 'no')]));
+ AOut.Writeln(Format(' ExtTocEntry.isParent: %s', [iif(tocextolay.isParent, 'yes', 'no')]));
+ AOut.Writeln(Format(' ExtTocEntry.unknown2: %1.1x', [tocextolay.unknown2]));
+
inc( p, sizeof( TExtendedTOCEntry ) ); // move p past two flag bytes
if ( pExtendedInfo^.w1 and 1 ) > 0 then
@@ -106,9 +146,20 @@ begin
// _pSlotNumbers := pUInt16(p);
inc( p, pEntry^.numSlots * sizeof(uint16) );
+ // Calculate the remainder of the tocentry length - that is the bytes used for TOC topic (title) text
+ titleLen := pEntry^.length - ( longword( p ) - longword( pEntry ) );
+
+ // Read title
+ if TitleLen > 0 then
+ SetString(Title, Pointer(p), TitleLen)
+ else
+ Title := '<unknown>';
+ AOut.WriteLn(Format(' toc Title: %s', [title]));
+
+
p := PByte(pEntry);
inc(p, pEntry^.Length);
- pEntry := pTTOCentryStart(p);
+ pEntry := pTTOCEntryStart(p);
end;
AOut.WriteLn(Format(' TOC visible count: %d', [VisCount]));