mirror of
				https://gitlab.com/freepascal.org/fpc/source.git
				synced 2025-10-31 01:11:29 +01:00 
			
		
		
		
	* improved widestring infrastructure manager
This commit is contained in:
		
							parent
							
								
									0853821fd1
								
							
						
					
					
						commit
						4f7560d89e
					
				| @ -543,10 +543,16 @@ begin | |||||||
| {$ifdef HASVARIANT} | {$ifdef HASVARIANT} | ||||||
|   initvariantmanager; |   initvariantmanager; | ||||||
| {$endif HASVARIANT} | {$endif HASVARIANT} | ||||||
|  | {$ifdef HASWIDESTRING} | ||||||
|  |   initwidestringmanager; | ||||||
|  | {$endif HASWIDESTRING} | ||||||
| end. | end. | ||||||
| { | { | ||||||
|   $Log$ |   $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 |     + GetProcessID added | ||||||
| 
 | 
 | ||||||
|   Revision 1.18  2004/11/04 09:32:31  peter |   Revision 1.18  2004/11/04 09:32:31  peter | ||||||
|  | |||||||
| @ -214,11 +214,17 @@ Begin | |||||||
| {$ifdef HASVARIANT} | {$ifdef HASVARIANT} | ||||||
|   initvariantmanager; |   initvariantmanager; | ||||||
| {$endif HASVARIANT} | {$endif HASVARIANT} | ||||||
|  | {$ifdef HASWIDESTRING} | ||||||
|  |   initwidestringmanager; | ||||||
|  | {$endif HASWIDESTRING} | ||||||
| End. | End. | ||||||
| 
 | 
 | ||||||
| { | { | ||||||
|   $Log$ |   $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 |     + GetProcessID added | ||||||
| 
 | 
 | ||||||
|   Revision 1.20  2004/11/04 09:32:31  peter |   Revision 1.20  2004/11/04 09:32:31  peter | ||||||
|  | |||||||
| @ -1599,10 +1599,16 @@ Begin | |||||||
| {$ifdef HASVARIANT} | {$ifdef HASVARIANT} | ||||||
|   initvariantmanager; |   initvariantmanager; | ||||||
| {$endif HASVARIANT} | {$endif HASVARIANT} | ||||||
|  | {$ifdef HASWIDESTRING} | ||||||
|  |   initwidestringmanager; | ||||||
|  | {$endif HASWIDESTRING} | ||||||
| End. | End. | ||||||
| { | { | ||||||
|   $Log$ |   $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) |     * fix cdecl name problems (patch from Tomas) | ||||||
| 
 | 
 | ||||||
|   Revision 1.45  2004/12/05 14:36:37  hajny |   Revision 1.45  2004/12/05 14:36:37  hajny | ||||||
|  | |||||||
| @ -545,66 +545,7 @@ function  lowercase(const s : ansistring) : ansistring; | |||||||
| ****************************************************************************} | ****************************************************************************} | ||||||
| 
 | 
 | ||||||
| {$ifdef HASWIDESTRING} | {$ifdef HASWIDESTRING} | ||||||
| {$ifndef INTERNSETLENGTH} | {$i wstringh.inc} | ||||||
| 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); |  | ||||||
| 
 |  | ||||||
| {$endif HASWIDESTRING} | {$endif HASWIDESTRING} | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| @ -796,7 +737,10 @@ const | |||||||
| 
 | 
 | ||||||
| { | { | ||||||
|   $Log$ |   $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 |     * pinteger in non-delphi/objfpc mode is psmallint | ||||||
| 
 | 
 | ||||||
|   Revision 1.111  2004/12/05 14:36:37  hajny |   Revision 1.111  2004/12/05 14:36:37  hajny | ||||||
|  | |||||||
							
								
								
									
										85
									
								
								rtl/inc/wstringh.inc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										85
									
								
								rtl/inc/wstringh.inc
									
									
									
									
									
										Normal file
									
								
							| @ -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 | ||||||
|  | } | ||||||
| @ -1,7 +1,7 @@ | |||||||
| { | { | ||||||
|     $Id$ |     $Id$ | ||||||
|     This file is part of the Free Pascal run time library. |     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. |     member of the Free Pascal development team. | ||||||
| 
 | 
 | ||||||
|     This file implements support routines for WideStrings/Unicode with FPC |     This file implements support routines for WideStrings/Unicode with FPC | ||||||
| @ -43,7 +43,6 @@ Const | |||||||
|   WideRecLen = SizeOf(TWideRec); |   WideRecLen = SizeOf(TWideRec); | ||||||
|   WideFirstOff = SizeOf(TWideRec)-sizeof(WideChar); |   WideFirstOff = SizeOf(TWideRec)-sizeof(WideChar); | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| { | { | ||||||
|   Default WideChar <-> Char conversion is to only convert the |   Default WideChar <-> Char conversion is to only convert the | ||||||
|   lower 127 chars, all others are translated to spaces. |   lower 127 chars, all others are translated to spaces. | ||||||
| @ -82,30 +81,21 @@ begin | |||||||
|    end; |    end; | ||||||
| end; | end; | ||||||
| 
 | 
 | ||||||
| Const |  | ||||||
|   Wide2AnsiMoveProc:TWide2AnsiMove=@Wide2AnsiMove; |  | ||||||
|   Ansi2WideMoveProc:TAnsi2WideMove=@Ansi2WideMove; |  | ||||||
| 
 |  | ||||||
| Procedure GetWideStringManager (Var Manager : TWideStringManager); | Procedure GetWideStringManager (Var Manager : TWideStringManager); | ||||||
| 
 |  | ||||||
| begin | begin | ||||||
|   Manager.Wide2AnsiMove:=Wide2AnsiMoveProc; | 	manager:=widestringmanager; | ||||||
|   Manager.Ansi2WideMove:=Ansi2WideMoveProc; |  | ||||||
| end; | end; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| Procedure SetWideStringManager (Const New : TWideStringManager; Var Old: TWideStringManager); | Procedure SetWideStringManager (Const New : TWideStringManager; Var Old: TWideStringManager); | ||||||
| 
 |  | ||||||
| begin | begin | ||||||
|   GetWideStringManager(Old); | 	Old:=widestringmanager; | ||||||
|   SetWideStringManager(New); | 	widestringmanager:=New; | ||||||
| end; | end; | ||||||
| 
 | 
 | ||||||
| Procedure SetWideStringManager (Const New : TWideStringManager); | Procedure SetWideStringManager (Const New : TWideStringManager); | ||||||
| 
 |  | ||||||
| begin | begin | ||||||
|   Wide2AnsiMoveProc:=New.Wide2AnsiMove; | 	widestringmanager:=New; | ||||||
|   Ansi2WideMoveProc:=New.Ansi2WideMove; |  | ||||||
| end; | end; | ||||||
| 
 | 
 | ||||||
| (* | (* | ||||||
| @ -237,7 +227,7 @@ begin | |||||||
|      Size:=Length(S2); |      Size:=Length(S2); | ||||||
|      If Size>high_of_res then |      If Size>high_of_res then | ||||||
|       Size:=high_of_res; |       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); |      byte(fpc_WideStr_To_ShortStr[0]):=byte(Size); | ||||||
|    end; |    end; | ||||||
| end; | end; | ||||||
| @ -254,7 +244,7 @@ begin | |||||||
|   Setlength (fpc_ShortStr_To_WideStr,Size); |   Setlength (fpc_ShortStr_To_WideStr,Size); | ||||||
|   if Size>0 then |   if Size>0 then | ||||||
|     begin |     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 } |       { Terminating Zero } | ||||||
|       PWideChar(Pointer(fpc_ShortStr_To_WideStr)+Size*sizeof(WideChar))^:=#0;
 |       PWideChar(Pointer(fpc_ShortStr_To_WideStr)+Size*sizeof(WideChar))^:=#0;
 | ||||||
|     end; |     end; | ||||||
| @ -282,7 +272,7 @@ begin | |||||||
|   Setlength (fpc_WideStr_To_AnsiStr,Size); |   Setlength (fpc_WideStr_To_AnsiStr,Size); | ||||||
|   if Size>0 then |   if Size>0 then | ||||||
|    begin |    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 } |      { Terminating Zero } | ||||||
|      PChar(Pointer(fpc_WideStr_To_AnsiStr)+Size)^:=#0;
 |      PChar(Pointer(fpc_WideStr_To_AnsiStr)+Size)^:=#0;
 | ||||||
|    end; |    end; | ||||||
| @ -310,7 +300,7 @@ begin | |||||||
|    Setlength (result,Size); |    Setlength (result,Size); | ||||||
|    if Size>0 then |    if Size>0 then | ||||||
|     begin |     begin | ||||||
|       Ansi2WideMoveProc(PChar(S2),PWideChar(Pointer(result)),Size); |       widestringmanager.Ansi2WideMoveProc(PChar(S2),PWideChar(Pointer(result)),Size); | ||||||
|       { Terminating Zero } |       { Terminating Zero } | ||||||
|       PWideChar(Pointer(result)+Size*sizeof(WideChar))^:=#0;
 |       PWideChar(Pointer(result)+Size*sizeof(WideChar))^:=#0;
 | ||||||
|     end; |     end; | ||||||
| @ -327,7 +317,7 @@ begin | |||||||
|   Setlength (result,Size); |   Setlength (result,Size); | ||||||
|   if Size>0 then |   if Size>0 then | ||||||
|    begin |    begin | ||||||
|      Wide2AnsiMoveProc(P,PChar(Pointer(result)),Size); |      widestringmanager.Wide2AnsiMoveProc(P,PChar(Pointer(result)),Size); | ||||||
|      { Terminating Zero } |      { Terminating Zero } | ||||||
|      PChar(Pointer(result)+Size)^:=#0;
 |      PChar(Pointer(result)+Size)^:=#0;
 | ||||||
|    end; |    end; | ||||||
| @ -366,7 +356,7 @@ begin | |||||||
|    begin |    begin | ||||||
|      If Size>255 then |      If Size>255 then | ||||||
|       Size:=255; |       Size:=255; | ||||||
|      Wide2AnsiMoveProc(p,PChar(@result[1]),Size); |      widestringmanager.Wide2AnsiMoveProc(p,PChar(@result[1]),Size); | ||||||
|      byte(result[0]):=byte(Size); |      byte(result[0]):=byte(Size); | ||||||
|    end; |    end; | ||||||
| end; | end; | ||||||
| @ -466,7 +456,7 @@ begin | |||||||
|     exit; |     exit; | ||||||
|   l:=IndexChar(p^,-1,#0);
 |   l:=IndexChar(p^,-1,#0);
 | ||||||
|   SetLength(fpc_PChar_To_WideStr,L); |   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; | end; | ||||||
| 
 | 
 | ||||||
| { old style helper } | { old style helper } | ||||||
| @ -489,7 +479,7 @@ begin | |||||||
|   if i = -1 then |   if i = -1 then | ||||||
|     i := high(arr)+1; |     i := high(arr)+1; | ||||||
|   SetLength(fpc_CharArray_To_WideStr,i); |   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; | end; | ||||||
| 
 | 
 | ||||||
| { old style helper } | { old style helper } | ||||||
| @ -537,9 +527,9 @@ begin | |||||||
|   else |   else | ||||||
|     len := index; |     len := index; | ||||||
| {$ifdef hascompilerproc} | {$ifdef hascompilerproc} | ||||||
|   Wide2AnsiMoveProc (pwidechar(@arr),PAnsiChar(@(fpc_WideCharArray_To_ShortStr[1])),len); |   widestringmanager.Wide2AnsiMoveProc (pwidechar(@arr),PAnsiChar(@(fpc_WideCharArray_To_ShortStr[1])),len); | ||||||
| {$else} | {$else} | ||||||
|   Wide2AnsiMoveProc (arr, PAnsiChar(@(fpc_WideCharArray_To_ShortStr[1])),len); |   widestringmanager.Wide2AnsiMoveProc (arr, PAnsiChar(@(fpc_WideCharArray_To_ShortStr[1])),len); | ||||||
| {$endif} | {$endif} | ||||||
|   fpc_WideCharArray_To_ShortStr[0]:=chr(len); |   fpc_WideCharArray_To_ShortStr[0]:=chr(len); | ||||||
| end; | end; | ||||||
| @ -555,7 +545,7 @@ begin | |||||||
|   if i = -1 then |   if i = -1 then | ||||||
|     i := high(arr)+1; |     i := high(arr)+1; | ||||||
|   SetLength(fpc_WideCharArray_To_AnsiStr,i); |   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; | end; | ||||||
| 
 | 
 | ||||||
| { old style helper } | { old style helper } | ||||||
| @ -630,7 +620,7 @@ begin | |||||||
|     len := arraysize; |     len := arraysize; | ||||||
|   { make sure we don't dereference src if it can be nil (JM) } |   { make sure we don't dereference src if it can be nil (JM) } | ||||||
|   if len > 0 then |   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); |   fillchar(fpc_widestr_to_chararray[len],arraysize-len,0); | ||||||
| end; | end; | ||||||
| {$endif hascompilerproc} | {$endif hascompilerproc} | ||||||
| @ -664,7 +654,7 @@ begin | |||||||
|     len := arraysize; |     len := arraysize; | ||||||
|   { make sure we don't dereference src if it can be nil (JM) } |   { make sure we don't dereference src if it can be nil (JM) } | ||||||
|   if len > 0 then |   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); |   fillchar(fpc_ansistr_to_widechararray[len],(arraysize-len)*SizeOf(WideChar),0); | ||||||
| end; | end; | ||||||
| {$endif hascompilerproc} | {$endif hascompilerproc} | ||||||
| @ -679,7 +669,7 @@ begin | |||||||
|     len := arraysize; |     len := arraysize; | ||||||
|   { make sure we don't access char 1 if length is 0 (JM) } |   { make sure we don't access char 1 if length is 0 (JM) } | ||||||
|   if len > 0 then |   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); |   fillchar(fpc_shortstr_to_widechararray[len],(arraysize-len)*SizeOf(WideChar),0); | ||||||
| end; | end; | ||||||
| 
 | 
 | ||||||
| @ -794,9 +784,9 @@ function WideCharToString(S : PWideChar) : AnsiString; | |||||||
| function StringToWideChar(const Src : AnsiString;Dest : PWideChar;DestSize : SizeInt) : PWideChar; | function StringToWideChar(const Src : AnsiString;Dest : PWideChar;DestSize : SizeInt) : PWideChar; | ||||||
|   begin |   begin | ||||||
|      if Length(Src)<DestSize then |      if Length(Src)<DestSize then | ||||||
|        Ansi2WideMoveProc(PChar(Src),Dest,Length(Src)) |        widestringmanager.Ansi2WideMoveProc(PChar(Src),Dest,Length(Src)) | ||||||
|      else |      else | ||||||
|        Ansi2WideMoveProc(PChar(Src),Dest,DestSize); |        widestringmanager.Ansi2WideMoveProc(PChar(Src),Dest,DestSize); | ||||||
|      result:=Dest; |      result:=Dest; | ||||||
|   end; |   end; | ||||||
| 
 | 
 | ||||||
| @ -1040,7 +1030,7 @@ begin | |||||||
|       BufLen := IndexByte(Buf^, Len+1, 0); |       BufLen := IndexByte(Buf^, Len+1, 0); | ||||||
|       If (BufLen>0) and (BufLen < Len) then |       If (BufLen>0) and (BufLen < Len) then | ||||||
|         Len := BufLen; |         Len := BufLen; | ||||||
|       Ansi2WideMoveProc(Buf,PWideChar(S),Len); |       widestringmanager.Ansi2WideMoveProc(Buf,PWideChar(S),Len); | ||||||
|       PWideChar(Pointer(S)+Len*sizeof(WideChar))^:=#0;
 |       PWideChar(Pointer(S)+Len*sizeof(WideChar))^:=#0;
 | ||||||
|     end; |     end; | ||||||
| end; | end; | ||||||
| @ -1386,9 +1376,47 @@ function Utf8ToAnsi(const s : UTF8String) : ansistring;{$ifdef SYSTEMINLINE}inli | |||||||
|   end; |   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$ |   $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 |     * widecharray patch from Peter | ||||||
| 
 | 
 | ||||||
|   Revision 1.46  2004/11/17 22:19:04  peter |   Revision 1.46  2004/11/17 22:19:04  peter | ||||||
|  | |||||||
| @ -186,11 +186,17 @@ Begin | |||||||
| {$ifdef HASVARIANT} | {$ifdef HASVARIANT} | ||||||
|   initvariantmanager; |   initvariantmanager; | ||||||
| {$endif HASVARIANT} | {$endif HASVARIANT} | ||||||
|  | {$ifdef HASWIDESTRING} | ||||||
|  |   initwidestringmanager; | ||||||
|  | {$endif HASWIDESTRING} | ||||||
| End. | End. | ||||||
| 
 | 
 | ||||||
| { | { | ||||||
|   $Log$ |   $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 |     + GetProcessID added | ||||||
| 
 | 
 | ||||||
|   Revision 1.19  2004/11/04 09:32:31  peter |   Revision 1.19  2004/11/04 09:32:31  peter | ||||||
|  | |||||||
| @ -1197,6 +1197,9 @@ begin | |||||||
| {$ifdef HASVARIANT} | {$ifdef HASVARIANT} | ||||||
|   initvariantmanager; |   initvariantmanager; | ||||||
| {$endif HASVARIANT} | {$endif HASVARIANT} | ||||||
|  | {$ifdef HASWIDESTRING} | ||||||
|  |   initwidestringmanager; | ||||||
|  | {$endif HASWIDESTRING} | ||||||
| 
 | 
 | ||||||
|   if StandAlone = 0 then |   if StandAlone = 0 then | ||||||
|     begin |     begin | ||||||
| @ -1209,7 +1212,10 @@ end. | |||||||
| 
 | 
 | ||||||
| { | { | ||||||
|   $Log$ |   $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 |     * 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 |   Revision 1.26  2004/12/05 14:36:37  hajny | ||||||
|  | |||||||
| @ -875,11 +875,17 @@ begin | |||||||
| {$ifdef HASVARIANT} | {$ifdef HASVARIANT} | ||||||
|   initvariantmanager; |   initvariantmanager; | ||||||
| {$endif HASVARIANT} | {$endif HASVARIANT} | ||||||
|  | {$ifdef HASWIDESTRING} | ||||||
|  |   initwidestringmanager; | ||||||
|  | {$endif HASWIDESTRING} | ||||||
| end. | end. | ||||||
| 
 | 
 | ||||||
| { | { | ||||||
|   $Log$ |   $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 |     * Few more Sysutils functions implemented | ||||||
| 
 | 
 | ||||||
|   Revision 1.28  2005/01/11 17:43:14  karoly |   Revision 1.28  2005/01/11 17:43:14  karoly | ||||||
|  | |||||||
| @ -981,10 +981,16 @@ Begin | |||||||
| {$ifdef HASVARIANT} | {$ifdef HASVARIANT} | ||||||
|   initvariantmanager; |   initvariantmanager; | ||||||
| {$endif HASVARIANT} | {$endif HASVARIANT} | ||||||
|  | {$ifdef HASWIDESTRING} | ||||||
|  |   initwidestringmanager; | ||||||
|  | {$endif HASWIDESTRING} | ||||||
| End. | End. | ||||||
| { | { | ||||||
|   $Log$ |   $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 |   * fixed GetProcessId | ||||||
| 
 | 
 | ||||||
|   Revision 1.32  2004/12/05 14:36:37  hajny |   Revision 1.32  2004/12/05 14:36:37  hajny | ||||||
|  | |||||||
| @ -1187,10 +1187,16 @@ Begin | |||||||
| {$ifdef HASVARIANT} | {$ifdef HASVARIANT} | ||||||
|   initvariantmanager; |   initvariantmanager; | ||||||
| {$endif HASVARIANT} | {$endif HASVARIANT} | ||||||
|  | {$ifdef HASWIDESTRING} | ||||||
|  |   initwidestringmanager; | ||||||
|  | {$endif HASWIDESTRING} | ||||||
| End. | End. | ||||||
| { | { | ||||||
|   $Log$ |   $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 |   * rtl code cleanup, compat fixes between clib and libc | ||||||
| 
 | 
 | ||||||
|   Revision 1.10  2004/12/07 11:40:43  armin |   Revision 1.10  2004/12/07 11:40:43  armin | ||||||
|  | |||||||
| @ -61,10 +61,6 @@ type | |||||||
|    PWordarray = ^TWordArray; |    PWordarray = ^TWordArray; | ||||||
|    TWordArray = array[0..16383] of Word; |    TWordArray = array[0..16383] of Word; | ||||||
| 
 | 
 | ||||||
|    TMethod = packed record |  | ||||||
|      Code, Data: Pointer; |  | ||||||
|    end; |  | ||||||
| 
 |  | ||||||
|    { exceptions } |    { exceptions } | ||||||
|    Exception = class(TObject) |    Exception = class(TObject) | ||||||
|     private |     private | ||||||
| @ -210,6 +206,9 @@ Type | |||||||
|   { MCBS functions } |   { MCBS functions } | ||||||
|   {$i sysansih.inc} |   {$i sysansih.inc} | ||||||
| 
 | 
 | ||||||
|  |   { wide string functions } | ||||||
|  |   {$i syswideh.inc} | ||||||
|  | 
 | ||||||
|   { Read filename handling functions declaration } |   { Read filename handling functions declaration } | ||||||
|   {$i finah.inc} |   {$i finah.inc} | ||||||
| 
 | 
 | ||||||
| @ -231,7 +230,10 @@ Type | |||||||
| 
 | 
 | ||||||
| { | { | ||||||
|   $Log$ |   $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 |   + Some capitalization added for documentation purposes | ||||||
| 
 | 
 | ||||||
|   Revision 1.8  2004/08/31 10:34:11  michael |   Revision 1.8  2004/08/31 10:34:11  michael | ||||||
|  | |||||||
| @ -67,6 +67,9 @@ | |||||||
|   { MCBS functions } |   { MCBS functions } | ||||||
|   {$i sysansi.inc} |   {$i sysansi.inc} | ||||||
|    |    | ||||||
|  |   { wide string functions } | ||||||
|  |   {$i syswide.inc} | ||||||
|  | 
 | ||||||
|   { CPU Specific code } |   { CPU Specific code } | ||||||
|   {$i sysutilp.inc} |   {$i sysutilp.inc} | ||||||
| 
 | 
 | ||||||
|  | |||||||
							
								
								
									
										49
									
								
								rtl/objpas/sysutils/syswide.inc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								rtl/objpas/sysutils/syswide.inc
									
									
									
									
									
										Normal file
									
								
							| @ -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
									
								
								rtl/objpas/sysutils/syswideh.inc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								rtl/objpas/sysutils/syswideh.inc
									
									
									
									
									
										Normal file
									
								
							| @ -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 | ||||||
|  | } | ||||||
| @ -132,11 +132,17 @@ Begin | |||||||
| {$ifdef HASVARIANT} | {$ifdef HASVARIANT} | ||||||
|   initvariantmanager; |   initvariantmanager; | ||||||
| {$endif HASVARIANT} | {$endif HASVARIANT} | ||||||
|  | {$ifdef HASWIDESTRING} | ||||||
|  |   initwidestringmanager; | ||||||
|  | {$endif HASWIDESTRING} | ||||||
| End. | End. | ||||||
| 
 | 
 | ||||||
| { | { | ||||||
|  $Log$ |  $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 |    + GetProcessID added | ||||||
| 
 | 
 | ||||||
|  Revision 1.2  2004/11/06 22:22:28  florian |  Revision 1.2  2004/11/06 22:22:28  florian | ||||||
|  | |||||||
							
								
								
									
										81
									
								
								rtl/unix/cwstring.pp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										81
									
								
								rtl/unix/cwstring.pp
									
									
									
									
									
										Normal file
									
								
							| @ -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 | ||||||
|  | } | ||||||
|  | 
 | ||||||
| @ -1534,11 +1534,17 @@ Begin | |||||||
| {$ifdef HASVARIANT} | {$ifdef HASVARIANT} | ||||||
|   initvariantmanager; |   initvariantmanager; | ||||||
| {$endif HASVARIANT} | {$endif HASVARIANT} | ||||||
|  | {$ifdef HASWIDESTRING} | ||||||
|  |   initwidestringmanager; | ||||||
|  | {$endif HASWIDESTRING} | ||||||
| End. | End. | ||||||
| 
 | 
 | ||||||
| { | { | ||||||
|   $Log$ |   $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 |     + GetProcessID added | ||||||
| 
 | 
 | ||||||
|   Revision 1.17  2004/11/04 09:32:31  peter |   Revision 1.17  2004/11/04 09:32:31  peter | ||||||
|  | |||||||
| @ -1614,11 +1614,17 @@ begin | |||||||
| {$ifdef HASVARIANT} | {$ifdef HASVARIANT} | ||||||
|   initvariantmanager; |   initvariantmanager; | ||||||
| {$endif HASVARIANT} | {$endif HASVARIANT} | ||||||
|  | {$ifdef HASWIDESTRING} | ||||||
|  |   initwidestringmanager; | ||||||
|  | {$endif HASWIDESTRING} | ||||||
| end. | end. | ||||||
| 
 | 
 | ||||||
| { | { | ||||||
|   $Log$ |   $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 |     * remove inline assembler for calling asm_exit | ||||||
| 
 | 
 | ||||||
|   Revision 1.64  2004/12/05 14:36:38  hajny |   Revision 1.64  2004/12/05 14:36:38  hajny | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 florian
						florian