wce_defs.h

00001 /*
00002  * File to have Windows CE Toolkit for VC++ 5.0 working with STL
00003  * 09 - 03 - 1999
00004  * Rev 1.0 - Now eVC++ compatible
00005  * 20 - 07 - 2001
00006  * Giuseppe Govi - giuseppe.govi@syncdata.it
00007  */
00008 
00009 #ifndef INC_WCE_DEFS_H
00010 #define INC_WCE_DEFS_H
00011 
00012 #if defined (UNDER_CE)
00013 
00014 #include <windows.h>
00015 
00016 #ifdef __STL_WCE_USE_OUTPUTDEBUGSTRING
00017 #define STLTRACE(msg)   OutputDebugString(msg)
00018 #else
00019 #define STLTRACE(msg)   MessageBox(NULL,(msg),NULL,MB_OK)
00020 #endif
00021 
00022 #define abort() TerminateProcess(GetCurrentProcess(), 0)
00023 
00024 #ifndef __THROW_BAD_ALLOC
00025 #define __THROW_BAD_ALLOC STLTRACE(L"out of memory"); ExitThread(1)
00026 #endif
00027 
00028 template <class charT> //charT == TCHAR under Widnows CE
00029 void wce_assert(bool cond, charT* file, int line, charT* exp)
00030 {
00031 charT buffer[512];
00032         if (!cond)
00033         {
00034                 wsprintf(buffer, _T("%s:%d assertion failure:\n%s"), file, line, exp);
00035 #ifdef _DEBUG
00036                 if (MessageBox(NULL, buffer, NULL, MB_RETRYCANCEL) == IDCANCEL)
00037                         DebugBreak();
00038                 else
00039 #else
00040                 MessageBox(NULL, buffer, NULL, MB_RETRYCANCEL);
00041 #endif
00042                 abort();
00043 
00044         }
00045 }
00046 
00047 #ifndef __PLACEMENT_NEW_INLINE
00048 #define __PLACEMENT_NEW_INLINE
00049 #  ifndef _MFC_VER
00050    inline void * operator new(size_t, void *_P) {return (_P); }
00051 #  endif
00052 #endif
00053 
00054 //size_t and wchar_t are defined in many different places in all SDKs.
00055 //let's put them here (just to be sure)
00056 
00057 #ifndef _SIZE_T_DEFINED
00058 typedef unsigned int size_t;
00059 #define _SIZE_T_DEFINED
00060 #endif
00061 
00062 #ifndef _WCHAR_T_DEFINED
00063 typedef unsigned short wchar_t;
00064 #define _WCHAR_T_DEFINED
00065 #endif
00066 
00067 //ptrdiff_t is not defined in Windows CE SDK
00068 #ifndef _PTRDIFF_T_DEFINED
00069 typedef int ptrdiff_t;
00070 #define _PTRDIFF_T_DEFINED
00071 #endif
00072 
00073 #endif //UNDER_CE
00074 
00075 #endif //INC_WCE_DEFS_H
00076 
00077 

Generated on Mon Jun 5 10:20:45 2006 for Intelligence.kdevelop by  doxygen 1.4.6