Browse Source

+ add method to TMessage to check whether a message is valid

Sven/Sarah Barth 7 months ago
parent
commit
9a2d0e0692
1 changed files with 6 additions and 0 deletions
  1. 6 0
      compiler/cmsgs.pas

+ 6 - 0
compiler/cmsgs.pas

@@ -66,6 +66,7 @@ type
     { function  ClearVerbosity(nr:longint):boolean; not used anymore }
     function  SetVerbosity(nr:longint;newstate:tmsgstate):boolean;
     function  Get(nr:longint;const args:array of TMsgStr):TMsgStr;
+    function  Valid(nr:longint):boolean;
   end;
 
 { this will read a line until #10 or #0 and also increase p }
@@ -459,6 +460,11 @@ begin
     end;
 end;
 
+function TMessage.Valid(nr:longint):boolean;
+begin
+  result:=(nr div 1000<msgparts) and (nr mod 1000<msgidxmax[nr div 1000]) and assigned(msgidx[nr div 1000]^[nr mod 1000]);
+end;
+
 procedure TMessage.ResetStates;
 var
   i,j,glob : longint;