From f3fd39be4c444d4a3e27e243e73d49bfaa8ac6fc Mon Sep 17 00:00:00 2001 From: urchlay Date: Mon, 20 Jun 2005 02:36:39 +0000 Subject: [PATCH] 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 --- stella/src/debugger/DebuggerParser.cxx | 9 ++++++--- stella/src/debugger/DebuggerParser.hxx | 7 ++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/stella/src/debugger/DebuggerParser.cxx b/stella/src/debugger/DebuggerParser.cxx index 0f493eba0..e65429619 100644 --- a/stella/src/debugger/DebuggerParser.cxx +++ b/stella/src/debugger/DebuggerParser.cxx @@ -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)); diff --git a/stella/src/debugger/DebuggerParser.hxx b/stella/src/debugger/DebuggerParser.hxx index 6a5aec51f..ef79474d7 100644 --- a/stella/src/debugger/DebuggerParser.hxx +++ b/stella/src/debugger/DebuggerParser.hxx @@ -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: