00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <stdio.h>
00022 #include <stdlib.h>
00023 #include "analy.h"
00024 #include "analy_register.h"
00025 #include "data_analy.h"
00026 #include "global.h"
00027 #include "snprintf.h"
00028
00029
00030
00031 #define DPRINTF(msg...)
00032
00033 void analyser_put_addrtype(ht_object_stream *f, const taddr_type *at)
00034 {
00035 byte t = (taddr_typetype)at->type;
00036 f->putIntDec(t, 1, "type");
00037 switch (t) {
00038 case dt_unknown:
00039 break;
00040 case dt_code:
00041 f->putIntDec(at->code_subtype, 1, "type");
00042 break;
00043 case dt_unknown_data:
00044 break;
00045 case dt_int:
00046 f->putIntDec(at->int_subtype, 1, "type");
00047 f->putIntDec(at->length, 1, "length");
00048 break;
00049 case dt_float:
00050 f->putIntDec(at->float_subtype, 1, "type");
00051 f->putIntDec(at->length, 1, "length");
00052 break;
00053 case dt_array:
00054 f->putIntDec(at->array_subtype, 1, "type");
00055 f->putIntDec(at->length, 1, "length");
00056 break;
00057 }
00058 }
00059
00060 int analyser_get_addrtype(ht_object_stream *f, taddr_type *at)
00061 {
00062 at->type = (taddr_typetype)f->getIntDec(1, "type");
00063 at->length = 0;
00064 switch (at->type) {
00065 case dt_unknown:
00066 break;
00067 case dt_code:
00068 at->code_subtype = (taddr_code_subtype)f->getIntDec(1, "type");
00069 break;
00070 case dt_unknown_data:
00071 break;
00072 case dt_int:
00073 at->int_subtype = (taddr_int_subtype)f->getIntDec(1, "type");
00074 at->length = f->getIntDec(1, "length");
00075 break;
00076 case dt_float:
00077 at->float_subtype = (taddr_float_subtype)f->getIntDec(1, "type");
00078 at->length = f->getIntDec(1, "length");
00079 break;
00080 case dt_array:
00081 at->array_subtype = (taddr_array_subtype)f->getIntDec(1, "type");
00082 at->length = f->getIntDec(1, "length");
00083 break;
00084 }
00085 return f->get_error();
00086 }
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099 void DataAnalyser::init(Analyser *Analy)
00100 {
00101 analy = Analy;
00102 }
00103
00104 int DataAnalyser::load(ht_object_stream *f)
00105 {
00106 return 0;
00107 }
00108
00109 void DataAnalyser::done()
00110 {
00111 }
00112
00113 OBJECT_ID DataAnalyser::object_id() const
00114 {
00115 return ATOM_DATA_ANALYSER;
00116 }
00117
00118 void DataAnalyser::access(Address *Addr, OP op, int size)
00119 {
00120 }
00121
00122 void DataAnalyser::setAddressType(Address *Addr, taddr_typetype type, int subtype, int length)
00123 {
00124 setAddressType(analy->newLocation(Addr), type, subtype, length);
00125 }
00126
00127 void DataAnalyser::setAddressType(Location *Addr, taddr_typetype type, int subtype, int length)
00128 {
00129 DPRINTF("Addr %y set to %d (%d) length %d\n", Addr->addr, type, subtype, length);
00130 Addr->type.type = type;
00131 Addr->type.subtype = subtype;
00132 Addr->type.length = length;
00133 }
00134
00135 void DataAnalyser::setCodeAddressType(Address *Addr, taddr_code_subtype subtype)
00136 {
00137 setAddressType(analy->newLocation(Addr), dt_code, subtype, 0);
00138 }
00139
00140 void DataAnalyser::setCodeAddressType(Location *Addr, taddr_code_subtype subtype)
00141 {
00142 setAddressType(Addr, dt_code, subtype, 0);
00143 }
00144
00145 void DataAnalyser::setIntAddressType(Address *Addr, taddr_int_subtype subtype, int length)
00146 {
00147 setAddressType(analy->newLocation(Addr), dt_int, subtype, length);
00148 }
00149
00150 void DataAnalyser::setIntAddressType(Location *Addr, taddr_int_subtype subtype, int length)
00151 {
00152 setAddressType(Addr, dt_int, subtype, length);
00153 }
00154
00155 void DataAnalyser::setFloatAddressType(Address *Addr, taddr_float_subtype subtype, int length)
00156 {
00157 setAddressType(analy->newLocation(Addr), dt_float, subtype, length);
00158 }
00159
00160 void DataAnalyser::setFloatAddressType(Location *Addr, taddr_float_subtype subtype, int length)
00161 {
00162 setAddressType(Addr, dt_float, subtype, length);
00163 }
00164
00165 void DataAnalyser::setArrayAddressType(Address *Addr, taddr_array_subtype subtype, int length)
00166 {
00167 setAddressType(analy->newLocation(Addr), dt_array, subtype, length);
00168 }
00169
00170 void DataAnalyser::setArrayAddressType(Location *Addr, taddr_array_subtype subtype, int length)
00171 {
00172 setAddressType(Addr, dt_array, subtype, length);
00173 }
00174
00175 void DataAnalyser::store(ht_object_stream *f)
00176 {
00177 }
00178