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

View File

@ -876,8 +876,7 @@ Hash_t AssemblerHashMnemonic ( const TCHAR * pMnemonic )
static int nMaxLen = 0;
if (nMaxLen < nLen) {
nMaxLen = nLen;
char sText[CONSOLE_WIDTH * 3];
ConsolePrintFormat( sText, "New Max Len: %d %s", nMaxLen, pMnemonic );
ConsolePrintFormat( "New Max Len: %d %s", nMaxLen, pMnemonic );
}
#endif
@ -912,8 +911,7 @@ void AssemblerHashOpcodes ()
g_aOpcodesHash[ iOpcode ] = nMnemonicHash;
#if DEBUG_ASSEMBLER
//OutputDebugString( "" );
char sText[ 128 ];
ConsolePrintFormat( sText, "%s : %08X ", pMnemonic, nMnemonicHash );
ConsolePrintFormat( "%s : %08X ", pMnemonic, nMnemonicHash );
// CLC: 002B864
#endif
}
@ -949,7 +947,6 @@ void _CmdAssembleHashDump ()
// #if DEBUG_ASM_HASH
std::vector<HashOpcode_t> vHashes;
HashOpcode_t tHash;
TCHAR sText[ CONSOLE_WIDTH ];
int iOpcode;
for( iOpcode = 0; iOpcode < NUM_OPCODES; iOpcode++ )
@ -972,7 +969,7 @@ void _CmdAssembleHashDump ()
int nOpcode = tHash.m_iOpcode;
int nOpmode = g_aOpcodes[ nOpcode ].nAddressMode;
ConsoleBufferPushFormat( sText, "%08X %02X %s %s"
ConsoleBufferPushFormat( "%08X %02X %s %s"
, iThisHash
, nOpcode
, g_aOpcodes65C02[ nOpcode ].sMnemonic
@ -982,7 +979,7 @@ void _CmdAssembleHashDump ()
// if (nPrevHash != iThisHash)
// {
// ConsoleBufferPushFormat( sText, "Total: %d", nThisHash );
// ConsoleBufferPushFormat( "Total: %d", nThisHash );
// nThisHash = 0;
// }
}
@ -1000,7 +997,7 @@ int AssemblerPokeAddress( const int Opcode, const int nOpmode, const WORD nBaseA
int nOpbytes = g_aOpmodes[ nOpmode ].m_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;
// *(mem + nBaseAddress) = (BYTE) nOpcode;
@ -1477,8 +1474,7 @@ bool Assemble( int iArg, int nArgs, WORD nAddress )
Hash_t nMnemonicHash = AssemblerHashMnemonic( pMnemonic );
#if DEBUG_ASSEMBLER
char sText[ CONSOLE_WIDTH * 2 ];
ConsolePrintFormat( sText, "%s%04X%s: %s%s%s -> %s%08X",
ConsolePrintFormat( "%s%04X%s: %s%s%s -> %s%08X",
CHC_ADDRESS, nAddress,
CHC_DEFAULT,
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 "Debug.h"
#include "StrFormat.h"
// 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)
{
@ -258,26 +259,12 @@ bool ConsolePrint ( const char * pText )
}
*pDst = 0;
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
// Shifts the buffered console output lines "Up"
//===========================================================================
bool ConsoleBufferPush ( const char * pText )
void ConsoleBufferPush ( const char * pText )
{
while (g_nConsoleBuffer >= CONSOLE_BUFFER_HEIGHT)
{
@ -318,8 +305,6 @@ bool ConsoleBufferPush ( const char * pText )
}
*pDst = 0;
g_nConsoleBuffer++;
return true;
}
// 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 );
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?
{

View File

@ -3,6 +3,8 @@
#include <cstdarg>
#include "StrFormat.h"
enum
{
// Basic Symbol table has > 600 symbols
@ -255,76 +257,78 @@
// Console
// Buffered
bool ConsolePrint( const char * pText );
bool ConsolePrintVa( char* buf, size_t bufsz, const char* pFormat, va_list va );
template<size_t _BufSz>
inline bool ConsolePrintVa( char (&buf)[_BufSz], const char* pFormat, va_list va )
void ConsolePrint( const char * pText );
inline void ConsolePrintVa( 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_start(va, pFormat);
bool const r = ConsolePrintVa(buf, bufsz, pFormat, va);
ConsolePrintVa(pFormat, 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 ();
const conchar_t* ConsoleBufferPeek ();
void ConsoleBufferPop ();
void ConsoleBufferToDisplay();
const conchar_t* ConsoleBufferPeek();
void ConsoleBufferPop();
bool ConsoleBufferPush( const char * pString );
bool ConsoleBufferPushVa( char* buf, size_t bufsz, const char* pFormat, va_list va );
template<size_t _BufSz>
inline bool ConsoleBufferPushVa( char (&buf)[_BufSz], const char* pFormat, va_list va )
void ConsoleBufferPush( const char * pString );
inline void ConsoleBufferPushVa( 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_start(va, pFormat);
bool const r = ConsoleBufferPushVa(buf, bufsz, pFormat, va);
ConsoleBufferPushVa(pFormat, 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 );
// Display
Update_t ConsoleDisplayError ( const char * pTextError );
void ConsoleDisplayPause ();
void ConsoleDisplayPush ( const char * pText );
Update_t ConsoleDisplayError( const char * pTextError );
inline Update_t ConsoleDisplayErrorVa(const char* pFormat, va_list va)
{
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 );
Update_t ConsoleUpdate ();
void ConsoleFlush ();
// Input
void ConsoleInputToDisplay ();
const char *ConsoleInputPeek ();
bool ConsoleInputClear ();
bool ConsoleInputBackSpace ();
bool ConsoleInputChar ( TCHAR ch );
bool ConsoleInputChar ( char ch );
void ConsoleInputReset ();
int ConsoleInputTabCompletion ();

View File

@ -348,10 +348,9 @@ Update_t CmdDisasmDataList (int nArgs)
{
int nLen = strlen( pData->sSymbol );
char sText[CONSOLE_WIDTH * 2];
// <smbol> <type> <start>:<end>
// `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
, g_aNopcodeTypes[ pData->eElementType ]
, (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
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_DEFAULT
);
@ -360,13 +360,11 @@ Update_t CmdSymbolsInfo (int nArgs)
//===========================================================================
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"
// 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.
ConsolePrintFormat( sText, " %s%s%s: $%s%04X %s%s"
ConsolePrintFormat( " %s%s%s: $%s%04X %s%s"
, CHC_USAGE, g_aSymbolTableNames[ iTable ]
, CHC_ARG_SEP
, CHC_ADDRESS, nAddress
@ -522,8 +520,7 @@ Update_t _CmdSymbolsListTables (int nArgs, int bSymbolTables )
// nope, ok, try as address
if (! _CmdSymbolList_Address2Symbol( nAddress, bSymbolTables))
{
ConsolePrintFormat( sText
, TEXT(" Address not found: %s$%s%04X%s" )
ConsolePrintFormat( " Address not found: %s$%s%04X%s"
, CHC_ARG_SEP
, CHC_ADDRESS, nAddress, CHC_DEFAULT );
}
@ -537,16 +534,14 @@ Update_t _CmdSymbolsListTables (int nArgs, int bSymbolTables )
{
if (! _CmdSymbolList_Address2Symbol( nAddress, bSymbolTables ))
{
ConsolePrintFormat( sText
, TEXT(" %sSymbol not found: %s%s%s")
ConsolePrintFormat( " %sSymbol not found: %s%s%s"
, CHC_ERROR, CHC_SYMBOL, pSymbol, CHC_DEFAULT
);
}
}
else
{
ConsolePrintFormat( sText
, TEXT(" %sSymbol not found: %s%s%s")
ConsolePrintFormat( " %sSymbol not found: %s%s%s"
, 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 )
{
char sText[ CONSOLE_WIDTH * 3 ];
bool bFileDisplayed = false;
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 );
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_SYMBOL
, sName
@ -678,13 +672,13 @@ int ParseSymbolTable(const std::string & pPathFileName, SymbolTable_Index_e eSym
bFileDisplayed = true;
// TODO: Must check for buffer overflow !
ConsolePrintFormat( sText, "%s%s"
ConsolePrintFormat( "%s%s"
, CHC_PATH
, 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_SYMBOL
, 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
/*
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_INFO
, CHC_ARG_SEP
@ -713,7 +707,7 @@ int ParseSymbolTable(const std::string & pPathFileName, SymbolTable_Index_e eSym
, pSymbolPrev
);
ConsolePrintFormat( sText, " %s$%s%04X %s%-31s%s"
ConsolePrintFormat( " %s$%s%04X %s%-31s%s"
, CHC_ARG_SEP
, CHC_ADDRESS
, nAddress
@ -730,7 +724,7 @@ int ParseSymbolTable(const std::string & pPathFileName, SymbolTable_Index_e eSym
if( !bDupSymbolHeader )
{
bDupSymbolHeader = true;
ConsolePrintFormat( sText, " %sDup Symbol Name%s (%s%s%s) %s"
ConsolePrintFormat( " %sDup Symbol Name%s (%s%s%s) %s"
, CHC_ERROR
, CHC_DEFAULT
, 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_ADDRESS
, nAddress
@ -868,8 +862,7 @@ void SymbolUpdate( SymbolTable_Index_e eSymbolTable, const char *pSymbolName, WO
if (bUpdateSymbol)
{
char sText[ CONSOLE_WIDTH * 2 ];
ConsolePrintFormat( sText, " Updating %s%s%s from %s$%s%04X%s to %s$%s%04X%s"
ConsolePrintFormat( " Updating %s%s%s from %s$%s%04X%s to %s$%s%04X%s"
, CHC_SYMBOL, pSymbolName, CHC_DEFAULT
, CHC_ARG_SEP
, CHC_ADDRESS, nAddressPrev, CHC_DEFAULT
@ -899,8 +892,7 @@ void SymbolUpdate( SymbolTable_Index_e eSymbolTable, const char *pSymbolName, WO
g_aSymbols[ eSymbolTable ][ nAddress ] = pSymbolName;
// Tell user symbol was added
char sText[ CONSOLE_WIDTH * 2 ];
ConsolePrintFormat( sText, " Added symbol: %s%s%s %s$%s%04X%s"
ConsolePrintFormat( " Added symbol: %s%s%s %s$%s%04X%s"
, CHC_SYMBOL, pSymbolName, CHC_DEFAULT
, CHC_ARG_SEP
, CHC_ADDRESS, nAddress, CHC_DEFAULT
@ -984,7 +976,7 @@ Update_t _CmdSymbolsCommon ( int nArgs, int bSymbolTables )
if (iTable != NUM_SYMBOL_TABLES)
{
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 ]
);
iUpdate |= ConsoleUpdate();

View File

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

View File

@ -2,6 +2,8 @@
#include "yaml.h"
#include "StrFormat.h"
#define SS_YAML_KEY_FILEHDR "File_hdr"
#define SS_YAML_KEY_TAG "Tag"
#define SS_YAML_KEY_VERSION "Version"
@ -212,7 +214,7 @@ public:
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 SaveUint(const char* key, UINT value);
@ -233,7 +235,7 @@ public:
class Label
{
public:
Label(YamlSaveHelper& rYamlSaveHelper, const char* format, ...) :
Label(YamlSaveHelper& rYamlSaveHelper, const char* format, ...) ATTRIBUTE_FORMAT_PRINTF(2, 3) :
yamlSaveHelper(rYamlSaveHelper)
{
fwrite(yamlSaveHelper.m_szIndent, 1, yamlSaveHelper.m_indent, yamlSaveHelper.m_hFile);

View File

@ -54,14 +54,8 @@ Update_t ConsoleUpdate ()
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

View File

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