summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2015-06-17 14:26:07 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2015-06-17 14:26:07 +0100
commit51f49642b4bd9852163a45d2d4480e070e107472 (patch)
treef9af54f5afadc2de9dbaba43757fa95b5e8e5633 /src
parentf800e8a3bfe0a36ddc55b8d0498a252727c0ec3c (diff)
eolian: remove the outdated and ugly database printer (needs rework)
Diffstat (limited to 'src')
-rw-r--r--src/Makefile_Eolian.am1
-rw-r--r--src/bin/eolian/main.c11
-rw-r--r--src/bindings/luajit/eolian.lua35
-rw-r--r--src/lib/eolian/Eolian.h147
-rw-r--r--src/lib/eolian/database_print.c403
5 files changed, 2 insertions, 595 deletions
diff --git a/src/Makefile_Eolian.am b/src/Makefile_Eolian.am
index 6c06368563..a5635fd179 100644
--- a/src/Makefile_Eolian.am
+++ b/src/Makefile_Eolian.am
@@ -29,7 +29,6 @@ lib_eolian_libeolian_la_SOURCES = \
29 lib/eolian/database_constructor_api.c \ 29 lib/eolian/database_constructor_api.c \
30 lib/eolian/database_event.c \ 30 lib/eolian/database_event.c \
31 lib/eolian/database_event_api.c \ 31 lib/eolian/database_event_api.c \
32 lib/eolian/database_print.c \
33 lib/eolian/database_expr.c \ 32 lib/eolian/database_expr.c \
34 lib/eolian/database_expr_api.c \ 33 lib/eolian/database_expr_api.c \
35 lib/eolian/database_var.c \ 34 lib/eolian/database_var.c \
diff --git a/src/bin/eolian/main.c b/src/bin/eolian/main.c
index 0e7c0901f4..f2dbd5a8e8 100644
--- a/src/bin/eolian/main.c
+++ b/src/bin/eolian/main.c
@@ -315,7 +315,7 @@ static int legacy_support = 0;
315int main(int argc, char **argv) 315int main(int argc, char **argv)
316{ 316{
317 int ret = 1; 317 int ret = 1;
318 Eina_Bool help = EINA_FALSE, show = EINA_FALSE; 318 Eina_Bool help = EINA_FALSE;
319 const char *eo_filename = NULL; 319 const char *eo_filename = NULL;
320 char *output_filename = NULL; /* if NULL, have to generate, otherwise use the name stored there */ 320 char *output_filename = NULL; /* if NULL, have to generate, otherwise use the name stored there */
321 char *eo_filename_copy = NULL, *eo_file_basename; 321 char *eo_filename_copy = NULL, *eo_file_basename;
@@ -340,7 +340,6 @@ int main(int argc, char **argv)
340 { 340 {
341 /* These options set a flag. */ 341 /* These options set a flag. */
342 {"eo", no_argument, &eo_needed, 1}, 342 {"eo", no_argument, &eo_needed, 1},
343 {"verbose", no_argument, 0, 'v'},
344 {"help", no_argument, 0, 'h'}, 343 {"help", no_argument, 0, 'h'},
345 {"gh", no_argument, &gen_opt, H_GEN}, 344 {"gh", no_argument, &gen_opt, H_GEN},
346 {"gc", no_argument, &gen_opt, C_GEN}, 345 {"gc", no_argument, &gen_opt, C_GEN},
@@ -361,7 +360,6 @@ int main(int argc, char **argv)
361 output_filename = strdup(optarg); 360 output_filename = strdup(optarg);
362 break; 361 break;
363 } 362 }
364 case 'v': show = EINA_TRUE; break;
365 case 'h': help = EINA_TRUE; break; 363 case 'h': help = EINA_TRUE; break;
366 case 'I': 364 case 'I':
367 { 365 {
@@ -380,7 +378,7 @@ int main(int argc, char **argv)
380 378
381 if (help) 379 if (help)
382 { 380 {
383 printf("Usage: %s [-h/--help] [-v/--verbose] [-I/--include input_dir] [--legacy] [--gh|--gc|--gi] [--output/-o outfile] file.eo ... \n", argv[0]); 381 printf("Usage: %s [-h/--help] [-I/--include input_dir] [--legacy] [--gh|--gc|--gi] [--output/-o outfile] file.eo ... \n", argv[0]);
384 printf(" --help/-h Print that help\n"); 382 printf(" --help/-h Print that help\n");
385 printf(" --include/-I Include 'input_dir' as directory to search .eo files into\n"); 383 printf(" --include/-I Include 'input_dir' as directory to search .eo files into\n");
386 printf(" --output/-o Force output filename to 'outfile'\n"); 384 printf(" --output/-o Force output filename to 'outfile'\n");
@@ -416,11 +414,6 @@ int main(int argc, char **argv)
416 414
417 eo_filename_copy = strdup(eo_filename); 415 eo_filename_copy = strdup(eo_filename);
418 eo_file_basename = basename(eo_filename_copy); 416 eo_file_basename = basename(eo_filename_copy);
419 if (show)
420 {
421 const Eolian_Class *class = eolian_class_get_by_file(eo_file_basename);
422 if (class) eolian_show_class(class);
423 }
424 417
425 /* Only needed for .eo files */ 418 /* Only needed for .eo files */
426 if (is_eo && !eo_needed && !(gen_opt == H_GEN && legacy_support)) 419 if (is_eo && !eo_needed && !(gen_opt == H_GEN && legacy_support))
diff --git a/src/bindings/luajit/eolian.lua b/src/bindings/luajit/eolian.lua
index 452cb75cb6..fa78cc2dcf 100644
--- a/src/bindings/luajit/eolian.lua
+++ b/src/bindings/luajit/eolian.lua
@@ -189,13 +189,6 @@ ffi.cdef [[
189 Eina_Bool eolian_all_eo_files_parse(); 189 Eina_Bool eolian_all_eo_files_parse();
190 Eina_Bool eolian_all_eot_files_parse(); 190 Eina_Bool eolian_all_eot_files_parse();
191 Eina_Bool eolian_database_validate(void); 191 Eina_Bool eolian_database_validate(void);
192 Eina_Bool eolian_show_class(const Eolian_Class *klass);
193 Eina_Bool eolian_show_typedef(const char *alias);
194 Eina_Bool eolian_show_struct(const char *name);
195 Eina_Bool eolian_show_enum(const char *name);
196 Eina_Bool eolian_show_global(const char *name);
197 Eina_Bool eolian_show_constant(const char *name);
198 void eolian_show_all();
199 const Eolian_Class *eolian_class_get_by_name(const char *class_name); 192 const Eolian_Class *eolian_class_get_by_name(const char *class_name);
200 const Eolian_Class *eolian_class_get_by_file(const char *file_name); 193 const Eolian_Class *eolian_class_get_by_file(const char *file_name);
201 const char *eolian_class_file_get(const Eolian_Class *klass); 194 const char *eolian_class_file_get(const Eolian_Class *klass);
@@ -409,34 +402,6 @@ M.database_validate = function()
409 return eolian.eolian_database_validate() ~= 0 402 return eolian.eolian_database_validate() ~= 0
410end 403end
411 404
412M.show_class = function(klass)
413 return eolian.eolian_show_class(klass) ~= 0
414end
415
416M.show_typedef = function(alias)
417 return eolian.eolian_show_typedef(alias) ~= 0
418end
419
420M.show_struct = function(name)
421 return eolian.eolian_show_typedef(name) ~= 0
422end
423
424M.show_enum = function(name)
425 return eolian.eolian_show_enum(name) ~= 0
426end
427
428M.show_global = function(name)
429 return eolian.eolian_show_global(name) ~= 0
430end
431
432M.show_constant = function(name)
433 return eolian.eolian_show_constant(name) ~= 0
434end
435
436M.show_all = function()
437 eolian.eolian_show_all()
438end
439
440M.declaration_type = { 405M.declaration_type = {
441 UNKNOWN = -1, 406 UNKNOWN = -1,
442 CLASS = 0, 407 CLASS = 0,
diff --git a/src/lib/eolian/Eolian.h b/src/lib/eolian/Eolian.h
index c7981371e3..5ebd90d1ca 100644
--- a/src/lib/eolian/Eolian.h
+++ b/src/lib/eolian/Eolian.h
@@ -462,153 +462,6 @@ EAPI Eina_Bool eolian_all_eot_files_parse(void);
462EAPI Eina_Bool eolian_database_validate(void); 462EAPI Eina_Bool eolian_database_validate(void);
463 463
464/* 464/*
465 * @brief Show information about a given class.
466 *
467 * If klass is NULL, this function will print information of
468 * all the classes stored into the database.
469 *
470 * @param[in] klass the class to show
471 *
472 * @return EINA_TRUE on success, EINA_FALSE otherwise (currently always
473 * succeeds).
474 *
475 * @see eolian_show_typedef
476 * @see eolian_show_struct
477 * @see eolian_show_enum
478 * @see eolian_show_global
479 * @see eolian_show_constant
480 * @see eolian_show_all
481 *
482 * @ingroup Eolian
483 */
484EAPI Eina_Bool eolian_show_class(const Eolian_Class *klass);
485
486/*
487 * @brief Show information about a given typedef.
488 *
489 * If @c alias is NULL, this function will print information of
490 * all the typedefs.
491 *
492 * @param[in] alias the typedef to show.
493 *
494 * @return EINA_TRUE on success, EINA_FALSE otherwise (when typedef is not
495 * found).
496 *
497 * @see eolian_show_class
498 * @see eolian_show_struct
499 * @see eolian_show_enum
500 * @see eolian_show_global
501 * @see eolian_show_constant
502 * @see eolian_show_all
503 *
504 * @ingroup Eolian
505 */
506EAPI Eina_Bool eolian_show_typedef(const char *alias);
507
508/*
509 * @brief Show information about a given struct.
510 *
511 * If @c name is NULL, this function will print information of
512 * all the named global structs.
513 *
514 * @param[in] name the struct to show.
515 *
516 * @return EINA_TRUE on success, EINA_FALSE otherwise (when struct is not
517 * found).
518 *
519 * @see eolian_show_class
520 * @see eolian_show_typedef
521 * @see eolian_show_enum
522 * @see eolian_show_global
523 * @see eolian_show_constant
524 * @see eolian_show_all
525 *
526 * @ingroup Eolian
527 */
528EAPI Eina_Bool eolian_show_struct(const char *name);
529
530/*
531 * @brief Show information about a given enum.
532 *
533 * If @c name is NULL, this function will print information of
534 * all the enums.
535 *
536 * @param[in] name the enum to show.
537 *
538 * @return EINA_TRUE on success, EINA_FALSE otherwise (when enum is not
539 * found).
540 *
541 * @see eolian_show_class
542 * @see eolian_show_typedef
543 * @see eolian_show_struct
544 * @see eolian_show_global
545 * @see eolian_show_constant
546 * @see eolian_show_all
547 *
548 * @ingroup Eolian
549 */
550EAPI Eina_Bool eolian_show_enum(const char *name);
551
552/*
553 * @brief Show information about a given global.
554 *
555 * If @c name is NULL, this function will print information of
556 * all the globals.
557 *
558 * @param[in] name the global to show.
559 *
560 * @return EINA_TRUE on success, EINA_FALSE otherwise (when global is not
561 * found).
562 *
563 * @see eolian_show_class
564 * @see eolian_show_typedef
565 * @see eolian_show_struct
566 * @see eolian_show_enum
567 * @see eolian_show_constant
568 * @see eolian_show_all
569 *
570 * @ingroup Eolian
571 */
572EAPI Eina_Bool eolian_show_global(const char *name);
573
574/*
575 * @brief Show information about a given constant.
576 *
577 * If @c name is NULL, this function will print information of
578 * all the constants.
579 *
580 * @param[in] name the constant to show.
581 *
582 * @return EINA_TRUE on success, EINA_FALSE otherwise (when constant is not
583 * found).
584 *
585 * @see eolian_show_class
586 * @see eolian_show_typedef
587 * @see eolian_show_struct
588 * @see eolian_show_enum
589 * @see eolian_show_global
590 * @see eolian_show_all
591 *
592 * @ingroup Eolian
593 */
594EAPI Eina_Bool eolian_show_constant(const char *name);
595
596/*
597 * @brief Show information about everything.
598 *
599 * This will print a complete dump of all information stored in the Eolian
600 * database.
601 *
602 * @see eolian_show_class
603 * @see eolian_show_typedef
604 * @see eolian_show_struct
605 * @see eolian_show_enum
606 *
607 * @ingroup Eolian
608 */
609EAPI void eolian_show_all(void);
610
611/*
612 * @brief Gets a class by its name 465 * @brief Gets a class by its name
613 * 466 *
614 * @param[in] class_name name of the class to get. 467 * @param[in] class_name name of the class to get.
diff --git a/src/lib/eolian/database_print.c b/src/lib/eolian/database_print.c
deleted file mode 100644
index 741a363c47..0000000000
--- a/src/lib/eolian/database_print.c
+++ /dev/null
@@ -1,403 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include "config.h"
3#endif
4
5#include <Eina.h>
6#include "eolian_database.h"
7
8static void
9_implements_print(Eolian_Implement *impl, int nb_spaces)
10{
11 const char *t;
12 Eolian_Function_Type ft = EOLIAN_UNRESOLVED;
13 eolian_implement_function_get(impl, &ft);
14 switch (ft)
15 {
16 case EOLIAN_PROP_SET: t = "SET"; break;
17 case EOLIAN_PROP_GET: t = "GET"; break;
18 case EOLIAN_METHOD: t = "METHOD"; break;
19 case EOLIAN_UNRESOLVED: t = ""; break;
20 default:
21 return;
22 }
23 printf("%*s <%s> <%s>\n", nb_spaces + 5, "", eolian_implement_full_name_get(impl), t);
24}
25
26static void
27_constructors_print(Eolian_Constructor *ctor, int nb_spaces)
28{
29 const char *t;
30 const Eolian_Function *func = eolian_constructor_function_get(ctor);
31 Eolian_Function_Type ft = eolian_function_type_get(func);
32 switch (ft)
33 {
34 case EOLIAN_PROP_SET: t = "SET"; break;
35 case EOLIAN_PROP_GET: t = "GET"; break;
36 case EOLIAN_METHOD: t = "METHOD"; break;
37 case EOLIAN_UNRESOLVED: t = ""; break;
38 default:
39 return;
40 }
41 printf("%*s <%s> <%s>\n", nb_spaces + 5, "", eolian_constructor_full_name_get(ctor), t);
42}
43
44
45static void
46_event_print(Eolian_Event *ev, int nb_spaces)
47{
48 const Eolian_Type *type = eolian_event_type_get(ev);
49 printf("%*s <%s> <", nb_spaces + 5, "", eolian_event_name_get(ev));
50 if (type) database_type_print((Eolian_Type*)type);
51 printf(">\n");
52}
53
54static Eina_Bool _function_print(const Eolian_Function *fid, int nb_spaces)
55{
56 EINA_SAFETY_ON_NULL_RETURN_VAL(fid, EINA_FALSE);
57 const char *ret_desc = eolian_function_return_comment_get(fid, fid->type);
58 const Eolian_Type *tp;
59 switch (fid->type)
60 {
61 case EOLIAN_PROPERTY:
62 {
63 printf("%*s<%s> %s\n", nb_spaces, "", ret_desc ? ret_desc : "", fid->name);
64 const char *str = eolian_function_description_get(fid, EOLIAN_PROP_GET);
65 if (str) printf("%*s<%s>\n", nb_spaces + 5, "", str);
66 str = eolian_function_description_get(fid, EOLIAN_PROP_SET);
67 if (str) printf("%*s<%s>\n", nb_spaces + 5, "", str);
68 str = eolian_function_legacy_get(fid, EOLIAN_PROP_GET);
69 if (str) printf("%*slegacy_get: <%s>\n", nb_spaces + 5, "", str);
70 str = eolian_function_legacy_get(fid, EOLIAN_PROP_SET);
71 if (str) printf("%*slegacy_set: <%s>\n", nb_spaces + 5, "", str);
72 tp = eolian_function_return_type_get(fid, EOLIAN_PROP_GET);
73 if (tp)
74 {
75 printf("%*sreturn type for get: <", nb_spaces + 5, "");
76 database_type_print((Eolian_Type*)tp);
77 printf(">\n");
78 }
79 tp = eolian_function_return_type_get(fid, EOLIAN_PROP_SET);
80 if (tp)
81 {
82 printf("%*sreturn type for set: <", nb_spaces + 5, "");
83 database_type_print((Eolian_Type*)tp);
84 printf(">\n");
85 }
86 break;
87 }
88 case EOLIAN_PROP_GET:
89 {
90 printf("%*sGET:<%s> %s\n", nb_spaces, "", ret_desc ? ret_desc : "", fid->name);
91 const char *str = eolian_function_description_get(fid, EOLIAN_PROP_GET);
92 if (str) printf("%*s<%s>\n", nb_spaces + 5, "", str);
93 str = eolian_function_legacy_get(fid, EOLIAN_PROP_GET);
94 if (str) printf("%*slegacy: <%s>\n", nb_spaces + 5, "", str);
95 tp = eolian_function_return_type_get(fid, EOLIAN_PROP_GET);
96 if (tp)
97 {
98 printf("%*sreturn type: <", nb_spaces + 5, "");
99 database_type_print((Eolian_Type*)tp);
100 printf(">\n");
101 }
102 break;
103 }
104 case EOLIAN_PROP_SET:
105 {
106 printf("%*sSET:<%s> %s\n", nb_spaces, "", ret_desc ? ret_desc : "", fid->name);
107 const char *str = eolian_function_description_get(fid, EOLIAN_PROP_SET);
108 if (str) printf("%*s<%s>\n", nb_spaces + 5, "", str);
109 str = eolian_function_legacy_get(fid, EOLIAN_PROP_SET);
110 if (str) printf("%*slegacy: <%s>\n", nb_spaces + 5, "", str);
111 tp = eolian_function_return_type_get(fid, EOLIAN_PROP_SET);
112 if (tp)
113 {
114 printf("%*sreturn type: <", nb_spaces + 5, "");
115 database_type_print((Eolian_Type*)tp);
116 printf(">\n");
117 }
118 break;
119 }
120 case EOLIAN_METHOD:
121 {
122 printf("%*s<%s> %s\n", nb_spaces, "", ret_desc ? ret_desc : "", fid->name);
123 const char *str = eolian_function_description_get(fid, EOLIAN_METHOD);
124 if (str) printf("%*s<%s>\n", nb_spaces + 5, "", str);
125 str = eolian_function_legacy_get(fid, EOLIAN_METHOD);
126 if (str) printf("%*slegacy: <%s>\n", nb_spaces + 5, "", str);
127 tp = eolian_function_return_type_get(fid, EOLIAN_METHOD);
128 if (tp)
129 {
130 printf("%*sreturn type: <", nb_spaces + 5, "");
131 database_type_print((Eolian_Type*)tp);
132 printf(">\n");
133 }
134 if (fid->obj_is_const) printf("%*sobj const: <true>\n", nb_spaces + 5, "");
135 break;
136 }
137 default:
138 return EINA_FALSE;
139 }
140 Eina_List *itr;
141 Eolian_Function_Parameter *param;
142 EINA_LIST_FOREACH(fid->params, itr, param)
143 {
144 char *param_dir = NULL;
145 switch (param->param_dir)
146 {
147 case EOLIAN_IN_PARAM:
148 param_dir = "IN";
149 break;
150 case EOLIAN_OUT_PARAM:
151 param_dir = "OUT";
152 break;
153 case EOLIAN_INOUT_PARAM:
154 param_dir = "INOUT";
155 break;
156 }
157 printf("%*s%s <%s> <", nb_spaces + 5, "", param_dir, param->name);
158 database_type_print((Eolian_Type*)param->type);
159 printf("> <%s>\n", param->description?param->description:"");
160 }
161 return EINA_TRUE;
162}
163
164static Eina_Bool
165_class_print(const Eolian_Class *cl)
166{
167 Eina_List *itr;
168 Eolian_Function *function;
169 const char *types[5] = {"", "Regular", "Regular Non Instantiable", "Mixin", "Interface"};
170
171 EINA_SAFETY_ON_NULL_RETURN_VAL(cl, EINA_FALSE);
172 printf("Class %s:\n", cl->name);
173 if (cl->description)
174 printf(" description: <%s>\n", cl->description);
175
176 printf(" type: %s\n", types[cl->type]);
177
178 // Inherits
179 if (cl->inherits)
180 {
181 printf(" inherits: ");
182 char *word;
183 EINA_LIST_FOREACH(cl->inherits, itr, word)
184 printf("%s ", word);
185 printf("\n");
186 }
187
188 // Legacy prefix
189 if (cl->legacy_prefix)
190 {
191 printf(" legacy prefix: <%s>\n", cl->legacy_prefix);
192 }
193
194 // Eo prefix
195 if (cl->eo_prefix)
196 {
197 printf(" Eo prefix: <%s>\n", cl->eo_prefix);
198 }
199
200 // Data type
201 if (cl->data_type)
202 {
203 printf(" Data type: <%s>\n", cl->data_type);
204 }
205
206 // Properties
207 printf(" properties:\n");
208 EINA_LIST_FOREACH(cl->properties, itr, function)
209 {
210 _function_print(function, 4);
211 }
212 printf("\n");
213
214 // Methods
215 printf(" methods:\n");
216 EINA_LIST_FOREACH(cl->methods, itr, function)
217 {
218 _function_print(function, 4);
219 }
220 printf("\n");
221
222 // Implement
223 printf(" implements:\n");
224 Eolian_Implement *impl;
225 EINA_LIST_FOREACH(cl->implements, itr, impl)
226 {
227 _implements_print(impl, 4);
228 }
229 printf("\n");
230
231 // Constructor
232 printf(" constructors:\n");
233 Eolian_Constructor *ctor;
234 EINA_LIST_FOREACH(cl->constructors, itr, ctor)
235 {
236 _constructors_print(ctor, 4);
237 }
238 printf("\n");
239
240 // Implement
241 printf(" events:\n");
242 Eolian_Event *ev;
243 EINA_LIST_FOREACH(cl->events, itr, ev)
244 {
245 _event_print(ev, 4);
246 }
247 printf("\n");
248
249 return EINA_TRUE;
250}
251
252static Eina_Bool
253_cl_print_cb(const Eina_Hash *hash EINA_UNUSED, const void *key EINA_UNUSED,
254 void *data, void *fdata EINA_UNUSED)
255{
256 _class_print((Eolian_Class*)data);
257 return EINA_TRUE;
258}
259
260EAPI Eina_Bool
261eolian_show_class(const Eolian_Class *class)
262{
263 if (!class)
264 eina_hash_foreach(_classes, _cl_print_cb, NULL);
265 else
266 _class_print(class);
267 return EINA_TRUE;
268}
269
270static Eina_Bool
271_typedef_cb(Eina_Hash *hash EINA_UNUSED, const char *alias,
272 const Eolian_Type *tp, const void *fdata EINA_UNUSED)
273{
274 printf("Typedef: %s\n", alias);
275 printf(" type: <");
276 database_type_print(tp->base_type);
277 printf(">\n");
278 return EINA_TRUE;
279}
280
281EAPI Eina_Bool
282eolian_show_typedef(const char *alias)
283{
284 if (!alias)
285 eina_hash_foreach(_aliases, (Eina_Hash_Foreach)_typedef_cb, NULL);
286 else
287 {
288 Eina_Stringshare *shr = eina_stringshare_add(alias);
289 Eolian_Type *tp = eina_hash_find(_aliases, shr);
290 eina_stringshare_del(shr);
291 if (!tp) return EINA_FALSE;
292 _typedef_cb(NULL, alias, tp, NULL);
293 }
294 return EINA_TRUE;
295}
296
297static Eina_Bool
298_struct_cb(Eina_Hash *hash EINA_UNUSED, const char *name,
299 const Eolian_Type *tp, const void *fdata EINA_UNUSED)
300{
301 printf("Struct: %s\n", name);
302 printf(" type: <");
303 database_type_print((Eolian_Type*)tp);
304 printf(">\n");
305 return EINA_TRUE;
306}
307
308EAPI Eina_Bool
309eolian_show_struct(const char *name)
310{
311 if (!name)
312 eina_hash_foreach(_structs, (Eina_Hash_Foreach)_struct_cb, NULL);
313 else
314 {
315 Eina_Stringshare *shr = eina_stringshare_add(name);
316 Eolian_Type *tp = eina_hash_find(_structs, shr);
317 eina_stringshare_del(shr);
318 if (!tp) return EINA_FALSE;
319 _struct_cb(NULL, name, tp, NULL);
320 }
321 return EINA_TRUE;
322}
323
324static Eina_Bool
325_enum_cb(Eina_Hash *hash EINA_UNUSED, const char *name,
326 const Eolian_Type *tp, const void *fdata EINA_UNUSED)
327{
328 printf("Enum: %s\n", name);
329 printf(" type: <");
330 database_type_print((Eolian_Type*)tp);
331 printf(">\n");
332 return EINA_TRUE;
333}
334
335EAPI Eina_Bool
336eolian_show_enum(const char *name)
337{
338 if (!name)
339 eina_hash_foreach(_enums, (Eina_Hash_Foreach)_enum_cb, NULL);
340 else
341 {
342 Eina_Stringshare *shr = eina_stringshare_add(name);
343 Eolian_Type *tp = eina_hash_find(_enums, shr);
344 eina_stringshare_del(shr);
345 if (!tp) return EINA_FALSE;
346 _enum_cb(NULL, name, tp, NULL);
347 }
348 return EINA_TRUE;
349}
350
351static Eina_Bool
352_var_cb(Eina_Hash *hash EINA_UNUSED, const char *name,
353 const Eolian_Variable *var, const void *fdata EINA_UNUSED)
354{
355 if (var->type == EOLIAN_VAR_CONSTANT)
356 printf("Constant: %s\n", name);
357 else
358 printf("Global: %s\n", name);
359 printf(" value: <");
360 database_expr_print(var->value);
361 printf(">\n");
362 return EINA_TRUE;
363}
364
365EAPI Eina_Bool
366eolian_show_global(const char *name)
367{
368 if (!name)
369 eina_hash_foreach(_globals, (Eina_Hash_Foreach)_var_cb, NULL);
370 else
371 {
372 Eina_Stringshare *shr = eina_stringshare_add(name);
373 Eolian_Variable *var = eina_hash_find(_globals, shr);
374 eina_stringshare_del(shr);
375 if (!var) return EINA_FALSE;
376 _var_cb(NULL, name, var, NULL);
377 }
378 return EINA_TRUE;
379}
380
381EAPI Eina_Bool
382eolian_show_constant(const char *name)
383{
384 if (!name)
385 eina_hash_foreach(_constants, (Eina_Hash_Foreach)_var_cb, NULL);
386 else
387 {
388 Eina_Stringshare *shr = eina_stringshare_add(name);
389 Eolian_Variable *var = eina_hash_find(_constants, shr);
390 eina_stringshare_del(shr);
391 if (!var) return EINA_FALSE;
392 _var_cb(NULL, name, var, NULL);
393 }
394 return EINA_TRUE;
395}
396
397EAPI void
398eolian_show_all()
399{
400 eolian_show_class(NULL);
401 eolian_show_typedef(NULL);
402 eolian_show_struct(NULL);
403}