summaryrefslogtreecommitdiffstats
path: root/ue4/mycpu/cinstruction.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'ue4/mycpu/cinstruction.cpp')
-rw-r--r--ue4/mycpu/cinstruction.cpp48
1 files changed, 0 insertions, 48 deletions
diff --git a/ue4/mycpu/cinstruction.cpp b/ue4/mycpu/cinstruction.cpp
deleted file mode 100644
index a766015..0000000
--- a/ue4/mycpu/cinstruction.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
1/**
2 * @module cinstruction
3 * @author Guenther Neuwirth (0626638), Manuel Mausz (0728348)
4 * @brief Abstract class for displays
5 * @date 13.05.2009
6 */
7
8#include <sstream>
9#include <stdexcept>
10#include <boost/lexical_cast.hpp>
11#include <assert.h>
12#include "cinstruction.h"
13#include "ccpu.h"
14
15using namespace std;
16
17const unsigned CInstruction::parseRegister(const std::string& str)
18{
19 unsigned reg;
20 if (str.length() < 2 || str[0] != 'r')
21 throw runtime_error("Invalid syntax of register");
22
23 try
24 {
25 reg = boost::lexical_cast<unsigned>(str.substr(1));
26 }
27 catch(boost::bad_lexical_cast& ex)
28 {
29 throw runtime_error("Invalid syntax of register");
30 }
31
32 return reg;
33}
34
35/*----------------------------------------------------------------------------*/
36
37inline void CInstruction::checkRegister(CCPU *cpu, const unsigned regidx)
38{
39 assert(cpu != NULL);
40 if (regidx >= cpu->getRegisterCount())
41 {
42 stringstream sstr;
43 sstr << "Register R" << regidx << " doesn't exist (out of bound)";
44 throw runtime_error(sstr.str());
45 }
46}
47
48/* vim: set et sw=2 ts=2: */