diff options
author | nickysn <nickysn@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2015-03-28 01:37:57 +0000 |
---|---|---|
committer | nickysn <nickysn@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2015-03-28 01:37:57 +0000 |
commit | a911042ac8905b7deb3fb18af4f77da573cf5e54 (patch) | |
tree | dc2c9d5a41d6334451e7589f48205f09dd4fce92 | |
parent | e5c987d71b3f497649dfd671263515f69bb7a1b0 (diff) | |
download | fpc-a911042ac8905b7deb3fb18af4f77da573cf5e54.tar.gz |
+ added class for encapsulating an omf raw record
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@30344 3ad0048d-3df7-0310-abae-a5850022a9f2
-rw-r--r-- | compiler/omfbase.pas | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/compiler/omfbase.pas b/compiler/omfbase.pas index 7686e3d29a..0856817fce 100644 --- a/compiler/omfbase.pas +++ b/compiler/omfbase.pas @@ -26,6 +26,9 @@ unit omfbase; interface + uses + owbase; + const { OMF record types } RT_THEADR = $80; { Translator Header Record } @@ -68,6 +71,59 @@ interface RT_VERNUM = $CC; { OMF Version Number Record } RT_VENDEXT = $CE; { Vendor-specific OMF Extension Record } + type + + { TOmfRawRecord } + + TOmfRawRecord = class + private + function GetRecordLength: Word; + function GetRecordType: Byte; + procedure SetRecordLength(AValue: Word); + procedure SetRecordType(AValue: Byte); + public + RawData: array [-3..65535] of Byte; + property RecordType: Byte read GetRecordType write SetRecordType; + property RecordLength: Word read GetRecordLength write SetRecordLength; + + procedure ReadFrom(aReader: TObjectReader); + procedure WriteTo(aWriter: TObjectWriter); + end; + implementation + { TOmfRawRecord } + + function TOmfRawRecord.GetRecordType: Byte; + begin + Result:=RawData[-3]; + end; + + procedure TOmfRawRecord.SetRecordType(AValue: Byte); + begin + RawData[-3]:=AValue; + end; + + function TOmfRawRecord.GetRecordLength: Word; + begin + Result:=RawData[-2] or (RawData[-1] shl 8); + end; + + procedure TOmfRawRecord.SetRecordLength(AValue: Word); + begin + RawData[-2]:=Byte(AValue); + RawData[-1]:=Byte(AValue shr 8); + end; + + procedure TOmfRawRecord.ReadFrom(aReader: TObjectReader); + begin + aReader.read(RawData, 3); + aReader.read(RawData[0], RecordLength); + end; + + procedure TOmfRawRecord.WriteTo(aWriter: TObjectWriter); + begin + aWriter.write(RawData, RecordLength+3); + end; + end. |