home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1998 May / Pcwk5b98.iso / Borland / Cplus45 / BC45 / CLOBSS.PAK / OBJECT.CPO < prev    next >
Text File  |  1995-08-29  |  3KB  |  81 lines

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