diff options
author | Alan Coopersmith <alan.coopersmith@sun.com> | 2009-06-14 09:10:06 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@sun.com> | 2009-06-14 09:35:23 -0700 |
commit | 5bad478221c54c0dbf682ef2569f6ca5ac050049 (patch) | |
tree | 40661e1b52327cdc74c7cd88b3514bbbb23955e2 | |
parent | 1f59b5f8eac522bb0a5155393224496c39deca42 (diff) |
Use indentation to provide a map through the twisty maze of ifdefs, all alike
git diff -w shows no changes other than whitespace in this patch
Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
-rw-r--r-- | Xarch.h | 104 | ||||
-rw-r--r-- | Xfuncs.h | 100 | ||||
-rw-r--r-- | Xmd.h | 134 | ||||
-rw-r--r-- | Xos.h | 186 | ||||
-rw-r--r-- | Xos_r.h | 2 | ||||
-rw-r--r-- | Xosdefs.h | 116 | ||||
-rw-r--r-- | Xthreads.h | 400 | ||||
-rw-r--r-- | Xw32defs.h | 138 | ||||
-rw-r--r-- | Xwindows.h | 20 | ||||
-rw-r--r-- | Xwinsock.h | 8 |
10 files changed, 604 insertions, 604 deletions
@@ -1,5 +1,5 @@ #ifndef _XARCH_H_ -#define _XARCH_H_ +# define _XARCH_H_ /* * Copyright 1997 Metro Link Incorporated @@ -32,64 +32,64 @@ */ /* See if it is set in the imake config first */ -#ifdef X_BYTE_ORDER +# ifdef X_BYTE_ORDER -#define X_BIG_ENDIAN 4321 -#define X_LITTLE_ENDIAN 1234 +# define X_BIG_ENDIAN 4321 +# define X_LITTLE_ENDIAN 1234 -#else +# else -#ifdef SVR4 -#if !defined(sun) -#include <sys/byteorder.h> -#endif -#elif defined(CSRG_BASED) -#if defined(__NetBSD__) || defined(__OpenBSD__) -#include <sys/types.h> -#endif -#include <machine/endian.h> -#elif defined(linux) -#if defined __STRICT_ANSI__ -#undef __STRICT_ANSI__ -#include <endian.h> -#define __STRICT_ANSI__ -#else -#include <endian.h> -#endif +# ifdef SVR4 +# if !defined(sun) +# include <sys/byteorder.h> +# endif +# elif defined(CSRG_BASED) +# if defined(__NetBSD__) || defined(__OpenBSD__) +# include <sys/types.h> +# endif +# include <machine/endian.h> +# elif defined(linux) +# if defined __STRICT_ANSI__ +# undef __STRICT_ANSI__ +# include <endian.h> +# define __STRICT_ANSI__ +# else +# include <endian.h> +# endif /* 'endian.h' might have been included before 'Xarch.h' */ -#if !defined(LITTLE_ENDIAN) && defined(__LITTLE_ENDIAN) -#define LITTLE_ENDIAN __LITTLE_ENDIAN -#endif -#if !defined(BIG_ENDIAN) && defined(__BIG_ENDIAN) -#define BIG_ENDIAN __BIG_ENDIAN -#endif -#if !defined(PDP_ENDIAN) && defined(__PDP_ENDIAN) -#define PDP_ENDIAN __PDP_ENDIAN -#endif -#if !defined(BYTE_ORDER) && defined(__BYTE_ORDER) -#define BYTE_ORDER __BYTE_ORDER -#endif -#endif +# if !defined(LITTLE_ENDIAN) && defined(__LITTLE_ENDIAN) +# define LITTLE_ENDIAN __LITTLE_ENDIAN +# endif +# if !defined(BIG_ENDIAN) && defined(__BIG_ENDIAN) +# define BIG_ENDIAN __BIG_ENDIAN +# endif +# if !defined(PDP_ENDIAN) && defined(__PDP_ENDIAN) +# define PDP_ENDIAN __PDP_ENDIAN +# endif +# if !defined(BYTE_ORDER) && defined(__BYTE_ORDER) +# define BYTE_ORDER __BYTE_ORDER +# endif +# endif -#ifndef BYTE_ORDER -#define LITTLE_ENDIAN 1234 -#define BIG_ENDIAN 4321 +# ifndef BYTE_ORDER +# define LITTLE_ENDIAN 1234 +# define BIG_ENDIAN 4321 -#if defined(sun) && defined(SVR4) -#include <sys/isa_defs.h> -#ifdef _LITTLE_ENDIAN -#define BYTE_ORDER LITTLE_ENDIAN -#endif -#ifdef _BIG_ENDIAN -#define BYTE_ORDER BIG_ENDIAN -#endif -#endif /* sun */ -#endif /* BYTE_ORDER */ +# if defined(sun) && defined(SVR4) +# include <sys/isa_defs.h> +# ifdef _LITTLE_ENDIAN +# define BYTE_ORDER LITTLE_ENDIAN +# endif +# ifdef _BIG_ENDIAN +# define BYTE_ORDER BIG_ENDIAN +# endif +# endif /* sun */ +# endif /* BYTE_ORDER */ -#define X_BYTE_ORDER BYTE_ORDER -#define X_BIG_ENDIAN BIG_ENDIAN -#define X_LITTLE_ENDIAN LITTLE_ENDIAN +# define X_BYTE_ORDER BYTE_ORDER +# define X_BIG_ENDIAN BIG_ENDIAN +# define X_LITTLE_ENDIAN LITTLE_ENDIAN -#endif /* not in imake config */ +# endif /* not in imake config */ #endif /* _XARCH_H_ */ @@ -25,70 +25,70 @@ in this Software without prior written authorization from The Open Group. */ #ifndef _XFUNCS_H_ -#define _XFUNCS_H_ +# define _XFUNCS_H_ -#include <X11/Xosdefs.h> +# include <X11/Xosdefs.h> /* the old Xfuncs.h, for pre-R6 */ -#if !(defined(XFree86LOADER) && defined(IN_MODULE)) +# if !(defined(XFree86LOADER) && defined(IN_MODULE)) -#ifdef X_USEBFUNCS +# ifdef X_USEBFUNCS void bcopy(); void bzero(); int bcmp(); -#else -#if defined(SYSV) && !defined(__SCO__) && !defined(sun) && !defined(__UNIXWARE__) -#include <memory.h> +# else +# if defined(SYSV) && !defined(__SCO__) && !defined(sun) && !defined(__UNIXWARE__) +# include <memory.h> void bcopy(); -#define bzero(b,len) memset(b, 0, len) -#define bcmp(b1,b2,len) memcmp(b1, b2, len) -#else -#include <string.h> -#if defined(__SCO__) || defined(sun) || defined(__UNIXWARE__) -#include <strings.h> -#endif -#define _XFUNCS_H_INCLUDED_STRING_H -#if defined(sun) -#define bcopy(b1,b2,len) memmove(b2, b1, (size_t)(len)) -#define bzero(b,len) memset(b, 0, (size_t)(len)) -#define bcmp(b1,b2,len) memcmp(b1, b2, (size_t)(len)) -#endif -#endif -#endif /* X_USEBFUNCS */ +# define bzero(b,len) memset(b, 0, len) +# define bcmp(b1,b2,len) memcmp(b1, b2, len) +# else +# include <string.h> +# if defined(__SCO__) || defined(sun) || defined(__UNIXWARE__) +# include <strings.h> +# endif +# define _XFUNCS_H_INCLUDED_STRING_H +# if defined(sun) +# define bcopy(b1,b2,len) memmove(b2, b1, (size_t)(len)) +# define bzero(b,len) memset(b, 0, (size_t)(len)) +# define bcmp(b1,b2,len) memcmp(b1, b2, (size_t)(len)) +# endif +# endif +# endif /* X_USEBFUNCS */ /* the new Xfuncs.h */ -#if (!defined(sun) || defined(SVR4)) +# if (!defined(sun) || defined(SVR4)) /* the ANSI C way */ -#ifndef _XFUNCS_H_INCLUDED_STRING_H -#include <string.h> -#endif -#undef bzero -#define bzero(b,len) memset(b,0,len) -#else -#if defined(SYSV) || defined(sun) -#include <memory.h> -#define memmove(dst,src,len) bcopy((char *)(src),(char *)(dst),(int)(len)) -#if defined(SYSV) && defined(_XBCOPYFUNC) -#undef memmove -#define memmove(dst,src,len) _XBCOPYFUNC((char *)(src),(char *)(dst),(int)(len)) -#define _XNEEDBCOPYFUNC -#endif -#else /* else vanilla BSD */ -#define memmove(dst,src,len) bcopy((char *)(src),(char *)(dst),(int)(len)) -#define memcpy(dst,src,len) bcopy((char *)(src),(char *)(dst),(int)(len)) -#define memcmp(b1,b2,len) bcmp((char *)(b1),(char *)(b2),(int)(len)) -#endif /* SYSV else */ -#endif +# ifndef _XFUNCS_H_INCLUDED_STRING_H +# include <string.h> +# endif +# undef bzero +# define bzero(b,len) memset(b,0,len) +# else +# if defined(SYSV) || defined(sun) +# include <memory.h> +# define memmove(dst,src,len) bcopy((char *)(src),(char *)(dst),(int)(len)) +# if defined(SYSV) && defined(_XBCOPYFUNC) +# undef memmove +# define memmove(dst,src,len) _XBCOPYFUNC((char *)(src),(char *)(dst),(int)(len)) +# define _XNEEDBCOPYFUNC +# endif +# else /* else vanilla BSD */ +# define memmove(dst,src,len) bcopy((char *)(src),(char *)(dst),(int)(len)) +# define memcpy(dst,src,len) bcopy((char *)(src),(char *)(dst),(int)(len)) +# define memcmp(b1,b2,len) bcmp((char *)(b1),(char *)(b2),(int)(len)) +# endif /* SYSV else */ +# endif -#if (defined(sun) && !defined(SVR4)) -#define atexit(f) on_exit(f, 0) -#endif +# if (defined(sun) && !defined(SVR4)) +# define atexit(f) on_exit(f, 0) +# endif -#if defined WIN32 && defined __MINGW32__ -#define bcopy(b1,b2,len) memmove(b2, b1, (size_t)(len)) -#endif +# if defined WIN32 && defined __MINGW32__ +# define bcopy(b1,b2,len) memmove(b2, b1, (size_t)(len)) +# endif -#endif /* !(defined(XFree86LOADER) && defined(IN_MODULE)) */ +# endif /* !(defined(XFree86LOADER) && defined(IN_MODULE)) */ #endif /* _XFUNCS_H_ */ @@ -45,7 +45,7 @@ SOFTWARE. ******************************************************************/ #ifndef XMD_H -#define XMD_H 1 +# define XMD_H 1 /* * Xmd.h: MACHINE DEPENDENT DECLARATIONS. */ @@ -53,28 +53,28 @@ SOFTWARE. /* * Special per-machine configuration flags. */ -#if defined(sun) && defined(__SVR4) -# include <sys/isa_defs.h> /* Solaris: defines _LP64 if necessary */ -#endif - -#if defined (_LP64) || \ - defined(__alpha) || defined(__alpha__) || \ - defined(__ia64__) || defined(ia64) || \ - defined(__sparc64__) || \ - defined(__s390x__) || \ - defined(__hppa__) && defined(__LP64__) || \ - defined(__amd64__) || defined(amd64) || \ - defined(__powerpc64__) -#define LONG64 /* 32/64-bit architecture */ -#endif +# if defined(sun) && defined(__SVR4) +# include <sys/isa_defs.h> /* Solaris: defines _LP64 if necessary */ +# endif + +# if defined (_LP64) || \ + defined(__alpha) || defined(__alpha__) || \ + defined(__ia64__) || defined(ia64) || \ + defined(__sparc64__) || \ + defined(__s390x__) || \ + defined(__hppa__) && defined(__LP64__) || \ + defined(__amd64__) || defined(amd64) || \ + defined(__powerpc64__) +# define LONG64 /* 32/64-bit architecture */ +# endif /* * Stuff to handle large architecture machines; the constants were generated * on a 32-bit machine and must correspond to the protocol. */ -#ifdef WORD64 -#define MUSTCOPY -#endif /* WORD64 */ +# ifdef WORD64 +# define MUSTCOPY +# endif /* WORD64 */ /* @@ -91,49 +91,49 @@ SOFTWARE. * The extra indirection is to get macro arguments to expand correctly before * the concatenation, rather than afterward. */ -#define _SIZEOF(x) sz_##x -#define SIZEOF(x) _SIZEOF(x) +# define _SIZEOF(x) sz_##x +# define SIZEOF(x) _SIZEOF(x) /* * Bitfield suffixes for the protocol structure elements, if you * need them. Note that bitfields are not guaranteed to be signed * (or even unsigned) according to ANSI C. */ -#ifdef WORD64 +# ifdef WORD64 typedef long INT64; typedef unsigned long CARD64; -#define B32 :32 -#define B16 :16 -#ifdef UNSIGNEDBITFIELDS +# define B32 :32 +# define B16 :16 +# ifdef UNSIGNEDBITFIELDS typedef unsigned int INT32; typedef unsigned int INT16; -#else +# else typedef signed int INT32; typedef signed int INT16; -#endif -#else -#define B32 -#define B16 -#ifdef LONG64 +# endif +# else +# define B32 +# define B16 +# ifdef LONG64 typedef long INT64; typedef int INT32; -#else +# else typedef long INT32; -#endif +# endif typedef short INT16; -#endif +# endif typedef signed char INT8; -#ifdef LONG64 +# ifdef LONG64 typedef unsigned long CARD64; typedef unsigned int CARD32; -#else +# else typedef unsigned long CARD32; -#endif -#if !defined(WORD64) && !defined(LONG64) +# endif +# if !defined(WORD64) && !defined(LONG64) typedef unsigned long long CARD64; -#endif +# endif typedef unsigned short CARD16; typedef unsigned char CARD8; @@ -146,41 +146,41 @@ typedef CARD8 BOOL; /* * definitions for sign-extending bitfields on 64-bit architectures */ -#if defined(WORD64) && defined(UNSIGNEDBITFIELDS) -#define cvtINT8toInt(val) (((val) & 0x00000080) ? ((val) | 0xffffffffffffff00) : (val)) -#define cvtINT16toInt(val) (((val) & 0x00008000) ? ((val) | 0xffffffffffff0000) : (val)) -#define cvtINT32toInt(val) (((val) & 0x80000000) ? ((val) | 0xffffffff00000000) : (val)) -#define cvtINT8toShort(val) cvtINT8toInt(val) -#define cvtINT16toShort(val) cvtINT16toInt(val) -#define cvtINT32toShort(val) cvtINT32toInt(val) -#define cvtINT8toLong(val) cvtINT8toInt(val) -#define cvtINT16toLong(val) cvtINT16toInt(val) -#define cvtINT32toLong(val) cvtINT32toInt(val) -#else -#define cvtINT8toInt(val) (val) -#define cvtINT16toInt(val) (val) -#define cvtINT32toInt(val) (val) -#define cvtINT8toShort(val) (val) -#define cvtINT16toShort(val) (val) -#define cvtINT32toShort(val) (val) -#define cvtINT8toLong(val) (val) -#define cvtINT16toLong(val) (val) -#define cvtINT32toLong(val) (val) -#endif /* WORD64 and UNSIGNEDBITFIELDS */ - - - -#ifdef MUSTCOPY +# if defined(WORD64) && defined(UNSIGNEDBITFIELDS) +# define cvtINT8toInt(val) (((val) & 0x00000080) ? ((val) | 0xffffffffffffff00) : (val)) +# define cvtINT16toInt(val) (((val) & 0x00008000) ? ((val) | 0xffffffffffff0000) : (val)) +# define cvtINT32toInt(val) (((val) & 0x80000000) ? ((val) | 0xffffffff00000000) : (val)) +# define cvtINT8toShort(val) cvtINT8toInt(val) +# define cvtINT16toShort(val) cvtINT16toInt(val) +# define cvtINT32toShort(val) cvtINT32toInt(val) +# define cvtINT8toLong(val) cvtINT8toInt(val) +# define cvtINT16toLong(val) cvtINT16toInt(val) +# define cvtINT32toLong(val) cvtINT32toInt(val) +# else +# define cvtINT8toInt(val) (val) +# define cvtINT16toInt(val) (val) +# define cvtINT32toInt(val) (val) +# define cvtINT8toShort(val) (val) +# define cvtINT16toShort(val) (val) +# define cvtINT32toShort(val) (val) +# define cvtINT8toLong(val) (val) +# define cvtINT16toLong(val) (val) +# define cvtINT32toLong(val) (val) +# endif /* WORD64 and UNSIGNEDBITFIELDS */ + + + +# ifdef MUSTCOPY /* * This macro must not cast or else pointers will get aligned and be wrong */ -#define NEXTPTR(p,t) (((char *) p) + SIZEOF(t)) -#else /* else not MUSTCOPY, this is used for 32-bit machines */ +# define NEXTPTR(p,t) (((char *) p) + SIZEOF(t)) +# else /* else not MUSTCOPY, this is used for 32-bit machines */ /* * this version should leave result of type (t *), but that should only be * used when not in MUSTCOPY */ -#define NEXTPTR(p,t) (((t *)(p)) + 1) -#endif /* MUSTCOPY - used machines whose C structs don't line up with proto */ +# define NEXTPTR(p,t) (((t *)(p)) + 1) +# endif /* MUSTCOPY - used machines whose C structs don't line up with proto */ #endif /* XMD_H */ @@ -1,5 +1,5 @@ /* - * + * Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its @@ -31,26 +31,26 @@ in this Software without prior written authorization from The Open Group. */ #ifndef _XOS_H_ -#define _XOS_H_ +# define _XOS_H_ -#include <X11/Xosdefs.h> +# include <X11/Xosdefs.h> /* * Get major data types (esp. caddr_t) */ -#ifdef USG -#ifndef __TYPES__ -#include <sys/types.h> /* forgot to protect it... */ -#define __TYPES__ -#endif /* __TYPES__ */ -#else /* USG */ -# include <sys/types.h> -#endif /* USG */ +# ifdef USG +# ifndef __TYPES__ +# include <sys/types.h> /* forgot to protect it... */ +# define __TYPES__ +# endif /* __TYPES__ */ +# else /* USG */ +# include <sys/types.h> +# endif /* USG */ -#if defined(__SCO__) || defined(__UNIXWARE__) -#include <stdint.h> -#endif +# if defined(__SCO__) || defined(__UNIXWARE__) +# include <stdint.h> +# endif /* @@ -66,129 +66,129 @@ in this Software without prior written authorization from The Open Group. * which can be really inconvenient. :-( */ -#include <string.h> -#if defined(__SCO__) || defined(__UNIXWARE__) -#include <strings.h> -#else -#if (defined(sun) && defined(__SVR4)) -#include <strings.h> -#endif -#ifndef index -#define index(s,c) (strchr((s),(c))) -#endif -#ifndef rindex -#define rindex(s,c) (strrchr((s),(c))) -#endif -#endif +# include <string.h> +# if defined(__SCO__) || defined(__UNIXWARE__) +# include <strings.h> +# else +# if (defined(sun) && defined(__SVR4)) +# include <strings.h> +# endif +# ifndef index +# define index(s,c) (strchr((s),(c))) +# endif +# ifndef rindex +# define rindex(s,c) (strrchr((s),(c))) +# endif +# endif /* * strerror() */ -#if (defined(sun) && !defined(SVR4)) && !defined(__GLIBC__) -#ifndef strerror +# if (defined(sun) && !defined(SVR4)) && !defined(__GLIBC__) +# ifndef strerror extern char *sys_errlist[]; extern int sys_nerr; -#define strerror(n) \ +# define strerror(n) \ (((n) >= 0 && (n) < sys_nerr) ? sys_errlist[n] : "unknown error") -#endif -#endif +# endif +# endif /* * Get open(2) constants */ -#if defined(X_NOT_POSIX) -#include <fcntl.h> -#if defined(USL) || defined(__i386__) && (defined(SYSV) || defined(SVR4)) -#include <unistd.h> -#endif -#ifdef WIN32 -#include <X11/Xw32defs.h> -#else -#include <sys/file.h> -#endif -#else /* X_NOT_POSIX */ -#include <fcntl.h> -#include <unistd.h> -#endif /* X_NOT_POSIX else */ +# if defined(X_NOT_POSIX) +# include <fcntl.h> +# if defined(USL) || defined(__i386__) && (defined(SYSV) || defined(SVR4)) +# include <unistd.h> +# endif +# ifdef WIN32 +# include <X11/Xw32defs.h> +# else +# include <sys/file.h> +# endif +# else /* X_NOT_POSIX */ +# include <fcntl.h> +# include <unistd.h> +# endif /* X_NOT_POSIX else */ /* * Get struct timeval and struct tm */ -#if defined(SYSV) +# if defined(SYSV) -#ifndef USL -#include <sys/time.h> -#endif -#include <time.h> -#if defined(USG) +# ifndef USL +# include <sys/time.h> +# endif +# include <time.h> +# if defined(USG) struct timeval { long tv_sec; long tv_usec; }; -#ifndef USL_SHARELIB +# ifndef USL_SHARELIB struct timezone { int tz_minuteswest; int tz_dsttime; }; -#endif /* USL_SHARELIB */ -#endif /* USG */ +# endif /* USL_SHARELIB */ +# endif /* USG */ -#else /* not SYSV */ +# else /* not SYSV */ -#if defined(_POSIX_SOURCE) && defined(SVR4) +# if defined(_POSIX_SOURCE) && defined(SVR4) /* need to omit _POSIX_SOURCE in order to get what we want in SVR4 */ -#undef _POSIX_SOURCE -#include <sys/time.h> -#define _POSIX_SOURCE -#elif defined(WIN32) -#include <time.h> -#if !defined(_WINSOCKAPI_) && !defined(_WILLWINSOCK_) && !defined(_TIMEVAL_DEFINED) && !defined(_STRUCT_TIMEVAL) +# undef _POSIX_SOURCE +# include <sys/time.h> +# define _POSIX_SOURCE +# elif defined(WIN32) +# include <time.h> +# if !defined(_WINSOCKAPI_) && !defined(_WILLWINSOCK_) && !defined(_TIMEVAL_DEFINED) && !defined(_STRUCT_TIMEVAL) struct timeval { long tv_sec; /* seconds */ long tv_usec; /* and microseconds */ }; -#define _TIMEVAL_DEFINED -#endif -#include <sys/timeb.h> -#define gettimeofday(t) \ +# define _TIMEVAL_DEFINED +# endif +# include <sys/timeb.h> +# define gettimeofday(t) \ { \ struct _timeb _gtodtmp; \ _ftime (&_gtodtmp); \ (t)->tv_sec = _gtodtmp.time; \ (t)->tv_usec = _gtodtmp.millitm * 1000; \ } -#else -#include <sys/time.h> -#include <time.h> -#endif /* defined(_POSIX_SOURCE) && defined(SVR4) */ +# else +# include <sys/time.h> +# include <time.h> +# endif /* defined(_POSIX_SOURCE) && defined(SVR4) */ -#endif /* SYSV */ +# endif /* SYSV */ /* define X_GETTIMEOFDAY macro, a portable gettimeofday() */ -#if defined(_XOPEN_XPG4) || defined(_XOPEN_UNIX) /* _XOPEN_UNIX is XPG4.2 */ -#define X_GETTIMEOFDAY(t) gettimeofday(t, (struct timezone*)0) -#else -#if defined(SVR4) || defined(WIN32) -#define X_GETTIMEOFDAY(t) gettimeofday(t) -#else -#define X_GETTIMEOFDAY(t) gettimeofday(t, (struct timezone*)0) -#endif -#endif /* XPG4 else */ - - -#ifdef __GNU__ -#define PATH_MAX 4096 -#define MAXPATHLEN 4096 -#define OPEN_MAX 256 /* We define a reasonable limit. */ -#endif +# if defined(_XOPEN_XPG4) || defined(_XOPEN_UNIX) /* _XOPEN_UNIX is XPG4.2 */ +# define X_GETTIMEOFDAY(t) gettimeofday(t, (struct timezone*)0) +# else +# if defined(SVR4) || defined(WIN32) +# define X_GETTIMEOFDAY(t) gettimeofday(t) +# else +# define X_GETTIMEOFDAY(t) gettimeofday(t, (struct timezone*)0) +# endif +# endif /* XPG4 else */ + + +# ifdef __GNU__ +# define PATH_MAX 4096 +# define MAXPATHLEN 4096 +# define OPEN_MAX 256 /* We define a reasonable limit. */ +# endif /* use POSIX name for signal */ -#if defined(X_NOT_POSIX) && defined(SYSV) && !defined(SIGCHLD) -#define SIGCHLD SIGCLD -#endif +# if defined(X_NOT_POSIX) && defined(SYSV) && !defined(SIGCHLD) +# define SIGCHLD SIGCLD +# endif -#include <X11/Xarch.h> +# include <X11/Xarch.h> #endif /* _XOS_H_ */ @@ -324,7 +324,7 @@ typedef struct { struct passwd pws; char pwbuf[X_LINE_MAX]; } _Xgetpwparams; -# if defined(_POSIX_REENTRANT_FUNCTIONS) || !defined(SVR4) +# if defined(_POSIX_REENTRANT_FUNCTIONS) || !defined(SVR4) # define _XGetpwuid(u,p) \ ((getpwuid_r((u),&(p).pws,(p).pwbuf,sizeof((p).pwbuf)) == -1) ? NULL : &(p).pws) # define _XGetpwnam(u,p) \ @@ -25,7 +25,7 @@ in this Software without prior written authorization from The Open Group. */ #ifndef _XOSDEFS_H_ -#define _XOSDEFS_H_ +# define _XOSDEFS_H_ /* * X_NOT_POSIX means does not have POSIX header files. Lack of this @@ -34,83 +34,83 @@ in this Software without prior written authorization from The Open Group. */ -#ifdef _SCO_DS -#ifndef __SCO__ -#define __SCO__ -#endif -#endif +# ifdef _SCO_DS +# ifndef __SCO__ +# define __SCO__ +# endif +# endif -#ifdef __i386__ -#ifdef SYSV -#if !defined(__SCO__) && \ +# ifdef __i386__ +# ifdef SYSV +# if !defined(__SCO__) && \ !defined(__UNIXWARE__) && !defined(sun) -#if !defined(_POSIX_SOURCE) -#define X_NOT_POSIX -#endif -#endif -#endif -#endif - -#ifdef sun +# if !defined(_POSIX_SOURCE) +# define X_NOT_POSIX +# endif +# endif +# endif +# endif + +# ifdef sun /* Imake configs define SVR4 on Solaris, but cc & gcc only define __SVR4 * This check allows non-Imake configured programs to build correctly. */ -#if defined(__SVR4) && !defined(SVR4) -#define SVR4 1 -#endif -#ifdef SVR4 +# if defined(__SVR4) && !defined(SVR4) +# define SVR4 1 +# endif +# ifdef SVR4 /* define this to whatever it needs to be */ -#define X_POSIX_C_SOURCE 199300L -#endif -#endif +# define X_POSIX_C_SOURCE 199300L +# endif +# endif -#ifdef WIN32 -#ifndef _POSIX_ -#define X_NOT_POSIX -#endif -#endif +# ifdef WIN32 +# ifndef _POSIX_ +# define X_NOT_POSIX +# endif +# endif -#ifdef __APPLE__ -#define NULL_NOT_ZERO +# ifdef __APPLE__ +# define NULL_NOT_ZERO /* Defining any of these will sanitize the namespace to JUST want is defined by * that particular standard. If that happens, we don't get some expected * prototypes, typedefs, etc (like fd_mask). We can define _DARWIN_C_SOURCE to * loosen our belts a tad. */ -#if defined(_XOPEN_SOURCE) || defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) -#ifndef _DARWIN_C_SOURCE -#define _DARWIN_C_SOURCE -#endif -#endif - -#endif - -#ifdef __GNU__ -#ifndef PATH_MAX -#define PATH_MAX 4096 -#endif -#ifndef MAXPATHLEN -#define MAXPATHLEN 4096 -#endif -#endif - -#if defined(__SCO__) || defined(__UNIXWARE__) -# ifndef PATH_MAX -# define PATH_MAX 1024 +# if defined(_XOPEN_SOURCE) || defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) +# ifndef _DARWIN_C_SOURCE +# define _DARWIN_C_SOURCE +# endif +# endif + +# endif + +# ifdef __GNU__ +# ifndef PATH_MAX +# define PATH_MAX 4096 +# endif +# ifndef MAXPATHLEN +# define MAXPATHLEN 4096 +# endif # endif -# ifndef MAXPATHLEN -# define MAXPATHLEN 1024 + +# if defined(__SCO__) || defined(__UNIXWARE__) +# ifndef PATH_MAX +# define PATH_MAX 1024 +# endif +# ifndef MAXPATHLEN +# define MAXPATHLEN 1024 +# endif # endif -#endif -#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) \ +# if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) \ || defined(__APPLE__) || defined(__DragonFly__) -# ifndef CSRG_BASED -# define CSRG_BASED +# ifndef CSRG_BASED +# define CSRG_BASED +# endif # endif -#endif #endif /* _XOSDEFS_H_ */ @@ -1,5 +1,5 @@ /* - * + * Copyright 1993, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its @@ -25,77 +25,77 @@ in this Software without prior written authorization from The Open Group. */ #ifndef _XTHREADS_H_ -#define _XTHREADS_H_ +# define _XTHREADS_H_ /* Redefine these to XtMalloc/XtFree or whatever you want before including * this header file. */ -#ifndef xmalloc -#define xmalloc malloc -#endif -#ifndef xfree -#define xfree free -#endif +# ifndef xmalloc +# define xmalloc malloc +# endif +# ifndef xfree +# define xfree free +# endif -#ifdef CTHREADS -#include <cthreads.h> +# ifdef CTHREADS +# include <cthreads.h> typedef cthread_t xthread_t; typedef struct condition xcondition_rec; typedef struct mutex xmutex_rec; -#define xthread_init() cthread_init() -#define xthread_self cthread_self -#define xthread_fork(func,closure) cthread_fork(func,closure) -#define xthread_yield() cthread_yield() -#define xthread_exit(v) cthread_exit(v) -#define xthread_set_name(t,str) cthread_set_name(t,str) -#define xmutex_init(m) mutex_init(m) -#define xmutex_clear(m) mutex_clear(m) -#define xmutex_lock(m) mutex_lock(m) -#define xmutex_unlock(m) mutex_unlock(m) -#define xmutex_set_name(m,str) mutex_set_name(m,str) -#define xcondition_init(cv) condition_init(cv) -#define xcondition_clear(cv) condition_clear(cv) -#define xcondition_wait(cv,m) condition_wait(cv,m) -#define xcondition_signal(cv) condition_signal(cv) -#define xcondition_broadcast(cv) condition_broadcast(cv) -#define xcondition_set_name(cv,str) condition_set_name(cv,str) -#else /* !CTHREADS */ -#if defined(SVR4) -#include <thread.h> -#include <synch.h> +# define xthread_init() cthread_init() +# define xthread_self cthread_self +# define xthread_fork(func,closure) cthread_fork(func,closure) +# define xthread_yield() cthread_yield() +# define xthread_exit(v) cthread_exit(v) +# define xthread_set_name(t,str) cthread_set_name(t,str) +# define xmutex_init(m) mutex_init(m) +# define xmutex_clear(m) mutex_clear(m) +# define xmutex_lock(m) mutex_lock(m) +# define xmutex_unlock(m) mutex_unlock(m) +# define xmutex_set_name(m,str) mutex_set_name(m,str) +# define xcondition_init(cv) condition_init(cv) +# define xcondition_clear(cv) condition_clear(cv) +# define xcondition_wait(cv,m) condition_wait(cv,m) +# define xcondition_signal(cv) condition_signal(cv) +# define xcondition_broadcast(cv) condition_broadcast(cv) +# define xcondition_set_name(cv,str) condition_set_name(cv,str) +# else /* !CTHREADS */ +# if defined(SVR4) +# include <thread.h> +# include <synch.h> typedef thread_t xthread_t; typedef thread_key_t xthread_key_t; typedef cond_t xcondition_rec; typedef mutex_t xmutex_rec; -#if defined(__UNIXWARE__) +# if defined(__UNIXWARE__) extern xthread_t (*_x11_thr_self)(); -#define xthread_self (_x11_thr_self) -#else -#define xthread_self thr_self -#endif -#define xthread_fork(func,closure) thr_create(NULL,0,func,closure,THR_NEW_LWP|THR_DETACHED,NULL) -#define xthread_yield() thr_yield() -#define xthread_exit(v) thr_exit(v) -#define xthread_key_create(kp,d) thr_keycreate(kp,d) -#ifdef sun -#define xthread_key_delete(k) 0 -#else -#define xthread_key_delete(k) thr_keydelete(k) -#endif -#define xthread_set_specific(k,v) thr_setspecific(k,v) -#define xthread_get_specific(k,vp) thr_getspecific(k,vp) -#define xmutex_init(m) mutex_init(m,USYNC_THREAD,0) -#define xmutex_clear(m) mutex_destroy(m) -#define xmutex_lock(m) mutex_lock(m) -#define xmutex_unlock(m) mutex_unlock(m) -#define xcondition_init(cv) cond_init(cv,USYNC_THREAD,0) -#define xcondition_clear(cv) cond_destroy(cv) -#define xcondition_wait(cv,m) cond_wait(cv,m) -#define xcondition_signal(cv) cond_signal(cv) -#define xcondition_broadcast(cv) cond_broadcast(cv) -#else /* !SVR4 */ -#ifdef WIN32 -#include <X11/Xwindows.h> +# define xthread_self (_x11_thr_self) +# else +# define xthread_self thr_self +# endif +# define xthread_fork(func,closure) thr_create(NULL,0,func,closure,THR_NEW_LWP|THR_DETACHED,NULL) +# define xthread_yield() thr_yield() +# define xthread_exit(v) thr_exit(v) +# define xthread_key_create(kp,d) thr_keycreate(kp,d) +# ifdef sun +# define xthread_key_delete(k) 0 +# else +# define xthread_key_delete(k) thr_keydelete(k) +# endif +# define xthread_set_specific(k,v) thr_setspecific(k,v) +# define xthread_get_specific(k,vp) thr_getspecific(k,vp) +# define xmutex_init(m) mutex_init(m,USYNC_THREAD,0) +# define xmutex_clear(m) mutex_destroy(m) +# define xmutex_lock(m) mutex_lock(m) +# define xmutex_unlock(m) mutex_unlock(m) +# define xcondition_init(cv) cond_init(cv,USYNC_THREAD,0) +# define xcondition_clear(cv) cond_destroy(cv) +# define xcondition_wait(cv,m) cond_wait(cv,m) +# define xcondition_signal(cv) cond_signal(cv) +# define xcondition_broadcast(cv) cond_broadcast(cv) +# else /* !SVR4 */ +# ifdef WIN32 +# include <X11/Xwindows.h> typedef DWORD xthread_t; typedef DWORD xthread_key_t; struct _xthread_waiter { @@ -107,31 +107,31 @@ typedef struct { struct _xthread_waiter *waiters; } xcondition_rec; typedef CRITICAL_SECTION xmutex_rec; -#define xthread_init() _Xthread_init() -#define xthread_self GetCurrentThreadId -#define xthread_fork(func,closure) { \ +# define xthread_init() _Xthread_init() +# define xthread_self GetCurrentThreadId +# define xthread_fork(func,closure) { \ DWORD _tmptid; \ CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)func, (LPVOID)closure, 0, \ &_tmptid); \ } -#define xthread_yield() Sleep(0) -#define xthread_exit(v) ExitThread((DWORD)(v)) -#define xthread_key_create(kp,d) *(kp) = TlsAlloc() -#define xthread_key_delete(k) TlsFree(k) -#define xthread_set_specific(k,v) TlsSetValue(k,v) -#define xthread_get_specific(k,vp) TlsGetValue(k) -#define xmutex_init(m) InitializeCriticalSection(m) -#define xmutex_clear(m) DeleteCriticalSection(m) -#define _XMUTEX_NESTS -#define xmutex_lock(m) EnterCriticalSection(m) -#define xmutex_unlock(m) LeaveCriticalSection(m) -#define xcondition_init(cv) { \ +# define xthread_yield() Sleep(0) +# define xthread_exit(v) ExitThread((DWORD)(v)) +# define xthread_key_create(kp,d) *(kp) = TlsAlloc() +# define xthread_key_delete(k) TlsFree(k) +# define xthread_set_specific(k,v) TlsSetValue(k,v) +# define xthread_get_specific(k,vp) TlsGetValue(k) +# define xmutex_init(m) InitializeCriticalSection(m) +# define xmutex_clear(m) DeleteCriticalSection(m) +# define _XMUTEX_NESTS +# define xmutex_lock(m) EnterCriticalSection(m) +# define xmutex_unlock(m) LeaveCriticalSection(m) +# define xcondition_init(cv) { \ InitializeCriticalSection(&(cv)->cs); \ (cv)->waiters = NULL; \ } -#define xcondition_clear(cv) DeleteCriticalSection(&(cv)->cs) +# define xcondition_clear(cv) DeleteCriticalSection(&(cv)->cs) extern struct _xthread_waiter *_Xthread_waiter(); -#define xcondition_wait(cv,m) { \ +# define xcondition_wait(cv,m) { \ struct _xthread_waiter *_tmpthr = _Xthread_waiter(); \ EnterCriticalSection(&(cv)->cs); \ _tmpthr->next = (cv)->waiters; \ @@ -141,7 +141,7 @@ extern struct _xthread_waiter *_Xthread_waiter(); WaitForSingleObject(_tmpthr->sem, INFINITE); \ EnterCriticalSection(m); \ } -#define xcondition_signal(cv) { \ +# define xcondition_signal(cv) { \ EnterCriticalSection(&(cv)->cs); \ if ((cv)->waiters) { \ ReleaseSemaphore((cv)->waiters->sem, 1, NULL); \ @@ -149,7 +149,7 @@ extern struct _xthread_waiter *_Xthread_waiter(); } \ LeaveCriticalSection(&(cv)->cs); \ } -#define xcondition_broadcast(cv) { \ +# define xcondition_broadcast(cv) { \ struct _xthread_waiter *_tmpthr; \ EnterCriticalSection(&(cv)->cs); \ for (_tmpthr = (cv)->waiters; _tmpthr; _tmpthr = _tmpthr->next) \ @@ -157,157 +157,157 @@ extern struct _xthread_waiter *_Xthread_waiter(); (cv)->waiters = NULL; \ LeaveCriticalSection(&(cv)->cs); \ } -#else /* !WIN32 */ -#ifdef USE_TIS_SUPPORT +# else /* !WIN32 */ +# ifdef USE_TIS_SUPPORT /* * TIS support is intended for thread safe libraries. * This should not be used for general client programming. */ -#include <tis.h> +# include <tis.h> typedef pthread_t xthread_t; typedef pthread_key_t xthread_key_t; typedef pthread_cond_t xcondition_rec; typedef pthread_mutex_t xmutex_rec; -#define xthread_self tis_self -#define xthread_fork(func,closure) { pthread_t _tmpxthr; \ +# define xthread_self tis_self +# define xthread_fork(func,closure) { pthread_t _tmpxthr; \ pthread_create(&_tmpxthr,NULL,func,closure); } -#define xthread_yield() pthread_yield_np() -#define xthread_exit(v) pthread_exit(v) -#define xthread_key_create(kp,d) tis_key_create(kp,d) -#define xthread_key_delete(k) tis_key_delete(k) -#define xthread_set_specific(k,v) tis_setspecific(k,v) -#define xthread_get_specific(k,vp) *(vp) = tis_getspecific(k) -#define XMUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER -#define xmutex_init(m) tis_mutex_init(m) -#define xmutex_clear(m) tis_mutex_destroy(m) -#define xmutex_lock(m) tis_mutex_lock(m) -#define xmutex_unlock(m) tis_mutex_unlock(m) -#define xcondition_init(c) tis_cond_init(c) -#define xcondition_clear(c) tis_cond_destroy(c) -#define xcondition_wait(c,m) tis_cond_wait(c,m) -#define xcondition_signal(c) tis_cond_signal(c) -#define xcondition_broadcast(c) tis_cond_broadcast(c) -#else -#ifdef USE_NBSD_THREADLIB +# define xthread_yield() pthread_yield_np() +# define xthread_exit(v) pthread_exit(v) +# define xthread_key_create(kp,d) tis_key_create(kp,d) +# define xthread_key_delete(k) tis_key_delete(k) +# define xthread_set_specific(k,v) tis_setspecific(k,v) +# define xthread_get_specific(k,vp) *(vp) = tis_getspecific(k) +# define XMUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER +# define xmutex_init(m) tis_mutex_init(m) +# define xmutex_clear(m) tis_mutex_destroy(m) +# define xmutex_lock(m) tis_mutex_lock(m) +# define xmutex_unlock(m) tis_mutex_unlock(m) +# define xcondition_init(c) tis_cond_init(c) +# define xcondition_clear(c) tis_cond_destroy(c) +# define xcondition_wait(c,m) tis_cond_wait(c,m) +# define xcondition_signal(c) tis_cond_signal(c) +# define xcondition_broadcast(c) tis_cond_broadcast(c) +# else +# ifdef USE_NBSD_THREADLIB /* * NetBSD threadlib support is intended for thread safe libraries. * This should not be used for general client programming. */ -#include <threadlib.h> +# include <threadlib.h> typedef thr_t xthread_t; typedef thread_key_t xthread_key_t; typedef cond_t xcondition_rec; typedef mutex_t xmutex_rec; -#define xthread_self thr_self -#define xthread_fork(func,closure) { thr_t _tmpxthr; \ +# define xthread_self thr_self +# define xthread_fork(func,closure) { thr_t _tmpxthr; \ /* XXX Create it detached? --thorpej */ \ thr_create(&_tmpxthr,NULL,func,closure); } -#define xthread_yield() thr_yield() -#define xthread_exit(v) thr_exit(v) -#define xthread_key_create(kp,d) thr_keycreate(kp,d) -#define xthread_key_delete(k) thr_keydelete(k) -#define xthread_set_specific(k,v) thr_setspecific(k,v) -#define xthread_get_specific(k,vp) *(vp) = thr_getspecific(k) -#define XMUTEX_INITIALIZER MUTEX_INITIALIZER -#define xmutex_init(m) mutex_init(m, 0) -#define xmutex_clear(m) mutex_destroy(m) -#define xmutex_lock(m) mutex_lock(m) -#define xmutex_unlock(m) mutex_unlock(m) -#define xcondition_init(c) cond_init(c, 0, 0) -#define xcondition_clear(c) cond_destroy(c) -#define xcondition_wait(c,m) cond_wait(c,m) -#define xcondition_signal(c) cond_signal(c) -#define xcondition_broadcast(c) cond_broadcast(c) -#else -#include <pthread.h> +# define xthread_yield() thr_yield() +# define xthread_exit(v) thr_exit(v) +# define xthread_key_create(kp,d) thr_keycreate(kp,d) +# define xthread_key_delete(k) thr_keydelete(k) +# define xthread_set_specific(k,v) thr_setspecific(k,v) +# define xthread_get_specific(k,vp) *(vp) = thr_getspecific(k) +# define XMUTEX_INITIALIZER MUTEX_INITIALIZER +# define xmutex_init(m) mutex_init(m, 0) +# define xmutex_clear(m) mutex_destroy(m) +# define xmutex_lock(m) mutex_lock(m) +# define xmutex_unlock(m) mutex_unlock(m) +# define xcondition_init(c) cond_init(c, 0, 0) +# define xcondition_clear(c) cond_destroy(c) +# define xcondition_wait(c,m) cond_wait(c,m) +# define xcondition_signal(c) cond_signal(c) +# define xcondition_broadcast(c) cond_broadcast(c) +# else +# include <pthread.h> typedef pthread_t xthread_t; typedef pthread_key_t xthread_key_t; typedef pthread_cond_t xcondition_rec; typedef pthread_mutex_t xmutex_rec; -#define xthread_self pthread_self -#define xthread_yield() pthread_yield() -#define xthread_exit(v) pthread_exit(v) -#define xthread_set_specific(k,v) pthread_setspecific(k,v) -#define xmutex_clear(m) pthread_mutex_destroy(m) -#define xmutex_lock(m) pthread_mutex_lock(m) -#define xmutex_unlock(m) pthread_mutex_unlock(m) -#ifndef XPRE_STANDARD_API -#define xthread_key_create(kp,d) pthread_key_create(kp,d) -#define xthread_key_delete(k) pthread_key_delete(k) -#define xthread_get_specific(k,vp) *(vp) = pthread_getspecific(k) -#define xthread_fork(func,closure) { pthread_t _tmpxthr; \ +# define xthread_self pthread_self +# define xthread_yield() pthread_yield() +# define xthread_exit(v) pthread_exit(v) +# define xthread_set_specific(k,v) pthread_setspecific(k,v) +# define xmutex_clear(m) pthread_mutex_destroy(m) +# define xmutex_lock(m) pthread_mutex_lock(m) +# define xmutex_unlock(m) pthread_mutex_unlock(m) +# ifndef XPRE_STANDARD_API +# define xthread_key_create(kp,d) pthread_key_create(kp,d) +# define xthread_key_delete(k) pthread_key_delete(k) +# define xthread_get_specific(k,vp) *(vp) = pthread_getspecific(k) +# define xthread_fork(func,closure) { pthread_t _tmpxthr; \ pthread_create(&_tmpxthr,NULL,func,closure); } -#define XMUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER -#define xmutex_init(m) pthread_mutex_init(m, NULL) -#define xcondition_init(c) pthread_cond_init(c, NULL) -#else /* XPRE_STANDARD_API */ -#define xthread_key_create(kp,d) pthread_keycreate(kp,d) -#define xthread_key_delete(k) 0 -#define xthread_get_specific(k,vp) pthread_getspecific(k,vp) -#define xthread_fork(func,closure) { pthread_t _tmpxthr; \ +# define XMUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER +# define xmutex_init(m) pthread_mutex_init(m, NULL) +# define xcondition_init(c) pthread_cond_init(c, NULL) +# else /* XPRE_STANDARD_API */ +# define xthread_key_create(kp,d) pthread_keycreate(kp,d) +# define xthread_key_delete(k) 0 +# define xthread_get_specific(k,vp) pthread_getspecific(k,vp) +# define xthread_fork(func,closure) { pthread_t _tmpxthr; \ pthread_create(&_tmpxthr,pthread_attr_default,func,closure); } -#define xmutex_init(m) pthread_mutex_init(m, pthread_mutexattr_default) -#define xcondition_init(c) pthread_cond_init(c, pthread_condattr_default) -#endif /* XPRE_STANDARD_API */ -#define xcondition_clear(c) pthread_cond_destroy(c) -#define xcondition_wait(c,m) pthread_cond_wait(c,m) -#define xcondition_signal(c) pthread_cond_signal(c) -#define xcondition_broadcast(c) pthread_cond_broadcast(c) -#if defined(_DECTHREADS_) +# define xmutex_init(m) pthread_mutex_init(m, pthread_mutexattr_default) +# define xcondition_init(c) pthread_cond_init(c, pthread_condattr_default) +# endif /* XPRE_STANDARD_API */ +# define xcondition_clear(c) pthread_cond_destroy(c) +# define xcondition_wait(c,m) pthread_cond_wait(c,m) +# define xcondition_signal(c) pthread_cond_signal(c) +# define xcondition_broadcast(c) pthread_cond_broadcast(c) +# if defined(_DECTHREADS_) static xthread_t _X_no_thread_id; -#define xthread_have_id(id) !pthread_equal(id, _X_no_thread_id) -#define xthread_clear_id(id) id = _X_no_thread_id -#define xthread_equal(id1,id2) pthread_equal(id1, id2) -#endif /* _DECTHREADS_ */ -#if defined(__linux__) -#define xthread_have_id(id) !pthread_equal(id, 0) -#define xthread_clear_id(id) id = 0 -#define xthread_equal(id1,id2) pthread_equal(id1, id2) -#endif /* linux */ -#if defined(_CMA_VENDOR_) && defined(_CMA__IBM) && (_CMA_VENDOR_ == _CMA__IBM) -#ifdef DEBUG /* too much of a hack to enable normally */ +# define xthread_have_id(id) !pthread_equal(id, _X_no_thread_id) +# define xthread_clear_id(id) id = _X_no_thread_id +# define xthread_equal(id1,id2) pthread_equal(id1, id2) +# endif /* _DECTHREADS_ */ +# if defined(__linux__) +# define xthread_have_id(id) !pthread_equal(id, 0) +# define xthread_clear_id(id) id = 0 +# define xthread_equal(id1,id2) pthread_equal(id1, id2) +# endif /* linux */ +# if defined(_CMA_VENDOR_) && defined(_CMA__IBM) && (_CMA_VENDOR_ == _CMA__IBM) +# ifdef DEBUG /* too much of a hack to enable normally */ /* see also cma__obj_set_name() */ -#define xmutex_set_name(m,str) ((char**)(m)->field1)[5] = (str) -#define xcondition_set_name(cv,str) ((char**)(cv)->field1)[5] = (str) -#endif /* DEBUG */ -#endif /* _CMA_VENDOR_ == _CMA__IBM */ -#endif /* USE_NBSD_THREADLIB */ -#endif /* USE_TIS_SUPPORT */ -#endif /* WIN32 */ -#endif /* SVR4 */ -#endif /* CTHREADS */ +# define xmutex_set_name(m,str) ((char**)(m)->field1)[5] = (str) +# define xcondition_set_name(cv,str) ((char**)(cv)->field1)[5] = (str) +# endif /* DEBUG */ +# endif /* _CMA_VENDOR_ == _CMA__IBM */ +# endif /* USE_NBSD_THREADLIB */ +# endif /* USE_TIS_SUPPORT */ +# endif /* WIN32 */ +# endif /* SVR4 */ +# endif /* CTHREADS */ typedef xcondition_rec *xcondition_t; typedef xmutex_rec *xmutex_t; -#ifndef xcondition_malloc -#define xcondition_malloc() (xcondition_t)xmalloc(sizeof(xcondition_rec)) -#endif -#ifndef xcondition_free -#define xcondition_free(c) xfree((char *)c) -#endif -#ifndef xmutex_malloc -#define xmutex_malloc() (xmutex_t)xmalloc(sizeof(xmutex_rec)) -#endif -#ifndef xmutex_free -#define xmutex_free(m) xfree((char *)m) -#endif -#ifndef xthread_have_id -#define xthread_have_id(id) id -#endif -#ifndef xthread_clear_id -#define xthread_clear_id(id) id = 0 -#endif -#ifndef xthread_equal -#define xthread_equal(id1,id2) ((id1) == (id2)) -#endif +# ifndef xcondition_malloc +# define xcondition_malloc() (xcondition_t)xmalloc(sizeof(xcondition_rec)) +# endif +# ifndef xcondition_free +# define xcondition_free(c) xfree((char *)c) +# endif +# ifndef xmutex_malloc +# define xmutex_malloc() (xmutex_t)xmalloc(sizeof(xmutex_rec)) +# endif +# ifndef xmutex_free +# define xmutex_free(m) xfree((char *)m) +# endif +# ifndef xthread_have_id +# define xthread_have_id(id) id +# endif +# ifndef xthread_clear_id +# define xthread_clear_id(id) id = 0 +# endif +# ifndef xthread_equal +# define xthread_equal(id1,id2) ((id1) == (id2)) +# endif /* aids understood by some debuggers */ -#ifndef xthread_set_name -#define xthread_set_name(t,str) -#endif -#ifndef xmutex_set_name -#define xmutex_set_name(m,str) -#endif -#ifndef xcondition_set_name -#define xcondition_set_name(cv,str) -#endif +# ifndef xthread_set_name +# define xthread_set_name(t,str) +# endif +# ifndef xmutex_set_name +# define xmutex_set_name(m,str) +# endif +# ifndef xcondition_set_name +# define xcondition_set_name(cv,str) +# endif #endif /* _XTHREADS_H_ */ @@ -1,79 +1,79 @@ #ifndef _XW32DEFS_H -#define _XW32DEFS_H +# define _XW32DEFS_H -#ifdef __GNUC__ /* mingw is more close to unix than msvc */ -#if !defined(__daddr_t_defined) +# ifdef __GNUC__ /* mingw is more close to unix than msvc */ +# if !defined(__daddr_t_defined) typedef char *caddr_t; -#endif -#define lstat stat +# endif +# define lstat stat -#else +# else typedef char *caddr_t; -#define access _access -#define alloca _alloca -#define chdir _chdir -#define chmod _chmod -#define close _close -#define creat _creat -#define dup _dup -#define dup2 _dup2 -#define environ _environ -#define execl _execl -#define execle _execle -#define execlp _execlp -#define execlpe _execlpe -#define execv _execv -#define execve _execve -#define execvp _execvp -#define execvpe _execvpe -#define fdopen _fdopen -#define fileno _fileno -#define fstat _fstat -#define getcwd _getcwd -#define getpid _getpid -#define hypot _hypot -#define isascii __isascii -#define isatty _isatty -#define lseek _lseek -#define mkdir _mkdir -#define mktemp _mktemp -#define open _open -#define putenv _putenv -#define read _read -#define rmdir _rmdir -#define sleep(x) Sleep((x) * 1000) -#define stat _stat -#define sys_errlist _sys_errlist -#define sys_nerr _sys_nerr -#define umask _umask -#define unlink _unlink -#define write _write -#define random rand -#define srandom srand +# define access _access +# define alloca _alloca +# define chdir _chdir +# define chmod _chmod +# define close _close +# define creat _creat +# define dup _dup +# define dup2 _dup2 +# define environ _environ +# define execl _execl +# define execle _execle +# define execlp _execlp +# define execlpe _execlpe +# define execv _execv +# define execve _execve +# define execvp _execvp +# define execvpe _execvpe +# define fdopen _fdopen +# define fileno _fileno +# define fstat _fstat +# define getcwd _getcwd +# define getpid _getpid +# define hypot _hypot +# define isascii __isascii +# define isatty _isatty +# define lseek _lseek +# define mkdir _mkdir +# define mktemp _mktemp +# define open _open +# define putenv _putenv +# define read _read +# define rmdir _rmdir +# define sleep(x) Sleep((x) * 1000) +# define stat _stat +# define sys_errlist _sys_errlist +# define sys_nerr _sys_nerr +# define umask _umask +# define unlink _unlink +# define write _write +# define random rand +# define srandom srand -#define O_RDONLY _O_RDONLY -#define O_WRONLY _O_WRONLY -#define O_RDWR _O_RDWR -#define O_APPEND _O_APPEND -#define O_CREAT _O_CREAT -#define O_TRUNC _O_TRUNC -#define O_EXCL _O_EXCL -#define O_TEXT _O_TEXT -#define O_BINARY _O_BINARY -#define O_RAW _O_BINARY +# define O_RDONLY _O_RDONLY +# define O_WRONLY _O_WRONLY +# define O_RDWR _O_RDWR +# define O_APPEND _O_APPEND +# define O_CREAT _O_CREAT +# define O_TRUNC _O_TRUNC +# define O_EXCL _O_EXCL +# define O_TEXT _O_TEXT +# define O_BINARY _O_BINARY +# define O_RAW _O_BINARY -#define S_IFMT _S_IFMT -#define S_IFDIR _S_IFDIR -#define S_IFCHR _S_IFCHR -#define S_IFREG _S_IFREG -#define S_IREAD _S_IREAD -#define S_IWRITE _S_IWRITE -#define S_IEXEC _S_IEXEC +# define S_IFMT _S_IFMT +# define S_IFDIR _S_IFDIR +# define S_IFCHR _S_IFCHR +# define S_IFREG _S_IFREG +# define S_IREAD _S_IREAD +# define S_IWRITE _S_IWRITE +# define S_IEXEC _S_IEXEC -#define F_OK 0 -#define X_OK 1 -#define W_OK 2 -#define R_OK 4 -#endif /* __GNUC__ */ +# define F_OK 0 +# define X_OK 1 +# define W_OK 2 +# define R_OK 4 +# endif /* __GNUC__ */ #endif @@ -45,8 +45,8 @@ The Open Group. #undef _XFree86Server #ifdef XFree86Server -#define _XFree86Server -#undef XFree86Server +# define _XFree86Server +# undef XFree86Server #endif #define NOMINMAX @@ -69,19 +69,19 @@ The Open Group. #undef CreateWindowA #ifdef RESOURCE_H -#undef RT_FONT -#undef RT_CURSOR -#define RT_FONT ((RESTYPE)4) -#define RT_CURSOR ((RESTYPE)5) +# undef RT_FONT +# undef RT_CURSOR +# define RT_FONT ((RESTYPE)4) +# define RT_CURSOR ((RESTYPE)5) #endif #if defined(WIN32) && (!defined(PATH_MAX) || PATH_MAX < 1024) -#undef PATH_MAX -#define PATH_MAX 1024 +# undef PATH_MAX +# define PATH_MAX 1024 #endif #ifdef _XFree86Server -#define XFree86Server -#undef _XFree86Server +# define XFree86Server +# undef _XFree86Server #endif @@ -35,8 +35,8 @@ The Open Group. #undef _XFree86Server #ifdef XFree86Server -#define _XFree86Server -#undef XFree86Server +# define _XFree86Server +# undef XFree86Server #endif #define BOOL wBOOL @@ -59,7 +59,7 @@ The Open Group. #undef RT_CURSOR #ifdef _XFree86Server -#define XFree86Server -#undef _XFree86Server +# define XFree86Server +# undef _XFree86Server #endif |