Generic Trace Generator (GTG) 0.1
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
28typedef struct StateType { /* Func group */
29 char *name;
30 char *alias;
32 int id;
33 struct gtg_list token; /* stored in the stateTypes list */
35
37typedef struct State {
38 int value;
39 int cont;
41 gtg_stack token; /* stored in the states list */
43
44/* ContainerTypes */
45typedef struct ContainerType {
46 char *name;
47 char *alias;
48 int id;
49 struct gtg_list token; /* stored in the ctType list */
51
53typedef struct Container {
54 char *name;
55 char *alias;
56 int ctType;
57 int id;
58 struct gtg_list token; /* stored in the conts list */
61
63typedef struct EntityValue {
64 char *name;
65 char *alias;
67 int id;
68 struct gtg_list token; /* not used */
70
72typedef struct EventType {
73 char *name;
74 char *alias;
76 int id;
77 struct gtg_list token; /* stored in the eventTypes list */
79
81typedef struct LinkType {
82 char *name;
83 char *alias;
87 int id;
88 struct gtg_list token; /* stored in the linkTypes lisk */
90
91typedef struct Link {
93 int src;
95
96
98typedef struct VariableType {
99 char *name;
100 char *alias;
102 int id;
103 struct gtg_list token; /* stored in the variableTypes list */
105
106typedef struct Variable {
108 int type;
109 uint64_t value;
110 int id;
111 struct gtg_list token; /* stored in the variables list */
113
114struct otf_color {
115 char *colorID;
116 uint8_t red;
117 uint8_t green;
118 uint8_t blue;
119};
120
121typedef 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_ */
struct EventType EventType_t
struct StateType StateType_t
struct VariableType VariableType_t
struct ContainerType ContainerType_t
struct Link Link_t
struct Variable Variable_t
struct State State_t
struct otf_color * otf_color_t
Definition GTGOTF_Structs.h:121
struct Container Container_t
struct EntityValue EntityValue_t
struct LinkType LinkType_t
double varPrec
Use the double precision type for time and value.
Definition GTGTypes.h:28
Definition GTGOTF_Structs.h:45
int id
Definition GTGOTF_Structs.h:48
struct gtg_list token
Definition GTGOTF_Structs.h:49
char * alias
Definition GTGOTF_Structs.h:47
char * name
Definition GTGOTF_Structs.h:46
Definition GTGOTF_Structs.h:53
int id
Definition GTGOTF_Structs.h:57
int ctType
Definition GTGOTF_Structs.h:56
char * name
Definition GTGOTF_Structs.h:54
char * alias
Definition GTGOTF_Structs.h:55
struct gtg_list token
Definition GTGOTF_Structs.h:58
State_t state_stack
Definition GTGOTF_Structs.h:59
Definition GTGOTF_Structs.h:63
struct gtg_list token
Definition GTGOTF_Structs.h:68
char * name
Definition GTGOTF_Structs.h:64
int id
Definition GTGOTF_Structs.h:67
char * alias
Definition GTGOTF_Structs.h:65
int groupId
Definition GTGOTF_Structs.h:66
Definition GTGOTF_Structs.h:72
char * name
Definition GTGOTF_Structs.h:73
int id
Definition GTGOTF_Structs.h:76
char * alias
Definition GTGOTF_Structs.h:74
struct gtg_list token
Definition GTGOTF_Structs.h:77
int contType
Definition GTGOTF_Structs.h:75
Definition GTGOTF_Structs.h:81
int srcType
Definition GTGOTF_Structs.h:85
int contType
Definition GTGOTF_Structs.h:84
struct gtg_list token
Definition GTGOTF_Structs.h:88
char * alias
Definition GTGOTF_Structs.h:83
char * name
Definition GTGOTF_Structs.h:82
int destType
Definition GTGOTF_Structs.h:86
int id
Definition GTGOTF_Structs.h:87
Definition GTGOTF_Structs.h:28
char * name
Definition GTGOTF_Structs.h:29
int id
Definition GTGOTF_Structs.h:32
struct gtg_list token
Definition GTGOTF_Structs.h:33
int groupId
Definition GTGOTF_Structs.h:31
char * alias
Definition GTGOTF_Structs.h:30
Definition GTGOTF_Structs.h:37
int cont
Definition GTGOTF_Structs.h:39
int stateType
Definition GTGOTF_Structs.h:40
gtg_stack token
Definition GTGOTF_Structs.h:41
int value
Definition GTGOTF_Structs.h:38
Definition GTGOTF_Structs.h:98
char * alias
Definition GTGOTF_Structs.h:100
struct gtg_list token
Definition GTGOTF_Structs.h:103
char * name
Definition GTGOTF_Structs.h:99
int contType
Definition GTGOTF_Structs.h:101
int id
Definition GTGOTF_Structs.h:102
Definition GTGOTF_Structs.h:106
struct gtg_list token
Definition GTGOTF_Structs.h:111
int parent
Definition GTGOTF_Structs.h:107
int type
Definition GTGOTF_Structs.h:108
uint64_t value
Definition GTGOTF_Structs.h:109
int id
Definition GTGOTF_Structs.h:110
Definition GTGList.h:4
Definition GTGOTF_Structs.h:114
char * colorID
Definition GTGOTF_Structs.h:115
uint8_t green
Definition GTGOTF_Structs.h:117
uint8_t blue
Definition GTGOTF_Structs.h:118
uint8_t red
Definition GTGOTF_Structs.h:116