aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Pisa <pisa@cmp.felk.cvut.cz>2019-07-17 22:50:42 +0200
committerPavel Pisa <pisa@cmp.felk.cvut.cz>2019-07-17 22:50:42 +0200
commitd0e96ac431f8ebccc5fd21580414913824d72766 (patch)
treec186e5307e36f4be47df18de516d95ea97556e78
parent94095c7890f491d7023b1a69b3f088be8c05e898 (diff)
downloadqtmips-d0e96ac431f8ebccc5fd21580414913824d72766.tar.gz
qtmips-d0e96ac431f8ebccc5fd21580414913824d72766.tar.bz2
qtmips-d0e96ac431f8ebccc5fd21580414913824d72766.zip
Prepend message types by MSG_, Windows headerfiles define ERROR as macro.
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
-rw-r--r--qtmips_asm/messagetype.h10
-rw-r--r--qtmips_asm/simpleasm.cpp16
-rw-r--r--qtmips_cli/msgreport.cpp6
-rw-r--r--qtmips_gui/messagesmodel.cpp4
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();