mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-21 04:39:37 +01: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;
|
bufsize=8192;
|
||||||
var
|
var
|
||||||
f : text;
|
f : text;
|
||||||
|
msgsread,
|
||||||
line,i : longint;
|
line,i : longint;
|
||||||
ptxt : pchar;
|
ptxt : pchar;
|
||||||
s,s1 : string;
|
s,s1 : string;
|
||||||
@ -106,13 +107,14 @@ begin
|
|||||||
if ioresult<>0 then
|
if ioresult<>0 then
|
||||||
begin
|
begin
|
||||||
WriteLn('*** message file '+fn+' not found ***');
|
WriteLn('*** message file '+fn+' not found ***');
|
||||||
exit;
|
fail;
|
||||||
end;
|
end;
|
||||||
settextbuf(f,buf^,bufsize);
|
settextbuf(f,buf^,bufsize);
|
||||||
{ First parse the file and count bytes needed }
|
{ First parse the file and count bytes needed }
|
||||||
line:=0;
|
line:=0;
|
||||||
msgs:=n;
|
msgs:=n;
|
||||||
msgsize:=0;
|
msgsize:=0;
|
||||||
|
msgsread:=0;
|
||||||
while not eof(f) do
|
while not eof(f) do
|
||||||
begin
|
begin
|
||||||
readln(f,s);
|
readln(f,s);
|
||||||
@ -121,11 +123,22 @@ begin
|
|||||||
begin
|
begin
|
||||||
i:=pos('=',s);
|
i:=pos('=',s);
|
||||||
if i>0 then
|
if i>0 then
|
||||||
inc(msgsize,length(s)-i+1)
|
begin
|
||||||
|
inc(msgsize,length(s)-i+1);
|
||||||
|
inc(msgsread);
|
||||||
|
end
|
||||||
else
|
else
|
||||||
writeln('error in line: ',line,' skipping');
|
writeln('error in line: ',line,' skipping');
|
||||||
end;
|
end;
|
||||||
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 }
|
{ now read the buffer in mem }
|
||||||
msgallocsize:=msgsize;
|
msgallocsize:=msgsize;
|
||||||
getmem(msgtxt,msgallocsize);
|
getmem(msgtxt,msgallocsize);
|
||||||
@ -274,7 +287,11 @@ end;
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$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
|
* log truncated
|
||||||
|
|
||||||
Revision 1.10 2000/01/23 16:32:08 peter
|
Revision 1.10 2000/01/23 16:32:08 peter
|
||||||
|
|||||||
@ -243,6 +243,8 @@ begin
|
|||||||
if not(msg=nil) then
|
if not(msg=nil) then
|
||||||
dispose(msg,Done);
|
dispose(msg,Done);
|
||||||
msg:=new(pmessage,InitExtern(fn,ord(endmsgconst)));
|
msg:=new(pmessage,InitExtern(fn,ord(endmsgconst)));
|
||||||
|
if msg=nil then
|
||||||
|
msg:=new(pmessage,Init(@msgtxt,ord(endmsgconst)));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -506,7 +508,11 @@ end.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$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
|
* lowercase .INC -> .inc
|
||||||
|
|
||||||
Revision 1.46 2000/02/28 17:23:57 daniel
|
Revision 1.46 2000/02/28 17:23:57 daniel
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user