diff options
Diffstat (limited to 'ue3/mycpu/cprogram.h')
| -rw-r--r-- | ue3/mycpu/cprogram.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/ue3/mycpu/cprogram.h b/ue3/mycpu/cprogram.h index bf161b8..c145832 100644 --- a/ue3/mycpu/cprogram.h +++ b/ue3/mycpu/cprogram.h | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | 10 | ||
| 11 | #include <vector> | 11 | #include <vector> |
| 12 | #include <set> | 12 | #include <set> |
| 13 | #include <map> | ||
| 13 | #include "cinstruction.h" | 14 | #include "cinstruction.h" |
| 14 | 15 | ||
| 15 | /** | 16 | /** |
| @@ -44,6 +45,31 @@ class CProgram | |||
| 44 | ~CProgram(); | 45 | ~CProgram(); |
| 45 | 46 | ||
| 46 | /** | 47 | /** |
| 48 | * @method getLabels | ||
| 49 | * @brief get reference to labels map | ||
| 50 | * @param - | ||
| 51 | * @return reference to labels map | ||
| 52 | * @globalvars none | ||
| 53 | * @exception none | ||
| 54 | * @conditions none | ||
| 55 | */ | ||
| 56 | const std::map<std::string, unsigned>& getLabels() const | ||
| 57 | { | ||
| 58 | return m_labels; | ||
| 59 | } | ||
| 60 | |||
| 61 | /** | ||
| 62 | * @method findLabel | ||
| 63 | * @brief search for label | ||
| 64 | * @param label name of label to search for | ||
| 65 | * @return index of found label in program | ||
| 66 | * @globalvars none | ||
| 67 | * @exception std::runtime_error | ||
| 68 | * @conditions none | ||
| 69 | */ | ||
| 70 | unsigned findLabel(const std::string& label) const; | ||
| 71 | |||
| 72 | /** | ||
| 47 | * @method compile | 73 | * @method compile |
| 48 | * @brief create instructions from parsing stream | 74 | * @brief create instructions from parsing stream |
| 49 | * @param in inputstream to read from | 75 | * @param in inputstream to read from |
| @@ -71,6 +97,7 @@ class CProgram | |||
| 71 | /* members */ | 97 | /* members */ |
| 72 | /** set of known instructions */ | 98 | /** set of known instructions */ |
| 73 | std::set<CInstruction *> m_instrset; | 99 | std::set<CInstruction *> m_instrset; |
| 100 | std::map<std::string, unsigned> m_labels; | ||
| 74 | }; | 101 | }; |
| 75 | 102 | ||
| 76 | #endif | 103 | #endif |
