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