diff --git a/BlockSocket.pas b/BlockSocket.pas
index 70bbd72..6836ee6 100644
--- a/BlockSocket.pas
+++ b/BlockSocket.pas
@@ -25,8 +25,8 @@ TBlockSocket = class
procedure Connect(Host : string; pPort : word);
procedure Purge;
procedure Close;
- function RecvString : string;
- procedure SendString(const Data: string);
+ function RecvString : AnsiString;
+ procedure SendString(const Data: AnsiString);
function WaitingData : cardinal;
function CanRead(Timeout: Integer): Boolean;
function Error : integer;
@@ -171,7 +171,7 @@ procedure TBlockSocket.Purge;
// Returns the socket input stream as a string
// @see Error
-function TBlockSocket.RecvString : string;
+function TBlockSocket.RecvString : AnsiString;
var
Tam : integer;
begin
@@ -186,7 +186,7 @@ function TBlockSocket.RecvString : string;
@param Data String to send
@see Error
}
-procedure TBlockSocket.SendString(const Data: string); begin
+procedure TBlockSocket.SendString(const Data: AnsiString); begin
fpSend(Socket, @Data[1], length(Data), 0);
end;
diff --git a/ExtPascal.pas b/ExtPascal.pas
index e4e5047..adcaf26 100644
--- a/ExtPascal.pas
+++ b/ExtPascal.pas
@@ -123,8 +123,8 @@ TExtObject = class
function IsParent(CName : string): boolean;
function VarToJSON(A : array of const) : string; overload;
function VarToJSON(Exts : TExtObjectList) : string; overload;
- function VarToJSON(Strs : TArrayOfString) : string; overload;
- function VarToJSON(Ints : TArrayOfInteger) : string; overload;
+ function VarToJSON(Strs : {$IF Defined(FPC) or (RTLVersion < 20)}TArrayOfString {$ELSE}array of string {$IFEND}) : string; overload;
+ function VarToJSON(Ints : {$IF Defined(FPC) or (RTLVersion < 20)}TArrayOfInteger{$ELSE}array of integer{$IFEND}) : string; overload;
function ParamAsInteger(ParamName : string) : integer;
function ParamAsDouble(ParamName : string) : double;
function ParamAsBoolean(ParamName : string) : boolean;
@@ -945,9 +945,14 @@ function TExtObject.JSExpression(Expression : string; MethodsValues : array of c
for I := 0 to high(MethodsValues) do
with MethodsValues[I] do
if VType = vtObject then begin
- Command := TExtFunction(VObject).ExtractJSCommand; // FPC idiosincrasy
+ Command := TExtFunction(VObject).ExtractJSCommand; // FPC idiosincrasy
+ {$IFNDEF UNICODE}
VAnsiString := pointer(Command);
VType := vtAnsiString;
+ {$ELSE}
+ VUnicodeString := pointer(Command);
+ VType := vtUnicodeString;
+ {$ENDIF}
end;
JSReturns.Values[Mark] := Format(Expression, MethodsValues);
end;
@@ -1209,6 +1214,10 @@ function TExtObject.Ajax(MethodName : string; Params : array of const; IsEvent :
case VType of
vtAnsiString : lParams := lParams + '"+' + string(VAnsiString) + '+"';
vtString : lParams := lParams + '"+' + VString^ + '+"';
+ vtWideString : lParams := lParams + '"+' + string(VWideString) + '+"';
+ {$IFDEF UNICODE}
+ vtUnicodeString : lParams := lParams + '"+' + string(VUnicodeString) + '+"';
+ {$ENDIF}
vtObject : begin
lParams := lParams + '"+' + TExtObject(VObject).ExtractJSCommand + '+"';
TExtObject(VObject).JSCommand := '';
@@ -1216,14 +1225,22 @@ function TExtObject.Ajax(MethodName : string; Params : array of const; IsEvent :
vtInteger : lParams := lParams + IntToStr(VInteger);
vtBoolean : lParams := lParams + IfThen(VBoolean, 'true', 'false');
vtExtended : lParams := lParams + FloatToStr(VExtended^);
+ vtCurrency : lParams := lParams + CurrToStr(VCurrency^);
+ vtInt64 : lParams := lParams + IntToStr(VInt64^);
vtVariant : lParams := lParams + string(VVariant^);
vtChar : lParams := lParams + '"+' + VChar + '+"';
+ vtWideChar : lParams := lParams + '"+' + VWideChar + '+"';
end
else
case VType of
vtAnsiString : lParams := lParams + '&' + string(VAnsiString) + '=';
vtString : lParams := lParams + '&' + VString^ + '=';
+ vtWideString : lParams := lParams + '&' + string(VWideString) + '=';
+ {$IFDEF UNICODE}
+ vtUnicodeString : lParams := lParams + '&' + string(VUnicodeString) + '=';
+ {$ENDIF}
vtChar : lParams := lParams + '&' + VChar + '=';
+ vtWideChar : lParams := lParams + '&' + VWideChar + '=';
else
JSCode('Ext.Msg.show({title:"Error",msg:"Ajax method: ' + MethodName +
' has an invalid parameter name in place #' + IntToStr(I+1) + '",icon:Ext.Msg.ERROR,buttons:Ext.Msg.OK});');
@@ -1333,10 +1350,18 @@ function TExtObject.VarToJSON(A : array of const) : string;
end;
vtAnsiString: Result := Result + StrToJS(string(VAnsiString));
vtString: Result := Result + StrToJS(VString^);
+ vtWideString: Result := Result + StrToJS(string(VWideString));
+ {$IFDEF UNICODE}
+ vtUnicodeString: Result := Result + StrToJS(string(VUnicodeString));
+ {$ENDIF}
vtInteger: Result := Result + IntToStr(VInteger);
vtBoolean: Result := Result + IfThen(VBoolean, 'true', 'false');
vtExtended: Result := Result + FloatToStr(VExtended^);
- vtVariant: Result := Result + string(VVariant^)
+ vtCurrency: Result := Result + CurrToStr(VCurrency^);
+ vtInt64: Result := Result + IntToStr(VInt64^);
+ vtVariant: Result := Result + string(VVariant^);
+ vtChar: Result := Result + VChar;
+ vtWideChar: Result := Result + VWideChar;
end;
if I < high(A) then Result := Result + ',';
inc(I);
@@ -1361,7 +1386,7 @@ function TExtObject.VarToJSON(Exts : TExtObjectList) : string; begin
@param Strs An to convert
@return JSON representation of Strs
}
-function TExtObject.VarToJSON(Strs : TArrayOfString) : string;
+function TExtObject.VarToJSON(Strs : {$IF Defined(FPC) or (RTLVersion < 20)}TArrayOfString{$ELSE}array of string{$IFEND}) : string;
var
I : integer;
begin
@@ -1378,7 +1403,7 @@ function TExtObject.VarToJSON(Strs : TArrayOfString) : string;
@param Ints An to convert
@return JSON representation of Ints
}
-function TExtObject.VarToJSON(Ints : TArrayOfInteger) : string;
+function TExtObject.VarToJSON(Ints : {$IF Defined(FPC) or (RTLVersion < 20)}TArrayOfInteger{$ELSE}array of integer{$IFEND}) : string;
var
I : integer;
begin
diff --git a/ExtPascalSamples.dpr b/ExtPascalSamples.dpr
index 01aa33a..bb49006 100644
--- a/ExtPascalSamples.dpr
+++ b/ExtPascalSamples.dpr
@@ -1,12 +1,11 @@
program ExtPascalSamples;
{.$DEFINE SERVICE}
-uses
- ExtPascal, ExtPascalUtils, SysUtils, {$IFNDEF WebServer}FCGIApp{$ELSE}IdExtHTTPServer{$ENDIF}, {$IFDEF SERVICE}Services,{$ENDIF}
- Classes, Ext, ExtGlobal, ExtData, ExtForm, ExtGrid, ExtUtil, ExtAir, ExtSql, ExtDd, ExtLayout, ExtMenu, ExtState, ExtTree;
-
{$IFNDEF WebServer}
{$IFDEF MSWINDOWS}{$APPTYPE CONSOLE}{$ENDIF}
{$ENDIF}
+uses
+ ExtPascal, ExtPascalUtils, SysUtils, {$IFNDEF WebServer}FCGIApp{$ELSE}IdExtHTTPServer{$ENDIF}, {$IFDEF SERVICE}Services,{$ENDIF}
+ Classes, Ext, ExtGlobal, ExtData, ExtForm, ExtGrid, ExtUtil, ExtAir, ExtSql, ExtDd, ExtLayout, ExtMenu, ExtState, ExtTree;
type
TSamples = class(TExtThread)
diff --git a/ExtToPascal.dpr b/ExtToPascal.dpr
index 62f4594..924f990 100644
--- a/ExtToPascal.dpr
+++ b/ExtToPascal.dpr
@@ -13,7 +13,7 @@ uses
const
UsesPublished = false;
-
+
function FixReserved(S : string) : string;
const
Reserved = '.and.array.as.asm.begin.case.class.const.constructor.destructor.destroy.dispinterface.div.do.downto.else.end.except.exports.'+
@@ -1205,7 +1205,7 @@ begin
AllClasses := TStringList.Create;
Units := TStringList.Create;
writeln('ExtToPascal wrapper, version ', ExtPascalVersion);
- writeln('(c) 2008 by Wanderlan Santos dos Anjos, BSD license'^M^J);
+ writeln('(c) 2009 by Wanderlan Santos dos Anjos, BSD license'^M^J);
writeln('Reading HTML files...');
T := now;
repeat
diff --git a/SocketsDelphi.pas b/SocketsDelphi.pas
index 75f46ce..52780bb 100644
--- a/SocketsDelphi.pas
+++ b/SocketsDelphi.pas
@@ -276,8 +276,8 @@ function fpaccept(s:cint; addrx : psockaddr; addrlen : plongint):cint; begin
fpAccept:=WinSockDelphi.Accept(S,WinSockDelphi.PSockAddr(Addrx), AddrLen);
end;
-function fpgetsockname(s:cint; name : psockaddr; namelen : psocklen):cint; begin
- fpGetSockName:=WinSockDelphi.GetSockName(S,WinSockDelphi.TSockAddr(name^),nameLen^);
+function fpgetsockname(s:cint; name : psockaddr; namelen : psocklen):cint; begin
+ fpGetSockName:=WinSockDelphi.GetSockName(S, WinSockDelphi.PSockAddr(name)^,nameLen^);
end;
type
diff --git a/WinSockDelphi.pas b/WinSockDelphi.pas
index 7362f92..a889a88 100644
--- a/WinSockDelphi.pas
+++ b/WinSockDelphi.pas
@@ -931,19 +931,6 @@ TWSAProtocol_InfoW = record
SERVICE_TYPE_VALUE_OBJECTIDA = 'ObjectId';
SERVICE_TYPE_VALUE_OBJECTIDW : PWideChar = 'ObjectId';
-
-{$IFDEF UNICODE}
- SERVICE_TYPE_VALUE_SAPID = SERVICE_TYPE_VALUE_SAPIDW;
- SERVICE_TYPE_VALUE_TCPPORT = SERVICE_TYPE_VALUE_TCPPORTW;
- SERVICE_TYPE_VALUE_UDPPORT = SERVICE_TYPE_VALUE_UDPPORTW;
- SERVICE_TYPE_VALUE_OBJECTID = SERVICE_TYPE_VALUE_OBJECTIDW;
-{$ELSE}
- SERVICE_TYPE_VALUE_SAPID = SERVICE_TYPE_VALUE_SAPIDA;
- SERVICE_TYPE_VALUE_TCPPORT = SERVICE_TYPE_VALUE_TCPPORTA;
- SERVICE_TYPE_VALUE_UDPPORT = SERVICE_TYPE_VALUE_UDPPORTA;
- SERVICE_TYPE_VALUE_OBJECTID = SERVICE_TYPE_VALUE_OBJECTIDA;
-{$ENDIF}
-
{$endif}{FPC}
{ SockAddr Information }