00001 /* 00002 * HT Editor 00003 * srt.h 00004 * 00005 * Copyright (C) 2001, 2002 Stefan Weyergraf (stefan@weyergraf.de) 00006 * 00007 * This program is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License version 2 as 00009 * published by the Free Software Foundation. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software 00018 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00019 */ 00020 00021 #ifndef __SRT_H__ 00022 #define __SRT_H__ 00023 00024 #include "analy.h" 00025 #include "symmath.h" 00026 00027 enum srt_endian { srte_be, srte_le }; 00028 00029 /* 00030 * CLASS state_mod 00031 */ 00032 00033 #define MTYPE_REG 0 00034 #define MTYPE_FLAG 1 00035 #define MTYPE_MEM 2 00036 00037 class state_mod: public Object { 00038 public: 00039 bool ismem; 00040 union { 00041 UINT regidx; 00042 struct { 00043 sym_int_token *addr; 00044 UINT size; 00045 srt_endian endian; 00046 } mem; 00047 } dest; 00048 00049 bool isbool; 00050 union { 00051 sym_int_token *integer; 00052 sym_bool_token *boolean; 00053 } value; 00054 00055 ~state_mod(); 00056 }; 00057 00058 /* 00059 * CLASS sym_int_reg 00060 */ 00061 00062 class sym_int_reg: public sym_int_token { 00063 public: 00064 UINT regidx; 00065 00066 sym_int_reg(UINT r); 00067 /* overwritten */ 00068 virtual bool compare_eq(sym_int_token *t); 00069 virtual Object *duplicate(); 00070 virtual bool evaluate(bool *i); 00071 virtual int nstrfy(char *buf, int n); 00072 virtual OBJECT_ID object_id() const; 00073 }; 00074 00075 /* 00076 * CLASS sym_int_mem 00077 */ 00078 00079 class sym_int_mem: public sym_int_token { 00080 public: 00081 sym_int_token *addr; 00082 UINT size; 00083 srt_endian endian; 00084 00085 sym_int_mem(sym_int_token *a, UINT s, srt_endian e); 00086 /* overwritten */ 00087 virtual bool compare_eq(sym_int_token *t); 00088 virtual Object *duplicate(); 00089 virtual bool evaluate(bool *i); 00090 virtual int nstrfy(char *buf, int n); 00091 virtual OBJECT_ID object_id() const; 00092 }; 00093 00094 /***/ 00095 00096 char *srt_endian_to_str(srt_endian endian); 00097 00098 void test_srt(Analyser *analy, Address *addr); 00099 00100 #endif /* __SRT_H__ */