瀏覽代碼

+ added property tobjectreader.pos, which returns the current position when reading an object file

git-svn-id: trunk@31315 -
nickysn 10 年之前
父節點
當前提交
c3133c498a
共有 3 個文件被更改,包括 21 次插入0 次删除
  1. 7 0
      compiler/owar.pas
  2. 7 0
      compiler/owbase.pas
  3. 7 0
      compiler/owomflib.pas

+ 7 - 0
compiler/owar.pas

@@ -75,6 +75,7 @@ type
     procedure ReadArchive;
   protected
     function getfilename:string;override;
+    function GetPos: longint;override;
   public
     constructor create(const Aarfn:string;allow_nonar:boolean=false);
     destructor  destroy;override;
@@ -357,6 +358,12 @@ implementation
       end;
 
 
+    function tarobjectreader.GetPos: longint;
+      begin
+        result:=inherited GetPos-CurrMemberPos;
+      end;
+
+
     function tarobjectreader.DecodeMemberName(ahdr:TArHdr):string;
       var
         hs : string;

+ 7 - 0
compiler/owbase.pas

@@ -66,6 +66,7 @@ type
     function readbuf:boolean;
   protected
     function getfilename : string;virtual;
+    function GetPos: longint;virtual;
   public
     constructor create;
     destructor  destroy;override;
@@ -76,6 +77,7 @@ type
     function  readarray(a:TDynamicArray;len:longint):boolean;
     property filename : string read getfilename;
     property size:longint read bufmax;
+    property Pos:longint read GetPos;
   end;
 
 implementation
@@ -310,4 +312,9 @@ function tobjectreader.getfilename : string;
     result:=ffilename;
   end;
 
+function tobjectreader.GetPos: longint;
+  begin
+    Result:=bufidx;
+  end;
+
 end.

+ 7 - 0
compiler/owomflib.pas

@@ -81,6 +81,8 @@ type
     FPageSize: Integer;
     procedure ReadLibrary;
     procedure ReadDictionary(DictionaryOffset: DWord; DictionarySizeInBlocks: Word);
+  protected
+    function GetPos: longint;override;
   public
     constructor create(const Aarfn:string;allow_nonar:boolean=false);
     destructor  destroy;override;
@@ -399,6 +401,11 @@ implementation
         end;
     end;
 
+  function TOmfLibObjectReader.GetPos: longint;
+    begin
+      result:=inherited GetPos-CurrMemberPos;
+    end;
+
   constructor TOmfLibObjectReader.create(const Aarfn: string; allow_nonar: boolean);
     var
       RecType: Byte;