Turbo C 3.0 + UCOS2 + UCGUI PC学习版本

源代码在线查看: object.cpp

软件大小: 4553 K
上传用户: zhangyuntong
关键词: Turbo UCOS2 UCGUI 3.0
下载地址: 免注册下载 普通下载 VIP

相关代码

				/*------------------------------------------------------------------------*/
				/*                                                                        */
				/*  OBJECT.CPP                                                            */
				/*                                                                        */
				/*  Copyright Borland International 1991                                  */
				/*  All Rights Reserved                                                   */
				/*                                                                        */
				/*------------------------------------------------------------------------*/
				
				#if !defined( TEMPLATES )
				#define TEMPLATES
				#endif
				
				#if !defined( __CLSDEFS_H )
				#include 
				#endif  // __CLSDEFS_H
				
				#if !defined( __OBJECT_H )
				#include 
				#endif  // __OBJECT_H
				
				#if !defined( __STDLIB_H )
				#include 
				#endif  // __STDLIB_H
				
				#if !defined( __STRSTREA_H )
				#include 
				#endif  // __STRSTREA_H
				
				#if !defined( __MALLOC_H )
				#include 
				#endif  // __MALLOC_H
				
				void *Object::operator new( size_t s )
				{
				    void *allocated = ::operator new( s );
				    if( allocated == 0 )
				        return ZERO;
				    else
				        return allocated;
				}
				
				Error theErrorObject;
				
				Object *Object::ZERO = &theErrorObject;
				
				// Error reporting
				
				static char *errstring[__ElastError] =
				{
				    "firstError: [[ Error in error reporting???? ]]",
				    "EDELERROR: Attemping to delete the ERROR object",
				    "EXPANDFS: Attempting to expand a fixed size array.",
				    "EXPANDLB: Attempt to expand lower bound of array.",
				    "NOMEM: Out of Memory",
				    "NOTSORT: Object must be sortable.",
				    "NOTASSOC: Object must be association type.",
				    "ORDER3: B-trees must be at least of order 3.",
				    "NOMEMIA: No room for the item array for an InnerNode",
				    "NOMEMLN: No room for item array for a LeafNode.",
				    "PRBADCLASS: PersistRegister called with bad class id.",
				    "PRINCONS: PersistRegister called with inconsistent values.",
				    "BNZERODIV: Attempt to divide by zero.",
				    "BNILLLOG: Attempt to take log of zero or negative number.",
				    "BNNOMEM: No memory for a bignum.",
				    "RANDOM2SMALL: Bignum RNG must be bigger than 32 bits (> 2 words).",
				    "BNTEMPSTKOVFL: Too many markTempRing invocations,",
				    "BNTEMPSTKUNFL: Too many releaseTempRing invocations,",
				    "BN2MANYTEMPS: Ran out of temporaries on the Temp ring.",
				    "BN2BIG2PRINT: Bignum has too many digits in current output base.",
				    "BNNOMEM4PRINT: No memory for temporaries for printing.",
				    "BNRESULT2BIG: An operation would have resulted in too large of a number.",
				    "RNG2BIG: Sorry.  RNGs are limited to 32767 `digits' in size.",
				    "BNSQRTILLEGAL: Trying to take sqrt of negative bignum.",
				};
				
				extern "C" void __ErrorMessage( const char _FAR * );
				
				void _FARFUNC ClassLib_error( ClassLib_errors errnum, char _FAR *addstr )
				{
				    ostrstream os;
				    os 				    os 				    if( addstr != 0 )
				        os 				    os 				
				    char *buf = os.str();
				    __ErrorMessage( buf );
				    delete [] buf;
				
				    exit( errnum );
				}
							

相关资源