home *** CD-ROM | disk | FTP | other *** search
/ C Programming Starter Kit 2.0 / SamsPublishing-CProgrammingStarterKit-v2.0-Win31.iso / bc45 / inc.pak / EXCEPT.H < prev    next >
C/C++ Source or Header  |  1997-07-23  |  3KB  |  135 lines

  1. /*  except.h
  2.  
  3.     Definitions for exception handling
  4.  
  5. */
  6.  
  7. /*
  8.  *      C/C++ Run Time Library - Version 6.5
  9.  *
  10.  *      Copyright (c) 1992, 1994 by Borland International
  11.  *      All Rights Reserved.
  12.  *
  13.  */
  14.  
  15. #ifndef __cplusplus
  16. #error Must use C++ for except.h
  17. #endif
  18.  
  19. #ifndef __EXCEPT_H
  20. #define __EXCEPT_H
  21.  
  22. #if !defined(___DEFS_H)
  23. #include <_defs.h>
  24. #endif
  25.  
  26. #if !defined(___STDLIB_H)
  27. #include <stdlib.h>
  28. #endif
  29.  
  30.  
  31. #if !defined(RC_INVOKED)
  32.  
  33. #pragma option -a-      // byte packing
  34.  
  35. #if defined(__BCOPT__)
  36. #if !defined(_RTL_ALLOW_po) && !defined(__FLAT__)
  37. #pragma option -po-     // disable Object data calling convention
  38. #endif
  39. #endif
  40.  
  41. #if !defined(__TINY__)
  42. #pragma option -RT
  43. #endif
  44.  
  45. #pragma option -Vo-     // set standard C++ options
  46.  
  47. #if defined(__STDC__)
  48. #pragma warn -nak
  49. #endif
  50.  
  51. #endif  /* !RC_INVOKED */
  52.  
  53.  
  54. typedef void (_RTLENTRY *terminate_function)();
  55. typedef void (_RTLENTRY *unexpected_function)();
  56.  
  57. terminate_function  _RTLENTRY set_terminate(terminate_function);
  58. unexpected_function _RTLENTRY set_unexpected(unexpected_function);
  59.  
  60. terminate_function  _RTLENTRY terminate();
  61. unexpected_function _RTLENTRY unexpected();
  62.  
  63. extern  char _FAR * _RTLENTRY __ThrowFileName();
  64. extern  unsigned    _RTLENTRY __ThrowLineNumber();
  65. extern  char _FAR * _RTLENTRY __ThrowExceptionName();
  66.  
  67. #define  __throwFileName      __ThrowFileName()
  68. #define  __throwLineNumber    __ThrowLineNumber()
  69. #define  __throwExceptionName __ThrowExceptionName()
  70.  
  71. class _EXPCLASS string;
  72.  
  73. class _EXPCLASS xmsg
  74. {
  75. public:
  76.     _RTLENTRY xmsg(const string _FAR &msg);
  77.     _RTLENTRY xmsg(const xmsg _FAR &msg);
  78.     _RTLENTRY ~xmsg();
  79.  
  80.     const string _FAR & _RTLENTRY why() const;
  81.     void                _RTLENTRY raise() throw(xmsg);
  82.     xmsg&               _RTLENTRY operator=(const xmsg _FAR &src);
  83.  
  84. private:
  85.     string _FAR *str;
  86. };
  87.  
  88. inline const string _FAR & _RTLENTRY xmsg::why() const
  89. {
  90.     return *str;
  91. };
  92.  
  93. class _EXPCLASS xalloc : public xmsg
  94. {
  95. public:
  96.     _RTLENTRY xalloc(const string _FAR &msg, size_t size);
  97.  
  98.     size_t _RTLENTRY requested() const;
  99.     void   _RTLENTRY raise() throw(xalloc);
  100.  
  101. private:
  102.     size_t siz;
  103. };
  104.  
  105. inline size_t _RTLENTRY xalloc::requested() const
  106. {
  107.     return siz;
  108. }
  109.  
  110.  
  111. #if !defined(RC_INVOKED)
  112.  
  113. #if defined(__STDC__)
  114. #pragma warn .nak
  115. #endif
  116.  
  117. #pragma option -Vo.     // restore user C++ options
  118.  
  119. #if !defined(__TINY__)
  120. #pragma option -RT.
  121. #endif
  122.  
  123. #if defined(__BCOPT__)
  124. #if !defined(_RTL_ALLOW_po) && !defined(__FLAT__)
  125. #pragma option -po.     // restore Object data calling convention
  126. #endif
  127. #endif
  128.  
  129. #pragma option -a.      // restore default packing
  130.  
  131. #endif  /* !RC_INVOKED */
  132.  
  133.  
  134. #endif  // __EXCEPT_H
  135.