mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-12-08 20:37:11 +01:00
bsd: set DefaultSystemCodePage without cwstring.pas
git-svn-id: trunk@22410 -
This commit is contained in:
parent
57da93dd11
commit
d7d8c10aaf
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -8616,6 +8616,7 @@ rtl/unix/syscgen.inc svneol=native#text/plain
|
|||||||
rtl/unix/sysdir.inc svneol=native#text/plain
|
rtl/unix/sysdir.inc svneol=native#text/plain
|
||||||
rtl/unix/sysfile.inc svneol=native#text/plain
|
rtl/unix/sysfile.inc svneol=native#text/plain
|
||||||
rtl/unix/sysheap.inc svneol=native#text/plain
|
rtl/unix/sysheap.inc svneol=native#text/plain
|
||||||
|
rtl/unix/sysunix.inc svneol=native#text/pascal
|
||||||
rtl/unix/sysunixh.inc svneol=native#text/plain
|
rtl/unix/sysunixh.inc svneol=native#text/plain
|
||||||
rtl/unix/sysutils.pp svneol=native#text/plain
|
rtl/unix/sysutils.pp svneol=native#text/plain
|
||||||
rtl/unix/terminfo.pp svneol=native#text/plain
|
rtl/unix/terminfo.pp svneol=native#text/plain
|
||||||
|
|||||||
@ -77,7 +77,7 @@ Implementation
|
|||||||
{$endif defined(CPUARM) or defined(CPUM68K)}
|
{$endif defined(CPUARM) or defined(CPUM68K)}
|
||||||
|
|
||||||
|
|
||||||
{$I system.inc}
|
{$I sysunix.inc}
|
||||||
|
|
||||||
{*****************************************************************************
|
{*****************************************************************************
|
||||||
Misc. System Dependent Functions
|
Misc. System Dependent Functions
|
||||||
@ -335,7 +335,7 @@ Begin
|
|||||||
{ Setup heap }
|
{ Setup heap }
|
||||||
InitHeap;
|
InitHeap;
|
||||||
SysInitExceptions;
|
SysInitExceptions;
|
||||||
initunicodestringmanager;
|
InitUnixStrings;
|
||||||
{ Setup stdin, stdout and stderr }
|
{ Setup stdin, stdout and stderr }
|
||||||
SysInitStdIO;
|
SysInitStdIO;
|
||||||
{ Reset IO Error }
|
{ Reset IO Error }
|
||||||
|
|||||||
48
rtl/unix/sysunix.inc
Normal file
48
rtl/unix/sysunix.inc
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
{
|
||||||
|
This file is part of the Free Pascal Run time library.
|
||||||
|
Copyright (c) 2001 by the Free Pascal development team
|
||||||
|
|
||||||
|
This file contains the OS independent routines of the system unit
|
||||||
|
for unix styled systems
|
||||||
|
|
||||||
|
See the File COPYING.FPC, included in this distribution,
|
||||||
|
for details about the copyright.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
**********************************************************************}
|
||||||
|
|
||||||
|
|
||||||
|
{$I system.inc}
|
||||||
|
{$i winiconv.inc}
|
||||||
|
|
||||||
|
function get_locale_charset: AnsiString;
|
||||||
|
var
|
||||||
|
p: SizeInt;
|
||||||
|
begin
|
||||||
|
// Get one of non-empty environment variables in the next order:
|
||||||
|
// LC_ALL, LC_CTYPE, LANG. Default is 'ASCII'.
|
||||||
|
Result:=FpGetEnv('LC_ALL');
|
||||||
|
if Result='' then
|
||||||
|
Result:=FpGetEnv('LC_CTYPE');
|
||||||
|
if Result='' then
|
||||||
|
Result:=FpGetEnv('LANG');
|
||||||
|
if Result='' then
|
||||||
|
Result:='ASCII'
|
||||||
|
else begin
|
||||||
|
// clean up, for example en_US.UTF-8 => UTF-8
|
||||||
|
p:=Pos('.',Result);
|
||||||
|
if p>0 then Delete(Result,1,p);
|
||||||
|
p:=Pos('@',Result);
|
||||||
|
if p>0 then Delete(Result,p,length(Result));
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure InitUnixStrings;
|
||||||
|
begin
|
||||||
|
DefaultSystemCodepage:=iconv2win(get_locale_charset);
|
||||||
|
initunicodestringmanager;
|
||||||
|
end;
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user