summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2017-12-06 14:11:42 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2017-12-06 15:07:31 +0100
commit7491f9353f7e34aa0ae903b28ed09467b0652d75 (patch)
treef3aff8a058ddb6c466761bf2d05582e5d79c438f /src
parent51ec796497ce1fccf49e4d6cea00b38054f3a2da (diff)
eolian: move enums to temporary state
Diffstat (limited to 'src')
-rw-r--r--src/lib/eolian/database_type.c6
-rw-r--r--src/lib/eolian/database_type_api.c10
-rw-r--r--src/lib/eolian/database_validate.c2
-rw-r--r--src/lib/eolian/eolian_database.c7
-rw-r--r--src/lib/eolian/eolian_database.h3
5 files changed, 11 insertions, 17 deletions
diff --git a/src/lib/eolian/database_type.c b/src/lib/eolian/database_type.c
index 7055a510ef..347a6ba0b9 100644
--- a/src/lib/eolian/database_type.c
+++ b/src/lib/eolian/database_type.c
@@ -62,9 +62,9 @@ database_struct_add(Eolian_Typedecl *tp)
62void 62void
63database_enum_add(Eolian_Typedecl *tp) 63database_enum_add(Eolian_Typedecl *tp)
64{ 64{
65 eina_hash_set(_enums, tp->full_name, tp); 65 eina_hash_set(_state->unit.enums, tp->full_name, tp);
66 eina_hash_set(_enumsf, tp->base.file, eina_list_append 66 eina_hash_set(_state->enums_f, tp->base.file, eina_list_append
67 ((Eina_List*)eina_hash_find(_enumsf, tp->base.file), tp)); 67 ((Eina_List*)eina_hash_find(_state->enums_f, tp->base.file), tp));
68 database_decl_add(tp->full_name, EOLIAN_DECL_ENUM, tp->base.file, tp); 68 database_decl_add(tp->full_name, EOLIAN_DECL_ENUM, tp->base.file, tp);
69} 69}
70 70
diff --git a/src/lib/eolian/database_type_api.c b/src/lib/eolian/database_type_api.c
index 6704b6b724..20ba88a609 100644
--- a/src/lib/eolian/database_type_api.c
+++ b/src/lib/eolian/database_type_api.c
@@ -34,9 +34,9 @@ EAPI const Eolian_Typedecl *
34eolian_typedecl_enum_get_by_name(const Eolian_Unit *unit EINA_UNUSED, 34eolian_typedecl_enum_get_by_name(const Eolian_Unit *unit EINA_UNUSED,
35 const char *name) 35 const char *name)
36{ 36{
37 if (!_enums) return NULL; 37 if (!_state) return NULL;
38 Eina_Stringshare *shr = eina_stringshare_add(name); 38 Eina_Stringshare *shr = eina_stringshare_add(name);
39 Eolian_Typedecl *tp = eina_hash_find(_enums, shr); 39 Eolian_Typedecl *tp = eina_hash_find(_state->unit.enums, shr);
40 eina_stringshare_del(shr); 40 eina_stringshare_del(shr);
41 if (!tp) return NULL; 41 if (!tp) return NULL;
42 return tp; 42 return tp;
@@ -70,9 +70,9 @@ EAPI Eina_Iterator *
70eolian_typedecl_enums_get_by_file(const Eolian_Unit *unit EINA_UNUSED, 70eolian_typedecl_enums_get_by_file(const Eolian_Unit *unit EINA_UNUSED,
71 const char *fname) 71 const char *fname)
72{ 72{
73 if (!_enumsf) return NULL; 73 if (!_state) return NULL;
74 Eina_Stringshare *shr = eina_stringshare_add(fname); 74 Eina_Stringshare *shr = eina_stringshare_add(fname);
75 Eina_List *l = eina_hash_find(_enumsf, shr); 75 Eina_List *l = eina_hash_find(_state->enums_f, shr);
76 eina_stringshare_del(shr); 76 eina_stringshare_del(shr);
77 if (!l) return NULL; 77 if (!l) return NULL;
78 return eina_list_iterator_new(l); 78 return eina_list_iterator_new(l);
@@ -93,7 +93,7 @@ eolian_typedecl_all_structs_get(const Eolian_Unit *unit EINA_UNUSED)
93EAPI Eina_Iterator * 93EAPI Eina_Iterator *
94eolian_typedecl_all_enums_get(const Eolian_Unit *unit EINA_UNUSED) 94eolian_typedecl_all_enums_get(const Eolian_Unit *unit EINA_UNUSED)
95{ 95{
96 return (_enums ? eina_hash_iterator_data_new(_enums) : NULL); 96 return (_state ? eina_hash_iterator_data_new(_state->unit.enums) : NULL);
97} 97}
98 98
99EAPI Eolian_Type_Type 99EAPI Eolian_Type_Type
diff --git a/src/lib/eolian/database_validate.c b/src/lib/eolian/database_validate.c
index 40e4a2804c..b11790950c 100644
--- a/src/lib/eolian/database_validate.c
+++ b/src/lib/eolian/database_validate.c
@@ -536,7 +536,7 @@ database_validate(const Eolian_Unit *src)
536 if (!rt.succ) 536 if (!rt.succ)
537 return EINA_FALSE; 537 return EINA_FALSE;
538 538
539 eina_hash_foreach(_enums, (Eina_Hash_Foreach)_typedecl_map_cb, &rt); 539 eina_hash_foreach(_state->unit.enums, (Eina_Hash_Foreach)_typedecl_map_cb, &rt);
540 if (!rt.succ) 540 if (!rt.succ)
541 return EINA_FALSE; 541 return EINA_FALSE;
542 542
diff --git a/src/lib/eolian/eolian_database.c b/src/lib/eolian/eolian_database.c
index 17b2a54260..e364ca6416 100644
--- a/src/lib/eolian/eolian_database.c
+++ b/src/lib/eolian/eolian_database.c
@@ -8,10 +8,8 @@
8#include "eolian_database.h" 8#include "eolian_database.h"
9#include "eolian_priv.h" 9#include "eolian_priv.h"
10 10
11Eina_Hash *_enums = NULL;
12Eina_Hash *_globals = NULL; 11Eina_Hash *_globals = NULL;
13Eina_Hash *_constants = NULL; 12Eina_Hash *_constants = NULL;
14Eina_Hash *_enumsf = NULL;
15Eina_Hash *_globalsf = NULL; 13Eina_Hash *_globalsf = NULL;
16Eina_Hash *_constantsf = NULL; 14Eina_Hash *_constantsf = NULL;
17Eina_Hash *_filenames = NULL; 15Eina_Hash *_filenames = NULL;
@@ -42,10 +40,8 @@ database_init()
42{ 40{
43 if (_database_init_count > 0) return ++_database_init_count; 41 if (_database_init_count > 0) return ++_database_init_count;
44 eina_init(); 42 eina_init();
45 _enums = eina_hash_stringshared_new(EINA_FREE_CB(database_typedecl_del));
46 _globals = eina_hash_stringshared_new(EINA_FREE_CB(database_var_del)); 43 _globals = eina_hash_stringshared_new(EINA_FREE_CB(database_var_del));
47 _constants = eina_hash_stringshared_new(EINA_FREE_CB(database_var_del)); 44 _constants = eina_hash_stringshared_new(EINA_FREE_CB(database_var_del));
48 _enumsf = eina_hash_stringshared_new(_hashlist_free);
49 _globalsf = eina_hash_stringshared_new(_hashlist_free); 45 _globalsf = eina_hash_stringshared_new(_hashlist_free);
50 _constantsf = eina_hash_stringshared_new(_hashlist_free); 46 _constantsf = eina_hash_stringshared_new(_hashlist_free);
51 _filenames = eina_hash_string_small_new(free); 47 _filenames = eina_hash_string_small_new(free);
@@ -73,10 +69,8 @@ database_shutdown()
73 if (_database_init_count == 0) 69 if (_database_init_count == 0)
74 { 70 {
75 eolian_free(_state); _state = NULL; 71 eolian_free(_state); _state = NULL;
76 eina_hash_free(_enums ); _enums = NULL;
77 eina_hash_free(_globals ); _globals = NULL; 72 eina_hash_free(_globals ); _globals = NULL;
78 eina_hash_free(_constants ); _constants = NULL; 73 eina_hash_free(_constants ); _constants = NULL;
79 eina_hash_free(_enumsf ); _enumsf = NULL;
80 eina_hash_free(_globalsf ); _globalsf = NULL; 74 eina_hash_free(_globalsf ); _globalsf = NULL;
81 eina_hash_free(_constantsf); _constantsf = NULL; 75 eina_hash_free(_constantsf); _constantsf = NULL;
82 eina_hash_free(_filenames ); _filenames = NULL; 76 eina_hash_free(_filenames ); _filenames = NULL;
@@ -634,6 +628,7 @@ eolian_new(void)
634 state->classes_f = eina_hash_stringshared_new(NULL); 628 state->classes_f = eina_hash_stringshared_new(NULL);
635 state->aliases_f = eina_hash_stringshared_new(_hashlist_free); 629 state->aliases_f = eina_hash_stringshared_new(_hashlist_free);
636 state->structs_f = eina_hash_stringshared_new(_hashlist_free); 630 state->structs_f = eina_hash_stringshared_new(_hashlist_free);
631 state->enums_f = eina_hash_stringshared_new(_hashlist_free);
637 632
638 return state; 633 return state;
639} 634}
diff --git a/src/lib/eolian/eolian_database.h b/src/lib/eolian/eolian_database.h
index f616a5c4f4..dc20ab5d0b 100644
--- a/src/lib/eolian/eolian_database.h
+++ b/src/lib/eolian/eolian_database.h
@@ -31,10 +31,8 @@ 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 *_enums;
35extern Eina_Hash *_globals; 34extern Eina_Hash *_globals;
36extern Eina_Hash *_constants; 35extern Eina_Hash *_constants;
37extern Eina_Hash *_enumsf;
38extern Eina_Hash *_globalsf; 36extern Eina_Hash *_globalsf;
39extern Eina_Hash *_constantsf; 37extern Eina_Hash *_constantsf;
40extern Eina_Hash *_filenames; /* Hash: filename without extension -> full path */ 38extern Eina_Hash *_filenames; /* Hash: filename without extension -> full path */
@@ -75,6 +73,7 @@ struct _Eolian
75 Eina_Hash *classes_f; 73 Eina_Hash *classes_f;
76 Eina_Hash *aliases_f; 74 Eina_Hash *aliases_f;
77 Eina_Hash *structs_f; 75 Eina_Hash *structs_f;
76 Eina_Hash *enums_f;
78}; 77};
79 78
80typedef struct _Eolian_Object 79typedef struct _Eolian_Object