summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvi Levin <avi.levin@samsung.com>2015-06-09 09:55:06 +0300
committerAvi Levin <avi.levin@samsung.com>2015-06-09 09:55:06 +0300
commit66245133b2c04eb89c0a2766c9e3ee9e6c388a2f (patch)
tree96dc5c3af7d26db0ca16ea1697c8b31aac79baeb
parent48cf2f4dfc6b6eda4ab2714899353d70746de545 (diff)
Eolian_info: cleaning and ficing spaces
-rw-r--r--src/bin/.main.c.swpbin45056 -> 45056 bytes
-rw-r--r--src/bin/main.c91
2 files changed, 28 insertions, 63 deletions
diff --git a/src/bin/.main.c.swp b/src/bin/.main.c.swp
index f1131fa..8100635 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 d5220c5..a7b4bba 100644
--- a/src/bin/main.c
+++ b/src/bin/main.c
@@ -37,30 +37,16 @@ int _eolian_info_log_dom;
37#endif 37#endif
38#define CRIT(...) EINA_LOG_DOM_CRIT(_eolian_info_log_dom, __VA_ARGS__) 38#define CRIT(...) EINA_LOG_DOM_CRIT(_eolian_info_log_dom, __VA_ARGS__)
39 39
40static void _prints_inherit_tree_scope(const Eolian_Class *ekl, int depth_max); 40#define MAX_CHARS_FILTER 4
41static void _prints_inherits_from_scope(const Eolian_Class *ekl, int depth_max); 41
42static void _file_filter(const Eolian_Class *ekl, Eina_Strbuf *buf); 42static void _file_filter(const Eolian_Class *ekl, Eina_Strbuf *buf);
43static void _event_filter(const Eolian_Class *ekl, Eina_Strbuf *buf); 43static void _event_filter(const Eolian_Class *ekl, Eina_Strbuf *buf);
44 44
45const Eolian_Class* queue[200];
46int queue_size=0;
47FILE* _file = NULL; 45FILE* _file = NULL;
48Eina_Inlist *classes_edges_list = NULL; 46Eina_Inlist *classes_edges_list = NULL;
49 47
50typedef struct 48typedef struct
51{ 49{
52 const char *name_l, *name_s;
53 void (*func)(const Eolian_Class *ekl, int depth_max);
54} _scope;
55
56static _scope _scopes[] = {
57 {"inheritance_tree", "i_t",_prints_inherit_tree_scope},
58 {"inherited_from", "i_f", _prints_inherits_from_scope},
59 {NULL, NULL, NULL}
60};
61
62typedef struct
63{
64 const char* name; 50 const char* name;
65 void (*func)(const Eolian_Class*, Eina_Strbuf *); 51 void (*func)(const Eolian_Class*, Eina_Strbuf *);
66 Eina_Bool active; 52 Eina_Bool active;
@@ -78,24 +64,8 @@ typedef struct
78 const char *class, *parent; 64 const char *class, *parent;
79} _Class_Node; 65} _Class_Node;
80 66
81static void _push_queue(const Eolian_Class* cl) 67static void
82{ 68_file_filter(const Eolian_Class *ekl, Eina_Strbuf *buf)
83 queue[queue_size] = cl;
84
85 queue_size++;
86}
87
88static const Eolian_Class* _pop_queue()
89{
90 queue_size--;
91 if(queue_size<0)
92 return NULL;
93
94 return queue[queue_size];
95}
96#define MAX_CHARS_FILTER 40
97
98static void _file_filter(const Eolian_Class *ekl, Eina_Strbuf *buf)
99{ 69{
100 Eina_Stringshare* class_file = eolian_class_file_get(ekl); 70 Eina_Stringshare* class_file = eolian_class_file_get(ekl);
101 71
@@ -103,7 +73,8 @@ static void _file_filter(const Eolian_Class *ekl, Eina_Strbuf *buf)
103 eina_strbuf_append(buf, class_file); 73 eina_strbuf_append(buf, class_file);
104} 74}
105 75
106static void _event_filter(const Eolian_Class *ekl, Eina_Strbuf *buf) 76static void
77_event_filter(const Eolian_Class *ekl, Eina_Strbuf *buf)
107{ 78{
108 Eina_Iterator *lst_events = eolian_class_events_get(ekl); 79 Eina_Iterator *lst_events = eolian_class_events_get(ekl);
109 const Eolian_Event* event; 80 const Eolian_Event* event;
@@ -130,7 +101,8 @@ static void _event_filter(const Eolian_Class *ekl, Eina_Strbuf *buf)
130 eina_iterator_free(lst_events); 101 eina_iterator_free(lst_events);
131} 102}
132 103
133static void _print_class(const char *class_name) 104static void
105_print_class(const char *class_name)
134{ 106{
135 const Eolian_Class *ekl = eolian_class_get_by_name(class_name); 107 const Eolian_Class *ekl = eolian_class_get_by_name(class_name);
136 const char* desc = eolian_class_description_get(ekl); 108 const char* desc = eolian_class_description_get(ekl);
@@ -174,7 +146,8 @@ static void _print_class(const char *class_name)
174 fprintf(_file, "}\"]\n"); 146 fprintf(_file, "}\"]\n");
175} 147}
176 148
177static void _print_graph() 149static void
150_print_graph()
178{ 151{
179 _Class_Node *node = NULL; 152 _Class_Node *node = NULL;
180 Eina_Inlist *nnode; 153 Eina_Inlist *nnode;
@@ -231,7 +204,6 @@ static void _print_graph()
231 204
232 fprintf(_file, "}\n"); 205 fprintf(_file, "}\n");
233 206
234
235 /* Delete the inlist */ 207 /* Delete the inlist */
236 EINA_INLIST_FOREACH_SAFE(classes_edges_list, nnode, node) 208 EINA_INLIST_FOREACH_SAFE(classes_edges_list, nnode, node)
237 { 209 {
@@ -265,7 +237,8 @@ _add_class_edge(const char *class_name, const char *parent_name)
265 classes_edges_list = eina_inlist_append(classes_edges_list, EINA_INLIST_GET(d)); 237 classes_edges_list = eina_inlist_append(classes_edges_list, EINA_INLIST_GET(d));
266} 238}
267 239
268static void _prints_inherit_tree_scope_rec(const Eolian_Class *ekl, int depth) 240static void
241_inherit_tree_scope_rec(const Eolian_Class *ekl, int depth)
269{ 242{
270 if(depth<= 0 ) 243 if(depth<= 0 )
271 return; 244 return;
@@ -273,6 +246,7 @@ static void _prints_inherit_tree_scope_rec(const Eolian_Class *ekl, int depth)
273 Eina_Iterator *lst = eolian_class_inherits_get(ekl); 246 Eina_Iterator *lst = eolian_class_inherits_get(ekl);
274 const char* class_name = eolian_class_full_name_get(ekl); 247 const char* class_name = eolian_class_full_name_get(ekl);
275 const char* ekl_name; 248 const char* ekl_name;
249
276 EINA_ITERATOR_FOREACH(lst, ekl_name) 250 EINA_ITERATOR_FOREACH(lst, ekl_name)
277 { 251 {
278 ekl=eolian_class_get_by_name(ekl_name); 252 ekl=eolian_class_get_by_name(ekl_name);
@@ -280,13 +254,13 @@ static void _prints_inherit_tree_scope_rec(const Eolian_Class *ekl, int depth)
280 _add_class_edge( 254 _add_class_edge(
281 class_name, eolian_class_full_name_get(ekl)); 255 class_name, eolian_class_full_name_get(ekl));
282 256
283 _prints_inherit_tree_scope_rec(ekl, depth - 1); 257 _inherit_tree_scope_rec(ekl, depth - 1);
284 } 258 }
285 eina_iterator_free(lst); 259 eina_iterator_free(lst);
286
287} 260}
288 261
289static void _prints_inherit_tree_scope(const Eolian_Class *ekl, int depth_max) 262static void
263_inherit_tree_scope(const Eolian_Class *ekl, int depth_max)
290{ 264{
291 if(depth_max<= 0 ) 265 if(depth_max<= 0 )
292 return; 266 return;
@@ -294,11 +268,11 @@ static void _prints_inherit_tree_scope(const Eolian_Class *ekl, int depth_max)
294 _add_class_edge( 268 _add_class_edge(
295 eolian_class_full_name_get(ekl), NULL); 269 eolian_class_full_name_get(ekl), NULL);
296 270
297 _prints_inherit_tree_scope_rec(ekl, depth_max); 271 _inherit_tree_scope_rec(ekl, depth_max);
298} 272}
299 273
300static int 274static int
301_prints_inherits_from_scope_recur(const Eolian_Class *ekl, 275_inherits_from_scope_recur(const Eolian_Class *ekl,
302 Eina_Hash *classes_hash, const char *des_class_name, int depth_max) 276 Eina_Hash *classes_hash, const char *des_class_name, int depth_max)
303{ 277{
304 const char *class_name = eolian_class_full_name_get(ekl); 278 const char *class_name = eolian_class_full_name_get(ekl);
@@ -318,12 +292,12 @@ _prints_inherits_from_scope_recur(const Eolian_Class *ekl,
318 int depth_class = -1; 292 int depth_class = -1;
319 if(!hash) 293 if(!hash)
320 { 294 {
321 depth_class = _prints_inherits_from_scope_recur( 295 depth_class = _inherits_from_scope_recur(
322 ekl, classes_hash, des_class_name, depth_max); 296 ekl, classes_hash, des_class_name, depth_max);
323 eina_hash_add(classes_hash, ekl, (void*)(int64_t)depth_class ); 297 eina_hash_add(classes_hash, ekl, (void*)(uintptr_t)depth_class );
324 298
325 } 299 }
326 else depth_class = (int)(int64_t)hash; 300 else depth_class = (int)(uintptr_t)hash;
327 301
328 if(depth_class>=0){ 302 if(depth_class>=0){
329 if(depth_class<=depth_max){ 303 if(depth_class<=depth_max){
@@ -339,7 +313,8 @@ _prints_inherits_from_scope_recur(const Eolian_Class *ekl,
339 return min_found_depth>=0 ? min_found_depth+1 : -1; 313 return min_found_depth>=0 ? min_found_depth+1 : -1;
340} 314}
341 315
342static void _prints_inherits_from_scope(const Eolian_Class *ekl, int depth_max) 316static void
317_inherits_from_scope(const Eolian_Class *ekl, int depth_max)
343{ 318{
344 const char* class_name = eolian_class_full_name_get(ekl); 319 const char* class_name = eolian_class_full_name_get(ekl);
345 if(depth_max<= 0 ) 320 if(depth_max<= 0 )
@@ -356,8 +331,7 @@ static void _prints_inherits_from_scope(const Eolian_Class *ekl, int depth_max)
356 { 331 {
357 if(!eina_hash_find(classes_hash, ekl)) 332 if(!eina_hash_find(classes_hash, ekl))
358 { 333 {
359 334 _inherits_from_scope_recur(
360 _prints_inherits_from_scope_recur(
361 ekl, classes_hash, class_name, depth_max); 335 ekl, classes_hash, class_name, depth_max);
362 } 336 }
363 } 337 }
@@ -365,23 +339,14 @@ static void _prints_inherits_from_scope(const Eolian_Class *ekl, int depth_max)
365 eina_iterator_free(lst); 339 eina_iterator_free(lst);
366} 340}
367 341
368static void _print_help(const char *program) 342static void
343_print_help(const char *program)
369{ 344{
370 printf("Usage: %s [options] class_path/class_name...\n", program); 345 printf("Usage: %s [options] class_path/class_name...\n", program);
371 printf("Options:\n"); 346 printf("Options:\n");
372 printf(" --help/-h Display this information\n"); 347 printf(" --help/-h Display this information\n");
373 printf(" --output/-o <outFile> Set output filename to <outFile>\n"); 348 printf(" --output/-o <outFile> Set output filename to <outFile>\n");
374 printf(" --include/-I <includeDir> Add <includeDir> to the list of include dirs for scanning\n"); 349 printf(" --include/-I <includeDir> Add <includeDir> to the list of include dirs for scanning\n");
375 printf(" --scope/-s <scope> Set scope(of classes we will work on) to one of:\n ");
376 _scope *current_s = _scopes;
377
378 while(current_s->name_l != NULL )
379 {
380 printf("%s(or %s), ", current_s->name_l, current_s->name_s);
381
382 current_s++;
383 }
384 printf("\n");
385 printf(" --filters/-f <filter1,...> Set filters(the info of the class\n "\ 350 printf(" --filters/-f <filter1,...> Set filters(the info of the class\n "\
386 "that will be printed) to the list seperated by comma of:\n "); 351 "that will be printed) to the list seperated by comma of:\n ");
387 _filter *current_f = _filters; 352 _filter *current_f = _filters;
@@ -538,12 +503,12 @@ int main(int argc, char **argv)
538 503
539 if(!no_inheritance) 504 if(!no_inheritance)
540 { 505 {
541 _prints_inherit_tree_scope(ekl, max_depth); 506 _inherit_tree_scope(ekl, max_depth);
542 } 507 }
543 if(inheritors) 508 if(inheritors)
544 { 509 {
545 printf("inheritors!\n"); 510 printf("inheritors!\n");
546 _prints_inherits_from_scope(ekl, max_depth); 511 _inherits_from_scope(ekl, max_depth);
547 } 512 }
548 513
549 } 514 }