epoc32/include/tools/stlport/stl/config/_windows.h
branchSymbian2
changeset 2 2fe1408b6811
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/tools/stlport/stl/config/_windows.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -0,0 +1,209 @@
     1.4 +/*
     1.5 + * Copyright (c) 1997-1999
     1.6 + * Silicon Graphics Computer Systems, Inc.
     1.7 + *
     1.8 + * Copyright (c) 1999
     1.9 + * Boris Fomitchev
    1.10 + *
    1.11 + * Copyright (c) 2003
    1.12 + * Francois Dumont
    1.13 + *
    1.14 + * This material is provided "as is", with absolutely no warranty expressed
    1.15 + * or implied. Any use is at your own risk.
    1.16 + *
    1.17 + * Permission to use or copy this software for any purpose is hereby granted
    1.18 + * without fee, provided the above notices are retained on all copies.
    1.19 + * Permission to modify the code and to distribute modified code is granted,
    1.20 + * provided the above notices are retained, and a notice that the code was
    1.21 + * modified is included with the above copyright notice.
    1.22 + *
    1.23 + */
    1.24 +#ifndef _STLP_INTERNAL_WINDOWS_H
    1.25 +#define _STLP_INTERNAL_WINDOWS_H
    1.26 +
    1.27 +#if !defined (_STLP_PLATFORM)
    1.28 +#  define _STLP_PLATFORM "Windows"
    1.29 +#endif
    1.30 +
    1.31 +#if !defined (_STLP_BIG_ENDIAN) && !defined (_STLP_LITTLE_ENDIAN)
    1.32 +#  if defined (_MIPSEB)
    1.33 +#    define _STLP_BIG_ENDIAN 1
    1.34 +#  endif
    1.35 +#  if defined (__i386) || defined (_M_IX86) || defined (_M_ARM) || \
    1.36 +      defined (__amd64__) || defined (_M_AMD64) || defined (__x86_64__) || \
    1.37 +      defined (__alpha__)
    1.38 +#    define _STLP_LITTLE_ENDIAN 1
    1.39 +#  endif
    1.40 +#  if defined (__ia64__)
    1.41 +    /* itanium allows both settings (for instance via gcc -mbig-endian) - hence a seperate check is required */
    1.42 +#    if defined (__BIG_ENDIAN__)
    1.43 +#      define _STLP_BIG_ENDIAN 1
    1.44 +#    else
    1.45 +#      define _STLP_LITTLE_ENDIAN 1
    1.46 +#    endif
    1.47 +#  endif
    1.48 +#endif /* _STLP_BIG_ENDIAN */
    1.49 +
    1.50 +#if !defined (_STLP_WINDOWS_H_INCLUDED)
    1.51 +#  define _STLP_WINDOWS_H_INCLUDED
    1.52 +#  if !(defined ( _STLP_MSVC ) || defined (__BORLANDC__) || defined (__ICL) || defined (__WATCOMC__) || \
    1.53 +        defined (__MINGW32__) || defined (__DMC__))
    1.54 +#    if defined (_STLP_USE_MFC)
    1.55 +#      include <afx.h>
    1.56 +#    else
    1.57 +#      include <windows.h>
    1.58 +#    endif
    1.59 +#  else
    1.60 +/* This section serves as a replacement for windows.h header for Visual C++ */
    1.61 +#    if defined (__cplusplus)
    1.62 +extern "C" {
    1.63 +#    endif
    1.64 +#    if (defined (_M_AMD64) || defined (_M_IA64) || (!defined (_STLP_WCE) && defined (_M_MRX000)) || defined (_M_ALPHA) || \
    1.65 +        (defined (_M_PPC) && (_STLP_MSVC_LIB >= 1000))) && !defined (RC_INVOKED)
    1.66 +#      define InterlockedIncrement       _InterlockedIncrement
    1.67 +#      define InterlockedDecrement       _InterlockedDecrement
    1.68 +#      define InterlockedExchange        _InterlockedExchange
    1.69 +/* Here we use a different macro name than the InterlockedExchangePointer SDK function
    1.70 + * to avoid macro definition conflict as the SDK might already define InterlockedExchangePointer
    1.71 + * as a macro.
    1.72 + */
    1.73 +#      define STLPInterlockedExchangePointer _InterlockedExchangePointer
    1.74 +#      define _STLP_STDCALL
    1.75 +#    else
    1.76 +#      if defined (_MAC)
    1.77 +#        define _STLP_STDCALL _cdecl
    1.78 +#      else
    1.79 +#        define _STLP_STDCALL __stdcall
    1.80 +#      endif
    1.81 +#    endif
    1.82 +
    1.83 +#    if defined (_STLP_NEW_PLATFORM_SDK)
    1.84 +_STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedIncrement(long volatile *);
    1.85 +_STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedDecrement(long volatile *);
    1.86 +_STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedExchange(long volatile *, long);
    1.87 +#      if defined (STLPInterlockedExchangePointer)
    1.88 +_STLP_IMPORT_DECLSPEC void* _STLP_STDCALL STLPInterlockedExchangePointer(void* volatile *, void*);
    1.89 +#      endif
    1.90 +_STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedExchangeAdd(long volatile *, long);
    1.91 +#    elif defined (_STLP_WCE)
    1.92 +
    1.93 +/* start of eMbedded Visual C++ specific section */
    1.94 +#      include <windef.h> /* needed for basic windows types */
    1.95 +
    1.96 +       /** in SDKs generated with PB5, windef.h somehow includes headers which then
    1.97 +       define setjmp. */
    1.98 +#      if (_WIN32_WCE >= 0x500)
    1.99 +#        define _STLP_NATIVE_SETJMP_H_INCLUDED
   1.100 +#      endif
   1.101 +
   1.102 +#      ifndef _WINBASE_ /* winbase.h already included? */
   1.103 +long WINAPI InterlockedIncrement(long*);
   1.104 +long WINAPI InterlockedDecrement(long*);
   1.105 +long WINAPI InterlockedExchange(long*, long);
   1.106 +#      endif
   1.107 +
   1.108 +#      ifndef __WINDOWS__ /* windows.h already included? */
   1.109 +
   1.110 +#        if defined (x86)
   1.111 +#          include <winbase.h> /* needed for inline versions of Interlocked* functions */
   1.112 +#        endif
   1.113 +
   1.114 +#        ifndef _MFC_VER
   1.115 +
   1.116 +#          define MessageBox MessageBoxW
   1.117 +int WINAPI MessageBoxW(HWND hWnd, LPCWSTR lpText, LPCWSTR lpCaption, UINT uType);
   1.118 +
   1.119 +#          define wvsprintf wvsprintfW
   1.120 +int WINAPI wvsprintfW(LPWSTR, LPCWSTR, va_list ArgList);
   1.121 +
   1.122 +void WINAPI ExitThread(DWORD dwExitCode);
   1.123 +
   1.124 +#          if !defined (COREDLL)
   1.125 +#            define _STLP_WCE_WINBASEAPI DECLSPEC_IMPORT
   1.126 +#          else
   1.127 +#            define _STLP_WCE_WINBASEAPI
   1.128 +#          endif
   1.129 +
   1.130 +_STLP_WCE_WINBASEAPI int WINAPI
   1.131 +MultiByteToWideChar(UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr,
   1.132 +                    int cbMultiByte, LPWSTR lpWideCharStr, int cchWideChar);
   1.133 +
   1.134 +_STLP_WCE_WINBASEAPI UINT WINAPI GetACP();
   1.135 +
   1.136 +_STLP_WCE_WINBASEAPI BOOL WINAPI TerminateProcess(HANDLE hProcess, DWORD uExitCode);
   1.137 +
   1.138 +#          define OutputDebugString OutputDebugStringW
   1.139 +void WINAPI OutputDebugStringW(LPCWSTR);
   1.140 +
   1.141 +_STLP_WCE_WINBASEAPI void WINAPI Sleep(DWORD);
   1.142 +
   1.143 +#          undef _STLP_WCE_WINBASEAPI
   1.144 +
   1.145 +#        endif /* !_MFC_VER */
   1.146 +
   1.147 +#      endif /* !__WINDOWS__ */
   1.148 +
   1.149 +/* end of eMbedded Visual C++ specific section */
   1.150 +
   1.151 +#    else
   1.152 +/* boris : for the latest SDK, you may actually need the other version of the declaration (above)
   1.153 + * even for earlier VC++ versions. There is no way to tell SDK versions apart, sorry ...
   1.154 + */
   1.155 +_STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedIncrement(long*);
   1.156 +_STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedDecrement(long*);
   1.157 +_STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedExchange(long*, long);
   1.158 +#    endif
   1.159 +
   1.160 +#    if !defined (STLPInterlockedExchangePointer)
   1.161 +/* This API function do not exist in the old platform SDK and is equivalent to
   1.162 + * InterlockedExchange on 32 bits platform:
   1.163 + */
   1.164 +#      if defined (__cplusplus)
   1.165 +/* We do not define this function if we are not in a C++ translation unit just
   1.166 + * because of the inline portability issue it would introduce. We will have to
   1.167 + * fix it the day we need this function for a C translation unit.
   1.168 + */
   1.169 +inline
   1.170 +void* _STLP_CALL STLPInterlockedExchangePointer(void* volatile* __a, void* __b) {
   1.171 +#        if defined (_STLP_MSVC)
   1.172 +/* Here MSVC produces warning if 64 bits portability issue is activated.
   1.173 + * MSVC do not see that _STLP_ATOMIC_EXCHANGE_PTR is a macro which content
   1.174 + * is based on the platform, Win32 or Win64
   1.175 + */
   1.176 +#          pragma warning (push)
   1.177 +#          pragma warning (disable : 4311) // pointer truncation from void* to long
   1.178 +#          pragma warning (disable : 4312) // conversion from long to void* of greater size
   1.179 +#        endif
   1.180 +#        if !defined (_STLP_NO_NEW_STYLE_CASTS)
   1.181 +  return reinterpret_cast<void*>(InterlockedExchange(reinterpret_cast<long*>(const_cast<void**>(__a)),
   1.182 +                                                     reinterpret_cast<long>(__b)));
   1.183 +#        else
   1.184 +  return (void*)InterlockedExchange((long*)__a, (long)__b);
   1.185 +#        endif
   1.186 +#        if defined (_STLP_MSVC)
   1.187 +#          pragma warning (pop)
   1.188 +#        endif
   1.189 +}
   1.190 +#      endif
   1.191 +#    endif
   1.192 +
   1.193 +#    if !defined (_STLP_WCE)
   1.194 +_STLP_IMPORT_DECLSPEC void _STLP_STDCALL Sleep(unsigned long);
   1.195 +_STLP_IMPORT_DECLSPEC void _STLP_STDCALL OutputDebugStringA(const char* lpOutputString);
   1.196 +#    endif
   1.197 +
   1.198 +#    if defined (InterlockedIncrement)
   1.199 +#      pragma intrinsic(_InterlockedIncrement)
   1.200 +#      pragma intrinsic(_InterlockedDecrement)
   1.201 +#      pragma intrinsic(_InterlockedExchange)
   1.202 +#      pragma intrinsic(_InterlockedExchangePointer)
   1.203 +#    endif
   1.204 +#    if defined (__cplusplus)
   1.205 +} /* extern "C" */
   1.206 +#    endif
   1.207 +
   1.208 +#  endif /* STL_MSVC __BORLANDC__ __ICL __WATCOMC__ __MINGW32__ __DMC__*/
   1.209 +
   1.210 +#endif /* _STLP_WINDOWS_H_INCLUDED */
   1.211 +
   1.212 +#endif /* _STLP_INTERNAL_WINDOWS_H */