Store and lookup system labels (aka, equates) in case-insensitive manner.

This fixes a bug in the debugger parser, where typing (for example)
'trap swchb' doesn't work but 'trap SWCHB' does.
This commit is contained in:
Stephen Anthony 2017-07-04 19:50:32 -02:30
parent 087fccd29f
commit d88969adcb
2 changed files with 13 additions and 1 deletions

View File

@ -46,6 +46,17 @@ CartDebug::CartDebug(Debugger& dbg, Console& console, const OSystem& osystem)
myRWPortAddress(0),
myLabelLength(8) // longest pre-defined label
{
// Add case sensitive compare for user labels
// TODO - should user labels be case insensitive too?
auto usrCmp = [](const string& a, const string& b) { return a < b; };
myUserAddresses = LabelToAddr(usrCmp);
// Add case insensitive compare for system labels
auto sysCmp = [](const string& a, const string& b) {
return BSPF::compareIgnoreCase(a, b) < 0;
};
mySystemAddresses = LabelToAddr(sysCmp);
// Add Zero-page RAM addresses
for(uInt32 i = 0x80; i <= 0xFF; ++i)
{

View File

@ -271,7 +271,8 @@ class CartDebug : public DebuggerSystem
private:
using AddrToLabel = std::map<uInt16, string>;
using LabelToAddr = std::map<string, uInt16>;
using LabelToAddr = std::map<string, uInt16,
std::function<bool(const string&, const string&)>>;
struct DirectiveTag {
DisasmType type;