diff options
| author | manuel <manuel@nc8430.lan> | 2009-05-13 16:55:17 +0200 |
|---|---|---|
| committer | manuel <manuel@nc8430.lan> | 2009-05-13 16:55:17 +0200 |
| commit | 3c6f886d5a8bfd36c796b963d6e3178ad9577742 (patch) | |
| tree | 7a65d184e66c810777d18ea208931910c91b7e43 /ue3/mycpu/cprogram.cpp | |
| parent | 431bbac5a99abbccf33500e22aa353ec792eff94 (diff) | |
| download | ooprog-3c6f886d5a8bfd36c796b963d6e3178ad9577742.tar.gz ooprog-3c6f886d5a8bfd36c796b963d6e3178ad9577742.tar.bz2 ooprog-3c6f886d5a8bfd36c796b963d6e3178ad9577742.zip | |
* added documentation (no more TODOs)
* added testsuite + testcase
* used copyctor instead of assign operator more often
Diffstat (limited to 'ue3/mycpu/cprogram.cpp')
| -rw-r--r-- | ue3/mycpu/cprogram.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/ue3/mycpu/cprogram.cpp b/ue3/mycpu/cprogram.cpp index f904bce..1a450f5 100644 --- a/ue3/mycpu/cprogram.cpp +++ b/ue3/mycpu/cprogram.cpp | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /** | 1 | /** |
| 2 | * @module cprogram | 2 | * @module cprogram |
| 3 | * @author Guenther Neuwirth (0626638), Manuel Mausz (0728348) | 3 | * @author Guenther Neuwirth (0626638), Manuel Mausz (0728348) |
| 4 | * @brief TODO | 4 | * @brief CProgram extends std::vector and adds a method for parsing programfile |
| 5 | * @date 12.05.2009 | 5 | * @date 12.05.2009 |
| 6 | */ | 6 | */ |
| 7 | 7 | ||
| @@ -75,7 +75,7 @@ void CProgram::compile(std::istream& in) | |||
| 75 | 75 | ||
| 76 | /* get instruction name */ | 76 | /* get instruction name */ |
| 77 | size_t pos = line.find_first_of(' '); | 77 | size_t pos = line.find_first_of(' '); |
| 78 | string instrname = line.substr(0, pos); | 78 | string instrname(line.substr(0, pos)); |
| 79 | 79 | ||
| 80 | /* search and create instruction */ | 80 | /* search and create instruction */ |
| 81 | CInstruction *instrptr = NULL; | 81 | CInstruction *instrptr = NULL; |
| @@ -112,7 +112,7 @@ void CProgram::compile(std::istream& in) | |||
| 112 | { | 112 | { |
| 113 | if (instrparams.size() != 1) | 113 | if (instrparams.size() != 1) |
| 114 | throw runtime_error("Invalid paramater count - must be 1"); | 114 | throw runtime_error("Invalid paramater count - must be 1"); |
| 115 | string label = instrparams.front(); | 115 | string label(instrparams.front()); |
| 116 | if (label.length() < 2 || label[ label.length() - 1] != ':') | 116 | if (label.length() < 2 || label[ label.length() - 1] != ':') |
| 117 | throw runtime_error("Label has invalid syntax"); | 117 | throw runtime_error("Label has invalid syntax"); |
| 118 | m_labels[ label.substr(0, label.length() - 1) ] = size(); | 118 | m_labels[ label.substr(0, label.length() - 1) ] = size(); |
