Patch from Frédéric Hannes for PS_NOWIDESTRING support.

git-svn-id: http://code.remobjects.com/svn/pascalscript@234 5c9d2617-0215-0410-a2ee-e80e04d1c6d8
This commit is contained in:
ck 2010-08-26 06:41:03 +00:00
parent 5bc0220ef8
commit 0a9ac85673
2 changed files with 51 additions and 18 deletions

View File

@ -12313,9 +12313,14 @@ begin
AddType('UnicodeString', btUnicodeString);
{$ENDIF}
AddType('AnsiString', btString);
{$IFNDEF PS_NOWIDESTRING}
{$IFDEF DELPHI2009UP}
AddType('String', btUnicodeString);
ADdType('NativeString', btUnicodeString);
AddType('NativeString', btUnicodeString);
{$ELSE}
AddType('String', btString);
AddType('NativeString', btString);
{$ENDIF}
{$ELSE}
AddType('String', btString);
AddType('NativeString', btString);

View File

@ -3131,20 +3131,28 @@ end;
function VNGetString(const Src: TPSVariantIFC): String;
begin
{$IFNDEF PS_NOWIDESTRING}
{$IFDEF DELPHI2009UP}
Result := VNGetUnicodeString(Src);
{$ELSE}
Result := VNGetAnsiString(Src);
{$ENDIF}
{$ELSE}
Result := VNGetAnsiString(Src);
{$ENDIF}
end;
procedure VNSetString(const Src: TPSVariantIFC; const Val: String);
begin
{$IFNDEF PS_NOWIDESTRING}
{$IFDEF DELPHI2009UP}
VNSetUnicodeString(Src, Val);
{$ELSE}
VNSetAnsiString(Src, Val);
{$ENDIF}
{$ELSE}
VNSetAnsiString(Src, Val);
{$ENDIF}
end;
{$IFNDEF PS_NOWIDESTRING}
@ -3267,22 +3275,30 @@ end;
function VGetString(const Src: PIFVariant): String;
begin
{$IFNDEF PS_NOWIDESTRING}
{$IFDEF DELPHI2009UP}
Result := PSGetUnicodeString(@PPSVariantData(src).Data, src.FType);
{$ELSE}
Result := PSGetAnsiString(@PPSVariantData(src).Data, src.FType);
{$ENDIF}
{$ELSE}
Result := PSGetAnsiString(@PPSVariantData(src).Data, src.FType);
{$ENDIF}
end;
procedure VSetString(const Src: PIFVariant; const Val: string);
var
Dummy: Boolean;
begin
{$IFNDEF PS_NOWIDESTRING}
{$IFDEF DELPHI2009UP}
PSSetUnicodeString(@PPSVariantData(src).Data, src.FType, Dummy, Val);
{$ELSE}
PSSetAnsiString(@PPSVariantData(src).Data, src.FType, Dummy, Val);
{$ENDIF}
{$ELSE}
PSSetAnsiString(@PPSVariantData(src).Data, src.FType, Dummy, Val);
{$ENDIF}
end;
@ -3814,20 +3830,28 @@ end;
function PSGetString(Src: Pointer; aType: TPSTypeRec): string;
begin
{$IFNDEF PS_NOWIDESTRING}
{$IFDEF DELPHI2009UP}
result := PSGetUnicodeString(Src, aType);
{$ELSE}
result := PSGetAnsiString(Src, aType);
{$ENDIF}
{$ELSE}
result := PSGetAnsiString(Src, aType);
{$ENDIF}
end;
procedure PSSetString(Src: Pointer; aType: TPSTypeRec; var Ok: Boolean; const Val: String);
begin
{$IFNDEF PS_NOWIDESTRING}
{$IFDEF DELPHI2009UP}
PSSetUnicodeString(Src, aType, Ok, Val);
{$ELSE}
PSSetAnsiString(Src, aType, Ok, Val);
{$ENDIF}
{$ELSE}
PSSetAnsiString(Src, aType, Ok, Val);
{$ENDIF}
end;
@ -12126,7 +12150,7 @@ end;
function TPSStack.GetString(ItemNo: Longint): string; // calls the native method
begin
result := {$IFDEF DELPHI2009UP}GetUnicodeString(ItemNo){$ELSE}GetAnsiString(ItemNo){$ENDIF};
result := {$IFNDEF PS_NOWIDESTRING}{$IFDEF DELPHI2009UP}GetUnicodeString(ItemNo){$ELSE}GetAnsiString(ItemNo){$ENDIF}{$ELSE}GetAnsiString(ItemNo){$ENDIF};
end;
function TPSStack.GetUInt(ItemNo: Longint): Cardinal;
@ -12346,11 +12370,15 @@ end;
procedure TPSStack.SetString(ItemNo: Longint; const Data: string);
begin
{$IFNDEF PS_NOWIDESTRING}
{$IFDEF DELPHI2009UP}
SetUnicodeString(ItemNo, Data);
{$ELSE}
SetAnsiString(ItemNo, Data);
{$ENDIF}
{$ELSE}
SetAnsiString(ItemNo, Data);
{$ENDIF}
end;