diff options
Diffstat (limited to 'ue3/mycpu/ccpu.h')
| -rw-r--r-- | ue3/mycpu/ccpu.h | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/ue3/mycpu/ccpu.h b/ue3/mycpu/ccpu.h new file mode 100644 index 0000000..6b16ba3 --- /dev/null +++ b/ue3/mycpu/ccpu.h | |||
| @@ -0,0 +1,77 @@ | |||
| 1 | /** | ||
| 2 | * @module ccpu | ||
| 3 | * @author Guenther Neuwirth (0626638), Manuel Mausz (0728348) | ||
| 4 | * @brief class for parsing simple scriptfiles | ||
| 5 | * @date 17.04.2009 | ||
| 6 | */ | ||
| 7 | |||
| 8 | #ifndef CCPU_H | ||
| 9 | #define CCPU_H | ||
| 10 | |||
| 11 | #include <stdexcept> | ||
| 12 | #include <string> | ||
| 13 | #include <vector> | ||
| 14 | |||
| 15 | #include "cprogram.h" | ||
| 16 | #include "cmem.h" | ||
| 17 | #include "cinstruction.h" | ||
| 18 | /** | ||
| 19 | * @class CCPU | ||
| 20 | * | ||
| 21 | * Parses a simple line based scriptfile with some limitations: | ||
| 22 | * first function (starting a block) must be a read-command, | ||
| 23 | * last must be a write-command (ending this block). | ||
| 24 | * | ||
| 25 | * read- and write-commands have hard coded parameters, number#1 being a filetype. | ||
| 26 | * Classes handling certain filetypes must be of type CFile. | ||
| 27 | * Custom functions will be passed to CFile::callFunc(). | ||
| 28 | * | ||
| 29 | * On error ParserError will be thrown. | ||
| 30 | */ | ||
| 31 | class CCPU | ||
| 32 | { | ||
| 33 | public: | ||
| 34 | |||
| 35 | |||
| 36 | /** | ||
| 37 | * @method CScriptparser | ||
| 38 | * @brief Default ctor | ||
| 39 | * @param scriptfile filename of script to parse | ||
| 40 | * @return - | ||
| 41 | * @globalvars none | ||
| 42 | * @exception bad_alloc | ||
| 43 | * @conditions none | ||
| 44 | */ | ||
| 45 | CCPU(const std::string& progfile, const std::string& memfile); | ||
| 46 | /** | ||
| 47 | * @method ~CScriptparser | ||
| 48 | * @brief Default dtor | ||
| 49 | * @param - | ||
| 50 | * @return - | ||
| 51 | * @globalvars none | ||
| 52 | * @exception none | ||
| 53 | * @conditions none | ||
| 54 | */ | ||
| 55 | ~CCPU() | ||
| 56 | {} | ||
| 57 | |||
| 58 | |||
| 59 | void proceed(); | ||
| 60 | |||
| 61 | |||
| 62 | |||
| 63 | void execInstruction( CInstruction& instr, std::vector<std::string>& i_list); | ||
| 64 | private: | ||
| 65 | /* members */ | ||
| 66 | |||
| 67 | CProgram m_program; | ||
| 68 | CMem m_memory; | ||
| 69 | std::map<std::string, CInstruction *> m_instrtype; | ||
| 70 | bool f_zero, f_sign; | ||
| 71 | // std::string m_memfiler; | ||
| 72 | |||
| 73 | }; | ||
| 74 | |||
| 75 | #endif | ||
| 76 | |||
| 77 | /* vim: set et sw=2 ts=2: */ | ||
