+ support the codepage directive in the msg2inc converter util

* msgtxt.inc updated to include the codepage info

git-svn-id: trunk@36449 -
This commit is contained in:
nickysn 2017-06-08 15:46:30 +00:00
parent c0413a9179
commit e667a18838
2 changed files with 12 additions and 2 deletions

View File

@ -1,3 +1,4 @@
const msgtxt_codepage=20127;
{$ifdef Delphi}
const msgtxt : array[0..000334] of string[240]=(
{$else Delphi}

View File

@ -53,6 +53,7 @@ var
msgidxmax : array[1..msgparts] of longint;
msgs : array[0..msgparts,0..999] of boolean;
msgcodepage: TSystemCodePage;
procedure LoadMsgFile(const fn:string);
var
@ -75,6 +76,7 @@ var
begin
Writeln('Loading messagefile ',fn);
msgcodepage:=CP_ACP;
{Read the message file}
assign(f,fn);
{$push} {$I-}
@ -150,6 +152,12 @@ begin
end
else
err('no = found');
end
else if (Length(s)>11) and (Copy(s,1,11)='# CodePage ') then
begin
val(Copy(s,12,Length(s)-11),msgcodepage,code);
if code<>0 then
err('illegal code page number: '+s);
end;
end;
end;
@ -329,6 +337,7 @@ begin
{Open textfile}
assign(t,fn);
rewrite(t);
writeln(t,'const '+constname+'_codepage=',msgcodepage:5,';');
writeln(t,'{$ifdef Delphi}');
writeln(t,'const '+constname+' : array[0..000000] of string[',maxslen,']=(');
writeln(t,'{$else Delphi}');
@ -405,9 +414,9 @@ begin
s:=l0(msgsize div maxslen); { we start with 0 }
assign(f,fn);
reset(f,1);
seek(f,34+eollen+length(constname));
seek(f,22+34+2*eollen+2*length(constname));
blockwrite(f,s[1],5);
seek(f,90+3*eollen+2*length(constname));
seek(f,22+90+4*eollen+3*length(constname));
blockwrite(f,s[1],5);
close(f);
end;