home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_122 / 2.ddi / CLASSSRC.ZIP / OBJECT.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-10  |  3.0 KB  |  85 lines

  1. /*------------------------------------------------------------------------*/
  2. /*                                                                        */
  3. /*  OBJECT.CPP                                                            */
  4. /*                                                                        */
  5. /*  Copyright Borland International 1991, 1992                            */
  6. /*  All Rights Reserved                                                   */
  7. /*                                                                        */
  8. /*------------------------------------------------------------------------*/
  9.  
  10. #if !defined( TEMPLATES )
  11. #define TEMPLATES
  12. #endif
  13.  
  14. #if !defined( __CLSDEFS_H )
  15. #include <ClsDefs.h>
  16. #endif  // __CLSDEFS_H
  17.  
  18. #if !defined( __OBJECT_H )
  19. #include <Object.h>
  20. #endif  // __OBJECT_H
  21.  
  22. #if !defined( __STDLIB_H )
  23. #include <StdLib.h>
  24. #endif  // __STDLIB_H
  25.  
  26. #if !defined( __STRSTREA_H )
  27. #include <StrStrea.h>
  28. #endif  // __STRSTREA_H
  29.  
  30. #if !defined( __MALLOC_H )
  31. #include <Malloc.h>
  32. #endif  // __MALLOC_H
  33.  
  34. Error theErrorObject;
  35.  
  36. Object *Object::ZERO = &theErrorObject;
  37.  
  38. // Error reporting
  39.  
  40. static char *errstring[__ElastError] =
  41. {
  42.     "firstError: [[ Error in error reporting???? ]]",
  43.     "EDELERROR: Attemping to delete the ERROR object",
  44.     "EXPANDFS: Attempting to expand a fixed size array.",
  45.     "EXPANDLB: Attempt to expand lower bound of array.",
  46.     "NOMEM: Out of Memory",
  47.     "NOTSORT: Object must be sortable.",
  48.     "NOTASSOC: Object must be association type.",
  49.     "ORDER3: B-trees must be at least of order 3.",
  50.     "NOMEMIA: No room for the item array for an InnerNode",
  51.     "NOMEMLN: No room for item array for a LeafNode.",
  52.     "PRBADCLASS: PersistRegister called with bad class id.",
  53.     "PRINCONS: PersistRegister called with inconsistent values.",
  54.     "BNZERODIV: Attempt to divide by zero.",
  55.     "BNILLLOG: Attempt to take log of zero or negative number.",
  56.     "BNNOMEM: No memory for a bignum.",
  57.     "RANDOM2SMALL: Bignum RNG must be bigger than 32 bits (> 2 words).",
  58.     "BNTEMPSTKOVFL: Too many markTempRing invocations,",
  59.     "BNTEMPSTKUNFL: Too many releaseTempRing invocations,",
  60.     "BN2MANYTEMPS: Ran out of temporaries on the Temp ring.",
  61.     "BN2BIG2PRINT: Bignum has too many digits in current output base.",
  62.     "BNNOMEM4PRINT: No memory for temporaries for printing.",
  63.     "BNRESULT2BIG: An operation would have resulted in too large of a number.",
  64.     "RNG2BIG: Sorry.  RNGs are limited to 32767 `digits' in size.",
  65.     "BNSQRTILLEGAL: Trying to take sqrt of negative bignum.",
  66. };
  67.  
  68. extern "C" void __ErrorMessage( const char _FAR * );
  69.  
  70. void _FARFUNC ClassLib_error( ClassLib_errors errnum, char _FAR *addstr )
  71. {
  72.     ostrstream os;
  73.     os << endl << "Fatal error from class library:" << endl;
  74.     os << "__E" << errstring[errnum] << endl;
  75.     if( addstr != 0 )
  76.         os << addstr << endl;
  77.     os << ends;
  78.  
  79.     char *buf = os.str();
  80.     __ErrorMessage( buf );
  81.     delete [] buf;
  82.  
  83.     exit( errnum );
  84. }
  85.