From d0e96ac431f8ebccc5fd21580414913824d72766 Mon Sep 17 00:00:00 2001 From: Pavel Pisa Date: Wed, 17 Jul 2019 22:50:42 +0200 Subject: Prepend message types by MSG_, Windows headerfiles define ERROR as macro. Signed-off-by: Pavel Pisa --- qtmips_asm/messagetype.h | 10 +++++----- qtmips_asm/simpleasm.cpp | 16 ++++++++-------- qtmips_cli/msgreport.cpp | 6 +++--- qtmips_gui/messagesmodel.cpp | 4 ++-- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/qtmips_asm/messagetype.h b/qtmips_asm/messagetype.h index a3a1c49..fef5eb8 100644 --- a/qtmips_asm/messagetype.h +++ b/qtmips_asm/messagetype.h @@ -39,11 +39,11 @@ namespace messagetype { enum Type { - START, - FINISH, - INFO, - WARNING, - ERROR, + MSG_START, + MSG_FINISH, + MSG_INFO, + MSG_WARNING, + MSG_ERROR, }; } diff --git a/qtmips_asm/simpleasm.cpp b/qtmips_asm/simpleasm.cpp index 15d50b2..9ff8816 100644 --- a/qtmips_asm/simpleasm.cpp +++ b/qtmips_asm/simpleasm.cpp @@ -150,7 +150,7 @@ bool SimpleAsm::process_line(QString line, QString filename, if (!ok) { error = tr("line %1 .orig %2 parse error.") .arg(QString::number(line_number), line); - emit report_message(messagetype::ERROR, filename, line_number, 0, error, ""); + emit report_message(messagetype::MSG_ERROR, filename, line_number, 0, error, ""); error_occured = true; fatal_occured = true; if (error_ptr != nullptr) @@ -165,7 +165,7 @@ bool SimpleAsm::process_line(QString line, QString filename, if ((operands.count() > 2) || (operands.count() < 1)) { error = tr("line %1 .set or .equ incorrect arguments number.") .arg(QString::number(line_number)); - emit report_message(messagetype::ERROR, filename, line_number, 0, error, ""); + emit report_message(messagetype::MSG_ERROR, filename, line_number, 0, error, ""); error_occured = true; if (error_ptr != nullptr) *error_ptr = error; @@ -184,7 +184,7 @@ bool SimpleAsm::process_line(QString line, QString filename, if (!ok) { error = tr("line %1 .set or .equ %2 parse error.") .arg(QString::number(line_number), operands.at(1)); - emit report_message(messagetype::ERROR, filename, line_number, 0, error, ""); + emit report_message(messagetype::MSG_ERROR, filename, line_number, 0, error, ""); error_occured = true; if (error_ptr != nullptr) *error_ptr = error; @@ -218,7 +218,7 @@ bool SimpleAsm::process_line(QString line, QString filename, if (size < 0) { error = tr("line %1 instruction %2 parse error - %3.") .arg(QString::number(line_number), line, error); - emit report_message(messagetype::ERROR, filename, line_number, 0, error, ""); + emit report_message(messagetype::MSG_ERROR, filename, line_number, 0, error, ""); error_occured = true; if (error_ptr != nullptr) *error_ptr = error; @@ -241,7 +241,7 @@ bool SimpleAsm::finish(QString *error_ptr) { if (!expression.parse(r->expression, error)) { error = tr("expression parse error %1 at line %2, expression %3.") .arg(error, QString::number(r->line), expression.dump()); - emit report_message(messagetype::ERROR, r->filename, r->line, 0, error, ""); + emit report_message(messagetype::MSG_ERROR, r->filename, r->line, 0, error, ""); if (error_ptr != nullptr && !error_reported) *error_ptr = error; error_occured = true; @@ -251,20 +251,20 @@ bool SimpleAsm::finish(QString *error_ptr) { if (!expression.eval(value, symtab, error)) { error = tr("expression evalution error %1 at line %2 , expression %3.") .arg(error, QString::number(r->line), expression.dump()); - emit report_message(messagetype::ERROR, r->filename, r->line, 0, error, ""); + emit report_message(messagetype::MSG_ERROR, r->filename, r->line, 0, error, ""); if (error_ptr != nullptr && !error_reported) *error_ptr = error; error_occured = true; error_reported = true; } else { if (false) - emit report_message(messagetype::INFO, r->filename, r->line, 0, + emit report_message(messagetype::MSG_INFO, r->filename, r->line, 0, expression.dump() + " -> " + QString::number(value), ""); machine::Instruction inst(mem->read_word(r->location, true)); if (!inst.update(value, r)) { error = tr("instruction update error %1 at line %2, expression %3 -> value %4.") .arg(error, QString::number(r->line), expression.dump(), QString::number(value)); - emit report_message(messagetype::ERROR, r->filename, r->line, 0, error, ""); + emit report_message(messagetype::MSG_ERROR, r->filename, r->line, 0, error, ""); if (error_ptr != nullptr && !error_reported) *error_ptr = error; error_occured = true; diff --git a/qtmips_cli/msgreport.cpp b/qtmips_cli/msgreport.cpp index bd5f478..96181d4 100644 --- a/qtmips_cli/msgreport.cpp +++ b/qtmips_cli/msgreport.cpp @@ -51,13 +51,13 @@ void MsgReport::report_message(messagetype::Type type, QString file, QString typestr = "error"; switch (type) { - case messagetype::ERROR: + case messagetype::MSG_ERROR: typestr = "error"; break; - case messagetype::WARNING: + case messagetype::MSG_WARNING: typestr = "warning"; break; - case messagetype::INFO: + case messagetype::MSG_INFO: typestr = "info"; break; default: diff --git a/qtmips_gui/messagesmodel.cpp b/qtmips_gui/messagesmodel.cpp index 6138e01..f179b2d 100644 --- a/qtmips_gui/messagesmodel.cpp +++ b/qtmips_gui/messagesmodel.cpp @@ -113,9 +113,9 @@ QVariant MessagesModel::data(const QModelIndex &index, int role) const { if (role == Qt::BackgroundRole) { MessagesEntry *ent = messages.at(index.row()); switch (ent->type) { - case messagetype::ERROR: + case messagetype::MSG_ERROR: return QBrush(QColor(255, 230, 230)); - case messagetype::WARNING: + case messagetype::MSG_WARNING: return QBrush(QColor(255, 255, 220)); default: return QVariant(); -- cgit v1.2.3