Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

224 lines
7.5 KiB

  1. #ifndef STDTYP_H
  2. #define STDTYP_H
  3. /*******************************************************************
  4. Filename: STDTYP.H
  5. (c) 1989, ATI Technologies Incorporated.
  6. $Revision: 1.1 $
  7. $Date: 23 Dec 1994 10:48:20 $
  8. $Author: ASHANMUG $
  9. $Log: S:/source/wnt/ms11/miniport/vcs/stdtyp.h $
  10. *
  11. * Rev 1.1 23 Dec 1994 10:48:20 ASHANMUG
  12. * ALPHA/Chrontel-DAC
  13. *
  14. * Rev 1.0 31 Jan 1994 11:49:02 RWOLFF
  15. * Initial revision.
  16. Rev 1.1 03 Sep 1993 14:29:46 RWOLFF
  17. Type definitions used by Windows NT driver.
  18. Rev 1.1 24 Feb 1993 11:05:20 Ajith_S
  19. Check for MSDOS and not far as #ifdef far always returns FALSE
  20. Rev 1.0 13 Jan 1993 14:16:12 Robert_Wolff
  21. Initial revision.
  22. Rev 1.14 15 Apr 1991 16:26:30 Bryan_Sniderman
  23. Corrected WORD definition from 'unsigned int' to 'unsigned short'
  24. This will force a WORD to 16-bits (even in HIGH-C)
  25. Rev 1.13 06 Dec 1990 12:02:22 Chris_Brady
  26. Added support for Metaware HIGHC compiler. Define P386.
  27. Rev 1.12 04 Jun 1990 15:54:18 Sandy_Lum
  28. Corrected syntax error
  29. Rev 1.11 17 May 1990 10:02:00 Robin_Davies
  30. Added TINY, UTINY base types.
  31. Rev 1.10 28 Sep 1989 11:41:14 Robin_Davies
  32. Made PRIVATE declarator conditional, allowing all PRIVATE labels
  33. to be published from the command line by adding /DPRIVATE option
  34. to CL options. Useful for debugging purposes.
  35. Rev 1.9 17 Sep 1989 16:10:16 Robin_Davies
  36. "define HUGE huge" conflicts with ANSI definition of HUGE in
  37. MATH.H. Replaced with "define ENORMOUSE huge".
  38. Rev 1.8 15 Sep 1989 16:39:10 Peter Liepa
  39. added HUGE keyword
  40. Rev 1.7 30 Jun 1989 11:06:52 Peter Michalek
  41. FALSE , TRUE added
  42. Rev 1.6 28 Jun 1989 15:00:28 Robin_Davies
  43. Added FLOAT and DOUBLE.
  44. Rev 1.5 28 Jun 1989 14:34:54 Robin_Davies
  45. Removed double-slash comments.
  46. Rev 1.4 21 Jun 1989 15:34:06 Peter Liepa
  47. removed hard tabs
  48. Rev 1.3 20 Jun 1989 15:45:20 Peter Liepa
  49. corrected spelling of "SUCCESS", fixed up line overflows
  50. Rev 1.2 16 Jun 1989 9:51:56 Robin_Davies
  51. Made headers consistent.
  52. Rev 1.1 14 Jun 1989 15:27:38 Robin_Davies
  53. Added OFFSET, SEGMENT macros.
  54. Rev 1.0 14 Jun 1989 9:20:24 Robin_Davies
  55. Initial revision.
  56. ********************************************************************/
  57. #ifdef DOC
  58. STDTYP.H - Portable types for C programs.
  59. DESCRIPTION
  60. This file contains standard augmented types for C programs. Types
  61. are based on and are compatible with Microsoft OS/2 types.
  62. In addition, several Plum-Hall/Whitesmith standard types
  63. have been added.
  64. This header currently supports the Microsoft C 5.1 compiler.
  65. and the Metaware High C 386 Protected mode Version 1.6 compiler
  66. by defining P386.
  67. #endif
  68. #ifndef INT_MAX /* Defined in limits.h */
  69. #include <limits.h> /* Ansi type limits, matching augmented types */
  70. #endif
  71. /*
  72. *****************************
  73. Standard Defines
  74. *****************************
  75. */
  76. #define YES 1
  77. #define NO 0
  78. /*
  79. * Some platforms have already defined TRUE and/or FALSE.
  80. */
  81. #ifndef TRUE
  82. #define TRUE (1) /* Function TRUE value */
  83. #endif
  84. #ifndef FALSE
  85. #define FALSE (0) /* Function FALSE value */
  86. #endif
  87. #ifndef P386
  88. #define SUCCESS 0
  89. #define FAIL 1
  90. #endif
  91. /*
  92. * Non-portable types. Data size references are not needed
  93. * for Windows NT, since it's a 32 bit operating system.
  94. * Only define the basic types for platforms (e.g. Windows NT)
  95. * where they aren't already defined.
  96. */
  97. typedef unsigned char BYTE; /* 8 bits unsigned */
  98. typedef unsigned short WORD; /* 16 bits unsigned */
  99. /*
  100. **************************
  101. BASE TYPES
  102. **************************
  103. */
  104. typedef char CHAR; /* At least 8 bits, sign indeterminate */
  105. typedef short SHORT; /* At least 16 bits signed */
  106. typedef long LONG; /* At least 32 bits signed */
  107. typedef float FLOAT; /* Floating point, unspecified precision */
  108. typedef double DOUBLE; /* Floating point, unspecified precision */
  109. typedef unsigned char UCHAR; /* At least 8 bits, unsigned */
  110. typedef signed char SCHAR; /* At least 8 bits, signed */
  111. typedef unsigned short USHORT; /* At least 16 bits, unsigned */
  112. typedef unsigned long ULONG; /* At least 32 bits, signed */
  113. typedef unsigned char UTINY; /* Scalar, at least 8 bits , unsigned */
  114. typedef char TINY; /* Scalar, at least 8 bits, signed */
  115. /*
  116. ****************************
  117. ARTIFICIAL TYPES
  118. ****************************
  119. */
  120. #ifndef PRIVATE
  121. #define PRIVATE static /* Local functions and variables */
  122. #endif
  123. typedef int METACHAR; /* Sufficient to hold any character and EOF */
  124. typedef int BOOL; /* Most efficient Boolean,
  125. compare against zero only! */
  126. typedef char TBOOL; /* Smallest boolean, e.g. for use in arrays.
  127. Compare against zero only */
  128. typedef unsigned int BITS; /* At least 16 bits, used for bit manipulation */
  129. typedef unsigned char TBITS; /* At least 8 bits, used for bit manipulation */
  130. typedef unsigned long int LBITS; /* At least 32 bits, used for bit manipulation */
  131. #ifndef _BASETSD_H_
  132. typedef unsigned int SIZE_T; /* sufficent for sizeof(anything)
  133. e.g. malloc size. Equivalent to ansi size_t */
  134. #endif
  135. #if defined(__LARGE__) || defined(__HUGE__) || defined(__COMPACT__)
  136. typedef long PTRDIFF_T; /* difference between pointers.
  137. Equivalent to ansi ptrdiff_t */
  138. #else
  139. typedef int PTRDIFF_T; /* difference between pointers.
  140. Equivalent to ansi ptrdiff_t */
  141. #endif
  142. /*
  143. ****************************
  144. POINTERS
  145. ****************************
  146. */
  147. typedef void *PVOID; /* Generic untyped pointer */
  148. typedef int (*PFUNC)(); /* Pointer to Function (model dependent) */
  149. /*
  150. ****************************
  151. Useful Macros
  152. ****************************
  153. */
  154. #define FOREVER for(;;)
  155. #define NOTHING /**/ /* e.g. while (condition) NOTHING */
  156. /* Create untyped far pointer from selector and offset */
  157. #define MAKEP(sel, off) ((PVOID)MAKEULONG(off, sel))
  158. /* Extract selector or offset from far pointer. e.g. OFFSET(&x) */
  159. #define OFFSET(p) LOWORD((VOID FAR *) (p))
  160. #define SEGMENT(p) HIWORD((VOID FAR *) (p))
  161. /* Cast any variable to an instance of the specified type. */
  162. #define MAKETYPE(v, type) (*((type *)&v))
  163. /* Calculate the byte offset of a field in a structure of type type. */
  164. #define FIELDOFFSET(type, field) ((SHORT)&(((type *)0)->field))
  165. /* Combine l & h to form a 32 bit quantity. */
  166. #define MAKEULONG(l, h) ((ULONG)(((USHORT)(l)) | ((ULONG)((USHORT)(h))) << 16))
  167. #define MAKELONG(l, h) ((LONG)MAKEULONG(l, h))
  168. /* Combine l & h to form a 16 bit quantity. */
  169. #define MAKEWORD(l, h) (((WORD)(l)) | ((WORD)(h)) << 8)
  170. #define MAKESHORT(l, h) ((SHORT)MAKEUSHORT(l, h))
  171. /* Extract high and low order parts of 16 and 32 bit quantity */
  172. #define LOBYTE(w) ((BYTE)(w))
  173. #define HIBYTE(w) ((BYTE)(((WORD)(w) >> 8) & 0xff))
  174. #define LOWORD(l) ((WORD)(l))
  175. #define HIWORD(l) ((WORD)(((ULONG)(l) >> 16) & 0xffff))
  176. #endif /* defined STDTYP_H */