OpenMW
components/interpreter/interpreter.hpp
Go to the documentation of this file.
00001 #ifndef INTERPRETER_INTERPRETER_H_INCLUDED
00002 #define INTERPRETER_INTERPRETER_H_INCLUDED
00003 
00004 #include <map>
00005 
00006 #include "runtime.hpp"
00007 #include "types.hpp"
00008 
00009 namespace Interpreter
00010 {
00011     class Opcode0;
00012     class Opcode1;
00013     class Opcode2;
00014 
00015     class Interpreter
00016     {
00017             Runtime mRuntime;
00018             std::map<int, Opcode1 *> mSegment0;
00019             std::map<int, Opcode2 *> mSegment1;
00020             std::map<int, Opcode1 *> mSegment2;
00021             std::map<int, Opcode1 *> mSegment3;
00022             std::map<int, Opcode2 *> mSegment4;
00023             std::map<int, Opcode0 *> mSegment5;
00024 
00025             // not implemented
00026             Interpreter (const Interpreter&);
00027             Interpreter& operator= (const Interpreter&);
00028 
00029             void execute (Type_Code code);
00030 
00031             void abortUnknownCode (int segment, int opcode);
00032 
00033             void abortUnknownSegment (Type_Code code);
00034 
00035         public:
00036 
00037             Interpreter();
00038 
00039             ~Interpreter();
00040 
00041             void installSegment0 (int code, Opcode1 *opcode);
00043 
00044             void installSegment1 (int code, Opcode2 *opcode);
00046 
00047             void installSegment2 (int code, Opcode1 *opcode);
00049 
00050             void installSegment3 (int code, Opcode1 *opcode);
00052 
00053             void installSegment4 (int code, Opcode2 *opcode);
00055 
00056             void installSegment5 (int code, Opcode0 *opcode);
00058 
00059             void run (const Type_Code *code, int codeSize, Context& context);
00060     };
00061 }
00062 
00063 #endif