home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / include / excpt.h < prev    next >
C/C++ Source or Header  |  1998-06-16  |  3KB  |  159 lines

  1. /***
  2. *excpt.h - defines exception values, types and routines
  3. *
  4. *       Copyright (c) 1990-1997, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. *       This file contains the definitions and prototypes for the compiler-
  8. *       dependent intrinsics, support functions and keywords which implement
  9. *       the structured exception handling extensions.
  10. *
  11. *       [Public]
  12. *
  13. ****/
  14.  
  15. #if     _MSC_VER > 1000
  16. #pragma once
  17. #endif
  18.  
  19. #ifndef _INC_EXCPT
  20. #define _INC_EXCPT
  21.  
  22. #if     !defined(_WIN32) && !defined(_MAC)
  23. #error ERROR: Only Mac or Win32 targets supported!
  24. #endif
  25.  
  26.  
  27. #ifdef  _MSC_VER
  28. /*
  29.  * Currently, all MS C compilers for Win32 platforms default to 8 byte
  30.  * alignment.
  31.  */
  32. #pragma pack(push,8)
  33. #endif  /* _MSC_VER */
  34.  
  35. #ifdef  __cplusplus
  36. extern "C" {
  37. #endif
  38.  
  39.  
  40.  
  41. /* Define _CRTIMP */
  42.  
  43. #ifndef _CRTIMP
  44. #ifdef  _DLL
  45. #define _CRTIMP __declspec(dllimport)
  46. #else   /* ndef _DLL */
  47. #define _CRTIMP
  48. #endif  /* _DLL */
  49. #endif  /* _CRTIMP */
  50.  
  51.  
  52. /* Define __cdecl for non-Microsoft compilers */
  53.  
  54. #if     ( !defined(_MSC_VER) && !defined(__cdecl) )
  55. #define __cdecl
  56. #endif
  57.  
  58. /* Define _CRTAPI1 (for compatibility with the NT SDK) */
  59.  
  60. #ifndef _CRTAPI1
  61. #if    _MSC_VER >= 800 && _M_IX86 >= 300
  62. #define _CRTAPI1 __cdecl
  63. #else
  64. #define _CRTAPI1
  65. #endif
  66. #endif
  67.  
  68.  
  69. /*
  70.  * Exception disposition return values.
  71.  */
  72. typedef enum _EXCEPTION_DISPOSITION {
  73.     ExceptionContinueExecution,
  74.     ExceptionContinueSearch,
  75.     ExceptionNestedException,
  76.     ExceptionCollidedUnwind
  77. } EXCEPTION_DISPOSITION;
  78.  
  79.  
  80. /*
  81.  * Prototype for SEH support function.
  82.  */
  83.  
  84. #ifdef  _M_IX86
  85.  
  86. /*
  87.  * Declarations to keep MS C 8 (386/486) compiler happy
  88.  */
  89. struct _EXCEPTION_RECORD;
  90. struct _CONTEXT;
  91.  
  92. EXCEPTION_DISPOSITION __cdecl _except_handler (
  93.     struct _EXCEPTION_RECORD *ExceptionRecord,
  94.     void * EstablisherFrame,
  95.     struct _CONTEXT *ContextRecord,
  96.     void * DispatcherContext
  97.     );
  98.  
  99. #elif   defined(_M_MRX000) || defined(_M_ALPHA) || defined(_M_PPC)
  100.  
  101. /*
  102.  * Declarations to keep MIPS, ALPHA, and PPC compiler happy
  103.  */
  104. typedef struct _EXCEPTION_POINTERS *Exception_info_ptr;
  105. struct _EXCEPTION_RECORD;
  106. struct _CONTEXT;
  107. struct _DISPATCHER_CONTEXT;
  108.  
  109.  
  110. _CRTIMP EXCEPTION_DISPOSITION __C_specific_handler (
  111.     struct _EXCEPTION_RECORD *ExceptionRecord,
  112.     void *EstablisherFrame,
  113.     struct _CONTEXT *ContextRecord,
  114.     struct _DISPATCHER_CONTEXT *DispatcherContext
  115.     );
  116.  
  117. #endif
  118.  
  119.  
  120. /*
  121.  * Keywords and intrinsics for SEH
  122.  */
  123.  
  124. #ifdef  _MSC_VER
  125.  
  126. #define GetExceptionCode            _exception_code
  127. #define exception_code              _exception_code
  128. #define GetExceptionInformation     (struct _EXCEPTION_POINTERS *)_exception_info
  129. #define exception_info              (struct _EXCEPTION_POINTERS *)_exception_info
  130. #define AbnormalTermination         _abnormal_termination
  131. #define abnormal_termination        _abnormal_termination
  132.  
  133. unsigned long __cdecl _exception_code(void);
  134. void *        __cdecl _exception_info(void);
  135. int           __cdecl _abnormal_termination(void);
  136.  
  137. #endif
  138.  
  139.  
  140. /*
  141.  * Legal values for expression in except().
  142.  */
  143.  
  144. #define EXCEPTION_EXECUTE_HANDLER       1
  145. #define EXCEPTION_CONTINUE_SEARCH       0
  146. #define EXCEPTION_CONTINUE_EXECUTION    -1
  147.  
  148.  
  149.  
  150. #ifdef  __cplusplus
  151. }
  152. #endif
  153.  
  154. #ifdef  _MSC_VER
  155. #pragma pack(pop)
  156. #endif  /* _MSC_VER */
  157.  
  158. #endif  /* _INC_EXCPT */
  159.