mirror of
https://github.com/markdavidlong/AppleSAWS.git
synced 2024-11-15 15:05:38 +00:00
Continued work on assembler metadata dialog
This commit is contained in:
parent
0badceb216
commit
cea53aadd5
@ -8,17 +8,17 @@ AssemblerSymbols::AssemblerSymbols(QObject *parent) : QObject(parent)
|
||||
bool AssemblerSymbols::hasAssemSymbolAtAddress(quint16 address)
|
||||
{
|
||||
// Assume list m_assemblerSymbols is sorted by address (it should be)
|
||||
QListIterator<AssemSymbol> it(m_assemblerSymbols);
|
||||
QListIterator<AssemblerSymbol> it(m_assemblerSymbols);
|
||||
while (it.hasNext())
|
||||
{
|
||||
AssemSymbol ep = it.next();
|
||||
AssemblerSymbol ep = it.next();
|
||||
if (ep.address == address) return true;
|
||||
if (ep.address > address) return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void AssemblerSymbols::editSymbol(int location, AssemSymbol newSymbol)
|
||||
void AssemblerSymbols::editSymbol(int location, AssemblerSymbol newSymbol)
|
||||
{
|
||||
|
||||
if (m_assemblerSymbols.at(location).address == newSymbol.address)
|
||||
@ -33,7 +33,7 @@ void AssemblerSymbols::editSymbol(int location, AssemSymbol newSymbol)
|
||||
}
|
||||
}
|
||||
|
||||
void AssemblerSymbols::addSymbol(AssemSymbol ep)
|
||||
void AssemblerSymbols::addSymbol(AssemblerSymbol ep)
|
||||
{
|
||||
if (hasAssemSymbolAtAddress(ep.address)) return;
|
||||
|
||||
@ -88,14 +88,14 @@ QDataStream &operator>>(QDataStream &in, AssemblerSymbols&model)
|
||||
return model.read(in);
|
||||
}
|
||||
|
||||
QDataStream &operator<<(QDataStream &out, const AssemSymbol &model)
|
||||
QDataStream &operator<<(QDataStream &out, const AssemblerSymbol &model)
|
||||
{
|
||||
out << model.address;
|
||||
out << model.name;
|
||||
return out;
|
||||
}
|
||||
|
||||
QDataStream &operator>>(QDataStream &in, AssemSymbol &model)
|
||||
QDataStream &operator>>(QDataStream &in, AssemblerSymbol &model)
|
||||
{
|
||||
in >> model.address;
|
||||
in >> model.name;
|
||||
@ -108,15 +108,15 @@ QDataStream &operator>>(QDataStream &in, AssemSymbol &model)
|
||||
|
||||
void AssemblerSymbols::doTestData()
|
||||
{
|
||||
AssemSymbol ep;
|
||||
ep.address = 0x0010;
|
||||
ep.name = "Test Entry Symbol 1";
|
||||
AssemblerSymbol ep;
|
||||
ep.address = 0x0100;
|
||||
ep.name = "Test Symbol 1";
|
||||
addSymbol(ep);
|
||||
ep.address = 0x0020;
|
||||
ep.name = "Test Entry Symbol 2";
|
||||
ep.address = 0x0200;
|
||||
ep.name = "Test Symbol 2";
|
||||
addSymbol(ep);
|
||||
ep.address = 0x0030;
|
||||
ep.name = "Test Entry Symbol 3";
|
||||
ep.address = 0x0300;
|
||||
ep.name = "Test Symbol 3";
|
||||
addSymbol(ep);
|
||||
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include <QObject>
|
||||
#include <QDataStream>
|
||||
|
||||
struct AssemSymbol {
|
||||
struct AssemblerSymbol {
|
||||
quint16 address;
|
||||
QString name;
|
||||
};
|
||||
@ -17,11 +17,11 @@ public:
|
||||
|
||||
bool hasAssemSymbolAtAddress(quint16 address);
|
||||
|
||||
const AssemSymbol &at(int location) const { return m_assemblerSymbols.at(location); }
|
||||
AssemSymbol &symbolRefAt(int location) { return m_assemblerSymbols[location]; }
|
||||
AssemSymbol &operator[](int location) { return m_assemblerSymbols[location]; }
|
||||
const AssemblerSymbol &at(int location) const { return m_assemblerSymbols.at(location); }
|
||||
AssemblerSymbol &symbolRefAt(int location) { return m_assemblerSymbols[location]; }
|
||||
AssemblerSymbol &operator[](int location) { return m_assemblerSymbols[location]; }
|
||||
|
||||
void editSymbol(int at, AssemSymbol newSymbol);
|
||||
void editSymbol(int at, AssemblerSymbol newSymbol);
|
||||
|
||||
QDataStream &read(QDataStream &dataStream);
|
||||
QDataStream &write(QDataStream &dataStream) const;
|
||||
@ -31,17 +31,17 @@ public:
|
||||
void doTestData();
|
||||
|
||||
signals:
|
||||
void symbolAdded(AssemSymbol &AssemSymbol, int location);
|
||||
void symbolAdded(AssemblerSymbol &AssemblerSymbol, int location);
|
||||
void symbolAddedAt(int location);
|
||||
void symbolRemovedAt(int location);
|
||||
void symbolChangedAt(int location);
|
||||
|
||||
public slots:
|
||||
void addSymbol(AssemSymbol ep);
|
||||
void addSymbol(AssemblerSymbol ep);
|
||||
void removeSymbolAt(int location);
|
||||
|
||||
protected:
|
||||
QList<AssemSymbol> m_assemblerSymbols;
|
||||
QList<AssemblerSymbol> m_assemblerSymbols;
|
||||
};
|
||||
|
||||
QDataStream &operator<<(QDataStream &out, const AssemblerSymbols &model);
|
||||
|
@ -42,6 +42,8 @@ DisassemblerMetadataDialog::~DisassemblerMetadataDialog()
|
||||
|
||||
void DisassemblerMetadataDialog::showEvent(QShowEvent *){
|
||||
ui->entryTable->resizeRowsToContents();
|
||||
ui->symbolTable->resizeRowsToContents();
|
||||
|
||||
}
|
||||
|
||||
void DisassemblerMetadataDialog::setRelocatable(bool relocatable)
|
||||
@ -97,7 +99,7 @@ void DisassemblerMetadataDialog::handleAddSymbolButton()
|
||||
lid.setWindowTitle("Add Symbol");
|
||||
if (lid.exec() == Accepted)
|
||||
{
|
||||
AssemSymbol as;
|
||||
AssemblerSymbol as;
|
||||
as.address = lid.getAddress();
|
||||
as.name = lid.getInfo();
|
||||
m_as->addSymbol(as);
|
||||
@ -113,7 +115,7 @@ void DisassemblerMetadataDialog::handleRemoveSymbolButton()
|
||||
|
||||
void DisassemblerMetadataDialog::processSymbols()
|
||||
{
|
||||
|
||||
m_as->doTestData();
|
||||
}
|
||||
|
||||
void DisassemblerMetadataDialog::processEntryPoints()
|
||||
|
Loading…
Reference in New Issue
Block a user