summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2017-12-06 13:59:17 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2017-12-06 15:07:31 +0100
commit9fb3abc662459ed2a0080e68d065556a71d7fe49 (patch)
tree8fb87367d3ef8e7f49dd0a88619d28d5326773c7 /src
parent14cd25a8d33956d6a2ad5a5b833be0413ef84fac (diff)
eolian: store classes in temporary state
Diffstat (limited to 'src')
-rw-r--r--src/lib/eolian/database_class_api.c10
-rw-r--r--src/lib/eolian/eo_parser.c4
-rw-r--r--src/lib/eolian/eolian_database.c11
-rw-r--r--src/lib/eolian/eolian_database.h7
4 files changed, 16 insertions, 16 deletions
diff --git a/src/lib/eolian/database_class_api.c b/src/lib/eolian/database_class_api.c
index 10fb275cde..1cc2a2a679 100644
--- a/src/lib/eolian/database_class_api.c
+++ b/src/lib/eolian/database_class_api.c
@@ -35,9 +35,9 @@ EAPI const Eolian_Class *
35eolian_class_get_by_name(const Eolian_Unit *unit EINA_UNUSED, 35eolian_class_get_by_name(const Eolian_Unit *unit EINA_UNUSED,
36 const char *class_name) 36 const char *class_name)
37{ 37{
38 if (!_classes) return NULL; 38 if (!_state->unit.classes) return NULL;
39 Eina_Stringshare *shr = eina_stringshare_add(class_name); 39 Eina_Stringshare *shr = eina_stringshare_add(class_name);
40 Eolian_Class *cl = eina_hash_find(_classes, shr); 40 Eolian_Class *cl = eina_hash_find(_state->unit.classes, shr);
41 eina_stringshare_del(shr); 41 eina_stringshare_del(shr);
42 return cl; 42 return cl;
43} 43}
@@ -46,9 +46,9 @@ EAPI const Eolian_Class *
46eolian_class_get_by_file(const Eolian_Unit *unit EINA_UNUSED, 46eolian_class_get_by_file(const Eolian_Unit *unit EINA_UNUSED,
47 const char *file_name) 47 const char *file_name)
48{ 48{
49 if (!_classesf) return NULL; 49 if (!_state->classes_f) return NULL;
50 Eina_Stringshare *shr = eina_stringshare_add(file_name); 50 Eina_Stringshare *shr = eina_stringshare_add(file_name);
51 Eolian_Class *cl = eina_hash_find(_classesf, shr); 51 Eolian_Class *cl = eina_hash_find(_state->classes_f, shr);
52 eina_stringshare_del(shr); 52 eina_stringshare_del(shr);
53 return cl; 53 return cl;
54} 54}
@@ -63,7 +63,7 @@ eolian_class_type_get(const Eolian_Class *cl)
63EAPI Eina_Iterator * 63EAPI Eina_Iterator *
64eolian_all_classes_get(const Eolian_Unit *unit EINA_UNUSED) 64eolian_all_classes_get(const Eolian_Unit *unit EINA_UNUSED)
65{ 65{
66 return (_classes ? eina_hash_iterator_data_new(_classes) : NULL); 66 return (_state ? eina_hash_iterator_data_new(_state->unit.classes) : NULL);
67} 67}
68 68
69EAPI const Eolian_Documentation * 69EAPI const Eolian_Documentation *
diff --git a/src/lib/eolian/eo_parser.c b/src/lib/eolian/eo_parser.c
index dcdfc0600a..8d24dd3c67 100644
--- a/src/lib/eolian/eo_parser.c
+++ b/src/lib/eolian/eo_parser.c
@@ -2537,8 +2537,8 @@ eo_parser_database_fill(const char *filename, Eina_Bool eot, Eolian_Class **fcl)
2537 if (!_db_fill_ctors(cl)) 2537 if (!_db_fill_ctors(cl))
2538 goto error; 2538 goto error;
2539 2539
2540 eina_hash_set(_classes, cl->full_name, cl); 2540 eina_hash_set(_state->unit.classes, cl->full_name, cl);
2541 eina_hash_set(_classesf, cl->base.file, cl); 2541 eina_hash_set(_state->classes_f, cl->base.file, cl);
2542 eolian_object_ref(&cl->base); 2542 eolian_object_ref(&cl->base);
2543 2543
2544 if (fcl) *fcl = cl; 2544 if (fcl) *fcl = cl;
diff --git a/src/lib/eolian/eolian_database.c b/src/lib/eolian/eolian_database.c
index fff1f4373a..cae2de4dae 100644
--- a/src/lib/eolian/eolian_database.c
+++ b/src/lib/eolian/eolian_database.c
@@ -8,13 +8,11 @@
8#include "eolian_database.h" 8#include "eolian_database.h"
9#include "eolian_priv.h" 9#include "eolian_priv.h"
10 10
11Eina_Hash *_classes = NULL;
12Eina_Hash *_aliases = NULL; 11Eina_Hash *_aliases = NULL;
13Eina_Hash *_structs = NULL; 12Eina_Hash *_structs = NULL;
14Eina_Hash *_enums = NULL; 13Eina_Hash *_enums = NULL;
15Eina_Hash *_globals = NULL; 14Eina_Hash *_globals = NULL;
16Eina_Hash *_constants = NULL; 15Eina_Hash *_constants = NULL;
17Eina_Hash *_classesf = NULL;
18Eina_Hash *_aliasesf = NULL; 16Eina_Hash *_aliasesf = NULL;
19Eina_Hash *_structsf = NULL; 17Eina_Hash *_structsf = NULL;
20Eina_Hash *_enumsf = NULL; 18Eina_Hash *_enumsf = NULL;
@@ -48,13 +46,11 @@ database_init()
48{ 46{
49 if (_database_init_count > 0) return ++_database_init_count; 47 if (_database_init_count > 0) return ++_database_init_count;
50 eina_init(); 48 eina_init();
51 _classes = eina_hash_stringshared_new(EINA_FREE_CB(database_class_del));
52 _aliases = eina_hash_stringshared_new(EINA_FREE_CB(database_typedecl_del)); 49 _aliases = eina_hash_stringshared_new(EINA_FREE_CB(database_typedecl_del));
53 _structs = eina_hash_stringshared_new(EINA_FREE_CB(database_typedecl_del)); 50 _structs = eina_hash_stringshared_new(EINA_FREE_CB(database_typedecl_del));
54 _enums = eina_hash_stringshared_new(EINA_FREE_CB(database_typedecl_del)); 51 _enums = eina_hash_stringshared_new(EINA_FREE_CB(database_typedecl_del));
55 _globals = eina_hash_stringshared_new(EINA_FREE_CB(database_var_del)); 52 _globals = eina_hash_stringshared_new(EINA_FREE_CB(database_var_del));
56 _constants = eina_hash_stringshared_new(EINA_FREE_CB(database_var_del)); 53 _constants = eina_hash_stringshared_new(EINA_FREE_CB(database_var_del));
57 _classesf = eina_hash_stringshared_new(NULL);
58 _aliasesf = eina_hash_stringshared_new(_hashlist_free); 54 _aliasesf = eina_hash_stringshared_new(_hashlist_free);
59 _structsf = eina_hash_stringshared_new(_hashlist_free); 55 _structsf = eina_hash_stringshared_new(_hashlist_free);
60 _enumsf = eina_hash_stringshared_new(_hashlist_free); 56 _enumsf = eina_hash_stringshared_new(_hashlist_free);
@@ -84,14 +80,12 @@ database_shutdown()
84 80
85 if (_database_init_count == 0) 81 if (_database_init_count == 0)
86 { 82 {
87 eolian_free(_state); 83 eolian_free(_state); _state = NULL;
88 eina_hash_free(_classes ); _classes = NULL;
89 eina_hash_free(_aliases ); _aliases = NULL; 84 eina_hash_free(_aliases ); _aliases = NULL;
90 eina_hash_free(_structs ); _structs = NULL; 85 eina_hash_free(_structs ); _structs = NULL;
91 eina_hash_free(_enums ); _enums = NULL; 86 eina_hash_free(_enums ); _enums = NULL;
92 eina_hash_free(_globals ); _globals = NULL; 87 eina_hash_free(_globals ); _globals = NULL;
93 eina_hash_free(_constants ); _constants = NULL; 88 eina_hash_free(_constants ); _constants = NULL;
94 eina_hash_free(_classesf ); _classesf = NULL;
95 eina_hash_free(_aliasesf ); _aliasesf = NULL; 89 eina_hash_free(_aliasesf ); _aliasesf = NULL;
96 eina_hash_free(_structsf ); _structsf = NULL; 90 eina_hash_free(_structsf ); _structsf = NULL;
97 eina_hash_free(_enumsf ); _enumsf = NULL; 91 eina_hash_free(_enumsf ); _enumsf = NULL;
@@ -648,6 +642,9 @@ eolian_new(void)
648 return NULL; 642 return NULL;
649 643
650 database_unit_init(&state->unit, NULL); 644 database_unit_init(&state->unit, NULL);
645
646 state->classes_f = eina_hash_stringshared_new(NULL);
647
651 return state; 648 return state;
652} 649}
653 650
diff --git a/src/lib/eolian/eolian_database.h b/src/lib/eolian/eolian_database.h
index 44878aefff..e2d1ee936b 100644
--- a/src/lib/eolian/eolian_database.h
+++ b/src/lib/eolian/eolian_database.h
@@ -31,13 +31,11 @@ extern Eina_Prefix *_eolian_prefix;
31#endif 31#endif
32#define DBG(...) EINA_LOG_DOM_DBG(_eolian_log_dom, __VA_ARGS__) 32#define DBG(...) EINA_LOG_DOM_DBG(_eolian_log_dom, __VA_ARGS__)
33 33
34extern Eina_Hash *_classes;
35extern Eina_Hash *_aliases; 34extern Eina_Hash *_aliases;
36extern Eina_Hash *_structs; 35extern Eina_Hash *_structs;
37extern Eina_Hash *_enums; 36extern Eina_Hash *_enums;
38extern Eina_Hash *_globals; 37extern Eina_Hash *_globals;
39extern Eina_Hash *_constants; 38extern Eina_Hash *_constants;
40extern Eina_Hash *_classesf;
41extern Eina_Hash *_aliasesf; 39extern Eina_Hash *_aliasesf;
42extern Eina_Hash *_structsf; 40extern Eina_Hash *_structsf;
43extern Eina_Hash *_enumsf; 41extern Eina_Hash *_enumsf;
@@ -59,6 +57,9 @@ extern Eina_Hash *_parsingeos;
59/* for deferred dependency parsing */ 57/* for deferred dependency parsing */
60extern Eina_Hash *_defereos; 58extern Eina_Hash *_defereos;
61 59
60/* TODO: remove */
61extern Eolian *_state;
62
62struct _Eolian_Unit 63struct _Eolian_Unit
63{ 64{
64 Eolian_Unit *parent; 65 Eolian_Unit *parent;
@@ -74,6 +75,8 @@ struct _Eolian_Unit
74struct _Eolian 75struct _Eolian
75{ 76{
76 Eolian_Unit unit; 77 Eolian_Unit unit;
78
79 Eina_Hash *classes_f;
77}; 80};
78 81
79typedef struct _Eolian_Object 82typedef struct _Eolian_Object