Przeglądaj źródła

* small diffs from Sergey applied

peter 24 lat temu
rodzic
commit
66aa8ba662
3 zmienionych plików z 132 dodań i 18 usunięć
  1. 117 4
      compiler/utils/fixlog.pp
  2. 5 10
      compiler/utils/fixmsg.pp
  3. 10 4
      compiler/utils/msgdif.pp

+ 117 - 4
compiler/utils/fixlog.pp

@@ -44,7 +44,7 @@ procedure dofile(const fn:string);
 var
   t,f : text;
   s : string;
-  skip : boolean;
+  skip, truncated : boolean;
   year,month,day,
   found,revs,i : integer;
   fbuf,tbuf : pointer;
@@ -68,14 +68,127 @@ begin
   found:=0;
   revs:=0;
   skip:=false;
+  truncated:=false;
   while not eof(t) do
    begin
      readln(t,s);
      case found of
       0 :
         begin
+          if pos('$Log: ',s)>0 then
+           found:=1;
+          skip:=false;
+          writeln(f,s);
+        end;
+      1 :
+        begin
+          i:=pos('Revision',s);
+          if i>0 then
+           begin
+             inc(revs);
+             if revs>maxrevs then
+              begin
+                skip:=true;
+                truncated:=true;
+                found:=2;
+              end
+             else
+              begin
+                inc(i,10);
+                while (i<length(s)) and (s[i]<>' ') do
+                 inc(i);
+                while (i<length(s)) and (s[i]=' ') do
+                 inc(i);
+                if (i<length(s)) and (s[i] in ['0'..'9']) then
+                 begin
+                   Date2Int(Copy(s,i,10),year,month,day);
+                   if (year<Myear) or
+                      ((year=MYear) and (month<Mmonth)) or
+                      ((year=MYear) and (month=Mmonth) and (day<Mday)) then
+                    begin
+                      skip:=true;
+                      truncated:=true;
+                      found:=2;
+//                    write(year,'/',month,'/',day,' date');
+                    end;
+                 end;
+              end;
+           end
+          else
+           if pos('}',s)>0 then
+            begin
+              skip:=false;
+              found:=0;
+            end;
+          if not skip then
+           writeln(f,s);
+        end;
+      2 :
+        begin
+          if pos('}',s)>0 then
+           begin
+             skip:=false;
+             found:=0;
+           end;
+          if not skip then
+           writeln(f,s);
+        end;
+     end;
+   end;
+  close(t);
+  close(f);
+  if revs=0 then
+   writeln(' no log found')
+  else
+   if truncated then
+     writeln(revs-1,' revisions')
+  else
+     writeln(revs,' revisions');
+  erase(t);
+  rename(f,fn);
+  freemem(tbuf);
+  freemem(fbuf);
+end;
+
+var
+  dir : tsearchrec;
+  i   : integer;
+begin
+  writeln('fixlog v1.00 (C) 1999-2000 Peter Vreman');
+  if paramcount<3 then
+   begin
+     writeln('usage: fixlog <revisions> <yyyy-mm-dd> <files> [files]');
+     halt(1);
+   end;
+  MaxRevs:=StrToInt(ParamStr(1));
+  Date2Int(ParamStr(2),MYear,MMonth,MDay);
+  for i:=3 to paramcount do
+   begin
+     if findfirst(paramstr(i),faAnyFile,dir)=0 then
+      repeat
+        dofile(dir.name);
+      until findnext(dir)<>0;
+     findclose(dir);
+   end;
+end.
+{
   $Log$
-  Revision 1.2  2000-07-13 11:32:55  michael
-  + removed logs
- 
+  Revision 1.3  2001-03-05 21:44:16  peter
+    * small diffs from Sergey applied
+
+  Revision 1.1  2000/07/13 06:30:14  michael
+  + Initial import
+
+  Revision 1.4  2000/02/09 13:08:27  peter
+    * usage shows yyyy-mm-dd
+
+  Revision 1.3  2000/01/08 13:52:02  peter
+    * max date added
+
+  Revision 1.2  2000/01/07 01:15:00  peter
+    * updated copyright to 2000
+
+  Revision 1.1  1999/10/06 06:29:03  peter
+    * new tool
+
 }

+ 5 - 10
compiler/utils/fixmsg.pp

@@ -26,19 +26,13 @@ var
 begin
   assign(t,paramstr(1));
   reset(t);
-  assign(f,'errorm.msg');
+  assign(f,'New.msg');
   rewrite(f);
   while not eof(t) do
    begin
      readln(t,s);
      if (s<>'') and not(s[1] in ['#','%']) then
       begin
-        if copy(s,1,11)='option_info' then
-         delete(s,1,13)
-        else
-        if copy(s,1,2)='ol' then
-         delete(s,1,6)
-        else
         for i:=0 to 10 do
          if Copy(s,1,length(trtab[i].name))=trtab[i].name then
           begin
@@ -69,12 +63,13 @@ begin
    end;
   close(f);
   close(t);
-  erase(t);
-  rename(f,paramstr(1));
 end.
 
   $Log$
-  Revision 1.2  2000-07-13 11:32:55  michael
+  Revision 1.3  2001-03-05 21:44:16  peter
+    * small diffs from Sergey applied
+
+  Revision 1.2  2000/07/13 11:32:55  michael
   + removed logs
  
 }

+ 10 - 4
compiler/utils/msgdif.pp

@@ -311,6 +311,7 @@ end;
 procedure WriteReorderedFile(FileName : string;orgnext,diffnext : PMsg);
   var t,t2,t3 : text;
       i,ntcount : longint;
+      j : integer;
       s,s2,s3 : string;
       is_msg : boolean;
       nextdiffkept : pmsg;
@@ -365,11 +366,13 @@ procedure WriteReorderedFile(FileName : string;orgnext,diffnext : PMsg);
                    inc(ntcount);
                end;
              s2:=orgnext^.text;
-             s2:=upcase(copy(s2,1,pos('_',s2)));
+             j:=pos('_',copy(s2,7,20)) + 6;
+             s2:=upcase(copy(s2,1,j));
              s3:=orgnext^.equivalent^.text;
-             s3:=upcase(copy(s3,1,pos('_',s3)));
+             j:=pos('_',copy(s3,7,20)) + 6;
+             s3:=upcase(copy(s3,1,j));
              { that are the conditions in verbose unit }
-             if (length(s3)<5) and (s2<>s3) then
+             if (length(s3)<12) and (s2<>s3) then
                begin
                  Writeln('Warning: different options for ',orgnext^.enum);
                  Writeln('in ',orgFileName,' : ',s2);
@@ -434,7 +437,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.3  2001-02-09 23:04:56  peter
+  Revision 1.4  2001-03-05 21:44:16  peter
+    * small diffs from Sergey applied
+
+  Revision 1.3  2001/02/09 23:04:56  peter
     * updated for new message file by Sergey Korshunoff
 
   Revision 1.2  2000/07/13 11:32:55  michael