Bladeren bron

* status.currentmodule is now also updated
+ status.currentsourcepath

peter 26 jaren geleden
bovenliggende
commit
abb72c5d48
3 gewijzigde bestanden met toevoegingen van 42 en 11 verwijderingen
  1. 7 2
      compiler/comphook.pas
  2. 26 7
      compiler/files.pas
  3. 9 2
      compiler/verbose.pas

+ 7 - 2
compiler/comphook.pas

@@ -49,6 +49,7 @@ type
   TCompilerStatus = record
   { Current status }
     currentmodule,
+    currentsourcepath,
     currentsource : string;   { filename }
     currentline,
     currentcolumn : longint;  { current line and column }
@@ -219,7 +220,7 @@ begin
              hs:=gccfilename(status.currentsource)+':'+tostr(status.currentline)+': '+hs
                  +tostr(status.currentcolumn)+': '
            else
-             hs:=status.currentsource+'('+tostr(status.currentline)
+             hs:=status.currentsourcepath+'/'+status.currentsource+'('+tostr(status.currentline)
                  +','+tostr(status.currentcolumn)+') '+hs;
          end
         else
@@ -260,7 +261,11 @@ end;
 end.
 {
   $Log$
-  Revision 1.13  1998-12-11 00:03:12  peter
+  Revision 1.14  1999-01-14 21:47:09  peter
+    * status.currentmodule is now also updated
+    + status.currentsourcepath
+
+  Revision 1.13  1998/12/11 00:03:12  peter
     + globtype,tokens,version unit splitted from globals
 
 }

+ 26 - 7
compiler/files.pas

@@ -96,6 +96,8 @@ unit files;
        tfilemanager = object
           files : pinputfile;
           last_ref_index : longint;
+          cacheindex : longint;
+          cacheinputfile : pinputfile;
           constructor init;
           destructor done;
           procedure register_file(f : pinputfile);
@@ -501,6 +503,8 @@ uses
       begin
          files:=nil;
          last_ref_index:=0;
+         cacheindex:=0;
+         cacheinputfile:=nil;
       end;
 
 
@@ -525,10 +529,13 @@ uses
          f^.ref_next:=files;
          f^.ref_index:=last_ref_index;
          files:=f;
+         { update cache }
+         cacheindex:=last_ref_index;
+         cacheinputfile:=f;
 {$ifdef FPC}
-{$ifdef heaptrc}
+  {$ifdef heaptrc}
          writeln(stderr,f^.name^,' index ',current_module^.unit_index*100000+f^.ref_index);
-{$endif heaptrc}
+  {$endif heaptrc}
 {$endif FPC}
       end;
 
@@ -545,7 +552,9 @@ uses
              f^.ref_index:=last_ref_index-f^.ref_index+1;
              f:=f^.ref_next;
           end;
-
+        { reset cache }
+        cacheindex:=0;
+        cacheinputfile:=nil;
      end;
 
 
@@ -554,10 +563,16 @@ uses
      var
         ff : pinputfile;
      begin
-        ff:=files;
-        while assigned(ff) and (ff^.ref_index<>l) do
+       { check cache }
+       if (l=cacheindex) and assigned(cacheinputfile) then
+        begin
+          get_file:=cacheinputfile;
+          exit;
+        end;
+       ff:=files;
+       while assigned(ff) and (ff^.ref_index<>l) do
          ff:=ff^.ref_next;
-        get_file:=ff;
+       get_file:=ff;
      end;
 
 
@@ -1077,7 +1092,11 @@ uses
 end.
 {
   $Log$
-  Revision 1.84  1999-01-14 11:38:39  daniel
+  Revision 1.85  1999-01-14 21:47:11  peter
+    * status.currentmodule is now also updated
+    + status.currentsourcepath
+
+  Revision 1.84  1999/01/14 11:38:39  daniel
   * Exe name derived from target_info instead of target_os
 
   Revision 1.83  1999/01/13 15:02:00  daniel

+ 9 - 2
compiler/verbose.pas

@@ -253,13 +253,16 @@ begin
      ((current_module^.unit_index<>lastmoduleidx) or
       (aktfilepos.fileindex<>lastfileidx)) then
    begin
+     { update status record }
+     status.currentmodule:=current_module^.modulename^;
      status.currentsource:=current_module^.sourcefiles^.get_file_name(aktfilepos.fileindex);
-     lastmoduleidx:=current_module^.unit_index;
+     status.currentsourcepath:=current_module^.sourcefiles^.get_file_path(aktfilepos.fileindex);
      { update lastfileidx only if name known PM }
      if status.currentsource<>'' then
        lastfileidx:=aktfilepos.fileindex
      else
        lastfileidx:=0;
+     lastmoduleidx:=current_module^.unit_index;
    end;
 end;
 
@@ -429,7 +432,11 @@ end.
 
 {
   $Log$
-  Revision 1.32  1998-12-15 10:23:33  peter
+  Revision 1.33  1999-01-14 21:47:10  peter
+    * status.currentmodule is now also updated
+    + status.currentsourcepath
+
+  Revision 1.32  1998/12/15 10:23:33  peter
     + -iSO, -iSP, -iTO, -iTP
 
   Revision 1.31  1998/12/11 00:04:04  peter