summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvi Levin <avi.levin@samsung.com>2015-06-03 18:15:27 +0300
committerAvi Levin <avi.levin@samsung.com>2015-06-03 18:15:27 +0300
commitaea0f1747d36978d0811c2d46becc7bccee230d3 (patch)
treed490d04a39dfb06f4cee1f558480402819dfc768
parent1282ce52b4b21a75012721186557ef9506e27f2d (diff)
Eolian_info: make classes_list global variable
And change his name to classes_edges_list.
-rw-r--r--src/bin/.main.c.swpbin45056 -> 49152 bytes
-rw-r--r--src/bin/main.c70
2 files changed, 32 insertions, 38 deletions
diff --git a/src/bin/.main.c.swp b/src/bin/.main.c.swp
index 46a2159..05c4691 100644
--- a/src/bin/.main.c.swp
+++ b/src/bin/.main.c.swp
Binary files differ
diff --git a/src/bin/main.c b/src/bin/main.c
index 30cf06f..838ba3f 100644
--- a/src/bin/main.c
+++ b/src/bin/main.c
@@ -39,20 +39,21 @@ int _eolian_info_log_dom;
39#endif 39#endif
40#define CRIT(...) EINA_LOG_DOM_CRIT(_eolian_info_log_dom, __VA_ARGS__) 40#define CRIT(...) EINA_LOG_DOM_CRIT(_eolian_info_log_dom, __VA_ARGS__)
41 41
42static Eina_Inlist* _prints_inherit_tree_mode(const Eolian_Class *ekl, Eina_Inlist *classes_list); 42static void _prints_inherit_tree_mode(const Eolian_Class *ekl);
43static Eina_Inlist* _prints_inherits_from_mode(const Eolian_Class *ekl, Eina_Inlist *classes_list); 43static void _prints_inherits_from_mode(const Eolian_Class *ekl);
44static Eina_Inlist* _prints_class_mode(const Eolian_Class *ekl, Eina_Inlist *classes_list); 44static void _prints_class_mode(const Eolian_Class *ekl);
45static void _file_filter(const Eolian_Class *ekl, Eina_Strbuf *buf); 45static void _file_filter(const Eolian_Class *ekl, Eina_Strbuf *buf);
46static void _event_filter(const Eolian_Class *ekl, Eina_Strbuf *buf); 46static void _event_filter(const Eolian_Class *ekl, Eina_Strbuf *buf);
47 47
48const Eolian_Class* queue[200]; 48const Eolian_Class* queue[200];
49int queue_size=0; 49int queue_size=0;
50FILE* _file = NULL; 50FILE* _file = NULL;
51Eina_Inlist *classes_edges_list = NULL;
51 52
52typedef struct 53typedef struct
53{ 54{
54 const char *name_l, *name_s; 55 const char *name_l, *name_s;
55 Eina_Inlist* (*func)(const Eolian_Class *ekl, Eina_Inlist *classes_list); 56 void (*func)(const Eolian_Class *ekl);
56} _mode; 57} _mode;
57 58
58static _mode _modes[] = { 59static _mode _modes[] = {
@@ -179,7 +180,7 @@ static void _print_class(const char *class_name)
179 180
180} 181}
181 182
182static void _print_graph( Eina_Inlist *classes_list) 183static void _print_graph()
183{ 184{
184 _Class_Node *node = NULL; 185 _Class_Node *node = NULL;
185 Eina_Inlist *nnode; 186 Eina_Inlist *nnode;
@@ -201,7 +202,7 @@ static void _print_graph( Eina_Inlist *classes_list)
201 ]\n"); 202 ]\n");
202 203
203 /* print classes info */ 204 /* print classes info */
204 EINA_INLIST_FOREACH_SAFE(classes_list, nnode, node) 205 EINA_INLIST_FOREACH_SAFE(classes_edges_list, nnode, node)
205 { 206 {
206 if(node->class && !eina_hash_find(classes_hash, node->class)) 207 if(node->class && !eina_hash_find(classes_hash, node->class))
207 { 208 {
@@ -218,7 +219,7 @@ static void _print_graph( Eina_Inlist *classes_list)
218 219
219 /* mark the roots */ 220 /* mark the roots */
220 fprintf(_file, "{rank=same; "); 221 fprintf(_file, "{rank=same; ");
221 EINA_INLIST_FOREACH_SAFE(classes_list, nnode, node) 222 EINA_INLIST_FOREACH_SAFE(classes_edges_list, nnode, node)
222 { 223 {
223 if(!node->parent) 224 if(!node->parent)
224 { 225 {
@@ -228,7 +229,7 @@ static void _print_graph( Eina_Inlist *classes_list)
228 fprintf(_file, "}\n"); 229 fprintf(_file, "}\n");
229 230
230/*print classes edges */ 231/*print classes edges */
231 EINA_INLIST_FOREACH_SAFE(classes_list, nnode, node) 232 EINA_INLIST_FOREACH_SAFE(classes_edges_list, nnode, node)
232 { 233 {
233 if(node->parent && node->class) 234 if(node->parent && node->class)
234 fprintf(_file, "\"%s\" -> \"%s\"\n", node->parent, node->class); 235 fprintf(_file, "\"%s\" -> \"%s\"\n", node->parent, node->class);
@@ -238,9 +239,9 @@ static void _print_graph( Eina_Inlist *classes_list)
238 239
239 240
240 /* Delete the inlist */ 241 /* Delete the inlist */
241 EINA_INLIST_FOREACH_SAFE(classes_list, nnode, node) 242 EINA_INLIST_FOREACH_SAFE(classes_edges_list, nnode, node)
242 { 243 {
243 classes_list = eina_inlist_remove(classes_list, 244 classes_edges_list = eina_inlist_remove(classes_edges_list,
244 EINA_INLIST_GET(node)); 245 EINA_INLIST_GET(node));
245 246
246 free(node); 247 free(node);
@@ -248,8 +249,8 @@ static void _print_graph( Eina_Inlist *classes_list)
248 249
249} 250}
250 251
251static Eina_Inlist * 252static void
252_add_class_edge(const char *class_name, const char *parent_name, Eina_Inlist *classes_list) 253_add_class_edge(const char *class_name, const char *parent_name)
253{ 254{
254 _Class_Node* d; 255 _Class_Node* d;
255 _Class_Node *node = NULL; 256 _Class_Node *node = NULL;
@@ -257,36 +258,34 @@ _add_class_edge(const char *class_name, const char *parent_name, Eina_Inlist *cl
257 258
258 /* dont add double edges */ 259 /* dont add double edges */
259 if(parent_name) 260 if(parent_name)
260 EINA_INLIST_FOREACH_SAFE(classes_list, nnode, node) 261 EINA_INLIST_FOREACH_SAFE(classes_edges_list, nnode, node)
261 { 262 {
262 if((node->parent && !strcmp(parent_name, node->parent)) && 263 if((node->parent && !strcmp(parent_name, node->parent)) &&
263 !strcmp(class_name, node->class)) 264 !strcmp(class_name, node->class))
264 return classes_list; 265 return;
265 } 266 }
266 267
267 d = malloc(sizeof(*d)); 268 d = malloc(sizeof(*d));
268 d->parent = parent_name; 269 d->parent = parent_name;
269 d->class = class_name; 270 d->class = class_name;
270 271
271 return eina_inlist_append(classes_list, EINA_INLIST_GET(d)); 272 classes_edges_list = eina_inlist_append(classes_edges_list, EINA_INLIST_GET(d));
272} 273}
273 274
274static Eina_Inlist* _prints_class_mode(const Eolian_Class *ekl, Eina_Inlist *classes_list) 275static void _prints_class_mode(const Eolian_Class *ekl)
275{ 276{
276 classes_list = _add_class_edge( 277 _add_class_edge(
277 eolian_class_full_name_get(ekl), NULL, classes_list); 278 eolian_class_full_name_get(ekl), NULL);
278
279 return classes_list;
280} 279}
281 280
282static Eina_Inlist* _prints_inherit_tree_mode(const Eolian_Class *ekl, Eina_Inlist *classes_list) 281static void _prints_inherit_tree_mode(const Eolian_Class *ekl)
283{ 282{
284 int depth = 0; 283 int depth = 0;
285 284
286 _push_queue(ekl); 285 _push_queue(ekl);
287 286
288 classes_list = _add_class_edge( 287 _add_class_edge(
289 eolian_class_full_name_get(ekl), NULL, classes_list); 288 eolian_class_full_name_get(ekl), NULL);
290 289
291 while((ekl = _pop_queue())) 290 while((ekl = _pop_queue()))
292 { 291 {
@@ -298,23 +297,21 @@ static Eina_Inlist* _prints_inherit_tree_mode(const Eolian_Class *ekl, Eina_Inli
298 ekl=eolian_class_get_by_name(ekl_name); 297 ekl=eolian_class_get_by_name(ekl_name);
299 _push_queue(ekl); 298 _push_queue(ekl);
300 299
301 classes_list = _add_class_edge( 300 _add_class_edge(
302 eolian_class_full_name_get(ekl), class_name, classes_list); 301 eolian_class_full_name_get(ekl), class_name);
303 } 302 }
304 eina_iterator_free(lst); 303 eina_iterator_free(lst);
305 } 304 }
306 queue_size = 0; 305 queue_size = 0;
307
308 return classes_list;
309} 306}
310 307
311static Eina_Inlist* _prints_inherits_from_mode(const Eolian_Class *ekl, Eina_Inlist *classes_list) 308static void _prints_inherits_from_mode(const Eolian_Class *ekl)
312{ 309{
313 Eina_Iterator *lst = eolian_all_classes_get(); 310 Eina_Iterator *lst = eolian_all_classes_get();
314 const char* class_name = eolian_class_full_name_get(ekl); 311 const char* class_name = eolian_class_full_name_get(ekl);
315 312
316 classes_list = _add_class_edge( 313 _add_class_edge(
317 class_name, NULL, classes_list); 314 class_name, NULL);
318 315
319 EINA_ITERATOR_FOREACH(lst, ekl) 316 EINA_ITERATOR_FOREACH(lst, ekl)
320 { 317 {
@@ -327,14 +324,12 @@ static Eina_Inlist* _prints_inherits_from_mode(const Eolian_Class *ekl, Eina_Inl
327 { 324 {
328 if(ekl_i == class_name){ 325 if(ekl_i == class_name){
329 326
330 classes_list = _add_class_edge( 327 _add_class_edge(
331 class_name, eolian_class_full_name_get(ekl), classes_list); 328 class_name, eolian_class_full_name_get(ekl));
332 } 329 }
333 } 330 }
334 } 331 }
335 eina_iterator_free(lst); 332 eina_iterator_free(lst);
336
337 return classes_list;
338} 333}
339 334
340static void _print_help(const char *program) 335static void _print_help(const char *program)
@@ -475,9 +470,8 @@ int main(int argc, char **argv)
475 470
476 if(mode) 471 if(mode)
477 { 472 {
478 Eina_Inlist *classes_list = NULL;
479 eolian_all_eo_files_parse(); 473 eolian_all_eo_files_parse();
480 while(name_start < name_end ) 474 while(name_start < name_end)
481 { 475 {
482 char *class_path = argv[name_start++]; 476 char *class_path = argv[name_start++];
483 _mode *current_m = _modes; 477 _mode *current_m = _modes;
@@ -502,7 +496,7 @@ int main(int argc, char **argv)
502 496
503 if(!strcmp(current_m->name_s, mode) || !strcmp(current_m->name_l, mode)) 497 if(!strcmp(current_m->name_s, mode) || !strcmp(current_m->name_l, mode))
504 { 498 {
505 classes_list = current_m->func(ekl, classes_list); 499 current_m->func(ekl);
506 break; 500 break;
507 } 501 }
508 502
@@ -521,7 +515,7 @@ int main(int argc, char **argv)
521 goto end; 515 goto end;
522 } 516 }
523 } 517 }
524 _print_graph(classes_list); 518 _print_graph();
525 if(output) 519 if(output)
526 fclose(_file); 520 fclose(_file);
527 521