2009-09-08 12:08:10 +00:00
|
|
|
/* PCSX2 - PS2 Emulator for PCs
|
2010-05-03 14:08:02 +00:00
|
|
|
* Copyright (C) 2002-2010 PCSX2 Dev Team
|
2009-11-12 14:52:29 +00:00
|
|
|
*
|
2009-09-08 12:08:10 +00:00
|
|
|
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
|
|
|
* of the GNU Lesser General Public License as published by the Free Software Found-
|
|
|
|
* ation, either version 3 of the License, or (at your option) any later version.
|
2009-07-03 00:49:40 +00:00
|
|
|
*
|
2009-09-08 12:08:10 +00:00
|
|
|
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
|
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE. See the GNU General Public License for more details.
|
2009-07-03 00:49:40 +00:00
|
|
|
*
|
2009-09-08 12:08:10 +00:00
|
|
|
* You should have received a copy of the GNU General Public License along with PCSX2.
|
|
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
2009-07-03 00:49:40 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "StringHelpers.h"
|
|
|
|
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
enum ConsoleColors
|
|
|
|
{
|
2009-10-20 19:34:57 +00:00
|
|
|
Color_Current = -1,
|
|
|
|
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
Color_Black = 0,
|
|
|
|
Color_Green,
|
2009-10-29 13:32:40 +00:00
|
|
|
Color_Red,
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
Color_Blue,
|
|
|
|
Color_Magenta,
|
2009-10-29 13:32:40 +00:00
|
|
|
Color_Orange,
|
|
|
|
Color_Gray,
|
|
|
|
|
|
|
|
Color_Cyan, // faint visibility, intended for logging PS2/IOP output
|
|
|
|
Color_Yellow, // faint visibility, intended for logging PS2/IOP output
|
|
|
|
Color_White, // faint visibility, intended for logging PS2/IOP output
|
|
|
|
|
|
|
|
// Strong text *may* result in mis-aligned text in the console, depending on the
|
|
|
|
// font and the platform, so use these with caution.
|
|
|
|
Color_StrongBlack,
|
|
|
|
Color_StrongRed, // intended for errors
|
|
|
|
Color_StrongGreen, // intended for infrequent state information
|
|
|
|
Color_StrongBlue, // intended for block headings
|
2009-11-12 14:52:29 +00:00
|
|
|
Color_StrongMagenta,
|
2009-10-29 13:32:40 +00:00
|
|
|
Color_StrongOrange, // intended for warnings
|
2009-11-12 14:52:29 +00:00
|
|
|
Color_StrongGray,
|
|
|
|
|
|
|
|
Color_StrongCyan,
|
|
|
|
Color_StrongYellow,
|
|
|
|
Color_StrongWhite,
|
|
|
|
|
|
|
|
Color_Default,
|
|
|
|
|
2009-10-29 13:32:40 +00:00
|
|
|
ConsoleColors_Count
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
};
|
|
|
|
|
2009-11-15 06:26:55 +00:00
|
|
|
static const ConsoleColors DefaultConsoleColor = Color_Default;
|
|
|
|
|
|
|
|
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
// Use fastcall for the console; should be helpful in most cases
|
|
|
|
#define __concall __fastcall
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------------------
|
2009-10-05 14:40:46 +00:00
|
|
|
// IConsoleWriter -- For printing messages to the console.
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
// ----------------------------------------------------------------------------------------
|
2009-11-15 06:26:55 +00:00
|
|
|
// General ConsoleWrite Threading Guideline:
|
|
|
|
// PCSX2 is a threaded environment and multiple threads can write to the console asynchronously.
|
|
|
|
// Individual calls to ConsoleWriter APIs will be written in atomic fashion, however "partial"
|
|
|
|
// logs may end up interrupted by logs on other threads. This is usually not a problem for
|
|
|
|
// WriteLn, but may be undesirable for typical uses of Write. In cases where you want to
|
|
|
|
// print multi-line blocks of uninterrupted logs, compound the entire log into a single large
|
|
|
|
// string and issue that to WriteLn.
|
2009-07-03 00:49:40 +00:00
|
|
|
//
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
struct IConsoleWriter
|
2009-07-03 00:49:40 +00:00
|
|
|
{
|
2010-08-06 05:46:09 +00:00
|
|
|
// A direct console write, without tabbing or newlines. Useful to devs who want to do quick
|
|
|
|
// logging of various junk; but should *not* be used in production code due.
|
|
|
|
void (__concall *WriteRaw)( const wxString& fmt );
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
|
2010-08-06 05:46:09 +00:00
|
|
|
// WriteLn implementation for internal use only. Bypasses tabbing, prefixing, and other
|
|
|
|
// formatting.
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
void (__concall *DoWriteLn)( const wxString& fmt );
|
|
|
|
|
2009-11-15 06:26:55 +00:00
|
|
|
// SetColor implementation for internal use only.
|
|
|
|
void (__concall *DoSetColor)( ConsoleColors color );
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
|
2009-12-07 22:43:16 +00:00
|
|
|
// Special implementation of DoWrite that's pretty much for MSVC use only.
|
|
|
|
// All implementations should map to DoWrite, except Stdio which should map to Null.
|
2010-08-06 05:46:09 +00:00
|
|
|
// (This avoids circular/recursive stdio output)
|
2009-12-07 22:43:16 +00:00
|
|
|
void (__concall *DoWriteFromStdout)( const wxString& fmt );
|
|
|
|
|
2009-11-15 06:26:55 +00:00
|
|
|
void (__concall *Newline)();
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
void (__concall *SetTitle)( const wxString& title );
|
2009-07-03 00:49:40 +00:00
|
|
|
|
2010-08-06 05:46:09 +00:00
|
|
|
// internal value for indentation of individual lines. Use the Indent() member to invoke.
|
|
|
|
int _imm_indentation;
|
|
|
|
|
|
|
|
// For internal use only.
|
|
|
|
wxString _addIndentation( const wxString& src, int glob_indent ) const;
|
|
|
|
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// Public members; call these to print stuff to console!
|
2009-11-05 19:32:27 +00:00
|
|
|
//
|
2009-11-12 14:52:29 +00:00
|
|
|
// All functions always return false. Return value is provided only so that we can easily
|
2009-11-05 19:32:27 +00:00
|
|
|
// disable logs at compile time using the "0&&action" macro trick.
|
|
|
|
|
2009-11-15 06:26:55 +00:00
|
|
|
ConsoleColors GetColor() const;
|
|
|
|
const IConsoleWriter& SetColor( ConsoleColors color ) const;
|
|
|
|
const IConsoleWriter& ClearColor() const;
|
|
|
|
const IConsoleWriter& SetIndent( int tabcount=1 ) const;
|
|
|
|
|
|
|
|
IConsoleWriter Indent( int tabcount=1 ) const;
|
|
|
|
|
2010-08-06 05:46:09 +00:00
|
|
|
bool FormatV( const char* fmt, va_list args ) const;
|
2009-11-05 19:32:27 +00:00
|
|
|
bool WriteLn( ConsoleColors color, const char* fmt, ... ) const;
|
|
|
|
bool WriteLn( const char* fmt, ... ) const;
|
|
|
|
bool Error( const char* fmt, ... ) const;
|
|
|
|
bool Warning( const char* fmt, ... ) const;
|
|
|
|
|
2010-08-06 05:46:09 +00:00
|
|
|
bool FormatV( const wxChar* fmt, va_list args ) const;
|
2009-11-05 19:32:27 +00:00
|
|
|
bool WriteLn( ConsoleColors color, const wxChar* fmt, ... ) const;
|
|
|
|
bool WriteLn( const wxChar* fmt, ... ) const;
|
|
|
|
bool Error( const wxChar* fmt, ... ) const;
|
|
|
|
bool Warning( const wxChar* fmt, ... ) const;
|
2014-06-29 06:57:33 +00:00
|
|
|
|
|
|
|
#if wxMAJOR_VERSION >= 3
|
2014-08-01 20:42:00 +00:00
|
|
|
bool WriteLn( ConsoleColors color, const wxString fmt, ... ) const;
|
|
|
|
bool WriteLn( const wxString fmt, ... ) const;
|
|
|
|
bool Error( const wxString fmt, ... ) const;
|
|
|
|
bool Warning( const wxString fmt, ... ) const;
|
2014-06-29 06:57:33 +00:00
|
|
|
#endif
|
2009-11-15 06:26:55 +00:00
|
|
|
};
|
|
|
|
|
2010-08-06 05:46:09 +00:00
|
|
|
// --------------------------------------------------------------------------------------
|
|
|
|
// NullConsoleWriter
|
|
|
|
// --------------------------------------------------------------------------------------
|
|
|
|
// Used by Release builds for Debug and Devel writes (DbgCon / DevCon). Inlines to NOPs. :)
|
|
|
|
//
|
|
|
|
struct NullConsoleWriter
|
|
|
|
{
|
2014-07-12 11:30:34 +00:00
|
|
|
void WriteRaw( const wxString& fmt ) {}
|
|
|
|
void DoWriteLn( const wxString& fmt ) {}
|
|
|
|
void DoSetColor( ConsoleColors color ) {}
|
|
|
|
void DoWriteFromStdout( const wxString& fmt ) {}
|
2010-08-06 05:46:09 +00:00
|
|
|
void Newline() {}
|
2014-07-12 11:30:34 +00:00
|
|
|
void SetTitle( const wxString& title ) {}
|
2010-08-06 05:46:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
ConsoleColors GetColor() const { return Color_Current; }
|
2014-07-12 11:30:34 +00:00
|
|
|
const NullConsoleWriter& SetColor( ConsoleColors color ) const { return *this; }
|
2010-08-06 05:46:09 +00:00
|
|
|
const NullConsoleWriter& ClearColor() const { return *this; }
|
2014-07-12 11:30:34 +00:00
|
|
|
const NullConsoleWriter& SetIndent( int tabcount=1 ) const { return *this; }
|
2010-08-06 05:46:09 +00:00
|
|
|
|
2014-07-12 11:30:34 +00:00
|
|
|
NullConsoleWriter Indent( int tabcount=1 ) const { return NullConsoleWriter(); }
|
2010-08-06 05:46:09 +00:00
|
|
|
|
2014-07-12 11:30:34 +00:00
|
|
|
bool FormatV( const char* fmt, va_list args ) const { return false; }
|
|
|
|
bool WriteLn( ConsoleColors color, const char* fmt, ... ) const { return false; }
|
|
|
|
bool WriteLn( const char* fmt, ... ) const { return false; }
|
|
|
|
bool Error( const char* fmt, ... ) const { return false; }
|
|
|
|
bool Warning( const char* fmt, ... ) const { return false; }
|
2010-08-06 05:46:09 +00:00
|
|
|
|
2014-07-12 11:30:34 +00:00
|
|
|
bool FormatV( const wxChar* fmt, va_list args ) const { return false; }
|
|
|
|
bool WriteLn( ConsoleColors color, const wxChar* fmt, ... ) const { return false; }
|
|
|
|
bool WriteLn( const wxChar* fmt, ... ) const { return false; }
|
|
|
|
bool Error( const wxChar* fmt, ... ) const { return false; }
|
|
|
|
bool Warning( const wxChar* fmt, ... ) const { return false; }
|
2014-06-29 06:57:33 +00:00
|
|
|
|
|
|
|
#if wxMAJOR_VERSION >= 3
|
2014-08-01 20:42:00 +00:00
|
|
|
bool WriteLn( ConsoleColors color, const wxString fmt, ... ) const { return false; }
|
|
|
|
bool WriteLn( const wxString fmt, ... ) const { return false; }
|
|
|
|
bool Error( const wxString fmt, ... ) const { return false; }
|
|
|
|
bool Warning( const wxString fmt, ... ) const { return false; }
|
2014-06-29 06:57:33 +00:00
|
|
|
#endif
|
2010-08-06 05:46:09 +00:00
|
|
|
};
|
2009-11-15 06:26:55 +00:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------
|
|
|
|
// ConsoleIndentScope
|
|
|
|
// --------------------------------------------------------------------------------------
|
|
|
|
// Provides a scoped indentation of the IConsoleWriter interface for the current thread.
|
|
|
|
// Any console writes performed from this scope will be indented by the specified number
|
|
|
|
// of tab characters.
|
|
|
|
//
|
|
|
|
// Scoped Object Notes: Like most scoped objects, this is intended to be used as a stack
|
|
|
|
// or temporary object only. Using it in a situation where the object's lifespan out-lives
|
|
|
|
// a scope will almost certainly result in unintended /undefined side effects.
|
|
|
|
//
|
|
|
|
class ConsoleIndentScope
|
|
|
|
{
|
|
|
|
DeclareNoncopyableObject( ConsoleIndentScope );
|
|
|
|
|
|
|
|
protected:
|
2010-08-06 05:46:09 +00:00
|
|
|
int m_amount;
|
|
|
|
bool m_IsScoped;
|
2009-11-15 06:26:55 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
// Constructor: The specified number of tabs will be appended to the current indentation
|
|
|
|
// setting. The tabs will be unrolled when the object leaves scope or is destroyed.
|
2010-08-06 05:46:09 +00:00
|
|
|
ConsoleIndentScope( int tabs=1 );
|
|
|
|
virtual ~ConsoleIndentScope() throw();
|
|
|
|
void EnterScope();
|
|
|
|
void LeaveScope();
|
2009-11-15 06:26:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------
|
|
|
|
// ConsoleColorScope
|
|
|
|
// --------------------------------------------------------------------------------------
|
|
|
|
class ConsoleColorScope
|
|
|
|
{
|
|
|
|
DeclareNoncopyableObject( ConsoleColorScope );
|
|
|
|
|
|
|
|
protected:
|
2010-08-06 05:46:09 +00:00
|
|
|
ConsoleColors m_newcolor;
|
|
|
|
ConsoleColors m_old_color;
|
|
|
|
bool m_IsScoped;
|
2009-11-15 06:26:55 +00:00
|
|
|
|
|
|
|
public:
|
2010-08-06 05:46:09 +00:00
|
|
|
ConsoleColorScope( ConsoleColors newcolor );
|
|
|
|
virtual ~ConsoleColorScope() throw();
|
|
|
|
void EnterScope();
|
|
|
|
void LeaveScope();
|
2009-11-15 06:26:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------
|
|
|
|
// ConsoleAttrScope
|
|
|
|
// --------------------------------------------------------------------------------------
|
|
|
|
// Applies both color and tab attributes in a single object constructor.
|
|
|
|
//
|
|
|
|
class ConsoleAttrScope
|
|
|
|
{
|
|
|
|
DeclareNoncopyableObject( ConsoleAttrScope );
|
|
|
|
|
|
|
|
protected:
|
|
|
|
ConsoleColors m_old_color;
|
|
|
|
int m_tabsize;
|
|
|
|
|
|
|
|
public:
|
2010-08-06 05:46:09 +00:00
|
|
|
ConsoleAttrScope( ConsoleColors newcolor, int indent=0 );
|
|
|
|
virtual ~ConsoleAttrScope() throw();
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
};
|
2009-07-03 00:49:40 +00:00
|
|
|
|
2015-05-27 16:20:06 +00:00
|
|
|
extern IConsoleWriter Console;
|
2010-08-06 05:46:09 +00:00
|
|
|
|
2015-10-31 00:16:17 +00:00
|
|
|
#ifdef __linux__
|
|
|
|
extern void Console_SetStdout(FILE *fp);
|
|
|
|
#endif
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
extern void Console_SetActiveHandler( const IConsoleWriter& writer, FILE* flushfp=NULL );
|
|
|
|
extern const wxString& ConsoleBuffer_Get();
|
|
|
|
extern void ConsoleBuffer_Clear();
|
|
|
|
extern void ConsoleBuffer_FlushToFile( FILE *fp );
|
2009-07-03 00:49:40 +00:00
|
|
|
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
extern const IConsoleWriter ConsoleWriter_Null;
|
2009-12-07 22:43:16 +00:00
|
|
|
extern const IConsoleWriter ConsoleWriter_Stdout;
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
extern const IConsoleWriter ConsoleWriter_Assert;
|
|
|
|
extern const IConsoleWriter ConsoleWriter_Buffered;
|
|
|
|
extern const IConsoleWriter ConsoleWriter_wxError;
|
2009-07-03 00:49:40 +00:00
|
|
|
|
2015-05-27 16:20:06 +00:00
|
|
|
extern NullConsoleWriter NullCon;
|
2010-08-06 05:46:09 +00:00
|
|
|
|
2015-05-27 16:20:06 +00:00
|
|
|
extern IConsoleWriter DevConWriter;
|
2010-08-06 05:46:09 +00:00
|
|
|
extern bool DevConWriterEnabled;
|
|
|
|
|
2009-07-03 00:49:40 +00:00
|
|
|
#ifdef PCSX2_DEVBUILD
|
2010-08-06 05:46:09 +00:00
|
|
|
# define DevCon DevConWriter
|
2009-07-03 00:49:40 +00:00
|
|
|
#else
|
2010-08-06 05:46:09 +00:00
|
|
|
# define DevCon DevConWriterEnabled && DevConWriter
|
2009-07-03 00:49:40 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef PCSX2_DEBUG
|
2015-05-27 16:20:06 +00:00
|
|
|
extern IConsoleWriter DbgConWriter;
|
2010-08-06 05:46:09 +00:00
|
|
|
# define DbgCon DbgConWriter
|
2009-07-03 00:49:40 +00:00
|
|
|
#else
|
2010-08-06 05:46:09 +00:00
|
|
|
# define DbgCon 0&&NullCon
|
2009-07-03 00:49:40 +00:00
|
|
|
#endif
|