summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormichael <michael@3ad0048d-3df7-0310-abae-a5850022a9f2>2019-02-16 10:50:31 +0000
committermichael <michael@3ad0048d-3df7-0310-abae-a5850022a9f2>2019-02-16 10:50:31 +0000
commit69eaf6ef0017019e0c7b1b6c7998a8c59b2aa927 (patch)
tree8c92da250b86a420a49c4ed6f763ccf733a3d607
parent918726a26350eea31cb27269597ab76f6a8156ff (diff)
downloadfpc-69eaf6ef0017019e0c7b1b6c7998a8c59b2aa927.tar.gz
* Complete the implementation of IsLeadChar
git-svn-id: https://svn.freepascal.org/svn/fpc/trunk@41336 3ad0048d-3df7-0310-abae-a5850022a9f2
-rw-r--r--rtl/objpas/sysutils/sysstr.inc13
-rw-r--r--rtl/objpas/sysutils/sysstrh.inc2
-rw-r--r--rtl/win/sysutils.pp28
3 files changed, 43 insertions, 0 deletions
diff --git a/rtl/objpas/sysutils/sysstr.inc b/rtl/objpas/sysutils/sysstr.inc
index 431a63b466..f78bb9b334 100644
--- a/rtl/objpas/sysutils/sysstr.inc
+++ b/rtl/objpas/sysutils/sysstr.inc
@@ -76,6 +76,19 @@ begin
Dest := Dest + S;
end ;
+function IsLeadChar(C: AnsiChar): Boolean; inline;
+
+begin
+ Result:=C in LeadBytes;
+end;
+
+function IsLeadChar(B: Byte): Boolean; inline;
+
+
+begin
+ Result:=Char(B) in LeadBytes;
+end;
+
Function InternalChangeCase(Const S : AnsiString; const Chars: TSysCharSet; const Adjustment: Longint): AnsiString;
var
i : Integer;
diff --git a/rtl/objpas/sysutils/sysstrh.inc b/rtl/objpas/sysutils/sysstrh.inc
index 8c96d472fa..30d8716623 100644
--- a/rtl/objpas/sysutils/sysstrh.inc
+++ b/rtl/objpas/sysutils/sysstrh.inc
@@ -251,6 +251,8 @@ Function CharToByteLen(const S: string; MaxLen: SizeInt): SizeInt;
Function ByteToCharIndex(const S: string; Index: SizeInt): SizeInt;
Function StrCharLength(const Str: PChar): SizeInt;
function StrNextChar(const Str: PChar): PChar;
+function IsLeadChar(C: AnsiChar): Boolean; inline; overload;
+function IsLeadChar(B: Byte): Boolean; inline; overload;
const
diff --git a/rtl/win/sysutils.pp b/rtl/win/sysutils.pp
index ea11b02958..3afd7ebd80 100644
--- a/rtl/win/sysutils.pp
+++ b/rtl/win/sysutils.pp
@@ -1038,6 +1038,34 @@ begin
GetlocaleFormatSettings(GetThreadLocale, DefaultFormatSettings);
end;
+Procedure InitLeadBytes;
+
+var
+ I,B,C,E: Byte;
+ Info: TCPInfo;
+
+begin
+ GetCPInfo(CP_ACP,Info);
+ I:=0;
+ With Info do
+ begin
+ B:=LeadByte[i];
+ E:=LeadByte[i+1];
+ while (I<MAX_LEADBYTES) and (B<>0) and (E<>0) do
+ begin
+ for C:=B to E do
+ Include(LeadBytes,AnsiChar(C));
+ Inc(I,2);
+ if (I<MAX_LEADBYTES) then
+ begin
+ B:=LeadByte[i];
+ E:=LeadByte[i+1];
+ end;
+ end;
+ end;
+end;
+
+
Procedure InitInternational;
var
{ A call to GetSystemMetrics changes the value of the 8087 Control Word on