141141{ ---------------------------------------------------------------------------- }
142142// Global processing variables
143143var
144+ Issues : String; // Filename to write file list of problem files.
144145 BaseDir : String; // LST file source base directory
145146 OutName : String; // LST Output FileName
146147 TitleWidth : integer; // Maximum LST file title width (+1)
169170
170171
171172{ ---------------------------------------------------------------------------- }
173+ const
174+ IssueOpen : boolean = false;
175+ var
176+ LastFileName: String;
177+ IssueF : Text;
178+
179+ procedure WriteIssue ;
180+ begin
181+ if Issues= ' ' then Exit;
182+ if not IssueOpen then begin
183+ System.Assign(IssueF, Issues);
184+ System.Rewrite(IssueF);
185+ IssueOpen:=True;
186+ end ;
187+ WriteLn(IssueF, LastFileName);
188+ end ;
172189
173190// Returns the DOS file name from the Long file name or Group Title
174191function DosFileName (FileName : String) : String;
@@ -390,6 +407,7 @@ function ReadFile(FileName : String; out Data : RawByteString) : boolean;
390407 A : TArrayOfString;
391408 I : Integer;
392409begin
410+ LastFileName:=' ' ;
393411 if not FileExists(FileName) then begin
394412 Data:=' ' ;
395413 Exit(False);
@@ -404,6 +422,7 @@ function ReadFile(FileName : String; out Data : RawByteString) : boolean;
404422 A[I]:=TrimRight(A[I]);
405423 Data:=TrimCRLF(Implode(A, CRLF) + CRLF);
406424 Result:=True;
425+ LastFileName:=FileName;
407426end ;
408427
409428// Saves a LST file to the output directory
@@ -520,6 +539,7 @@ procedure AddToTree(const Name, ID : String; const Data : RawByteString);
520539 N:= SectionTree.Add(ID, Data);
521540 if not Assigned(N) then begin
522541 LogMessage(vbVerbose, TAB + ' Duplicate UniqueID (' + ID + ' ) for file: ' + Name );
542+ WriteIssue;;
523543 Inc(TotalWarnings);
524544 XX:=0 ;
525545 repeat
@@ -536,12 +556,14 @@ procedure AddGlossary(const Name : String; var Data : RawByteString);
536556 ID:=Trim(PopDelim(Data, CRLF));
537557 if ID=' ' then begin
538558 LogMessage(vbMinimal, TAB + ' No Term specified for file: ' + Name );
559+ WriteIssue;;
539560 Inc(TotalErrors);
540561 Exit;
541562 end ;
542563 Data:=TrimCRLF(Data);
543564 if Length(Data) = 0 then begin
544565 LogMessage(vbMinimal, TAB + ' No definition, excluded file: ' + Name );
566+ WriteIssue;;
545567 Inc(TotalErrors);
546568 Exit;
547569 end ;
@@ -565,12 +587,14 @@ procedure AddLink(const Name : String; var Data : RawByteString);
565587 ID:=UpperCase(StringReplace(Trim(Copy(Title, 1 , MaxLinkID)), SPACE, ' -' , [rfReplaceAll]));
566588 if ID=' ' then begin
567589 LogMessage(vbMinimal, TAB + ' No Term specified for file: ' + Name );
590+ WriteIssue;;
568591 Inc(TotalErrors);
569592 Exit;
570593 end ;
571594 Data:=TrimCRLF(Data);
572595 if Length(Data) = 0 then begin
573596 LogMessage(vbMinimal, TAB + ' No definition, excluded file: ' + Name );
597+ WriteIssue;;
574598 Inc(TotalErrors);
575599 Exit;
576600 end ;
@@ -586,12 +610,14 @@ procedure AddSMM(const Name : String; var Data : RawByteString);
586610 ID:=ExcludeLeading(ID, ' SMM-' );
587611 if ID=' ' then begin
588612 LogMessage(vbMinimal, TAB + ' No ID specified for file: ' + Name );
613+ WriteIssue;;
589614 Inc(TotalErrors);
590615 Exit;
591616 end ;
592617 Data:=TrimCRLF(Data);
593618 if Length(Data) = 0 then begin
594619 LogMessage(vbMinimal, TAB + ' No data, excluded file: ' + Name );
620+ WriteIssue;;
595621 Inc(TotalErrors);
596622 Exit;
597623 end ;
@@ -681,6 +707,7 @@ procedure HighestTable(const Name : String; const Data : RawByteString);
681707 if (TableCode <> ' ' ) then begin
682708 if (not HasLeading(S, TableCode)) then begin
683709 LogMessage(vbMinimal, TAB + ' Invalid Table Prefix in file: ' + Name );
710+ WriteIssue;;
684711 Inc(TotalErrors);
685712 Continue;
686713 end ;
@@ -689,17 +716,20 @@ procedure HighestTable(const Name : String; const Data : RawByteString);
689716 Val(S, V, E);
690717 if E <> 0 then begin
691718 LogMessage(vbMinimal, TAB + ' Invalid Table Number in file: ' + Name );
719+ WriteIssue;;
692720 Inc(TotalErrors);
693721 Continue;
694722 end ;
695723 if V > TableHigh then TableHigh:=V;
696724 N:=TableTree.Add(T);
697725 if not Assigned(N) then begin
698726 LogMessage(vbMinimal, TAB + ' Duplicated Table ID (' + T + ' ) in file: ' + Name );
727+ WriteIssue;;
699728 Inc(TotalErrors);
700729 end ;
701730 end ;
702731 LogMessage(vbMinimal, TAB+ ' Broken Table declaration in file: ' + Name );
732+ WriteIssue;;
703733 Inc(TotalErrors);
704734end ;
705735
@@ -710,11 +740,13 @@ procedure AddStandard(const Name : String; var Data : RawByteString);
710740 FileToSection(Name , Data, ID, Category, Flags);
711741 if ID=' ' then begin
712742 LogMessage(vbMinimal, TAB + ' No ID found for file: ' + Name );
743+ WriteIssue;;
713744 Inc(TotalErrors);
714745 Exit;
715746 end ;
716747 if Pos(HeaderBar, Data) > 0 then begin
717748 LogMessage(vbNormal, TAB+ ' Probably joined entry data in file: ' + Name );
749+ WriteIssue;;
718750 Inc(TotalProblems);
719751 end ;
720752 { TODO 5 -cDevel Add UID validation }
@@ -723,6 +755,7 @@ procedure AddStandard(const Name : String; var Data : RawByteString);
723755 HighestTable(Name , Data);
724756 if Length(Data) = 0 then begin
725757 LogMessage(vbMinimal, TAB + ' No data, excluded file: ' + Name );
758+ WriteIssue;;
726759 Inc(TotalErrors);
727760 Exit;
728761 end ;
@@ -986,7 +1019,8 @@ procedure Help;
9861019 (S:' ' ; L:' --modern' ; V:' ' ; M:' Disable legacy mode for modern parsers (default).' ),
9871020 (S:' ' ; L:' --legacy' ; V:' ' ; M:' Enable compatibility mode for legacy parsers.' ),
9881021 (S:' ' ; L:' ' ; V:' ' ; M:' ' ),
989- (S:' ' ; L:' --cicd' ; V:' ' ; M:' More strict verification for usage with CI/CD.' )
1022+ (S:' ' ; L:' --cicd' ; V:' ' ; M:' More strict verification for usage with CI/CD.' ),
1023+ (S:' ' ; L:' --issues' ; V:' (file)' ; M:' Write a list of the files with issues to a file.' )
9901024 );
9911025
9921026var
@@ -1078,6 +1112,7 @@ procedure Options;
10781112 ' --cicd' : CICD:=True;
10791113 ' --modern' : LegacyMode:=False;
10801114 ' --legacy' : LegacyMode:=True;
1115+ ' --issues' : Issues:=Trim(NextOpt);
10811116 ' -s' , ' --source' : DirSource:=IncludeTrailingPathDelimiter(Trim(NextOpt));
10821117 ' -o' , ' --output' : DirOutput:=IncludeTrailingPathDelimiter(Trim(NextOpt));
10831118 ' -m' , ' --maximum' : begin
@@ -1260,7 +1295,10 @@ procedure ReadFileMap;
12601295// We do not really need to include the Lazarus Resourse in the executable
12611296{ R *.res}
12621297
1298+ { R *.res}
1299+
12631300begin
1301+ Issues:=' ' ;
12641302 TotalTables:=0 ;
12651303 TotalEntries:=0 ;
12661304 TotalErrors:=0 ;
@@ -1271,15 +1309,19 @@ procedure ReadFileMap;
12711309 ReadFileMap;
12721310 Banner;
12731311 Build;
1312+ if IssueOpen then begin
1313+ System.Close(IssueF);
1314+ IssueOpen:=False;
1315+ end ;
12741316 LogMessage(vbNormal, ' ' );
12751317 LogMessage(vbNormal, ' Total Number of Entries: ' + IntToStr(TotalEntries));
12761318 LogMessage(vbNormal, ' Total Number of Tables: ' + IntToStr(TotalTables));
12771319 if TotalWarnings > 0 then
1278- LogMessage(vbMinimal, ' Total Number of Warnings: ' + IntToStr(TotalWarnings));
1320+ LogMessage(vbMinimal, ' Total Number of Warnings: ' + IntToStr(TotalWarnings));
12791321 if TotalProblems > 0 then
1280- LogMessage(vbMinimal, ' Total Number of Problems: ' + IntToStr(TotalProblems));
1322+ LogMessage(vbMinimal, ' Total Number of Problems: ' + IntToStr(TotalProblems));
12811323 if TotalErrors > 0 then
1282- LogMessage(vbMinimal, ' Total Number of Errors: ' + IntToStr(TotalErrors));
1324+ LogMessage(vbMinimal, ' Total Number of Errors: ' + IntToStr(TotalErrors));
12831325 if CICD then begin
12841326 if (TotalProblems > 0 ) or (TotalErrors > 0 )then begin
12851327 LogMessage(vbCritical, ' Done, CI/CD verification error.' );
0 commit comments