1
0

Modified compiler defines for windows (For better compatibility with non-WIN32 systems.)

git-svn-id: https://svn.code.sf.net/p/synalist/code/trunk@112 7c85be65-684b-0410-a082-b2ed4fbef004
This commit is contained in:
geby 2010-01-22 14:33:10 +00:00
parent ebe0a97881
commit de44816b86
9 changed files with 125 additions and 61 deletions

@ -1,5 +1,5 @@
{==============================================================================|
| Project : Ararat Synapse | 009.008.000 |
| Project : Ararat Synapse | 009.008.001 |
|==============================================================================|
| Content: Library base |
|==============================================================================|
@ -82,6 +82,13 @@ Core with implementation basic socket classes.
{$H+}
{$M+}
//old Delphi does not have MSWINDOWS define.
{$IFDEF WIN32}
{$IFNDEF MSWINDOWS}
{$DEFINE MSWINDOWS}
{$ENDIF}
{$ENDIF}
unit blcksock;
interface
@ -936,10 +943,6 @@ type
constructor CreateWithSSL(SSLPlugin: TSSLClass);
destructor Destroy; override;
{:Return descriptive string for @link(LastError). On case of error
in SSL/TLS subsystem, it returns right error description.}
function GetErrorDescEx: string; override;
{:See @link(TBlockSocket.CloseSocket)}
procedure CloseSocket; override;
@ -1030,6 +1033,10 @@ type
{:@True if is used HTTP tunnel mode.}
property HTTPTunnel: Boolean read FHTTPTunnel;
published
{:Return descriptive string for @link(LastError). On case of error
in SSL/TLS subsystem, it returns right error description.}
function GetErrorDescEx: string; override;
{:Specify IP address of HTTP proxy. Assingning non-empty value to this
property enable HTTP-tunnel mode. This mode is for tunnelling any outgoing
TCP connection through HTTP proxy server. (If policy on HTTP proxy server
@ -1546,7 +1553,7 @@ var
li: TLinger;
x: integer;
buf: TMemory;
{$IFNDEF WIN32}
{$IFNDEF MSWINDOWS}
timeval: TTimeval;
{$ENDIF}
begin
@ -1596,7 +1603,7 @@ begin
synsock.SetSockOpt(FSocket, integer(SOL_SOCKET), integer(SO_RCVTIMEO),
buf, SizeOf(Value.Value));
{$ELSE}
{$IFDEF WIN32}
{$IFDEF MSWINDOWS}
buf := @Value.Value;
synsock.SetSockOpt(FSocket, integer(SOL_SOCKET), integer(SO_RCVTIMEO),
buf, SizeOf(Value.Value));
@ -1613,7 +1620,7 @@ begin
{$IFDEF CIL}
buf := System.BitConverter.GetBytes(value.Value);
{$ELSE}
{$IFDEF WIN32}
{$IFDEF MSWINDOWS}
buf := @Value.Value;
synsock.SetSockOpt(FSocket, integer(SOL_SOCKET), integer(SO_SNDTIMEO),
buf, SizeOf(Value.Value));
@ -2243,7 +2250,7 @@ begin
end
else
begin
{$IFDEF WIN32}
{$IFDEF MSWINDOWS}
//not drain CPU on large downloads...
Sleep(0);
{$ENDIF}

@ -1,5 +1,5 @@
{==============================================================================|
| Project : Ararat Synapse | 003.012.003 |
| Project : Ararat Synapse | 003.012.004 |
|==============================================================================|
| Content: HTTP client |
|==============================================================================|
@ -51,6 +51,12 @@ Used RFC: RFC-1867, RFC-1947, RFC-2388, RFC-2616
{$MODE DELPHI}
{$ENDIF}
{$H+}
//old Delphi does not have MSWINDOWS define.
{$IFDEF WIN32}
{$IFNDEF MSWINDOWS}
{$DEFINE MSWINDOWS}
{$ENDIF}
{$ENDIF}
unit httpsend;
@ -322,7 +328,7 @@ begin
if FProtocol = '0.9' then
Result := FHeaders[0] + CRLF
else
{$IFNDEF WIN32}
{$IFNDEF MSWINDOWS}
Result := AdjustLineBreaks(FHeaders.Text, tlbsCRLF);
{$ELSE}
Result := FHeaders.Text;

@ -1,5 +1,5 @@
{==============================================================================|
| Project : Ararat Synapse | 004.000.001 |
| Project : Ararat Synapse | 004.000.002 |
|==============================================================================|
| Content: PING sender |
|==============================================================================|
@ -66,6 +66,12 @@ Note: This unit is NOT portable to .NET!
{$IFDEF CIL}
Sorry, this unit is not for .NET!
{$ENDIF}
//old Delphi does not have MSWINDOWS define.
{$IFDEF WIN32}
{$IFNDEF MSWINDOWS}
{$DEFINE MSWINDOWS}
{$ENDIF}
{$ENDIF}
unit pingsend;
@ -74,7 +80,7 @@ interface
uses
SysUtils,
synsock, blcksock, synautil, synafpc, synaip
{$IFDEF WIN32}
{$IFDEF MSWINDOWS}
, windows
{$ENDIF}
;
@ -205,7 +211,7 @@ type
proto: Byte;
end;
{$IFDEF WIN32}
{$IFDEF MSWINDOWS}
const
DLLIcmpName = 'iphlpapi.dll';
type
@ -332,7 +338,7 @@ begin
FReplyError := IE_Other;
GenErrorDesc;
FBuffer := StringOfChar(#55, SizeOf(TICMPEchoHeader) + FPacketSize);
{$IFDEF WIN32}
{$IFDEF MSWINDOWS}
b := IsHostIP6(host);
if not(b) and IcmpHelper4 then
result := InternalPingIpHlp(host)
@ -400,7 +406,7 @@ begin
break;
if fSock.IP6used then
begin
{$IFNDEF WIN32}
{$IFNDEF MSWINDOWS}
IcmpEchoHeaderPtr := Pointer(FBuffer);
{$ELSE}
//WinXP SP1 with networking update doing this think by another way ;-O
@ -474,7 +480,7 @@ var
x: integer;
begin
Result := 0;
{$IFDEF WIN32}
{$IFDEF MSWINDOWS}
s := StringOfChar(#0, SizeOf(TICMP6Packet)) + Value;
ICMP6Ptr := Pointer(s);
x := synsock.WSAIoctl(FSock.Socket, SIO_ROUTING_INTERFACE_QUERY,
@ -566,7 +572,7 @@ begin
end;
function TPINGSend.InternalPingIpHlp(const Host: string): Boolean;
{$IFDEF WIN32}
{$IFDEF MSWINDOWS}
var
PingIp6: boolean;
PingHandle: integer;
@ -679,7 +685,7 @@ begin
end;
end;
{$IFDEF WIN32}
{$IFDEF MSWINDOWS}
initialization
begin
IcmpHelper4 := false;

@ -1,5 +1,5 @@
{==============================================================================|
| Project : Ararat Synapse | 003.006.000 |
| Project : Ararat Synapse | 003.006.001 |
|==============================================================================|
| Content: SSL support by OpenSSL |
|==============================================================================|
@ -60,6 +60,13 @@ Special thanks to Gregor Ibic <gregor.ibic@intelicom.si>
(*$HPPEMIT 'namespace ssl_openssl_lib { using System::Shortint; }' *)
{$ENDIF}
//old Delphi does not have MSWINDOWS define.
{$IFDEF WIN32}
{$IFNDEF MSWINDOWS}
{$DEFINE MSWINDOWS}
{$ENDIF}
{$ENDIF}
{:@abstract(OpenSSL support)
This unit is Pascal interface to OpenSSL library (used by @link(ssl_openssl) unit).
@ -77,7 +84,7 @@ uses
{$ENDIF}
Classes,
synafpc,
{$IFNDEF WIN32}
{$IFNDEF MSWINDOWS}
Libc, SysUtils;
{$ELSE}
Windows;
@ -95,7 +102,7 @@ const
{$ENDIF}
{$ELSE}
var
{$IFNDEF WIN32}
{$IFNDEF MSWINDOWS}
DLLSSLName: string = 'libssl.so';
DLLUtilName: string = 'libcrypto.so';
{$ELSE}

@ -44,8 +44,6 @@
{:@exclude}
{$IFDEF WIN32}
//{$DEFINE WINSOCK1}
{Note about define WINSOCK1:
If you activate this compiler directive, then socket interface level 1.1 is
@ -389,8 +387,13 @@ type
TServEnt = packed record
s_name: PAnsiChar;
s_aliases: ^PAnsiChar;
{$ifdef WIN64}
s_proto: PAnsiChar;
s_port: Smallint;
{$else}
s_port: Smallint;
s_proto: PAnsiChar;
{$endif}
end;
PProtoEnt = ^TProtoEnt;
@ -719,11 +722,19 @@ type
TWSAData = packed record
wVersion: Word;
wHighVersion: Word;
{$ifdef win64}
iMaxSockets : Word;
iMaxUdpDg : Word;
lpVendorInfo : PAnsiChar;
szDescription : array[0..WSADESCRIPTION_LEN] of AnsiChar;
szSystemStatus : array[0..WSASYS_STATUS_LEN] of AnsiChar;
{$else}
szDescription: array[0..WSADESCRIPTION_LEN] of AnsiChar;
szSystemStatus: array[0..WSASYS_STATUS_LEN] of AnsiChar;
iMaxSockets: Word;
iMaxUdpDg: Word;
lpVendorInfo: PAnsiChar;
{$endif}
end;
function IN6_IS_ADDR_UNSPECIFIED(const a: PInAddr6): boolean;
@ -1582,5 +1593,3 @@ finalization
begin
SynSockCS.Free;
end;
{$ENDIF}

@ -1,9 +1,9 @@
{==============================================================================|
| Project : Ararat Synapse | 001.001.001 |
| Project : Ararat Synapse | 001.001.002 |
|==============================================================================|
| Content: Utils for FreePascal compatibility |
|==============================================================================|
| Copyright (c)1999-2007, Lukas Gebauer |
| Copyright (c)1999-2010, Lukas Gebauer |
| All rights reserved. |
| |
| Redistribution and use in source and binary forms, with or without |
@ -33,7 +33,7 @@
| DAMAGE. |
|==============================================================================|
| The Initial Developer of the Original Code is Lukas Gebauer (Czech Republic).|
| Portions created by Lukas Gebauer are Copyright (c)2003-2007. |
| Portions created by Lukas Gebauer are Copyright (c)2003-2010. |
| All Rights Reserved. |
|==============================================================================|
| Contributor(s): |
@ -48,6 +48,12 @@
{$MODE DELPHI}
{$ENDIF}
{$H+}
//old Delphi does not have MSWINDOWS define.
{$IFDEF WIN32}
{$IFNDEF MSWINDOWS}
{$DEFINE MSWINDOWS}
{$ENDIF}
{$ENDIF}
unit synafpc;
@ -57,7 +63,7 @@ uses
{$IFDEF FPC}
dynlibs, sysutils;
{$ELSE}
{$IFDEF WIN32}
{$IFDEF MSWINDOWS}
Windows;
{$ELSE}
SysUtils;
@ -116,7 +122,7 @@ end;
procedure Sleep(milliseconds: Cardinal);
begin
{$IFDEF WIN32}
{$IFDEF MSWINDOWS}
{$IFDEF FPC}
sysutils.sleep(milliseconds);
{$ELSE}

@ -1,9 +1,9 @@
{==============================================================================|
| Project : Ararat Synapse | 001.001.000 |
| Project : Ararat Synapse | 001.001.001 |
|==============================================================================|
| Content: ICONV support for Win32, Linux and .NET |
|==============================================================================|
| Copyright (c)2004-2008, Lukas Gebauer |
| Copyright (c)2004-2010, Lukas Gebauer |
| All rights reserved. |
| |
| Redistribution and use in source and binary forms, with or without |
@ -33,7 +33,7 @@
| DAMAGE. |
|==============================================================================|
| The Initial Developer of the Original Code is Lukas Gebauer (Czech Republic).|
| Portions created by Lukas Gebauer are Copyright (c)2004-2008. |
| Portions created by Lukas Gebauer are Copyright (c)2004-2010. |
| All Rights Reserved. |
|==============================================================================|
| Contributor(s): |
@ -46,6 +46,12 @@
{$MODE DELPHI}
{$ENDIF}
{$H+}
//old Delphi does not have MSWINDOWS define.
{$IFDEF WIN32}
{$IFNDEF MSWINDOWS}
{$DEFINE MSWINDOWS}
{$ENDIF}
{$ENDIF}
{:@abstract(LibIconv support)
@ -63,7 +69,7 @@ uses
System.Text,
{$ENDIF}
synafpc,
{$IFNDEF WIN32}
{$IFNDEF MSWINDOWS}
{$IFNDEF FPC}
Libc,
{$ENDIF}
@ -74,7 +80,7 @@ uses
const
{$IFNDEF WIN32}
{$IFNDEF MSWINDOWS}
DLLIconvName = 'libiconv.so';
{$ELSE}
DLLIconvName = 'iconv.dll';

@ -1,9 +1,9 @@
{==============================================================================|
| Project : Ararat Synapse | 004.013.000 |
| Project : Ararat Synapse | 004.014.000 |
|==============================================================================|
| Content: support procedures and functions |
|==============================================================================|
| Copyright (c)1999-2008, Lukas Gebauer |
| Copyright (c)1999-2010, Lukas Gebauer |
| All rights reserved. |
| |
| Redistribution and use in source and binary forms, with or without |
@ -33,7 +33,7 @@
| DAMAGE. |
|==============================================================================|
| The Initial Developer of the Original Code is Lukas Gebauer (Czech Republic).|
| Portions created by Lukas Gebauer are Copyright (c) 1999-2008. |
| Portions created by Lukas Gebauer are Copyright (c) 1999-2010. |
| Portions created by Hernan Sanchez are Copyright (c) 2000. |
| All Rights Reserved. |
|==============================================================================|
@ -53,18 +53,25 @@
{$R-}
{$H+}
//old Delphi does not have MSWINDOWS define.
{$IFDEF WIN32}
{$IFNDEF MSWINDOWS}
{$DEFINE MSWINDOWS}
{$ENDIF}
{$ENDIF}
unit synautil;
interface
uses
{$IFDEF WIN32}
{$IFDEF MSWINDOWS}
Windows,
{$ELSE}
{$IFDEF FPC}
UnixUtil, Unix, BaseUnix,
UnixUtil, Unix, BaseUnix,
{$ELSE}
Libc,
Libc,
{$ENDIF}
{$ENDIF}
{$IFDEF CIL}
@ -349,7 +356,7 @@ var
{==============================================================================}
function TimeZoneBias: integer;
{$IFNDEF WIN32}
{$IFNDEF MSWINDOWS}
{$IFNDEF FPC}
var
t: TTime_T;
@ -700,7 +707,7 @@ end;
{==============================================================================}
function GetUTTime: TDateTime;
{$IFDEF WIN32}
{$IFDEF MSWINDOWS}
{$IFNDEF FPC}
var
st: TSystemTime;
@ -742,7 +749,7 @@ end;
{==============================================================================}
function SetUTTime(Newdt: TDateTime): Boolean;
{$IFDEF WIN32}
{$IFDEF MSWINDOWS}
{$IFNDEF FPC}
var
st: TSystemTime;
@ -795,7 +802,7 @@ end;
{==============================================================================}
{$IFNDEF WIN32}
{$IFNDEF MSWINDOWS}
function GetTick: LongWord;
var
Stamp: TTimeStamp;
@ -1720,7 +1727,7 @@ end;
{==============================================================================}
function GetTempFile(const Dir, prefix: AnsiString): AnsiString;
{$IFNDEF FPC}
{$IFDEF WIN32}
{$IFDEF MSWINDOWS}
var
Path: AnsiString;
x: integer;
@ -1730,7 +1737,7 @@ begin
{$IFDEF FPC}
Result := GetTempFileName(Dir, Prefix);
{$ELSE}
{$IFNDEF WIN32}
{$IFNDEF MSWINDOWS}
Result := tempnam(Pointer(Dir), Pointer(prefix));
{$ELSE}
{$IFDEF CIL}

@ -1,9 +1,9 @@
{==============================================================================|
| Project : Ararat Synapse | 005.001.000 |
| Project : Ararat Synapse | 005.002.000 |
|==============================================================================|
| Content: Socket Independent Platform Layer |
|==============================================================================|
| Copyright (c)1999-2003, Lukas Gebauer |
| Copyright (c)1999-2010, Lukas Gebauer |
| All rights reserved. |
| |
| Redistribution and use in source and binary forms, with or without |
@ -33,7 +33,7 @@
| DAMAGE. |
|==============================================================================|
| The Initial Developer of the Original Code is Lukas Gebauer (Czech Republic).|
| Portions created by Lukas Gebauer are Copyright (c)2001-2003. |
| Portions created by Lukas Gebauer are Copyright (c)2001-20010. |
| All Rights Reserved. |
|==============================================================================|
| Contributor(s): |
@ -48,20 +48,30 @@ unit synsock;
{$MINENUMSIZE 4}
{$IFDEF CIL}
{$I ssdotnet.pas}
{$ENDIF}
//old Delphi does not have MSWINDOWS define.
{$IFDEF WIN32}
{$I sswin32.pas}
{$ELSE}
{$IFDEF FPC}
{$I ssfpc.pas}
{$ELSE}
{$I sslinux.pas}
{$IFNDEF MSWINDOWS}
{$DEFINE MSWINDOWS}
{$ENDIF}
{$ENDIF}
{$IFDEF CIL}
{$I ssdotnet.pas}
{$ELSE}
{$IFDEF MSWINDOWS}
{$I sswin32.pas}
{$ELSE}
{$IFDEF WINCE}
{$I sswin32.pas} //not complete yet!
{$ELSE}
{$IFDEF FPC}
{$I ssfpc.pas}
{$ELSE}
{$I sslinux.pas}
{$ENDIF}
{$ENDIF}
{$ENDIF}
{$ENDIF}
end.