~hikiko/nux/arb-srgba-shader

« back to all changes in this revision

Viewing changes to NuxCore/NSystemWindows.h

  • Committer: Neil Jagdish Patel
  • Date: 2010-09-01 19:25:37 UTC
  • Revision ID: neil.patel@canonical.com-20100901192537-mfz7rm6q262pewg6
Import and build NuxCore

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef SYSTEMWIN32_H
 
2
#define SYSTEMWIN32_H
 
3
 
 
4
#ifndef WIN32_LEAN_AND_MEAN
 
5
    #define WIN32_LEAN_AND_MEAN 1
 
6
#endif
 
7
#include <windows.h>
 
8
 
 
9
#include <cassert>  // (assert.h)
 
10
#include <cctype>   // (ctype.h)
 
11
#include <cerrno>   // (errno.h)
 
12
#include <cfloat>   // (float.h)
 
13
#include <ciso646>  // (iso646.h)
 
14
#include <climits>  // (limits.h)
 
15
#include <clocale>  // (locale.h)
 
16
#include <cmath>    // (math.h)
 
17
#include <csetjmp>  // (setjmp.h)
 
18
//#include <csignal>  // (signal.h)
 
19
#include <cstdarg>  // (stdarg.h)
 
20
#include <cstddef>  // (stddef.h)
 
21
#include <cstdio>   // (stdio.h)
 
22
#include <cstdlib>  // (stdlib.h)
 
23
#include <cstring>  // (string.h)
 
24
#include <ctime>    // (time.h)
 
25
#include <cwchar>   // (wchar.h)
 
26
#include <cwctype>  // (wctype.h)
 
27
 
 
28
#include <tchar.h>
 
29
#include <sys/utime.h>
 
30
#include <sys/timeb.h>
 
31
#include <sys/types.h>
 
32
#include <sys/stat.h>
 
33
 
 
34
#include <winbase.h>
 
35
#include <commdlg.h>
 
36
#include <shellapi.h>
 
37
 
 
38
#include <io.h>
 
39
#include <direct.h>
 
40
 
 
41
// If INL_LOG_FILE_ANSI is set to 1, log files will be written in ASCII characters even when in UNICODE.
 
42
#define INL_LOG_FILE_ANSI   1
 
43
 
 
44
// Undo any Windows defines.
 
45
#undef BYTE
 
46
#undef WORD
 
47
#undef DWORD
 
48
#undef INT
 
49
#undef FLOAT
 
50
#undef MAXBYTE
 
51
#undef MAXWORD
 
52
#undef MAXDWORD
 
53
#undef MAXINT
 
54
#undef CDECL
 
55
#undef BOOL
 
56
#undef TCHAR
 
57
 
 
58
// Undef Windows min and max. Conflict with std::min, std::max.
 
59
#undef min
 
60
#undef max
 
61
 
 
62
 
 
63
 
 
64
#define INL_VARARGS     __cdecl                                 // Functions with variable arguments
 
65
 
 
66
// Calling Convention
 
67
// This is the default calling convention for C and C++ programs.
 
68
// Because the stack is cleaned up by the caller, it can do vararg functions.
 
69
// Argument-passing order: Right to left
 
70
#define INL_CDECL           __cdecl
 
71
// The __stdcall calling convention is used to call Win32 API functions.
 
72
// The callee cleans the stack, so the compiler makes vararg functions __cdecl.
 
73
// Argument-passing order: Right to left
 
74
#define INL_STDCALL             __stdcall
 
75
// The __fastcall calling convention specifies that arguments to functions are to be passed in registers, when possible.
 
76
#define INL_FASTCALL    __fastcall
 
77
// This is the default calling convention used by C++ member functions that do not use variable arguments.
 
78
// Under thiscall, the callee cleans the stack, which is impossible for vararg functions.
 
79
#define INL_THISCALL    thiscall                //
 
80
 
 
81
#define INL_INLINE          inline                              // Force inline code
 
82
#define INL_FORCEINLINE     __forceinline                       // Force inline code
 
83
#define INL_FORCENOINLINE   __declspec(noinline)        // Force code to NOT be inline
 
84
 
 
85
 
 
86
// Unsigned base types.
 
87
typedef unsigned char           BYTE;       // 8-bit  unsigned.
 
88
typedef unsigned short          WORD;       // 16-bit unsigned.
 
89
typedef unsigned int            UINT;       // 32-bit unsigned.
 
90
typedef unsigned long           DWORD;          // 32-bit unsigned.
 
91
typedef unsigned __int64        QWORD;          // 64-bit unsigned.
 
92
 
 
93
// Signed base types.
 
94
typedef signed char             SBYTE;          // 8-bit  signed.
 
95
typedef signed short            SWORD;          // 16-bit signed.
 
96
typedef signed int              INT;            // 32-bit signed.
 
97
typedef signed __int64          SQWORD;         // 64-bit signed.
 
98
 
 
99
 
 
100
// Character types.
 
101
typedef char                    ANSICHAR;   // An ANSI character.
 
102
typedef unsigned char           ANSIUCHAR;  // An ANSI character.
 
103
typedef wchar_t                 UNICHAR;    // A unicode character. L"Hello" is of type wchar_t and should not be confuse with type unsigned short on windows.
 
104
 
 
105
// Other base types.
 
106
typedef int                     BOOL;       // Boolean 0 (false) or 1 (true).
 
107
typedef long                    UBOOL;      // Boolean 0 (false) or 1 (true).
 
108
typedef float                   FLOAT;      // 32-bit IEEE floating point.
 
109
typedef double                  DOUBLE;     // 64-bit IEEE double.
 
110
 
 
111
///////////////////////////////////////////////
 
112
// UNICODE                                   //
 
113
///////////////////////////////////////////////
 
114
#ifdef _UNICODE
 
115
    #ifndef _TCHAR_DEFINED
 
116
        typedef wchar_t  TCHAR;
 
117
    #endif
 
118
 
 
119
    #ifndef _TEXT_DEFINED
 
120
        #undef TEXT
 
121
        #define TEXT(s) L##s
 
122
    #endif
 
123
 
 
124
#else
 
125
    #ifndef _TCHAR_DEFINED
 
126
        typedef ANSICHAR  TCHAR;
 
127
    #endif
 
128
 
 
129
    #undef TEXT
 
130
    #define TEXT(s) s
 
131
#endif
 
132
 
 
133
// #ifdef WIN32_SECURE
 
134
//     #define STRNCPY_S(strDest, numberOfElements, strSource, count) strncpy_s(strDest, numberOfElements, strSource, count)
 
135
//     #define WCSNCPY_S(strDest, numberOfElements, strSource, count) wcsncpy_s(strDest, numberOfElements, strSource, count)
 
136
//     #define MBSNCPY_S(strDest, numberOfElements, strSource, count) _mbsncpy_s(strDest, numberOfElements, strSource, count)
 
137
//     #define _TCSNCPY_S(strDest, numberOfElements, strSource, count) _tcsncpy_s(strDest, numberOfElements, strSource, count)
 
138
// 
 
139
//     #define STRCPY_S(strDest, numberOfElements, strSource) strcpy_s(strDest, numberOfElements, strSource)
 
140
//     #define WCSCPY_S(strDest, numberOfElements, strSource) wcscpy_s(strDest, numberOfElements, strSource)
 
141
//     #define MBSCPY_S(strDest, numberOfElements, strSource) _mbscpy_s(strDest, numberOfElements, strSource)
 
142
//     #define _TCSCPY_S(strDest, numberOfElements, strSource) _tcscpy_s(strDest, numberOfElements, strSource)
 
143
// 
 
144
//     #define STRCAT_S(strDest, numberOfElements, strSource) strcat_s(strDest, numberOfElements, strSource)
 
145
//     #define WCSCAT_S(strDest, numberOfElements, strSource) wcscat_s(strDest, numberOfElements, strSource)
 
146
//     #define MBSCAT_S(strDest, numberOfElements, strSource) _mbscat_s(strDest, numberOfElements, strSource)
 
147
// 
 
148
//     #define _VSNPRINTF_S(strDest, numberOfElements, Count, Format, VA_Arg_List) _vsnprintf_s(strDest, numberOfElements, Count, Format, VA_Arg_List)
 
149
//     #define _VSNTPRINTF_S(strDest, numberOfElements, Count, Format, VA_Arg_List) _vsntprintf_s(strDest, numberOfElements, Count, Format, VA_Arg_List)
 
150
//     #define SPRINTF_S(strDest, numberOfElements, Format, ...) sprintf_s(strDest, numberOfElements, Format, ##__VA_ARGS__)
 
151
//     #define _SNPRINTF_S(strDest, numberOfElements, Count, Format, ...) _snprintf_s(strDest, numberOfElements, Count, Format, ##__VA_ARGS__)
 
152
// 
 
153
//     #define STRDATE_S(strDest, numberOfElements) _strdate_s(strDest, numberOfElements)
 
154
//     #define _TSTRDATE_S(strDest, numberOfElements) _tstrdate_s(strDest, numberOfElements)
 
155
//     #define _STRTIME_S(strDest, numberOfElements) _strtime_s(strDest, numberOfElements)
 
156
//     #define _TSTRTIME_S(strDest, numberOfElements) _tstrtime_s(strDest, numberOfElements)
 
157
//     
 
158
//     #define FOPEN_S(file, filename, mode)   fopen_s(file, filename, mode)
 
159
// 
 
160
//     #define _TCSNLEN(str, numberOfElements) _tcsnlen(str)
 
161
// 
 
162
//     #define _TSPLITPATH(path, Drive, DriveNumElements, Dir, DirNumElements, Filename, FileNumElements, Extension, ExtNumElements) _tsplitpath_s(path, Drive, DriveNumElements, Dir, DirNumElements, Filename, FileNumElements, Extension, ExtNumElements)
 
163
//     #define _TMAKEPATH_S(path, numberOfElements, Drive, Dir, Filename, Extension) _tmakepath_s(path, numberOfElements, Drive, Dir, Filename, Extension)
 
164
// 
 
165
//     #define SSCANF_S(buffer, Format, ...) sscanf_s(buffer, Format, ##__VA_ARGS__)
 
166
//     #define SWSCANF_S(buffer, Format, ...) swscanf_s(buffer, Format, ##__VA_ARGS__)
 
167
// 
 
168
// #else
 
169
//     #define STRNCPY_S(strDest, numberOfElements, strSource, count) strncpy(strDest, strSource, count)
 
170
//     #define WCSNCPY_S(strDest, numberOfElements, strSource, count) wcsncpy(strDest, strSource, count)
 
171
//     #define MBSNCPY_S(strDest, numberOfElements, strSource, count) _mbsncpy(strDest, strSource, count)
 
172
//     #define _TCSNCPY_S(strDest, numberOfElements, strSource, count) _tcsncpy(strDest, strSource, count)
 
173
// 
 
174
//     #define STRCPY_S(strDest, numberOfElements, strSource) strcpy(strDest, strSource)
 
175
//     #define WCSCPY_S(strDest, numberOfElements, strSource) wcscpy(strDest, strSource)
 
176
//     #define MBSCPY_S(strDest, numberOfElements, strSource) _mbscpy(strDest, strSource)
 
177
//     #define _TCSCPY_S(strDest, numberOfElements, strSource) _tcscpy(strDest, strSource)
 
178
// 
 
179
//     #define STRCAT_S(strDest, numberOfElements, strSource) strcat(strDest, strSource)
 
180
//     #define WCSCAT_S(strDest, numberOfElements, strSource) wcscat(strDest, strSource)
 
181
//     #define MBSCAT_S(strDest, numberOfElements, strSource) _mbscat(strDest, strSource)
 
182
// 
 
183
//     #define _VSNPRINTF_S(strDest, numberOfElements, Count, Format, VA_Arg_List) _vsnprintf(strDest, Count, Format, VA_Arg_List)
 
184
//     #define _VSNTPRINTF_S(strDest, numberOfElements, Count, Format, VA_Arg_List) _vsntprintf(strDest, Count, Format, VA_Arg_List)
 
185
//     #define SPRINTF_S(strDest, numberOfElements, Format, a,b,c,d,e,f,g,h,i,j,k,l) sprintf(strDest, Format, VARG(a),VARG(b),VARG(c),VARG(d),VARG(e),VARG(f),VARG(g),VARG(h),VARG(i),VARG(j),VARG(k),VARG(l))
 
186
//     #define _SNPRINTF_S(strDest, numberOfElements, Count, Format, a,b,c,d,e,f,g,h,i,j,k,l) _snprintf(strDest, Count, Format, VARG(a),VARG(b),VARG(c),VARG(d),VARG(e),VARG(f),VARG(g),VARG(h),VARG(i),VARG(j),VARG(k),VARG(l))
 
187
// 
 
188
//     #define STRDATE_S(strDest, numberOfElements) _strdate(strDest)
 
189
//     #define _TSTRDATE_S(strDest, numberOfElements) _tstrdate(strDest)
 
190
//     #define _STRTIME_S(strDest, numberOfElements) _strtime(strDest)
 
191
//     #define _TSTRTIME_S(strDest, numberOfElements) _tstrtime(strDest)
 
192
// 
 
193
//     #define FOPEN_S(file, filename, mode)   (file=fopen(filename, mode))
 
194
// 
 
195
//     #define _TCSNLEN(str, numberOfElements)     _tcsclen(str)
 
196
// 
 
197
//     #define _TSPLITPATH(path, Drive, DriveNumElements, Dir, DirNumElements, Filename, FileNumElements, Extension, ExtNumElements) _tsplitpath(path, Drive, Dir, Filename, Extension)
 
198
//     #define _TMAKEPATH_S(path, numberOfElements, Drive, Dir, Filename, Extension) _makepath(path, Drive, Dir, Filename, Extension)
 
199
// 
 
200
//     #define SSCANF_S(buffer, Format, VA_Arg_List) sscanf(buffer, Format, VA_Arg_List)
 
201
//     #define SWSCANF_S(buffer, Format, VA_Arg_List) swscanf(buffer, Format, VA_Arg_List)
 
202
// #endif
 
203
 
 
204
///////////////////////////////////////////////
 
205
// Variable argument functions               //
 
206
///////////////////////////////////////////////
 
207
 
 
208
//@note: Currently xutility breaks with this enabled 2005 fixes it
 
209
#pragma warning(disable : 4619) // #pragma warning : there is no warning number 'number'   
 
210
//#pragma warning(disable : 4267) // #pragma warning : conversion from 'size_t' to 'int', possible loss of data
 
211
  
 
212
 
 
213
// Unwanted VC++ level 4 warnings to disable.
 
214
#pragma warning(disable : 4100) // unreferenced formal parameter                                                                                
 
215
#pragma warning(disable : 4127) // Conditional expression is constant                                                                   
 
216
#pragma warning(disable : 4200) // Zero-length array item at end of structure, a VC-specific extension  
 
217
#pragma warning(disable : 4201) // nonstandard extension used : nameless struct/union                                   
 
218
#pragma warning(disable : 4244) // conversion to float, possible loss of data                                           
 
219
#pragma warning(disable : 4245) // conversion from 'enum ' to 'unsigned long', signed/unsigned mismatch 
 
220
#pragma warning(disable : 4251) // needs to have dll-interface to be used by clients of class 'ULinker' 
 
221
#pragma warning(disable : 4275) // non dll-interface class used as base for dll-interface class          
 
222
#pragma warning(disable : 4291) // typedef-name '' used as synonym for class-name ''                    
 
223
#pragma warning(disable : 4324) // structure was padded due to __declspec(align())                                              
 
224
#pragma warning(disable : 4355) // this used in base initializer list                                   
 
225
#pragma warning(disable : 4389) // signed/unsigned mismatch                                             
 
226
#pragma warning(disable : 4511) // copy constructor could not be generated                              
 
227
#pragma warning(disable : 4512) // assignment operator could not be generated                           
 
228
#pragma warning(disable : 4514) // unreferenced inline function has been removed                                                
 
229
#pragma warning(disable : 4699) // creating precompiled header                                                                                  
 
230
#pragma warning(disable : 4702) // unreachable code in inline expanded function                                                 
 
231
#pragma warning(disable : 4710) // inline function not expanded                                                                                 
 
232
#pragma warning(disable : 4711) // function selected for autmatic inlining                                                              
 
233
#pragma warning(disable : 4714) // __forceinline function not expanded                                                                  
 
234
 
 
235
 
 
236
NAMESPACE_BEGIN
 
237
 
 
238
void* GetDllHandle( const TCHAR* DllName );
 
239
 
 
240
void FreeDllHandle( void* DllHandle );
 
241
 
 
242
void* GetDllExport( void* DllHandle, const TCHAR* ExportName );
 
243
 
 
244
 
 
245
NAMESPACE_END
 
246
 
 
247
#endif // SYSTEMWIN32_H
 
248
 
 
249