/home/ntakagi/work/STLport-5.1.5/stlport/stl/config/_windows.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1997-1999
00003  * Silicon Graphics Computer Systems, Inc.
00004  *
00005  * Copyright (c) 1999
00006  * Boris Fomitchev
00007  *
00008  * Copyright (c) 2003
00009  * Francois Dumont
00010  *
00011  * This material is provided "as is", with absolutely no warranty expressed
00012  * or implied. Any use is at your own risk.
00013  *
00014  * Permission to use or copy this software for any purpose is hereby granted
00015  * without fee, provided the above notices are retained on all copies.
00016  * Permission to modify the code and to distribute modified code is granted,
00017  * provided the above notices are retained, and a notice that the code was
00018  * modified is included with the above copyright notice.
00019  *
00020  */
00021 #ifndef _STLP_INTERNAL_WINDOWS_H
00022 #define _STLP_INTERNAL_WINDOWS_H
00023 
00024 #if !defined (_STLP_PLATFORM)
00025 #  define _STLP_PLATFORM "Windows"
00026 #endif
00027 
00028 /* _STLP_WIN32_VERSION is used to detect targetted Windows platforms as
00029  * old ones are not supporting some Win32 functions that STLport use.
00030  * Limited OSs are going up to and including Windows 98 so they can be
00031  * detected using WINVER or _WIN32_WINDOWS macros, we do not have to use
00032  * _WINNT_WINDOWS macro for the moment.
00033  */
00034 #if !defined (_STLP_WIN32_VERSION)
00035 #  if defined (WINVER)
00036 #    define _STLP_WIN32_VERSION WINVER
00037 #  elif defined (_WIN32_WINDOWS)
00038 #    define _STLP_WIN32_VERSION _WIN32_WINDOWS
00039 #  endif
00040 #endif
00041 
00042 #if !defined (_STLP_BIG_ENDIAN) && !defined (_STLP_LITTLE_ENDIAN)
00043 #  if defined (_MIPSEB)
00044 #    define _STLP_BIG_ENDIAN 1
00045 #  endif
00046 #  if defined (__i386) || defined (_M_IX86) || defined (_M_ARM) || \
00047       defined (__amd64__) || defined (_M_AMD64) || defined (__x86_64__) || \
00048       defined (__alpha__)
00049 #    define _STLP_LITTLE_ENDIAN 1
00050 #  endif
00051 #  if defined (__ia64__)
00052     /* itanium allows both settings (for instance via gcc -mbig-endian) - hence a seperate check is required */
00053 #    if defined (__BIG_ENDIAN__)
00054 #      define _STLP_BIG_ENDIAN 1
00055 #    else
00056 #      define _STLP_LITTLE_ENDIAN 1
00057 #    endif
00058 #  endif
00059 #endif /* _STLP_BIG_ENDIAN */
00060 
00061 #if !defined (_STLP_WINDOWS_H_INCLUDED)
00062 #  define _STLP_WINDOWS_H_INCLUDED
00063 #  if !(defined ( _STLP_MSVC ) || defined (__BORLANDC__) || defined (__ICL) || defined (__WATCOMC__) || \
00064         defined (__MINGW32__) || defined (__DMC__))
00065 #    if defined (_STLP_USE_MFC)
00066 #      include <afx.h>
00067 #    else
00068 #      include <windows.h>
00069 #    endif
00070 #  else
00071 /* This section serves as a replacement for windows.h header for Visual C++ */
00072 #    if defined (__cplusplus)
00073 extern "C" {
00074 #    endif
00075 #    if (defined (_M_AMD64) || defined (_M_IA64) || (!defined (_STLP_WCE) && defined (_M_MRX000)) || defined (_M_ALPHA) || \
00076         (defined (_M_PPC) && (_STLP_MSVC_LIB >= 1000))) && !defined (RC_INVOKED)
00077 #      define InterlockedIncrement       _InterlockedIncrement
00078 #      define InterlockedDecrement       _InterlockedDecrement
00079 #      define InterlockedExchange        _InterlockedExchange
00080 /* Here we use a different macro name than the InterlockedExchangePointer SDK function
00081  * to avoid macro definition conflict as the SDK might already define InterlockedExchangePointer
00082  * as a macro.
00083  */
00084 #      define STLPInterlockedExchangePointer _InterlockedExchangePointer
00085 #      define _STLP_STDCALL
00086 #    else
00087 #      if defined (_MAC)
00088 #        define _STLP_STDCALL _cdecl
00089 #      else
00090 #        define _STLP_STDCALL __stdcall
00091 #      endif
00092 #    endif
00093 
00094 #    if defined (_STLP_NEW_PLATFORM_SDK)
00095 _STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedIncrement(long volatile *);
00096 _STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedDecrement(long volatile *);
00097 _STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedExchange(long volatile *, long);
00098 #      if defined (STLPInterlockedExchangePointer)
00099 _STLP_IMPORT_DECLSPEC void* _STLP_STDCALL STLPInterlockedExchangePointer(void* volatile *, void*);
00100 #      endif
00101 _STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedExchangeAdd(long volatile *, long);
00102 #    elif defined (_STLP_WCE)
00103 
00104 /* start of eMbedded Visual C++ specific section */
00105 #      include <windef.h> /* needed for basic windows types */
00106 
00109 #      if (_WIN32_WCE >= 0x500)
00110 #        define _STLP_NATIVE_SETJMP_H_INCLUDED
00111 #      endif
00112 
00113 #      ifndef _WINBASE_ /* winbase.h already included? */
00114 long WINAPI InterlockedIncrement(long*);
00115 long WINAPI InterlockedDecrement(long*);
00116 long WINAPI InterlockedExchange(long*, long);
00117 #      endif
00118 
00119 #      ifndef __WINDOWS__ /* windows.h already included? */
00120 
00121 #        if defined (x86)
00122 #          include <winbase.h> /* needed for inline versions of Interlocked* functions */
00123 #        endif
00124 
00125 #        ifndef _MFC_VER
00126 
00127 #          define MessageBox MessageBoxW
00128 int WINAPI MessageBoxW(HWND hWnd, LPCWSTR lpText, LPCWSTR lpCaption, UINT uType);
00129 
00130 #          define wvsprintf wvsprintfW
00131 int WINAPI wvsprintfW(LPWSTR, LPCWSTR, va_list ArgList);
00132 
00133 void WINAPI ExitThread(DWORD dwExitCode);
00134 
00135 #          if !defined (COREDLL)
00136 #            define _STLP_WCE_WINBASEAPI DECLSPEC_IMPORT
00137 #          else
00138 #            define _STLP_WCE_WINBASEAPI
00139 #          endif
00140 
00141 _STLP_WCE_WINBASEAPI int WINAPI
00142 MultiByteToWideChar(UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr,
00143                     int cbMultiByte, LPWSTR lpWideCharStr, int cchWideChar);
00144 
00145 _STLP_WCE_WINBASEAPI UINT WINAPI GetACP();
00146 
00147 _STLP_WCE_WINBASEAPI BOOL WINAPI TerminateProcess(HANDLE hProcess, DWORD uExitCode);
00148 
00149 #          define OutputDebugString OutputDebugStringW
00150 void WINAPI OutputDebugStringW(LPCWSTR);
00151 
00152 _STLP_WCE_WINBASEAPI void WINAPI Sleep(DWORD);
00153 
00154 #          undef _STLP_WCE_WINBASEAPI
00155 
00156 #        endif /* !_MFC_VER */
00157 
00158 #      endif /* !__WINDOWS__ */
00159 
00160 /* end of eMbedded Visual C++ specific section */
00161 
00162 #    else
00163 /* boris : for the latest SDK, you may actually need the other version of the declaration (above)
00164  * even for earlier VC++ versions. There is no way to tell SDK versions apart, sorry ...
00165  */
00166 _STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedIncrement(long*);
00167 _STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedDecrement(long*);
00168 _STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedExchange(long*, long);
00169 #    endif
00170 
00171 #    if !defined (STLPInterlockedExchangePointer)
00172 /* This API function do not exist in the old platform SDK and is equivalent to
00173  * InterlockedExchange on 32 bits platform:
00174  */
00175 #      if defined (__cplusplus)
00176 /* We do not define this function if we are not in a C++ translation unit just
00177  * because of the inline portability issue it would introduce. We will have to
00178  * fix it the day we need this function for a C translation unit.
00179  */
00180 inline
00181 void* _STLP_CALL STLPInterlockedExchangePointer(void* volatile* __a, void* __b) {
00182 #        if defined (_STLP_MSVC)
00183 /* Here MSVC produces warning if 64 bits portability issue is activated.
00184  * MSVC do not see that _STLP_ATOMIC_EXCHANGE_PTR is a macro which content
00185  * is based on the platform, Win32 or Win64
00186  */
00187 #          pragma warning (push)
00188 #          pragma warning (disable : 4311) // pointer truncation from void* to long
00189 #          pragma warning (disable : 4312) // conversion from long to void* of greater size
00190 #        endif
00191 #        if !defined (_STLP_NO_NEW_STYLE_CASTS)
00192   return reinterpret_cast<void*>(InterlockedExchange(reinterpret_cast<long*>(const_cast<void**>(__a)),
00193                                                      reinterpret_cast<long>(__b)));
00194 #        else
00195   return (void*)InterlockedExchange((long*)__a, (long)__b);
00196 #        endif
00197 #        if defined (_STLP_MSVC)
00198 #          pragma warning (pop)
00199 #        endif
00200 }
00201 #      endif
00202 #    endif
00203 
00204 #    if !defined (_STLP_WCE)
00205 _STLP_IMPORT_DECLSPEC void _STLP_STDCALL Sleep(unsigned long);
00206 _STLP_IMPORT_DECLSPEC void _STLP_STDCALL OutputDebugStringA(const char* lpOutputString);
00207 #    endif
00208 
00209 #    if defined (InterlockedIncrement)
00210 #      pragma intrinsic(_InterlockedIncrement)
00211 #      pragma intrinsic(_InterlockedDecrement)
00212 #      pragma intrinsic(_InterlockedExchange)
00213 #      pragma intrinsic(_InterlockedExchangePointer)
00214 #    endif
00215 #    if defined (__cplusplus)
00216 } /* extern "C" */
00217 #    endif
00218 
00219 #  endif /* STL_MSVC __BORLANDC__ __ICL __WATCOMC__ __MINGW32__ __DMC__*/
00220 
00221 #endif /* _STLP_WINDOWS_H_INCLUDED */
00222 
00223 #endif /* _STLP_INTERNAL_WINDOWS_H */



Generated on Mon Mar 10 15:32:46 2008 by  doxygen 1.5.1