Back to index

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