mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-06 13:50:20 +02:00
* message files are check for amount of msgs found. If not correct a
line is written to stdout and switched to internal messages
This commit is contained in:
parent
2af3a9059e
commit
3df7f51b0a
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user