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.

126 lines
2.5 KiB

  1. /***
  2. *new.h - declarations and definitions for C++ memory allocation functions
  3. *
  4. * Copyright (c) 1990-2001, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. * Contains the declarations for C++ memory allocation functions.
  8. *
  9. * [Public]
  10. *
  11. ****/
  12. #if _MSC_VER > 1000
  13. #pragma once
  14. #endif
  15. #ifndef _INC_NEW
  16. #define _INC_NEW
  17. #ifdef __cplusplus
  18. #ifndef _MSC_EXTENSIONS
  19. #include <new>
  20. #endif
  21. #if !defined(_WIN32)
  22. #error ERROR: Only Win32 target supported!
  23. #endif
  24. #if !defined(_W64)
  25. #if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
  26. #define _W64 __w64
  27. #else
  28. #define _W64
  29. #endif
  30. #endif
  31. /* Define _CRTIMP */
  32. #ifndef _CRTIMP
  33. #ifdef _DLL
  34. #define _CRTIMP __declspec(dllimport)
  35. #else /* ndef _DLL */
  36. #define _CRTIMP
  37. #endif /* _DLL */
  38. #endif /* _CRTIMP */
  39. /* Define _CRTIMP2 */
  40. #ifndef _CRTIMP2
  41. #if defined(_DLL) && !defined(_STATIC_CPPLIB)
  42. #define _CRTIMP2 __declspec(dllimport)
  43. #else /* ndef _DLL && !STATIC_CPPLIB */
  44. #define _CRTIMP2
  45. #endif /* _DLL && !STATIC_CPPLIB */
  46. #endif /* _CRTIMP2 */
  47. /* Define __cdecl for non-Microsoft compilers */
  48. #if ( !defined(_MSC_VER) && !defined(__cdecl) )
  49. #define __cdecl
  50. #endif
  51. /* types and structures */
  52. #ifndef _SIZE_T_DEFINED
  53. #ifdef _WIN64
  54. typedef unsigned __int64 size_t;
  55. #else
  56. typedef _W64 unsigned int size_t;
  57. #endif
  58. #define _SIZE_T_DEFINED
  59. #endif
  60. #ifdef _MSC_EXTENSIONS
  61. namespace std {
  62. typedef void (__cdecl * new_handler) ();
  63. _CRTIMP2 new_handler __cdecl set_new_handler(new_handler) throw();
  64. };
  65. using std::new_handler;
  66. using std::set_new_handler;
  67. #endif
  68. #ifndef __PLACEMENT_NEW_INLINE
  69. #define __PLACEMENT_NEW_INLINE
  70. inline void *__cdecl operator new(size_t, void *_P)
  71. {return (_P); }
  72. #if _MSC_VER >= 1200
  73. inline void __cdecl operator delete(void *, void *)
  74. {return; }
  75. #endif
  76. #endif
  77. /*
  78. * new mode flag -- when set, makes malloc() behave like new()
  79. */
  80. _CRTIMP int __cdecl _query_new_mode( void );
  81. _CRTIMP int __cdecl _set_new_mode( int );
  82. #ifndef _PNH_DEFINED
  83. typedef int (__cdecl * _PNH)( size_t );
  84. #define _PNH_DEFINED
  85. #endif
  86. _CRTIMP _PNH __cdecl _query_new_handler( void );
  87. _CRTIMP _PNH __cdecl _set_new_handler( _PNH );
  88. /*
  89. * Microsoft extension:
  90. *
  91. * _NO_ANSI_NEW_HANDLER de-activates the ANSI new_handler. Use this special value
  92. * to support old style (_set_new_handler) behavior.
  93. */
  94. #ifndef _NO_ANSI_NH_DEFINED
  95. #define _NO_ANSI_NEW_HANDLER ((new_handler)-1)
  96. #define _NO_ANSI_NH_DEFINED
  97. #endif
  98. #endif /* __cplusplus */
  99. #endif /* _INC_NEW */