~hikiko/nux/arb-srgba-shader

« back to all changes in this revision

Viewing changes to NuxCore/NKernel.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 KERNEL_H
 
2
#define KERNEL_H
 
3
 
 
4
 
 
5
#include "NSystem.h"
 
6
#include <iostream>
 
7
#include <stdexcept>
 
8
#include <iostream>
 
9
#include <fstream>
 
10
#include <sstream>
 
11
#include <stdexcept>
 
12
#include <string>
 
13
#include <iomanip>
 
14
#include <map>
 
15
#include <vector>
 
16
#include <list>
 
17
#include <algorithm>
 
18
#include <new>
 
19
#include <set>
 
20
 
 
21
#include <cstddef>
 
22
#include <cwchar>   // formerly C language <wchar.h>
 
23
#include <cstdio>   // formerly C language <stdio.h>
 
24
#include <cstdlib>  // formerly C language <stdlib.h>
 
25
#include <cstring>  // formerly C language <string.h>
 
26
#include <cmath>    // formerly C language <math.h>
 
27
#include <cfloat>   // formerly C language <float.h>
 
28
#include <ctime>    // formerly C language <time.h>
 
29
#include <cctype>   // formerly C language <ctype.h>
 
30
#include <cwctype>  // formerly C language <wctype.h>
 
31
#include <climits>  // formerly C language <limits.h>
 
32
#include <exception>
 
33
#include <stdexcept>
 
34
 
 
35
#include "NNamespace.h"
 
36
#include "NSystemTypes.h"
 
37
 
 
38
 
 
39
// WIN32_SECURE if define for the latest version of Visual Studio starting at VS 2005. We use it for security improvement.
 
40
#if (defined INL_VISUAL_STUDIO_2005) || (defined INL_VISUAL_STUDIO_2008)
 
41
        #define WIN32_SECURE
 
42
#endif
 
43
 
 
44
#define INL_STATIC_CAST(a, b)       static_cast<a>(b)
 
45
#define INL_REINTERPRET_CAST(a, b)  reinterpret_cast<a>(b)
 
46
#define INL_CONST_CAST(a, b)        const_cast<a>(b)
 
47
#define INL_DYNAMIC_CAST(a, b)      dynamic_cast<a>(b)
 
48
 
 
49
#define INL_INVALID_INDEX           -1
 
50
#define INL_INVALID_HANDLE          -1
 
51
 
 
52
#define INL_IN
 
53
#define INL_OUT
 
54
 
 
55
#define INL_0       0
 
56
#define INL_1       1
 
57
#define INL_2       2
 
58
#define INL_4       4
 
59
#define INL_8       8
 
60
#define INL_16      16
 
61
#define INL_32      32
 
62
#define INL_64      64
 
63
#define INL_128     128
 
64
#define INL_256     256
 
65
#define INL_512     512
 
66
#define INL_1024    1024
 
67
#define INL_2048    2048
 
68
#define INL_4096    4096
 
69
#define INL_8192    8192
 
70
#define INL_16384   16384
 
71
#define INL_65536   65536
 
72
 
 
73
#define INL_MAKEFOURCHARTAG(ch0, ch1, ch2, ch3)  \
 
74
    ((DWORD)(BYTE)(ch0) |               \
 
75
    ((DWORD)(BYTE)(ch1) << 8) |         \
 
76
    ((DWORD)(BYTE)(ch2) << 16) |        \
 
77
    ((DWORD)(BYTE)(ch3) << 24 ))
 
78
 
 
79
 
 
80
#define INLNEW new
 
81
#define INLDELETE delete
 
82
#define INLDELETEARRAY delete []
 
83
 
 
84
#define INL_RUNTIME_ERROR(str, ...)             LogOutputErrorMessage(__FILE__, __LINE__, str, ##__VA_ARGS__);
 
85
#define INL_ERROR_IF_NULL(test, str, ...)       if(test == 0)   LogOutputErrorMessage(__FILE__, __LINE__, str, ##__VA_ARGS__);
 
86
#define INL_ERROR_IF_TRUE(test, str, ...)       if(test)        LogOutputErrorMessage(__FILE__, __LINE__, str, ##__VA_ARGS__);
 
87
#define INL_ERROR_IF_FALSE(test, str, ...)      if(!(test))     LogOutputErrorMessage(__FILE__, __LINE__, str, ##__VA_ARGS__);
 
88
 
 
89
#define INL_RETURN_IF_NULL(test)                if(test == 0)   return;
 
90
#define INL_RETURN_IF_TRUE(test)                if(test)        return;
 
91
#define INL_RETURN_IF_FALSE(test)               if(!(test))     return;
 
92
 
 
93
#define INL_RETURN_VALUE_IF_NULL(test, value)   if(test == 0)   return value;
 
94
#define INL_RETURN_VALUE_IF_TRUE(test, value)   if(test)        return value;
 
95
#define INL_RETURN_VALUE_IF_FALSE(test, value)  if(!(test))     return value;
 
96
 
 
97
 
 
98
// Structure Alignment
 
99
#if defined(INL_MICROSOFT_COMPILER)
 
100
    #define INL_DATA_ALIGN(declaration, alignment) __declspec(align(alignment)) declaration
 
101
#elif defined(INL_PS3)
 
102
    #define INL_DATA_ALIGN(declaration, alignment) declaration __attribute__ ((aligned (alignment)))
 
103
#elif defined (INL_GNUCPP_COMPILER)
 
104
    #define INL_DATA_ALIGN(declaration, alignment) declaration __attribute__ ((aligned (alignment)))
 
105
#endif
 
106
 
 
107
// Sizeof is a compile time function. So array must be totally defined if sizeof is used on it.
 
108
// The number of elements in array must be a constant at compile time.
 
109
// Example: int array[10] is valid.
 
110
#define INL_ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
 
111
 
 
112
// Compiler specific include.
 
113
#ifdef XBOX360
 
114
    #error Unknown Compiler
 
115
#elif defined (INL_OS_WINDOWS) && defined (INL_MICROSOFT_COMPILER)
 
116
    #include "NSystemWindows.h"
 
117
#elif defined (INL_PS3)
 
118
    #include "NSystemPS3.h"
 
119
#elif defined (INL_OS_LINUX) && defined (INL_GNUCPP_COMPILER)
 
120
    #include "NSystemGNU.h"
 
121
#elif defined (INL_OS_MACOSX) && defined (INL_GNUCPP_COMPILER)
 
122
    #error Unknown Compiler
 
123
#else
 
124
    #error Unknown Compiler
 
125
#endif
 
126
 
 
127
 
 
128
NAMESPACE_BEGIN
 
129
 
 
130
// Variable arguments.
 
131
t_u32 GetVariableArgs(TCHAR* Dest, t_u32 Size, t_u32 Count, const TCHAR*& Fmt, va_list ArgPtr);
 
132
t_u32 GetVariableArgsAnsi(ANSICHAR* Dest, t_u32 Size, t_u32 Count, const ANSICHAR*& Fmt, va_list ArgPtr);
 
133
 
 
134
 
 
135
#define GET_VARARGS(msg, size, len, fmt)       \
 
136
{                                           \
 
137
    va_list arg_list;                       \
 
138
    va_start(arg_list,fmt);            \
 
139
    VSNTPRINTF_S( msg, size, len, fmt, arg_list );  \
 
140
    va_end( arg_list );                     \
 
141
}
 
142
#define GET_VARARGS_ANSI(msg, size, len, fmt)      \
 
143
{                                               \
 
144
    va_list arg_list;                           \
 
145
    va_start(arg_list,fmt);                \
 
146
    VSNPRINTF_S( msg, size, len, fmt, arg_list );  \
 
147
    va_end( arg_list );                         \
 
148
}
 
149
#define GET_VARARGS_RESULT(msg, size, len, fmt, result)     \
 
150
{                                                       \
 
151
    va_list arg_list;                                   \
 
152
    va_start(arg_list, fmt);                       \
 
153
    result = GetVariableArgs(msg, size, len, fmt, arg_list);     \
 
154
}
 
155
 
 
156
//////////////////////////////////////////////////////////////////////////
 
157
//      Check macros for assertions.                                        //
 
158
//////////////////////////////////////////////////////////////////////////
 
159
 
 
160
#ifdef INL_ENABLE_ASSERT_MACROS
 
161
    #define nuxAssert(expr)             { if(!(expr)) nuxFailAssert(TEXT(#expr)); }
 
162
    // Expression is always evaluated no matter if INL_ENABLE_ASSERT_MACROS is enabled. nuxFailAssert is called if enabled.
 
163
    #define nuxVerifyExpr(expr)         { if(!(expr)) nuxFailAssert(TEXT(#expr)); }
 
164
    
 
165
    #define DEBUGTRACE(str, ...)    nuxDebugMsg(str, ##__VA_ARGS__)
 
166
 
 
167
    #ifdef INL_VARIADIC_MACROS_SUPPORT
 
168
        #define nuxFailAssert(str, ...)         { if(nuxIsDebuggerPresent()){nux::LogOutputAssertMessage(__FILE__, __LINE__, str, ##__VA_ARGS__);} inlDebugBreak();}
 
169
        #define nuxError(str, ...)              { if(nuxIsDebuggerPresent()){nux::LogOutputErrorMessage(__FILE__, __LINE__, str, ##__VA_ARGS__);} inlDebugBreak();}
 
170
        #define nuxDebugMsg(str, ...)           { if(nuxIsDebuggerPresent()) nux::LogOutputDebugMessage(str, ##__VA_ARGS__);}
 
171
    
 
172
        #define nuxAssertMsg(expr, a, ...)      { if(!(expr)) nuxFailAssert( TEXT(#expr) TEXT(" : ") a, ##__VA_ARGS__); }
 
173
        #define nuxVerifyExprMsg(expr, a, ...)  { if(!(expr)) nuxFailAssert( TEXT(#expr) TEXT(" : ") a, ##__VA_ARGS__); }   // Expression is always evaluated. nuxFailAssert is called if enabled.
 
174
    #else
 
175
        #define nuxFailAssert(a,b,c,d,e,f,g,h,i,j,k,l)          { if(nuxIsDebuggerPresent()){nux::LogOutputAssertMessage(__FILE__,__LINE__,VARG(a),VARG(b),VARG(c),VARG(d),VARG(e),VARG(f),VARG(g),VARG(h),VARG(i),VARG(j),VARG(k),VARG(l));} inlDebugBreak();}
 
176
        #define nuxError(a,b,c,d,e,f,g,h,i,j,k,l)               { if(nuxIsDebuggerPresent()) {nux::LogOutputErrorMessage(__FILE__,__LINE__,VARG(a),VARG(b),VARG(c),VARG(d),VARG(e),VARG(f),VARG(g),VARG(h),VARG(i),VARG(j),VARG(k),VARG(l));} inlDebugBreak();}
 
177
        #define nuxAssertMsg(expr,a,b,c,d,e,f,g,h,i,j,k,l)      { if(!(expr)) { nuxFailAssert( TEXT(#expr) TEXT(" : ") a,b,c,d,e,f,g,h,i,j,k,l); } }
 
178
        #define nuxVerifyExprMsg(expr,a,b,c,d,e,f,g,h,i,j,k,l)  { if(!(expr)) { nuxFailAssert( TEXT(#expr) TEXT(" : ") a,b,c,d,e,f,g,h,i,j,k,l); } }    // Expression is always evaluated. nuxFailAssert is called if enabled.
 
179
        #define nuxDebugMsg(a,b,c,d,e,f,g,h,i,j,k,l)            { if(nuxIsDebuggerPresent() && NOutputDeviceRedirector::Ready()) GLogDevice.LogFunction(a,b,c,d,e,f,g,h,i,j,k,l); }
 
180
    #endif
 
181
 
 
182
    // Break if codepaths should never be reached.
 
183
    #define nuxAssertNoEntry()           { nuxFailAssert( TEXT("This section of code should not be executed.") ); }
 
184
    // Break if codepaths should not be executed more than once.
 
185
    #define nuxAssertNoReEntry() \
 
186
    { \
 
187
        static bool s_inlRuntimeHasBeenHere##__LINE__ = false; \
 
188
        nuxAssertMsg( !s_inlRuntimeHasBeenHere##__LINE__, TEXT("This section of code has already been called.") ); \
 
189
        s_inlRuntimeHasBeenHere##__LINE__ = true; \
 
190
    }
 
191
 
 
192
    class NRecursionScopeCounter
 
193
    {
 
194
    public: 
 
195
        NRecursionScopeCounter(WORD &InCounter) : Counter( InCounter ) { ++Counter; }
 
196
        ~NRecursionScopeCounter() { --Counter; }
 
197
    private:
 
198
        WORD& Counter;
 
199
    };
 
200
 
 
201
    // Break if codepaths should never be called recursively.
 
202
    #define nuxAssertNoRecursion()  \
 
203
        static WORD RecursionCounter##__LINE__ = 0; \
 
204
        nuxAssertMsg( RecursionCounter##__LINE__ == 0, TEXT("This section of code was entered recursively.") ); \
 
205
        const NRecursionScopeCounter ScopeMarker##__LINE__( RecursionCounter##__LINE__ )
 
206
 
 
207
    // Compile time assertion. Break if the assertion fails.
 
208
    // @param expr  Must be evaluated at compile time.
 
209
    #define nuxAssertAtCompileTime(expr)  typedef BYTE CompileTimeCheckType##__LINE__[(expr) ? 1 : -1]
 
210
#else
 
211
    #ifdef INL_MICROSOFT_COMPILER
 
212
        #define nuxAssert(expr)                     INL_NOOP
 
213
        #define nuxVerifyExpr(expr)                 { if(!(expr)) {} }
 
214
        #define nuxDebugMsg(a, ...)                 INL_NOOP
 
215
        #ifdef INL_VARIADIC_MACROS_SUPPORT
 
216
            #define nuxAssertMsg(expr, a, ...)      INL_NOOP
 
217
            #define nuxVerifyExprMsg(expr, a, ...)  { if(!(expr)) {} }
 
218
            #define nuxError(a, ...)                INL_NOOP
 
219
        #else
 
220
            #define nuxAssertMsg(expr,a,b,c,d,e,f,g,h,i,j,k,l)      INL_NOOP
 
221
            #define nuxVerifyExprMsg(expr,a,b,c,d,e,f,g,h,i,j,k,l)  { if(!(expr)) {} }
 
222
            #define nuxError(a,b,c,d,e,f,g,h,i,j,k,l)               INL_NOOP
 
223
        #endif
 
224
        #define nuxAssertNoEntry()              INL_NOOP
 
225
        #define nuxAssertNoReentry()            INL_NOOP
 
226
        #define nuxAssertNoRecursion()          INL_NOOP
 
227
        #define nuxAssertAtCompileTime(expr)    INL_NOOP    
 
228
    #else
 
229
        #define nuxDebugMsg(a, ...)
 
230
        #define nuxError(a, ...)                {}
 
231
        #define nuxAssert(expr)                 {}
 
232
        #define nuxVerifyExpr(expr)             { if(!(expr)) {} }
 
233
        #define nuxAssertMsg(expr,msg, ...)     {}
 
234
        #define nuxVerifyExprMsg(expr, a, ...)  { if(!(expr)) {} }
 
235
        #define nuxAssertNoEntry()              {}
 
236
        #define nuxAssertNoReentry()            {}
 
237
        #define nuxAssertNoRecursion()          {}
 
238
        #define nuxAssertAtCompileTime(expr)    {}
 
239
    #endif
 
240
#endif
 
241
 
 
242
//////////////////////////////////////////////////////////////////////////
 
243
// String conversion classes                                            //
 
244
//////////////////////////////////////////////////////////////////////////
 
245
 
 
246
#ifndef _UNICODE
 
247
    #define CALL_OS_TCHAR_FUNCTION(funcW,funcA) funcA
 
248
    #define TCHAR_TO_ANSI(str) str
 
249
    #define ANSI_TO_TCHAR(str) (const TCHAR*)((const ANSICHAR*)str)
 
250
 
 
251
    #define UTF8ToTCHAR(str) str
 
252
    #define TCHARToUTF8(str) str
 
253
    #define UTF16ToTCHAR(str) (const char*)NUTF8(str)
 
254
    #define TCHARToUTF16(str) (const wchar_t*)NUTF16(str)
 
255
#else
 
256
    #define CALL_OS_TCHAR_FUNCTION(funcW,funcA) funcW
 
257
 
 
258
    /*!
 
259
    NOTE: Theses macros creates objects with very short lifespan. They are
 
260
    meant to be used as parameters to functions. Do not assign a variable to the content 
 
261
    of the converted string as the object will go out of scope and the string released.
 
262
 
 
263
    Usage:
 
264
    SomeApi(TCHAR_TO_ANSI(SomeUnicodeString));
 
265
    const char* SomePointer = TCHAR_TO_ANSI(SomeUnicodeString); <--- Bad!!!
 
266
    */
 
267
    #define TCHAR_TO_ANSI(str)  (ANSICHAR*)typedef NCharacterConversion<ANSICHAR, TCHAR, TCharToAnsiConvertion>((const TCHAR*)str)
 
268
    #define ANSI_TO_TCHAR(str)  (TCHAR*)NCharacterConversion<TCHAR, ANSICHAR, AnsiToTCharConversion>((const ANSICHAR*)str)
 
269
 
 
270
    #define UTF8ToTCHAR(str) (const wchar_t*)NUTF16(str)
 
271
    #define TCHARToUTF8(str) (const char*)NUTF8(str)
 
272
    #define UTF16ToTCHAR(str) str
 
273
    #define TCHARToUTF16(str) str
 
274
#endif
 
275
 
 
276
#define inlUTF16ToUTF8(s) (const char*)nux::NUTF8(s)
 
277
#define inlUTF8ToUTF16(s) (const wchar_t*)nux::NUTF16(s)
 
278
 
 
279
#define ANSICHAR_TO_UNICHAR(str) (UNICHAR*)nux::NCharacterConversion<UNICHAR, ANSICHAR, nux::AnsicharToUnicharConvertion>((const ANSICHAR*)str)
 
280
#define UNICHAR_TO_ANSICHAR(str) (ANSICHAR*)nux::NCharacterConversion<ANSICHAR, UNICHAR, nux::UnicharToAnsicharConvertion>((const UNICHAR*)str)
 
281
 
 
282
 
 
283
#define INL_WIN32_LINE_TERMINATOR   TEXT("\r\n")
 
284
#define INL_UNIX_LINE_TERMINATOR    TEXT("\n")
 
285
#define INL_MACOSX_LINE_TERMINATOR  TEXT("\n")
 
286
 
 
287
#if defined(INL_OS_WINDOWS)
 
288
    #define INL_LINE_TERMINATOR INL_WIN32_LINE_TERMINATOR
 
289
#elif defined(INL_OS_LINUX) || defined(INL_OS_MACOSX)
 
290
    #define INL_LINE_TERMINATOR INL_UNIX_LINE_TERMINATOR
 
291
#elif defined(INL_PS3)
 
292
    #define INL_LINE_TERMINATOR INL_UNIX_LINE_TERMINATOR
 
293
#endif
 
294
 
 
295
 
 
296
#if defined(INL_OS_WINDOWS)
 
297
    #define INL_PATH_SEPARATOR_STRING   INL_BACKSLASH_STRING
 
298
    #define INL_PATH_SEPARATOR_CHAR     INL_BACKSLASH_CHAR
 
299
#elif defined(INL_OS_LINUX) || defined(INL_OS_MACOSX)
 
300
    #define INL_PATH_SEPARATOR_STRING   INL_SLASH_STRING
 
301
    #define INL_PATH_SEPARATOR_CHAR     INL_SLASH_CHAR
 
302
#elif defined(INL_PS3)
 
303
    #define INL_PATH_SEPARATOR_STRING   INL_SLASH_STRING
 
304
    #define INL_PATH_SEPARATOR_CHAR     INL_SLASH_CHAR
 
305
#endif
 
306
 
 
307
#define INL_BACKSLASH_CHAR      TEXT('\\')
 
308
#define INL_BACKSLASH_STRING    TEXT("\\")
 
309
#define INL_SLASH_CHAR          TEXT('/')
 
310
#define INL_SLASH_STRING        TEXT("/")
 
311
 
 
312
#define INL_MAX_FILEPATH_SIZE   1024
 
313
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
314
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
315
 
 
316
#if (defined _WIN32) && (defined WIN32_SECURE)
 
317
    #define WCSNCPY_S(strDest, numberOfElements, strSource, count)  wcsncpy_s (strDest, numberOfElements, strSource, count)
 
318
    #define STRNCPY_S(strDest, numberOfElements, strSource, count)  _tcsncpy_s(strDest, numberOfElements, strSource, count)
 
319
    #define STRCPY_S(strDest, numberOfElements, strSource)          _tcscpy_s(strDest, numberOfElements, strSource)
 
320
    #define STRCAT_S(strDest, numberOfElements, strSource)          _tcscat_s(strDest, numberOfElements, strSource)
 
321
 
 
322
    #define VSNPRINTF_S(strDest, numberOfElements, Count, format, VA_Arg_List)  vsnprintf_s(strDest, numberOfElements, Count, format, VA_Arg_List)
 
323
    #define VSNTPRINTF_S(strDest, numberOfElements, Count, format, VA_Arg_List) _vsntprintf_s(strDest, numberOfElements, Count, format, VA_Arg_List)
 
324
    #define SPRINTF_S(strDest, numberOfElements, format, ...)                   _stprintf_s(strDest, numberOfElements, format, ##__VA_ARGS__)
 
325
    #define SNPRINTF_S(strDest, numberOfElements, Count, format, ...)           _sntprintf_s(strDest, numberOfElements, Count, format, ##__VA_ARGS__)
 
326
 
 
327
    #define STRDATE_S(strDest, numberOfElements) _tstrdate_s(strDest, numberOfElements)
 
328
    #define STRTIME_S(strDest, numberOfElements)       _tstrtime_s(strDest, numberOfElements)
 
329
    
 
330
    #define FOPEN_S(file, filename, mode)           _tfopen_s(file, filename, mode)
 
331
 
 
332
    #define STRLEN_S(str, numberOfElements)         _tcsnlen(str, numberOfElements)
 
333
 
 
334
    #define SPLITPATH_S(path, Drive, DriveNumElements, Dir, DirNumElements, Filename, FileNumElements, Extension, ExtNumElements) _tsplitpath_s(path, Drive, DriveNumElements, Dir, DirNumElements, Filename, FileNumElements, Extension, ExtNumElements)
 
335
    #define MAKEPATH_S(path, numberOfElements, Drive, Dir, Filename, Extension) _tmakepath_s(path, numberOfElements, Drive, Dir, Filename, Extension)
 
336
 
 
337
    #define SSCANF_S(buffer, format, ...)           _stscanf_s(buffer, format, ##__VA_ARGS__)
 
338
    #define SNSCANF_S(input, length, format, ...)   _sntscanf_s(input, length, format, ##__VA_ARGS__)
 
339
 
 
340
#else
 
341
    #define WCSNCPY_S(strDest, numberOfElements, strSource, count)  wcsncpy (strDest, strSource, count)
 
342
    #define STRNCPY_S(strDest, numberOfElements, strSource, count)  _tcsncpy(strDest, strSource, count)
 
343
    #define STRCPY_S(strDest, numberOfElements, strSource)          _tcscpy(strDest, strSource)
 
344
    #define STRCAT_S(strDest, numberOfElements, strSource)          _tcscat(strDest, strSource)
 
345
 
 
346
    #define VSNPRINTF_S(strDest, numberOfElements, Count, format, VA_Arg_List)              vsnprintf(strDest, Count, format, VA_Arg_List)
 
347
    #define VSNTPRINTF_S(strDest, numberOfElements, Count, format, VA_Arg_List)             _vsntprintf(strDest, Count, format, VA_Arg_List)
 
348
    #define SPRINTF_S(strDest, numberOfElements, format, a,b,c,d,e,f,g,h,i,j,k,l)           _stprintf(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))
 
349
    #define SNPRINTF_S(strDest, numberOfElements, Count, format, a,b,c,d,e,f,g,h,i,j,k,l)   _sntprintf(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))
 
350
 
 
351
    #define STRDATE_S(strDest, numberOfElements)        _tstrdate(strDest)
 
352
    #define STRTIME_S(strDest, numberOfElements)        _tstrtime(strDest)
 
353
 
 
354
    #define FOPEN_S(file, filename, mode)               (file = _tfopen(filename, mode))
 
355
 
 
356
    #define STRLEN_S(str, numberOfElements)             _tcslen(str)
 
357
 
 
358
    #define SPLITPATH_S(path, Drive, DriveNumElements, Dir, DirNumElements, Filename, FileNumElements, Extension, ExtNumElements) _tsplitpath(path, Drive, Dir, Filename, Extension)
 
359
    #define MAKEPATH_S(path, numberOfElements, Drive, Dir, Filename, Extension) _makepath(path, Drive, Dir, Filename, Extension)
 
360
 
 
361
    #define SSCANF_S(buffer, format, ...)           _stscanf(buffer, format, ##__VA_ARGS__)
 
362
    #define SNSCANF_S(input, length, format, ...)   _sntscanf(input, length, format, ##__VA_ARGS__)
 
363
 
 
364
#endif
 
365
 
 
366
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
367
extern const t_bool GNoDialog;         // Set to true to disable the popping of dialog box. The message will go to the log.
 
368
 
 
369
#ifdef INL_VISUAL_STUDIO_2003
 
370
    //Visual Studio C++ 2003 doesn't support it, but there is a workaround:
 
371
    #pragma warning(disable: 4002)              // Warning: too many actual parameters for macro 'ident'
 
372
    #pragma warning(disable: 4003)              // Warning: not enough actual parameters for macro 'ident'
 
373
    template <typename T>
 
374
    inline const T &            VARG( const T &t )                              { return t; }
 
375
    inline const TCHAR *        VARG( )                                                 { return TEXT(""); }
 
376
#endif
 
377
 
 
378
#ifdef _UNICODE
 
379
    #define tstring std::wstring
 
380
    #define tostream std::wostream
 
381
    #define tistream std::wistream
 
382
    #define tiostream std::wiostream
 
383
    #define tofstream std::wofstream
 
384
    #define tfstream std::wfstream
 
385
#else
 
386
    #define tstring std::string
 
387
    #define tostream std::ostream
 
388
    #define tistream std::istream
 
389
    #define tiostream std::iostream
 
390
    #define tofstream std::ofstream
 
391
    #define tfstream std::fstream
 
392
#endif
 
393
 
 
394
// // UTF-16 is the primary encoding mechanism used by Microsoft Windows 2000, Windows 2000 Server, Windows XP and Windows 2003 Server.
 
395
// // Unicode Byte Order Mark (BOM)
 
396
// enum {UNICODE_UTF32_BE   = 0x0000FEFF };
 
397
// enum {UNICODE_UTF32_LE   = 0xFFFE0000 };
 
398
// enum {UNICODE_UTF16_BE   = 0xFEFF };
 
399
// enum {UNICODE_UTF16_LE   = 0xFFFE };
 
400
// enum {UNICODE_UTF8       = 0xEFBBBF };
 
401
 
 
402
const BYTE INL_UTF32_BE[]   = {0x04 /*size*/, 0x00, 0x00, 0xFE, 0xFF };
 
403
const BYTE INL_UTF32_LE[]   = {0x04 /*size*/, 0xFF, 0xFE, 0x00, 0x00 };
 
404
const BYTE INL_UTF16_BE[]   = {0x02 /*size*/, 0xFE, 0xFF };
 
405
const BYTE INL_UTF16_LE[]   = {0x02 /*size*/, 0xFF, 0xFE };
 
406
const BYTE INL_UTF8[]       = {0x03 /*size*/, 0xEF, 0xBB, 0xBF };
 
407
 
 
408
// enum {UNICODE_BOM   = 0xfeff     };
 
409
 
 
410
 
 
411
class NOutputDeviceManager;
 
412
class NOutputDevice;
 
413
class NFileManager;
 
414
 
 
415
 
 
416
#define GNullDevice         INL_GLOBAL_OBJECT_INSTANCE(nux::NNullOutput)
 
417
#define GLogDevice          INL_GLOBAL_OBJECT_INSTANCE(nux::NOutputDeviceRedirector)
 
418
#define GThrow              INL_GLOBAL_OBJECT_INSTANCE(nux::NThrowOutput)
 
419
 
 
420
#if (defined INL_OS_WINDOWS)
 
421
    #define GFileManager    INL_GLOBAL_OBJECT_INSTANCE(nux::NFileManagerWindows)
 
422
#elif (defined INL_OS_LINUX)
 
423
    #define GFileManager    INL_GLOBAL_OBJECT_INSTANCE(nux::NFileManagerGNU)
 
424
#elif (defined INL_PS3)
 
425
    #define GFileManager    INL_GLOBAL_OBJECT_INSTANCE(nux::NFileManagerPS3)
 
426
#endif
 
427
 
 
428
 
 
429
//////////////////////////////////////////////////////////////////////////
 
430
// Breaks into the debugger.  Forces a GPF in non-debug builds.         //
 
431
//////////////////////////////////////////////////////////////////////////
 
432
#if (defined _DEBUG) && (defined INL_MICROSOFT_COMPILER)
 
433
    #define nuxIsDebuggerPresent()  IsDebuggerPresent()
 
434
    #define inlDebugBreak()         ( IsDebuggerPresent() ? (DebugBreak(),1) : 1 )
 
435
#elif (defined _WIN32)
 
436
    #define nuxIsDebuggerPresent()      IsDebuggerPresent()
 
437
    #define inlDebugBreak()                     ( IsDebuggerPresent() ? *((INT*)3)=13 : 1 )
 
438
#elif (defined _DEBUG) && (defined INL_GNUCPP_COMPILER)
 
439
    #define nuxIsDebuggerPresent()  1
 
440
    #define inlDebugBreak()         asm("int3");
 
441
#elif (defined _DEBUG) && (defined INL_PS3)
 
442
    #define nuxIsDebuggerPresent()      1
 
443
    #define inlDebugBreak()                     __asm__ volatile("tw 31, 1, 1");
 
444
#else
 
445
    #define nuxIsDebuggerPresent()      0
 
446
    #define inlDebugBreak()                     
 
447
#endif
 
448
 
 
449
#if defined(INL_MICROSOFT_COMPILER)
 
450
    #define INL_HARDWARE_BREAK      {__debugbreak();}
 
451
    #define INL_BREAK_ASM_INT3      {__debugbreak();}
 
452
#elif defined(INL_GNUC_COMPILER)
 
453
    #define INL_HARDWARE_BREAK      asm("int3");
 
454
    #define INL_BREAK_ASM_INT3      asm("int3");
 
455
#elif defined(INL_PS3)
 
456
    #define INL_HARDWARE_BREAK      __asm__ volatile("tw 31, 1, 1");
 
457
    #define INL_BREAK_ASM_INT3      __asm__ volatile("tw 31, 1, 1");
 
458
#else
 
459
    #define INL_HARDWARE_BREAK
 
460
    #define INL_BREAK_ASM_INT3
 
461
#endif
 
462
 
 
463
// Simple version of the PURE_VIRTUAL. Use it before output macros nuxError is define.
 
464
#if INL_CHECK_PUREVIRTUALS
 
465
    #define INL_PURE_VIRTUAL =0;
 
466
#else
 
467
    #define INL_PURE_VIRTUAL { inlDebugBreak(); }
 
468
#endif
 
469
 
 
470
//////////////////////////////////////////////////////////////////////////
 
471
//      Variadic function prototypes.
 
472
//////////////////////////////////////////////////////////////////////////
 
473
 
 
474
#define VARARG_EXTRA(A) A,
 
475
#define VARARG_NONE
 
476
#define VARARG_PURE =0
 
477
 
 
478
#if _MSC_VER
 
479
 
 
480
    static inline DWORD         VAType(DWORD dw)        { return dw; }
 
481
    static inline t_byte        VAType(t_byte b)        { return b; }
 
482
    static inline t_u32        VAType(t_u32 ui)       { return ui; }
 
483
    static inline t_int         VAType(t_s32 i)         { return i; }
 
484
    static inline t_u64         VAType(t_u64 qw)        { return qw; } // possible conflict with t_size when compiling in 64 bits
 
485
    static inline t_s64         VAType(t_s64 sqw)       { return sqw; }
 
486
    static inline double        VAType(double d)        { return d; }
 
487
    static inline TCHAR         VAType(TCHAR c)         { return c; }
 
488
    static inline ANSICHAR*     VAType(ANSICHAR* s)     { return s; }
 
489
    static inline UNICHAR*      VAType(UNICHAR* s)      { return s; }
 
490
    template<class T> T*        VAType(T* p)            { return p; }
 
491
    template<class T> const T*  VAType(const T* p)      { return p; }
 
492
 
 
493
    //  Declaration of prototypes with lots of arguments
 
494
    //  If(the function return nothing)
 
495
    //  {
 
496
    //      Return = {}
 
497
    //      StaticFuncRet = void
 
498
    //  }
 
499
    //  else
 
500
    //  {
 
501
    //      Return = return 
 
502
    //      StaticFuncRet = type0
 
503
    //      FuncRet = type1
 
504
    //  }
 
505
    //  
 
506
    //  If this is a pure virtual function then PURE is equal to: ==0
 
507
    //  ExtraParamDecl is declaration for additional parameters: VARARG_EXTRA(TCHAR* Dest) VARARG_EXTRA(INT Size) VARARG_EXTRA(INT Count)
 
508
    //  ExtraParam is the parameters presented in ExtraParamDecl: VARARG_EXTRA(Dest) VARARG_EXTRA(Size) VARARG_EXTRA(Count) 
 
509
#define VARARG_DECL( FuncRet, StaticFuncRet, Return, FuncName, Pure, FmtType, ExtraParamDecl, ExtraParam )      \
 
510
    FuncRet FuncName##__VA(ExtraParamDecl FmtType Fmt, ... ) Pure;  \
 
511
    StaticFuncRet FuncName(ExtraParamDecl FmtType Fmt) {Return FuncName##__VA(ExtraParam (Fmt));} \
 
512
    template<class T1> \
 
513
    StaticFuncRet FuncName(ExtraParamDecl FmtType Fmt,T1 V1) {T1 v1=VAType(V1);Return FuncName##__VA(ExtraParam (Fmt),(v1));} \
 
514
    template<class T1,class T2> \
 
515
    StaticFuncRet FuncName(ExtraParamDecl FmtType Fmt,T1 V1,T2 V2) {T1 v1=VAType(V1);T2 v2=VAType(V2);Return FuncName##__VA(ExtraParam (Fmt),(v1),(v2));} \
 
516
    template<class T1,class T2,class T3> \
 
517
    StaticFuncRet FuncName(ExtraParamDecl FmtType Fmt,T1 V1,T2 V2,T3 V3) {T1 v1=VAType(V1);T2 v2=VAType(V2);T3 v3=VAType(V3);Return FuncName##__VA(ExtraParam (Fmt),(v1),(v2),(v3));} \
 
518
    template<class T1,class T2,class T3,class T4> \
 
519
    StaticFuncRet FuncName(ExtraParamDecl FmtType Fmt,T1 V1,T2 V2,T3 V3,T4 V4) {T1 v1=VAType(V1);T2 v2=VAType(V2);T3 v3=VAType(V3);T4 v4=VAType(V4);Return FuncName##__VA(ExtraParam (Fmt),(v1),(v2),(v3),(v4));} \
 
520
    template<class T1,class T2,class T3,class T4,class T5> \
 
521
    StaticFuncRet FuncName(ExtraParamDecl FmtType Fmt,T1 V1,T2 V2,T3 V3,T4 V4,T5 V5) {T1 v1=VAType(V1);T2 v2=VAType(V2);T3 v3=VAType(V3);T4 v4=VAType(V4);T5 v5=VAType(V5);Return FuncName##__VA(ExtraParam (Fmt),(v1),(v2),(v3),(v4),(v5));} \
 
522
    template<class T1,class T2,class T3,class T4,class T5,class T6> \
 
523
    StaticFuncRet FuncName(ExtraParamDecl FmtType Fmt,T1 V1,T2 V2,T3 V3,T4 V4,T5 V5,T6 V6) {T1 v1=VAType(V1);T2 v2=VAType(V2);T3 v3=VAType(V3);T4 v4=VAType(V4);T5 v5=VAType(V5);T6 v6=VAType(V6);Return FuncName##__VA(ExtraParam (Fmt),(v1),(v2),(v3),(v4),(v5),(v6));} \
 
524
    template<class T1,class T2,class T3,class T4,class T5,class T6,class T7> \
 
525
    StaticFuncRet FuncName(ExtraParamDecl FmtType Fmt,T1 V1,T2 V2,T3 V3,T4 V4,T5 V5,T6 V6,T7 V7) {T1 v1=VAType(V1);T2 v2=VAType(V2);T3 v3=VAType(V3);T4 v4=VAType(V4);T5 v5=VAType(V5);T6 v6=VAType(V6);T7 v7=VAType(V7);Return FuncName##__VA(ExtraParam (Fmt),(v1),(v2),(v3),(v4),(v5),(v6),(v7));} \
 
526
    template<class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8> \
 
527
    StaticFuncRet FuncName(ExtraParamDecl FmtType Fmt,T1 V1,T2 V2,T3 V3,T4 V4,T5 V5,T6 V6,T7 V7,T8 V8) {T1 v1=VAType(V1);T2 v2=VAType(V2);T3 v3=VAType(V3);T4 v4=VAType(V4);T5 v5=VAType(V5);T6 v6=VAType(V6);T7 v7=VAType(V7);T8 v8=VAType(V8);Return FuncName##__VA(ExtraParam (Fmt),(v1),(v2),(v3),(v4),(v5),(v6),(v7),(v8));} \
 
528
    template<class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9> \
 
529
    StaticFuncRet FuncName(ExtraParamDecl FmtType Fmt,T1 V1,T2 V2,T3 V3,T4 V4,T5 V5,T6 V6,T7 V7,T8 V8,T9 V9) {T1 v1=VAType(V1);T2 v2=VAType(V2);T3 v3=VAType(V3);T4 v4=VAType(V4);T5 v5=VAType(V5);T6 v6=VAType(V6);T7 v7=VAType(V7);T8 v8=VAType(V8);T9 v9=VAType(V9);Return FuncName##__VA(ExtraParam (Fmt),(v1),(v2),(v3),(v4),(v5),(v6),(v7),(v8),(v9));} \
 
530
    template<class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10> \
 
531
    StaticFuncRet FuncName(ExtraParamDecl FmtType Fmt,T1 V1,T2 V2,T3 V3,T4 V4,T5 V5,T6 V6,T7 V7,T8 V8,T9 V9,T10 V10) {T1 v1=VAType(V1);T2 v2=VAType(V2);T3 v3=VAType(V3);T4 v4=VAType(V4);T5 v5=VAType(V5);T6 v6=VAType(V6);T7 v7=VAType(V7);T8 v8=VAType(V8);T9 v9=VAType(V9);T10 v10=VAType(V10);Return FuncName##__VA(ExtraParam (Fmt),(v1),(v2),(v3),(v4),(v5),(v6),(v7),(v8),(v9),(v10));} \
 
532
    template<class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11> \
 
533
    StaticFuncRet FuncName(ExtraParamDecl FmtType Fmt,T1 V1,T2 V2,T3 V3,T4 V4,T5 V5,T6 V6,T7 V7,T8 V8,T9 V9,T10 V10,T11 V11) {T1 v1=VAType(V1);T2 v2=VAType(V2);T3 v3=VAType(V3);T4 v4=VAType(V4);T5 v5=VAType(V5);T6 v6=VAType(V6);T7 v7=VAType(V7);T8 v8=VAType(V8);T9 v9=VAType(V9);T10 v10=VAType(V10);T11 v11=VAType(V11);Return FuncName##__VA(ExtraParam (Fmt),(v1),(v2),(v3),(v4),(v5),(v6),(v7),(v8),(v9),(v10),(v11));} \
 
534
    template<class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12> \
 
535
    StaticFuncRet FuncName(ExtraParamDecl FmtType Fmt,T1 V1,T2 V2,T3 V3,T4 V4,T5 V5,T6 V6,T7 V7,T8 V8,T9 V9,T10 V10,T11 V11,T12 V12) {T1 v1=VAType(V1);T2 v2=VAType(V2);T3 v3=VAType(V3);T4 v4=VAType(V4);T5 v5=VAType(V5);T6 v6=VAType(V6);T7 v7=VAType(V7);T8 v8=VAType(V8);T9 v9=VAType(V9);T10 v10=VAType(V10);T11 v11=VAType(V11);T12 v12=VAType(V12);Return FuncName##__VA(ExtraParam (Fmt),(v1),(v2),(v3),(v4),(v5),(v6),(v7),(v8),(v9),(v10),(v11),(v12));} \
 
536
    template<class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13> \
 
537
    StaticFuncRet FuncName(ExtraParamDecl FmtType Fmt,T1 V1,T2 V2,T3 V3,T4 V4,T5 V5,T6 V6,T7 V7,T8 V8,T9 V9,T10 V10,T11 V11,T12 V12,T13 V13) {T1 v1=VAType(V1);T2 v2=VAType(V2);T3 v3=VAType(V3);T4 v4=VAType(V4);T5 v5=VAType(V5);T6 v6=VAType(V6);T7 v7=VAType(V7);T8 v8=VAType(V8);T9 v9=VAType(V9);T10 v10=VAType(V10);T11 v11=VAType(V11);T12 v12=VAType(V12);T13 v13=VAType(V13);Return FuncName##__VA(ExtraParam (Fmt),(v1),(v2),(v3),(v4),(v5),(v6),(v7),(v8),(v9),(v10),(v11),(v12),(v13));} \
 
538
    template<class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14> \
 
539
    StaticFuncRet FuncName(ExtraParamDecl FmtType Fmt,T1 V1,T2 V2,T3 V3,T4 V4,T5 V5,T6 V6,T7 V7,T8 V8,T9 V9,T10 V10,T11 V11,T12 V12,T13 V13,T14 V14) {T1 v1=VAType(V1);T2 v2=VAType(V2);T3 v3=VAType(V3);T4 v4=VAType(V4);T5 v5=VAType(V5);T6 v6=VAType(V6);T7 v7=VAType(V7);T8 v8=VAType(V8);T9 v9=VAType(V9);T10 v10=VAType(V10);T11 v11=VAType(V11);T12 v12=VAType(V12);T13 v13=VAType(V13);T14 v14=VAType(V14);Return FuncName##__VA(ExtraParam (Fmt),(v1),(v2),(v3),(v4),(v5),(v6),(v7),(v8),(v9),(v10),(v11),(v12),(v13),(v14));} \
 
540
    template<class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14,class T15> \
 
541
    StaticFuncRet FuncName(ExtraParamDecl FmtType Fmt,T1 V1,T2 V2,T3 V3,T4 V4,T5 V5,T6 V6,T7 V7,T8 V8,T9 V9,T10 V10,T11 V11,T12 V12,T13 V13,T14 V14,T15 V15) {T1 v1=VAType(V1);T2 v2=VAType(V2);T3 v3=VAType(V3);T4 v4=VAType(V4);T5 v5=VAType(V5);T6 v6=VAType(V6);T7 v7=VAType(V7);T8 v8=VAType(V8);T9 v9=VAType(V9);T10 v10=VAType(V10);T11 v11=VAType(V11);T12 v12=VAType(V12);T13 v13=VAType(V13);T14 v14=VAType(V14);T15 v15=VAType(V15);Return FuncName##__VA(ExtraParam (Fmt),(v1),(v2),(v3),(v4),(v5),(v6),(v7),(v8),(v9),(v10),(v11),(v12),(v13),(v14),(v15));} \
 
542
    template<class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14,class T15,class T16> \
 
543
    StaticFuncRet FuncName(ExtraParamDecl FmtType Fmt,T1 V1,T2 V2,T3 V3,T4 V4,T5 V5,T6 V6,T7 V7,T8 V8,T9 V9,T10 V10,T11 V11,T12 V12,T13 V13,T14 V14,T15 V15,T16 V16) {T1 v1=VAType(V1);T2 v2=VAType(V2);T3 v3=VAType(V3);T4 v4=VAType(V4);T5 v5=VAType(V5);T6 v6=VAType(V6);T7 v7=VAType(V7);T8 v8=VAType(V8);T9 v9=VAType(V9);T10 v10=VAType(V10);T11 v11=VAType(V11);T12 v12=VAType(V12);T13 v13=VAType(V13);T14 v14=VAType(V14);T15 v15=VAType(V15);T16 v16=VAType(V16);Return FuncName##__VA(ExtraParam (Fmt),(v1),(v2),(v3),(v4),(v5),(v6),(v7),(v8),(v9),(v10),(v11),(v12),(v13),(v14),(v15),(v16));} \
 
544
    template<class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14,class T15,class T16,class T17> \
 
545
    StaticFuncRet FuncName(ExtraParamDecl FmtType Fmt,T1 V1,T2 V2,T3 V3,T4 V4,T5 V5,T6 V6,T7 V7,T8 V8,T9 V9,T10 V10,T11 V11,T12 V12,T13 V13,T14 V14,T15 V15,T16 V16,T17 V17) {T1 v1=VAType(V1);T2 v2=VAType(V2);T3 v3=VAType(V3);T4 v4=VAType(V4);T5 v5=VAType(V5);T6 v6=VAType(V6);T7 v7=VAType(V7);T8 v8=VAType(V8);T9 v9=VAType(V9);T10 v10=VAType(V10);T11 v11=VAType(V11);T12 v12=VAType(V12);T13 v13=VAType(V13);T14 v14=VAType(V14);T15 v15=VAType(V15);T16 v16=VAType(V16);T17 v17=VAType(V17);Return FuncName##__VA(ExtraParam (Fmt),(v1),(v2),(v3),(v4),(v5),(v6),(v7),(v8),(v9),(v10),(v11),(v12),(v13),(v14),(v15),(v16),(v17));} \
 
546
    template<class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14,class T15,class T16,class T17,class T18> \
 
547
    StaticFuncRet FuncName(ExtraParamDecl FmtType Fmt,T1 V1,T2 V2,T3 V3,T4 V4,T5 V5,T6 V6,T7 V7,T8 V8,T9 V9,T10 V10,T11 V11,T12 V12,T13 V13,T14 V14,T15 V15,T16 V16,T17 V17,T18 V18) {T1 v1=VAType(V1);T2 v2=VAType(V2);T3 v3=VAType(V3);T4 v4=VAType(V4);T5 v5=VAType(V5);T6 v6=VAType(V6);T7 v7=VAType(V7);T8 v8=VAType(V8);T9 v9=VAType(V9);T10 v10=VAType(V10);T11 v11=VAType(V11);T12 v12=VAType(V12);T13 v13=VAType(V13);T14 v14=VAType(V14);T15 v15=VAType(V15);T16 v16=VAType(V16);T17 v17=VAType(V17);T18 v18=VAType(V18);Return FuncName##__VA(ExtraParam (Fmt),(v1),(v2),(v3),(v4),(v5),(v6),(v7),(v8),(v9),(v10),(v11),(v12),(v13),(v14),(v15),(v16),(v17),(v18));} \
 
548
    template<class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14,class T15,class T16,class T17,class T18,class T19> \
 
549
    StaticFuncRet FuncName(ExtraParamDecl FmtType Fmt,T1 V1,T2 V2,T3 V3,T4 V4,T5 V5,T6 V6,T7 V7,T8 V8,T9 V9,T10 V10,T11 V11,T12 V12,T13 V13,T14 V14,T15 V15,T16 V16,T17 V17,T18 V18,T19 V19) {T1 v1=VAType(V1);T2 v2=VAType(V2);T3 v3=VAType(V3);T4 v4=VAType(V4);T5 v5=VAType(V5);T6 v6=VAType(V6);T7 v7=VAType(V7);T8 v8=VAType(V8);T9 v9=VAType(V9);T10 v10=VAType(V10);T11 v11=VAType(V11);T12 v12=VAType(V12);T13 v13=VAType(V13);T14 v14=VAType(V14);T15 v15=VAType(V15);T16 v16=VAType(V16);T17 v17=VAType(V17);T18 v18=VAType(V18);T19 v19=VAType(V19);Return FuncName##__VA(ExtraParam (Fmt),(v1),(v2),(v3),(v4),(v5),(v6),(v7),(v8),(v9),(v10),(v11),(v12),(v13),(v14),(v15),(v16),(v17),(v18),(v19));}
 
550
 
 
551
#define VARARG_BODY( FuncRet, FuncName, FmtType, ExtraParamDecl )               \
 
552
    FuncRet FuncName##__VA( ExtraParamDecl  FmtType Fmt, ... )
 
553
 
 
554
#else  // !_MSC_VER
 
555
 
 
556
#define VARARG_DECL( FuncRet, StaticFuncRet, Return, FuncName, Pure, FmtType, ExtraParamDecl, ExtraParam )      \
 
557
    FuncRet FuncName( ExtraParamDecl FmtType Fmt, ... ) Pure
 
558
#define VARARG_BODY( FuncRet, FuncName, FmtType, ExtraParamDecl )               \
 
559
    FuncRet FuncName( ExtraParamDecl FmtType Fmt, ... )
 
560
 
 
561
#endif // _MSC_VER
 
562
 
 
563
 
 
564
/** Sends the formatted message to the debugging output. */
 
565
void inlOutputDebugString( const TCHAR *Format, ... );
 
566
 
 
567
/** Failed assertion handler.  Warning: May be called at library startup time. */
 
568
void LogOutputAssertMessage( const ANSICHAR* File, int Line, const TCHAR* Format = TEXT(""), ... );
 
569
 
 
570
void LogOutputErrorMessage( const ANSICHAR* File, int Line, const TCHAR* Format = TEXT(""), ... );
 
571
 
 
572
// Returns true is the output redirector is ready
 
573
bool inlOutputRedirectorReady();
 
574
 
 
575
void LogOutputDebugMessage(const TCHAR* Format, ... );
 
576
 
 
577
 
 
578
#if CHECK_PUREVIRTUALS
 
579
        #define PURE_VIRTUAL(func,extra) =0;
 
580
#else
 
581
        #define PURE_VIRTUAL(func,extra) { nuxError(TEXT("Pure virtual not implemented (%s)"), TEXT(#func)); extra }
 
582
#endif
 
583
 
 
584
enum EFileWrite
 
585
{
 
586
    FILEWRITE_NoFail            = 0x01,
 
587
    FILEWRITE_NoReplaceExisting = 0x02,
 
588
    FILEWRITE_EvenIfReadOnly    = 0x04,
 
589
    FILEWRITE_Unbuffered        = 0x08,
 
590
    FILEWRITE_Append                    = 0x10,
 
591
    FILEWRITE_AllowRead         = 0x20,
 
592
};
 
593
 
 
594
enum ECopyResult
 
595
{
 
596
    COPY_OK                                             = 0x00,
 
597
    COPY_MiscFail                               = 0x01,
 
598
    COPY_ReadFail                               = 0x02,
 
599
    COPY_WriteFail                              = 0x03,
 
600
    COPY_Canceled                               = 0x06,
 
601
};
 
602
 
 
603
enum INL_STATUS
 
604
{
 
605
    INL_OK,
 
606
    INL_ERROR,
 
607
    INL_FILENOTFOUND,
 
608
    INL_COPYFILE_ERROR,
 
609
    INL_DELETEFILE_ERROR,
 
610
};
 
611
 
 
612
NAMESPACE_END
 
613
 
 
614
 
 
615
#include "NMacros.h"
 
616
#include "NMemory.h"
 
617
 
 
618
#include "Character/NUni.h"
 
619
#if defined(INL_OS_WINDOWS)
 
620
    #include "Character/NUnicode.h"
 
621
#elif defined(INL_OS_LINUX)
 
622
    #include "Character/NUnicode.h"
 
623
#elif INL_PS3
 
624
    #include "Character/NUnicodePS3.h"
 
625
#endif
 
626
 
 
627
#include "NTemplate.h"
 
628
 
 
629
#include "NArray.h"
 
630
 
 
631
#include "NString.h"
 
632
 
 
633
#if defined(INL_OS_WINDOWS)
 
634
    #include "NThread.h"
 
635
#elif defined(INL_OS_LINUX)
 
636
    #include "NThreadGNU.h"
 
637
#elif INL_PS3
 
638
    #include "NThreadPS3.h"
 
639
#endif
 
640
 
 
641
#include "Memory/NMemoryAllocatorInterface.h"
 
642
#include "Memory/NDefaultMemoryAllocator.h"
 
643
#include "Memory/NMemoryHook.h"
 
644
#include "Memory/NMemoryAllocator.h"
 
645
 
 
646
 
 
647
#include "NUniqueIndex.h"
 
648
#include "SmartPtr/NRefCount.h"
 
649
#include "SmartPtr/NSmartPtr.h"
 
650
 
 
651
//#include "NGlobalInitializer.h"
 
652
 
 
653
#ifdef INL_OS_WINDOWS
 
654
    #include "Win32Dialogs/NWin32MessageBox.h"
 
655
#endif
 
656
 
 
657
#include "Character/NTChar.h"
 
658
 
 
659
#include "NTime.h"
 
660
#include "NCPU.h"
 
661
#include "NPlatform.h"
 
662
#include "FileManager/NSerializer.h"
 
663
#include "NProcess.h"
 
664
 
 
665
#include "NOutputDevice.h"
 
666
#include "FileManager/NFileManagerGeneric.h"
 
667
 
 
668
#ifdef INL_OS_WINDOWS
 
669
    #include "FileManager/NFileManagerStandardAnsi.h"
 
670
    #include "FileManager/NFileManagerWindows.h"
 
671
#elif defined INL_OS_LINUX
 
672
    #include "FileManager/NFileManagerGNU.h"
 
673
#elif defined INL_PS3
 
674
    #include "FileManager/NFileManagerPS3.h"
 
675
#endif
 
676
 
 
677
#include "NFile.h"
 
678
#include "NObjectType.h"
 
679
#include "NFileName.h"
 
680
#include "Color.h"
 
681
 
 
682
#ifdef INL_OS_WINDOWS
 
683
    #include "Win32Dialogs/NWin32CustomDialog.h"
 
684
#endif
 
685
 
 
686
#include "NPrintf.h"
 
687
 
 
688
#ifdef INL_OS_WINDOWS
 
689
    #include "Win32Dialogs/NWin32Clipboard.h"
 
690
#endif
 
691
//#include "NSocket.h"
 
692
 
 
693
#include "NGlobalInitializer.h"
 
694
 
 
695
#endif // KERNEL_H