~hikiko/nux/arb-srgba-shader

« back to all changes in this revision

Viewing changes to NuxCore/NKernel.cpp

  • Committer: Neil Jagdish Patel
  • Date: 2010-09-02 03:28:11 UTC
  • Revision ID: neil.patel@canonical.com-20100902032811-i2m18tfb6pkasnvt
Remove Win EOL chars

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 */
21
21
 
22
22
 
23
 
#include "NKernel.h"
24
 
 
25
 
NAMESPACE_BEGIN
26
 
 
27
 
//  MessageBox resolves to:
28
 
//      MessageBoxA, if UNICODE is not defined
29
 
//      MessageBoxW, if UNICODE is defined
30
 
 
31
 
//  In all cases in the code, it is assumed that we have UNICODE and _UNICODE defined or not.
32
 
//  We have no support for cases of  (UNICODE, !_UNICODE) or (!UNICODE, _UNICODE)
33
 
//  TCHAR  resolves:
34
 
//      char, if _UNICODE is not defined
35
 
//      wchar_t, if _UNICODE is defined 
36
 
 
37
 
 
38
 
// Set to true to disable the popping of dialog box. The message will go to the log.
39
 
const t_bool GNoDialog          = false;
40
 
 
41
 
/*-----------------------------------------------------------------------------
42
 
Formatted printing and messages.
43
 
-----------------------------------------------------------------------------*/
44
 
 
45
 
t_u32 GetVariableArgs( TCHAR* Dest, t_u32 Size, t_u32 Count, const TCHAR*& Fmt, va_list ArgPtr )
46
 
{
47
 
    t_u32 Result = VSNTPRINTF_S(Dest, Size, Count, Fmt, ArgPtr);
48
 
    va_end(ArgPtr);
49
 
    return Result;
50
 
}
51
 
t_u32 GetVariableArgsAnsi( ANSICHAR* Dest, t_u32 Size, t_u32 Count, const ANSICHAR*& Fmt, va_list ArgPtr)
52
 
{
53
 
    t_u32 Result = VSNPRINTF_S(Dest, Size, Count, Fmt, ArgPtr);
54
 
    va_end(ArgPtr);
55
 
    return Result;
56
 
}
57
 
 
58
 
// Formats the text for inlOutputDebugString.
59
 
// This function can be used to print anything before the other output are initialized.
60
 
void inlOutputDebugString( const TCHAR *Format, ... )
61
 
{
62
 
    TCHAR TempStr[4096];
63
 
    GET_VARARGS( TempStr, 4096, INL_ARRAY_COUNT(TempStr) - 1, Format );
64
 
 
65
 
#ifdef _WIN32
66
 
    OutputDebugString( TempStr );
67
 
#else
68
 
    printf("%s\n", TCHAR_TO_ANSI(TempStr));
69
 
#endif
70
 
}
71
 
 
72
 
void LogOutputAssertMessage( const ANSICHAR* File, int Line, const TCHAR* Format/*=TEXT("")*/, ... )
73
 
{
74
 
    TCHAR TempStr[4096];
75
 
    GET_VARARGS( TempStr, INL_ARRAY_COUNT(TempStr), INL_ARRAY_COUNT(TempStr) - 1, Format );
76
 
    // Logged to a file... Put "\r\n" at the end of each line.
77
 
    if(NOutputDeviceRedirector::Ready())
78
 
        GLogDevice.LogFunction( TEXT("Assertion failed: %s\r\n    [File:%s]\r\n    [Line: %i]\r\n"), (const TCHAR*)TempStr, ANSI_TO_TCHAR(File), Line);
79
 
}
80
 
 
81
 
void LogOutputErrorMessage( const ANSICHAR* File, int Line, const TCHAR* Format/*=TEXT("")*/, ... )
82
 
{
83
 
    TCHAR TempStr[4096];
84
 
    GET_VARARGS( TempStr, INL_ARRAY_COUNT(TempStr), INL_ARRAY_COUNT(TempStr) - 1, Format );
85
 
    if(NOutputDeviceRedirector::Ready())
86
 
        GLogDevice.LogFunction( TEXT("Error: %s\r\n    [File:%s]\r\n    [Line: %d]\r\n"), (const TCHAR*)TempStr, ANSI_TO_TCHAR(File), Line);
87
 
}
88
 
 
89
 
void LogOutputDebugMessage(const TCHAR* Format/*=TEXT("")*/, ... )
90
 
{
91
 
    TCHAR TempStr[4096];
92
 
    GET_VARARGS( TempStr, INL_ARRAY_COUNT(TempStr), INL_ARRAY_COUNT(TempStr) - 1, Format );
93
 
    if(NOutputDeviceRedirector::Ready())
94
 
        GLogDevice.LogFunction(TempStr);
95
 
}
96
 
 
97
 
bool inlOutputRedirectorReady()
98
 
{
99
 
    return NOutputDeviceRedirector::Ready();
100
 
}
101
 
 
102
 
NAMESPACE_END
 
23
#include "NKernel.h"
 
24
 
 
25
NAMESPACE_BEGIN
 
26
 
 
27
//  MessageBox resolves to:
 
28
//      MessageBoxA, if UNICODE is not defined
 
29
//      MessageBoxW, if UNICODE is defined
 
30
 
 
31
//  In all cases in the code, it is assumed that we have UNICODE and _UNICODE defined or not.
 
32
//  We have no support for cases of  (UNICODE, !_UNICODE) or (!UNICODE, _UNICODE)
 
33
//  TCHAR  resolves:
 
34
//      char, if _UNICODE is not defined
 
35
//      wchar_t, if _UNICODE is defined 
 
36
 
 
37
 
 
38
// Set to true to disable the popping of dialog box. The message will go to the log.
 
39
const t_bool GNoDialog          = false;
 
40
 
 
41
/*-----------------------------------------------------------------------------
 
42
Formatted printing and messages.
 
43
-----------------------------------------------------------------------------*/
 
44
 
 
45
t_u32 GetVariableArgs( TCHAR* Dest, t_u32 Size, t_u32 Count, const TCHAR*& Fmt, va_list ArgPtr )
 
46
{
 
47
    t_u32 Result = VSNTPRINTF_S(Dest, Size, Count, Fmt, ArgPtr);
 
48
    va_end(ArgPtr);
 
49
    return Result;
 
50
}
 
51
t_u32 GetVariableArgsAnsi( ANSICHAR* Dest, t_u32 Size, t_u32 Count, const ANSICHAR*& Fmt, va_list ArgPtr)
 
52
{
 
53
    t_u32 Result = VSNPRINTF_S(Dest, Size, Count, Fmt, ArgPtr);
 
54
    va_end(ArgPtr);
 
55
    return Result;
 
56
}
 
57
 
 
58
// Formats the text for inlOutputDebugString.
 
59
// This function can be used to print anything before the other output are initialized.
 
60
void inlOutputDebugString( const TCHAR *Format, ... )
 
61
{
 
62
    TCHAR TempStr[4096];
 
63
    GET_VARARGS( TempStr, 4096, INL_ARRAY_COUNT(TempStr) - 1, Format );
 
64
 
 
65
#ifdef _WIN32
 
66
    OutputDebugString( TempStr );
 
67
#else
 
68
    printf("%s\n", TCHAR_TO_ANSI(TempStr));
 
69
#endif
 
70
}
 
71
 
 
72
void LogOutputAssertMessage( const ANSICHAR* File, int Line, const TCHAR* Format/*=TEXT("")*/, ... )
 
73
{
 
74
    TCHAR TempStr[4096];
 
75
    GET_VARARGS( TempStr, INL_ARRAY_COUNT(TempStr), INL_ARRAY_COUNT(TempStr) - 1, Format );
 
76
    // Logged to a file... Put "\r\n" at the end of each line.
 
77
    if(NOutputDeviceRedirector::Ready())
 
78
        GLogDevice.LogFunction( TEXT("Assertion failed: %s\r\n    [File:%s]\r\n    [Line: %i]\r\n"), (const TCHAR*)TempStr, ANSI_TO_TCHAR(File), Line);
 
79
}
 
80
 
 
81
void LogOutputErrorMessage( const ANSICHAR* File, int Line, const TCHAR* Format/*=TEXT("")*/, ... )
 
82
{
 
83
    TCHAR TempStr[4096];
 
84
    GET_VARARGS( TempStr, INL_ARRAY_COUNT(TempStr), INL_ARRAY_COUNT(TempStr) - 1, Format );
 
85
    if(NOutputDeviceRedirector::Ready())
 
86
        GLogDevice.LogFunction( TEXT("Error: %s\r\n    [File:%s]\r\n    [Line: %d]\r\n"), (const TCHAR*)TempStr, ANSI_TO_TCHAR(File), Line);
 
87
}
 
88
 
 
89
void LogOutputDebugMessage(const TCHAR* Format/*=TEXT("")*/, ... )
 
90
{
 
91
    TCHAR TempStr[4096];
 
92
    GET_VARARGS( TempStr, INL_ARRAY_COUNT(TempStr), INL_ARRAY_COUNT(TempStr) - 1, Format );
 
93
    if(NOutputDeviceRedirector::Ready())
 
94
        GLogDevice.LogFunction(TempStr);
 
95
}
 
96
 
 
97
bool inlOutputRedirectorReady()
 
98
{
 
99
    return NOutputDeviceRedirector::Ready();
 
100
}
 
101
 
 
102
NAMESPACE_END