mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-13 09:59:25 +02:00
compiler: load binary unicode mappings in cpavailable() call instead of separate loadbinarycp() call
git-svn-id: trunk@26379 -
This commit is contained in:
parent
52d1cbc544
commit
93883d1264
@ -1511,7 +1511,7 @@ unit scandir;
|
||||
s:=current_scanner.readcomment;
|
||||
if (upper(s)='UTF8') or (upper(s)='UTF-8') then
|
||||
current_settings.sourcecodepage:=CP_UTF8
|
||||
else if not(cpavailable(s) or loadbinarycp(s)) then
|
||||
else if not cpavailable(s) then
|
||||
Message1(option_code_page_not_available,s)
|
||||
else
|
||||
current_settings.sourcecodepage:=codepagebyname(s);
|
||||
|
@ -56,14 +56,13 @@ unit widestr;
|
||||
procedure unicode2ascii(r : pcompilerwidestring;p : pchar;cp : tstringencoding);
|
||||
function hasnonasciichars(const p: pcompilerwidestring): boolean;
|
||||
function getcharwidestring(r : pcompilerwidestring;l : SizeInt) : tcompilerwidechar;
|
||||
function cpavailable(const s : string) : boolean;
|
||||
function cpavailable(cp : word) : boolean;
|
||||
function cpavailable(const s: string) : boolean;
|
||||
function cpavailable(cp: word) : boolean;
|
||||
procedure changecodepage(
|
||||
s : pchar; l : SizeInt; scp : tstringencoding;
|
||||
d : pchar; dcp : tstringencoding
|
||||
);
|
||||
function codepagebyname(const s : string) : tstringencoding;
|
||||
function loadbinarycp(const s: String): Boolean;
|
||||
|
||||
implementation
|
||||
|
||||
@ -287,14 +286,22 @@ unit widestr;
|
||||
end;
|
||||
|
||||
|
||||
function cpavailable(const s : string) : boolean;
|
||||
function cpavailable(const s: string): boolean;
|
||||
begin
|
||||
cpavailable:=mappingavailable(lower(s));
|
||||
result:=mappingavailable(lower(s));
|
||||
{$if FPC_FULLVERSION>20700}
|
||||
if not result then
|
||||
result:=(unicodepath<>'')and(registerbinarymapping(unicodepath+'charset',lower(s)));
|
||||
{$ifend}
|
||||
end;
|
||||
|
||||
function cpavailable(cp : word) : boolean;
|
||||
function cpavailable(cp: word): boolean;
|
||||
begin
|
||||
cpavailable:=mappingavailable(cp);
|
||||
result:=mappingavailable(cp);
|
||||
{$if FPC_FULLVERSION>20700}
|
||||
if not result then
|
||||
result:=(unicodepath<>'')and(registerbinarymapping(unicodepath+'charset','cp'+tostr(cp)));
|
||||
{$ifend}
|
||||
end;
|
||||
|
||||
procedure changecodepage(
|
||||
@ -329,13 +336,4 @@ unit widestr;
|
||||
Result:=p^.cp;
|
||||
end;
|
||||
|
||||
function loadbinarycp(const s: String): Boolean;
|
||||
begin
|
||||
{$if FPC_FULLVERSION>20700}
|
||||
result:=(unicodepath<>'')and(registerbinarymapping(unicodepath+'charset',s));
|
||||
{$else}
|
||||
result:=false;
|
||||
{$ifend}
|
||||
end;
|
||||
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user