diff options
author | Pavel Pisa <pisa@cmp.felk.cvut.cz> | 2019-07-03 08:44:32 +0200 |
---|---|---|
committer | Pavel Pisa <pisa@cmp.felk.cvut.cz> | 2019-07-03 08:44:32 +0200 |
commit | b2d8910f3f60b50bf3fc359dfa37a4da2414cd2f (patch) | |
tree | f7771569179b78ead87386601024923f5ad22de2 /qtmips_gui/programmodel.cpp | |
parent | 7e10c3ff8149a8d25431807fe15a73fe40cfdc5b (diff) | |
download | qtmips-b2d8910f3f60b50bf3fc359dfa37a4da2414cd2f.tar.gz qtmips-b2d8910f3f60b50bf3fc359dfa37a4da2414cd2f.tar.bz2 qtmips-b2d8910f3f60b50bf3fc359dfa37a4da2414cd2f.zip |
Allow spaces in middle of assembler arguments and report errors.
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Diffstat (limited to 'qtmips_gui/programmodel.cpp')
-rw-r--r-- | qtmips_gui/programmodel.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/qtmips_gui/programmodel.cpp b/qtmips_gui/programmodel.cpp index 0f3341f..b70ed34 100644 --- a/qtmips_gui/programmodel.cpp +++ b/qtmips_gui/programmodel.cpp @@ -256,6 +256,7 @@ bool ProgramModel::setData(const QModelIndex & index, const QVariant & value, in if (role == Qt::EditRole) { bool ok; + QString error; std::uint32_t address; std::uint32_t data; machine::MemoryAccess *mem; @@ -274,8 +275,12 @@ bool ProgramModel::setData(const QModelIndex & index, const QVariant & value, in mem->write_word(address, data); break; case 3: - if (machine::Instruction::code_from_string(&data, 4, value.toString(), address) < 0) + if (machine::Instruction::code_from_string(&data, 4, value.toString(), + error, address) < 0) { + emit report_error(tr("instruction 1 parse error - %2.").arg(error)); + return false; + } mem->write_word(address, data); break; default: |