* SetString(WideString,[PChar|PWideChar],Len) added

This commit is contained in:
peter 2002-12-15 22:33:12 +00:00
parent 8bb7e03d19
commit 438fbdedee
2 changed files with 39 additions and 6 deletions

View File

@ -476,6 +476,8 @@ Function Pos (c : Char; Const s : WideString) : Longint;
Function Pos (c : WideChar; Const s : WideString) : Longint;
Procedure Insert (Const Source : WideString; Var S : WideString; Index : Longint);
Procedure Delete (Var S : WideString; Index,Size: Longint);
Procedure SetString (Var S : WideString; Buf : PWideChar; Len : Longint);
Procedure SetString (Var S : WideString; Buf : PChar; Len : Longint);
function WideCharToString(S : PWideChar) : AnsiString;
function StringToWideChar(const Src : AnsiString;Dest : PWideChar;DestSize : LongInt) : PWideChar;
@ -654,7 +656,10 @@ const
{
$Log$
Revision 1.60 2002-11-16 20:12:22 florian
Revision 1.61 2002-12-15 22:33:12 peter
* SetString(WideString,[PChar|PWideChar],Len) added
Revision 1.60 2002/11/16 20:12:22 florian
+ sparc types added
+ UTF*/UCS* types added

View File

@ -823,12 +823,37 @@ begin
end;
{!!!:Procedure SetString (Var S : WideString; Buf : PWideChar; Len : Longint);
Procedure SetString (Var S : WideString; Buf : PWideChar; Len : Longint);
var
BufLen: longint;
begin
SetLength(S,Len);
Move (Buf[0],S[1],Len*2);
end;}
If (Buf<>Nil) and (Len>0) then
begin
BufLen := IndexWord(Buf^, Len+1, 0);
If (BufLen>0) and (BufLen < Len) then
Len := BufLen;
Move (Buf[0],S[1],Len*sizeof(WideChar));
PWideChar(Pointer(S)+Len*sizeof(WideChar))^:=#0;
end;
end;
Procedure SetString (Var S : WideString; Buf : PChar; Len : Longint);
var
BufLen: longint;
begin
SetLength(S,Len);
If (Buf<>Nil) and (Len>0) then
begin
BufLen := IndexByte(Buf^, Len+1, 0);
If (BufLen>0) and (BufLen < Len) then
Len := BufLen;
Ansi2WideMoveProc(Buf,PWideChar(S),Len);
PWideChar(Pointer(S)+Len*sizeof(WideChar))^:=#0;
end;
end;
Function fpc_Val_Real_WideStr(Const S : WideString; Var Code : ValSInt): ValReal; [public, alias:'FPC_VAL_REAL_WIDESTR']; {$ifdef hascompilerproc} compilerproc; {$endif}
Var
@ -935,7 +960,10 @@ end;
{
$Log$
Revision 1.26 2002-12-14 19:16:45 sg
Revision 1.27 2002-12-15 22:33:12 peter
* SetString(WideString,[PChar|PWideChar],Len) added
Revision 1.26 2002/12/14 19:16:45 sg
* Ported improvements from the AnsiString equivalents to NewWideString and
fpc_WideStr_SetLength