소스 검색

* improved widestring infrastructure manager

florian 20 년 전
부모
커밋
4f7560d89e

+ 7 - 1
rtl/beos/system.pp

@@ -543,10 +543,16 @@ begin
 {$ifdef HASVARIANT}
   initvariantmanager;
 {$endif HASVARIANT}
+{$ifdef HASWIDESTRING}
+  initwidestringmanager;
+{$endif HASWIDESTRING}
 end.
 {
   $Log$
-  Revision 1.19  2004-12-05 14:36:37  hajny
+  Revision 1.20  2005-02-01 20:22:49  florian
+    * improved widestring infrastructure manager
+
+  Revision 1.19  2004/12/05 14:36:37  hajny
     + GetProcessID added
 
   Revision 1.18  2004/11/04 09:32:31  peter

+ 7 - 1
rtl/bsd/system.pp

@@ -214,11 +214,17 @@ Begin
 {$ifdef HASVARIANT}
   initvariantmanager;
 {$endif HASVARIANT}
+{$ifdef HASWIDESTRING}
+  initwidestringmanager;
+{$endif HASWIDESTRING}
 End.
 
 {
   $Log$
-  Revision 1.21  2004-12-05 14:36:37  hajny
+  Revision 1.22  2005-02-01 20:22:49  florian
+    * improved widestring infrastructure manager
+
+  Revision 1.21  2004/12/05 14:36:37  hajny
     + GetProcessID added
 
   Revision 1.20  2004/11/04 09:32:31  peter

+ 7 - 1
rtl/go32v2/system.pp

@@ -1599,10 +1599,16 @@ Begin
 {$ifdef HASVARIANT}
   initvariantmanager;
 {$endif HASVARIANT}
+{$ifdef HASWIDESTRING}
+  initwidestringmanager;
+{$endif HASWIDESTRING}
 End.
 {
   $Log$
-  Revision 1.46  2004-12-07 14:02:24  jonas
+  Revision 1.47  2005-02-01 20:22:49  florian
+    * improved widestring infrastructure manager
+
+  Revision 1.46  2004/12/07 14:02:24  jonas
     * fix cdecl name problems (patch from Tomas)
 
   Revision 1.45  2004/12/05 14:36:37  hajny

+ 5 - 61
rtl/inc/systemh.inc

@@ -545,66 +545,7 @@ function  lowercase(const s : ansistring) : ansistring;
 ****************************************************************************}
 
 {$ifdef HASWIDESTRING}
-{$ifndef INTERNSETLENGTH}
-Procedure SetLength (Var S : WideString; l : SizeInt);
-{$endif INTERNSETLENGTH}
-procedure UniqueString(Var S : WideString);external name 'FPC_WIDESTR_UNIQUE';
-{$ifndef INTERNLENGTH}
-Function  Length (Const S : WideString) : SizeInt;
-{$endif INTERNLENGTH}
-{$ifndef InternCopy}
-Function  Copy (Const S : WideString; Index,Size : SizeInt) : WideString;
-{$endif interncopy}
-Function  Pos (Const Substr : WideString; Const Source : WideString) : SizeInt;
-Function  Pos (c : Char; Const s : WideString) : SizeInt;
-Function  Pos (c : WideChar; Const s : WideString) : SizeInt;
-Procedure Insert (Const Source : WideString; Var S : WideString; Index : SizeInt);
-Procedure Delete (Var S : WideString; Index,Size: SizeInt);
-Procedure SetString (Var S : WideString; Buf : PWideChar; Len : SizeInt);
-Procedure SetString (Var S : WideString; Buf : PChar; Len : SizeInt);
-
-function WideCharToString(S : PWideChar) : AnsiString;
-function StringToWideChar(const Src : AnsiString;Dest : PWideChar;DestSize : SizeInt) : PWideChar;
-function WideCharLenToString(S : PWideChar;Len : SizeInt) : AnsiString;
-procedure WideCharLenToStrVar(Src : PWideChar;Len : SizeInt;var Dest : AnsiString);
-procedure WideCharToStrVar(S : PWideChar;var Dest : AnsiString);
-
-Type
-  TWide2AnsiMove=procedure(source:pwidechar;dest:pchar;len:SizeInt);
-  TAnsi2WideMove=procedure(source:pchar;dest:pwidechar;len:SizeInt);
-
-
-  TWideStringManager = record
-    Wide2AnsiMove : TWide2AnsiMove;
-    Ansi2WideMove : TAnsi2WideMove;
-{
-    UpperUTF8 : procedure(p:PUTF8String);
-    UpperUCS2 : procedure(p:PUCS2Char);
-    UpperUCS4 : procedure(p:PUCS4Char);
-    LowerUTF8 : procedure(p:PUTF8String);
-    LowerUCS2 : procedure(p:PUCS2Char);
-    LowerUCS4 : procedure(p:PUCS4Char);
-
-    CompUTF8 : function(p1,p2:PUTF8String) : shortint;
-    CompUCS2 : function(p1,p2:PUCS2Char) : shortint;
-    CompUCS4 : function(p1,p2:PUC42Char) : shortint;
-}
-  end;
-
-
-function UnicodeToUtf8(Dest: PChar; Source: PWideChar; MaxBytes: SizeInt): SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
-function UnicodeToUtf8(Dest: PChar; MaxDestBytes: SizeUInt; Source: PWideChar; SourceChars: SizeUInt): SizeUInt;
-function Utf8ToUnicode(Dest: PWideChar; Source: PChar; MaxChars: SizeInt): SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
-function Utf8ToUnicode(Dest: PWideChar; MaxDestChars: SizeUInt; Source: PChar; SourceBytes: SizeUInt): SizeUInt;
-function UTF8Encode(const s : WideString) : UTF8String;
-function UTF8Decode(const s : UTF8String): WideString;
-function AnsiToUtf8(const s : ansistring): UTF8String;{$ifdef SYSTEMINLINE}inline;{$endif}
-function Utf8ToAnsi(const s : UTF8String) : ansistring;{$ifdef SYSTEMINLINE}inline;{$endif}
-
-Procedure GetWideStringManager (Var Manager : TWideStringManager);
-Procedure SetWideStringManager (Const New : TWideStringManager);
-Procedure SetWideStringManager (Const New : TWideStringManager; Var Old: TWideStringManager);
-
+{$i wstringh.inc}
 {$endif HASWIDESTRING}
 
 
@@ -796,7 +737,10 @@ const
 
 {
   $Log$
-  Revision 1.112  2005-01-24 18:03:19  peter
+  Revision 1.113  2005-02-01 20:22:49  florian
+    * improved widestring infrastructure manager
+
+  Revision 1.112  2005/01/24 18:03:19  peter
     * pinteger in non-delphi/objfpc mode is psmallint
 
   Revision 1.111  2004/12/05 14:36:37  hajny

+ 85 - 0
rtl/inc/wstringh.inc

@@ -0,0 +1,85 @@
+{
+    $Id$
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 1999-2005 by Florian Klaempfl,
+    member of the Free Pascal development team.
+
+    This file implements support routines for WideStrings/Unicode with FPC
+
+    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.
+
+ **********************************************************************}
+
+
+{$ifndef INTERNSETLENGTH}
+Procedure SetLength (Var S : WideString; l : SizeInt);
+{$endif INTERNSETLENGTH}
+procedure UniqueString(Var S : WideString);external name 'FPC_WIDESTR_UNIQUE';
+{$ifndef INTERNLENGTH}
+Function  Length (Const S : WideString) : SizeInt;
+{$endif INTERNLENGTH}
+{$ifndef InternCopy}
+Function  Copy (Const S : WideString; Index,Size : SizeInt) : WideString;
+{$endif interncopy}
+Function  Pos (Const Substr : WideString; Const Source : WideString) : SizeInt;
+Function  Pos (c : Char; Const s : WideString) : SizeInt;
+Function  Pos (c : WideChar; Const s : WideString) : SizeInt;
+Procedure Insert (Const Source : WideString; Var S : WideString; Index : SizeInt);
+Procedure Delete (Var S : WideString; Index,Size: SizeInt);
+Procedure SetString (Var S : WideString; Buf : PWideChar; Len : SizeInt);
+Procedure SetString (Var S : WideString; Buf : PChar; Len : SizeInt);
+
+function WideCharToString(S : PWideChar) : AnsiString;
+function StringToWideChar(const Src : AnsiString;Dest : PWideChar;DestSize : SizeInt) : PWideChar;
+function WideCharLenToString(S : PWideChar;Len : SizeInt) : AnsiString;
+procedure WideCharLenToStrVar(Src : PWideChar;Len : SizeInt;var Dest : AnsiString);
+procedure WideCharToStrVar(S : PWideChar;var Dest : AnsiString);
+
+Type
+  TWideStringManager = record
+    Wide2AnsiMoveProc : procedure(source:pwidechar;dest:pchar;len:SizeInt);
+    Ansi2WideMoveProc : procedure(source:pchar;dest:pwidechar;len:SizeInt);
+
+//    UpperUTF8 : procedure(p:PUTF8String);
+
+    UpperWideStringProc : function(const S: WideString): WideString;
+//    UpperUCS4 : procedure(p:PUCS4Char);
+//    LowerUTF8 : procedure(p:PUTF8String);
+    LowerWideStringProc : function(const S: WideString): WideString;
+//    LowerUCS4 : procedure(p:PUCS4Char);
+{
+    CompUTF8 : function(p1,p2:PUTF8String) : shortint;
+    CompUCS2 : function(p1,p2:PUCS2Char) : shortint;
+    CompUCS4 : function(p1,p2:PUC42Char) : shortint;
+}
+    CompareWideStringProc : function(const s1, s2 : WideString) : PtrInt;
+    SameWideStringProc : function(const s1, s2 : WideString) : Boolean;
+  end;
+
+
+function UnicodeToUtf8(Dest: PChar; Source: PWideChar; MaxBytes: SizeInt): SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
+function UnicodeToUtf8(Dest: PChar; MaxDestBytes: SizeUInt; Source: PWideChar; SourceChars: SizeUInt): SizeUInt;
+function Utf8ToUnicode(Dest: PWideChar; Source: PChar; MaxChars: SizeInt): SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
+function Utf8ToUnicode(Dest: PWideChar; MaxDestChars: SizeUInt; Source: PChar; SourceBytes: SizeUInt): SizeUInt;
+function UTF8Encode(const s : WideString) : UTF8String;
+function UTF8Decode(const s : UTF8String): WideString;
+function AnsiToUtf8(const s : ansistring): UTF8String;{$ifdef SYSTEMINLINE}inline;{$endif}
+function Utf8ToAnsi(const s : UTF8String) : ansistring;{$ifdef SYSTEMINLINE}inline;{$endif}
+
+var
+  widestringmanager : TWideStringManager;
+
+Procedure GetWideStringManager (Var Manager : TWideStringManager);
+Procedure SetWideStringManager (Const New : TWideStringManager);
+Procedure SetWideStringManager (Const New : TWideStringManager; Var Old: TWideStringManager);
+
+{
+  $Log$
+  Revision 1.1  2005-02-01 20:22:49  florian
+    * improved widestring infrastructure manager
+}

+ 61 - 33
rtl/inc/wstrings.inc

@@ -1,7 +1,7 @@
 {
     $Id$
     This file is part of the Free Pascal run time library.
-    Copyright (c) 1999-2001 by Florian Klaempfl,
+    Copyright (c) 1999-2005 by Florian Klaempfl,
     member of the Free Pascal development team.
 
     This file implements support routines for WideStrings/Unicode with FPC
@@ -43,7 +43,6 @@ Const
   WideRecLen = SizeOf(TWideRec);
   WideFirstOff = SizeOf(TWideRec)-sizeof(WideChar);
 
-
 {
   Default WideChar <-> Char conversion is to only convert the
   lower 127 chars, all others are translated to spaces.
@@ -82,30 +81,21 @@ begin
    end;
 end;
 
-Const
-  Wide2AnsiMoveProc:TWide2AnsiMove=@Wide2AnsiMove;
-  Ansi2WideMoveProc:TAnsi2WideMove=@Ansi2WideMove;
-
 Procedure GetWideStringManager (Var Manager : TWideStringManager);
-
 begin
-  Manager.Wide2AnsiMove:=Wide2AnsiMoveProc;
-  Manager.Ansi2WideMove:=Ansi2WideMoveProc;
+	manager:=widestringmanager;
 end;
 
 
 Procedure SetWideStringManager (Const New : TWideStringManager; Var Old: TWideStringManager);
-
 begin
-  GetWideStringManager(Old);
-  SetWideStringManager(New);
+	Old:=widestringmanager;
+	widestringmanager:=New;
 end;
 
 Procedure SetWideStringManager (Const New : TWideStringManager);
-
 begin
-  Wide2AnsiMoveProc:=New.Wide2AnsiMove;
-  Ansi2WideMoveProc:=New.Ansi2WideMove;
+	widestringmanager:=New;
 end;
 
 (*
@@ -237,7 +227,7 @@ begin
      Size:=Length(S2);
      If Size>high_of_res then
       Size:=high_of_res;
-     Wide2AnsiMoveProc(PWideChar(S2),PChar(@fpc_WideStr_To_ShortStr[1]),Size);
+     widestringmanager.Wide2AnsiMoveProc(PWideChar(S2),PChar(@fpc_WideStr_To_ShortStr[1]),Size);
      byte(fpc_WideStr_To_ShortStr[0]):=byte(Size);
    end;
 end;
@@ -254,7 +244,7 @@ begin
   Setlength (fpc_ShortStr_To_WideStr,Size);
   if Size>0 then
     begin
-      Ansi2WideMoveProc(PChar(@S2[1]),PWideChar(Pointer(fpc_ShortStr_To_WideStr)),Size);
+      widestringmanager.Ansi2WideMoveProc(PChar(@S2[1]),PWideChar(Pointer(fpc_ShortStr_To_WideStr)),Size);
       { Terminating Zero }
       PWideChar(Pointer(fpc_ShortStr_To_WideStr)+Size*sizeof(WideChar))^:=#0;
     end;
@@ -282,7 +272,7 @@ begin
   Setlength (fpc_WideStr_To_AnsiStr,Size);
   if Size>0 then
    begin
-     Wide2AnsiMoveProc(PWideChar(Pointer(S2)),PChar(Pointer(fpc_WideStr_To_AnsiStr)),Size);
+     widestringmanager.Wide2AnsiMoveProc(PWideChar(Pointer(S2)),PChar(Pointer(fpc_WideStr_To_AnsiStr)),Size);
      { Terminating Zero }
      PChar(Pointer(fpc_WideStr_To_AnsiStr)+Size)^:=#0;
    end;
@@ -310,7 +300,7 @@ begin
    Setlength (result,Size);
    if Size>0 then
     begin
-      Ansi2WideMoveProc(PChar(S2),PWideChar(Pointer(result)),Size);
+      widestringmanager.Ansi2WideMoveProc(PChar(S2),PWideChar(Pointer(result)),Size);
       { Terminating Zero }
       PWideChar(Pointer(result)+Size*sizeof(WideChar))^:=#0;
     end;
@@ -327,7 +317,7 @@ begin
   Setlength (result,Size);
   if Size>0 then
    begin
-     Wide2AnsiMoveProc(P,PChar(Pointer(result)),Size);
+     widestringmanager.Wide2AnsiMoveProc(P,PChar(Pointer(result)),Size);
      { Terminating Zero }
      PChar(Pointer(result)+Size)^:=#0;
    end;
@@ -366,7 +356,7 @@ begin
    begin
      If Size>255 then
       Size:=255;
-     Wide2AnsiMoveProc(p,PChar(@result[1]),Size);
+     widestringmanager.Wide2AnsiMoveProc(p,PChar(@result[1]),Size);
      byte(result[0]):=byte(Size);
    end;
 end;
@@ -466,7 +456,7 @@ begin
     exit;
   l:=IndexChar(p^,-1,#0);
   SetLength(fpc_PChar_To_WideStr,L);
-  Ansi2WideMoveProc(P,PWideChar(Pointer(fpc_PChar_To_WideStr)),l);
+  widestringmanager.Ansi2WideMoveProc(P,PWideChar(Pointer(fpc_PChar_To_WideStr)),l);
 end;
 
 { old style helper }
@@ -489,7 +479,7 @@ begin
   if i = -1 then
     i := high(arr)+1;
   SetLength(fpc_CharArray_To_WideStr,i);
-  Ansi2WideMoveProc (pchar(@arr),PWideChar(Pointer(fpc_CharArray_To_WideStr)),i);
+  widestringmanager.Ansi2WideMoveProc (pchar(@arr),PWideChar(Pointer(fpc_CharArray_To_WideStr)),i);
 end;
 
 { old style helper }
@@ -537,9 +527,9 @@ begin
   else
     len := index;
 {$ifdef hascompilerproc}
-  Wide2AnsiMoveProc (pwidechar(@arr),PAnsiChar(@(fpc_WideCharArray_To_ShortStr[1])),len);
+  widestringmanager.Wide2AnsiMoveProc (pwidechar(@arr),PAnsiChar(@(fpc_WideCharArray_To_ShortStr[1])),len);
 {$else}
-  Wide2AnsiMoveProc (arr, PAnsiChar(@(fpc_WideCharArray_To_ShortStr[1])),len);
+  widestringmanager.Wide2AnsiMoveProc (arr, PAnsiChar(@(fpc_WideCharArray_To_ShortStr[1])),len);
 {$endif}
   fpc_WideCharArray_To_ShortStr[0]:=chr(len);
 end;
@@ -555,7 +545,7 @@ begin
   if i = -1 then
     i := high(arr)+1;
   SetLength(fpc_WideCharArray_To_AnsiStr,i);
-  Wide2AnsiMoveProc (pwidechar(@arr),PAnsiChar(Pointer(fpc_WideCharArray_To_AnsiStr)),i);
+  widestringmanager.Wide2AnsiMoveProc (pwidechar(@arr),PAnsiChar(Pointer(fpc_WideCharArray_To_AnsiStr)),i);
 end;
 
 { old style helper }
@@ -630,7 +620,7 @@ begin
     len := arraysize;
   { make sure we don't dereference src if it can be nil (JM) }
   if len > 0 then
-    wide2ansimoveproc(pwidechar(@src[1]),pchar(@fpc_widestr_to_chararray[0]),len);
+    widestringmanager.wide2ansimoveproc(pwidechar(@src[1]),pchar(@fpc_widestr_to_chararray[0]),len);
   fillchar(fpc_widestr_to_chararray[len],arraysize-len,0);
 end;
 {$endif hascompilerproc}
@@ -664,7 +654,7 @@ begin
     len := arraysize;
   { make sure we don't dereference src if it can be nil (JM) }
   if len > 0 then
-    ansi2widemoveproc(pchar(@src[1]),pwidechar(@fpc_ansistr_to_widechararray[0]),len);
+    widestringmanager.ansi2widemoveproc(pchar(@src[1]),pwidechar(@fpc_ansistr_to_widechararray[0]),len);
   fillchar(fpc_ansistr_to_widechararray[len],(arraysize-len)*SizeOf(WideChar),0);
 end;
 {$endif hascompilerproc}
@@ -679,7 +669,7 @@ begin
     len := arraysize;
   { make sure we don't access char 1 if length is 0 (JM) }
   if len > 0 then
-    ansi2widemoveproc(pchar(@src[1]),pwidechar(@fpc_shortstr_to_widechararray[0]),len);
+    widestringmanager.ansi2widemoveproc(pchar(@src[1]),pwidechar(@fpc_shortstr_to_widechararray[0]),len);
   fillchar(fpc_shortstr_to_widechararray[len],(arraysize-len)*SizeOf(WideChar),0);
 end;
 
@@ -794,9 +784,9 @@ function WideCharToString(S : PWideChar) : AnsiString;
 function StringToWideChar(const Src : AnsiString;Dest : PWideChar;DestSize : SizeInt) : PWideChar;
   begin
      if Length(Src)<DestSize then
-       Ansi2WideMoveProc(PChar(Src),Dest,Length(Src))
+       widestringmanager.Ansi2WideMoveProc(PChar(Src),Dest,Length(Src))
      else
-       Ansi2WideMoveProc(PChar(Src),Dest,DestSize);
+       widestringmanager.Ansi2WideMoveProc(PChar(Src),Dest,DestSize);
      result:=Dest;
   end;
 
@@ -1040,7 +1030,7 @@ begin
       BufLen := IndexByte(Buf^, Len+1, 0);
       If (BufLen>0) and (BufLen < Len) then
         Len := BufLen;
-      Ansi2WideMoveProc(Buf,PWideChar(S),Len);
+      widestringmanager.Ansi2WideMoveProc(Buf,PWideChar(S),Len);
       PWideChar(Pointer(S)+Len*sizeof(WideChar))^:=#0;
     end;
 end;
@@ -1386,9 +1376,47 @@ function Utf8ToAnsi(const s : UTF8String) : ansistring;{$ifdef SYSTEMINLINE}inli
   end;
 
 
+procedure unimplementedwidestring;
+  begin
+    HandleErrorFrame(215,get_frame);
+  end;
+
+
+function GenericWideCase(const s : WideString) : WideString;
+  begin
+    unimplementedwidestring;
+  end;
+
+
+function CompareWideString(const s1, s2 : WideString) : PtrInt;
+  begin
+    unimplementedwidestring;
+  end;
+
+
+function SameWideString(const s1, s2 : WideString) : Boolean;
+  begin
+    unimplementedwidestring;
+  end;
+
+
+procedure initwidestringmanager;
+  begin
+    fillchar(widestringmanager,sizeof(widestringmanager),0);
+    widestringmanager.Wide2AnsiMoveProc:=@Wide2AnsiMove;
+    widestringmanager.Ansi2WideMoveProc:=@Ansi2WideMove;
+    widestringmanager.UpperWideStringProc:=@GenericWideCase;
+    widestringmanager.CompareWideStringProc:=@CompareWideString;
+    widestringmanager.SameWideStringProc:=@SameWideString;
+  end;
+
+
 {
   $Log$
-  Revision 1.47  2005-01-06 13:31:06  florian
+  Revision 1.48  2005-02-01 20:22:49  florian
+    * improved widestring infrastructure manager
+
+  Revision 1.47  2005/01/06 13:31:06  florian
     * widecharray patch from Peter
 
   Revision 1.46  2004/11/17 22:19:04  peter

+ 7 - 1
rtl/linux/system.pp

@@ -186,11 +186,17 @@ Begin
 {$ifdef HASVARIANT}
   initvariantmanager;
 {$endif HASVARIANT}
+{$ifdef HASWIDESTRING}
+  initwidestringmanager;
+{$endif HASWIDESTRING}
 End.
 
 {
   $Log$
-  Revision 1.20  2004-12-05 14:36:37  hajny
+  Revision 1.21  2005-02-01 20:22:49  florian
+    * improved widestring infrastructure manager
+
+  Revision 1.20  2004/12/05 14:36:37  hajny
     + GetProcessID added
 
   Revision 1.19  2004/11/04 09:32:31  peter

+ 7 - 1
rtl/macos/system.pp

@@ -1197,6 +1197,9 @@ begin
 {$ifdef HASVARIANT}
   initvariantmanager;
 {$endif HASVARIANT}
+{$ifdef HASWIDESTRING}
+  initwidestringmanager;
+{$endif HASWIDESTRING}
 
   if StandAlone = 0 then
     begin
@@ -1209,7 +1212,10 @@ end.
 
 {
   $Log$
-  Revision 1.27  2005-01-24 18:51:23  olle
+  Revision 1.28  2005-02-01 20:22:49  florian
+    * improved widestring infrastructure manager
+
+  Revision 1.27  2005/01/24 18:51:23  olle
     * filetype/filecreator changed after the file is opened, in case the file did not previously exist
 
   Revision 1.26  2004/12/05 14:36:37  hajny

+ 7 - 1
rtl/morphos/system.pp

@@ -875,11 +875,17 @@ begin
 {$ifdef HASVARIANT}
   initvariantmanager;
 {$endif HASVARIANT}
+{$ifdef HASWIDESTRING}
+  initwidestringmanager;
+{$endif HASWIDESTRING}
 end.
 
 {
   $Log$
-  Revision 1.29  2005-01-12 08:03:42  karoly
+  Revision 1.30  2005-02-01 20:22:49  florian
+    * improved widestring infrastructure manager
+
+  Revision 1.29  2005/01/12 08:03:42  karoly
     * Few more Sysutils functions implemented
 
   Revision 1.28  2005/01/11 17:43:14  karoly

+ 7 - 1
rtl/netware/system.pp

@@ -981,10 +981,16 @@ Begin
 {$ifdef HASVARIANT}
   initvariantmanager;
 {$endif HASVARIANT}
+{$ifdef HASWIDESTRING}
+  initwidestringmanager;
+{$endif HASWIDESTRING}
 End.
 {
   $Log$
-  Revision 1.33  2004-12-07 11:04:42  armin
+  Revision 1.34  2005-02-01 20:22:49  florian
+    * improved widestring infrastructure manager
+
+  Revision 1.33  2004/12/07 11:04:42  armin
   * fixed GetProcessId
 
   Revision 1.32  2004/12/05 14:36:37  hajny

+ 7 - 1
rtl/netwlibc/system.pp

@@ -1187,10 +1187,16 @@ Begin
 {$ifdef HASVARIANT}
   initvariantmanager;
 {$endif HASVARIANT}
+{$ifdef HASWIDESTRING}
+  initwidestringmanager;
+{$endif HASWIDESTRING}
 End.
 {
   $Log$
-  Revision 1.11  2005-01-04 11:25:34  armin
+  Revision 1.12  2005-02-01 20:22:49  florian
+    * improved widestring infrastructure manager
+
+  Revision 1.11  2005/01/04 11:25:34  armin
   * rtl code cleanup, compat fixes between clib and libc
 
   Revision 1.10  2004/12/07 11:40:43  armin

+ 7 - 5
rtl/objpas/sysutils/sysutilh.inc

@@ -61,10 +61,6 @@ type
    PWordarray = ^TWordArray;
    TWordArray = array[0..16383] of Word;
 
-   TMethod = packed record
-     Code, Data: Pointer;
-   end;
-
    { exceptions }
    Exception = class(TObject)
     private
@@ -210,6 +206,9 @@ Type
   { MCBS functions }
   {$i sysansih.inc}
 
+  { wide string functions }
+  {$i syswideh.inc}
+
   { Read filename handling functions declaration }
   {$i finah.inc}
 
@@ -231,7 +230,10 @@ Type
 
 {
   $Log$
-  Revision 1.9  2004-08-31 11:03:35  michael
+  Revision 1.10  2005-02-01 20:22:50  florian
+    * improved widestring infrastructure manager
+
+  Revision 1.9  2004/08/31 11:03:35  michael
   + Some capitalization added for documentation purposes
 
   Revision 1.8  2004/08/31 10:34:11  michael

+ 3 - 0
rtl/objpas/sysutils/sysutils.inc

@@ -66,6 +66,9 @@
 
   { MCBS functions }
   {$i sysansi.inc}
+  
+  { wide string functions }
+  {$i syswide.inc}
 
   { CPU Specific code }
   {$i sysutilp.inc}

+ 49 - 0
rtl/objpas/sysutils/syswide.inc

@@ -0,0 +1,49 @@
+{
+    *********************************************************************
+    $Id$
+    Copyright (C) 2002-2005 by Florian Klaempfl
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    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.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+    *********************************************************************
+}
+
+function WideUpperCase(const s : WideString) : WideString;
+  begin
+  	result:=widestringmanager.UpperWideStringProc(s);
+  end;
+
+
+function WideLowerCase(const s : WideString) : WideString;
+  begin
+  	result:=widestringmanager.LowerWideStringProc(s);
+  end;
+
+
+function WideCompareStr(const s1, s2 : WideString) : PtrInt;
+  begin
+  	result:=widestringmanager.CompareWideStringProc(s1,s2);
+  end;
+
+
+function WideSameStr(const s1, s2 : WideString) : Boolean;
+  begin
+  	result:=widestringmanager.SameWideStringProc(s1,s2);
+  end;
+
+{
+  $Log$
+  Revision 1.1  2005-02-01 20:22:50  florian
+    * improved widestring infrastructure manager
+}

+ 31 - 0
rtl/objpas/sysutils/syswideh.inc

@@ -0,0 +1,31 @@
+{
+    *********************************************************************
+    $Id$
+    Copyright (C) 2002 by Florian Klaempfl
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    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.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+    *********************************************************************
+}
+
+function WideUpperCase(const s : WideString) : WideString;
+function WideLowerCase(const s : WideString) : WideString;
+function WideCompareStr(const s1, s2 : WideString) : PtrInt;
+function WideSameStr(const s1, s2 : WideString) : Boolean;
+
+{
+  $Log$
+  Revision 1.1  2005-02-01 20:22:50  florian
+    * improved widestring infrastructure manager
+}

+ 7 - 1
rtl/sunos/system.pp

@@ -132,11 +132,17 @@ Begin
 {$ifdef HASVARIANT}
   initvariantmanager;
 {$endif HASVARIANT}
+{$ifdef HASWIDESTRING}
+  initwidestringmanager;
+{$endif HASWIDESTRING}
 End.
 
 {
  $Log$
- Revision 1.3  2004-12-05 14:36:38  hajny
+ Revision 1.4  2005-02-01 20:22:50  florian
+   * improved widestring infrastructure manager
+
+ Revision 1.3  2004/12/05 14:36:38  hajny
    + GetProcessID added
 
  Revision 1.2  2004/11/06 22:22:28  florian

+ 81 - 0
rtl/unix/cwstring.pp

@@ -0,0 +1,81 @@
+{
+    $Id$
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2005 by Florian Klaempfl,
+    member of the Free Pascal development team.
+
+    libc based wide string support
+
+    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.
+
+ **********************************************************************}
+{$mode objfpc}
+
+unit cwstring;
+interface
+
+ {$linklib c}		// try adding -Xf
+
+Procedure SetCWidestringManager;
+
+implementation
+
+Uses
+  systhrds,
+  BaseUnix,
+  unix,
+  unixtype;
+  
+{ maybe this needs to be splitted in an os depend way later }
+function towlower(__wc:wint_t):wint_t;cdecl;external clib name 'towlower';
+function towupper(__wc:wint_t):wint_t;cdecl;external clib name 'towupper';  
+  
+function LowerWideCase(const s : WideString) : WideString;
+  begin
+  end;
+  
+  
+function UpperWideCase(const s : WideString) : WideString;
+  begin
+  end;
+  
+  
+function CompareWideString(const s1, s2 : WideString) : PtrInt;
+  begin
+  end;
+  
+  
+function SameWideString(const s1, s2 : WideString) : Boolean;
+  begin
+  end;
+  
+
+Var
+  CWideStringManager : TWideStringManager;
+
+Procedure SetCWideStringManager;
+
+begin
+  With CWideStringManager do
+    begin
+    end;
+  SetWideStringManager(CWideStringManager);
+  InitHeapMutexes;
+end;
+
+
+initialization
+  SetCWideStringManager;
+finalization
+end.
+{
+  $Log$
+  Revision 1.1  2005-02-01 20:22:50  florian
+    * improved widestring infrastructure manager
+}
+

+ 7 - 1
rtl/watcom/system.pp

@@ -1534,11 +1534,17 @@ Begin
 {$ifdef HASVARIANT}
   initvariantmanager;
 {$endif HASVARIANT}
+{$ifdef HASWIDESTRING}
+  initwidestringmanager;
+{$endif HASWIDESTRING}
 End.
 
 {
   $Log$
-  Revision 1.18  2004-12-05 14:36:38  hajny
+  Revision 1.19  2005-02-01 20:22:50  florian
+    * improved widestring infrastructure manager
+
+  Revision 1.18  2004/12/05 14:36:38  hajny
     + GetProcessID added
 
   Revision 1.17  2004/11/04 09:32:31  peter

+ 7 - 1
rtl/win32/system.pp

@@ -1614,11 +1614,17 @@ begin
 {$ifdef HASVARIANT}
   initvariantmanager;
 {$endif HASVARIANT}
+{$ifdef HASWIDESTRING}
+  initwidestringmanager;
+{$endif HASWIDESTRING}
 end.
 
 {
   $Log$
-  Revision 1.65  2004-12-12 11:53:47  florian
+  Revision 1.66  2005-02-01 20:22:50  florian
+    * improved widestring infrastructure manager
+
+  Revision 1.65  2004/12/12 11:53:47  florian
     * remove inline assembler for calling asm_exit
 
   Revision 1.64  2004/12/05 14:36:38  hajny