Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
2 * Copyright (c) 1997-1999
3 * Silicon Graphics Computer Systems, Inc.
11 * This material is provided "as is", with absolutely no warranty expressed
12 * or implied. Any use is at your own risk.
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.
21 #ifndef _STLP_INTERNAL_WINDOWS_H
22 #define _STLP_INTERNAL_WINDOWS_H
24 #if !defined (_STLP_PLATFORM)
25 # define _STLP_PLATFORM "Windows"
28 #if !defined (_STLP_BIG_ENDIAN) && !defined (_STLP_LITTLE_ENDIAN)
29 # if defined (_MIPSEB)
30 # define _STLP_BIG_ENDIAN 1
32 # if defined (__i386) || defined (_M_IX86) || defined (_M_ARM) || \
33 defined (__amd64__) || defined (_M_AMD64) || defined (__x86_64__) || \
35 # define _STLP_LITTLE_ENDIAN 1
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
42 # define _STLP_LITTLE_ENDIAN 1
45 #endif /* _STLP_BIG_ENDIAN */
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)
57 /* This section serves as a replacement for windows.h header for Visual C++ */
58 # if defined (__cplusplus)
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
70 # define STLPInterlockedExchangePointer _InterlockedExchangePointer
71 # define _STLP_STDCALL
74 # define _STLP_STDCALL _cdecl
76 # define _STLP_STDCALL __stdcall
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*);
87 _STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedExchangeAdd(long volatile *, long);
88 # elif defined (_STLP_WCE)
90 /* start of eMbedded Visual C++ specific section */
91 # include <windef.h> /* needed for basic windows types */
93 /** in SDKs generated with PB5, windef.h somehow includes headers which then
95 # if (_WIN32_WCE >= 0x500)
96 # define _STLP_NATIVE_SETJMP_H_INCLUDED
99 # ifndef _WINBASE_ /* winbase.h already included? */
100 long WINAPI InterlockedIncrement(long*);
101 long WINAPI InterlockedDecrement(long*);
102 long WINAPI InterlockedExchange(long*, long);
105 # ifndef __WINDOWS__ /* windows.h already included? */
108 # include <winbase.h> /* needed for inline versions of Interlocked* functions */
113 # define MessageBox MessageBoxW
114 int WINAPI MessageBoxW(HWND hWnd, LPCWSTR lpText, LPCWSTR lpCaption, UINT uType);
116 # define wvsprintf wvsprintfW
117 int WINAPI wvsprintfW(LPWSTR, LPCWSTR, va_list ArgList);
119 void WINAPI ExitThread(DWORD dwExitCode);
121 # if !defined (COREDLL)
122 # define _STLP_WCE_WINBASEAPI DECLSPEC_IMPORT
124 # define _STLP_WCE_WINBASEAPI
127 _STLP_WCE_WINBASEAPI int WINAPI
128 MultiByteToWideChar(UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr,
129 int cbMultiByte, LPWSTR lpWideCharStr, int cchWideChar);
131 _STLP_WCE_WINBASEAPI UINT WINAPI GetACP();
133 _STLP_WCE_WINBASEAPI BOOL WINAPI TerminateProcess(HANDLE hProcess, DWORD uExitCode);
135 # define OutputDebugString OutputDebugStringW
136 void WINAPI OutputDebugStringW(LPCWSTR);
138 _STLP_WCE_WINBASEAPI void WINAPI Sleep(DWORD);
140 # undef _STLP_WCE_WINBASEAPI
142 # endif /* !_MFC_VER */
144 # endif /* !__WINDOWS__ */
146 /* end of eMbedded Visual C++ specific section */
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 ...
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);
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:
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.
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
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
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)));
181 return (void*)InterlockedExchange((long*)__a, (long)__b);
183 # if defined (_STLP_MSVC)
184 # pragma warning (pop)
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);
195 # if defined (InterlockedIncrement)
196 # pragma intrinsic(_InterlockedIncrement)
197 # pragma intrinsic(_InterlockedDecrement)
198 # pragma intrinsic(_InterlockedExchange)
199 # pragma intrinsic(_InterlockedExchangePointer)
201 # if defined (__cplusplus)
205 # endif /* STL_MSVC __BORLANDC__ __ICL __WATCOMC__ __MINGW32__ __DMC__*/
207 #endif /* _STLP_WINDOWS_H_INCLUDED */
209 #endif /* _STLP_INTERNAL_WINDOWS_H */