Browse Source

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

git-svn-id: trunk@31315 -
nickysn 10 years ago
parent
commit
c3133c498a
3 changed files with 21 additions and 0 deletions
  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;
     procedure ReadArchive;
   protected
   protected
     function getfilename:string;override;
     function getfilename:string;override;
+    function GetPos: longint;override;
   public
   public
     constructor create(const Aarfn:string;allow_nonar:boolean=false);
     constructor create(const Aarfn:string;allow_nonar:boolean=false);
     destructor  destroy;override;
     destructor  destroy;override;
@@ -357,6 +358,12 @@ implementation
       end;
       end;
 
 
 
 
+    function tarobjectreader.GetPos: longint;
+      begin
+        result:=inherited GetPos-CurrMemberPos;
+      end;
+
+
     function tarobjectreader.DecodeMemberName(ahdr:TArHdr):string;
     function tarobjectreader.DecodeMemberName(ahdr:TArHdr):string;
       var
       var
         hs : string;
         hs : string;

+ 7 - 0
compiler/owbase.pas

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

+ 7 - 0
compiler/owomflib.pas

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