mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 15:09:20 +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;
|
s:=current_scanner.readcomment;
|
||||||
if (upper(s)='UTF8') or (upper(s)='UTF-8') then
|
if (upper(s)='UTF8') or (upper(s)='UTF-8') then
|
||||||
current_settings.sourcecodepage:=CP_UTF8
|
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)
|
Message1(option_code_page_not_available,s)
|
||||||
else
|
else
|
||||||
current_settings.sourcecodepage:=codepagebyname(s);
|
current_settings.sourcecodepage:=codepagebyname(s);
|
||||||
|
@ -56,14 +56,13 @@ unit widestr;
|
|||||||
procedure unicode2ascii(r : pcompilerwidestring;p : pchar;cp : tstringencoding);
|
procedure unicode2ascii(r : pcompilerwidestring;p : pchar;cp : tstringencoding);
|
||||||
function hasnonasciichars(const p: pcompilerwidestring): boolean;
|
function hasnonasciichars(const p: pcompilerwidestring): boolean;
|
||||||
function getcharwidestring(r : pcompilerwidestring;l : SizeInt) : tcompilerwidechar;
|
function getcharwidestring(r : pcompilerwidestring;l : SizeInt) : tcompilerwidechar;
|
||||||
function cpavailable(const s : string) : boolean;
|
function cpavailable(const s: string) : boolean;
|
||||||
function cpavailable(cp : word) : boolean;
|
function cpavailable(cp: word) : boolean;
|
||||||
procedure changecodepage(
|
procedure changecodepage(
|
||||||
s : pchar; l : SizeInt; scp : tstringencoding;
|
s : pchar; l : SizeInt; scp : tstringencoding;
|
||||||
d : pchar; dcp : tstringencoding
|
d : pchar; dcp : tstringencoding
|
||||||
);
|
);
|
||||||
function codepagebyname(const s : string) : tstringencoding;
|
function codepagebyname(const s : string) : tstringencoding;
|
||||||
function loadbinarycp(const s: String): Boolean;
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@ -287,14 +286,22 @@ unit widestr;
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function cpavailable(const s : string) : boolean;
|
function cpavailable(const s: string): boolean;
|
||||||
begin
|
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;
|
end;
|
||||||
|
|
||||||
function cpavailable(cp : word) : boolean;
|
function cpavailable(cp: word): boolean;
|
||||||
begin
|
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;
|
end;
|
||||||
|
|
||||||
procedure changecodepage(
|
procedure changecodepage(
|
||||||
@ -329,13 +336,4 @@ unit widestr;
|
|||||||
Result:=p^.cp;
|
Result:=p^.cp;
|
||||||
end;
|
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.
|
end.
|
||||||
|
Loading…
Reference in New Issue
Block a user