//void registerExtension() {};
+const char* expression = "(;.*)|(r0)|(rX)|(r1[0-5])|(r[1-5])|(r[6-9])|(0x[a-fA-F0-9]+)|([-]?\\d+)";
+const char* format = "(?1$&)"
+ //Return-Register: violett
+ "(?2\033[0m\033[35m$&\033[0m\\3:)"
+ // Callee-saved Register: rot
+ "(?4\033[0m\033[31m$&\033[0m\\3:)"
+ //Argument-Register: gruen
+ "(?5\033[0m\033[32m$&\033[0m\\3:)"
+ // Temporary Register: gelb
+ "(?6\033[0m\033[33m$&\033[0m\\3:)"
+ // Zahlenwerte: tuerkis
+ "(?7\033[0m\033[36m$&\033[0m\\3:)"
+ "(?8\033[0m\033[36m$&\033[0m\\3:)";
+
+
+string CCpu::colorifyInstr(string instr)
+{
+ boost::regex e;
+ e.assign(expression);
+ return boost::regex_replace(instr, e, format, boost::match_default | boost::format_all);
+}
+
+
void CCpu::tick()
{
// signal extensions
throw string("Out of Instructions!");
}
if(this->conditionMet(instr->getCondition())) {
- cout << color(green,black) << "Executing: " << color(white,black) << instr->toString() << endl;
+ cout << color(green,black) << "Executing: " << color(white,black) << colorifyInstr(instr->toString()) << endl;
instr->execInstr();
this->incPerfBy(instr->getClockCount());
}
else {
- cout << color(red,black) << "Didn't Execute " << color(white,black) << instr->toString() << "; condition wasn't met" << endl;
+ cout << color(red,black) << "Didn't Execute " << color(white,black) << colorifyInstr(instr->toString()) << "; condition wasn't met" << endl;
this->incPerf();
}