Symbol file loading can now handle UNIX (\n), DOS/Windows (\r\n), or

Mac Classic (\r) line terminators, on all platforms.

Loading a symbol file now makes the ROM widget re-disassemble, so you can
actually see the symbols...


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@856 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
urchlay 2005-10-23 15:54:55 +00:00
parent 8ef299f67e
commit 8dcf950087
2 changed files with 23 additions and 14 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.85 2005-10-22 15:43:16 stephena Exp $
// $Id: DebuggerParser.cxx,v 1.86 2005-10-23 15:54:54 urchlay Exp $
//============================================================================
#include "bspf.hxx"
@ -1565,6 +1565,7 @@ void DebuggerParser::executeLoadlist() {
// "loadsym"
void DebuggerParser::executeLoadsym() {
commandResult = debugger->equateList->loadFile(argStrings[0]);
debugger->myRom->invalidate();
}
// "n"

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: EquateList.cxx,v 1.19 2005-10-11 17:14:34 stephena Exp $
// $Id: EquateList.cxx,v 1.20 2005-10-23 15:54:55 urchlay Exp $
//============================================================================
#include <string>
@ -208,9 +208,9 @@ bool EquateList::saveFile(string file)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string EquateList::loadFile(string file)
{
int lines = 0, curVal;
int pos = 0, lines = 0, curVal;
string curLabel;
char buffer[256]; // FIXME: static buffers suck
char line[1024];
ifstream in(file.c_str());
if(!in.is_open())
@ -224,18 +224,26 @@ string EquateList::loadFile(string file)
curVal = 0;
curLabel = "";
if(!in.getline(buffer, 255))
break;
int got = in.get();
if(buffer[0] != '-')
if(got == -1 || got == '\r' || got == '\n' || pos == 1023) {
line[pos] = '\0';
pos = 0;
if(strlen(line) > 0 && line[0] != '-')
{
curLabel = extractLabel(line);
if((curVal = extractValue(line)) < 0)
return "invalid symbol file";
addEquate(curLabel, curVal);
lines++;
}
}
else
{
curLabel = extractLabel(buffer);
if((curVal = extractValue(buffer)) < 0)
return "invalid symbol file";
addEquate(curLabel, curVal);
lines++;
line[pos++] = got;
}
}
in.close();