Source code of Windows XP (NT5)
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.

143 lines
2.5 KiB

  1. /***
  2. *stddef.h - definitions/declarations for common constants, types, variables
  3. *
  4. * Copyright (c) 1985-2001, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. * This file contains definitions and declarations for some commonly
  8. * used constants, types, and variables.
  9. * [ANSI]
  10. *
  11. * [Public]
  12. *
  13. ****/
  14. #if _MSC_VER > 1000
  15. #pragma once
  16. #endif
  17. #ifndef _INC_STDDEF
  18. #define _INC_STDDEF
  19. #if !defined(_WIN32)
  20. #error ERROR: Only Win32 target supported!
  21. #endif
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. #if !defined(_W64)
  26. #if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
  27. #define _W64 __w64
  28. #else
  29. #define _W64
  30. #endif
  31. #endif
  32. /* Define _CRTIMP */
  33. #ifndef _CRTIMP
  34. #ifdef _DLL
  35. #define _CRTIMP __declspec(dllimport)
  36. #else /* ndef _DLL */
  37. #define _CRTIMP
  38. #endif /* _DLL */
  39. #endif /* _CRTIMP */
  40. /* Define __cdecl for non-Microsoft compilers */
  41. #if ( !defined(_MSC_VER) && !defined(__cdecl) )
  42. #define __cdecl
  43. #endif
  44. /* Define NULL pointer value */
  45. #ifndef NULL
  46. #ifdef __cplusplus
  47. #define NULL 0
  48. #else
  49. #define NULL ((void *)0)
  50. #endif
  51. #endif
  52. /* Declare reference to errno */
  53. #if defined(_MT) || defined(_DLL)
  54. _CRTIMP extern int * __cdecl _errno(void);
  55. #define errno (*_errno())
  56. #else /* ndef _MT && ndef _DLL */
  57. _CRTIMP extern int errno;
  58. #endif /* _MT || _DLL */
  59. /* Define the implementation dependent size types */
  60. #ifndef _INTPTR_T_DEFINED
  61. #ifdef _WIN64
  62. typedef __int64 intptr_t;
  63. #else
  64. typedef _W64 int intptr_t;
  65. #endif
  66. #define _INTPTR_T_DEFINED
  67. #endif
  68. #ifndef _UINTPTR_T_DEFINED
  69. #ifdef _WIN64
  70. typedef unsigned __int64 uintptr_t;
  71. #else
  72. typedef _W64 unsigned int uintptr_t;
  73. #endif
  74. #define _UINTPTR_T_DEFINED
  75. #endif
  76. #ifndef _PTRDIFF_T_DEFINED
  77. #ifdef _WIN64
  78. typedef __int64 ptrdiff_t;
  79. #else
  80. typedef _W64 int ptrdiff_t;
  81. #endif
  82. #define _PTRDIFF_T_DEFINED
  83. #endif
  84. #ifndef _SIZE_T_DEFINED
  85. #ifdef _WIN64
  86. typedef unsigned __int64 size_t;
  87. #else
  88. typedef _W64 unsigned int size_t;
  89. #endif
  90. #define _SIZE_T_DEFINED
  91. #endif
  92. #ifndef _WCHAR_T_DEFINED
  93. typedef unsigned short wchar_t;
  94. #define _WCHAR_T_DEFINED
  95. #endif
  96. /* Define offsetof macro */
  97. #ifdef _WIN64
  98. #define offsetof(s,m) (size_t)( (ptrdiff_t)&(((s *)0)->m) )
  99. #else
  100. #define offsetof(s,m) (size_t)&(((s *)0)->m)
  101. #endif
  102. #ifdef _MT
  103. _CRTIMP extern unsigned long __cdecl __threadid(void);
  104. #define _threadid (__threadid())
  105. _CRTIMP extern uintptr_t __cdecl __threadhandle(void);
  106. #endif
  107. #ifdef __cplusplus
  108. }
  109. #endif
  110. #endif /* _INC_STDDEF */