Fennel: /home/pub/open/dev/fennel/calculator/InstructionDescription.h Source File (original) (raw)

00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 00024 00025 00026 #ifndef Fennel_InstructionDescription_Included 00027 #define Fennel_InstructionDescription_Included 00028 00029 #include "fennel/calculator/Calculator.h" 00030 #include "fennel/calculator/RegisterReference.h" 00031 #include "fennel/tuple/StandardTypeDescriptor.h" 00032 #include 00033 00034 FENNEL_BEGIN_NAMESPACE 00035 00036 class Instruction; 00037 00040 class FENNEL_CALCULATOR_EXPORT RegDesc 00041 { 00042 public: 00043 enum Groups { 00044 REGDESC_NONE = 0, 00045 REGDESC_ANY, 00046 REGDESC_NATIVE, 00047 REGDESC_INTEGRAL, 00048 REGDESC_POINTER, 00049 REGDESC_ARRAY 00050 }; 00051 00052
00053 explicit 00054 RegDesc(StandardTypeDescriptorOrdinal typeArg) : 00055 type(typeArg), 00056 group(REGDESC_NONE) 00057 { 00058 } 00059 00060
00061 explicit 00062 RegDesc(Groups groupArg) : 00063 type(STANDARD_TYPE_END_NO_UNICODE), 00064 group(groupArg) 00065 { 00066 } 00067 00068 bool 00069 match(StandardTypeDescriptorOrdinal m); 00070 00071 private: 00072 StandardTypeDescriptorOrdinal type; 00073 Groups group; 00074 }; 00075 00078 class FENNEL_CALCULATOR_EXPORT InstructionDescription 00079 { 00080 private: 00081
00084 typedef Instruction *(InstructionCreateFunction)( 00085 vector<RegisterReference*> const &); 00086 public: 00087 explicit 00088 InstructionDescription( 00089 string const &nameArg, 00090 vector const &registerdescArg, 00091 InstructionCreateFunction createFnArg) : 00092 name(nameArg), 00093 registerdesc(registerdescArg), 00094 createFn(createFnArg) 00095 { 00096 } 00097 00098 void setName(string const &s) 00099 { 00100 name = s; 00101 } 00102 00103 string getName() const 00104 { 00105 return name; 00106 } 00107 00108 private: 00109 string name; 00110 vector registerdesc; 00111 InstructionCreateFunction createFn; 00112 Instruction inst; 00113 TProgramCounter pc; 00114 }; 00115 00116 00117 typedef std::map< string, InstructionDescription* > StringToInstDesc; 00118 00119 FENNEL_END_NAMESPACE 00120 00121 #endif 00122 00123