epoc32/include/tools/stlport/stl/config/_windows.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     1 /*
     2  * Copyright (c) 1997-1999
     3  * Silicon Graphics Computer Systems, Inc.
     4  *
     5  * Copyright (c) 1999
     6  * Boris Fomitchev
     7  *
     8  * Copyright (c) 2003
     9  * Francois Dumont
    10  *
    11  * This material is provided "as is", with absolutely no warranty expressed
    12  * or implied. Any use is at your own risk.
    13  *
    14  * Permission to use or copy this software for any purpose is hereby granted
    15  * without fee, provided the above notices are retained on all copies.
    16  * Permission to modify the code and to distribute modified code is granted,
    17  * provided the above notices are retained, and a notice that the code was
    18  * modified is included with the above copyright notice.
    19  *
    20  */
    21 #ifndef _STLP_INTERNAL_WINDOWS_H
    22 #define _STLP_INTERNAL_WINDOWS_H
    23 
    24 #if !defined (_STLP_PLATFORM)
    25 #  define _STLP_PLATFORM "Windows"
    26 #endif
    27 
    28 #if !defined (_STLP_BIG_ENDIAN) && !defined (_STLP_LITTLE_ENDIAN)
    29 #  if defined (_MIPSEB)
    30 #    define _STLP_BIG_ENDIAN 1
    31 #  endif
    32 #  if defined (__i386) || defined (_M_IX86) || defined (_M_ARM) || \
    33       defined (__amd64__) || defined (_M_AMD64) || defined (__x86_64__) || \
    34       defined (__alpha__)
    35 #    define _STLP_LITTLE_ENDIAN 1
    36 #  endif
    37 #  if defined (__ia64__)
    38     /* itanium allows both settings (for instance via gcc -mbig-endian) - hence a seperate check is required */
    39 #    if defined (__BIG_ENDIAN__)
    40 #      define _STLP_BIG_ENDIAN 1
    41 #    else
    42 #      define _STLP_LITTLE_ENDIAN 1
    43 #    endif
    44 #  endif
    45 #endif /* _STLP_BIG_ENDIAN */
    46 
    47 #if !defined (_STLP_WINDOWS_H_INCLUDED)
    48 #  define _STLP_WINDOWS_H_INCLUDED
    49 #  if !(defined ( _STLP_MSVC ) || defined (__BORLANDC__) || defined (__ICL) || defined (__WATCOMC__) || \
    50         defined (__MINGW32__) || defined (__DMC__))
    51 #    if defined (_STLP_USE_MFC)
    52 #      include <afx.h>
    53 #    else
    54 #      include <windows.h>
    55 #    endif
    56 #  else
    57 /* This section serves as a replacement for windows.h header for Visual C++ */
    58 #    if defined (__cplusplus)
    59 extern "C" {
    60 #    endif
    61 #    if (defined (_M_AMD64) || defined (_M_IA64) || (!defined (_STLP_WCE) && defined (_M_MRX000)) || defined (_M_ALPHA) || \
    62         (defined (_M_PPC) && (_STLP_MSVC_LIB >= 1000))) && !defined (RC_INVOKED)
    63 #      define InterlockedIncrement       _InterlockedIncrement
    64 #      define InterlockedDecrement       _InterlockedDecrement
    65 #      define InterlockedExchange        _InterlockedExchange
    66 /* Here we use a different macro name than the InterlockedExchangePointer SDK function
    67  * to avoid macro definition conflict as the SDK might already define InterlockedExchangePointer
    68  * as a macro.
    69  */
    70 #      define STLPInterlockedExchangePointer _InterlockedExchangePointer
    71 #      define _STLP_STDCALL
    72 #    else
    73 #      if defined (_MAC)
    74 #        define _STLP_STDCALL _cdecl
    75 #      else
    76 #        define _STLP_STDCALL __stdcall
    77 #      endif
    78 #    endif
    79 
    80 #    if defined (_STLP_NEW_PLATFORM_SDK)
    81 _STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedIncrement(long volatile *);
    82 _STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedDecrement(long volatile *);
    83 _STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedExchange(long volatile *, long);
    84 #      if defined (STLPInterlockedExchangePointer)
    85 _STLP_IMPORT_DECLSPEC void* _STLP_STDCALL STLPInterlockedExchangePointer(void* volatile *, void*);
    86 #      endif
    87 _STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedExchangeAdd(long volatile *, long);
    88 #    elif defined (_STLP_WCE)
    89 
    90 /* start of eMbedded Visual C++ specific section */
    91 #      include <windef.h> /* needed for basic windows types */
    92 
    93        /** in SDKs generated with PB5, windef.h somehow includes headers which then
    94        define setjmp. */
    95 #      if (_WIN32_WCE >= 0x500)
    96 #        define _STLP_NATIVE_SETJMP_H_INCLUDED
    97 #      endif
    98 
    99 #      ifndef _WINBASE_ /* winbase.h already included? */
   100 long WINAPI InterlockedIncrement(long*);
   101 long WINAPI InterlockedDecrement(long*);
   102 long WINAPI InterlockedExchange(long*, long);
   103 #      endif
   104 
   105 #      ifndef __WINDOWS__ /* windows.h already included? */
   106 
   107 #        if defined (x86)
   108 #          include <winbase.h> /* needed for inline versions of Interlocked* functions */
   109 #        endif
   110 
   111 #        ifndef _MFC_VER
   112 
   113 #          define MessageBox MessageBoxW
   114 int WINAPI MessageBoxW(HWND hWnd, LPCWSTR lpText, LPCWSTR lpCaption, UINT uType);
   115 
   116 #          define wvsprintf wvsprintfW
   117 int WINAPI wvsprintfW(LPWSTR, LPCWSTR, va_list ArgList);
   118 
   119 void WINAPI ExitThread(DWORD dwExitCode);
   120 
   121 #          if !defined (COREDLL)
   122 #            define _STLP_WCE_WINBASEAPI DECLSPEC_IMPORT
   123 #          else
   124 #            define _STLP_WCE_WINBASEAPI
   125 #          endif
   126 
   127 _STLP_WCE_WINBASEAPI int WINAPI
   128 MultiByteToWideChar(UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr,
   129                     int cbMultiByte, LPWSTR lpWideCharStr, int cchWideChar);
   130 
   131 _STLP_WCE_WINBASEAPI UINT WINAPI GetACP();
   132 
   133 _STLP_WCE_WINBASEAPI BOOL WINAPI TerminateProcess(HANDLE hProcess, DWORD uExitCode);
   134 
   135 #          define OutputDebugString OutputDebugStringW
   136 void WINAPI OutputDebugStringW(LPCWSTR);
   137 
   138 _STLP_WCE_WINBASEAPI void WINAPI Sleep(DWORD);
   139 
   140 #          undef _STLP_WCE_WINBASEAPI
   141 
   142 #        endif /* !_MFC_VER */
   143 
   144 #      endif /* !__WINDOWS__ */
   145 
   146 /* end of eMbedded Visual C++ specific section */
   147 
   148 #    else
   149 /* boris : for the latest SDK, you may actually need the other version of the declaration (above)
   150  * even for earlier VC++ versions. There is no way to tell SDK versions apart, sorry ...
   151  */
   152 _STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedIncrement(long*);
   153 _STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedDecrement(long*);
   154 _STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedExchange(long*, long);
   155 #    endif
   156 
   157 #    if !defined (STLPInterlockedExchangePointer)
   158 /* This API function do not exist in the old platform SDK and is equivalent to
   159  * InterlockedExchange on 32 bits platform:
   160  */
   161 #      if defined (__cplusplus)
   162 /* We do not define this function if we are not in a C++ translation unit just
   163  * because of the inline portability issue it would introduce. We will have to
   164  * fix it the day we need this function for a C translation unit.
   165  */
   166 inline
   167 void* _STLP_CALL STLPInterlockedExchangePointer(void* volatile* __a, void* __b) {
   168 #        if defined (_STLP_MSVC)
   169 /* Here MSVC produces warning if 64 bits portability issue is activated.
   170  * MSVC do not see that _STLP_ATOMIC_EXCHANGE_PTR is a macro which content
   171  * is based on the platform, Win32 or Win64
   172  */
   173 #          pragma warning (push)
   174 #          pragma warning (disable : 4311) // pointer truncation from void* to long
   175 #          pragma warning (disable : 4312) // conversion from long to void* of greater size
   176 #        endif
   177 #        if !defined (_STLP_NO_NEW_STYLE_CASTS)
   178   return reinterpret_cast<void*>(InterlockedExchange(reinterpret_cast<long*>(const_cast<void**>(__a)),
   179                                                      reinterpret_cast<long>(__b)));
   180 #        else
   181   return (void*)InterlockedExchange((long*)__a, (long)__b);
   182 #        endif
   183 #        if defined (_STLP_MSVC)
   184 #          pragma warning (pop)
   185 #        endif
   186 }
   187 #      endif
   188 #    endif
   189 
   190 #    if !defined (_STLP_WCE)
   191 _STLP_IMPORT_DECLSPEC void _STLP_STDCALL Sleep(unsigned long);
   192 _STLP_IMPORT_DECLSPEC void _STLP_STDCALL OutputDebugStringA(const char* lpOutputString);
   193 #    endif
   194 
   195 #    if defined (InterlockedIncrement)
   196 #      pragma intrinsic(_InterlockedIncrement)
   197 #      pragma intrinsic(_InterlockedDecrement)
   198 #      pragma intrinsic(_InterlockedExchange)
   199 #      pragma intrinsic(_InterlockedExchangePointer)
   200 #    endif
   201 #    if defined (__cplusplus)
   202 } /* extern "C" */
   203 #    endif
   204 
   205 #  endif /* STL_MSVC __BORLANDC__ __ICL __WATCOMC__ __MINGW32__ __DMC__*/
   206 
   207 #endif /* _STLP_WINDOWS_H_INCLUDED */
   208 
   209 #endif /* _STLP_INTERNAL_WINDOWS_H */