فهرست منبع

* store original source time in ppu so it can be compared instead of
comparing with the ppu time

peter 23 سال پیش
والد
کامیت
21933875b5
3فایلهای تغییر یافته به همراه75 افزوده شده و 44 حذف شده
  1. 25 37
      compiler/finput.pas
  2. 11 5
      compiler/fppu.pas
  3. 39 2
      compiler/utils/ppudump.pp

+ 25 - 37
compiler/finput.pas

@@ -72,12 +72,15 @@ interface
          procedure setmacro(p:pchar;len:longint);
          procedure setline(line,linepos:longint);
          function  getlinestr(l:longint):string;
+         function  getfiletime:longint;
        protected
-         function fileopen(const filename: string): boolean; virtual;
-         function fileseek(pos: longint): boolean; virtual;
-         function fileread(var databuf; maxsize: longint): longint; virtual;
-         function fileeof: boolean; virtual;
-         function fileclose: boolean; virtual;
+         filetime  : longint;
+         function fileopen(const filename: string): boolean; virtual; abstract;
+         function fileseek(pos: longint): boolean; virtual; abstract;
+         function fileread(var databuf; maxsize: longint): longint; virtual; abstract;
+         function fileeof: boolean; virtual; abstract;
+         function fileclose: boolean; virtual; abstract;
+         procedure filegettime; virtual; abstract;
        end;
 
        tdosinputfile = class(tinputfile)
@@ -87,6 +90,7 @@ interface
          function fileread(var databuf; maxsize: longint): longint; override;
          function fileeof: boolean; override;
          function fileclose: boolean; override;
+         procedure filegettime; override;
        private
          f            : file;       { current file handle }
        end;
@@ -164,6 +168,7 @@ uses
         name:=stringdup(n+e);
         path:=stringdup(p);
         next:=nil;
+        filetime:=-1;
       { file info }
         is_macro:=false;
         endoffile:=false;
@@ -401,38 +406,11 @@ uses
       end;
 
 
-    function tinputfile.fileopen(const filename: string): boolean;
+    function tinputfile.getfiletime:longint;
       begin
-        abstract;
-        fileopen:=false;
-      end;
-
-
-    function tinputfile.fileseek(pos: longint): boolean;
-      begin
-        abstract;
-        fileseek:=false;
-      end;
-
-
-    function tinputfile.fileread(var databuf; maxsize: longint): longint;
-      begin
-        abstract;
-        fileread:=0;
-      end;
-
-
-    function tinputfile.fileeof: boolean;
-      begin
-        abstract;
-        fileeof:=false;
-      end;
-
-
-    function tinputfile.fileclose: boolean;
-      begin
-        abstract;
-        fileclose:=false;
+        if filetime=-1 then
+         filegettime;
+        getfiletime:=filetime;
       end;
 
 
@@ -488,6 +466,12 @@ uses
       end;
 
 
+    procedure tdosinputfile.filegettime;
+      begin
+        filetime:=getnamedfiletime(path^+name^);
+      end;
+
+
 {****************************************************************************
                                 Tinputfilemanager
  ****************************************************************************}
@@ -702,7 +686,11 @@ uses
 end.
 {
   $Log$
-  Revision 1.18  2002-08-11 13:24:11  peter
+  Revision 1.19  2002-10-20 14:49:31  peter
+    * store original source time in ppu so it can be compared instead of
+      comparing with the ppu time
+
+  Revision 1.18  2002/08/11 13:24:11  peter
     * saving of asmsymbols in ppu supported
     * asmsymbollist global is removed and moved into a new class
       tasmlibrarydata that will hold the info of a .a file which

+ 11 - 5
compiler/fppu.pas

@@ -401,6 +401,7 @@ uses
             for i:=1 to j-1 do
               hp:=hp.ref_next;
             ppufile.putstring(hp.name^);
+            ppufile.putlongint(hp.getfiletime);
             dec(j);
          end;
         ppufile.writeentry(ibsourcefiles);
@@ -550,17 +551,17 @@ uses
         incfile_found,
         main_found,
         is_main       : boolean;
-        ppufiletime,
+        orgfiletime,
         source_time   : longint;
         hp            : tinputfile;
       begin
-        ppufiletime:=getnamedfiletime(ppufilename^);
         sources_avail:=true;
         is_main:=true;
         main_dir:='';
         while not ppufile.endofentry do
          begin
            hs:=ppufile.getstring;
+           orgfiletime:=ppufile.getlongint;
            temp_dir:='';
            if (flags and uf_in_library)<>0 then
             begin
@@ -618,9 +619,10 @@ uses
                  else
                   begin
                     temp:=' time '+filetimestring(source_time);
-                    if (source_time>ppufiletime) then
+                    if (orgfiletime<>-1) and
+                       (source_time<>orgfiletime) then
                      begin
-                       if {is_main or} ((flags and uf_release)=0) then
+                       if ((flags and uf_release)=0) then
                         begin
                           do_compile:=true;
                           recompile_reason:=rr_sourcenewer;
@@ -1317,7 +1319,11 @@ uses
 end.
 {
   $Log$
-  Revision 1.24  2002-10-04 20:13:10  peter
+  Revision 1.25  2002-10-20 14:49:31  peter
+    * store original source time in ppu so it can be compared instead of
+      comparing with the ppu time
+
+  Revision 1.24  2002/10/04 20:13:10  peter
     * set in_second_load flag before resetting the module, this is
       required to skip some checkings
 

+ 39 - 2
compiler/utils/ppudump.pp

@@ -24,6 +24,7 @@
 {$endif}
 program pppdump;
 uses
+  dos,
   ppu;
 
 const
@@ -233,6 +234,38 @@ begin
 end;
 
 
+    Function L0(l:longint):string;
+    {
+      return the string of value l, if l<10 then insert a zero, so
+      the string is always at least 2 chars '01','02',etc
+    }
+      var
+        s : string;
+      begin
+        Str(l,s);
+        if l<10 then
+         s:='0'+s;
+        L0:=s;
+      end;
+
+
+   function  filetimestring( t : longint) : string;
+   {
+     convert dos datetime t to a string YY/MM/DD HH:MM:SS
+   }
+     var
+       DT : DateTime;
+     begin
+       if t=-1 then
+        begin
+          FileTimeString:='Not Found';
+          exit;
+        end;
+       unpacktime(t,DT);
+       filetimestring:=L0(dt.Year)+'/'+L0(dt.Month)+'/'+L0(dt.Day)+' '+L0(dt.Hour)+':'+L0(dt.min)+':'+L0(dt.sec);
+     end;
+
+
 {****************************************************************************
                              Read Routines
 ****************************************************************************}
@@ -1472,7 +1505,7 @@ begin
              sourcenumber:=1;
              while not EndOfEntry do
               begin
-                Writeln('Source file ',sourcenumber,' : ',getstring);
+                Writeln('Source file ',sourcenumber,' : ',getstring,' ',filetimestring(getlongint));
                 inc(sourcenumber);
               end;
            end;
@@ -1865,7 +1898,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.32  2002-10-06 12:25:53  florian
+  Revision 1.33  2002-10-20 14:49:31  peter
+    * store original source time in ppu so it can be compared instead of
+      comparing with the ppu time
+
+  Revision 1.32  2002/10/06 12:25:53  florian
     + dump of tdefoptions.df_unique
 
   Revision 1.31  2002/09/27 21:22:04  carl