home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / borhead.zip / EXCPT.H < prev    next >
C/C++ Source or Header  |  1994-11-09  |  3KB  |  111 lines

  1. /***
  2. *excpt.h - defines exception values, types and routines
  3. *
  4. *Purpose:
  5. *   This file contains the definitions and prototypes for the compiler-
  6. *   dependent intrinsics, support functions and keywords which implement
  7. *   the structured exception handling extensions.
  8. *
  9. ****/
  10.  
  11. /* $Copyright: 1993$ */
  12.  
  13. #ifndef __EXCPT_H
  14. #define __EXCPT_H
  15.  
  16. #ifdef __cplusplus
  17. extern "C" {
  18. #endif
  19.  
  20. typedef unsigned char BYTE;
  21. typedef unsigned long DWORD;
  22. typedef void          *LPVOID;
  23. typedef unsigned int  UINT;
  24. typedef DWORD         *LPDWORD;
  25. #define WINAPI
  26.  
  27. /* From WINNT.H */
  28. #define EXCEPTION_CONTINUABLE        0      // Continuable exception
  29. #define EXCEPTION_NONCONTINUABLE     0x1    // Noncontinuable exception
  30.  
  31. //
  32. // Exception record definition.
  33. //
  34.  
  35. typedef struct _EXCEPTION_RECORD {
  36.     DWORD ExceptionCode;
  37.     DWORD ExceptionFlags;
  38.     struct _EXCEPTION_RECORD *ExceptionRecord;
  39.     LPVOID ExceptionAddress;
  40.     UINT NumberParameters;
  41.     DWORD ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
  42. } EXCEPTION_RECORD;
  43.  
  44. typedef EXCEPTION_RECORD *PEXCEPTION_RECORD;
  45.  
  46. //
  47. // Typedef for pointer returned by exception_info()
  48. //
  49.  
  50. struct  _CONTEXT;
  51.  
  52. typedef struct  _CONTEXT        *PCONTEXT;
  53.  
  54. typedef struct _EXCEPTION_POINTERS {
  55.     PEXCEPTION_RECORD ExceptionRecord;
  56.     PCONTEXT ContextRecord;
  57. } EXCEPTION_POINTERS, *PEXCEPTION_POINTERS;
  58.  
  59. long
  60. WINAPI
  61. UnhandledExceptionFilter(PEXCEPTION_POINTERS ExceptionInfo);
  62.  
  63. typedef long (WINAPI *PTOP_LEVEL_EXCEPTION_FILTER)(
  64.    PEXCEPTION_POINTERS ExceptionInfo
  65.    );
  66. typedef PTOP_LEVEL_EXCEPTION_FILTER LPTOP_LEVEL_EXCEPTION_FILTER;
  67.  
  68. LPTOP_LEVEL_EXCEPTION_FILTER
  69. WINAPI
  70. SetUnhandledExceptionFilter(
  71.    LPTOP_LEVEL_EXCEPTION_FILTER lpTopLevelExceptionFilter
  72.    );
  73.  
  74. /*
  75.  * Exception disposition return values.
  76.  */
  77. typedef enum _EXCEPTION_DISPOSITION {
  78.     ExceptionContinueExecution,
  79.     ExceptionContinueSearch,
  80.     ExceptionNestedException,
  81.     ExceptionCollidedUnwind
  82. } EXCEPTION_DISPOSITION;
  83.  
  84.  
  85. /*
  86.  * Borland C++
  87.  */
  88. #ifndef __cplusplus
  89. #  define try                       __try
  90. #  define finally                   __finally
  91. #  define AbnormalTermination()     __abnormal_termination
  92. #endif
  93.  
  94. #  define except                    __except
  95. #  define GetExceptionCode()        __exception_code
  96. #  define GetExceptionInformation() ((PEXCEPTION_POINTERS)__exception_info)
  97.  
  98. /*
  99.  * Legal values for expression in except().
  100.  */
  101.  
  102. #define EXCEPTION_EXECUTE_HANDLER        1
  103. #define EXCEPTION_CONTINUE_SEARCH        0
  104. #define EXCEPTION_CONTINUE_EXECUTION    -1
  105.  
  106. #ifdef __cplusplus
  107. }
  108. #endif
  109.  
  110. #endif  /* __EXCPT_H */
  111.