nux-1.14.0
NuxCore.h
00001 /*
00002  * Copyright 2010 Inalogic® Inc.
00003  *
00004  * This program is free software: you can redistribute it and/or modify it
00005  * under the terms of the GNU Lesser General Public License, as
00006  * published by the  Free Software Foundation; either version 2.1 or 3.0
00007  * of the License.
00008  *
00009  * This program is distributed in the hope that it will be useful, but
00010  * WITHOUT ANY WARRANTY; without even the implied warranties of
00011  * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
00012  * PURPOSE.  See the applicable version of the GNU Lesser General Public
00013  * License for more details.
00014  *
00015  * You should have received a copy of both the GNU Lesser General Public
00016  * License along with this program. If not, see <http://www.gnu.org/licenses/>
00017  *
00018  * Authored by: Jay Taoko <jaytaoko@inalogic.com>
00019  *
00020  */
00021 
00022 #ifndef NUXCORE_H
00023 #define NUXCORE_H
00024 
00025 
00026 #include "System.h"
00027 
00028 #include <cassert>  // (assert.h)
00029 #include <cctype>   // (ctype.h)
00030 #include <cerrno>   // (errno.h)
00031 #include <cfloat>   // (float.h)
00032 #include <ciso646>  // (iso646.h)
00033 #include <climits>  // (limits.h)
00034 #include <clocale>  // (locale.h)
00035 #include <cmath>    // (math.h)
00036 //#include <csetjmp>  // (setjmp.h) conflict with libpng on GNU systems
00037 //#include <csignal>  // (signal.h)
00038 #include <cstdarg>  // (stdarg.h)
00039 #include <cstddef>  // (stddef.h)
00040 #include <cstdio>   // (stdio.h)
00041 #include <cstdlib>  // (stdlib.h)
00042 #include <cstring>  // (string.h)
00043 #include <ctime>    // (time.h)
00044 #include <cwchar>   // (wchar.h)
00045 #include <cwctype>  // (wctype.h)
00046 #include <exception>
00047 #include <stdexcept>
00048 
00049 #include <iostream>
00050 #include <stdexcept>
00051 #include <iostream>
00052 #include <fstream>
00053 #include <sstream>
00054 #include <stdexcept>
00055 #include <string>
00056 #include <iomanip>
00057 #include <map>
00058 #include <vector>
00059 #include <list>
00060 #include <stack>
00061 #include <queue>
00062 #include <algorithm>
00063 #include <new>
00064 #include <set>
00065 
00066 #include "SystemTypes.h"
00067 
00068 
00069 // WIN32_SECURE if define for the latest version of Visual Studio starting at VS 2005. We use it for security improvement.
00070 #if (defined NUX_VISUAL_STUDIO_2005) || (defined NUX_VISUAL_STUDIO_2008)
00071 #define WIN32_SECURE
00072 #endif
00073 
00074 #define NUX_STATIC_CAST(a, b)       static_cast<a>(b)
00075 #define NUX_REINTERPRET_CAST(a, b)  reinterpret_cast<a>(b)
00076 #define NUX_CONST_CAST(a, b)        const_cast<a>(b)
00077 #define NUX_DYNAMIC_CAST(a, b)      dynamic_cast<a>(b)
00078 
00079 #define NUX_INVALID_INDEX           -1
00080 #define NUX_INVALID_HANDLE          -1
00081 
00082 #define NUX_IN
00083 #define NUX_OUT
00084 
00085 #define NUX_MAKEFOURCHARTAG(ch0, ch1, ch2, ch3)  \
00086     ((DWORD)(BYTE)(ch0) |               \
00087     ((DWORD)(BYTE)(ch1) << 8) |         \
00088     ((DWORD)(BYTE)(ch2) << 16) |        \
00089     ((DWORD)(BYTE)(ch3) << 24 ))
00090 
00091 
00092 #define INLNEW new
00093 #define INLDELETE delete
00094 #define INLDELETEARRAY delete []
00095 
00096 #define NUX_RUNTIME_ERROR(str, ...)               LogOutputErrorMessage(__FILE__, __LINE__, str, ##__VA_ARGS__);
00097 #define NUX_ERROR_IF_NULL(test, str, ...)         if((test) == 0)   LogOutputErrorMessage(__FILE__, __LINE__, str, ##__VA_ARGS__);
00098 #define NUX_ERROR_IF_TRUE(test, str, ...)         if(test)        LogOutputErrorMessage(__FILE__, __LINE__, str, ##__VA_ARGS__);
00099 #define NUX_ERROR_IF_FALSE(test, str, ...)        if(!(test))     LogOutputErrorMessage(__FILE__, __LINE__, str, ##__VA_ARGS__);
00100 
00101 #define NUX_RETURN_IF_NULL(test)                  if((test) == 0) return;
00102 #define NUX_RETURN_IF_NOTNULL(test)               if((test) != 0) return;
00103 #define NUX_RETURN_IF_TRUE(test)                  if(test)        return;
00104 #define NUX_RETURN_IF_FALSE(test)                 if(!(test))     return;
00105 #define NUX_RETURN_IF_FAIL(test)                  if(!(test))     return;
00106 
00107 #define NUX_RETURN_VALUE_IF_NULL(test, value)     if((test) == 0) return value;
00108 #define NUX_RETURN_VALUE_IF_NOTNULL(test, value)  if((test) != 0) return value;
00109 #define NUX_RETURN_VALUE_IF_TRUE(test, value)     if(test)        return value;
00110 #define NUX_RETURN_VALUE_IF_FALSE(test, value)    if(!(test))     return value;
00111 
00112 
00113 // Structure Alignment
00114 #if defined(NUX_MICROSOFT_COMPILER)
00115 #define NUX_DATA_ALIGN(declaration, alignment) __declspec(align(alignment)) declaration
00116 #elif defined (NUX_GNUCPP_COMPILER)
00117 #define NUX_DATA_ALIGN(declaration, alignment) declaration __attribute__ ((aligned (alignment)))
00118 #endif
00119 
00120 // Sizeof is a compile time function. So array must be totally defined if sizeof is used on it.
00121 // The number of elements in array must be a constant at compile time.
00122 // Example: int array[10] is valid.
00123 #define NUX_ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
00124 
00125 // Compiler specific include.
00126 #if defined(NUX_OS_WINDOWS) && defined (NUX_MICROSOFT_COMPILER)
00127     #include "SystemWindows.h"
00128 #elif defined (NUX_OS_LINUX) && defined (NUX_GNUCPP_COMPILER)
00129     #include "SystemGNU.h"
00130 #elif defined (NUX_OS_MACOSX) && defined (NUX_GNUCPP_COMPILER)
00131     #error Unknown Compiler
00132 #else
00133     #error Unknown Compiler
00134 #endif
00135 
00136 
00137 namespace nux
00138 {
00139 
00140 // Variable arguments.
00141   t_u32 GetVariableArgs (TCHAR *Dest, t_u32 Size, t_u32 Count, const TCHAR*& Fmt, va_list ArgPtr);
00142   t_u32 GetVariableArgsAnsi (ANSICHAR *Dest, t_u32 Size, t_u32 Count, const ANSICHAR*& Fmt, va_list ArgPtr);
00143 
00144 
00145 #define GET_VARARGS(msg, size, len, fmt)            \
00146 {                                                   \
00147     va_list arg_list;                               \
00148     va_start(arg_list,fmt);                         \
00149     VSNTPRINTF_S( msg, size, len, fmt, arg_list );  \
00150     va_end( arg_list );                             \
00151 }
00152 #define GET_VARARGS_ANSI(msg, size, len, fmt)       \
00153 {                                                   \
00154     va_list arg_list;                               \
00155     va_start(arg_list,fmt);                         \
00156     VSNPRINTF_S( msg, size, len, fmt, arg_list );   \
00157     va_end( arg_list );                             \
00158 }
00159 #define GET_VARARGS_RESULT(msg, size, len, fmt, result)         \
00160 {                                                               \
00161     va_list arg_list;                                           \
00162     va_start(arg_list, fmt);                                    \
00163     result = GetVariableArgs(msg, size, len, fmt, arg_list);    \
00164     va_end(arg_list);                                           \
00165 }
00166 
00168 //      Check macros for assertions.                                        //
00170   typedef enum
00171   {
00172     NUX_MSG_SEVERITY_CRITICAL   = 0,
00173     NUX_MSG_SEVERITY_ALERT      = 1,
00174     NUX_MSG_SEVERITY_WARNING    = 2,
00175     NUX_MSG_SEVERITY_INFO       = 3,
00176     NUX_MSG_SEVERITY_NONE       = 4,
00177 
00178   } MessageSeverity;
00179 
00180 #define nuxWarningMsg(str, ...)   { nux::LogOutputSeverityMessage(nux::NUX_MSG_SEVERITY_WARNING, str, ##__VA_ARGS__);}
00181 #define nuxAlertMsg(str, ...)     { nux::LogOutputSeverityMessage(nux::NUX_MSG_SEVERITY_ALERT, str, ##__VA_ARGS__);}
00182 #define nuxCriticalMsg(str, ...)  { nux::LogOutputSeverityMessage(nux::NUX_MSG_SEVERITY_CRITICAL, str, ##__VA_ARGS__);}
00183 
00184 #ifdef NUX_ENABLE_ASSERT_MACROS
00185 #define nuxAssert(expr)             { if(!(expr)) nuxFailAssert(TEXT(#expr)); }
00186   // Expression is always evaluated no matter if NUX_ENABLE_ASSERT_MACROS is enabled. nuxFailAssert is called if enabled.
00187 #define nuxVerifyExpr(expr)         { if(!(expr)) nuxFailAssert(TEXT(#expr)); }
00188 
00189 #define DEBUGTRACE(str, ...)    nuxDebugMsg(str, ##__VA_ARGS__)
00190 
00191 #ifdef NUX_VARIADIC_MACROS_SUPPORT
00192 #define nuxFailAssert(str, ...)         { if(nuxIsDebuggerPresent()){nux::LogOutputAssertMessage(__FILE__, __LINE__, str, ##__VA_ARGS__);} inlDebugBreak();}
00193 #define nuxError(str, ...)              { if(nuxIsDebuggerPresent()){nux::LogOutputErrorMessage(__FILE__, __LINE__, str, ##__VA_ARGS__);} inlDebugBreak();}
00194 #define nuxDebugMsg(str, ...)           { if(nuxIsDebuggerPresent()) nux::LogOutputDebugMessage(str, ##__VA_ARGS__);}
00195 
00196 #define nuxAssertMsg(expr, a, ...)      { if(!(expr)) nuxFailAssert( TEXT(#expr) TEXT(" : ") a, ##__VA_ARGS__); }
00197 #define nuxVerifyExprMsg(expr, a, ...)  { if(!(expr)) nuxFailAssert( TEXT(#expr) TEXT(" : ") a, ##__VA_ARGS__); }   // Expression is always evaluated. nuxFailAssert is called if enabled.
00198 #else
00199 #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();}
00200 #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();}
00201 #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); } }
00202 #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.
00203 #define nuxDebugMsg(a,b,c,d,e,f,g,h,i,j,k,l)            { if(nuxIsDebuggerPresent() && LogOutputRedirector::Ready()) GLogDevice.LogFunction(a,b,c,d,e,f,g,h,i,j,k,l); }
00204 #endif
00205 
00206   // Break if codepaths should never be reached.
00207 #define nuxAssertNoEntry()           { nuxFailAssert( TEXT("This section of code should not be executed.") ); }
00208   // Break if codepaths should not be executed more than once.
00209 #define nuxAssertNoReEntry() \
00210     { \
00211         static bool s_inlRuntimeHasBeenHere##__LINE__ = false; \
00212         nuxAssertMsg( !s_inlRuntimeHasBeenHere##__LINE__, TEXT("This section of code has already been called.") ); \
00213         s_inlRuntimeHasBeenHere##__LINE__ = true; \
00214     }
00215 
00216   class NRecursionScopeCounter
00217   {
00218   public:
00219     NRecursionScopeCounter (WORD &InCounter) : Counter ( InCounter )
00220     {
00221       ++Counter;
00222     }
00223     ~NRecursionScopeCounter()
00224     {
00225       --Counter;
00226     }
00227   private:
00228     WORD &Counter;
00229   };
00230 
00231   // Break if codepaths should never be called recursively.
00232 #define nuxAssertNoRecursion()  \
00233         static WORD RecursionCounter##__LINE__ = 0; \
00234         nuxAssertMsg( RecursionCounter##__LINE__ == 0, TEXT("This section of code was entered recursively.") ); \
00235         const NRecursionScopeCounter ScopeMarker##__LINE__( RecursionCounter##__LINE__ )
00236 
00237   // Compile time assertion. Break if the assertion fails.
00238   // @param expr  Must be evaluated at compile time.
00239 #define nuxAssertAtCompileTime(expr)  typedef BYTE CompileTimeCheckType##__LINE__[(expr) ? 1 : -1]
00240 #else
00241 #ifdef NUX_MICROSOFT_COMPILER
00242 #define nuxAssert(expr)                     NUX_NOOP
00243 #define nuxVerifyExpr(expr)                 { if(!(expr)) {} }
00244 #define nuxDebugMsg(a, ...)                 NUX_NOOP
00245 #ifdef NUX_VARIADIC_MACROS_SUPPORT
00246 #define nuxAssertMsg(expr, a, ...)      NUX_NOOP
00247 #define nuxVerifyExprMsg(expr, a, ...)  { if(!(expr)) {} }
00248 #define nuxError(a, ...)                NUX_NOOP
00249 #else
00250 #define nuxAssertMsg(expr,a,b,c,d,e,f,g,h,i,j,k,l)      NUX_NOOP
00251 #define nuxVerifyExprMsg(expr,a,b,c,d,e,f,g,h,i,j,k,l)  { if(!(expr)) {} }
00252 #define nuxError(a,b,c,d,e,f,g,h,i,j,k,l)               NUX_NOOP
00253 #endif
00254 #define nuxAssertNoEntry()              NUX_NOOP
00255 #define nuxAssertNoReentry()            NUX_NOOP
00256 #define nuxAssertNoRecursion()          NUX_NOOP
00257 #define nuxAssertAtCompileTime(expr)    NUX_NOOP
00258 #else
00259 #define nuxDebugMsg(a, ...)
00260 #define nuxError(a, ...)                {}
00261 #define nuxAssert(expr)                 {}
00262 #define nuxVerifyExpr(expr)             { if(!(expr)) {} }
00263 #define nuxAssertMsg(expr,msg, ...)     {}
00264 #define nuxVerifyExprMsg(expr, a, ...)  { if(!(expr)) {} }
00265 #define nuxAssertNoEntry()              {}
00266 #define nuxAssertNoReentry()            {}
00267 #define nuxAssertNoRecursion()          {}
00268 #define nuxAssertAtCompileTime(expr)    {}
00269 #endif
00270 #endif
00271 
00273 // String conversion classes                                            //
00275 
00276 #ifndef _UNICODE
00277 #define CALL_OS_TCHAR_FUNCTION(funcW,funcA) funcA
00278 #define TCHAR_TO_ANSI(str) str
00279 #define ANSI_TO_TCHAR(str) (const TCHAR*)((const ANSICHAR*)str)
00280 
00281 #define UTF8ToTCHAR(str) str
00282 #define TCHARToUTF8(str) str
00283 #define UTF16ToTCHAR(str) (const char*)NUTF8(str)
00284 #define TCHARToUTF16(str) (const wchar_t*)NUTF16(str)
00285 #else
00286 #define CALL_OS_TCHAR_FUNCTION(funcW,funcA) funcW
00287 
00297 #define TCHAR_TO_ANSI(str)  (ANSICHAR*)typedef NCharacterConversion<ANSICHAR, TCHAR, TCharToAnsiConvertion>((const TCHAR*)str)
00298 #define ANSI_TO_TCHAR(str)  (TCHAR*)NCharacterConversion<TCHAR, ANSICHAR, AnsiToTCharConversion>((const ANSICHAR*)str)
00299 
00300 #define UTF8ToTCHAR(str) (const wchar_t*)NUTF16(str)
00301 #define TCHARToUTF8(str) (const char*)NUTF8(str)
00302 #define UTF16ToTCHAR(str) str
00303 #define TCHARToUTF16(str) str
00304 #endif
00305 
00306 #define inlUTF16ToUTF8(s) (const char*)nux::NUTF8(s)
00307 #define inlUTF8ToUTF16(s) (const wchar_t*)nux::NUTF16(s)
00308 
00309 #define ANSICHAR_TO_UNICHAR(str)  (UNICHAR*)  nux::NCharacterConversion <UNICHAR,   ANSICHAR, nux::AnsicharToUnicharConvertion>((const ANSICHAR*)str)
00310 #define UNICHAR_TO_ANSICHAR(str)  (ANSICHAR*) nux::NCharacterConversion <ANSICHAR,  UNICHAR,  nux::UnicharToAnsicharConvertion>((const UNICHAR*)str)
00311 #define ANSICHAR_TO_TCHAR(str)    (UNICHAR*)  nux::NCharacterConversion <TCHAR,     ANSICHAR, nux::AnsiToTCharConversion>((const ANSICHAR*)str)
00312 #define TCHAR_TO_ANSICHAR(str)    (ANSICHAR*) nux::NCharacterConversion <ANSICHAR,  TCHAR,    nux::TCharToAnsiConvertion>((const TCHAR*)str)
00313 #define TCHAR_TO_UNICHAR(str)     (UNICHAR*)  nux::NCharacterConversion <UNICHAR,   TCHAR,    nux::TCharToUnicharConvertion>((const TCHAR*)str)
00314 
00315 #define NUX_WIN32_LINE_TERMINATOR   TEXT("\r\n")
00316 #define NUX_UNIX_LINE_TERMINATOR    TEXT("\n")
00317 #define NUX_MACOSX_LINE_TERMINATOR  TEXT("\n")
00318 
00319 #if defined(NUX_OS_WINDOWS)
00320     #define NUX_LINE_TERMINATOR NUX_WIN32_LINE_TERMINATOR
00321 #elif defined(NUX_OS_LINUX) || defined(NUX_OS_MACOSX)
00322     #define NUX_LINE_TERMINATOR NUX_UNIX_LINE_TERMINATOR
00323 #endif
00324 
00325 
00326 #if defined(NUX_OS_WINDOWS)
00327     #define NUX_PATH_SEPARATOR_STRING   NUX_BACKSLASH_STRING
00328     #define NUX_PATH_SEPARATOR_CHAR     NUX_BACKSLASH_CHAR
00329 #elif defined(NUX_OS_LINUX) || defined(NUX_OS_MACOSX)
00330     #define NUX_PATH_SEPARATOR_STRING   NUX_SLASH_STRING
00331     #define NUX_PATH_SEPARATOR_CHAR     NUX_SLASH_CHAR
00332 #endif
00333 
00334 #define NUX_BACKSLASH_CHAR      TEXT('\\')
00335 #define NUX_BACKSLASH_STRING    TEXT("\\")
00336 #define NUX_SLASH_CHAR          TEXT('/')
00337 #define NUX_SLASH_STRING        TEXT("/")
00338 
00339 #define NUX_MAX_FILEPATH_SIZE   1024
00340 
00341 
00342 
00343 #if (defined _WIN32) && (defined WIN32_SECURE)
00344 #define WCSNCPY_S(strDest, numberOfElements, strSource, count)  wcsncpy_s (strDest, numberOfElements, strSource, count)
00345 #define STRNCPY_S(strDest, numberOfElements, strSource, count)  _tcsncpy_s(strDest, numberOfElements, strSource, count)
00346 #define STRCPY_S(strDest, numberOfElements, strSource)          _tcscpy_s(strDest, numberOfElements, strSource)
00347 #define STRCAT_S(strDest, numberOfElements, strSource)          _tcscat_s(strDest, numberOfElements, strSource)
00348 
00349 #define VSNPRINTF_S(strDest, numberOfElements, Count, format, VA_Arg_List)  vsnprintf_s(strDest, numberOfElements, Count, format, VA_Arg_List)
00350 #define VSNTPRINTF_S(strDest, numberOfElements, Count, format, VA_Arg_List) _vsntprintf_s(strDest, numberOfElements, Count, format, VA_Arg_List)
00351 #define SPRINTF_S(strDest, numberOfElements, format, ...)                   _stprintf_s(strDest, numberOfElements, format, ##__VA_ARGS__)
00352 #define SNPRINTF_S(strDest, numberOfElements, Count, format, ...)           _sntprintf_s(strDest, numberOfElements, Count, format, ##__VA_ARGS__)
00353 
00354 #define STRDATE_S(strDest, numberOfElements) _tstrdate_s(strDest, numberOfElements)
00355 #define STRTIME_S(strDest, numberOfElements)       _tstrtime_s(strDest, numberOfElements)
00356 
00357 #define FOPEN_S(file, filename, mode)           _tfopen_s(file, filename, mode)
00358 
00359 #define STRLEN_S(str, numberOfElements)         _tcsnlen(str, numberOfElements)
00360 
00361 #define SPLITPATH_S(path, Drive, DriveNumElements, Dir, DirNumElements, Filename, FileNumElements, Extension, ExtNumElements) _tsplitpath_s(path, Drive, DriveNumElements, Dir, DirNumElements, Filename, FileNumElements, Extension, ExtNumElements)
00362 #define MAKEPATH_S(path, numberOfElements, Drive, Dir, Filename, Extension) _tmakepath_s(path, numberOfElements, Drive, Dir, Filename, Extension)
00363 
00364 #define SSCANF_S(buffer, format, ...)           _stscanf_s(buffer, format, ##__VA_ARGS__)
00365 #define SNSCANF_S(input, length, format, ...)   _sntscanf_s(input, length, format, ##__VA_ARGS__)
00366 #else
00367 #define WCSNCPY_S(strDest, numberOfElements, strSource, count)  wcsncpy (strDest, strSource, count)
00368 #define STRNCPY_S(strDest, numberOfElements, strSource, count)  _tcsncpy(strDest, strSource, count)
00369 #define STRCPY_S(strDest, numberOfElements, strSource)          _tcscpy(strDest, strSource)
00370 #define STRCAT_S(strDest, numberOfElements, strSource)          _tcscat(strDest, strSource)
00371 
00372 #define VSNPRINTF_S(strDest, numberOfElements, Count, format, VA_Arg_List)              vsnprintf(strDest, Count, format, VA_Arg_List)
00373 #define VSNTPRINTF_S(strDest, numberOfElements, Count, format, VA_Arg_List)             _vsntprintf(strDest, Count, format, VA_Arg_List)
00374 #define SPRINTF_S(strDest, numberOfElements, format, ...)                               _stprintf(strDest, format, ##__VA_ARGS__)
00375 #define SNPRINTF_S(strDest, numberOfElements, Count, format, ...)                       _sntprintf(strDest, Count, format, ##__VA_ARGS__)
00376 
00377 #define STRDATE_S(strDest, numberOfElements)        _tstrdate(strDest)
00378 #define STRTIME_S(strDest, numberOfElements)        _tstrtime(strDest)
00379 
00380 #define FOPEN_S(file, filename, mode)               (file = _tfopen(filename, mode))
00381 
00382 #define STRLEN_S(str, numberOfElements)             _tcslen(str)
00383 
00384 #define SPLITPATH_S(path, Drive, DriveNumElements, Dir, DirNumElements, Filename, FileNumElements, Extension, ExtNumElements) _tsplitpath(path, Drive, Dir, Filename, Extension)
00385 #define MAKEPATH_S(path, numberOfElements, Drive, Dir, Filename, Extension) _makepath(path, Drive, Dir, Filename, Extension)
00386 
00387 #define SSCANF_S(buffer, format, ...)           _stscanf(buffer, format, ##__VA_ARGS__)
00388 #define SNSCANF_S(input, length, format, ...)   _sntscanf(input, length, format, ##__VA_ARGS__)
00389 #endif
00390 
00392   extern const t_bool GNoDialog;         // Set to true to disable the popping of dialog box. The message will go to the log.
00393 
00394 #ifdef NUX_VISUAL_STUDIO_2003
00395   //Visual Studio C++ 2003 doesn't support it, but there is a workaround:
00396 #pragma warning(disable: 4002)          // Warning: too many actual parameters for macro 'ident'
00397 #pragma warning(disable: 4003)          // Warning: not enough actual parameters for macro 'ident'
00398   template <typename T>
00399   inline const T                &VARG ( const T &t )
00400   {
00401     return t;
00402   }
00403   inline const TCHAR    *VARG( )
00404   {
00405     return TEXT ("");
00406   }
00407 #endif
00408 
00409 #ifdef _UNICODE
00410 #define tstring std::wstring
00411 #define tostream std::wostream
00412 #define tistream std::wistream
00413 #define tiostream std::wiostream
00414 #define tofstream std::wofstream
00415 #define tfstream std::wfstream
00416 #else
00417 #define tstring std::string
00418 #define tostream std::ostream
00419 #define tistream std::istream
00420 #define tiostream std::iostream
00421 #define tofstream std::ofstream
00422 #define tfstream std::fstream
00423 #endif
00424 
00425 // // UTF-16 is the primary encoding mechanism used by Microsoft Windows 2000, Windows 2000 Server, Windows XP and Windows 2003 Server.
00426 // // Unicode Byte Order Mark (BOM)
00427 // enum {UNICODE_UTF32_BE   = 0x0000FEFF };
00428 // enum {UNICODE_UTF32_LE   = 0xFFFE0000 };
00429 // enum {UNICODE_UTF16_BE   = 0xFEFF };
00430 // enum {UNICODE_UTF16_LE   = 0xFFFE };
00431 // enum {UNICODE_UTF8       = 0xEFBBBF };
00432 
00433   const BYTE NUX_UTF32_BE[]   = {0x04 /*size*/, 0x00, 0x00, 0xFE, 0xFF };
00434   const BYTE NUX_UTF32_LE[]   = {0x04 /*size*/, 0xFF, 0xFE, 0x00, 0x00 };
00435   const BYTE NUX_UTF16_BE[]   = {0x02 /*size*/, 0xFE, 0xFF };
00436   const BYTE NUX_UTF16_LE[]   = {0x02 /*size*/, 0xFF, 0xFE };
00437   const BYTE NUX_UTF8[]       = {0x03 /*size*/, 0xEF, 0xBB, 0xBF };
00438 
00439 // enum {UNICODE_BOM   = 0xfeff     };
00440 
00441 
00442   class LogOutputDevice;
00443   class NFileManager;
00444 
00445 
00446 #define GNullDevice         NUX_GLOBAL_OBJECT_INSTANCE(nux::NullOutput)
00447 #define GLogDevice          NUX_GLOBAL_OBJECT_INSTANCE(nux::LogOutputRedirector)
00448 
00449 #if (defined NUX_OS_WINDOWS)
00450     #define GFileManager    NUX_GLOBAL_OBJECT_INSTANCE(nux::NFileManagerWindows)
00451 #elif (defined NUX_OS_LINUX)
00452     #define GFileManager    NUX_GLOBAL_OBJECT_INSTANCE(nux::NFileManagerGNU)
00453 #endif
00454 
00455 // Define architecture specific asm statements for hardware breakpoint
00456 #if defined(NUX_GNUC_COMPILER)
00457     #if (defined __i386__) || (defined __x86_64__)
00458         #define ARCH_HARDWARE_BREAK std::abort ()
00459     #elif defined (__arm__) || (defined __ppc__)
00460         #define ARCH_HARDWARE_BREAK do {} while(0)
00461     #else
00462         #define ARCH_HARDWARE_BREAK do {} while(0)
00463     #endif
00464 #endif
00465 
00466 
00467 // Breaks into the debugger.  Forces a GPF in non-debug builds.
00468 #if (defined NUX_DEBUG) && (defined NUX_MICROSOFT_COMPILER)
00469     #define nuxIsDebuggerPresent()  IsDebuggerPresent()
00470     #define inlDebugBreak()         ( IsDebuggerPresent() ? (DebugBreak(),1) : 1 )
00471 #elif (defined _WIN32)
00472     #define nuxIsDebuggerPresent()  IsDebuggerPresent()
00473     #define inlDebugBreak()         std::abort ()
00474 #elif (defined NUX_DEBUG) && (defined NUX_GNUCPP_COMPILER)
00475     #define nuxIsDebuggerPresent()  1
00476     #define inlDebugBreak()         ARCH_HARDWARE_BREAK
00477 #else
00478     #define nuxIsDebuggerPresent()  0
00479     #define inlDebugBreak()
00480 #endif
00481 
00482 #if defined(NUX_MICROSOFT_COMPILER)
00483     #define NUX_HARDWARE_BREAK      {__debugbreak();}
00484     #define NUX_BREAK_ASM_INT3      {__debugbreak();}
00485 #elif defined(NUX_GNUC_COMPILER)
00486     #define NUX_HARDWARE_BREAK     ARCH_HARDWARE_BREAK
00487     #define NUX_BREAK_ASM_INT3     ARCH_HARDWARE_BREAK
00488 #else
00489     #define NUX_HARDWARE_BREAK
00490     #define NUX_BREAK_ASM_INT3
00491 #endif
00492 
00493 
00495 //      Variadic function prototypes.
00497 
00498 #define VARARG_EXTRA(A) A,
00499 #define VARARG_NONE
00500 #define VARARG_PURE =0
00501 
00502 #if _MSC_VER
00503 
00504   static inline DWORD         VAType (DWORD dw)
00505   {
00506     return dw;
00507   }
00508   static inline t_byte        VAType (t_byte b)
00509   {
00510     return b;
00511   }
00512   static inline t_u32        VAType (t_u32 ui)
00513   {
00514     return ui;
00515   }
00516   static inline t_int         VAType (t_s32 i)
00517   {
00518     return i;
00519   }
00520   static inline t_u64         VAType (t_u64 qw)
00521   {
00522     return qw;  // possible conflict with t_size when compiling in 64 bits
00523   }
00524   static inline t_s64         VAType (t_s64 sqw)
00525   {
00526     return sqw;
00527   }
00528   static inline double        VAType (double d)
00529   {
00530     return d;
00531   }
00532   static inline TCHAR         VAType (TCHAR c)
00533   {
00534     return c;
00535   }
00536   static inline ANSICHAR     *VAType (ANSICHAR *s)
00537   {
00538     return s;
00539   }
00540   static inline UNICHAR      *VAType (UNICHAR *s)
00541   {
00542     return s;
00543   }
00544   template<class T> T        *VAType (T *p)
00545   {
00546     return p;
00547   }
00548   template<class T> const T  *VAType (const T *p)
00549   {
00550     return p;
00551   }
00552 
00553   //  Declaration of prototypes with lots of arguments
00554   //  If(the function return nothing)
00555   //  {
00556   //      Return = {}
00557   //      StaticFuncRet = void
00558   //  }
00559   //  else
00560   //  {
00561   //      Return = return
00562   //      StaticFuncRet = type0
00563   //      FuncRet = type1
00564   //  }
00565   //
00566   //  If this is a pure virtual function then PURE is equal to: ==0
00567   //  ExtraParamDecl is declaration for additional parameters: VARARG_EXTRA(TCHAR* Dest) VARARG_EXTRA(INT Size) VARARG_EXTRA(INT Count)
00568   //  ExtraParam is the parameters presented in ExtraParamDecl: VARARG_EXTRA(Dest) VARARG_EXTRA(Size) VARARG_EXTRA(Count)
00569 #define VARARG_DECL( FuncRet, StaticFuncRet, Return, FuncName, Pure, FmtType, ExtraParamDecl, ExtraParam )      \
00570     FuncRet FuncName##__VA(ExtraParamDecl FmtType Fmt, ... ) Pure;  \
00571     StaticFuncRet FuncName(ExtraParamDecl FmtType Fmt) {Return FuncName##__VA(ExtraParam (Fmt));} \
00572     template<class T1> \
00573     StaticFuncRet FuncName(ExtraParamDecl FmtType Fmt,T1 V1) {T1 v1=VAType(V1);Return FuncName##__VA(ExtraParam (Fmt),(v1));} \
00574     template<class T1,class T2> \
00575     StaticFuncRet FuncName(ExtraParamDecl FmtType Fmt,T1 V1,T2 V2) {T1 v1=VAType(V1);T2 v2=VAType(V2);Return FuncName##__VA(ExtraParam (Fmt),(v1),(v2));} \
00576     template<class T1,class T2,class T3> \
00577     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));} \
00578     template<class T1,class T2,class T3,class T4> \
00579     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));} \
00580     template<class T1,class T2,class T3,class T4,class T5> \
00581     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));} \
00582     template<class T1,class T2,class T3,class T4,class T5,class T6> \
00583     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));} \
00584     template<class T1,class T2,class T3,class T4,class T5,class T6,class T7> \
00585     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));} \
00586     template<class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8> \
00587     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));} \
00588     template<class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9> \
00589     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));} \
00590     template<class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10> \
00591     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));} \
00592     template<class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11> \
00593     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));} \
00594     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> \
00595     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));} \
00596     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> \
00597     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));} \
00598     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> \
00599     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));} \
00600     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> \
00601     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));} \
00602     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> \
00603     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));} \
00604     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> \
00605     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));} \
00606     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> \
00607     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));} \
00608     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> \
00609     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));}
00610 
00611 #define VARARG_BODY( FuncRet, FuncName, FmtType, ExtraParamDecl )               \
00612     FuncRet FuncName##__VA( ExtraParamDecl  FmtType Fmt, ... )
00613 
00614 #else  // !_MSC_VER
00615 
00616 #define VARARG_DECL( FuncRet, StaticFuncRet, Return, FuncName, Pure, FmtType, ExtraParamDecl, ExtraParam )      \
00617     FuncRet FuncName( ExtraParamDecl FmtType Fmt, ... ) Pure
00618 #define VARARG_BODY( FuncRet, FuncName, FmtType, ExtraParamDecl )               \
00619     FuncRet FuncName( ExtraParamDecl FmtType Fmt, ... )
00620 
00621 #endif // _MSC_VER
00622 
00623 
00625   void PrintOutputDebugString (const TCHAR *Format, ...);
00626 
00628   void LogOutputAssertMessage (const ANSICHAR *File, int Line, const TCHAR *Format = TEXT (""), ...);
00629 
00631   void LogOutputErrorMessage (const ANSICHAR *File, int Line, const TCHAR *Format = TEXT (""), ...);
00632 
00634   void LogOutputDebugMessage (const TCHAR *Format, ...);
00635 
00637   void LogOutputSeverityMessage (int Severity, const TCHAR *Format/*=TEXT("")*/, ...);
00638 
00639 // Returns true is the output redirector is ready
00640   bool OutputRedirectorReady();
00641 
00642 
00643   enum EFileWrite
00644   {
00645     FILEWRITE_NOFAIL            = 0x01,
00646     FILEWRITE_NOREPLACEEXISTING = 0x02,
00647     FILEWRITE_EVENIFREADONLY    = 0x04,
00648     FILEWRITE_UNBUFFERED        = 0x08,
00649     FILEWRITE_APPEND            = 0x10,
00650     FILEWRITE_ALLOWREAD         = 0x20,
00651   };
00652 
00653   enum ECopyResult
00654   {
00655     COPY_OK                     = 0x00,
00656     COPY_MISCFAIL               = 0x01,
00657     COPY_READFAIL               = 0x02,
00658     COPY_WRITEFAIL              = 0x03,
00659     COPY_CANCELED               = 0x06,
00660   };
00661 
00662   enum NUX_STATUS
00663   {
00664     NUX_OK,
00665     NUX_ERROR,
00666     NUX_FILENOTFOUND,
00667     NUX_COPYFILE_ERROR,
00668     NUX_DELETEFILE_ERROR,
00669   };
00670 
00671 }
00672 
00673 
00674 #include "Macros.h"
00675 #include "Memory.h"
00676 
00677 #include "Character/NUni.h"
00678 
00679 #if defined(NUX_OS_WINDOWS)
00680     #include "Character/NUnicode.h"
00681 #elif defined(NUX_OS_LINUX)
00682     #include "Character/NUnicode.h"
00683 #endif
00684 
00685 #include "Template.h"
00686 #include "NumberConversion.h"
00687 
00688 #include "TextString.h"
00689 
00690 #if defined(NUX_OS_WINDOWS)
00691     #include "ThreadWin.h"
00692 #elif defined(NUX_OS_LINUX)
00693     #include "ThreadGNU.h"
00694 #endif
00695 
00696 /*#include "Memory/NMemoryAllocatorInterface.h"
00697 #include "Memory/NDefaultMemoryAllocator.h"
00698 #include "Memory/NMemoryHook.h"
00699 #include "Memory/NMemoryAllocator.h"
00700 */
00701 
00702 #include "NUniqueIndex.h"
00703 
00704 //#include "GlobalInitializer.h"
00705 
00706 #ifdef NUX_OS_WINDOWS
00707 #include "Win32Dialogs/NWin32MessageBox.h"
00708 #endif
00709 
00710 #include "Character/NTChar.h"
00711 
00712 #include "TimeFunctions.h"
00713 #include "CPU.h"
00714 #include "Platform.h"
00715 #include "FileManager/NSerializer.h"
00716 #include "Process.h"
00717 
00718 #include "OutputDevice.h"
00719 #include "FileManager/NFileManagerGeneric.h"
00720 
00721 #ifdef NUX_OS_WINDOWS
00722     #include "FileManager/NFileManagerStandardAnsi.h"
00723     #include "FileManager/NFileManagerWindows.h"
00724 #elif defined NUX_OS_LINUX
00725     #include "FileManager/NFileManagerGNU.h"
00726 #endif
00727 
00728 #include "FileIO.h"
00729 #include "ObjectType.h"
00730 #include "FileName.h"
00731 #include "Color.h"
00732 #include "Colors.h"
00733 #include "Object.h"
00734 
00735 #ifdef NUX_OS_WINDOWS
00736   #include "Win32Dialogs/NWin32CustomDialog.h"
00737   #include "Win32Dialogs/NWin32Clipboard.h"
00738 #endif
00739 
00740 
00741 #include "GlobalInitializer.h"
00742 
00743 #endif // NUXCORE_H
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends