From 3df7f51b0a2400edb26533409e8020cbd85b2670 Mon Sep 17 00:00:00 2001 From: peter Date: Wed, 1 Mar 2000 22:29:18 +0000 Subject: [PATCH] * message files are check for amount of msgs found. If not correct a line is written to stdout and switched to internal messages --- compiler/messages.pas | 23 ++++++++++++++++++++--- compiler/verbose.pas | 8 +++++++- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/compiler/messages.pas b/compiler/messages.pas index 9123d1aa16..bd0107990f 100644 --- a/compiler/messages.pas +++ b/compiler/messages.pas @@ -92,6 +92,7 @@ const bufsize=8192; var f : text; + msgsread, line,i : longint; ptxt : pchar; s,s1 : string; @@ -106,13 +107,14 @@ begin if ioresult<>0 then begin WriteLn('*** message file '+fn+' not found ***'); - exit; + fail; end; settextbuf(f,buf^,bufsize); { First parse the file and count bytes needed } line:=0; msgs:=n; msgsize:=0; + msgsread:=0; while not eof(f) do begin readln(f,s); @@ -121,11 +123,22 @@ begin begin i:=pos('=',s); if i>0 then - inc(msgsize,length(s)-i+1) + begin + inc(msgsize,length(s)-i+1); + inc(msgsread); + end else writeln('error in line: ',line,' skipping'); end; end; +{ check amount of messages } + if msgsread<>msgs then + begin + WriteLn('*** message file '+fn+' is corrupt: read ',msgsread,' of ',msgs,' msgs ***'); + close(f); + freemem(buf,bufsize); + fail; + end; { now read the buffer in mem } msgallocsize:=msgsize; getmem(msgtxt,msgallocsize); @@ -274,7 +287,11 @@ end; end. { $Log$ - Revision 1.11 2000-02-09 13:22:54 peter + Revision 1.12 2000-03-01 22:29:18 peter + * message files are check for amount of msgs found. If not correct a + line is written to stdout and switched to internal messages + + Revision 1.11 2000/02/09 13:22:54 peter * log truncated Revision 1.10 2000/01/23 16:32:08 peter diff --git a/compiler/verbose.pas b/compiler/verbose.pas index cbbad38ec9..db87bd144e 100644 --- a/compiler/verbose.pas +++ b/compiler/verbose.pas @@ -243,6 +243,8 @@ begin if not(msg=nil) then dispose(msg,Done); msg:=new(pmessage,InitExtern(fn,ord(endmsgconst))); + if msg=nil then + msg:=new(pmessage,Init(@msgtxt,ord(endmsgconst))); end; @@ -506,7 +508,11 @@ end. { $Log$ - Revision 1.47 2000-03-01 21:45:42 peter + Revision 1.48 2000-03-01 22:29:18 peter + * message files are check for amount of msgs found. If not correct a + line is written to stdout and switched to internal messages + + Revision 1.47 2000/03/01 21:45:42 peter * lowercase .INC -> .inc Revision 1.46 2000/02/28 17:23:57 daniel