home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 2000 May / PCP163A.iso / Runimage / Cbuilder4 / Include / EXCPT.H < prev    next >
Encoding:
C/C++ Source or Header  |  1999-01-26  |  5.0 KB  |  189 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. /*
  12.  *      C/C++ Run Time Library - Version 9.5
  13.  *
  14.  *      Copyright (c) 1990, 1999 by Inprise Corporation
  15.  *      All Rights Reserved.
  16.  *
  17.  */
  18.  
  19.  
  20.  
  21.  
  22. #ifndef __EXCPT_H
  23. #pragma option push -b -a8 -pc -A- /*P_O_Push_S*/
  24. #define __EXCPT_H
  25. #pragma option push -b
  26.  
  27.  
  28. #ifdef __cplusplus
  29. extern "C" {
  30. #endif
  31.  
  32. /*
  33.  * Conditional macro definition for function calling type and variable type
  34.  * qualifiers.
  35.  */
  36. #if   ( (_MSC_VER >= 800) && (_M_IX86 >= 300) ) || defined(__BORLANDC__)
  37.  
  38. /* From WINNT.H */
  39. #define EXCEPTION_CONTINUABLE        0      // Continuable exception
  40. #define EXCEPTION_NONCONTINUABLE     0x1    // Noncontinuable exception
  41. #define EXCEPTION_MAXIMUM_PARAMETERS 15     // maximum number of exception parameters
  42.  
  43. /*
  44.  * Definitions for MS C8-32 (386/486) compiler
  45.  */
  46. #define _CRTAPI1 __cdecl
  47. #define _CRTAPI2 __cdecl
  48.  
  49. #else
  50.  
  51. /*
  52.  * Other compilers (e.g., MIPS)
  53.  */
  54. #define _CRTAPI1
  55. #define _CRTAPI2
  56.  
  57. #endif
  58.  
  59.  
  60. /*
  61.  * Exception disposition return values.
  62.  */
  63. typedef enum _EXCEPTION_DISPOSITION {
  64.     ExceptionContinueExecution,
  65.     ExceptionContinueSearch,
  66.     ExceptionNestedException,
  67.     ExceptionCollidedUnwind
  68. } EXCEPTION_DISPOSITION;
  69.  
  70.  
  71. /*
  72.  * Prototype for SEH support function.
  73.  */
  74.  
  75. #if defined(_M_IX86)
  76.  
  77. /*
  78.  * Declarations to keep MS C 8 (386/486) compiler happy
  79.  */
  80. struct _EXCEPTION_RECORD;
  81. struct _CONTEXT;
  82.  
  83. EXCEPTION_DISPOSITION _CRTAPI2 _except_handler (
  84.         struct _EXCEPTION_RECORD *ExceptionRecord,
  85.         void *EstablisherFrame,
  86.         struct _CONTEXT *ContextRecord,
  87.         void *DispatcherContext
  88.         );
  89.  
  90. #elif defined(_M_MRX000) || defined(_MIPS_) || defined(_ALPHA_)
  91.  
  92. /*
  93.  * Declarations to keep MIPS and ALPHA compiler happy
  94.  */
  95. typedef struct _EXCEPTION_POINTERS *Exception_info_ptr;
  96. struct _EXCEPTION_RECORD;
  97. struct _CONTEXT;
  98. struct _DISPATCHER_CONTEXT;
  99.  
  100.  
  101. EXCEPTION_DISPOSITION __C_specific_handler (
  102.         struct _EXCEPTION_RECORD *ExceptionRecord,
  103.         void *EstablisherFrame,
  104.         struct _CONTEXT *ContextRecord,
  105.         struct _DISPATCHER_CONTEXT *DispatcherContext
  106.         );
  107.  
  108. #endif
  109.  
  110.  
  111. /*
  112.  * Keywords and intrinsics for SEH
  113.  */
  114.  
  115. #if defined(__BORLANDC__)
  116. /*
  117.  * Borland C++
  118.  */
  119. #ifndef __cplusplus
  120. #  define try                       __try
  121. #  define finally                   __finally
  122. #  define AbnormalTermination()     __abnormal_termination
  123. #  define abnormal_termination()    __abnormal_termination
  124. #endif
  125. #define except                      __except
  126.  
  127. #  define GetExceptionCode()        __exception_code
  128. #  define exception_code()          __exception_code
  129. #  define GetExceptionInformation() ((PEXCEPTION_POINTERS)__exception_info)
  130. #  define exception_info()          ((PEXCEPTION_POINTERS)__exception_info)
  131.  
  132. #elif     ( _MSC_VER >= 800 )
  133. /*
  134.  * MS C8-32 (386/486)
  135.  */
  136. #define try                             __try
  137. #define except                          __except
  138. #define finally                         __finally
  139. #define leave                           __leave
  140. #define GetExceptionCode                _exception_code
  141. #define exception_code                  _exception_code
  142. #define GetExceptionInformation         (struct _EXCEPTION_POINTERS *)_exception_info
  143. #define exception_info                  (struct _EXCEPTION_POINTERS *)_exception_info
  144. #define AbnormalTermination             _abnormal_termination
  145. #define abnormal_termination            _abnormal_termination
  146.  
  147. unsigned long _CRTAPI1 _exception_code(void);
  148. void *        _CRTAPI1 _exception_info(void);
  149. int           _CRTAPI1 _abnormal_termination(void);
  150.  
  151. #elif defined(_M_MRX000) || defined(_MIPS_) || defined(_ALPHA_)
  152. /*
  153.  * MIPS or ALPHA compiler
  154.  */
  155. #define try                             __builtin_try
  156. #define except                          __builtin_except
  157. #define finally                         __builtin_finally
  158. #define leave                           __builtin_leave
  159. #define GetExceptionCode()              __exception_code
  160. #define exception_code()                __exception_code
  161. #define GetExceptionInformation()       (struct _EXCEPTION_POINTERS *)__exception_info
  162. #define exception_info()                (struct _EXCEPTION_POINTERS *)__exception_info
  163. #define AbnormalTermination()           __abnormal_termination
  164. #define abnormal_termination()          __abnormal_termination
  165.  
  166. extern unsigned long __exception_code;
  167. extern int           __exception_info;
  168. extern int           __abnormal_termination;
  169.  
  170. #endif
  171.  
  172.  
  173. /*
  174.  * Legal values for expression in except().
  175.  */
  176.  
  177. #define EXCEPTION_EXECUTE_HANDLER        1
  178. #define EXCEPTION_CONTINUE_SEARCH        0
  179. #define EXCEPTION_CONTINUE_EXECUTION    -1
  180.  
  181. #ifdef __cplusplus
  182. }
  183. #endif
  184.  
  185.  
  186. #pragma option pop
  187. #pragma option pop /*P_O_Pop*/
  188. #endif  /* __EXCPT_H */
  189.