From b2d8910f3f60b50bf3fc359dfa37a4da2414cd2f Mon Sep 17 00:00:00 2001 From: Pavel Pisa Date: Wed, 3 Jul 2019 08:44:32 +0200 Subject: Allow spaces in middle of assembler arguments and report errors. Signed-off-by: Pavel Pisa --- qtmips_gui/programmodel.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'qtmips_gui/programmodel.cpp') 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: -- cgit v1.2.3