home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c083 / 14.ddi / GENINC.PAK / EXCEPT.H < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-02  |  2.2 KB  |  100 lines

  1. /*  except.h
  2.  
  3.     Definitions for exception handling
  4.  
  5. */
  6.  
  7. /*
  8.  *      C/C++ Run Time Library - Version 6.0
  9.  *
  10.  *      Copyright (c) 1992, 1993 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. #if !defined(___STDLIB_H)
  26. #include <stdlib.h>
  27. #endif
  28.  
  29. #pragma option -a-      // byte packing
  30. #pragma option -Vo-     // set standard C++ options
  31. #pragma option -RT
  32.  
  33. #if defined(__BCOPT__) && !defined(_RTL_ALLOW_po) && !defined(__FLAT__)
  34. #pragma option -po-     // disable Object data calling convention
  35. #endif
  36.  
  37. typedef void (_RTLENTRY *terminate_function)();
  38. typedef void (_RTLENTRY *unexpected_function)();
  39.  
  40. terminate_function  _RTLENTRY set_terminate(terminate_function);
  41. unexpected_function _RTLENTRY set_unexpected(unexpected_function);
  42.  
  43. terminate_function  _RTLENTRY terminate();
  44. unexpected_function _RTLENTRY unexpected();
  45.  
  46. extern  char _FAR * _RTLENTRY __ThrowFileName();
  47. extern  unsigned    _RTLENTRY __ThrowLineNumber();
  48. extern  char _FAR * _RTLENTRY __ThrowExceptionName();
  49.  
  50. #define  __throwFileName      __ThrowFileName()
  51. #define  __throwLineNumber    __ThrowLineNumber()
  52. #define  __throwExceptionName __ThrowExceptionName()
  53.  
  54. class _EXPCLASS string;
  55.  
  56. class _EXPCLASS xmsg
  57. {
  58. public:
  59.     xmsg(const string _FAR &msg);
  60.     xmsg(const xmsg _FAR &msg);
  61.     ~xmsg();
  62.  
  63.     const string _FAR & why() const;
  64.     void raise() throw(xmsg);
  65.     xmsg& operator=(const xmsg _FAR &src);
  66. private:
  67.     string _FAR *str;
  68. };
  69.  
  70. inline const string _FAR & xmsg::why() const
  71. {
  72.     return *str;
  73. };
  74.  
  75. class _EXPCLASS xalloc : public xmsg
  76. {
  77. public:
  78.     xalloc(const string _FAR &msg, size_t size);
  79.  
  80.     size_t requested() const;
  81.     void raise() throw(xalloc);
  82. private:
  83.     size_t siz;
  84. };
  85.  
  86. inline size_t xalloc::requested() const
  87. {
  88.     return siz;
  89. }
  90.  
  91. #if defined(__BCOPT__) && !defined(__FLAT__)
  92. #pragma option -po.     // restore Object Data calling convention
  93. #endif
  94.  
  95. #pragma option -RT.
  96. #pragma option -Vo.     // restore user C++ options
  97. #pragma option -a.      // restore default packing
  98.  
  99. #endif  // __EXCEPT_H
  100.