Use __MINGW32__ rather than __MINGW__ because gcc does that too.

NB. It seems some recent patches put ___MINGW32__ in the public headers ...
that needs to be fixed as the headers should be system independent!


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@21795 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2005-10-11 19:09:26 +00:00
parent 9919e36065
commit bfb6ebd9bc
40 changed files with 247 additions and 247 deletions

View file

@ -58,7 +58,7 @@
#if USE_ZLIB
gzFile gzDescriptor;
#endif
#if defined(__MINGW__)
#if defined(__MINGW32__)
WSAEVENT event;
#endif
}

View file

@ -39,12 +39,12 @@ typedef struct{
GSIArray performers; /** The actions to perform regularly. */
GSIArray timers; /** The timers set for the runloop mode */
GSIArray watchers; /** The inputs set for the runloop mode */
#if defined(__MINGW__)
#if defined(__MINGW32__)
id msgTarget; /** Target to raise a win32 message */
SEL msgSelector; /** method of target */
#endif
@private
#if defined(__MINGW__)
#if defined(__MINGW32__)
NSMapTable *handleMap;
#else
NSMapTable *_efdMap;

View file

@ -31,7 +31,7 @@
#include <Foundation/NSObject.h>
#include <Foundation/NSMapTable.h>
#if defined(__MINGW__)
#if defined(__MINGW32__)
#include <winsock2.h>
#include <wininet.h>
#else
@ -193,7 +193,7 @@ typedef SOCKET NSSocketNativeHandle;
gsu16 portNum; /* TCP port in host byte order. */
SOCKET listener;
NSMapTable *handles; /* Handles indexed by socket. */
#if defined(__MINGW__)
#if defined(__MINGW32__)
WSAEVENT eventListener;
NSMapTable *events;
#endif
@ -317,7 +317,7 @@ typedef SOCKET NSSocketNativeHandle;
NSRecursiveLock *myLock;
NSMapTable *handles; /* Handles indexed by socket. */
int listener; /* Descriptor to listen on. */
#if defined(__MINGW__)
#if defined(__MINGW32__)
WSAEVENT eventListener;
NSMapTable *events;
#endif

View file

@ -108,7 +108,7 @@ GS_EXPORT NSString * const NSDefaultRunLoopMode;
</example>
*/
typedef enum {
#ifdef __MINGW__
#ifdef __MINGW32__
ET_HANDLE,
ET_RPORT /* Watch for message arriving on port. */
#else
@ -199,7 +199,7 @@ typedef enum {
- (void) getFds: (int*)fds count: (int*)count;
@end
#if defined(__MINGW__)
#if defined(__MINGW32__)
/**
* Interface that add method to set target for win32 messages.<br />
*/

View file

@ -57,7 +57,7 @@
#include <GNUstepBase/GSFileHandle.h>
#if defined(__MINGW__)
#if defined(__MINGW32__)
#include <winsock2.h>
#else
#include <time.h>
@ -67,7 +67,7 @@
#include <netinet/in.h>
#include <arpa/inet.h>
#include <signal.h>
#endif /* __MINGW__ */
#endif /* __MINGW32__ */
#include <sys/file.h>
#include <sys/stat.h>

View file

@ -2214,7 +2214,7 @@ GSAutoreleasedBuffer(unsigned size)
/* Getting a system error message on a variety of systems */
#ifdef __MINGW__
#ifdef __MINGW32__
LPTSTR GetErrorMsg(DWORD msgId)
{
LPVOID lpMsgBuf;
@ -2244,12 +2244,12 @@ strerror(int eno)
return(sys_errlist[eno]);
}
#endif
#endif /* __MINGW__ */
#endif /* __MINGW32__ */
const char *
GSLastErrorStr(long error_id)
{
#ifdef __MINGW__
#ifdef __MINGW32__
return GetErrorMsg(GetLastError());
#else
return strerror(error_id);

View file

@ -44,7 +44,7 @@
#include "../Tools/gdomap.h"
#if defined(__MINGW__)
#if defined(__MINGW32__)
#include <winsock2.h>
#include <fcntl.h>
#include <sys/file.h>
@ -71,7 +71,7 @@
#define SOCKET int
#define SOCKET_ERROR -1
#define INVALID_SOCKET -1
#endif /* __MINGW__ */
#endif /* __MINGW32__ */
#include <string.h>
#ifdef HAVE_UNISTD_H
@ -133,7 +133,7 @@ static NSString* NotificationKey = @"NSFileHandleNotificationKey";
#endif
if (isSocket)
{
#if defined(__MINGW__)
#if defined(__MINGW32__)
len = recv((SOCKET)_get_osfhandle(descriptor), buf, len, 0);
#else
len = recv(descriptor, buf, len, 0);
@ -161,7 +161,7 @@ static NSString* NotificationKey = @"NSFileHandleNotificationKey";
#endif
if (isSocket)
{
#if defined(__MINGW__)
#if defined(__MINGW32__)
len = send((SOCKET)_get_osfhandle(descriptor), buf, len, 0);
#else
len = send(descriptor, buf, len, 0);
@ -302,7 +302,7 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
[self setNonBlocking: wasNonBlocking];
if (closeOnDealloc == YES)
{
#if defined(__MINGW__)
#if defined(__MINGW32__)
if (isSocket)
{
closesocket((SOCKET)_get_osfhandle(descriptor));
@ -842,7 +842,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
{
NSLog(@"unable to bind to port %s:%d - %s", inet_ntoa(lsin.sin_addr),
GSSwapBigI16ToHost(sin.sin_port), GSLastErrorStr(errno));
#if defined(__MINGW__)
#if defined(__MINGW32__)
(void) closesocket(net);
#else
(void) close(net);
@ -852,7 +852,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
}
}
#if defined(__MINGW__)
#if defined(__MINGW32__)
self = [self initWithNativeHandle: (void*)net closeOnDealloc: YES];
#else
self = [self initWithFileDescriptor: net closeOnDealloc: YES];
@ -865,7 +865,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
[self setNonBlocking: YES];
if (connect(net, (struct sockaddr*)&sin, sizeof(sin)) == SOCKET_ERROR)
{
#if defined(__MINGW__)
#if defined(__MINGW32__)
if (WSAGetLastError() != WSAEWOULDBLOCK)
#else
if (errno != EINPROGRESS)
@ -956,7 +956,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
{
NSLog(@"unable to bind to port %s:%d - %s", inet_ntoa(sin.sin_addr),
GSSwapBigI16ToHost(sin.sin_port), GSLastErrorStr(errno));
#if defined(__MINGW__)
#if defined(__MINGW32__)
(void) closesocket(net);
#else
(void) close(net);
@ -968,7 +968,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (listen(net, 5) == SOCKET_ERROR)
{
NSLog(@"unable to listen on port - %s", GSLastErrorStr(errno));
#if defined(__MINGW__)
#if defined(__MINGW32__)
(void) closesocket(net);
#else
(void) close(net);
@ -980,7 +980,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (getsockname(net, (struct sockaddr*)&sin, &size) == SOCKET_ERROR)
{
NSLog(@"unable to get socket name - %s", GSLastErrorStr(errno));
#if defined(__MINGW__)
#if defined(__MINGW32__)
(void) closesocket(net);
#else
(void) close(net);
@ -989,7 +989,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
return nil;
}
#if defined(__MINGW__)
#if defined(__MINGW32__)
self = [self initWithNativeHandle: (void*)net closeOnDealloc: YES];
#else
self = [self initWithFileDescriptor: net closeOnDealloc: YES];
@ -1008,7 +1008,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
- (id) initForReadingAtPath: (NSString*)path
{
#if defined(__MINGW__)
#if defined(__MINGW32__)
int d = _wopen(
(unichar*)[path cStringUsingEncoding: NSUnicodeStringEncoding],
O_RDONLY|O_BINARY);
@ -1036,7 +1036,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
- (id) initForWritingAtPath: (NSString*)path
{
#if defined(__MINGW__)
#if defined(__MINGW32__)
int d = _wopen(
(unichar*)[path cStringUsingEncoding: NSUnicodeStringEncoding],
O_WRONLY|O_BINARY);
@ -1064,7 +1064,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
- (id) initForUpdatingAtPath: (NSString*)path
{
#if defined(__MINGW__)
#if defined(__MINGW32__)
int d = _wopen(
(unichar*)[path cStringUsingEncoding: NSUnicodeStringEncoding],
O_RDWR|O_BINARY);
@ -1151,7 +1151,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
- (id) initWithNullDevice
{
#if defined(__MINGW__)
#if defined(__MINGW32__)
isNullDevice = YES;
isStandardFile = YES;
descriptor = -1;
@ -1171,14 +1171,14 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
self = [super init];
if (self != nil)
{
#if defined(__MINGW__)
#if defined(__MINGW32__)
struct _stat sbuf;
#else
struct stat sbuf;
int e;
#endif
#if defined(__MINGW__)
#if defined(__MINGW32__)
if (_fstat(desc, &sbuf) != 0)
#else
if (fstat(desc, &sbuf) < 0)
@ -1199,7 +1199,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
}
}
#if defined(__MINGW__)
#if defined(__MINGW32__)
if (isStandardFile == NO)
{
unsigned long nbio = 0;
@ -1243,7 +1243,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
writeOK = YES;
acceptOK = YES;
connectOK = YES;
#if defined(__MINGW__)
#if defined(__MINGW32__)
if (isSocket)
{
event = CreateEvent(NULL, NO, NO, NULL);
@ -1265,7 +1265,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
- (id) initWithNativeHandle: (void*)hdl
{
#if defined(__MINGW__)
#if defined(__MINGW32__)
return [self initWithFileDescriptor: _open_osfhandle((SOCKET)hdl, 0)
closeOnDealloc: NO];
#else
@ -1275,7 +1275,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
- (id) initWithNativeHandle: (void*)hdl closeOnDealloc: (BOOL)flag
{
#if defined(__MINGW__)
#if defined(__MINGW32__)
return [self initWithFileDescriptor: _open_osfhandle((SOCKET)hdl, 0)
closeOnDealloc: flag];
#else
@ -1385,7 +1385,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
- (void*) nativeHandle
{
#if defined(__MINGW__)
#if defined(__MINGW32__)
return (void*)(SOCKET)_get_osfhandle(descriptor);
#else
return (void*)descriptor;
@ -1530,7 +1530,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
rval = [self write: (char*)ptr+pos length: toWrite];
if (rval < 0)
{
#if defined(__MINGW__)
#if defined(__MINGW32__)
if (WSAGetLastError()== WSAEINTR ||
WSAGetLastError()== WSAEWOULDBLOCK)
#else
@ -1650,7 +1650,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
}
else
#endif
#if defined(__MINGW__)
#if defined(__MINGW32__)
result = _lseek(descriptor, 0, SEEK_CUR);
#else
result = lseek(descriptor, 0, SEEK_CUR);
@ -1678,7 +1678,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
}
else
#endif
#if defined(__MINGW__)
#if defined(__MINGW32__)
result = _lseek(descriptor, 0, SEEK_END);
#else
result = lseek(descriptor, 0, SEEK_END);
@ -1706,7 +1706,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
}
else
#endif
#if defined(__MINGW__)
#if defined(__MINGW32__)
result = _lseek(descriptor, (off_t)pos, SEEK_SET);
#else
result = lseek(descriptor, (off_t)pos, SEEK_SET);
@ -1741,7 +1741,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
gzDescriptor = 0;
}
#endif
#if defined(__MINGW__)
#if defined(__MINGW32__)
if (isSocket)
{
(void)closesocket((SOCKET)_get_osfhandle(descriptor));
@ -1782,7 +1782,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
{
if (isStandardFile)
{
#if defined(__MINGW__)
#if defined(__MINGW32__)
(void)_commit(descriptor);
#else
(void)sync();
@ -1792,7 +1792,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
- (void) truncateFileAtOffset: (unsigned long long)pos
{
#if defined(__MINGW__)
#if defined(__MINGW32__)
_chsize(descriptor, pos);
#else
if (isStandardFile && descriptor >= 0)
@ -1926,7 +1926,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
for (i = 0; i < [modes count]; i++)
{
#if defined(__MINGW__)
#if defined(__MINGW32__)
[l removeEvent: (void*)(gsaddr)event
type: ET_HANDLE
forMode: [modes objectAtIndex: i]
@ -1941,7 +1941,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
}
else
{
#if defined(__MINGW__)
#if defined(__MINGW32__)
[l removeEvent: (void*)(gsaddr)event
type: ET_HANDLE
forMode: NSDefaultRunLoopMode
@ -1980,7 +1980,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
for (i = 0; i < [modes count]; i++)
{
#if defined(__MINGW__)
#if defined(__MINGW32__)
[l removeEvent: (void*)(gsaddr)event
type: ET_HANDLE
forMode: [modes objectAtIndex: i]
@ -1995,7 +1995,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
}
else
{
#if defined(__MINGW__)
#if defined(__MINGW32__)
[l removeEvent: (void*)(gsaddr)event
type: ET_HANDLE
forMode: NSDefaultRunLoopMode
@ -2026,7 +2026,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
for (i = 0; i < [modes count]; i++)
{
#if defined(__MINGW__)
#if defined(__MINGW32__)
[l addEvent: (void*)(gsaddr)event
type: ET_HANDLE
watcher: self
@ -2042,7 +2042,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
}
else
{
#if defined(__MINGW__)
#if defined(__MINGW32__)
[l addEvent: (void*)(gsaddr)event
type: ET_HANDLE
watcher: self
@ -2077,7 +2077,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
for (i = 0; i < [modes count]; i++)
{
#if defined(__MINGW__)
#if defined(__MINGW32__)
[l addEvent: (void*)(gsaddr)event
type: ET_HANDLE
watcher: self
@ -2092,7 +2092,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
}
else
{
#if defined(__MINGW__)
#if defined(__MINGW32__)
[l addEvent: (void*)(gsaddr)event
type: ET_HANDLE
watcher: self
@ -2115,14 +2115,14 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (operation == NSFileHandleConnectionAcceptedNotification)
{
struct sockaddr_in buf;
#if defined(__MINGW__)
#if defined(__MINGW32__)
SOCKET desc;
#else
int desc;
#endif
unsigned int blen = sizeof(buf);
#if defined(__MINGW__)
#if defined(__MINGW32__)
desc = accept((SOCKET)_get_osfhandle(descriptor), (struct sockaddr*)&buf, &blen);
#else
desc = accept(descriptor, (struct sockaddr*)&buf, &blen);
@ -2149,7 +2149,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
setsockopt(desc, SOL_SOCKET, SO_KEEPALIVE, (char *)&status,
sizeof(status));
#if defined(__MINGW__)
#if defined(__MINGW32__)
h = [[[self class] alloc] initWithNativeHandle: (void*)desc
closeOnDealloc: YES];
#else
@ -2200,7 +2200,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
}
else if (received < 0)
{
#if defined(__MINGW__)
#if defined(__MINGW32__)
if (WSAGetLastError() != WSAEINTR
&& WSAGetLastError() != WSAEWOULDBLOCK)
#else
@ -2240,7 +2240,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
int result;
unsigned len = sizeof(result);
#if defined(__MINGW__)
#if defined(__MINGW32__)
if (getsockopt((SOCKET)_get_osfhandle(descriptor), SOL_SOCKET, SO_ERROR,
(char*)&result, &len) == 0 && result != 0)
#else
@ -2279,7 +2279,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
length: length-writePos];
if (written <= 0)
{
#if defined(__MINGW__)
#if defined(__MINGW32__)
if (written < 0 && WSAGetLastError()!= WSAEINTR
&& WSAGetLastError()!= WSAEWOULDBLOCK)
#else
@ -2311,7 +2311,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
extra: (void*)extra
forMode: (NSString*)mode
{
#if defined(__MINGW__)
#if defined(__MINGW32__)
WSANETWORKEVENTS ocurredEvents;
#endif
@ -2321,7 +2321,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
{
[self setNonBlocking: YES];
}
#if defined(__MINGW__)
#if defined(__MINGW32__)
if (WSAEnumNetworkEvents((SOCKET)_get_osfhandle(descriptor),
event, &ocurredEvents) == SOCKET_ERROR)
{
@ -2425,7 +2425,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
}
else
{
#if defined(__MINGW__)
#if defined(__MINGW32__)
unsigned long dummy;
if (isSocket != YES)

View file

@ -284,7 +284,7 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
[[NSProcessInfo processInfo] processIdentifier]];
RETAIN(debugFile);
#ifndef __MINGW__
#if !defined(__MINGW32__)
sslClass = [NSFileHandle sslClass];
#endif
}

View file

@ -46,20 +46,20 @@
#include <unistd.h> /* for gethostname() */
#endif
#ifdef __MINGW__
#if defined(__MINGW32__)
#define close closesocket
#else
#include <sys/param.h> /* for MAXHOSTNAMELEN */
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h> /* for inet_ntoa() */
#endif /* !__MINGW__ */
#endif /* !__MINGW32__ */
#include <errno.h>
#include <limits.h>
#include <string.h> /* for strchr() */
#include <ctype.h> /* for strchr() */
#include <fcntl.h>
#ifdef __MINGW__
#if defined(__MINGW32__)
#include <winsock2.h>
#include <wininet.h>
#include <process.h>
@ -96,7 +96,7 @@
#define SOCKET_ERROR -1
#define INVALID_SOCKET -1
#endif /* !__MINGW__ */
#endif /* !__MINGW32__ */
/*
* Largest chunk of data possible in DO
@ -390,18 +390,18 @@ static Class runLoopClass;
+ (GSTcpHandle*) handleWithDescriptor: (SOCKET)d
{
GSTcpHandle *handle;
#ifdef __MINGW__
#if defined(__MINGW32__)
unsigned long dummy;
#else
int e;
#endif /* __MINGW__ */
#endif /* __MINGW32__ */
if (d == INVALID_SOCKET)
{
NSLog(@"illegal descriptor (%d) for Tcp Handle", d);
return nil;
}
#ifdef __MINGW__
#if defined(__MINGW32__)
dummy = 1;
if (ioctlsocket(d, FIONBIO, &dummy) == SOCKET_ERROR)
{
@ -409,7 +409,7 @@ static Class runLoopClass;
d, GSLastErrorStr(errno));
return nil;
}
#else /* !__MINGW__ */
#else /* !__MINGW32__ */
if ((e = fcntl(d, F_GETFL, 0)) >= 0)
{
e |= NBLK_OPT;
@ -439,7 +439,7 @@ static Class runLoopClass;
{
if (self == [GSTcpHandle class])
{
#ifdef __MINGW__
#if defined(__MINGW32__)
WORD wVersionRequested;
WSADATA wsaData;
@ -540,7 +540,7 @@ static Class runLoopClass;
if (connect(desc, (struct sockaddr*)&sockAddr, sizeof(sockAddr))
== SOCKET_ERROR)
{
#ifdef __MINGW__
#if defined(__MINGW32__)
if (WSAGetLastError() != WSAEWOULDBLOCK)
#else
if (errno != EINPROGRESS)

View file

@ -374,7 +374,7 @@ _find_framework(NSString *name)
bundlePath = [bundlePath stringByDeletingLastPathComponent];
}
/* There are no Versions on MinGW. Skip the Versions check here. */
#if !defined(__MINGW__)
#if !defined(__MINGW32__)
/* version name */
bundlePath = [bundlePath stringByDeletingLastPathComponent];
@ -393,7 +393,7 @@ _find_framework(NSString *name)
if (bundlePath)
bundle = [[self alloc] initWithPath: bundlePath];
}
#if !defined(__MINGW__)
#if !defined(__MINGW32__)
}
#endif
@ -1586,7 +1586,7 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
mangledName = [mangledName stringByReplacingString: @"+"
withString: @"_1"];
#if !defined(__MINGW__)
#if !defined(__MINGW32__)
path = [_path stringByAppendingPathComponent:@"Versions/Current"];
#else
path = _path;
@ -1614,7 +1614,7 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
if (_bundleType == NSBUNDLE_FRAMEWORK)
{
#if !defined(__MINGW__)
#if !defined(__MINGW32__)
return [_path stringByAppendingPathComponent:
[NSString stringWithFormat:@"Versions/%@/Resources",
version]];
@ -1665,7 +1665,7 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
if (_bundleType == NSBUNDLE_FRAMEWORK)
{
#if !defined(__MINGW__)
#if !defined(__MINGW32__)
return [_path stringByAppendingPathComponent:
[NSString stringWithFormat:@"Versions/%@/PlugIns",
version]];
@ -1757,7 +1757,7 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
{
pathlist = [env objectForKey:@"Path"];
}
#if defined(__MINGW__)
#if defined(__MINGW32__)
patharr = [pathlist componentsSeparatedByString:@";"];
#else
patharr = [pathlist componentsSeparatedByString:@":"];

View file

@ -1015,7 +1015,7 @@ static NSLock *cached_proxies_gate = nil;
/*
* Make sure we are not registered.
*/
#ifndef __MINGW__
#if !defined(__MINGW32__)
if ([_receivePort isKindOfClass: [NSMessagePort class]])
{
[self registerName: nil

View file

@ -64,7 +64,7 @@
*
*/
#if defined(__MINGW__)
#if defined(__MINGW32__)
#define UNICODE
#define _UNICODE
#endif
@ -132,7 +132,7 @@ static IMP appendImp;
static BOOL
readContentsOfFile(NSString* path, void** buf, unsigned int* len, NSZone* zone)
{
#if defined(__MINGW__)
#if defined(__MINGW32__)
const unichar *thePath = 0;
#else
const char *thePath = 0;
@ -146,7 +146,7 @@ readContentsOfFile(NSString* path, void** buf, unsigned int* len, NSZone* zone)
zone = GSAtomicMallocZone(); // Use non-GC memory inside NSData
#endif
#if defined(__MINGW__)
#if defined(__MINGW32__)
thePath = (const unichar*)[path fileSystemRepresentation];
#else
thePath = [path fileSystemRepresentation];
@ -157,7 +157,7 @@ readContentsOfFile(NSString* path, void** buf, unsigned int* len, NSZone* zone)
return NO;
}
#if defined(__MINGW__)
#if defined(__MINGW32__)
theFile = _wfopen(thePath, L"rb");
#else
theFile = fopen(thePath, "rb");
@ -819,7 +819,7 @@ static unsigned gsu32Align;
*/
- (BOOL) writeToFile: (NSString*)path atomically: (BOOL)useAuxiliaryFile
{
#if defined(__MINGW__)
#if defined(__MINGW32__)
unsigned int length = [path length];
unichar wthePath[length + 100];
unichar wtheRealPath[length + 100];
@ -831,7 +831,7 @@ static unsigned gsu32Align;
FILE *theFile;
BOOL error_BadPath = YES;
#if defined(__MINGW__)
#if defined(__MINGW32__)
[path getCharacters: wtheRealPath];
wtheRealPath[length] = L'\0';
error_BadPath = (length <= 0);
@ -886,7 +886,7 @@ static unsigned gsu32Align;
/* Use the path name of the destination file as a prefix for the
* mktemp() call so that we can be sure that both files are on
* the same filesystem and the subsequent rename() will work. */
#if defined(__MINGW__)
#if defined(__MINGW32__)
wcscpy(wthePath, wtheRealPath);
wcscat(wthePath, L"XXXXXX");
if (_wmktemp(wthePath) == 0)
@ -909,7 +909,7 @@ static unsigned gsu32Align;
}
else
{
#if defined(__MINGW__)
#if defined(__MINGW32__)
wcscpy(wthePath,wtheRealPath);
#else
strcpy(thePath, theRealPath);
@ -917,7 +917,7 @@ static unsigned gsu32Align;
}
/* Open the file (whether temp or real) for writing. */
#if defined(__MINGW__)
#if defined(__MINGW32__)
theFile = _wfopen(wthePath, L"wb");
#else
theFile = fopen(thePath, "wb");
@ -928,7 +928,7 @@ static unsigned gsu32Align;
{
/* Something went wrong; we weren't
* even able to open the file. */
#if defined(__MINGW__)
#if defined(__MINGW32__)
NSWarnMLog(@"Open (%@) failed - %s",
[NSString stringWithCharacters: wthePath length: wcslen(wthePath)],
GSLastErrorStr(errno));
@ -946,7 +946,7 @@ static unsigned gsu32Align;
if (c < (int)[self length]) /* We failed to write everything for
* some reason. */
{
#if defined(__MINGW__)
#if defined(__MINGW32__)
NSWarnMLog(@"Fwrite (%@) failed - %s",
[NSString stringWithCharacters:wthePath length:wcslen(wthePath)],
GSLastErrorStr(errno));
@ -963,7 +963,7 @@ static unsigned gsu32Align;
* closing the file, but we got here,
* so we need to deal with it. */
{
#if defined(__MINGW__)
#if defined(__MINGW32__)
NSWarnMLog(@"Fclose (%@) failed - %s",
[NSString stringWithCharacters:wthePath length:wcslen(wthePath)],
GSLastErrorStr(errno));
@ -988,7 +988,7 @@ static unsigned gsu32Align;
IF_NO_GC(TEST_AUTORELEASE(att));
}
#if defined(__MINGW__)
#if defined(__MINGW32__)
/*
* The windoze implementation of the POSIX rename() function is buggy
* and doesn't work if the destination file already exists ... so we
@ -1048,7 +1048,7 @@ static unsigned gsu32Align;
#endif
if (c != 0) /* Many things could go wrong, I guess. */
{
#if defined(__MINGW__)
#if defined(__MINGW32__)
NSWarnMLog(@"Rename ('%@' to '%@') failed - %s",
[NSString stringWithCharacters: wthePath length:wcslen(wthePath)],
[NSString stringWithCharacters:
@ -1080,7 +1080,7 @@ static unsigned gsu32Align;
path);
}
}
#ifndef __MINGW__
#ifndef __MINGW32__
else if (geteuid() == 0 && [@"root" isEqualToString: NSUserName()] == NO)
{
att = [NSDictionary dictionaryWithObjectsAndKeys:
@ -1103,7 +1103,7 @@ failure:
*/
if (useAuxiliaryFile)
{
#if defined(__MINGW__)
#if defined(__MINGW32__)
_wunlink(wthePath);
#else
unlink(thePath);
@ -2886,7 +2886,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
{
int fd;
#if defined(__MINGW__)
#if defined(__MINGW32__)
const unichar *thePath = (const unichar*)[path filesystemRepresentation];
#else
const char *thePath = [path fileSystemRepresentation];
@ -2899,7 +2899,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
return nil;
}
#if defined(__MINGW__)
#if defined(__MINGW32__)
fd = _wopen(thePath, _O_RDONLY);
#else
fd = open(thePath, O_RDONLY);

View file

@ -125,7 +125,7 @@ otherTime(NSDate* other)
NSTimeInterval
GSTimeNow(void)
{
#if !defined(__MINGW__)
#if !defined(__MINGW32__)
NSTimeInterval interval;
struct timeval tp;
@ -163,7 +163,7 @@ GSTimeNow(void)
sys_time.wMinute, sys_time.wSecond, sys_time.wMilliseconds);
#endif
return t;
#endif /* __MINGW__ */
#endif /* __MINGW32__ */
}
/**

View file

@ -584,7 +584,7 @@ static NSDistributedNotificationCenter *netCenter = nil;
NSString *description = nil;
NSPortNameServer *ns = nil;
#ifdef __MINGW__
#ifdef __MINGW32__
if (_type == NSLocalNotificationCenterType)
{
ASSIGN(_type, GSPublicNotificationCenterType);

View file

@ -38,7 +38,7 @@
#define _FILE_OFFSET_BITS 64
#if defined(__MINGW__)
#if defined(__MINGW32__)
#define UNICODE
#define _UNICODE
#endif
@ -77,7 +77,7 @@
# include <windows.h>
#endif
#if defined(__MINGW__)
#if defined(__MINGW32__)
#include <stdio.h>
#ifdef UNICODE
#include <wchar.h>
@ -89,7 +89,7 @@
#if defined(_POSIX_VERSION) || defined(__WIN32__)
# include <limits.h> /* for PATH_MAX */
# if defined(__MINGW__)
# if defined(__MINGW32__)
# include <sys/utime.h>
# else
# include <utime.h>
@ -183,7 +183,7 @@
* Macros to handle unichar filesystem support.
*/
#if defined(__MINGW__) && defined(UNICODE)
#if defined(__MINGW32__) && defined(UNICODE)
#define _CHMOD(A,B) _wchmod(A,B)
#define _CLOSEDIR(A) _wclosedir(A)
@ -356,7 +356,7 @@ static NSStringEncoding defaultEncoding;
- (BOOL) changeCurrentDirectoryPath: (NSString*)path
{
const _CHAR *lpath = (_CCP)[self fileSystemRepresentationWithPath: path];
#if defined(__MINGW__)
#if defined(__MINGW32__)
return SetCurrentDirectory(lpath) == TRUE ? YES : NO;
#else
return (chdir(lpath) == 0) ? YES : NO;
@ -383,7 +383,7 @@ static NSStringEncoding defaultEncoding;
}
lpath = (_CCP)[defaultManager fileSystemRepresentationWithPath: path];
#ifndef __MINGW__
#ifndef __MINGW32__
num = [attributes fileOwnerAccountID];
if (num != NSNotFound)
{
@ -456,7 +456,7 @@ static NSStringEncoding defaultEncoding;
ASSIGN(_lastError, str);
}
}
#endif /* __MINGW__ */
#endif /* __MINGW32__ */
num = [attributes filePosixPermissions];
if (num != NSNotFound)
@ -628,7 +628,7 @@ static NSStringEncoding defaultEncoding;
- (BOOL) createDirectoryAtPath: (NSString*)path
attributes: (NSDictionary*)attributes
{
#if defined(__MINGW__)
#if defined(__MINGW32__)
NSEnumerator *paths = [[path pathComponents] objectEnumerator];
NSString *subPath;
NSString *completePath = nil;
@ -644,7 +644,7 @@ static NSStringEncoding defaultEncoding;
if ([path length] == 0)
return NO;
#if defined(__MINGW__)
#if defined(__MINGW32__)
while ((subPath = [paths nextObject]))
{
BOOL isDir = NO;
@ -786,7 +786,7 @@ static NSStringEncoding defaultEncoding;
contents: (NSData*)contents
attributes: (NSDictionary*)attributes
{
#if defined(__MINGW__)
#if defined(__MINGW32__)
const _CHAR *lpath = (_CCP)[self fileSystemRepresentationWithPath: path];
HANDLE fh;
DWORD written = 0;
@ -802,7 +802,7 @@ static NSStringEncoding defaultEncoding;
if ([path length] == 0)
return NO;
#if defined(__MINGW__)
#if defined(__MINGW32__)
fh = CreateFile(lpath, GENERIC_WRITE, 0, 0, CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL, 0);
if (fh == INVALID_HANDLE_VALUE)
@ -878,7 +878,7 @@ static NSStringEncoding defaultEncoding;
{
NSString *currentDir = nil;
#if defined(__MINGW__)
#if defined(__MINGW32__)
int len = GetCurrentDirectory(0, 0);
if (len > 0)
{
@ -1223,7 +1223,7 @@ static NSStringEncoding defaultEncoding;
}
else
{
#if defined(__MINGW__)
#if defined(__MINGW32__)
DWORD res;
res = GetFileAttributes(lpath);
@ -1253,7 +1253,7 @@ static NSStringEncoding defaultEncoding;
if (!is_dir)
{
#if defined(__MINGW__)
#if defined(__MINGW32__)
if (DeleteFile(lpath) == FALSE)
#else
if (unlink(lpath) < 0)
@ -1332,7 +1332,7 @@ static NSStringEncoding defaultEncoding;
return NO;
}
#if defined(__MINGW__)
#if defined(__MINGW32__)
{
DWORD res;
@ -1386,7 +1386,7 @@ static NSStringEncoding defaultEncoding;
return NO;
}
#if defined(__MINGW__)
#if defined(__MINGW32__)
{
DWORD res;
@ -1422,7 +1422,7 @@ static NSStringEncoding defaultEncoding;
return NO;
}
#if defined(__MINGW__)
#if defined(__MINGW32__)
{
DWORD res;
@ -1463,7 +1463,7 @@ static NSStringEncoding defaultEncoding;
return NO;
}
#if defined(__MINGW__)
#if defined(__MINGW32__)
{
DWORD res;
@ -1509,7 +1509,7 @@ static NSStringEncoding defaultEncoding;
return NO;
}
#if defined(__MINGW__)
#if defined(__MINGW32__)
// TODO - handle directories
{
DWORD res;
@ -1641,7 +1641,7 @@ static NSStringEncoding defaultEncoding;
*/
- (NSDictionary*) fileSystemAttributesAtPath: (NSString*)path
{
#if defined(__MINGW__)
#if defined(__MINGW32__)
unsigned long long totalsize, freesize;
id values[5];
id keys[5] = {
@ -1899,7 +1899,7 @@ static NSStringEncoding defaultEncoding;
if (path != nil)
{
#ifdef __MINGW__
#ifdef __MINGW32__
c_path = (_CCP)[path cStringUsingEncoding: NSUnicodeStringEncoding];
#else
c_path = (_CCP)[path cStringUsingEncoding: defaultEncoding];
@ -1926,7 +1926,7 @@ static NSStringEncoding defaultEncoding;
- (NSString*) stringWithFileSystemRepresentation: (const char*)string
length: (unsigned int)len
{
#ifdef __MINGW__
#ifdef __MINGW32__
return [NSString stringWithCharacters: (const unichar*)string length: len/2];
#else
return AUTORELEASE([[NSString allocWithZone: NSDefaultMallocZone()]
@ -2131,7 +2131,7 @@ inline void gsedRelease(GSEnumeratedDirectory X)
if (dirbuf)
{
#if defined(__MINGW__) && defined(UNICODE)
#if defined(__MINGW32__) && defined(UNICODE)
/* Skip "." and ".." directory entries */
if (wcscmp(dirbuf->d_name, L".") == 0
|| wcscmp(dirbuf->d_name, L"..") == 0)
@ -2167,7 +2167,7 @@ inline void gsedRelease(GSEnumeratedDirectory X)
{
// Do not follow links
#ifdef S_IFLNK
#ifdef __MINGW__
#ifdef __MINGW32__
#warning "lstat does not support unichars"
#else
if (!_flags.isFollowing)
@ -2414,7 +2414,7 @@ inline void gsedRelease(GSEnumeratedDirectory X)
toFile: (NSString*)destination
handler: (id)handler
{
#if defined(__MINGW__)
#if defined(__MINGW32__)
if (CopyFile((_CCP)[self fileSystemRepresentationWithPath: source],
(_CCP)[self fileSystemRepresentationWithPath: destination], NO))
{
@ -2758,7 +2758,7 @@ static NSSet *fileKeys = nil;
}
d = (GSAttrDictionary*)NSAllocateObject(self, 0, NSDefaultMallocZone());
#if defined(S_IFLNK) && !defined(__MINGW__)
#if defined(S_IFLNK) && !defined(__MINGW32__)
if (traverse == NO)
{
if (lstat(lpath, &d->statbuf) != 0)

View file

@ -37,7 +37,7 @@
#include "Foundation/NSCoder.h"
#include "Foundation/NSDebug.h"
#if defined(__MINGW__)
#if defined(__MINGW32__)
#include <winsock2.h>
#else
#include <netdb.h>
@ -48,7 +48,7 @@
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#endif /* !__MINGW__*/
#endif /* !__MINGW32__*/
#ifndef INADDR_NONE
#define INADDR_NONE -1

View file

@ -276,7 +276,7 @@ NSLogv (NSString* format, va_list args)
if (_NSLog_printf_handler == NULL)
_NSLog_printf_handler = *_NSLog_standard_printf_handler;
#if defined(__MINGW__)
#if defined(__MINGW32__)
pid = (int)GetCurrentProcessId();
#else
pid = (int)getpid();

View file

@ -48,18 +48,18 @@
#include <unistd.h> /* for gethostname() */
#endif
#ifndef __MINGW__
#ifndef __MINGW32__
#include <sys/param.h> /* for MAXHOSTNAMELEN */
#include <sys/types.h>
#include <sys/un.h>
#include <arpa/inet.h> /* for inet_ntoa() */
#endif /* !__MINGW__ */
#endif /* !__MINGW32__ */
#include <errno.h>
#include <limits.h>
#include <string.h> /* for strchr() */
#include <ctype.h> /* for strchr() */
#include <fcntl.h>
#ifdef __MINGW__
#ifdef __MINGW32__
#include <winsock2.h>
#include <wininet.h>
#include <process.h>
@ -92,9 +92,9 @@
#if defined(__svr4__)
#include <sys/stropts.h>
#endif
#endif /* !__MINGW__ */
#endif /* !__MINGW32__ */
#ifdef __MINGW__
#ifdef __MINGW32__
#define close closesocket
#endif
@ -305,18 +305,18 @@ static Class runLoopClass;
+ (GSMessageHandle*) handleWithDescriptor: (int)d
{
GSMessageHandle *handle;
#ifdef __MINGW__
#ifdef __MINGW32__
unsigned long dummy;
#else
int e;
#endif /* __MINGW__ */
#endif /* __MINGW32__ */
if (d < 0)
{
NSLog(@"illegal descriptor (%d) for message handle", d);
return nil;
}
#ifdef __MINGW__
#ifdef __MINGW32__
dummy = 1;
if (ioctlsocket(d, FIONBIO, &dummy) < 0)
{
@ -324,7 +324,7 @@ static Class runLoopClass;
d, GSLastErrorStr(errno));
return nil;
}
#else /* !__MINGW__ */
#else /* !__MINGW32__ */
if ((e = fcntl(d, F_GETFL, 0)) >= 0)
{
e |= NBLK_OPT;
@ -354,7 +354,7 @@ static Class runLoopClass;
{
if (self == [GSMessageHandle class])
{
#ifdef __MINGW__
#ifdef __MINGW32__
WORD wVersionRequested;
WSADATA wsaData;
@ -413,7 +413,7 @@ static Class runLoopClass;
if (connect(desc, (struct sockaddr*)&sockAddr, SUN_LEN(&sockAddr)) < 0)
{
#ifdef __MINGW__
#ifdef __MINGW32__
if (WSAGetLastError() != WSAEWOULDBLOCK)
#else
if (errno != EINPROGRESS)
@ -618,7 +618,7 @@ static Class runLoopClass;
* Now try to fill the buffer with data.
*/
bytes = [rData mutableBytes];
#ifdef __MINGW__
#ifdef __MINGW32__
res = recv(desc, bytes + rLength, want - rLength, 0);
#else
res = read(desc, bytes + rLength, want - rLength);
@ -940,7 +940,7 @@ static Class runLoopClass;
{
NSData *d = newDataWithEncodedPort([self recvPort]);
#ifdef __MINGW__
#ifdef __MINGW32__
len = send(desc, [d bytes], [d length], 0);
#else
len = write(desc, [d bytes], [d length]);
@ -984,7 +984,7 @@ static Class runLoopClass;
}
b = [wData bytes];
l = [wData length];
#ifdef __MINGW__
#ifdef __MINGW32__
res = send(desc, b + wLength, l - wLength, 0);
#else
res = write(desc, b + wLength, l - wLength);

View file

@ -881,7 +881,7 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
{
extern void GSBuildStrings(void); // See externs.m
#ifdef __MINGW__
#ifdef __MINGW32__
// See libgnustep-base-entry.m
extern void gnustep_base_socket_init(void);
gnustep_base_socket_init();

View file

@ -49,7 +49,7 @@
#include <malloc.h>
#endif
#ifdef __MINGW__
#ifdef __MINGW32__
#include <malloc.h>
static size_t
getpagesize(void)
@ -146,7 +146,7 @@ NSRealMemoryAvailable ()
if ((sysinfo(&info)) != 0)
return 0;
return (unsigned) info.freeram;
#elif defined(__MINGW__)
#elif defined(__MINGW32__)
MEMORYSTATUS memory;
GlobalMemoryStatus(&memory);

View file

@ -803,7 +803,7 @@ NSString *
NSHomeDirectoryForUser(NSString *loginName)
{
NSString *s = nil;
#if !defined(__MINGW__)
#if !defined(__MINGW32__)
struct passwd *pw;
[gnustep_global_lock lock];
@ -1048,7 +1048,7 @@ NSTemporaryDirectory(void)
baseTempDirName = [env objectForKey: @"TMP"];
if (baseTempDirName == nil)
{
#if defined(__MINGW__)
#if defined(__MINGW32__)
#ifdef __CYGWIN__
baseTempDirName = @"/cygdrive/c/";
#else
@ -1087,9 +1087,9 @@ NSTemporaryDirectory(void)
perm = perm & 0777;
// Mateu Batle: secure temporary directories don't work in MinGW
#ifndef __MINGW__
#ifndef __MINGW32__
#if defined(__MINGW__)
#if defined(__MINGW32__)
uid = owner;
#else
#ifdef HAVE_GETEUID
@ -1176,7 +1176,7 @@ NSOpenStepRootDirectory(void)
objectForKey: @"GNUSTEP_ROOT"];
if (root == nil)
{
#if defined(__MINGW__)
#if defined(__MINGW32__)
#ifdef __CYGWIN__
root = @"/cygdrive/c/";
#else

View file

@ -65,7 +65,7 @@
self = [super init];
if (self != nil)
{
#ifndef __MINGW__
#ifndef __MINGW32__
int p[2];
if (pipe(p) == 0)

View file

@ -67,7 +67,7 @@ Class NSPort_concrete_class;
if (self == [NSPort class])
{
NSPort_abstract_class = self;
#ifndef __MINGW__
#ifndef __MINGW32__
/* Must be kept in sync with [NSPortNameServer
+systemDefaultPortNameServer]. */
if (GSUserDefaultsFlag(GSMacOSXCompatible) == YES

View file

@ -69,7 +69,7 @@
/* Must be kept in sync with [NSPort +initialize]. */
if (GSUserDefaultsFlag(GSMacOSXCompatible) == YES)
{
#ifndef __MINGW__
#ifndef __MINGW32__
return [NSMessagePortNameServer sharedInstance];
#else
return [NSSocketPortNameServer sharedInstance];
@ -104,7 +104,7 @@
}
else
{
#ifndef __MINGW__
#ifndef __MINGW32__
return [NSMessagePortNameServer sharedInstance];
#else
return [NSSocketPortNameServer sharedInstance];

View file

@ -210,7 +210,7 @@ _gnu_process_args(int argc, char *argv[], char *env[])
}
else
{
#ifdef __MINGW__
#ifdef __MINGW32__
unichar *buffer;
int buffer_size = 0;
int needed_size = 0;
@ -292,7 +292,7 @@ _gnu_process_args(int argc, char *argv[], char *env[])
i = 0;
while (env[i])
{
#if defined(__MINGW__)
#if defined(__MINGW32__)
char buf[1024];
char *cp;
DWORD len;
@ -738,7 +738,7 @@ _gnu_noobjc_free_vars(void)
}
#else /*! HAVE_PROCFS !HAVE_LOAD_METHOD !HAVE_KVM_ENV */
#ifdef __MINGW__
#ifdef __MINGW32__
/* For WindowsAPI Library, we know the global variables (argc, etc) */
+ (void) initialize
{
@ -775,7 +775,7 @@ int main(int argc, char *argv[], char *env[])
sizeof(_NSConstantStringClassReference));
#endif
#if defined(__MINGW__)
#if defined(__MINGW32__)
WSADATA lpWSAData;
// Initialize Windows Sockets
@ -784,7 +784,7 @@ int main(int argc, char *argv[], char *env[])
printf("Could not startup Windows Sockets\n");
exit(1);
}
#endif /* __MINGW__ */
#endif /* __MINGW32__ */
#ifdef __MS_WIN__
_MB_init_runtime();
@ -796,7 +796,7 @@ int main(int argc, char *argv[], char *env[])
return gnustep_base_user_main(argc, argv, env);
}
#endif /* !GS_PASS_ARGUMENTS */
#endif /* __MINGW__ */
#endif /* __MINGW32__ */
#endif /* HAS_LOAD_METHOD && HAS_PROCFS */
@ -996,7 +996,7 @@ int main(int argc, char *argv[], char *env[])
{
int pid;
#if defined(__MINGW__)
#if defined(__MINGW32__)
pid = (int)GetCurrentProcessId();
#else
pid = (int)getpid();

View file

@ -955,7 +955,7 @@ extern IMP wRetImp;
{
when = min_watcher->_date;
}
#if defined(__MINGW__)
#if defined(__MINGW32__)
// if there are handler for win32 messages
else if (context->msgTarget != nil)
{
@ -1007,7 +1007,7 @@ extern IMP wRetImp;
if ((context == nil || (watchers = context->watchers) == 0
|| (i = GSIArrayCount(watchers)) == 0)
#if defined(__MINGW__)
#if defined(__MINGW32__)
// there are inputs for win32 messages
&& context->msgTarget == 0)
#else

View file

@ -47,20 +47,20 @@
#include <unistd.h> /* for gethostname() */
#endif
#ifdef __MINGW__
#ifdef __MINGW32__
#define close closesocket
#else
#include <sys/param.h> /* for MAXHOSTNAMELEN */
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h> /* for inet_ntoa() */
#endif /* !__MINGW__ */
#endif /* !__MINGW32__ */
#include <errno.h>
#include <limits.h>
#include <string.h> /* for strchr() */
#include <ctype.h> /* for strchr() */
#include <fcntl.h>
#ifdef __MINGW__
#ifdef __MINGW32__
#include <winsock2.h>
#include <wininet.h>
#include <process.h>
@ -97,7 +97,7 @@
#define SOCKET_ERROR -1
#define INVALID_SOCKET -1
#endif /* !__MINGW__ */
#endif /* !__MINGW32__ */
/*
* Largest chunk of data possible in DO
@ -198,7 +198,7 @@ typedef enum {
unsigned nItems; /* Number of items to be read. */
GSHandleState state; /* State of the handle. */
unsigned int addrNum; /* Address number within host. */
#ifdef __MINGW__
#ifdef __MINGW32__
WSAEVENT event; /* Win32 event associated to socket */
WSAEVENT eventTemp; /* Win32 event for asynchronous */
@public
@ -219,7 +219,7 @@ typedef enum {
+ (GSTcpHandle*) handleWithDescriptor: (SOCKET)d;
- (BOOL) connectToPort: (NSSocketPort*)aPort beforeDate: (NSDate*)when;
- (int) descriptor;
#if defined(__MINGW__)
#if defined(__MINGW32__)
- (int) eventHandle;
#endif
- (void) invalidate;
@ -368,13 +368,13 @@ static Class runLoopClass;
+ (GSTcpHandle*) handleWithDescriptor: (SOCKET)d
{
GSTcpHandle *handle;
#ifdef __MINGW__
#ifdef __MINGW32__
unsigned long dummy;
#else
int e;
#endif /* __MINGW__ */
#endif /* __MINGW32__ */
#ifdef __MINGW__
#ifdef __MINGW32__
WSAEVENT ev;
int rc;
#endif
@ -384,7 +384,7 @@ static Class runLoopClass;
NSLog(@"illegal descriptor (%d) for Tcp Handle", d);
return nil;
}
#ifdef __MINGW__
#ifdef __MINGW32__
dummy = 1;
if (ioctlsocket(d, FIONBIO, &dummy) == SOCKET_ERROR)
{
@ -392,7 +392,7 @@ static Class runLoopClass;
d, GSLastErrorStr(errno));
return nil;
}
#else /* !__MINGW__ */
#else /* !__MINGW32__ */
if ((e = fcntl(d, F_GETFL, 0)) >= 0)
{
e |= NBLK_OPT;
@ -415,7 +415,7 @@ static Class runLoopClass;
handle->wMsgs = [NSMutableArray new];
handle->myLock = [GSLazyRecursiveLock new];
handle->valid = YES;
#if defined(__MINGW__)
#if defined(__MINGW32__)
ev = (WSAEVENT)CreateEvent(NULL,NO,NO,NULL);
if (ev == WSA_INVALID_EVENT)
{
@ -436,7 +436,7 @@ static Class runLoopClass;
{
if (self == [GSTcpHandle class])
{
#ifdef __MINGW__
#ifdef __MINGW32__
WORD wVersionRequested;
WSADATA wsaData;
@ -537,7 +537,7 @@ static Class runLoopClass;
if (connect(desc, (struct sockaddr*)&sockAddr, sizeof(sockAddr))
== SOCKET_ERROR)
{
#ifdef __MINGW__
#ifdef __MINGW32__
if (WSAGetLastError() != WSAEWOULDBLOCK)
#else
if (errno != EINPROGRESS)
@ -564,7 +564,7 @@ static Class runLoopClass;
state = GS_H_TRYCON;
l = [NSRunLoop currentRunLoop];
#if defined(__MINGW__)
#if defined(__MINGW32__)
NSAssert(event != WSA_INVALID_EVENT, @"Socket without win32 event!");
[l addEvent: (void*)(gsaddr)event
type: ET_HANDLE
@ -590,7 +590,7 @@ static Class runLoopClass;
M_LOCK(myLock);
}
#if defined(__MINGW__)
#if defined(__MINGW32__)
[l removeEvent: (void*)(gsaddr)event
type: ET_HANDLE
forMode: NSConnectionReplyMode
@ -669,7 +669,7 @@ static Class runLoopClass;
return desc;
}
#if defined(__MINGW__)
#if defined(__MINGW32__)
- (int) eventHandle
{
return (int)event;
@ -694,7 +694,7 @@ static Class runLoopClass;
valid = NO;
l = [runLoopClass currentRunLoop];
#if defined(__MINGW__)
#if defined(__MINGW32__)
[l removeEvent: (void*)(gsaddr)event
type: ET_HANDLE
forMode: nil
@ -716,7 +716,7 @@ static Class runLoopClass;
NSDebugMLLog(@"GSTcpHandle", @"invalidated 0x%x", self);
[[self recvPort] removeHandle: self];
[[self sendPort] removeHandle: self];
#if defined(__MINGW__)
#if defined(__MINGW32__)
WSACloseEvent(event);
event = WSA_INVALID_EVENT;
#endif
@ -783,12 +783,12 @@ static Class runLoopClass;
[self invalidate];
return;
}
#ifdef __MINGW__
#ifdef __MINGW32__
else if (WSAGetLastError()!= WSAEINTR
&& WSAGetLastError()!= WSAEWOULDBLOCK)
#else
else if (errno != EINTR && errno != EAGAIN)
#endif /* !__MINGW__ */
#endif /* !__MINGW32__ */
{
NSDebugMLLog(@"GSTcpHandle",
@"read failed - %s on 0x%x", GSLastErrorStr(errno), self);
@ -1133,23 +1133,23 @@ static Class runLoopClass;
res = send(desc, b + wLength, l - wLength, 0);
if (res < 0)
{
#ifdef __MINGW__
#ifdef __MINGW32__
if (WSAGetLastError()!= WSAEINTR
&& WSAGetLastError()!= WSAEWOULDBLOCK)
#else
if (errno != EINTR && errno != EAGAIN)
#endif /* !__MINGW__ */
#endif /* !__MINGW32__ */
{
NSLog(@"write attempt failed - %s", GSLastErrorStr(errno));
[self invalidate];
return;
}
#ifdef __MINGW__
#ifdef __MINGW32__
if (WSAGetLastError()== WSAEWOULDBLOCK)
{
readyToSend = NO;
}
#endif /* !__MINGW__ */
#endif /* !__MINGW32__ */
}
else
{
@ -1194,7 +1194,7 @@ static Class runLoopClass;
extra: (void*)extra
forMode: (NSString*)mode
{
#if defined(__MINGW__)
#if defined(__MINGW32__)
WSANETWORKEVENTS ocurredEvents;
#endif
NSDebugMLLog(@"GSTcpHandle", @"received %s event on 0x%x",
@ -1207,7 +1207,7 @@ static Class runLoopClass;
{
NSRunLoop *l = [runLoopClass currentRunLoop];
#if defined(__MINGW__)
#if defined(__MINGW32__)
[l removeEvent: data
type: ET_HANDLE
forMode: mode
@ -1227,7 +1227,7 @@ static Class runLoopClass;
M_LOCK(myLock);
#if defined(__MINGW__)
#if defined(__MINGW32__)
if (WSAEnumNetworkEvents(desc, event, &ocurredEvents)==SOCKET_ERROR)
{
NSLog(@"Error getting event type %d", WSAGetLastError());
@ -1324,7 +1324,7 @@ static Class runLoopClass;
RETAIN(self);
#if defined(__MINGW__)
#if defined(__MINGW32__)
NSAssert(event != WSA_INVALID_EVENT, @"Socket without win32 event!");
[l addEvent: (void*)(gsaddr)event
type: ET_HANDLE
@ -1347,7 +1347,7 @@ static Class runLoopClass;
&& [when timeIntervalSinceNow] > 0)
{
M_UNLOCK(myLock);
#if defined(__MINGW__)
#if defined(__MINGW32__)
if (readyToSend)
{
[self receivedEventWrite];
@ -1362,7 +1362,7 @@ static Class runLoopClass;
M_LOCK(myLock);
}
#if defined(__MINGW__)
#if defined(__MINGW32__)
[l removeEvent: (void*)(gsaddr)event
type: ET_HANDLE
forMode: NSConnectionReplyMode
@ -1548,7 +1548,7 @@ static unsigned wordAlign;
port->address = [addr copy];
port->handles = NSCreateMapTable(NSIntMapKeyCallBacks,
NSObjectMapValueCallBacks, 0);
#if defined(__MINGW__)
#if defined(__MINGW32__)
port->eventListener = WSA_INVALID_EVENT;
port->events = NSCreateMapTable(NSIntMapKeyCallBacks,
NSIntMapValueCallBacks, 0);
@ -1644,7 +1644,7 @@ static unsigned wordAlign;
}
else
{
#if defined(__MINGW__)
#if defined(__MINGW32__)
int rc;
#endif
/*
@ -1654,7 +1654,7 @@ static unsigned wordAlign;
*/
port->listener = desc;
port->portNum = GSSwapBigI16ToHost(sockaddr.sin_port);
#if defined(__MINGW__)
#if defined(__MINGW32__)
port->eventListener = (WSAEVENT)CreateEvent(NULL,NO,NO,NULL);
if (port->eventListener == WSA_INVALID_EVENT)
{
@ -1737,7 +1737,7 @@ static unsigned wordAlign;
handle->recvPort = GS_GC_HIDE(self);
}
NSMapInsert(handles, (void*)(gsaddr)[handle descriptor], (void*)handle);
#if defined(__MINGW__)
#if defined(__MINGW32__)
NSMapInsert(events, (void*)(gsaddr)[handle eventHandle],
(void*)(gsaddr)[handle descriptor]);
#endif
@ -1790,7 +1790,7 @@ static unsigned wordAlign;
* This is a callback method used by the NSRunLoop class to determine which
* descriptors to watch for the port.
*/
#if defined(__MINGW__)
#if defined(__MINGW32__)
- (void) getFds: (int*)fds count: (int*)count
{
NSMapEnumerator me;
@ -2029,7 +2029,7 @@ static unsigned wordAlign;
{
(void) close(listener);
listener = -1;
#if defined(__MINGW__)
#if defined(__MINGW32__)
WSACloseEvent(eventListener);
eventListener = WSA_INVALID_EVENT;
#endif
@ -2058,7 +2058,7 @@ static unsigned wordAlign;
handles = 0;
}
}
#if defined(__MINGW__)
#if defined(__MINGW32__)
if (events != 0)
{
NSFreeMapTable(events);
@ -2100,7 +2100,7 @@ static unsigned wordAlign;
extra: (void*)extra
forMode: (NSString*)mode
{
#if defined(__MINGW__)
#if defined(__MINGW32__)
WSAEVENT event = (WSAEVENT)extra;
SOCKET desc;
#else
@ -2111,7 +2111,7 @@ static unsigned wordAlign;
NSDebugMLLog(@"NSPort", @"received %s event on 0x%x",
type == ET_RPORT ? "read" : "write", self);
#if defined(__MINGW__)
#if defined(__MINGW32__)
if (event == eventListener)
#else
if (desc == listener)
@ -2131,7 +2131,7 @@ static unsigned wordAlign;
setsockopt(desc, SOL_SOCKET, SO_KEEPALIVE, (char*)&status,
sizeof(status));
#if defined(__MINGW__)
#if defined(__MINGW32__)
// reset associated event with new socket
WSAEventSelect(desc, eventListener, 0);
#endif
@ -2152,7 +2152,7 @@ static unsigned wordAlign;
else
{
M_LOCK(myLock);
#if defined(__MINGW__)
#if defined(__MINGW32__)
desc = (SOCKET)NSMapGet(events, (void*)(gsaddr)event);
#endif
handle = (GSTcpHandle*)NSMapGet(handles, (void*)(gsaddr)desc);
@ -2162,7 +2162,7 @@ static unsigned wordAlign;
{
const char *t;
#if defined(__MINGW__)
#if defined(__MINGW32__)
if (type == ET_HANDLE) t = "winhandle";
#else
if (type == ET_RDESC) t = "rdesc";
@ -2212,7 +2212,7 @@ static unsigned wordAlign;
handle->recvPort = nil;
}
NSMapRemove(handles, (void*)(gsaddr)[handle descriptor]);
#if defined(__MINGW__)
#if defined(__MINGW32__)
NSMapRemove(events, (void*)(gsaddr)[handle eventHandle]);
#endif
if (((int) listener) < 0 && NSCountMapTable(handles) == 0)

View file

@ -42,7 +42,7 @@
#include "Foundation/NSPathUtilities.h"
#include "Foundation/NSPortNameServer.h"
#include "Foundation/NSDebug.h"
#ifdef __MINGW__
#ifdef __MINGW32__
#include <winsock2.h>
#include <wininet.h>
#else

View file

@ -4121,7 +4121,7 @@ static NSFileManager *fm = nil;
- (NSString*) stringByResolvingSymlinksInPath
{
#if defined(__MINGW__)
#if defined(__MINGW32__)
return IMMUTABLE(self);
#else
#ifndef MAX_PATH
@ -4284,7 +4284,7 @@ static NSFileManager *fm = nil;
}
return [[NSFileManager defaultManager]
stringWithFileSystemRepresentation: newBuf length: strlen(newBuf)];
#endif /* (__MINGW__) */
#endif /* (__MINGW32__) */
}
- (NSString*) stringByStandardizingPath
@ -4377,7 +4377,7 @@ static NSFileManager *fm = nil;
* For absolute paths, we must resolve symbolic links or (on MINGW)
* remove '/../' sequences and their matching parent directories.
*/
#if defined(__MINGW__)
#if defined(__MINGW32__)
/* Condense `/../' */
r = (NSRange){root, l-root};
while ((r = [s rangeOfString: @"/.." options: 0 range: r]).length == 3)
@ -4543,7 +4543,7 @@ static NSFileManager *fm = nil;
*/
if (c == '/')
{
#if defined(__MINGW__)
#if defined(__MINGW32__)
if (GSPathHandlingUnix() == YES)
{
return YES;

View file

@ -109,12 +109,12 @@ static BOOL hadChildSignal = NO;
static void handleSignal(int sig)
{
hadChildSignal = YES;
#ifndef __MINGW__
#ifndef __MINGW32__
signal(SIGCHLD, handleSignal);
#endif
}
#ifdef __MINGW__
#ifdef __MINGW32__
@interface NSConcreteWindowsTask : NSTask
{
@public
@ -254,7 +254,7 @@ pty_slave(const char* name)
}
[gnustep_global_lock unlock];
#ifndef __MINGW__
#ifndef __MINGW32__
signal(SIGCHLD, handleSignal);
#endif
}
@ -349,7 +349,7 @@ pty_slave(const char* name)
return;
}
#ifndef __MINGW__
#ifndef __MINGW32__
#ifdef HAVE_KILLPG
killpg(_taskId, SIGINT);
#else
@ -417,7 +417,7 @@ pty_slave(const char* name)
[NSException raise: NSInvalidArgumentException
format: @"NSTask - task has not yet launched"];
}
#ifndef __MINGW__
#ifndef __MINGW32__
#ifdef HAVE_KILLPG
killpg(_taskId, SIGCONT);
#else
@ -608,7 +608,7 @@ pty_slave(const char* name)
[NSException raise: NSInvalidArgumentException
format: @"NSTask - task has not yet launched"];
}
#ifndef __MINGW__
#ifndef __MINGW32__
#ifdef HAVE_KILLPG
killpg(_taskId, SIGSTOP);
#else
@ -640,7 +640,7 @@ pty_slave(const char* name)
}
_hasTerminated = YES;
#ifndef __MINGW__
#ifndef __MINGW32__
#ifdef HAVE_KILLPG
killpg(_taskId, SIGTERM);
#else
@ -741,7 +741,7 @@ pty_slave(const char* name)
full_path = [arch_path stringByAppendingPathComponent: libs];
lpath = [full_path stringByAppendingPathComponent: prog];
#ifdef __MINGW__
#ifdef __MINGW32__
if ([mgr isExecutableFileAtPath: lpath] == NO
&& [mgr isExecutableFileAtPath:
(lpath = [lpath stringByAppendingPathExtension: @"exe"])] == NO)
@ -750,7 +750,7 @@ pty_slave(const char* name)
#endif
{
lpath = [arch_path stringByAppendingPathComponent: prog];
#ifdef __MINGW__
#ifdef __MINGW32__
if ([mgr isExecutableFileAtPath: lpath] == NO
&& [mgr isExecutableFileAtPath:
(lpath = [lpath stringByAppendingPathExtension: @"exe"])] == NO)
@ -759,7 +759,7 @@ pty_slave(const char* name)
#endif
{
lpath = [base_path stringByAppendingPathComponent: prog];
#ifdef __MINGW__
#ifdef __MINGW32__
if ([mgr isExecutableFileAtPath: lpath] == NO
&& [mgr isExecutableFileAtPath:
(lpath = [lpath stringByAppendingPathExtension: @"exe"])] == NO)
@ -778,7 +778,7 @@ pty_slave(const char* name)
}
if (lpath != nil)
{
#ifdef __MINGW__
#ifdef __MINGW32__
if ([mgr isExecutableFileAtPath: lpath] == NO
&& [mgr isExecutableFileAtPath:
(lpath = [lpath stringByAppendingPathExtension: @"exe"])]
@ -903,7 +903,7 @@ pty_slave(const char* name)
@end
#ifdef __MINGW__
#ifdef __MINGW32__
@implementation NSConcreteWindowsTask
BOOL
@ -1402,7 +1402,7 @@ GSCheckTasks()
setpgrp(getpid(), getpid());
#endif
#else
#if defined(__MINGW__)
#if defined(__MINGW32__)
pid = (int)GetCurrentProcessId(),
#else
pid = (int)getpid();

View file

@ -162,7 +162,7 @@ GSSleepUntilIntervalSinceReferenceDate(NSTimeInterval when)
while (delay > 30.0*60.0)
{
// sleep 30 minutes
#if defined(__MINGW__)
#if defined(__MINGW32__)
Sleep (30*60*1000);
#else
sleep (30*60);
@ -179,7 +179,7 @@ GSSleepUntilIntervalSinceReferenceDate(NSTimeInterval when)
#ifdef HAVE_USLEEP
usleep ((int)(delay*1000000));
#else
#if defined(__MINGW__)
#if defined(__MINGW32__)
Sleep (delay*1000);
#else
sleep ((int)delay);
@ -793,7 +793,7 @@ gnustep_base_thread_callback(void)
@implementation GSPerformHolder
static NSLock *subthreadsLock = nil;
#ifdef __MINGW__
#ifdef __MINGW32__
static HANDLE event;
#else
static int inputFd = -1;
@ -813,7 +813,7 @@ static NSDate *theFuture;
subthreadsLock = [[NSLock alloc] init];
perfArray = [[NSMutableArray alloc] initWithCapacity: 10];
#ifndef __MINGW__
#ifndef __MINGW32__
{
int fd[2];
@ -877,7 +877,7 @@ static NSDate *theFuture;
[perfArray addObject: h];
#if defined(__MINGW__)
#if defined(__MINGW32__)
if (SetEvent(event) == 0)
{
NSLog(@"Set event failed - %@", GSLastErrorStr(errno));
@ -906,7 +906,7 @@ static NSDate *theFuture;
[subthreadsLock lock];
#if defined(__MINGW__)
#if defined(__MINGW32__)
if (ResetEvent(event) == 0)
{
NSLog(@"Reset event failed - %@", GSLastErrorStr(errno));

View file

@ -910,7 +910,7 @@ static NSMapTable *absolutes = 0;
/* Read dictionary from file. */
abbreviationMap = [[NSMutableDictionary alloc] init];
path = _time_zone_path (ABBREV_MAP, nil);
#if defined(__MINGW__)
#if defined(__MINGW32__)
{
unichar mode[3];
mode[0] = 'r';
@ -1336,7 +1336,7 @@ static NSMapTable *absolutes = 0;
temp_array[i] = [NSMutableArray array];
fileName = _time_zone_path (REGIONS_FILE, nil);
#if defined(__MINGW__)
#if defined(__MINGW32__)
{
unichar mode[3];
mode[0] = 'r';

View file

@ -609,7 +609,7 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
{
currLang = [NSArray arrayWithObject: GSLanguageFromLocale(locale)];
}
#ifdef __MINGW__
#ifdef __MINGW32__
if (currLang == nil && locale != nil)
{
/* Check for language as the first part of the locale string */

View file

@ -106,7 +106,7 @@ objc_initialize_loading(FILE *errorStream)
dynamic_loaded = NO;
path = objc_executable_location();
#ifdef __MINGW__
#ifdef __MINGW32__
NSDebugFLLog(@"NSBundle",
@"Debug (objc-load): initializing dynamic loader for %S",
path);
@ -177,7 +177,7 @@ objc_load_module (const char *filename,
_objc_load_callback = objc_load_callback;
/* Link in the object file */
#ifdef __MINGW__
#ifdef __MINGW32__
NSDebugFLLog(@"NSBundle",
@"Debug (objc-load): Linking file %S\n", filename);
#else
@ -288,7 +288,7 @@ objc_unload_modules(FILE *errorStream,
return 0;
}
#ifdef __MINGW__
#ifdef __MINGW32__
NSString *
objc_get_symbol_path(Class theClass, Category *theCategory)
{

View file

@ -501,7 +501,7 @@ int main (int argc, char *argv[], char **env)
unsigned connect_attempts;
NSAutoreleasePool *arp;
Auth *auth;
#ifndef __MINGW__
#ifndef __MINGW32__
extern int optind;
extern char *optarg;
#endif

View file

@ -476,7 +476,7 @@ int main(int argc, char *argv[], char **env)
id o = [[NSObject alloc] init];
NSConnection *c;
NSAutoreleasePool *arp = [NSAutoreleasePool new];
#ifndef __MINGW__
#ifndef __MINGW32__
extern int optind;
extern char *optarg;
#endif

View file

@ -38,7 +38,7 @@ main()
name: NSTaskDidTerminateNotification
object: nil];
#ifdef __MINGW__
#ifdef __MINGW32__
task = [NSTask launchedTaskWithLaunchPath: @"C:\\windows\\system32\\mem.exe"
arguments: nil];
#else

View file

@ -8,7 +8,7 @@
This file is part of the GNUstep Base Library.
*/
#if (defined __MINGW__)
#if (defined __MINGW32__)
/* A simple implementation of getopt() */
static int
indexof(char c, char *string)

View file

@ -24,7 +24,7 @@
#include <stdio.h>
#include <unistd.h>
#ifdef __MINGW__
#ifdef __MINGW32__
#include "process.h"
#endif
@ -395,7 +395,7 @@ ihandler(int sig)
}
else
{
#ifdef __MINGW__
#ifdef __MINGW32__
isPublic = YES;
#else
isLocal = YES;
@ -425,7 +425,7 @@ ihandler(int sig)
port = (NSPort*)[NSSocketPort port];
}
}
#ifndef __MINGW__
#ifndef __MINGW32__
else
{
hostname = @"";
@ -1108,7 +1108,7 @@ main(int argc, char** argv, char** env)
{
signal(sym, ihandler);
}
#ifndef __MINGW__
#ifndef __MINGW32__
signal(SIGPIPE, SIG_IGN);
signal(SIGTTOU, SIG_IGN);
signal(SIGTTIN, SIG_IGN);
@ -1130,7 +1130,7 @@ main(int argc, char** argv, char** env)
*/
[[NSFileHandle fileHandleWithStandardInput] closeFile];
[[NSFileHandle fileHandleWithStandardOutput] closeFile];
#ifndef __MINGW__
#ifndef __MINGW32__
if (debugging == NO)
{
[[NSFileHandle fileHandleWithStandardError] closeFile];

View file

@ -71,7 +71,7 @@ main(int argc, char** argv, char **env)
NSString *name = [[args objectAtIndex: 1] lowercaseString];
NSString *sep;
#ifdef __MINGW__
#ifdef __MINGW32__
sep = @";";
#else
sep = @":";