home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / glibc-1.06 / stddef.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-05-20  |  5.6 KB  |  216 lines

  1. #ifndef _STDDEF_H
  2. #ifndef _STDDEF_H_
  3. #ifndef _ANSI_STDDEF_H
  4.  
  5. /* Any one of these symbols __need_* means that GNU libc
  6.    wants us just to define one data type.  So don't define
  7.    the symbols that indicate this file's entire job has been done.  */
  8. #if (!defined(__need_wchar_t) && !defined(__need_size_t)    \
  9.      && !defined(__need_ptrdiff_t) && !defined(__need_NULL))
  10. #define _STDDEF_H
  11. #define _STDDEF_H_
  12. /* snaroff@next.com says the NeXT needs this.  */
  13. #define _ANSI_STDDEF_H
  14. #endif
  15.  
  16. #ifndef __sys_stdtypes_h
  17. /* This avoids lossage on SunOS but only if stdtypes.h comes first.
  18.    There's no way to win with the other order!  Sun lossage.  */
  19.  
  20. /* On 4.3bsd-net2, make sure ansi.h is included, so we have
  21.    one less case to deal with in the following.  */
  22. #if defined (__BSD_NET2__) || defined (____386BSD____)
  23. #include <machine/ansi.h>
  24. #endif
  25.  
  26. /* In 4.3bsd-net2, machine/ansi.h defines these symbols, which are
  27.     defined if the corresponding type is *not* defined.  */
  28. #ifdef _ANSI_H_
  29. #ifndef _SIZE_T_
  30. #define _SIZE_T
  31. #endif
  32. #ifndef _PTRDIFF_T_
  33. #define _PTRDIFF_T
  34. #endif
  35. #ifndef _WCHAR_T_
  36. #define _WCHAR_T
  37. #endif
  38. /* Undef _FOO_T_ if we are supposed to define foo_t.  */
  39. #if defined (__need_ptrdiff_t) || defined (_STDDEF_H_)
  40. #undef _PTRDIFF_T_
  41. #endif
  42. #if defined (__need_size_t) || defined (_STDDEF_H_)
  43. #undef _SIZE_T_
  44. #endif
  45. #if defined (__need_wchar_t) || defined (_STDDEF_H_)
  46. #undef _WCHAR_T_
  47. #endif
  48. #endif /* _ANSI_H_ */
  49.  
  50. /* Sequent's header files use _PTRDIFF_T_ in some conflicting way.
  51.    Just ignore it.  */
  52. #if defined (__sequent__) && defined (_PTRDIFF_T_)
  53. #undef _PTRDIFF_T_
  54. #endif
  55.  
  56. /* In case nobody has defined these types, but we aren't running under
  57.    GCC 2.00, make sure that __PTRDIFF_TYPE__, __SIZE__TYPE__, and
  58.    __WCHAR_TYPE__ have reasonable values.  This can happen if the
  59.    parts of GCC is compiled by an older compiler, that actually
  60.    include gstddef.h, such as collect2.  */
  61.  
  62. /* Signed type of difference of two pointers.  */
  63.  
  64. /* Define this type if we are doing the whole job,
  65.    or if we want this type in particular.  */
  66. #if defined (_STDDEF_H) || defined (__need_ptrdiff_t)
  67. #ifndef _PTRDIFF_T    /* in case <sys/types.h> has defined it. */
  68. #ifndef _T_PTRDIFF_
  69. #ifndef _T_PTRDIFF
  70. #ifndef __PTRDIFF_T
  71. #ifndef _PTRDIFF_T_
  72. #ifndef ___int_ptrdiff_t_h
  73. #ifndef _GCC_PTRDIFF_T
  74. #define _PTRDIFF_T
  75. #define _T_PTRDIFF_
  76. #define _T_PTRDIFF
  77. #define __PTRDIFF_T
  78. #define _PTRDIFF_T_
  79. #define ___int_ptrdiff_t_h
  80. #define _GCC_PTRDIFF_T
  81. #ifndef __PTRDIFF_TYPE__
  82. #define __PTRDIFF_TYPE__ long int
  83. #endif
  84. typedef __PTRDIFF_TYPE__ ptrdiff_t;
  85. #endif /* _GCC_PTRDIFF_T */
  86. #endif /* ___int_ptrdiff_t_h */
  87. #endif /* _PTRDIFF_T_ */
  88. #endif /* __PTRDIFF_T */
  89. #endif /* _T_PTRDIFF */
  90. #endif /* _T_PTRDIFF_ */
  91. #endif /* _PTRDIFF_T */
  92.  
  93. /* If this symbol has done its job, get rid of it.  */
  94. #undef    __need_ptrdiff_t
  95.  
  96. #endif /* _STDDEF_H or __need_ptrdiff_t.  */
  97.  
  98. /* Unsigned type of `sizeof' something.  */
  99.  
  100. /* Define this type if we are doing the whole job,
  101.    or if we want this type in particular.  */
  102. #if defined (_STDDEF_H) || defined (__need_size_t)
  103. #ifndef _SIZE_T    /* in case <sys/types.h> has defined it. */
  104. #ifndef _SYS_SIZE_T_H
  105. #ifndef _T_SIZE_
  106. #ifndef _T_SIZE
  107. #ifndef __SIZE_T
  108. #ifndef _SIZE_T_
  109. #ifndef ___int_size_t_h
  110. #ifndef _GCC_SIZE_T
  111. #ifndef _SIZET_
  112. #define _SIZE_T
  113. #define _SYS_SIZE_T_H
  114. #define _T_SIZE_
  115. #define _T_SIZE
  116. #define __SIZE_T
  117. #define _SIZE_T_
  118. #define ___int_size_t_h
  119. #define _GCC_SIZE_T
  120. #define _SIZET_
  121. #ifndef __SIZE_TYPE__
  122. #define __SIZE_TYPE__ long unsigned int
  123. #endif
  124. typedef __SIZE_TYPE__ size_t;
  125. #endif /* _SIZET_ */
  126. #endif /* _GCC_SIZE_T */
  127. #endif /* ___int_size_t_h */
  128. #endif /* _SIZE_T_ */
  129. #endif /* __SIZE_T */
  130. #endif /* _T_SIZE */
  131. #endif /* _T_SIZE_ */
  132. #endif /* _SYS_SIZE_T_H */
  133. #endif /* _SIZE_T */
  134. #undef    __need_size_t
  135. #endif /* _STDDEF_H or __need_size_t.  */
  136.  
  137.  
  138. /* Wide character type.
  139.    Locale-writers should change this as necessary to
  140.    be big enough to hold unique values not between 0 and 127,
  141.    and not (wchar_t) -1, for each defined multibyte character.  */
  142.  
  143. /* Define this type if we are doing the whole job,
  144.    or if we want this type in particular.  */
  145. #if defined (_STDDEF_H) || defined (__need_wchar_t)
  146. #ifndef _WCHAR_T
  147. #ifndef _T_WCHAR_
  148. #ifndef _T_WCHAR
  149. #ifndef __WCHAR_T
  150. #ifndef _WCHAR_T_
  151. #ifndef ___int_wchar_t_h
  152. #ifndef _GCC_WCHAR_T
  153. #define _WCHAR_T
  154. #define _T_WCHAR_
  155. #define _T_WCHAR
  156. #define __WCHAR_T
  157. #define _WCHAR_T_
  158. #define ___int_wchar_t_h
  159. #define _GCC_WCHAR_T
  160. #ifndef __WCHAR_TYPE__
  161. #define __WCHAR_TYPE__ int
  162. #endif
  163. #ifdef __GNUG__
  164. /* In C++, wchar_t is a distinct basic type,
  165.    and we can expect __wchar_t to be defined by cc1plus.  */
  166. typedef __wchar_t wchar_t;
  167. #else
  168. /* In C, cpp tells us which type to make an alias for.  */
  169. typedef __WCHAR_TYPE__ wchar_t;
  170. #endif
  171. #endif
  172. #endif
  173. #endif
  174. #endif
  175. #endif
  176. #endif
  177. #endif
  178. #undef    __need_wchar_t
  179. #endif /* _STDDEF_H or __need_wchar_t.  */
  180.  
  181. /*  In 4.3bsd-net2, leave these undefined to indicate that size_t, etc.
  182.     are already defined.  */
  183. #ifdef _ANSI_H_
  184. #ifdef _GCC_PTRDIFF_T_
  185. #undef _PTRDIFF_T_
  186. #endif
  187. #ifdef _GCC_SIZE_T_
  188. #undef _SIZE_T_
  189. #endif
  190. #ifdef _GCC_WCHAR_T_
  191. #undef _WCHAR_T_
  192. #endif
  193. #endif /* _ANSI_H_ */
  194.  
  195. #endif /* __sys_stdtypes_h */
  196.  
  197. /* A null pointer constant.  */
  198.  
  199. #if defined (_STDDEF_H) || defined (__need_NULL)
  200. #undef NULL        /* in case <stdio.h> has defined it. */
  201. #define NULL ((void *)0)
  202. #endif    /* NULL not defined and <stddef.h> or need NULL.  */
  203. #undef    __need_NULL
  204.  
  205. #ifdef _STDDEF_H
  206.  
  207. /* Offset of member MEMBER in a struct of type TYPE.  */
  208.  
  209. #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
  210.  
  211. #endif /* _STDDEF_H was defined this time */
  212.  
  213. #endif /* _ANSI_STDDEF_H was not defined before */
  214. #endif /* _STDDEF_H_ was not defined before */
  215. #endif /* _STDDEF_H was not defined before */
  216.