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.

129 lines
2.2 KiB

  1. /***
  2. *stddef.h - definitions/declarations for common constants, types, variables
  3. *
  4. * Copyright (c) 1985-1995, 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. #ifndef _INC_STDDEF
  15. #define _INC_STDDEF
  16. #if !defined(_WIN32) && !defined(_MAC)
  17. #error ERROR: Only Mac or Win32 targets supported!
  18. #endif
  19. #ifdef __cplusplus
  20. extern "C" {
  21. #endif
  22. /* Define _CRTAPI1 (for compatibility with the NT SDK) */
  23. #ifndef _CRTAPI1
  24. #if _MSC_VER >= 800 && _M_IX86 >= 300
  25. #define _CRTAPI1 __cdecl
  26. #else
  27. #define _CRTAPI1
  28. #endif
  29. #endif
  30. /* Define _CRTAPI2 (for compatibility with the NT SDK) */
  31. #ifndef _CRTAPI2
  32. #if _MSC_VER >= 800 && _M_IX86 >= 300
  33. #define _CRTAPI2 __cdecl
  34. #else
  35. #define _CRTAPI2
  36. #endif
  37. #endif
  38. /* Define _CRTIMP */
  39. #ifndef _CRTIMP
  40. #ifdef _NTSDK
  41. /* definition compatible with NT SDK */
  42. #define _CRTIMP
  43. #else /* ndef _NTSDK */
  44. /* current definition */
  45. #ifdef _DLL
  46. #define _CRTIMP __declspec(dllimport)
  47. #else /* ndef _DLL */
  48. #define _CRTIMP
  49. #endif /* _DLL */
  50. #endif /* _NTSDK */
  51. #endif /* _CRTIMP */
  52. /* Define __cdecl for non-Microsoft compilers */
  53. #if ( !defined(_MSC_VER) && !defined(__cdecl) )
  54. #define __cdecl
  55. #endif
  56. /* Define NULL pointer value and the offset() macro */
  57. #ifndef NULL
  58. #ifdef __cplusplus
  59. #define NULL 0
  60. #else
  61. #define NULL ((void *)0)
  62. #endif
  63. #endif
  64. #define offsetof(s,m) (size_t)&(((s *)0)->m)
  65. /* Declare reference to errno */
  66. #if (defined(_MT) || defined(_DLL)) && (!defined(_M_MPPC) && !defined(_M_M68K))
  67. _CRTIMP extern int * __cdecl _errno(void);
  68. #define errno (*_errno())
  69. #else /* ndef _MT && ndef _DLL */
  70. _CRTIMP extern int errno;
  71. #endif /* _MT || _DLL */
  72. /* define the implementation dependent size types */
  73. #ifndef _PTRDIFF_T_DEFINED
  74. typedef int ptrdiff_t;
  75. #define _PTRDIFF_T_DEFINED
  76. #endif
  77. #ifndef _SIZE_T_DEFINED
  78. typedef unsigned int size_t;
  79. #define _SIZE_T_DEFINED
  80. #endif
  81. #ifndef _WCHAR_T_DEFINED
  82. typedef unsigned short wchar_t;
  83. #define _WCHAR_T_DEFINED
  84. #endif
  85. #ifdef _MT
  86. _CRTIMP extern unsigned long __cdecl __threadid(void);
  87. #define _threadid (__threadid())
  88. _CRTIMP extern unsigned long __cdecl __threadhandle(void);
  89. #endif
  90. #ifdef __cplusplus
  91. }
  92. #endif
  93. #endif /* _INC_STDDEF */