瀏覽代碼

+ added read only property TOmfSubRecord_FIXUP.LocationSize, which returns the
size in bytes of the fixup

git-svn-id: trunk@30678 -

nickysn 10 年之前
父節點
當前提交
32e0eca0dc
共有 1 個文件被更改,包括 25 次插入0 次删除
  1. 25 0
      compiler/omfbase.pas

+ 25 - 0
compiler/omfbase.pas

@@ -441,6 +441,7 @@ interface
       FFrameMethod: TOmfFixupFrameMethod;
       FFrameMethod: TOmfFixupFrameMethod;
       FFrameDatum: Integer;
       FFrameDatum: Integer;
       function GetDataRecordOffset: Integer;
       function GetDataRecordOffset: Integer;
+      function GetLocationSize: Integer;
       procedure SetDataRecordOffset(AValue: Integer);
       procedure SetDataRecordOffset(AValue: Integer);
     public
     public
       function ReadAt(RawRecord: TOmfRawRecord; Offset: Integer): Integer;
       function ReadAt(RawRecord: TOmfRawRecord; Offset: Integer): Integer;
@@ -450,6 +451,7 @@ interface
       property Mode: TOmfFixupMode read FMode write FMode;
       property Mode: TOmfFixupMode read FMode write FMode;
       property LocationType: TOmfFixupLocationType read FLocationType write FLocationType;
       property LocationType: TOmfFixupLocationType read FLocationType write FLocationType;
       property LocationOffset: DWord read FLocationOffset write FLocationOffset;
       property LocationOffset: DWord read FLocationOffset write FLocationOffset;
+      property LocationSize: Integer read GetLocationSize;
       property DataRecordStartOffset: DWord read FDataRecordStartOffset write FDataRecordStartOffset;
       property DataRecordStartOffset: DWord read FDataRecordStartOffset write FDataRecordStartOffset;
       property DataRecordOffset: Integer read GetDataRecordOffset write SetDataRecordOffset;
       property DataRecordOffset: Integer read GetDataRecordOffset write SetDataRecordOffset;
       property TargetDeterminedByThread: Boolean read FTargetDeterminedByThread write FTargetDeterminedByThread;
       property TargetDeterminedByThread: Boolean read FTargetDeterminedByThread write FTargetDeterminedByThread;
@@ -1321,6 +1323,29 @@ implementation
       Result:=FLocationOffset-FDataRecordStartOffset;
       Result:=FLocationOffset-FDataRecordStartOffset;
     end;
     end;
 
 
+  function TOmfSubRecord_FIXUP.GetLocationSize: Integer;
+    const
+      OmfLocationType2Size: array [TOmfFixupLocationType] of Integer=
+        (1,  // fltLoByte
+         2,  // fltOffset
+         2,  // fltBase
+         4,  // fltFarPointer
+         1,  // fltHiByte
+         2,  // fltLoaderResolvedOffset  (PharLap: Offset32)
+         0,  // fltUndefined6            (PharLap: Pointer48)
+         0,  // fltUndefined7
+         0,  // fltUndefined8
+         4,  // fltOffset32
+         0,  // fltUndefined10
+         6,  // fltFarPointer48
+         0,  // fltUndefined12
+         4,  // fltLoaderResolvedOffset32
+         0,  // fltUndefined14
+         0); // fltUndefined15
+    begin
+      Result:=OmfLocationType2Size[LocationType];
+    end;
+
   procedure TOmfSubRecord_FIXUP.SetDataRecordOffset(AValue: Integer);
   procedure TOmfSubRecord_FIXUP.SetDataRecordOffset(AValue: Integer);
     begin
     begin
       FLocationOffset:=AValue+FDataRecordStartOffset;
       FLocationOffset:=AValue+FDataRecordStartOffset;