home *** CD-ROM | disk | FTP | other *** search
/ Dream 52 / Amiga_Dream_52.iso / Linux / Divers / ImageMagick-4.0.6.tar.gz / ImageMagick-4.0.6.tar / ImageMagick-4.0.6 / xlib / X11 / Xos.h < prev    next >
C/C++ Source or Header  |  1996-12-05  |  5KB  |  228 lines

  1. /*
  2.  * $XConsortium: Xos.h,v 1.67 94/11/30 20:48:05 kaleb Exp $
  3.  * 
  4.  * 
  5. Copyright (c) 1987  X Consortium
  6.  
  7. Permission is hereby granted, free of charge, to any person obtaining a copy
  8. of this software and associated documentation files (the "Software"), to deal
  9. in the Software without restriction, including without limitation the rights
  10. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11. copies of the Software, and to permit persons to whom the Software is
  12. furnished to do so, subject to the following conditions:
  13.  
  14. The above copyright notice and this permission notice shall be included in
  15. all copies or substantial portions of the Software.
  16.  
  17. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
  20. X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
  21. AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  22. CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  23.  
  24. Except as contained in this notice, the name of the X Consortium shall not be
  25. used in advertising or otherwise to promote the sale, use or other dealings
  26. in this Software without prior written authorization from the X Consortium.
  27.  *
  28.  * The X Window System is a Trademark of X Consortium.
  29.  *
  30.  */
  31.  
  32. /* This is a collection of things to try and minimize system dependencies
  33.  * in a "signficant" number of source files.
  34.  */
  35.  
  36. #ifndef _XOS_H_
  37. #define _XOS_H_
  38.  
  39. #ifdef __MWERKS__
  40. #   include <Xosdefs.h>
  41. #else
  42. #include <X11/Xosdefs.h>
  43. #endif
  44.  
  45. /*
  46.  * Get major data types (esp. caddr_t)
  47.  */
  48.  
  49. #ifdef USG
  50. #ifndef __TYPES__
  51. #ifdef CRAY
  52. #define word word_t
  53. #endif /* CRAY */
  54. #include <sys/types.h>            /* forgot to protect it... */
  55. #define __TYPES__
  56. #endif /* __TYPES__ */
  57. #else /* USG */
  58. #if defined(_POSIX_SOURCE) && (defined(MOTOROLA) || defined(AMOEBA))
  59. #undef _POSIX_SOURCE
  60. #include <sys/types.h>
  61. #define _POSIX_SOURCE
  62. #else
  63. #ifdef __MWERKS__
  64. #   include <types.h>
  65. #else
  66. #include <sys/types.h>
  67. #endif
  68. #endif
  69. #endif /* USG */
  70.  
  71.  
  72. /*
  73.  * Just about everyone needs the strings routines.  We provide both forms here,
  74.  * index/rindex and strchr/strrchr, so any systems that don't provide them all
  75.  * need to have #defines here.
  76.  */
  77.  
  78. #ifndef X_NOT_STDC_ENV
  79.  
  80. #include <string.h>
  81. #ifndef index
  82. #define index strchr
  83. #endif
  84. #ifndef rindex
  85. #define rindex strrchr
  86. #endif
  87.  
  88. #else
  89.  
  90. #ifdef SYSV
  91. #include <string.h>
  92. #define index strchr
  93. #define rindex strrchr
  94. #else
  95. #include <strings.h>
  96. #define strchr index
  97. #define strrchr rindex
  98. #endif
  99.  
  100. #endif /* X_NOT_STDC_ENV */
  101.  
  102. /*
  103.  * strerror()
  104.  */
  105. #if defined(X_NOT_STDC_ENV) || (defined(sun) && !defined(SVR4)) || defined(macII)
  106. #ifndef strerror
  107. extern char *sys_errlist[];
  108. extern int sys_nerr;
  109. #define strerror(n) \
  110.     (((n) >= 0 && (n) < sys_nerr) ? sys_errlist[n] : "unknown error")
  111. #endif
  112. #endif
  113.  
  114. /*
  115.  * Get open(2) constants
  116.  */
  117. #ifdef X_NOT_POSIX
  118. #include <fcntl.h>
  119. #if defined(USL) || defined(CRAY) || defined(MOTOROLA) || (defined(i386) && (defined(SYSV) || defined(SVR4))) || defined(__sxg__)
  120. #include <unistd.h>
  121. #endif
  122. #ifdef WIN32
  123. #include <X11/Xw32defs.h>
  124. #else
  125. #include <sys/file.h>
  126. #endif
  127. #else /* X_NOT_POSIX */
  128. #if !defined(_POSIX_SOURCE) && defined(macII)
  129. #define _POSIX_SOURCE
  130. #include <fcntl.h>
  131. #include <unistd.h>
  132. #undef _POSIX_SOURCE
  133. #else
  134. #include <fcntl.h>
  135. #include <unistd.h>
  136. #endif
  137. #endif /* X_NOT_POSIX else */
  138.  
  139. /*
  140.  * Get struct timeval
  141.  */
  142.  
  143. #ifdef SYSV
  144.  
  145. #ifndef USL
  146. #include <sys/time.h>
  147. #endif
  148. #include <time.h>
  149. #ifdef CRAY
  150. #undef word
  151. #endif /* CRAY */
  152. #if defined(USG) && !defined(CRAY) && !defined(MOTOROLA) && !defined(uniosu) && !defined(__sxg__)
  153. struct timeval {
  154.     long tv_sec;
  155.     long tv_usec;
  156. };
  157. #ifndef USL_SHARELIB
  158. struct timezone {
  159.     int tz_minuteswest;
  160.     int tz_dsttime;
  161. };
  162. #endif /* USL_SHARELIB */
  163. #endif /* USG */
  164.  
  165. #ifdef _SEQUENT_
  166. struct timezone {
  167.     int tz_minuteswest;
  168.     int tz_dsttime;
  169. };
  170. #endif /* _SEQUENT_ */
  171.  
  172. #else /* not SYSV */
  173.  
  174. #if defined(_POSIX_SOURCE) && defined(SVR4)
  175. /* need to omit _POSIX_SOURCE in order to get what we want in SVR4 */
  176. #undef _POSIX_SOURCE
  177. #include <sys/time.h>
  178. #define _POSIX_SOURCE
  179. #else /* defined(_POSIX_SOURCE) && defined(SVR4) */
  180. #ifdef WIN32
  181. #include <time.h>
  182. #if !defined(_WINSOCKAPI_) && !defined(_WILLWINSOCK_)
  183. struct timeval {
  184.     long    tv_sec;         /* seconds */
  185.     long    tv_usec;        /* and microseconds */
  186. };
  187. #endif
  188. /*#include <sys/timeb.h>*/
  189. #define gettimeofday(t) \
  190. { \
  191.     struct _timeb _gtodtmp; \
  192.     _ftime (&_gtodtmp); \
  193.     (t)->tv_sec = _gtodtmp.time; \
  194.     (t)->tv_usec = _gtodtmp.millitm * 1000; \
  195. }
  196. #else /* WIN32 */
  197. #ifdef _SEQUENT_
  198. #include <time.h>
  199. #else /* _SEQUENT_ */
  200. #ifdef __MWERKS__
  201. #   include <time.h>
  202. #else
  203. #include <sys/time.h>
  204. #endif
  205. #endif /* _SEQUENT_ */
  206. #endif /* WIN32 else */
  207. #endif /* defined(_POSIX_SOURCE) && defined(SVR4) */
  208.  
  209. #endif /* SYSV */
  210.  
  211. /* define X_GETTIMEOFDAY macro, a portable gettimeofday() */
  212. #if defined(SVR4) || defined(VMS) || defined(WIN32)
  213. #define X_GETTIMEOFDAY(t) gettimeofday(t)
  214. #else
  215. #define X_GETTIMEOFDAY(t) gettimeofday(t, (struct timezone*)0)
  216. #endif
  217.  
  218. /* use POSIX name for signal */
  219. #if defined(X_NOT_POSIX) && defined(SYSV) && !defined(SIGCHLD)
  220. #define SIGCHLD SIGCLD
  221. #endif
  222.  
  223. #ifdef ISC
  224. #include <sys/bsdtypes.h>
  225. #endif
  226.  
  227. #endif /* _XOS_H_ */
  228.