mirror of
https://github.com/PCSX2/pcsx2.git
synced 2026-11-17 19:44:19 +01:00
Common: reformat (#4720)
* common: format AlignedMalloc.cpp * common: format AppTrait.h * common: format Assertions.h * common: format CheckedStaticBox * common: format Console * common: format Dependencies.h * common: format EmbeddedImage * common: format EventSource * common: format Exceptions * common: format FastFormatString.cpp * common: format General.h * common: format InitInterface * common: format MathUtils.h * common: format MemsetFast/MemcpyFast * common: format Mutex.cpp * common: format PageFaultSource.h * common: format Path.h * common: format PathUtils.cpp * common: format Pcsx2Types.h * common: format Perf * common: format PersistentThread.h * common: format RwMutex * common: format SafeArray * common: format ScopedAlloc.h * common: format ScopedPtrMT.h * common: format Semaphore.cpp * common: format StringHelpers * common: format ThreadTools.cpp * common: format Threading.h * common: format ThreadingDialogs * common: format ThreadingInternal.h * common: format TraceLog.h * common: format VirtualMemory.cpp * common: format pxCheckBox * common: format pxEvents.h * common: format pxForwardDefs.h * common: format pxRadioPanel * common: format pxStaticText * common: format pxStreams * common: format pxTranslate.cpp * common: format pxWindowTextWriter.cpp * common: format wxAppWithHelpers * common: format wxBaseTools.h * common: format wxGuiTools * common: format wxHelpers.cpp * common: format Darwin directory * common: format Linux directory * common: format Windows directory * common: format LnxCpuDetect.cpp * common: format WinCpuDetect.cpp * common: format bmi.cpp * common: format cpudetect.cpp * common: format cpu_detect_internal.h * common: format fpu.cpp * common: format groups.cpp * common: format instructions.h * common: format internal.h * common: format jmp.cpp * common: format legacy.cpp * common: format legacy_instructions.h * common: format legacy_internal.h * common: format movs.cpp * common: format simd.cpp * common: format tools.h * common: format x86emitter.cpp * common: format x86types.h * common: format bmi.h * common: format dwshift.h * common: format group1.h group2.h group3.h * common: format incdec.h * common: format jmpcall.h * common: format movs.h * common: format simd_arithmetic.h * common: format simd_comparisons.h * common: format simd_helpers.h * common: format simd_moremovs.h * common: format simd_shufflepack.h * common: format simd_templated_helpers.h * common: format test.h
This commit is contained in:
1 parent
f9bf87f50d
commit
13dfceff48
102 files changed
+13189
-12692
No files matched your search
+260
-256
@@ -26,11 +26,11 @@ static DeclareTls(int) conlog_Indent(0);
|
||||
static DeclareTls(ConsoleColors) conlog_Color(DefaultConsoleColor);
|
||||
|
||||
#ifdef __POSIX__
|
||||
static FILE *stdout_fp = stdout;
|
||||
static FILE* stdout_fp = stdout;
|
||||
|
||||
void Console_SetStdout(FILE *fp)
|
||||
void Console_SetStdout(FILE* fp)
|
||||
{
|
||||
stdout_fp = fp;
|
||||
stdout_fp = fp;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -41,33 +41,33 @@ void Console_SetStdout(FILE *fp)
|
||||
// Important! Only Assert and Null console loggers are allowed during C++ startup init (when
|
||||
// the program or DLL first loads). Other log targets rely on the static buffer and a
|
||||
// threaded mutex lock, which are only valid after C++ initialization has finished.
|
||||
void Console_SetActiveHandler(const IConsoleWriter &writer, FILE *flushfp)
|
||||
void Console_SetActiveHandler(const IConsoleWriter& writer, FILE* flushfp)
|
||||
{
|
||||
pxAssertDev(
|
||||
(writer.WriteRaw != NULL) && (writer.DoWriteLn != NULL) &&
|
||||
(writer.Newline != NULL) && (writer.SetTitle != NULL) &&
|
||||
(writer.DoSetColor != NULL),
|
||||
"Invalid IConsoleWriter object! All function pointer interfaces must be implemented.");
|
||||
pxAssertDev(
|
||||
(writer.WriteRaw != NULL) && (writer.DoWriteLn != NULL) &&
|
||||
(writer.Newline != NULL) && (writer.SetTitle != NULL) &&
|
||||
(writer.DoSetColor != NULL),
|
||||
"Invalid IConsoleWriter object! All function pointer interfaces must be implemented.");
|
||||
|
||||
Console = writer;
|
||||
DevConWriter = writer;
|
||||
Console = writer;
|
||||
DevConWriter = writer;
|
||||
|
||||
#ifdef PCSX2_DEBUG
|
||||
DbgCon = writer;
|
||||
DbgCon = writer;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Writes text to the Visual Studio Output window (Microsoft Windows only).
|
||||
// On all other platforms this pipes to Stdout instead.
|
||||
void MSW_OutputDebugString(const wxString &text)
|
||||
void MSW_OutputDebugString(const wxString& text)
|
||||
{
|
||||
#if defined(__WXMSW__) && !defined(__WXMICROWIN__)
|
||||
static bool hasDebugger = wxIsDebuggerRunning();
|
||||
if (hasDebugger)
|
||||
OutputDebugString(text);
|
||||
static bool hasDebugger = wxIsDebuggerRunning();
|
||||
if (hasDebugger)
|
||||
OutputDebugString(text);
|
||||
#else
|
||||
fputs(text.utf8_str(), stdout_fp);
|
||||
fflush(stdout_fp);
|
||||
fputs(text.utf8_str(), stdout_fp);
|
||||
fflush(stdout_fp);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -76,23 +76,23 @@ void MSW_OutputDebugString(const wxString &text)
|
||||
// ConsoleNull
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
static void __concall ConsoleNull_SetTitle(const wxString &title) {}
|
||||
static void __concall ConsoleNull_SetTitle(const wxString& title) {}
|
||||
static void __concall ConsoleNull_DoSetColor(ConsoleColors color) {}
|
||||
static void __concall ConsoleNull_Newline() {}
|
||||
static void __concall ConsoleNull_DoWrite(const wxString &fmt) {}
|
||||
static void __concall ConsoleNull_DoWriteLn(const wxString &fmt) {}
|
||||
static void __concall ConsoleNull_DoWrite(const wxString& fmt) {}
|
||||
static void __concall ConsoleNull_DoWriteLn(const wxString& fmt) {}
|
||||
|
||||
const IConsoleWriter ConsoleWriter_Null =
|
||||
{
|
||||
ConsoleNull_DoWrite,
|
||||
ConsoleNull_DoWriteLn,
|
||||
ConsoleNull_DoSetColor,
|
||||
{
|
||||
ConsoleNull_DoWrite,
|
||||
ConsoleNull_DoWriteLn,
|
||||
ConsoleNull_DoSetColor,
|
||||
|
||||
ConsoleNull_DoWrite,
|
||||
ConsoleNull_Newline,
|
||||
ConsoleNull_SetTitle,
|
||||
ConsoleNull_DoWrite,
|
||||
ConsoleNull_Newline,
|
||||
ConsoleNull_SetTitle,
|
||||
|
||||
0, // instance-level indentation (should always be 0)
|
||||
0, // instance-level indentation (should always be 0)
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
@@ -100,133 +100,134 @@ const IConsoleWriter ConsoleWriter_Null =
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
#if defined(__unix__)
|
||||
static __fi const char *GetLinuxConsoleColor(ConsoleColors color)
|
||||
static __fi const char* GetLinuxConsoleColor(ConsoleColors color)
|
||||
{
|
||||
switch (color) {
|
||||
case Color_Black:
|
||||
case Color_StrongBlack:
|
||||
return "\033[30m\033[1m";
|
||||
switch (color)
|
||||
{
|
||||
case Color_Black:
|
||||
case Color_StrongBlack:
|
||||
return "\033[30m\033[1m";
|
||||
|
||||
case Color_Red:
|
||||
return "\033[31m";
|
||||
case Color_StrongRed:
|
||||
return "\033[31m\033[1m";
|
||||
case Color_Red:
|
||||
return "\033[31m";
|
||||
case Color_StrongRed:
|
||||
return "\033[31m\033[1m";
|
||||
|
||||
case Color_Green:
|
||||
return "\033[32m";
|
||||
case Color_StrongGreen:
|
||||
return "\033[32m\033[1m";
|
||||
case Color_Green:
|
||||
return "\033[32m";
|
||||
case Color_StrongGreen:
|
||||
return "\033[32m\033[1m";
|
||||
|
||||
case Color_Yellow:
|
||||
return "\033[33m";
|
||||
case Color_StrongYellow:
|
||||
return "\033[33m\033[1m";
|
||||
case Color_Yellow:
|
||||
return "\033[33m";
|
||||
case Color_StrongYellow:
|
||||
return "\033[33m\033[1m";
|
||||
|
||||
case Color_Blue:
|
||||
return "\033[34m";
|
||||
case Color_StrongBlue:
|
||||
return "\033[34m\033[1m";
|
||||
case Color_Blue:
|
||||
return "\033[34m";
|
||||
case Color_StrongBlue:
|
||||
return "\033[34m\033[1m";
|
||||
|
||||
// No orange, so use magenta.
|
||||
case Color_Orange:
|
||||
case Color_Magenta:
|
||||
return "\033[35m";
|
||||
case Color_StrongOrange:
|
||||
case Color_StrongMagenta:
|
||||
return "\033[35m\033[1m";
|
||||
// No orange, so use magenta.
|
||||
case Color_Orange:
|
||||
case Color_Magenta:
|
||||
return "\033[35m";
|
||||
case Color_StrongOrange:
|
||||
case Color_StrongMagenta:
|
||||
return "\033[35m\033[1m";
|
||||
|
||||
case Color_Cyan:
|
||||
return "\033[36m";
|
||||
case Color_StrongCyan:
|
||||
return "\033[36m\033[1m";
|
||||
case Color_Cyan:
|
||||
return "\033[36m";
|
||||
case Color_StrongCyan:
|
||||
return "\033[36m\033[1m";
|
||||
|
||||
// Use 'white' instead of grey.
|
||||
case Color_Gray:
|
||||
case Color_White:
|
||||
return "\033[37m";
|
||||
case Color_StrongGray:
|
||||
case Color_StrongWhite:
|
||||
return "\033[37m\033[1m";
|
||||
// Use 'white' instead of grey.
|
||||
case Color_Gray:
|
||||
case Color_White:
|
||||
return "\033[37m";
|
||||
case Color_StrongGray:
|
||||
case Color_StrongWhite:
|
||||
return "\033[37m\033[1m";
|
||||
|
||||
// On some other value being passed, clear any formatting.
|
||||
case Color_Default:
|
||||
default:
|
||||
return "\033[0m";
|
||||
}
|
||||
// On some other value being passed, clear any formatting.
|
||||
case Color_Default:
|
||||
default:
|
||||
return "\033[0m";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// One possible default write action at startup and shutdown is to use the stdout.
|
||||
static void __concall ConsoleStdout_DoWrite(const wxString &fmt)
|
||||
static void __concall ConsoleStdout_DoWrite(const wxString& fmt)
|
||||
{
|
||||
MSW_OutputDebugString(fmt);
|
||||
MSW_OutputDebugString(fmt);
|
||||
}
|
||||
|
||||
// Default write action at startup and shutdown is to use the stdout.
|
||||
static void __concall ConsoleStdout_DoWriteLn(const wxString &fmt)
|
||||
static void __concall ConsoleStdout_DoWriteLn(const wxString& fmt)
|
||||
{
|
||||
MSW_OutputDebugString(fmt + L"\n");
|
||||
MSW_OutputDebugString(fmt + L"\n");
|
||||
}
|
||||
|
||||
static void __concall ConsoleStdout_Newline()
|
||||
{
|
||||
MSW_OutputDebugString(L"\n");
|
||||
MSW_OutputDebugString(L"\n");
|
||||
}
|
||||
|
||||
static void __concall ConsoleStdout_DoSetColor(ConsoleColors color)
|
||||
{
|
||||
#if defined(__unix__)
|
||||
fprintf(stdout_fp, "\033[0m%s", GetLinuxConsoleColor(color));
|
||||
fflush(stdout_fp);
|
||||
fprintf(stdout_fp, "\033[0m%s", GetLinuxConsoleColor(color));
|
||||
fflush(stdout_fp);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void __concall ConsoleStdout_SetTitle(const wxString &title)
|
||||
static void __concall ConsoleStdout_SetTitle(const wxString& title)
|
||||
{
|
||||
#if defined(__unix__)
|
||||
fputs("\033]0;", stdout_fp);
|
||||
fputs(title.utf8_str(), stdout_fp);
|
||||
fputs("\007", stdout_fp);
|
||||
fputs("\033]0;", stdout_fp);
|
||||
fputs(title.utf8_str(), stdout_fp);
|
||||
fputs("\007", stdout_fp);
|
||||
#endif
|
||||
}
|
||||
|
||||
const IConsoleWriter ConsoleWriter_Stdout =
|
||||
{
|
||||
ConsoleStdout_DoWrite, // Writes without newlines go to buffer to avoid error log spam.
|
||||
ConsoleStdout_DoWriteLn,
|
||||
ConsoleStdout_DoSetColor,
|
||||
{
|
||||
ConsoleStdout_DoWrite, // Writes without newlines go to buffer to avoid error log spam.
|
||||
ConsoleStdout_DoWriteLn,
|
||||
ConsoleStdout_DoSetColor,
|
||||
|
||||
ConsoleNull_DoWrite, // writes from re-piped stdout are ignored here, lest we create infinite loop hell >_<
|
||||
ConsoleStdout_Newline,
|
||||
ConsoleStdout_SetTitle,
|
||||
0, // instance-level indentation (should always be 0)
|
||||
ConsoleNull_DoWrite, // writes from re-piped stdout are ignored here, lest we create infinite loop hell >_<
|
||||
ConsoleStdout_Newline,
|
||||
ConsoleStdout_SetTitle,
|
||||
0, // instance-level indentation (should always be 0)
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// ConsoleAssert
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
static void __concall ConsoleAssert_DoWrite(const wxString &fmt)
|
||||
static void __concall ConsoleAssert_DoWrite(const wxString& fmt)
|
||||
{
|
||||
pxFail(L"Console class has not been initialized; Message written:\n\t" + fmt);
|
||||
pxFail(L"Console class has not been initialized; Message written:\n\t" + fmt);
|
||||
}
|
||||
|
||||
static void __concall ConsoleAssert_DoWriteLn(const wxString &fmt)
|
||||
static void __concall ConsoleAssert_DoWriteLn(const wxString& fmt)
|
||||
{
|
||||
pxFail(L"Console class has not been initialized; Message written:\n\t" + fmt);
|
||||
pxFail(L"Console class has not been initialized; Message written:\n\t" + fmt);
|
||||
}
|
||||
|
||||
const IConsoleWriter ConsoleWriter_Assert =
|
||||
{
|
||||
ConsoleAssert_DoWrite,
|
||||
ConsoleAssert_DoWriteLn,
|
||||
ConsoleNull_DoSetColor,
|
||||
{
|
||||
ConsoleAssert_DoWrite,
|
||||
ConsoleAssert_DoWriteLn,
|
||||
ConsoleNull_DoSetColor,
|
||||
|
||||
ConsoleNull_DoWrite,
|
||||
ConsoleNull_Newline,
|
||||
ConsoleNull_SetTitle,
|
||||
ConsoleNull_DoWrite,
|
||||
ConsoleNull_Newline,
|
||||
ConsoleNull_SetTitle,
|
||||
|
||||
0, // instance-level indentation (should always be 0)
|
||||
0, // instance-level indentation (should always be 0)
|
||||
};
|
||||
|
||||
// =====================================================================================================
|
||||
@@ -239,170 +240,170 @@ const IConsoleWriter ConsoleWriter_Assert =
|
||||
// glob_indent - this parameter is used to specify a global indentation setting. It is used by
|
||||
// WriteLn function, but defaults to 0 for Warning and Error calls. Local indentation always
|
||||
// applies to all writes.
|
||||
wxString IConsoleWriter::_addIndentation(const wxString &src, int glob_indent = 0) const
|
||||
wxString IConsoleWriter::_addIndentation(const wxString& src, int glob_indent = 0) const
|
||||
{
|
||||
const int indent = glob_indent + _imm_indentation;
|
||||
if (indent == 0)
|
||||
return src;
|
||||
const int indent = glob_indent + _imm_indentation;
|
||||
if (indent == 0)
|
||||
return src;
|
||||
|
||||
wxString result(src);
|
||||
const wxString indentStr(L'\t', indent);
|
||||
result.Replace(L"\n", L"\n" + indentStr);
|
||||
return indentStr + result;
|
||||
wxString result(src);
|
||||
const wxString indentStr(L'\t', indent);
|
||||
result.Replace(L"\n", L"\n" + indentStr);
|
||||
return indentStr + result;
|
||||
}
|
||||
|
||||
// Sets the indentation to be applied to all WriteLn's. The indentation is added to the
|
||||
// primary write, and to any newlines specified within the write. Note that this applies
|
||||
// to calls to WriteLn *only* -- calls to Write bypass the indentation parser.
|
||||
const IConsoleWriter &IConsoleWriter::SetIndent(int tabcount) const
|
||||
const IConsoleWriter& IConsoleWriter::SetIndent(int tabcount) const
|
||||
{
|
||||
conlog_Indent += tabcount;
|
||||
pxAssert(conlog_Indent >= 0);
|
||||
return *this;
|
||||
conlog_Indent += tabcount;
|
||||
pxAssert(conlog_Indent >= 0);
|
||||
return *this;
|
||||
}
|
||||
|
||||
IConsoleWriter IConsoleWriter::Indent(int tabcount) const
|
||||
{
|
||||
IConsoleWriter retval = *this;
|
||||
retval._imm_indentation = tabcount;
|
||||
return retval;
|
||||
IConsoleWriter retval = *this;
|
||||
retval._imm_indentation = tabcount;
|
||||
return retval;
|
||||
}
|
||||
|
||||
// Changes the active console color.
|
||||
// This color will be unset by calls to colored text methods
|
||||
// such as ErrorMsg and Notice.
|
||||
const IConsoleWriter &IConsoleWriter::SetColor(ConsoleColors color) const
|
||||
const IConsoleWriter& IConsoleWriter::SetColor(ConsoleColors color) const
|
||||
{
|
||||
// Ignore current color requests since, well, the current color is already set. ;)
|
||||
if (color == Color_Current)
|
||||
return *this;
|
||||
// Ignore current color requests since, well, the current color is already set. ;)
|
||||
if (color == Color_Current)
|
||||
return *this;
|
||||
|
||||
pxAssertMsg((color > Color_Current) && (color < ConsoleColors_Count), "Invalid ConsoleColor specified.");
|
||||
pxAssertMsg((color > Color_Current) && (color < ConsoleColors_Count), "Invalid ConsoleColor specified.");
|
||||
|
||||
if (conlog_Color != color)
|
||||
DoSetColor(conlog_Color = color);
|
||||
if (conlog_Color != color)
|
||||
DoSetColor(conlog_Color = color);
|
||||
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
|
||||
ConsoleColors IConsoleWriter::GetColor() const
|
||||
{
|
||||
return conlog_Color;
|
||||
return conlog_Color;
|
||||
}
|
||||
|
||||
// Restores the console color to default (usually black, or low-intensity white if the console uses a black background)
|
||||
const IConsoleWriter &IConsoleWriter::ClearColor() const
|
||||
const IConsoleWriter& IConsoleWriter::ClearColor() const
|
||||
{
|
||||
if (conlog_Color != DefaultConsoleColor)
|
||||
DoSetColor(conlog_Color = DefaultConsoleColor);
|
||||
if (conlog_Color != DefaultConsoleColor)
|
||||
DoSetColor(conlog_Color = DefaultConsoleColor);
|
||||
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// ASCII/UTF8 (char*)
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
bool IConsoleWriter::FormatV(const char *fmt, va_list args) const
|
||||
bool IConsoleWriter::FormatV(const char* fmt, va_list args) const
|
||||
{
|
||||
DoWriteLn(_addIndentation(pxsFmtV(fmt, args), conlog_Indent));
|
||||
return false;
|
||||
DoWriteLn(_addIndentation(pxsFmtV(fmt, args), conlog_Indent));
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IConsoleWriter::WriteLn(const char *fmt, ...) const
|
||||
bool IConsoleWriter::WriteLn(const char* fmt, ...) const
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
FormatV(fmt, args);
|
||||
va_end(args);
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
FormatV(fmt, args);
|
||||
va_end(args);
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IConsoleWriter::WriteLn(ConsoleColors color, const char *fmt, ...) const
|
||||
bool IConsoleWriter::WriteLn(ConsoleColors color, const char* fmt, ...) const
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
ConsoleColorScope cs(color);
|
||||
FormatV(fmt, args);
|
||||
va_end(args);
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
ConsoleColorScope cs(color);
|
||||
FormatV(fmt, args);
|
||||
va_end(args);
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IConsoleWriter::Error(const char *fmt, ...) const
|
||||
bool IConsoleWriter::Error(const char* fmt, ...) const
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
ConsoleColorScope cs(Color_StrongRed);
|
||||
FormatV(fmt, args);
|
||||
va_end(args);
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
ConsoleColorScope cs(Color_StrongRed);
|
||||
FormatV(fmt, args);
|
||||
va_end(args);
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IConsoleWriter::Warning(const char *fmt, ...) const
|
||||
bool IConsoleWriter::Warning(const char* fmt, ...) const
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
ConsoleColorScope cs(Color_StrongOrange);
|
||||
FormatV(fmt, args);
|
||||
va_end(args);
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
ConsoleColorScope cs(Color_StrongOrange);
|
||||
FormatV(fmt, args);
|
||||
va_end(args);
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// Write Variants - Unicode/UTF16 style
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
bool IConsoleWriter::FormatV(const wxChar *fmt, va_list args) const
|
||||
bool IConsoleWriter::FormatV(const wxChar* fmt, va_list args) const
|
||||
{
|
||||
DoWriteLn(_addIndentation(pxsFmtV(fmt, args), conlog_Indent));
|
||||
return false;
|
||||
DoWriteLn(_addIndentation(pxsFmtV(fmt, args), conlog_Indent));
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IConsoleWriter::WriteLn(const wxChar *fmt, ...) const
|
||||
bool IConsoleWriter::WriteLn(const wxChar* fmt, ...) const
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
FormatV(fmt, args);
|
||||
va_end(args);
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
FormatV(fmt, args);
|
||||
va_end(args);
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IConsoleWriter::WriteLn(ConsoleColors color, const wxChar *fmt, ...) const
|
||||
bool IConsoleWriter::WriteLn(ConsoleColors color, const wxChar* fmt, ...) const
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
ConsoleColorScope cs(color);
|
||||
FormatV(fmt, args);
|
||||
va_end(args);
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
ConsoleColorScope cs(color);
|
||||
FormatV(fmt, args);
|
||||
va_end(args);
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IConsoleWriter::Error(const wxChar *fmt, ...) const
|
||||
bool IConsoleWriter::Error(const wxChar* fmt, ...) const
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
ConsoleColorScope cs(Color_StrongRed);
|
||||
FormatV(fmt, args);
|
||||
va_end(args);
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
ConsoleColorScope cs(Color_StrongRed);
|
||||
FormatV(fmt, args);
|
||||
va_end(args);
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IConsoleWriter::Warning(const wxChar *fmt, ...) const
|
||||
bool IConsoleWriter::Warning(const wxChar* fmt, ...) const
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
ConsoleColorScope cs(Color_StrongOrange);
|
||||
FormatV(fmt, args);
|
||||
va_end(args);
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
ConsoleColorScope cs(Color_StrongOrange);
|
||||
FormatV(fmt, args);
|
||||
va_end(args);
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
@@ -410,45 +411,45 @@ bool IConsoleWriter::Warning(const wxChar *fmt, ...) const
|
||||
// --------------------------------------------------------------------------------------
|
||||
bool IConsoleWriter::WriteLn(const wxString fmt, ...) const
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
FormatV(fmt.wx_str(), args);
|
||||
va_end(args);
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
FormatV(fmt.wx_str(), args);
|
||||
va_end(args);
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IConsoleWriter::WriteLn(ConsoleColors color, const wxString fmt, ...) const
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
ConsoleColorScope cs(color);
|
||||
FormatV(fmt.wx_str(), args);
|
||||
va_end(args);
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
ConsoleColorScope cs(color);
|
||||
FormatV(fmt.wx_str(), args);
|
||||
va_end(args);
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IConsoleWriter::Error(const wxString fmt, ...) const
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
ConsoleColorScope cs(Color_StrongRed);
|
||||
FormatV(fmt.wx_str(), args);
|
||||
va_end(args);
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
ConsoleColorScope cs(Color_StrongRed);
|
||||
FormatV(fmt.wx_str(), args);
|
||||
va_end(args);
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IConsoleWriter::Warning(const wxString fmt, ...) const
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
ConsoleColorScope cs(Color_StrongOrange);
|
||||
FormatV(fmt.wx_str(), args);
|
||||
va_end(args);
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
ConsoleColorScope cs(Color_StrongOrange);
|
||||
FormatV(fmt.wx_str(), args);
|
||||
va_end(args);
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -458,70 +459,73 @@ bool IConsoleWriter::Warning(const wxString fmt, ...) const
|
||||
|
||||
ConsoleColorScope::ConsoleColorScope(ConsoleColors newcolor)
|
||||
{
|
||||
m_IsScoped = false;
|
||||
m_newcolor = newcolor;
|
||||
EnterScope();
|
||||
m_IsScoped = false;
|
||||
m_newcolor = newcolor;
|
||||
EnterScope();
|
||||
}
|
||||
|
||||
ConsoleColorScope::~ConsoleColorScope()
|
||||
{
|
||||
LeaveScope();
|
||||
LeaveScope();
|
||||
}
|
||||
|
||||
void ConsoleColorScope::EnterScope()
|
||||
{
|
||||
if (!m_IsScoped) {
|
||||
m_old_color = Console.GetColor();
|
||||
Console.SetColor(m_newcolor);
|
||||
m_IsScoped = true;
|
||||
}
|
||||
if (!m_IsScoped)
|
||||
{
|
||||
m_old_color = Console.GetColor();
|
||||
Console.SetColor(m_newcolor);
|
||||
m_IsScoped = true;
|
||||
}
|
||||
}
|
||||
|
||||
void ConsoleColorScope::LeaveScope()
|
||||
{
|
||||
m_IsScoped = m_IsScoped && (Console.SetColor(m_old_color), false);
|
||||
m_IsScoped = m_IsScoped && (Console.SetColor(m_old_color), false);
|
||||
}
|
||||
|
||||
ConsoleIndentScope::ConsoleIndentScope(int tabs)
|
||||
{
|
||||
m_IsScoped = false;
|
||||
m_amount = tabs;
|
||||
EnterScope();
|
||||
m_IsScoped = false;
|
||||
m_amount = tabs;
|
||||
EnterScope();
|
||||
}
|
||||
|
||||
ConsoleIndentScope::~ConsoleIndentScope()
|
||||
{
|
||||
try {
|
||||
LeaveScope();
|
||||
}
|
||||
DESTRUCTOR_CATCHALL
|
||||
try
|
||||
{
|
||||
LeaveScope();
|
||||
}
|
||||
DESTRUCTOR_CATCHALL
|
||||
}
|
||||
|
||||
void ConsoleIndentScope::EnterScope()
|
||||
{
|
||||
m_IsScoped = m_IsScoped || (Console.SetIndent(m_amount), true);
|
||||
m_IsScoped = m_IsScoped || (Console.SetIndent(m_amount), true);
|
||||
}
|
||||
|
||||
void ConsoleIndentScope::LeaveScope()
|
||||
{
|
||||
m_IsScoped = m_IsScoped && (Console.SetIndent(-m_amount), false);
|
||||
m_IsScoped = m_IsScoped && (Console.SetIndent(-m_amount), false);
|
||||
}
|
||||
|
||||
|
||||
ConsoleAttrScope::ConsoleAttrScope(ConsoleColors newcolor, int indent)
|
||||
{
|
||||
m_old_color = Console.GetColor();
|
||||
Console.SetIndent(m_tabsize = indent);
|
||||
Console.SetColor(newcolor);
|
||||
m_old_color = Console.GetColor();
|
||||
Console.SetIndent(m_tabsize = indent);
|
||||
Console.SetColor(newcolor);
|
||||
}
|
||||
|
||||
ConsoleAttrScope::~ConsoleAttrScope()
|
||||
{
|
||||
try {
|
||||
Console.SetColor(m_old_color);
|
||||
Console.SetIndent(-m_tabsize);
|
||||
}
|
||||
DESTRUCTOR_CATCHALL
|
||||
try
|
||||
{
|
||||
Console.SetColor(m_old_color);
|
||||
Console.SetIndent(-m_tabsize);
|
||||
}
|
||||
DESTRUCTOR_CATCHALL
|
||||
}
|
||||
|
||||
|
||||
@@ -552,31 +556,31 @@ NullConsoleWriter NullCon = {};
|
||||
|
||||
// Writes to the console using the specified color. This overrides the default color setting
|
||||
// for this log.
|
||||
bool ConsoleLogSource::WriteV(ConsoleColors color, const char *fmt, va_list list) const
|
||||
bool ConsoleLogSource::WriteV(ConsoleColors color, const char* fmt, va_list list) const
|
||||
{
|
||||
ConsoleColorScope cs(color);
|
||||
DoWrite(pxsFmtV(fmt, list).c_str());
|
||||
return false;
|
||||
ConsoleColorScope cs(color);
|
||||
DoWrite(pxsFmtV(fmt, list).c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ConsoleLogSource::WriteV(ConsoleColors color, const wxChar *fmt, va_list list) const
|
||||
bool ConsoleLogSource::WriteV(ConsoleColors color, const wxChar* fmt, va_list list) const
|
||||
{
|
||||
ConsoleColorScope cs(color);
|
||||
DoWrite(pxsFmtV(fmt, list).c_str());
|
||||
return false;
|
||||
ConsoleColorScope cs(color);
|
||||
DoWrite(pxsFmtV(fmt, list).c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
// Writes to the console using the source's default color. Note that the source's default
|
||||
// color will always be used, thus ConsoleColorScope() will not be effectual unless the
|
||||
// console's default color is Color_Default.
|
||||
bool ConsoleLogSource::WriteV(const char *fmt, va_list list) const
|
||||
bool ConsoleLogSource::WriteV(const char* fmt, va_list list) const
|
||||
{
|
||||
WriteV(DefaultColor, fmt, list);
|
||||
return false;
|
||||
WriteV(DefaultColor, fmt, list);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ConsoleLogSource::WriteV(const wxChar *fmt, va_list list) const
|
||||
bool ConsoleLogSource::WriteV(const wxChar* fmt, va_list list) const
|
||||
{
|
||||
WriteV(DefaultColor, fmt, list);
|
||||
return false;
|
||||
WriteV(DefaultColor, fmt, list);
|
||||
return false;
|
||||
}
|
||||
Reference in new issue
Block a user