Generic Trace Generator (GTG)
0.1
Main Page
Modules
Data Structures
Files
File List
Globals
inc
GTGOTF_Structs.h
Go to the documentation of this file.
1
17
#ifndef _GTG_OTF_STRUCTS_H_
18
#define _GTG_OTF_STRUCTS_H_
19
20
#include <stdint.h>
21
#include "
GTGList.h
"
22
#include "
GTGStack.h
"
23
24
/* todo: remove this */
25
#define MAX_PROCESS 64
26
28
typedef
struct
StateType
{
/* Func group */
29
char
*
name
;
30
char
*
alias
;
31
int
groupId
;
32
int
id
;
33
struct
gtg_list
token
;
/* stored in the stateTypes list */
34
}
StateType_t
;
35
37
typedef
struct
State
{
38
int
value
;
39
int
cont
;
40
int
stateType
;
41
gtg_stack
token
;
/* stored in the states list */
42
}
State_t
;
43
44
/* ContainerTypes */
45
typedef
struct
ContainerType
{
46
char
*
name
;
47
char
*
alias
;
48
int
id
;
49
struct
gtg_list
token
;
/* stored in the ctType list */
50
}
ContainerType_t
;
51
53
typedef
struct
Container
{
54
char
*
name
;
55
char
*
alias
;
56
int
ctType
;
57
int
id
;
58
struct
gtg_list
token
;
/* stored in the conts list */
59
State_t
state_stack
;
60
}
Container_t
;
61
63
typedef
struct
EntityValue
{
64
char
*
name
;
65
char
*
alias
;
66
int
groupId
;
67
int
id
;
68
struct
gtg_list
token
;
/* not used */
69
}
EntityValue_t
;
70
72
typedef
struct
EventType
{
73
char
*
name
;
74
char
*
alias
;
75
int
contType
;
76
int
id
;
77
struct
gtg_list
token
;
/* stored in the eventTypes list */
78
}
EventType_t
;
79
81
typedef
struct
LinkType
{
82
char
*
name
;
83
char
*
alias
;
84
int
contType
;
85
int
srcType
;
86
int
destType
;
87
int
id
;
88
struct
gtg_list
token
;
/* stored in the linkTypes lisk */
89
}
LinkType_t
;
90
91
typedef
struct
Link
{
92
varPrec
time
;
93
int
src
;
94
}
Link_t
;
95
96
98
typedef
struct
VariableType
{
99
char
*
name
;
100
char
*
alias
;
101
int
contType
;
102
int
id
;
103
struct
gtg_list
token
;
/* stored in the variableTypes list */
104
}
VariableType_t
;
105
106
typedef
struct
Variable
{
107
int
parent
;
108
int
type
;
109
uint64_t
value
;
110
int
id
;
111
struct
gtg_list
token
;
/* stored in the variables list */
112
}
Variable_t
;
113
114
struct
otf_color
{
115
char
*
colorID
;
116
uint8_t
red
;
117
uint8_t
green
;
118
uint8_t
blue
;
119
};
120
121
typedef
struct
otf_color
*
otf_color_t
;
122
123
#define ContainerType_NIL 0
124
#define Container_NIL 0
125
#define StateType_NIL 0
126
#define State_NIL 0
127
#define EntityValue_NIL 0
128
#define EventType_NIL 0
129
#define LinkType_NIL 0
130
#define VariableType_NIL 0
131
#define Variable_NIL 0
132
133
#define init_ContainerType(var)\
134
do { \
135
(var).name = NULL; \
136
(var).alias = NULL; \
137
(var).id = ContainerType_NIL; \
138
GTG_LIST_INIT(&(var).token); \
139
}while(0)
140
141
#define init_Container(var) \
142
do { \
143
(var).name = NULL; \
144
(var).alias = NULL; \
145
(var).ctType = ContainerType_NIL; \
146
(var).id = Container_NIL; \
147
GTG_LIST_INIT(&(var).token); \
148
GTG_STACK_INIT(&(var).state_stack.token); \
149
}while(0)
150
151
#define init_StateType(var) \
152
do { \
153
(var).name = NULL; \
154
(var).alias = NULL; \
155
(var).groupId = 0; \
156
(var).id = StateType_NIL; \
157
GTG_LIST_INIT(&(var).token); \
158
}while(0)
159
160
#define init_EntityValue(var) \
161
do { \
162
(var).name = NULL; \
163
(var).alias = NULL; \
164
(var).groupId = 0; \
165
(var).id = EntityValue_NIL; \
166
GTG_LIST_INIT(&(var).token); \
167
}while(0)
168
169
#define init_EventType(var) \
170
do { \
171
(var).name = NULL; \
172
(var).alias = NULL; \
173
(var).contType = ContainerType_NIL; \
174
(var).id = EventType_NIL; \
175
GTG_LIST_INIT(&(var).token); \
176
}while(0)
177
178
#define init_LinkType(var) \
179
do { \
180
(var).name = NULL; \
181
(var).alias = NULL; \
182
(var).contType = ContainerType_NIL; \
183
(var).srcType = ContainerType_NIL; \
184
(var).destType = ContainerType_NIL; \
185
(var).id = LinkType_NIL; \
186
GTG_LIST_INIT(&(var).token); \
187
}while(0)
188
189
#define init_VariableType(var) \
190
do { \
191
(var).name = NULL; \
192
(var).alias = NULL; \
193
(var).contType = ContainerType_NIL; \
194
(var).id = VariableType_NIL; \
195
GTG_LIST_INIT(&(var).token); \
196
}while(0)
197
198
#define init_Variable(var) \
199
do { \
200
(var).parent = Container_NIL; \
201
(var).parent = VariableType_NIL; \
202
(var).value = 0; \
203
(var).id = Variable_NIL; \
204
GTG_LIST_INIT(&(var).token); \
205
}while(0)
206
207
#define init_State(var) \
208
do { \
209
(var).value = EntityValue_NIL; \
210
(var).cont = Container_NIL; \
211
(var).stateType = StateType_NIL; \
212
GTG_STACK_INIT(&(var).token); \
213
}while(0)
214
215
216
#define alloc_struct(ptr, type, list_head) \
217
do { \
218
ptr = (type*) malloc(sizeof(type)); \
219
GTG_LIST_INIT(&(ptr->token)); \
220
ptr->id = (gtg_list_entry((list_head)->prev, type, token)->id) + 1; \
221
gtg_list_add_tail(&(ptr->token), list_head); \
222
} while(0)
223
224
#define alloc_init_struct(type, ptr, list_head, _name_, _alias_) \
225
do { \
226
alloc_struct(ptr, type, list_head); \
227
(ptr)->name = (char *)malloc(sizeof(char)*(strlen(_name_)+1)); \
228
strcpy((ptr)->name, _name_); \
229
(ptr)->alias = (char *)malloc(sizeof(char)*(strlen(_alias_)+1)); \
230
strcpy((ptr)->alias, _alias_); \
231
}while(0)
232
233
#define alloc_Variable(_ptr_, _id_, _parent_, _type_, _value_) \
234
do { \
235
(_ptr_) = (Variable_t*) malloc(sizeof(Variable_t)); \
236
init_Variable(*(_ptr_)); \
237
(_ptr_)->id = _id_; \
238
(_ptr_)->parent = _parent_; \
239
(_ptr_)->type = _type_; \
240
(_ptr_)->value = _value_; \
241
}while(0)
242
243
#define alloc_State(_ptr_, _value_, _cont_, _stateType_) \
244
do { \
245
_ptr_ = (State_t*) malloc(sizeof(State_t)); \
246
init_State(*(_ptr_)); \
247
(_ptr_)->value = _value_; \
248
(_ptr_)->cont = _cont_; \
249
(_ptr_)->stateType = _stateType_; \
250
}while(0)
251
252
#define free_struct(_type_, _list_head_)\
253
do{\
254
_type_ *ptr, *tmp; \
255
gtg_list_for_each_entry_safe(ptr, tmp, &(_list_head_).token, token) { \
256
gtg_list_del(&(ptr->token));\
257
free(ptr->name);\
258
free(ptr->alias);\
259
free(ptr);\
260
}\
261
}while(0)
262
263
#endif
/* _GTG_OTF_STRUCTS_H_ */
Generated on Mon Oct 21 2013 16:12:08 for Generic Trace Generator (GTG) by
1.8.4