File: data_analy.h

package info (click to toggle)
ht 2.0.20-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 6,324 kB
  • sloc: cpp: 97,563; ansic: 17,183; sh: 3,811; lex: 226; makefile: 213; yacc: 127
file content (122 lines) | stat: -rw-r--r-- 3,045 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/* 
 *	HT Editor
 *	data_analy.h
 *
 *	Copyright (C) 1999-2002 Sebastian Biallas (sb@biallas.net)
 *
 *	This program is free software; you can redistribute it and/or modify
 *	it under the terms of the GNU General Public License version 2 as
 *	published by the Free Software Foundation.
 *
 *	This program is distributed in the hope that it will be useful,
 *	but WITHOUT ANY WARRANTY; without even the implied warranty of
 *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *	GNU General Public License for more details.
 *
 *	You should have received a copy of the GNU General Public License
 *	along with this program; if not, write to the Free Software
 *	Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#ifndef DATA_ANALY_H
#define DATA_ANALY_H

#include "data.h"
#include "analy.h"


enum OP {op_read, op_write, op_offset};

/*
 * general type of an address
 */
enum taddr_typetype {
	dt_unknown = 0,
	dt_code,
	dt_unknown_data,
	dt_int,
	dt_float,
	dt_array
};

enum taddr_code_subtype {
	dst_cunknown = 0,
	dst_location,
	dst_function
};

enum  taddr_int_subtype{
	dst_iunknown = 0,
	dst_ibyte,
	dst_iword,
	dst_idword,
	dst_ipword,
	dst_iqword
};

enum taddr_float_subtype {
	dst_funknown = 0,
	dst_fsingle,
	dst_fdouble,
	dst_fextended
};

enum taddr_array_subtype {
	dst_aunknown = 0,
	dst_abyte,
	dst_aword,
	dst_adword,
	dst_apword,
	dst_aqword,
	dst_string,
	dst_unistring
};

struct taddr_type {
	taddr_typetype type;
	union {
		byte				subtype;
		taddr_code_subtype	code_subtype;
		taddr_int_subtype	int_subtype;
		taddr_float_subtype	float_subtype;
		taddr_array_subtype	array_subtype;
	};
	union {
		int  length;
		// ...?
	};
};

class Analyser;
class Address;
struct Location;

class DataAnalyser: public Object	{
public:
	Analyser		*analy;
	
				DataAnalyser();
				DataAnalyser(BuildCtorArg&a): Object(a) {};
		void		init(Analyser *Analy);
	virtual	void		load(ObjectStream &s);
	virtual	void		done();
	virtual	ObjectID	getObjectID() const;

		void		access(Address *Addr, OP op, int size);
		void		setAddressType(Address *Addr, taddr_typetype type, int subtype, int length);
		void		setAddressType(Location *Addr, taddr_typetype type, int subtype, int length);
		void		setCodeAddressType(Address *Addr, taddr_code_subtype subtype);
		void		setCodeAddressType(Location *Addr, taddr_code_subtype subtype);
		void		setIntAddressType(Address *Addr, taddr_int_subtype subtype, int length);
		void		setIntAddressType(Location *Addr, taddr_int_subtype subtype, int length);
		void		setFloatAddressType(Address *Addr, taddr_float_subtype subtype, int length);
		void		setFloatAddressType(Location *Addr, taddr_float_subtype subtype, int length);
		void		setArrayAddressType(Address *Addr, taddr_array_subtype subtype, int length);
		void		setArrayAddressType(Location *Addr, taddr_array_subtype subtype, int length);
	virtual	void		store(ObjectStream &s) const;
};

void analyser_put_addrtype(ObjectStream &s, const taddr_type *at);
void analyser_get_addrtype(ObjectStream &s, taddr_type *at);

#endif