Debugger: Simplify console print (PR #1038)

. Simplify console display functions using StrFormat()
. Update TestDebugger that needs StrFormat() now
This commit is contained in:
Kelvin Lee 2022-02-18 09:12:04 +11:00 committed by GitHub
parent 43b9df253a
commit 5a5d0e2df4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 518 additions and 629 deletions

View File

@ -581,9 +581,7 @@ Update_t CmdBookmarkAdd (int nArgs )
if (iBookmark >= MAX_BOOKMARKS) if (iBookmark >= MAX_BOOKMARKS)
{ {
char sText[ CONSOLE_WIDTH ]; ConsoleDisplayPushFormat( "All bookmarks are currently in use. (Max: %d)", MAX_BOOKMARKS );
sprintf( sText, "All bookmarks are currently in use. (Max: %d)", MAX_BOOKMARKS );
ConsoleDisplayPush( sText );
return ConsoleUpdate(); return ConsoleUpdate();
} }
@ -645,8 +643,7 @@ Update_t CmdBookmarkList (int nArgs)
{ {
if (! g_nBookmarks) if (! g_nBookmarks)
{ {
TCHAR sText[ CONSOLE_WIDTH ]; ConsoleBufferPushFormat( " There are no current bookmarks. (Max: %d)", MAX_BOOKMARKS );
ConsoleBufferPushFormat( sText, TEXT(" There are no current bookmarks. (Max: %d)"), MAX_BOOKMARKS );
} }
else else
{ {
@ -815,8 +812,7 @@ Update_t CmdProfile (int nArgs)
{ {
if (ProfileSave()) if (ProfileSave())
{ {
TCHAR sText[ CONSOLE_WIDTH ]; ConsoleBufferPushFormat( " Saved: %s", g_FileNameProfile.c_str() );
ConsoleBufferPushFormat ( sText, " Saved: %s", g_FileNameProfile.c_str() );
} }
else else
ConsoleBufferPush( TEXT(" ERROR: Couldn't save file. (In use?)" ) ); ConsoleBufferPush( TEXT(" ERROR: Couldn't save file. (In use?)" ) );
@ -879,7 +875,6 @@ Update_t CmdBreakInvalid (int nArgs) // Breakpoint IFF Full-speed!
// 2a. CMD # ON | OFF // set // 2a. CMD # ON | OFF // set
// 2b. CMD ALL ON | OFF // set all // 2b. CMD ALL ON | OFF // set all
// 2c. CMD # ? // error // 2c. CMD # ? // error
TCHAR sText[ CONSOLE_WIDTH ];
bool bValidParam = true; bool bValidParam = true;
int iParamArg = nArgs; // last arg is the 'ON' / 'OFF' param int iParamArg = nArgs; // last arg is the 'ON' / 'OFF' param
@ -920,9 +915,9 @@ Update_t CmdBreakInvalid (int nArgs) // Breakpoint IFF Full-speed!
} }
if (iType == 0) if (iType == 0)
ConsoleBufferPushFormat( sText, TEXT("Enter debugger on BRK opcode: %s"), g_aParameters[ iParam ].m_sName ); ConsoleBufferPushFormat( "Enter debugger on BRK opcode: %s", g_aParameters[ iParam ].m_sName );
else else
ConsoleBufferPushFormat( sText, TEXT("Enter debugger on INVALID %1X opcode: %s"), iType, g_aParameters[ iParam ].m_sName ); ConsoleBufferPushFormat( "Enter debugger on INVALID %1X opcode: %s", iType, g_aParameters[ iParam ].m_sName );
return ConsoleUpdate(); return ConsoleUpdate();
} }
else else
@ -933,7 +928,7 @@ Update_t CmdBreakInvalid (int nArgs) // Breakpoint IFF Full-speed!
{ {
for (iType = 0; iType <= AM_3; iType++) for (iType = 0; iType <= AM_3; iType++)
SetDebugBreakOnInvalid(iType, nActive); SetDebugBreakOnInvalid(iType, nActive);
ConsoleBufferPushFormat(sText, TEXT("Enter debugger on BRK opcode and INVALID opcodes: %s"), g_aParameters[iParam].m_sName); ConsoleBufferPushFormat("Enter debugger on BRK opcode and INVALID opcodes: %s", g_aParameters[iParam].m_sName);
return ConsoleUpdate(); return ConsoleUpdate();
} }
else if (! bValidParam) // case 2c else if (! bValidParam) // case 2c
@ -948,9 +943,9 @@ Update_t CmdBreakInvalid (int nArgs) // Breakpoint IFF Full-speed!
SetDebugBreakOnInvalid( iType, nActive ); SetDebugBreakOnInvalid( iType, nActive );
if (iType == 0) if (iType == 0)
ConsoleBufferPushFormat( sText, TEXT("Enter debugger on BRK opcode: %s"), g_aParameters[ iParam ].m_sName ); ConsoleBufferPushFormat( "Enter debugger on BRK opcode: %s", g_aParameters[ iParam ].m_sName );
else else
ConsoleBufferPushFormat( sText, TEXT("Enter debugger on INVALID %1X opcode: %s"), iType, g_aParameters[ iParam ].m_sName ); ConsoleBufferPushFormat( "Enter debugger on INVALID %1X opcode: %s", iType, g_aParameters[ iParam ].m_sName );
return ConsoleUpdate(); return ConsoleUpdate();
} }
} }
@ -965,8 +960,6 @@ _Help:
//=========================================================================== //===========================================================================
Update_t CmdBreakOpcode (int nArgs) // Breakpoint IFF Full-speed! Update_t CmdBreakOpcode (int nArgs) // Breakpoint IFF Full-speed!
{ {
TCHAR sText[ CONSOLE_WIDTH ];
if (nArgs > 1) if (nArgs > 1)
return HelpLastCommand(); return HelpLastCommand();
@ -981,19 +974,19 @@ Update_t CmdBreakOpcode (int nArgs) // Breakpoint IFF Full-speed!
if (iOpcode >= NUM_OPCODES) if (iOpcode >= NUM_OPCODES)
{ {
ConsoleBufferPushFormat( sText, TEXT("Warning: clamping opcode: %02X"), g_iDebugBreakOnOpcode ); ConsoleBufferPushFormat( "Warning: clamping opcode: %02X", g_iDebugBreakOnOpcode );
return ConsoleUpdate(); return ConsoleUpdate();
} }
} }
if (g_iDebugBreakOnOpcode == 0) if (g_iDebugBreakOnOpcode == 0)
// Show what the current break opcode is // Show what the current break opcode is
ConsoleBufferPushFormat( sText, TEXT("%s Break on Opcode: None") ConsoleBufferPushFormat( "%s Break on Opcode: None"
, sAction , sAction
); );
else else
// Show what the current break opcode is // Show what the current break opcode is
ConsoleBufferPushFormat( sText, TEXT("%s Break on Opcode: %02X %s") ConsoleBufferPushFormat( "%s Break on Opcode: %02X %s"
, sAction , sAction
, g_iDebugBreakOnOpcode , g_iDebugBreakOnOpcode
, g_aOpcodes65C02[ g_iDebugBreakOnOpcode ].sMnemonic , g_aOpcodes65C02[ g_iDebugBreakOnOpcode ].sMnemonic
@ -1025,7 +1018,6 @@ Update_t CmdBreakOnInterrupt(int nArgs)
if (nArgs == 1 && nActive == -1) if (nArgs == 1 && nActive == -1)
return HelpLastCommand(); return HelpLastCommand();
TCHAR sText[CONSOLE_WIDTH];
TCHAR sAction[CONSOLE_WIDTH] = TEXT("Current"); // default to display TCHAR sAction[CONSOLE_WIDTH] = TEXT("Current"); // default to display
if (nArgs == 1) if (nArgs == 1)
@ -1034,7 +1026,7 @@ Update_t CmdBreakOnInterrupt(int nArgs)
_tcscpy(sAction, TEXT("Setting")); _tcscpy(sAction, TEXT("Setting"));
} }
ConsoleBufferPushFormat(sText, TEXT("%s Break on Interrupt: %s") ConsoleBufferPushFormat("%s Break on Interrupt: %s"
, sAction , sAction
, g_bDebugBreakOnInterrupt ? "Enabled" : "Disabled" , g_bDebugBreakOnInterrupt ? "Enabled" : "Disabled"
); );
@ -1426,7 +1418,7 @@ int _CmdBreakpointAddCommonArg ( int iArg, int nArg, BreakpointSource_t iSrc, Br
if (iBreakpoint >= MAX_BREAKPOINTS) if (iBreakpoint >= MAX_BREAKPOINTS)
{ {
ConsoleDisplayError(TEXT("All Breakpoints slots are currently in use.")); ConsoleDisplayError("All Breakpoints slots are currently in use.");
return dArg; return dArg;
} }
@ -1655,7 +1647,7 @@ void _BWZ_EnableDisableViaArgs( int nArgs, Breakpoint_t * aBreakWatchZero, const
Update_t CmdBreakpointClear (int nArgs) Update_t CmdBreakpointClear (int nArgs)
{ {
if (!g_nBreakpoints) if (!g_nBreakpoints)
return ConsoleDisplayError(TEXT("There are no breakpoints defined.")); return ConsoleDisplayError("There are no breakpoints defined.");
if (!nArgs) if (!nArgs)
{ {
@ -1673,7 +1665,7 @@ Update_t CmdBreakpointClear (int nArgs)
Update_t CmdBreakpointDisable (int nArgs) Update_t CmdBreakpointDisable (int nArgs)
{ {
if (! g_nBreakpoints) if (! g_nBreakpoints)
return ConsoleDisplayError(TEXT("There are no (PC) Breakpoints defined.")); return ConsoleDisplayError("There are no (PC) Breakpoints defined.");
if (! nArgs) if (! nArgs)
return Help_Arg_1( CMD_BREAKPOINT_DISABLE ); return Help_Arg_1( CMD_BREAKPOINT_DISABLE );
@ -1694,7 +1686,7 @@ Update_t CmdBreakpointEdit (int nArgs)
Update_t CmdBreakpointEnable (int nArgs) { Update_t CmdBreakpointEnable (int nArgs) {
if (! g_nBreakpoints) if (! g_nBreakpoints)
return ConsoleDisplayError(TEXT("There are no (PC) Breakpoints defined.")); return ConsoleDisplayError("There are no (PC) Breakpoints defined.");
if (! nArgs) if (! nArgs)
return Help_Arg_1( CMD_BREAKPOINT_ENABLE ); return Help_Arg_1( CMD_BREAKPOINT_ENABLE );
@ -1707,7 +1699,6 @@ Update_t CmdBreakpointEnable (int nArgs) {
void _BWZ_List( const Breakpoint_t * aBreakWatchZero, const int iBWZ ) //, bool bZeroBased ) void _BWZ_List( const Breakpoint_t * aBreakWatchZero, const int iBWZ ) //, bool bZeroBased )
{ {
static char sText[ CONSOLE_WIDTH ];
static const char sFlags[] = "-*"; static const char sFlags[] = "-*";
static char sName[ MAX_SYMBOLS_LEN+1 ]; static char sName[ MAX_SYMBOLS_LEN+1 ];
@ -1723,7 +1714,7 @@ void _BWZ_List( const Breakpoint_t * aBreakWatchZero, const int iBWZ ) //, bool
: aBreakWatchZero[iBWZ].eSource == BP_SRC_MEM_WRITE_ONLY ? 'W' : aBreakWatchZero[iBWZ].eSource == BP_SRC_MEM_WRITE_ONLY ? 'W'
: ' '; : ' ';
ConsoleBufferPushFormat( sText, " #%d %c %04X %c %s", ConsoleBufferPushFormat( " #%d %c %04X %c %s",
// (bZeroBased ? iBWZ + 1 : iBWZ), // (bZeroBased ? iBWZ + 1 : iBWZ),
iBWZ, iBWZ,
sFlags[ (int) aBreakWatchZero[ iBWZ ].bEnabled ], sFlags[ (int) aBreakWatchZero[ iBWZ ].bEnabled ],
@ -1764,8 +1755,7 @@ Update_t CmdBreakpointList (int nArgs)
if (! g_nBreakpoints) if (! g_nBreakpoints)
{ {
TCHAR sText[ CONSOLE_WIDTH ]; ConsoleBufferPushFormat( " There are no current breakpoints. (Max: %d)", MAX_BREAKPOINTS );
ConsoleBufferPushFormat( sText, TEXT(" There are no current breakpoints. (Max: %d)"), MAX_BREAKPOINTS );
} }
else else
{ {
@ -1995,8 +1985,7 @@ static Update_t CmdGo (int nArgs, const bool bFullSpeed)
g_nDebugSkipLen &= _6502_MEM_END; g_nDebugSkipLen &= _6502_MEM_END;
#if _DEBUG #if _DEBUG
TCHAR sText[ CONSOLE_WIDTH ]; ConsoleBufferPushFormat( "Start: %04X,%04X End: %04X Len: %04X",
ConsoleBufferPushFormat( sText, TEXT("Start: %04X,%04X End: %04X Len: %04X"),
g_nDebugSkipStart, g_nDebugSkipLen, nEnd, nLen ); g_nDebugSkipStart, g_nDebugSkipLen, nEnd, nLen );
ConsoleBufferToDisplay(); ConsoleBufferToDisplay();
#endif #endif
@ -2095,8 +2084,6 @@ Update_t CmdTrace (int nArgs)
//=========================================================================== //===========================================================================
Update_t CmdTraceFile (int nArgs) Update_t CmdTraceFile (int nArgs)
{ {
char sText[ CONSOLE_WIDTH ] = "";
if (g_hTraceFile) if (g_hTraceFile)
{ {
fclose( g_hTraceFile ); fclose( g_hTraceFile );
@ -2123,12 +2110,12 @@ Update_t CmdTraceFile (int nArgs)
{ {
const char* pTextHdr = g_bTraceFileWithVideoScanner ? "Trace (with video info) started: %s" const char* pTextHdr = g_bTraceFileWithVideoScanner ? "Trace (with video info) started: %s"
: "Trace started: %s"; : "Trace started: %s";
ConsoleBufferPushFormat( sText, pTextHdr, sFilePath.c_str() ); ConsoleBufferPushFormat( pTextHdr, sFilePath.c_str() );
g_bTraceHeader = true; g_bTraceHeader = true;
} }
else else
{ {
ConsoleBufferPushFormat( sText, "Trace ERROR: %s", sFilePath.c_str() ); ConsoleBufferPushFormat( "Trace ERROR: %s", sFilePath.c_str() );
} }
} }
@ -2257,8 +2244,7 @@ Update_t CmdOut (int nArgs)
//=========================================================================== //===========================================================================
Update_t CmdLBR(int nArgs) Update_t CmdLBR(int nArgs)
{ {
TCHAR sText[CONSOLE_WIDTH]; ConsolePrintFormat(" LBR = $%04X", g_LBR);
ConsolePrintFormat(sText, " LBR = $%04X", g_LBR);
return ConsoleUpdate(); return ConsoleUpdate();
} }
@ -2270,8 +2256,7 @@ void _ColorPrint( int iColor, COLORREF nColor )
int G = (nColor >> 8) & 0xFF; int G = (nColor >> 8) & 0xFF;
int B = (nColor >> 16) & 0xFF; int B = (nColor >> 16) & 0xFF;
TCHAR sText[ CONSOLE_WIDTH ]; ConsoleBufferPushFormat( " Color %01X: %02X %02X %02X", iColor, R, G, B ); // TODO: print name of colors!
ConsoleBufferPushFormat( sText, " Color %01X: %02X %02X %02X", iColor, R, G, B ); // TODO: print name of colors!
} }
void _CmdColorGet( const int iScheme, const int iColor ) void _CmdColorGet( const int iScheme, const int iColor )
@ -2544,7 +2529,6 @@ Update_t CmdConfigSave (int nArgs)
Update_t CmdConfigDisasm( int nArgs ) Update_t CmdConfigDisasm( int nArgs )
{ {
int iParam = 0; int iParam = 0;
TCHAR sText[ CONSOLE_WIDTH ];
bool bDisplayCurrentSettings = false; bool bDisplayCurrentSettings = false;
@ -2584,7 +2568,7 @@ Update_t CmdConfigDisasm( int nArgs )
} }
else // show current setting else // show current setting
{ {
ConsoleBufferPushFormat( sText, TEXT( "Branch Type: %d" ), g_iConfigDisasmBranchType ); ConsoleBufferPushFormat( "Branch Type: %d", g_iConfigDisasmBranchType );
ConsoleBufferToDisplay(); ConsoleBufferToDisplay();
} }
break; break;
@ -2608,7 +2592,7 @@ Update_t CmdConfigDisasm( int nArgs )
,"Shift+Ctrl " // 6 ,"Shift+Ctrl " // 6
,"Shift+Ctarl+Alt " // 7 ,"Shift+Ctarl+Alt " // 7
}; };
ConsoleBufferPushFormat( sText, TEXT( "Click: %d = %sLeft click" ), g_bConfigDisasmClick, aClickKey[ g_bConfigDisasmClick & 7 ] ); ConsoleBufferPushFormat( "Click: %d = %sLeft click", g_bConfigDisasmClick, aClickKey[ g_bConfigDisasmClick & 7 ] );
ConsoleBufferToDisplay(); ConsoleBufferToDisplay();
} }
break; break;
@ -2622,7 +2606,7 @@ Update_t CmdConfigDisasm( int nArgs )
else // show current setting else // show current setting
{ {
int iState = g_bConfigDisasmAddressColon ? PARAM_ON : PARAM_OFF; int iState = g_bConfigDisasmAddressColon ? PARAM_ON : PARAM_OFF;
ConsoleBufferPushFormat( sText, TEXT( "Colon: %s" ), g_aParameters[ iState ].m_sName ); ConsoleBufferPushFormat( "Colon: %s", g_aParameters[ iState ].m_sName );
ConsoleBufferToDisplay(); ConsoleBufferToDisplay();
} }
break; break;
@ -2636,7 +2620,7 @@ Update_t CmdConfigDisasm( int nArgs )
else else
{ {
int iState = g_bConfigDisasmOpcodesView ? PARAM_ON : PARAM_OFF; int iState = g_bConfigDisasmOpcodesView ? PARAM_ON : PARAM_OFF;
ConsoleBufferPushFormat( sText, TEXT( "Opcodes: %s" ), g_aParameters[ iState ].m_sName ); ConsoleBufferPushFormat( "Opcodes: %s", g_aParameters[ iState ].m_sName );
ConsoleBufferToDisplay(); ConsoleBufferToDisplay();
} }
break; break;
@ -2650,7 +2634,7 @@ Update_t CmdConfigDisasm( int nArgs )
else else
{ {
int iState = g_bConfigInfoTargetPointer ? PARAM_ON : PARAM_OFF; int iState = g_bConfigInfoTargetPointer ? PARAM_ON : PARAM_OFF;
ConsoleBufferPushFormat( sText, TEXT( "Info Target Pointer: %s" ), g_aParameters[ iState ].m_sName ); ConsoleBufferPushFormat( "Info Target Pointer: %s", g_aParameters[ iState ].m_sName );
ConsoleBufferToDisplay(); ConsoleBufferToDisplay();
} }
break; break;
@ -2664,7 +2648,7 @@ Update_t CmdConfigDisasm( int nArgs )
else else
{ {
int iState = g_bConfigDisasmOpcodeSpaces ? PARAM_ON : PARAM_OFF; int iState = g_bConfigDisasmOpcodeSpaces ? PARAM_ON : PARAM_OFF;
ConsoleBufferPushFormat( sText, TEXT( "Opcode spaces: %s" ), g_aParameters[ iState ].m_sName ); ConsoleBufferPushFormat( "Opcode spaces: %s", g_aParameters[ iState ].m_sName );
ConsoleBufferToDisplay(); ConsoleBufferToDisplay();
} }
break; break;
@ -2681,7 +2665,7 @@ Update_t CmdConfigDisasm( int nArgs )
} }
else // show current setting else // show current setting
{ {
ConsoleBufferPushFormat( sText, TEXT( "Target: %d" ), g_iConfigDisasmTargets ); ConsoleBufferPushFormat( "Target: %d", g_iConfigDisasmTargets );
ConsoleBufferToDisplay(); ConsoleBufferToDisplay();
} }
break; break;
@ -3361,8 +3345,7 @@ Update_t CmdDisk ( int nArgs)
if (nArgs > 2) if (nArgs > 2)
return HelpLastCommand(); return HelpLastCommand();
char buffer[200] = ""; // HACK: Magic number TODO: Should be MAX_CONSOLE_WIDTH*2 ConsoleBufferPushFormat("FW%2d: D%d at T$%s, phase $%s, offset $%X, mask $%02X, extraCycles %.2f, %s",
ConsoleBufferPushFormat(buffer, "FW%2d: D%d at T$%s, phase $%s, offset $%X, mask $%02X, extraCycles %.2f, %s",
diskCard.GetCurrentFirmware(), diskCard.GetCurrentFirmware(),
diskCard.GetCurrentDrive() + 1, diskCard.GetCurrentDrive() + 1,
diskCard.GetCurrentTrackString().c_str(), diskCard.GetCurrentTrackString().c_str(),
@ -3557,9 +3540,7 @@ bool _MemoryCheckMiniDump ( int iWhich )
{ {
if ((iWhich < 0) || (iWhich > NUM_MEM_MINI_DUMPS)) if ((iWhich < 0) || (iWhich > NUM_MEM_MINI_DUMPS))
{ {
TCHAR sText[ CONSOLE_WIDTH ]; ConsoleDisplayErrorFormat( " Only %d memory mini dumps", NUM_MEM_MINI_DUMPS );
wsprintf( sText, TEXT(" Only %d memory mini dumps"), NUM_MEM_MINI_DUMPS );
ConsoleDisplayError( sText );
return true; return true;
} }
return false; return false;
@ -3750,9 +3731,8 @@ Update_t CmdConfigGetDebugDir (int nArgs)
if( nArgs != 0 ) if( nArgs != 0 )
return Help_Arg_1( CMD_CONFIG_GET_DEBUG_DIR ); return Help_Arg_1( CMD_CONFIG_GET_DEBUG_DIR );
TCHAR sPath[ MAX_PATH + 8 ];
// TODO: debugger dir has no ` CONSOLE_COLOR_ESCAPE_CHAR ?!?! // TODO: debugger dir has no ` CONSOLE_COLOR_ESCAPE_CHAR ?!?!
ConsoleBufferPushFormat( sPath, "Path: %s", g_sCurrentDir.c_str() ); ConsoleBufferPushFormat( "Path: %s", g_sCurrentDir.c_str() );
return ConsoleUpdate(); return ConsoleUpdate();
} }
@ -3977,8 +3957,7 @@ Update_t CmdMemoryLoad (int nArgs)
CmdConfigGetDebugDir( 0 ); CmdConfigGetDebugDir( 0 );
TCHAR sFile[ MAX_PATH + 8 ]; ConsoleBufferPushFormat( "File: %s", g_sMemoryLoadSaveFileName );
ConsoleBufferPushFormat( sFile, "File: %s", g_sMemoryLoadSaveFileName );
} }
delete [] pMemory; delete [] pMemory;
@ -4158,12 +4137,11 @@ Update_t CmdMemoryLoad (int nArgs)
size_t nRead = fread( pMemBankBase+nAddressStart, nAddressLen, 1, hFile ); size_t nRead = fread( pMemBankBase+nAddressStart, nAddressLen, 1, hFile );
if (nRead == 1) if (nRead == 1)
{ {
char text[ 128 ]; ConsoleBufferPushFormat( "Loaded @ A$%04X,L$%04X", nAddressStart, nAddressLen );
ConsoleBufferPushFormat( text, "Loaded @ A$%04X,L$%04X", nAddressStart, nAddressLen );
} }
else else
{ {
ConsoleBufferPush( TEXT( "Error loading data." ) ); ConsoleBufferPush( "Error loading data." );
} }
fclose( hFile ); fclose( hFile );
@ -4181,12 +4159,11 @@ Update_t CmdMemoryLoad (int nArgs)
} }
else else
{ {
ConsoleBufferPush( TEXT( "ERROR: Bad filename" ) ); ConsoleBufferPush( "ERROR: Bad filename" );
CmdConfigGetDebugDir( 0 ); CmdConfigGetDebugDir( 0 );
TCHAR sFile[ MAX_PATH + 8 ]; ConsoleBufferPushFormat( "File: ", g_sMemoryLoadSaveFileName.c_str() );
ConsoleBufferPushFormat( sFile, "File: ", g_sMemoryLoadSaveFileName.c_str() );
} }
return ConsoleUpdate(); return ConsoleUpdate();
@ -4261,15 +4238,14 @@ Update_t CmdMemorySave (int nArgs)
if (! nArgs) if (! nArgs)
{ {
TCHAR sLast[ CONSOLE_WIDTH ] = TEXT("");
if (nAddressLen) if (nAddressLen)
{ {
ConsoleBufferPushFormat( sLast, TEXT("Last saved: $%04X:$%04X, %04X"), ConsoleBufferPushFormat( "Last saved: $%04X:$%04X, %04X",
nAddressStart, nAddressEnd, nAddressLen ); nAddressStart, nAddressEnd, nAddressLen );
} }
else else
{ {
ConsoleBufferPush( sLast, TEXT( "Last saved: none" ) ); ConsoleBufferPush( "Last saved: none" );
} }
} }
else else
@ -4389,14 +4365,13 @@ Update_t CmdMemorySave (int nArgs)
if (! nArgs) if (! nArgs)
{ {
TCHAR sLast[ CONSOLE_WIDTH ] = TEXT("");
if (nAddressLen) if (nAddressLen)
{ {
if (!bBankSpecified) if (!bBankSpecified)
ConsoleBufferPushFormat( sLast, TEXT("Last saved: $%04X:$%04X, %04X"), ConsoleBufferPushFormat( "Last saved: $%04X:$%04X, %04X",
nAddressStart, nAddressEnd, nAddressLen ); nAddressStart, nAddressEnd, nAddressLen );
else else
ConsoleBufferPushFormat( sLast, TEXT("Last saved: Bank=%02X $%04X:$%04X, %04X"), ConsoleBufferPushFormat( "Last saved: Bank=%02X $%04X:$%04X, %04X",
nBank, nAddressStart, nAddressEnd, nAddressLen ); nBank, nAddressStart, nAddressEnd, nAddressLen );
} }
else else
@ -4740,30 +4715,29 @@ Update_t CmdNTSC (int nArgs)
public: public:
static void update( const char *pPrefixText ) static void update( const char *pPrefixText )
{ {
char text[ CONSOLE_WIDTH*2 ] = ""; size_t len1 = strlen( pPrefixText );
size_t len2 = sPaletteFilePath.size();
size_t len = len1 + len2;
size_t len1 = strlen( pPrefixText ); if (len >= CONSOLE_WIDTH)
size_t len2 = sPaletteFilePath.size(); {
size_t len = len1 + len2; ConsoleBufferPush( pPrefixText ); // TODO: Add a ": " separator
if (len >= CONSOLE_WIDTH)
{
ConsoleBufferPush( pPrefixText ); // TODO: Add a ": " separator
#if _DEBUG #if _DEBUG
LogOutput( "Filename.length.1: %d\n", len1 ); LogOutput( "Filename.length.1: %d\n", len1 );
LogOutput( "Filename.length.2: %d\n", len2 ); LogOutput( "Filename.length.2: %d\n", len2 );
OutputDebugString( sPaletteFilePath.c_str() ); OutputDebugString( sPaletteFilePath.c_str() );
#endif #endif
// File path is too long // File path is too long
// TODO: Need to split very long path names // TODO: Need to split very long path names
strncpy( text, sPaletteFilePath.c_str(), CONSOLE_WIDTH ); char text[CONSOLE_WIDTH * 2] = "";
ConsoleBufferPush( text ); // TODO: Switch ConsoleBufferPush() to ConsoleBufferPushFormat() strncpy( text, sPaletteFilePath.c_str(), CONSOLE_WIDTH );
} ConsoleBufferPush( text ); // TODO: Switch ConsoleBufferPush() to ConsoleBufferPushFormat()
else }
{ else
ConsoleBufferPushFormat( text, "%s: %s", pPrefixText, sPaletteFilePath.c_str() ); {
} ConsoleBufferPushFormat( "%s: %s", pPrefixText, sPaletteFilePath.c_str() );
}
} }
}; };
@ -5317,7 +5291,7 @@ int CmdTextSave (int nArgs)
FILE *hFile = fopen( sLoadSaveFilePath.c_str(), "rb" ); FILE *hFile = fopen( sLoadSaveFilePath.c_str(), "rb" );
if (hFile) if (hFile)
{ {
ConsoleBufferPush( TEXT( "Warning: File already exists. Overwriting." ) ); ConsoleBufferPush( "Warning: File already exists. Overwriting." );
fclose( hFile ); fclose( hFile );
} }
@ -5327,18 +5301,17 @@ int CmdTextSave (int nArgs)
size_t nWrote = fwrite( pText, nSize, 1, hFile ); size_t nWrote = fwrite( pText, nSize, 1, hFile );
if (nWrote == 1) if (nWrote == 1)
{ {
TCHAR text[ CONSOLE_WIDTH ] = TEXT(""); ConsoleBufferPushFormat( "Saved: %s", g_sMemoryLoadSaveFileName.c_str() );
ConsoleBufferPushFormat( text, "Saved: %s", g_sMemoryLoadSaveFileName.c_str() );
} }
else else
{ {
ConsoleBufferPush( TEXT( "Error saving." ) ); ConsoleBufferPush( "Error saving." );
} }
fclose( hFile ); fclose( hFile );
} }
else else
{ {
ConsoleBufferPush( TEXT( "Error opening file." ) ); ConsoleBufferPush( "Error opening file." );
} }
return ConsoleUpdate(); return ConsoleUpdate();
@ -5506,8 +5479,7 @@ Update_t _SearchMemoryDisplay (int nArgs)
ConsolePrint( sMatches ); ConsolePrint( sMatches );
} }
// wsprintf( sMatches, "Total: %d (#$%04X)", nFound, nFound ); // ConsoleDisplayPushFormat( "Total: %d (#$%04X)", nFound, nFound );
// ConsoleDisplayPush( sMatches );
sResult[0] = 0; sResult[0] = 0;
StringCat( sResult, CHC_USAGE , nBuf ); StringCat( sResult, CHC_USAGE , nBuf );
@ -5555,7 +5527,7 @@ Update_t _CmdMemorySearch (int nArgs, bool bTextIsAscii = true )
// if (eRange == RANGE_MISSING_ARG_2) // if (eRange == RANGE_MISSING_ARG_2)
if (! Range_CalcEndLen( eRange, nAddressStart, nAddress2, nAddressEnd, nAddressLen)) if (! Range_CalcEndLen( eRange, nAddressStart, nAddress2, nAddressEnd, nAddressLen))
return ConsoleDisplayError( TEXT("Error: Missing address seperator (comma or colon)" ) ); return ConsoleDisplayError( "Error: Missing address seperator (comma or colon)" );
int iArgFirstByte = 4; int iArgFirstByte = 4;
int iArg; int iArg;
@ -6027,7 +5999,7 @@ Update_t CmdOutputPrintf (int nArgs)
case PS_TYPE: case PS_TYPE:
if (iValue >= nParamValues) if (iValue >= nParamValues)
{ {
ConsoleBufferPushFormat( sText, TEXT("Error: Missing value arg: %d"), iValue + 1 ); ConsoleBufferPushFormat( "Error: Missing value arg: %d", iValue + 1 );
return ConsoleUpdate(); return ConsoleUpdate();
} }
switch( c ) switch( c )
@ -6155,9 +6127,8 @@ Update_t CmdOutputRun (int nArgs)
} }
else else
{ {
char sText[ CONSOLE_WIDTH ]; ConsolePrintFormat("%sCouldn't load filename:", CHC_ERROR);
ConsolePrintFormat(sText, "%sCouldn't load filename:", CHC_ERROR); ConsolePrintFormat("%s%s", CHC_STRING, sFileName.c_str());
ConsolePrintFormat(sText, "%s%s", CHC_STRING, sFileName.c_str());
} }
return ConsoleUpdate(); return ConsoleUpdate();
@ -6401,27 +6372,25 @@ Update_t CmdSource (int nArgs)
const int MAX_MINI_FILENAME = 20; const int MAX_MINI_FILENAME = 20;
const std::string sMiniFileName = sFileName.substr(0, MIN(MAX_MINI_FILENAME, sFileName.size())); const std::string sMiniFileName = sFileName.substr(0, MIN(MAX_MINI_FILENAME, sFileName.size()));
TCHAR buffer[MAX_PATH] = { 0 };
if (BufferAssemblyListing( sFileName )) if (BufferAssemblyListing( sFileName ))
{ {
g_aSourceFileName = pFileName; g_aSourceFileName = pFileName;
if (! ParseAssemblyListing( g_bSourceAddMemory, g_bSourceAddSymbols )) if (! ParseAssemblyListing( g_bSourceAddMemory, g_bSourceAddSymbols ))
{ {
ConsoleBufferPushFormat( buffer, "Couldn't load filename: %s", sMiniFileName.c_str() ); ConsoleBufferPushFormat( "Couldn't load filename: %s", sMiniFileName.c_str() );
} }
else else
{ {
if (g_nSourceAssembleBytes) if (g_nSourceAssembleBytes)
{ {
ConsoleBufferPushFormat( buffer, " Read: %d lines, %d symbols, %d bytes" ConsoleBufferPushFormat( " Read: %d lines, %d symbols, %d bytes"
, g_AssemblerSourceBuffer.GetNumLines() // g_nSourceAssemblyLines , g_AssemblerSourceBuffer.GetNumLines() // g_nSourceAssemblyLines
, g_nSourceAssemblySymbols, g_nSourceAssembleBytes ); , g_nSourceAssemblySymbols, g_nSourceAssembleBytes );
} }
else else
{ {
ConsoleBufferPushFormat( buffer, " Read: %d lines, %d symbols" ConsoleBufferPushFormat( " Read: %d lines, %d symbols"
, g_AssemblerSourceBuffer.GetNumLines() // g_nSourceAssemblyLines , g_AssemblerSourceBuffer.GetNumLines() // g_nSourceAssemblyLines
, g_nSourceAssemblySymbols ); , g_nSourceAssemblySymbols );
} }
@ -6429,7 +6398,7 @@ Update_t CmdSource (int nArgs)
} }
else else
{ {
ConsoleBufferPushFormat( buffer, "Error reading: %s", sMiniFileName.c_str() ); ConsoleBufferPushFormat( "Error reading: %s", sMiniFileName.c_str() );
} }
} }
} }
@ -6490,8 +6459,7 @@ Update_t CmdVideoScannerInfo(int nArgs)
return Help_Arg_1(CMD_VIDEO_SCANNER_INFO); return Help_Arg_1(CMD_VIDEO_SCANNER_INFO);
} }
TCHAR sText[CONSOLE_WIDTH]; ConsoleBufferPushFormat("Video-scanner display updated: %s", g_aArgs[1].sArg);
ConsoleBufferPushFormat(sText, "Video-scanner display updated: %s", g_aArgs[1].sArg);
ConsoleBufferToDisplay(); ConsoleBufferToDisplay();
return UPDATE_ALL; return UPDATE_ALL;
@ -6520,8 +6488,7 @@ Update_t CmdCyclesInfo(int nArgs)
CmdCyclesReset(0); CmdCyclesReset(0);
} }
TCHAR sText[CONSOLE_WIDTH]; ConsoleBufferPushFormat("Cycles display updated: %s", g_aArgs[1].sArg);
ConsoleBufferPushFormat(sText, "Cycles display updated: %s", g_aArgs[1].sArg);
ConsoleBufferToDisplay(); ConsoleBufferToDisplay();
return UPDATE_ALL; return UPDATE_ALL;
@ -6706,7 +6673,7 @@ Update_t CmdWatchAdd (int nArgs)
// Make sure address isn't an IO address // Make sure address isn't an IO address
if ((nAddress >= _6502_IO_BEGIN) && (nAddress <= _6502_IO_END)) if ((nAddress >= _6502_IO_BEGIN) && (nAddress <= _6502_IO_END))
return ConsoleDisplayError(TEXT("You may not watch an I/O location.")); return ConsoleDisplayError("You may not watch an I/O location.");
if (iWatch == NO_6502_TARGET) if (iWatch == NO_6502_TARGET)
{ {
@ -6719,9 +6686,7 @@ Update_t CmdWatchAdd (int nArgs)
if ((iWatch >= MAX_WATCHES) && !bAdded) if ((iWatch >= MAX_WATCHES) && !bAdded)
{ {
char sText[ CONSOLE_WIDTH ]; ConsoleDisplayPushFormat( "All watches are currently in use. (Max: %d)", MAX_WATCHES );
sprintf( sText, "All watches are currently in use. (Max: %d)", MAX_WATCHES );
ConsoleDisplayPush( sText );
return ConsoleUpdate(); return ConsoleUpdate();
} }
@ -6749,7 +6714,7 @@ _Help:
Update_t CmdWatchClear (int nArgs) Update_t CmdWatchClear (int nArgs)
{ {
if (!g_nWatches) if (!g_nWatches)
return ConsoleDisplayError(TEXT("There are no watches defined.")); return ConsoleDisplayError("There are no watches defined.");
if (!nArgs) if (!nArgs)
return Help_Arg_1( CMD_WATCH_CLEAR ); return Help_Arg_1( CMD_WATCH_CLEAR );
@ -6769,7 +6734,7 @@ Update_t CmdWatchClear (int nArgs)
Update_t CmdWatchDisable (int nArgs) Update_t CmdWatchDisable (int nArgs)
{ {
if (! g_nWatches) if (! g_nWatches)
return ConsoleDisplayError(TEXT("There are no watches defined.")); return ConsoleDisplayError("There are no watches defined.");
if (!nArgs) if (!nArgs)
return Help_Arg_1( CMD_WATCH_DISABLE ); return Help_Arg_1( CMD_WATCH_DISABLE );
@ -6783,7 +6748,7 @@ Update_t CmdWatchDisable (int nArgs)
Update_t CmdWatchEnable (int nArgs) Update_t CmdWatchEnable (int nArgs)
{ {
if (! g_nWatches) if (! g_nWatches)
return ConsoleDisplayError(TEXT("There are no watches defined.")); return ConsoleDisplayError("There are no watches defined.");
if (!nArgs) if (!nArgs)
return Help_Arg_1( CMD_WATCH_ENABLE ); return Help_Arg_1( CMD_WATCH_ENABLE );
@ -6798,8 +6763,7 @@ Update_t CmdWatchList (int nArgs)
{ {
if (! g_nWatches) if (! g_nWatches)
{ {
TCHAR sText[ CONSOLE_WIDTH ]; ConsoleBufferPushFormat( " There are no current watches. (Max: %d)", MAX_WATCHES );
ConsoleBufferPushFormat( sText, TEXT(" There are no current watches. (Max: %d)"), MAX_WATCHES );
} }
else else
{ {
@ -7242,9 +7206,7 @@ Update_t CmdZeroPageAdd (int nArgs)
if ((iZP >= MAX_ZEROPAGE_POINTERS) && !bAdded) if ((iZP >= MAX_ZEROPAGE_POINTERS) && !bAdded)
{ {
char sText[ CONSOLE_WIDTH ]; ConsoleDisplayPushFormat( "All zero page pointers are currently in use. (Max: %d)", MAX_ZEROPAGE_POINTERS );
sprintf( sText, "All zero page pointers are currently in use. (Max: %d)", MAX_ZEROPAGE_POINTERS );
ConsoleDisplayPush( sText );
return ConsoleUpdate(); return ConsoleUpdate();
} }
@ -7272,10 +7234,8 @@ _Help:
Update_t _ZeroPage_Error() Update_t _ZeroPage_Error()
{ {
// return ConsoleDisplayError( "There are no (ZP) pointers defined." ); // return ConsoleDisplayError( "There are no (ZP) pointers defined." );
char sText[ CONSOLE_WIDTH ]; // ConsoleBufferPushFormat( " There are no current (ZP) pointers. (Max: %d)", MAX_ZEROPAGE_POINTERS );
sprintf( sText, " There are no current (ZP) pointers. (Max: %d)", MAX_ZEROPAGE_POINTERS ); return ConsoleDisplayErrorFormat( " There are no current (ZP) pointers. (Max: %d)", MAX_ZEROPAGE_POINTERS );
// ConsoleBufferPush( sText );
return ConsoleDisplayError( sText );
} }
//=========================================================================== //===========================================================================
@ -7519,8 +7479,7 @@ int FindCommand( LPCTSTR pName, CmdFuncPtr_t & pFunction_, int * iCommand_ )
//=========================================================================== //===========================================================================
void DisplayAmbigiousCommands( int nFound ) void DisplayAmbigiousCommands( int nFound )
{ {
char sText[ CONSOLE_WIDTH * 2 ]; ConsolePrintFormat("Ambiguous %s%d%s Commands:"
ConsolePrintFormat( sText, "Ambiguous %s%d%s Commands:"
, CHC_NUM_DEC , CHC_NUM_DEC
, g_vPotentialCommands.size() , g_vPotentialCommands.size()
, CHC_DEFAULT , CHC_DEFAULT
@ -7542,6 +7501,7 @@ void DisplayAmbigiousCommands( int nFound )
if ((iWidth + nLen) >= (CONSOLE_WIDTH - 1)) if ((iWidth + nLen) >= (CONSOLE_WIDTH - 1))
break; break;
char sText[ CONSOLE_WIDTH * 2 ];
sprintf( sText, "%s ", pName ); sprintf( sText, "%s ", pName );
strcat( sPotentialCommands, sText ); strcat( sPotentialCommands, sText );
iWidth += nLen + 1; iWidth += nLen + 1;
@ -7707,9 +7667,8 @@ Update_t ExecuteCommand (int nArgs)
if( bFoundSrc && bFoundLen ) if( bFoundSrc && bFoundLen )
{ {
//ArgsGetValue( pArg, & nAddress ); //ArgsGetValue( pArg, & nAddress );
//char sText[ CONSOLE_WIDTH ]; //ConsolePrintFormat( "Dst:%s Src: %s End: %s", pDst, pSrc, pEnd );
//ConsolePrintFormat( sText, "Dst:%s Src: %s End: %s", pDst, pSrc, pEnd );
g_iCommand = CMD_MEMORY_MOVE; g_iCommand = CMD_MEMORY_MOVE;
pFunction = g_aCommands[ g_iCommand ].pFunction; pFunction = g_aCommands[ g_iCommand ].pFunction;
@ -8461,7 +8420,6 @@ void DebugContinueStepping(const bool bCallerWillUpdateDisplay/*=false*/)
if (regs.pc == g_nDebugStepUntil || g_bDebugBreakpointHit) if (regs.pc == g_nDebugStepUntil || g_bDebugBreakpointHit)
{ {
TCHAR sText[ CONSOLE_WIDTH ];
char szStopMessage[CONSOLE_WIDTH]; char szStopMessage[CONSOLE_WIDTH];
const char* pszStopReason = szStopMessage; const char* pszStopReason = szStopMessage;
@ -8490,7 +8448,7 @@ void DebugContinueStepping(const bool bCallerWillUpdateDisplay/*=false*/)
else else
pszStopReason = TEXT("Unknown!"); pszStopReason = TEXT("Unknown!");
ConsoleBufferPushFormat( sText, TEXT("Stop reason: %s"), pszStopReason ); ConsoleBufferPushFormat( "Stop reason: %s", pszStopReason );
ConsoleUpdate(); ConsoleUpdate();
g_nDebugSteps = 0; g_nDebugSteps = 0;
@ -8706,7 +8664,6 @@ void DebugInitialize ()
#endif #endif
// ConsoleInputReset(); already called in DebugInitialize() // ConsoleInputReset(); already called in DebugInitialize()
TCHAR sText[ CONSOLE_WIDTH ];
VerifyDebuggerCommandTable(); VerifyDebuggerCommandTable();
@ -8719,8 +8676,7 @@ void DebugInitialize ()
int nLen = _tcslen( pHelp ) + 2; int nLen = _tcslen( pHelp ) + 2;
if (nLen > (CONSOLE_WIDTH-1)) if (nLen > (CONSOLE_WIDTH-1))
{ {
ConsoleBufferPushFormat( sText, TEXT("Warning: %s help is %d chars"), ConsoleBufferPushFormat( "Warning: %s help is %d chars", pHelp, nLen );
pHelp, nLen );
} }
} }
} }
@ -8819,8 +8775,6 @@ Update_t DebuggerProcessCommand ( const bool bEchoConsoleInput )
{ {
Update_t bUpdateDisplay = UPDATE_NOTHING; Update_t bUpdateDisplay = UPDATE_NOTHING;
char sText[ CONSOLE_WIDTH ];
if (bEchoConsoleInput) if (bEchoConsoleInput)
ConsoleDisplayPush( ConsoleInputPeek() ); ConsoleDisplayPush( ConsoleInputPeek() );
@ -8838,8 +8792,7 @@ Update_t DebuggerProcessCommand ( const bool bEchoConsoleInput )
int nDelayedTargets = AssemblerDelayedTargetsSize(); int nDelayedTargets = AssemblerDelayedTargetsSize();
if (nDelayedTargets) if (nDelayedTargets)
{ {
sprintf( sText, " Asm: %d sym declared, not defined", nDelayedTargets ); ConsoleDisplayPushFormat( " Asm: %d sym declared, not defined", nDelayedTargets );
ConsoleDisplayPush( sText );
bUpdateDisplay |= UPDATE_CONSOLE_DISPLAY; bUpdateDisplay |= UPDATE_CONSOLE_DISPLAY;
} }
} }
@ -8856,8 +8809,7 @@ Update_t DebuggerProcessCommand ( const bool bEchoConsoleInput )
int nArgs = ParseInput( g_pConsoleInput ); int nArgs = ParseInput( g_pConsoleInput );
if (nArgs == ARG_SYNTAX_ERROR) if (nArgs == ARG_SYNTAX_ERROR)
{ {
sprintf( sText, "Syntax error: %s", g_aArgs[0].sArg ); bUpdateDisplay |= ConsoleDisplayErrorFormat( "Syntax error: %s", g_aArgs[0].sArg );
bUpdateDisplay |= ConsoleDisplayError( sText );
} }
else else
{ {

View File

@ -876,8 +876,7 @@ Hash_t AssemblerHashMnemonic ( const TCHAR * pMnemonic )
static int nMaxLen = 0; static int nMaxLen = 0;
if (nMaxLen < nLen) { if (nMaxLen < nLen) {
nMaxLen = nLen; nMaxLen = nLen;
char sText[CONSOLE_WIDTH * 3]; ConsolePrintFormat( "New Max Len: %d %s", nMaxLen, pMnemonic );
ConsolePrintFormat( sText, "New Max Len: %d %s", nMaxLen, pMnemonic );
} }
#endif #endif
@ -912,8 +911,7 @@ void AssemblerHashOpcodes ()
g_aOpcodesHash[ iOpcode ] = nMnemonicHash; g_aOpcodesHash[ iOpcode ] = nMnemonicHash;
#if DEBUG_ASSEMBLER #if DEBUG_ASSEMBLER
//OutputDebugString( "" ); //OutputDebugString( "" );
char sText[ 128 ]; ConsolePrintFormat( "%s : %08X ", pMnemonic, nMnemonicHash );
ConsolePrintFormat( sText, "%s : %08X ", pMnemonic, nMnemonicHash );
// CLC: 002B864 // CLC: 002B864
#endif #endif
} }
@ -949,7 +947,6 @@ void _CmdAssembleHashDump ()
// #if DEBUG_ASM_HASH // #if DEBUG_ASM_HASH
std::vector<HashOpcode_t> vHashes; std::vector<HashOpcode_t> vHashes;
HashOpcode_t tHash; HashOpcode_t tHash;
TCHAR sText[ CONSOLE_WIDTH ];
int iOpcode; int iOpcode;
for( iOpcode = 0; iOpcode < NUM_OPCODES; iOpcode++ ) for( iOpcode = 0; iOpcode < NUM_OPCODES; iOpcode++ )
@ -972,7 +969,7 @@ void _CmdAssembleHashDump ()
int nOpcode = tHash.m_iOpcode; int nOpcode = tHash.m_iOpcode;
int nOpmode = g_aOpcodes[ nOpcode ].nAddressMode; int nOpmode = g_aOpcodes[ nOpcode ].nAddressMode;
ConsoleBufferPushFormat( sText, "%08X %02X %s %s" ConsoleBufferPushFormat( "%08X %02X %s %s"
, iThisHash , iThisHash
, nOpcode , nOpcode
, g_aOpcodes65C02[ nOpcode ].sMnemonic , g_aOpcodes65C02[ nOpcode ].sMnemonic
@ -982,7 +979,7 @@ void _CmdAssembleHashDump ()
// if (nPrevHash != iThisHash) // if (nPrevHash != iThisHash)
// { // {
// ConsoleBufferPushFormat( sText, "Total: %d", nThisHash ); // ConsoleBufferPushFormat( "Total: %d", nThisHash );
// nThisHash = 0; // nThisHash = 0;
// } // }
} }
@ -1000,7 +997,7 @@ int AssemblerPokeAddress( const int Opcode, const int nOpmode, const WORD nBaseA
int nOpbytes = g_aOpmodes[ nOpmode ].m_nBytes; int nOpbytes = g_aOpmodes[ nOpmode ].m_nBytes;
// if (nOpbytes != nBytes) // if (nOpbytes != nBytes)
// ConsoleDisplayError( TEXT(" ERROR: Input Opcode bytes differs from actual!" ) ); // ConsoleDisplayError( " ERROR: Input Opcode bytes differs from actual!" );
*(memdirty + (nBaseAddress >> 8)) |= 1; *(memdirty + (nBaseAddress >> 8)) |= 1;
// *(mem + nBaseAddress) = (BYTE) nOpcode; // *(mem + nBaseAddress) = (BYTE) nOpcode;
@ -1477,8 +1474,7 @@ bool Assemble( int iArg, int nArgs, WORD nAddress )
Hash_t nMnemonicHash = AssemblerHashMnemonic( pMnemonic ); Hash_t nMnemonicHash = AssemblerHashMnemonic( pMnemonic );
#if DEBUG_ASSEMBLER #if DEBUG_ASSEMBLER
char sText[ CONSOLE_WIDTH * 2 ]; ConsolePrintFormat( "%s%04X%s: %s%s%s -> %s%08X",
ConsolePrintFormat( sText, "%s%04X%s: %s%s%s -> %s%08X",
CHC_ADDRESS, nAddress, CHC_ADDRESS, nAddress,
CHC_DEFAULT, CHC_DEFAULT,
CHC_STRING, pMnemonic, CHC_STRING, pMnemonic,

View File

@ -29,6 +29,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "StdAfx.h" #include "StdAfx.h"
#include "Debug.h" #include "Debug.h"
#include "StrFormat.h"
// Console ________________________________________________________________________________________ // Console ________________________________________________________________________________________
@ -114,7 +115,7 @@ const conchar_t* ConsoleBufferPeek ()
//=========================================================================== //===========================================================================
bool ConsolePrint ( const char * pText ) void ConsolePrint ( const char * pText )
{ {
while (g_nConsoleBuffer >= CONSOLE_BUFFER_HEIGHT) while (g_nConsoleBuffer >= CONSOLE_BUFFER_HEIGHT)
{ {
@ -258,26 +259,12 @@ bool ConsolePrint ( const char * pText )
} }
*pDst = 0; *pDst = 0;
g_nConsoleBuffer++; g_nConsoleBuffer++;
return true;
}
bool ConsolePrintVa ( char* buf, size_t bufsz, const char * pFormat, va_list va )
{
vsnprintf_s(buf, bufsz, _TRUNCATE, pFormat, va);
return ConsolePrint(buf);
}
bool ConsoleBufferPushVa ( char* buf, size_t bufsz, const char * pFormat, va_list va )
{
vsnprintf_s(buf, bufsz, _TRUNCATE, pFormat, va);
return ConsoleBufferPush(buf);
} }
// Add string to buffered output // Add string to buffered output
// Shifts the buffered console output lines "Up" // Shifts the buffered console output lines "Up"
//=========================================================================== //===========================================================================
bool ConsoleBufferPush ( const char * pText ) void ConsoleBufferPush ( const char * pText )
{ {
while (g_nConsoleBuffer >= CONSOLE_BUFFER_HEIGHT) while (g_nConsoleBuffer >= CONSOLE_BUFFER_HEIGHT)
{ {
@ -318,8 +305,6 @@ bool ConsoleBufferPush ( const char * pText )
} }
*pDst = 0; *pDst = 0;
g_nConsoleBuffer++; g_nConsoleBuffer++;
return true;
} }
// Shifts the buffered console output "down" // Shifts the buffered console output "down"
@ -366,7 +351,7 @@ void ConsoleConvertFromText ( conchar_t * sText, const char * pText )
} }
//=========================================================================== //===========================================================================
Update_t ConsoleDisplayError ( const char * pText) Update_t ConsoleDisplayError ( const char * pText )
{ {
ConsoleBufferPush( pText ); ConsoleBufferPush( pText );
return ConsoleUpdate(); return ConsoleUpdate();
@ -473,7 +458,7 @@ bool ConsoleInputClear ()
} }
//=========================================================================== //===========================================================================
bool ConsoleInputChar ( const char ch ) bool ConsoleInputChar ( char ch )
{ {
if (g_nConsoleInputChars < g_nConsoleDisplayWidth) // bug? include prompt? if (g_nConsoleInputChars < g_nConsoleDisplayWidth) // bug? include prompt?
{ {

View File

@ -3,6 +3,8 @@
#include <cstdarg> #include <cstdarg>
#include "StrFormat.h"
enum enum
{ {
// Basic Symbol table has > 600 symbols // Basic Symbol table has > 600 symbols
@ -255,76 +257,78 @@
// Console // Console
// Buffered // Buffered
bool ConsolePrint( const char * pText ); void ConsolePrint( const char * pText );
bool ConsolePrintVa( char* buf, size_t bufsz, const char* pFormat, va_list va ); inline void ConsolePrintVa( const char* pFormat, va_list va )
template<size_t _BufSz>
inline bool ConsolePrintVa( char (&buf)[_BufSz], const char* pFormat, va_list va )
{ {
return ConsolePrintVa(buf, _BufSz, pFormat, va); std::string strText = StrFormatV(pFormat, va);
ConsolePrint(strText.c_str());
} }
inline bool ConsolePrintFormat( char* buf, size_t bufsz, const char* pFormat, ... ) inline void ConsolePrintFormat( const char* pFormat, ... ) ATTRIBUTE_FORMAT_PRINTF(1, 2)
{ {
va_list va; va_list va;
va_start(va, pFormat); va_start(va, pFormat);
bool const r = ConsolePrintVa(buf, bufsz, pFormat, va); ConsolePrintVa(pFormat, va);
va_end(va); va_end(va);
return r;
}
template<size_t _BufSz>
inline bool ConsolePrintFormat( char(&buf)[_BufSz], const char* pFormat, ... )
{
va_list va;
va_start(va, pFormat);
bool const r = ConsolePrintVa(buf, pFormat, va);
va_end(va);
return r;
} }
void ConsoleBufferToDisplay (); void ConsoleBufferToDisplay();
const conchar_t* ConsoleBufferPeek (); const conchar_t* ConsoleBufferPeek();
void ConsoleBufferPop (); void ConsoleBufferPop();
bool ConsoleBufferPush( const char * pString ); void ConsoleBufferPush( const char * pString );
bool ConsoleBufferPushVa( char* buf, size_t bufsz, const char* pFormat, va_list va ); inline void ConsoleBufferPushVa( const char* pFormat, va_list va )
template<size_t _BufSz>
inline bool ConsoleBufferPushVa( char (&buf)[_BufSz], const char* pFormat, va_list va )
{ {
return ConsoleBufferPushVa(buf, _BufSz, pFormat, va); std::string strText = StrFormatV(pFormat, va);
ConsoleBufferPush(strText.c_str());
} }
inline bool ConsoleBufferPushFormat( char* buf, size_t bufsz, const char* pFormat, ... ) inline void ConsoleBufferPushFormat( const char* pFormat, ... ) ATTRIBUTE_FORMAT_PRINTF(1, 2)
{ {
va_list va; va_list va;
va_start(va, pFormat); va_start(va, pFormat);
bool const r = ConsoleBufferPushVa(buf, bufsz, pFormat, va); ConsoleBufferPushVa(pFormat, va);
va_end(va); va_end(va);
return r;
}
template<size_t _BufSz>
inline bool ConsoleBufferPushFormat( char(&buf)[_BufSz], const char* pFormat, ... )
{
va_list va;
va_start(va, pFormat);
bool const r = ConsoleBufferPushVa(buf, pFormat, va);
va_end(va);
return r;
} }
void ConsoleConvertFromText( conchar_t * sText, const char * pText ); void ConsoleConvertFromText( conchar_t * sText, const char * pText );
// Display // Display
Update_t ConsoleDisplayError ( const char * pTextError ); Update_t ConsoleDisplayError( const char * pTextError );
void ConsoleDisplayPause (); inline Update_t ConsoleDisplayErrorVa(const char* pFormat, va_list va)
void ConsoleDisplayPush ( const char * pText ); {
std::string strText = StrFormatV(pFormat, va);
return ConsoleDisplayError(strText.c_str());
}
inline Update_t ConsoleDisplayErrorFormat(const char* pFormat, ...) ATTRIBUTE_FORMAT_PRINTF(1, 2)
{
va_list va;
va_start(va, pFormat);
Update_t const r = ConsoleDisplayErrorVa(pFormat, va);
va_end(va);
return r;
}
void ConsoleDisplayPause();
void ConsoleDisplayPush( const char * pText );
inline void ConsoleDisplayPushVa(const char* pFormat, va_list va)
{
std::string strText = StrFormatV(pFormat, va);
ConsoleDisplayPush(strText.c_str());
}
inline void ConsoleDisplayPushFormat(const char* pFormat, ...) ATTRIBUTE_FORMAT_PRINTF(1, 2)
{
va_list va;
va_start(va, pFormat);
ConsoleDisplayPushVa(pFormat, va);
va_end(va);
}
void ConsoleDisplayPush ( const conchar_t * pText ); void ConsoleDisplayPush ( const conchar_t * pText );
Update_t ConsoleUpdate (); Update_t ConsoleUpdate ();
void ConsoleFlush (); void ConsoleFlush ();
// Input // Input
void ConsoleInputToDisplay ();
const char *ConsoleInputPeek (); const char *ConsoleInputPeek ();
bool ConsoleInputClear (); bool ConsoleInputClear ();
bool ConsoleInputBackSpace (); bool ConsoleInputBackSpace ();
bool ConsoleInputChar ( TCHAR ch ); bool ConsoleInputChar ( char ch );
void ConsoleInputReset (); void ConsoleInputReset ();
int ConsoleInputTabCompletion (); int ConsoleInputTabCompletion ();

View File

@ -348,10 +348,9 @@ Update_t CmdDisasmDataList (int nArgs)
{ {
int nLen = strlen( pData->sSymbol ); int nLen = strlen( pData->sSymbol );
char sText[CONSOLE_WIDTH * 2];
// <smbol> <type> <start>:<end> // <smbol> <type> <start>:<end>
// `TEST `300`:`320 // `TEST `300`:`320
ConsolePrintFormat( sText, "%s%s %s%*s %s%04X%s:%s%04X" ConsolePrintFormat( "%s%s %s%*s %s%04X%s:%s%04X"
, CHC_CATEGORY , CHC_CATEGORY
, g_aNopcodeTypes[ pData->eElementType ] , g_aNopcodeTypes[ pData->eElementType ]
, (nLen > 0) ? CHC_SYMBOL : CHC_DEFAULT , (nLen > 0) ? CHC_SYMBOL : CHC_DEFAULT

File diff suppressed because it is too large Load Diff

View File

@ -96,7 +96,7 @@ Update_t _PrintSymbolInvalidTable()
// TODO: display the user specified file name // TODO: display the user specified file name
ConsoleBufferPush( "Invalid symbol table." ); ConsoleBufferPush( "Invalid symbol table." );
ConsolePrintFormat( sText, "Only %s%d%s symbol tables are supported:" ConsolePrintFormat( "Only %s%d%s symbol tables are supported:"
, CHC_NUM_DEC, NUM_SYMBOL_TABLES , CHC_NUM_DEC, NUM_SYMBOL_TABLES
, CHC_DEFAULT , CHC_DEFAULT
); );
@ -360,13 +360,11 @@ Update_t CmdSymbolsInfo (int nArgs)
//=========================================================================== //===========================================================================
void _CmdPrintSymbol( LPCTSTR pSymbol, WORD nAddress, int iTable ) void _CmdPrintSymbol( LPCTSTR pSymbol, WORD nAddress, int iTable )
{ {
char sText[ CONSOLE_WIDTH * 2 ];
// 2.6.2.19 Color for name of symbol table: _CmdPrintSymbol() "SYM HOME" _CmdSymbolsInfoHeader "SYM" // 2.6.2.19 Color for name of symbol table: _CmdPrintSymbol() "SYM HOME" _CmdSymbolsInfoHeader "SYM"
// CHC_STRING and CHC_NUM_DEC are both cyan, using CHC_USAGE instead of CHC_STRING // CHC_STRING and CHC_NUM_DEC are both cyan, using CHC_USAGE instead of CHC_STRING
// 2.6.2.20 Changed: Output of found symbol more table friendly. Symbol table name displayed first. // 2.6.2.20 Changed: Output of found symbol more table friendly. Symbol table name displayed first.
ConsolePrintFormat( sText, " %s%s%s: $%s%04X %s%s" ConsolePrintFormat( " %s%s%s: $%s%04X %s%s"
, CHC_USAGE, g_aSymbolTableNames[ iTable ] , CHC_USAGE, g_aSymbolTableNames[ iTable ]
, CHC_ARG_SEP , CHC_ARG_SEP
, CHC_ADDRESS, nAddress , CHC_ADDRESS, nAddress
@ -522,8 +520,7 @@ Update_t _CmdSymbolsListTables (int nArgs, int bSymbolTables )
// nope, ok, try as address // nope, ok, try as address
if (! _CmdSymbolList_Address2Symbol( nAddress, bSymbolTables)) if (! _CmdSymbolList_Address2Symbol( nAddress, bSymbolTables))
{ {
ConsolePrintFormat( sText ConsolePrintFormat( " Address not found: %s$%s%04X%s"
, TEXT(" Address not found: %s$%s%04X%s" )
, CHC_ARG_SEP , CHC_ARG_SEP
, CHC_ADDRESS, nAddress, CHC_DEFAULT ); , CHC_ADDRESS, nAddress, CHC_DEFAULT );
} }
@ -537,16 +534,14 @@ Update_t _CmdSymbolsListTables (int nArgs, int bSymbolTables )
{ {
if (! _CmdSymbolList_Address2Symbol( nAddress, bSymbolTables )) if (! _CmdSymbolList_Address2Symbol( nAddress, bSymbolTables ))
{ {
ConsolePrintFormat( sText ConsolePrintFormat( " %sSymbol not found: %s%s%s"
, TEXT(" %sSymbol not found: %s%s%s")
, CHC_ERROR, CHC_SYMBOL, pSymbol, CHC_DEFAULT , CHC_ERROR, CHC_SYMBOL, pSymbol, CHC_DEFAULT
); );
} }
} }
else else
{ {
ConsolePrintFormat( sText ConsolePrintFormat( " %sSymbol not found: %s%s%s"
, TEXT(" %sSymbol not found: %s%s%s")
, CHC_ERROR, CHC_SYMBOL, pSymbol, CHC_DEFAULT , CHC_ERROR, CHC_SYMBOL, pSymbol, CHC_DEFAULT
); );
} }
@ -560,7 +555,6 @@ Update_t _CmdSymbolsListTables (int nArgs, int bSymbolTables )
//=========================================================================== //===========================================================================
int ParseSymbolTable(const std::string & pPathFileName, SymbolTable_Index_e eSymbolTableWrite, int nSymbolOffset ) int ParseSymbolTable(const std::string & pPathFileName, SymbolTable_Index_e eSymbolTableWrite, int nSymbolOffset )
{ {
char sText[ CONSOLE_WIDTH * 3 ];
bool bFileDisplayed = false; bool bFileDisplayed = false;
const int nMaxLen = MIN(DISASM_DISPLAY_MAX_TARGET_LEN, MAX_SYMBOLS_LEN); const int nMaxLen = MIN(DISASM_DISPLAY_MAX_TARGET_LEN, MAX_SYMBOLS_LEN);
@ -654,7 +648,7 @@ int ParseSymbolTable(const std::string & pPathFileName, SymbolTable_Index_e eSym
int nLen = strlen( sName ); int nLen = strlen( sName );
if (nLen > nMaxLen) if (nLen > nMaxLen)
{ {
ConsolePrintFormat( sText, " %sWarn.: %s%s %s(%s%d %s> %s%d%s)" ConsolePrintFormat( " %sWarn.: %s%s %s(%s%d %s> %s%d%s)"
, CHC_WARNING , CHC_WARNING
, CHC_SYMBOL , CHC_SYMBOL
, sName , sName
@ -678,13 +672,13 @@ int ParseSymbolTable(const std::string & pPathFileName, SymbolTable_Index_e eSym
bFileDisplayed = true; bFileDisplayed = true;
// TODO: Must check for buffer overflow ! // TODO: Must check for buffer overflow !
ConsolePrintFormat( sText, "%s%s" ConsolePrintFormat( "%s%s"
, CHC_PATH , CHC_PATH
, pPathFileName.c_str() , pPathFileName.c_str()
); );
} }
ConsolePrintFormat( sText, " %sInfo.: %s%-16s %saliases %s$%s%04X %s%-12s%s (%s%s%s)" // MAGIC NUMBER: -MAX_SYMBOLS_LEN ConsolePrintFormat( " %sInfo.: %s%-16s %saliases %s$%s%04X %s%-12s%s (%s%s%s)" // MAGIC NUMBER: -MAX_SYMBOLS_LEN
, CHC_INFO // 2.9.0.10 was CHC_WARNING, see #479 , CHC_INFO // 2.9.0.10 was CHC_WARNING, see #479
, CHC_SYMBOL , CHC_SYMBOL
, sName , sName
@ -702,7 +696,7 @@ int ParseSymbolTable(const std::string & pPathFileName, SymbolTable_Index_e eSym
ConsoleUpdate(); // Flush buffered output so we don't ask the user to pause ConsoleUpdate(); // Flush buffered output so we don't ask the user to pause
/* /*
ConsolePrintFormat( sText, " %sWarning: %sAddress already has symbol Name%s (%s%s%s): %s%s" ConsolePrintFormat( " %sWarning: %sAddress already has symbol Name%s (%s%s%s): %s%s"
, CHC_WARNING , CHC_WARNING
, CHC_INFO , CHC_INFO
, CHC_ARG_SEP , CHC_ARG_SEP
@ -713,7 +707,7 @@ int ParseSymbolTable(const std::string & pPathFileName, SymbolTable_Index_e eSym
, pSymbolPrev , pSymbolPrev
); );
ConsolePrintFormat( sText, " %s$%s%04X %s%-31s%s" ConsolePrintFormat( " %s$%s%04X %s%-31s%s"
, CHC_ARG_SEP , CHC_ARG_SEP
, CHC_ADDRESS , CHC_ADDRESS
, nAddress , nAddress
@ -730,7 +724,7 @@ int ParseSymbolTable(const std::string & pPathFileName, SymbolTable_Index_e eSym
if( !bDupSymbolHeader ) if( !bDupSymbolHeader )
{ {
bDupSymbolHeader = true; bDupSymbolHeader = true;
ConsolePrintFormat( sText, " %sDup Symbol Name%s (%s%s%s) %s" ConsolePrintFormat( " %sDup Symbol Name%s (%s%s%s) %s"
, CHC_ERROR , CHC_ERROR
, CHC_DEFAULT , CHC_DEFAULT
, CHC_STRING , CHC_STRING
@ -740,7 +734,7 @@ int ParseSymbolTable(const std::string & pPathFileName, SymbolTable_Index_e eSym
); );
} }
ConsolePrintFormat( sText, " %s$%s%04X %s%-31s%s" ConsolePrintFormat( " %s$%s%04X %s%-31s%s"
, CHC_ARG_SEP , CHC_ARG_SEP
, CHC_ADDRESS , CHC_ADDRESS
, nAddress , nAddress
@ -868,8 +862,7 @@ void SymbolUpdate( SymbolTable_Index_e eSymbolTable, const char *pSymbolName, WO
if (bUpdateSymbol) if (bUpdateSymbol)
{ {
char sText[ CONSOLE_WIDTH * 2 ]; ConsolePrintFormat( " Updating %s%s%s from %s$%s%04X%s to %s$%s%04X%s"
ConsolePrintFormat( sText, " Updating %s%s%s from %s$%s%04X%s to %s$%s%04X%s"
, CHC_SYMBOL, pSymbolName, CHC_DEFAULT , CHC_SYMBOL, pSymbolName, CHC_DEFAULT
, CHC_ARG_SEP , CHC_ARG_SEP
, CHC_ADDRESS, nAddressPrev, CHC_DEFAULT , CHC_ADDRESS, nAddressPrev, CHC_DEFAULT
@ -899,8 +892,7 @@ void SymbolUpdate( SymbolTable_Index_e eSymbolTable, const char *pSymbolName, WO
g_aSymbols[ eSymbolTable ][ nAddress ] = pSymbolName; g_aSymbols[ eSymbolTable ][ nAddress ] = pSymbolName;
// Tell user symbol was added // Tell user symbol was added
char sText[ CONSOLE_WIDTH * 2 ]; ConsolePrintFormat( " Added symbol: %s%s%s %s$%s%04X%s"
ConsolePrintFormat( sText, " Added symbol: %s%s%s %s$%s%04X%s"
, CHC_SYMBOL, pSymbolName, CHC_DEFAULT , CHC_SYMBOL, pSymbolName, CHC_DEFAULT
, CHC_ARG_SEP , CHC_ARG_SEP
, CHC_ADDRESS, nAddress, CHC_DEFAULT , CHC_ADDRESS, nAddress, CHC_DEFAULT
@ -984,7 +976,7 @@ Update_t _CmdSymbolsCommon ( int nArgs, int bSymbolTables )
if (iTable != NUM_SYMBOL_TABLES) if (iTable != NUM_SYMBOL_TABLES)
{ {
Update_t iUpdate = _CmdSymbolsClear( (SymbolTable_Index_e) iTable ); Update_t iUpdate = _CmdSymbolsClear( (SymbolTable_Index_e) iTable );
ConsolePrintFormat( sText, TEXT(" Cleared symbol table: %s%s") ConsolePrintFormat( " Cleared symbol table: %s%s"
, CHC_STRING, g_aSymbolTableNames[ iTable ] , CHC_STRING, g_aSymbolTableNames[ iTable ]
); );
iUpdate |= ConsoleUpdate(); iUpdate |= ConsoleUpdate();

View File

@ -247,9 +247,7 @@ Update_t CmdConfigGetFont(int nArgs)
{ {
for (int iFont = 0; iFont < NUM_FONTS; iFont++) for (int iFont = 0; iFont < NUM_FONTS; iFont++)
{ {
TCHAR sText[CONSOLE_WIDTH] = TEXT(""); ConsoleBufferPushFormat(" Font: %-20s A:%2d M:%2d",
ConsoleBufferPushFormat(sText, " Font: %-20s A:%2d M:%2d",
// g_sFontNameCustom, g_nFontWidthAvg, g_nFontWidthMax );
g_aFontConfig[iFont]._sFontName, g_aFontConfig[iFont]._sFontName,
g_aFontConfig[iFont]._nFontWidthAvg, g_aFontConfig[iFont]._nFontWidthAvg,
g_aFontConfig[iFont]._nFontWidthMax); g_aFontConfig[iFont]._nFontWidthMax);
@ -276,8 +274,7 @@ Update_t CmdConfigFont(int nArgs)
if ((!_tcscmp(g_aArgs[iArg].sArg, g_aParameters[PARAM_WILDSTAR].m_sName)) || if ((!_tcscmp(g_aArgs[iArg].sArg, g_aParameters[PARAM_WILDSTAR].m_sName)) ||
(!_tcscmp(g_aArgs[iArg].sArg, g_aParameters[PARAM_MEM_SEARCH_WILD].m_sName))) (!_tcscmp(g_aArgs[iArg].sArg, g_aParameters[PARAM_MEM_SEARCH_WILD].m_sName)))
{ {
TCHAR sText[CONSOLE_WIDTH]; ConsoleBufferPushFormat("Lines: %d Font Px: %d Line Px: %d"
ConsoleBufferPushFormat(sText, "Lines: %d Font Px: %d Line Px: %d"
, g_nDisasmDisplayLines , g_nDisasmDisplayLines
, g_aFontConfig[FONT_DISASM_DEFAULT]._nFontHeight , g_aFontConfig[FONT_DISASM_DEFAULT]._nFontHeight
, g_aFontConfig[FONT_DISASM_DEFAULT]._nLineHeight); , g_aFontConfig[FONT_DISASM_DEFAULT]._nLineHeight);
@ -355,9 +352,7 @@ void DebuggerMouseClick(int x, int y)
int cy = nOffsetInScreenY / nFontHeight; int cy = nOffsetInScreenY / nFontHeight;
#if _DEBUG #if _DEBUG
char sText[CONSOLE_WIDTH]; ConsoleDisplayPushFormat("x:%d y:%d cx:%d cy:%d", x, y, cx, cy);
sprintf(sText, "x:%d y:%d cx:%d cy:%d", x, y, cx, cy);
ConsoleDisplayPush(sText);
DebugDisplay(); DebugDisplay();
#endif #endif

View File

@ -2,6 +2,8 @@
#include "yaml.h" #include "yaml.h"
#include "StrFormat.h"
#define SS_YAML_KEY_FILEHDR "File_hdr" #define SS_YAML_KEY_FILEHDR "File_hdr"
#define SS_YAML_KEY_TAG "Tag" #define SS_YAML_KEY_TAG "Tag"
#define SS_YAML_KEY_VERSION "Version" #define SS_YAML_KEY_VERSION "Version"
@ -212,7 +214,7 @@ public:
delete[] m_pMbStr; delete[] m_pMbStr;
} }
void Save(const char* format, ...); void Save(const char* format, ...) ATTRIBUTE_FORMAT_PRINTF(1, 2);
void SaveInt(const char* key, int value); void SaveInt(const char* key, int value);
void SaveUint(const char* key, UINT value); void SaveUint(const char* key, UINT value);
@ -233,7 +235,7 @@ public:
class Label class Label
{ {
public: public:
Label(YamlSaveHelper& rYamlSaveHelper, const char* format, ...) : Label(YamlSaveHelper& rYamlSaveHelper, const char* format, ...) ATTRIBUTE_FORMAT_PRINTF(2, 3) :
yamlSaveHelper(rYamlSaveHelper) yamlSaveHelper(rYamlSaveHelper)
{ {
fwrite(yamlSaveHelper.m_szIndent, 1, yamlSaveHelper.m_indent, yamlSaveHelper.m_hFile); fwrite(yamlSaveHelper.m_szIndent, 1, yamlSaveHelper.m_indent, yamlSaveHelper.m_hFile);

View File

@ -54,14 +54,8 @@ Update_t ConsoleUpdate ()
return 0; return 0;
} }
bool ConsoleBufferPush ( const char * pText ) void ConsoleBufferPush ( const char * pText )
{ {
return false;
}
bool ConsoleBufferPushVa ( char* buf, size_t bufsz, const char * pFormat, va_list va )
{
return false;
} }
// From Debugger_DisassemblerData.cpp // From Debugger_DisassemblerData.cpp

View File

@ -41,7 +41,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="..\..\source\Debugger" AdditionalIncludeDirectories="..\..\source\Debugger;..\..\source"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true" MinimalRebuild="true"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
@ -116,7 +116,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="2" Optimization="2"
EnableIntrinsicFunctions="true" EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="..\..\source\Debugger" AdditionalIncludeDirectories="..\..\source\Debugger;..\..\source"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2" RuntimeLibrary="2"
EnableFunctionLevelLinking="true" EnableFunctionLevelLinking="true"
@ -202,6 +202,10 @@
RelativePath=".\stdafx.h" RelativePath=".\stdafx.h"
> >
</File> </File>
<File
RelativePath="..\..\source\StrFormat.cpp"
>
</File>
<File <File
RelativePath=".\TestDebugger.cpp" RelativePath=".\TestDebugger.cpp"
> >