Unit HelpFileHeader; {$mode objfpc}{$H+} // NewView - a new OS/2 Help Viewer // Copyright 2001 Aaron Lawrence (aaronl at consultant dot com) // This software is released under the Gnu Public License - see readme.txt Interface // Definition of IPF file header and other structures uses DataTypes; Type THelpFileHeader = packed record ID: int16; // ID magic word (5348h = "HS") unknown1: byte; // unknown purpose, could be third letter of ID flags: byte; // probably a flag word... // bit 0: set if INF style file // bit 4: set if HLP style file // patching this byte allows reading HLP files // using the VIEW command, while help files // seem to work with INF settings here as well. hdrsize: word; // total size of header unknown2: word; // unknown purpose ntoc: int16; // number of entries in the tocarray tocstart: int32; // file offset of the start of the toc toclen: int32; // number of bytes in file occupied by the toc tocoffsetsstart: int32; // file offset of the start of array of toc offsets nres: int16; // number of panels with ressource numbers resstart: int32; // 32 bit file offset of ressource number table nname: int16; // number of panels with textual name namestart: int32; // 32 bit file offset to panel name table nindex: int16; // number of index entries indexstart: int32; // 32 bit file offset to index table indexlen: int32; // size of index table unknown3: array[0..9] of byte; // unknown purpose searchstart: int32; // 32 bit file offset of full text search table searchlen: int32; // size of full text search table nslots: int16; // number of "slots" slotsstart: int32; // file offset of the slots array dictlen: int32; // number of bytes occupied by the "dictionary" ndict: int16; // number of entries in the dictionary dictstart: int32; // file offset of the start of the dictionary imgstart: int32; // file offset of image data unknown4: byte; // unknown purpose nlsstart: int32; // 32 bit file offset of NLS table nlslen: int32; // size of NLS table extstart: int32; // 32 bit file offset of extended data block reserved: array[0..11] of byte; // for future use. set to zero. title: array[ 0..47 ] of char; // ASCII title of database end; pTHelpFileHeader = ^THelpFileHeader; Type TTOCEntryStart = packed record length: int8; // length of the entry including this byte flags: int8; // flag byte, description folows (MSB first) // bit7 haschildren; // following nodes are a higher level // bit6 hidden; // this entry doesn't appear in VIEW.EXE's // presentation of the toc // bit5 extended; // extended entry format // bit4 stuff; // ?? // int4 level; // nesting level numSlots: int8; // number of "slots" occupied by the text for this toc entry Slots : record end; end; pTTOCEntryStart = ^TTOCEntryStart; TExtendedTOCEntry = packed record w1: byte; // bit 3: Window controls are specified // bit 2: Viewport // bit 1: Size is specified. // bit 0: Position is specified. w2: byte; // bit 3: // bit 2: Group is specified. // bit 1 // bit 0: Clear (all windows before display) end; pExtendedTOCEntry = ^TExtendedTOCEntry; TTOCEntryOffsetArray = packed array[ 0..0 ] of int32; pTTOCEntryOffsetArray = ^TTOCEntryOffsetArray; const TOCEntryExtended = $20; { extended entry format } TOCEntryHidden = $40; { this entry doesn't appear in VIEW.EXE's presentation of the toc } TOCEntryHasChildren = $80; { following nodes are a higher level } TOCEntryLevelMask = $0f; type THelpXYPair = packed record Flags: int8; X: int16; Y: int16; end; pHelpXYPair = ^ THelpXYPair; TSlotHeader = packed record stuff: int8; // always 0?? localdictpos: int32; // file offset of the local dictionary nlocaldict: int8; // number of entries in the local dict ntext: int16; // number of bytes in the text end; pSlotHeader = ^TSlotHeader; Implementation Initialization End.