Debugger::parseArgument() now takes an optional outputBase parameter,

which defaults to kBASE_DEFAULT (which means to use the DebuggerParser's
current input base, set with the "base" command).


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@532 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
urchlay 2005-06-20 02:36:39 +00:00
parent 7051819948
commit f3fd39be4c
2 changed files with 10 additions and 6 deletions

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: DebuggerParser.cxx,v 1.17 2005-06-19 16:53:57 urchlay Exp $
// $Id: DebuggerParser.cxx,v 1.18 2005-06-20 02:36:39 urchlay Exp $
//============================================================================
#include "bspf.hxx"
@ -162,7 +162,7 @@ int DebuggerParser::decipher_arg(string &arg) {
// The GUI uses this:
bool DebuggerParser::parseArgument(
string& arg, int *value, char *rendered)
string& arg, int *value, char *rendered, int outputBase=kBASE_DEFAULT)
{
*value = decipher_arg(arg);
@ -171,7 +171,10 @@ bool DebuggerParser::parseArgument(
return false;
}
switch(defaultBase) {
if(outputBase == kBASE_DEFAULT)
outputBase = defaultBase;
switch(outputBase) {
case kBASE_2:
if(*value < 0x100)
sprintf(rendered, Debugger::to_bin_8(*value));

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: DebuggerParser.hxx,v 1.9 2005-06-19 08:29:40 urchlay Exp $
// $Id: DebuggerParser.hxx,v 1.10 2005-06-20 02:36:39 urchlay Exp $
//============================================================================
#ifndef DEBUGGER_PARSER_HXX
@ -29,7 +29,8 @@ class Debugger;
enum {
kBASE_16,
kBASE_10,
kBASE_2
kBASE_2,
kBASE_DEFAULT
};
class DebuggerParser
@ -39,7 +40,7 @@ class DebuggerParser
~DebuggerParser();
string run(const string& command);
bool parseArgument(string& arg, int *value, char *rendered);
bool parseArgument(string& arg, int *value, char *rendered, int outputBase);
void setBase(int base);
private: