mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-15 23:29:13 +02:00
+ added class for encoding/decoding an omf library end record
git-svn-id: trunk@30660 -
This commit is contained in:
parent
e791f534d2
commit
623ea066c7
@ -72,6 +72,7 @@ interface
|
|||||||
RT_VERNUM = $CC; { OMF Version Number Record }
|
RT_VERNUM = $CC; { OMF Version Number Record }
|
||||||
RT_VENDEXT = $CE; { Vendor-specific OMF Extension Record }
|
RT_VENDEXT = $CE; { Vendor-specific OMF Extension Record }
|
||||||
RT_LIBHEAD = $F0; { Library Header Record }
|
RT_LIBHEAD = $F0; { Library Header Record }
|
||||||
|
RT_LIBEND = $F1; { Library End Record (marks end of objects and beginning of dictionary) }
|
||||||
|
|
||||||
{ OMF comment class }
|
{ OMF comment class }
|
||||||
CC_Translator = $00; { language translator (compiler or assembler) name }
|
CC_Translator = $00; { language translator (compiler or assembler) name }
|
||||||
@ -486,6 +487,19 @@ interface
|
|||||||
property CaseSensitive: Boolean read IsCaseSensitive write SetCaseSensitive;
|
property CaseSensitive: Boolean read IsCaseSensitive write SetCaseSensitive;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ TOmfRecord_LIBEND }
|
||||||
|
|
||||||
|
TOmfRecord_LIBEND = class(TOmfParsedRecord)
|
||||||
|
private
|
||||||
|
FPaddingBytes: Word;
|
||||||
|
public
|
||||||
|
procedure DecodeFrom(RawRecord: TOmfRawRecord);override;
|
||||||
|
procedure EncodeTo(RawRecord: TOmfRawRecord);override;
|
||||||
|
|
||||||
|
procedure CalculatePaddingBytes(RecordStartOffset: DWord);
|
||||||
|
property PaddingBytes: Word read FPaddingBytes write FPaddingBytes;
|
||||||
|
end;
|
||||||
|
|
||||||
TOmfLibHash = record
|
TOmfLibHash = record
|
||||||
block_x: Integer;
|
block_x: Integer;
|
||||||
block_d: Integer;
|
block_d: Integer;
|
||||||
@ -1494,6 +1508,35 @@ implementation
|
|||||||
FFlags:=(FFlags and $FE) or Ord(AValue);
|
FFlags:=(FFlags and $FE) or Ord(AValue);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ TOmfRecord_LIBEND }
|
||||||
|
|
||||||
|
procedure TOmfRecord_LIBEND.DecodeFrom(RawRecord: TOmfRawRecord);
|
||||||
|
begin
|
||||||
|
if RawRecord.RecordType<>RT_LIBEND then
|
||||||
|
internalerror(2015040301);
|
||||||
|
FPaddingBytes:=RawRecord.RecordLength;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TOmfRecord_LIBEND.EncodeTo(RawRecord: TOmfRawRecord);
|
||||||
|
begin
|
||||||
|
{ make sure the LIBEND record is padded with zeros at the end }
|
||||||
|
FillChar(RawRecord.RawData,SizeOf(RawRecord.RawData),0);
|
||||||
|
RawRecord.RecordType:=RT_LIBEND;
|
||||||
|
RawRecord.RecordLength:=FPaddingBytes;
|
||||||
|
{ the LIBEND record contains no checksum byte, so no need to call
|
||||||
|
RawRecord.CalculateChecksumByte }
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TOmfRecord_LIBEND.CalculatePaddingBytes(RecordStartOffset: DWord);
|
||||||
|
var
|
||||||
|
DictionaryStartOffset: Integer;
|
||||||
|
begin
|
||||||
|
{ padding must be calculated, so that the dictionary begins on a 512-byte boundary }
|
||||||
|
Inc(RecordStartOffset,3); // padding begins _after_ the record header (3 bytes)
|
||||||
|
DictionaryStartOffset:=(RecordStartOffset+511) and $fffffe00;
|
||||||
|
PaddingBytes:=DictionaryStartOffset-RecordStartOffset;
|
||||||
|
end;
|
||||||
|
|
||||||
function compute_omf_lib_hash(const name: string; blocks: Integer): TOmfLibHash;
|
function compute_omf_lib_hash(const name: string; blocks: Integer): TOmfLibHash;
|
||||||
const
|
const
|
||||||
blank=$20; // ASCII blank
|
blank=$20; // ASCII blank
|
||||||
|
Loading…
Reference in New Issue
Block a user