summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2017-12-06 14:08:25 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2017-12-06 15:07:31 +0100
commit51ec796497ce1fccf49e4d6cea00b38054f3a2da (patch)
treecfd5a7f65fc9a859405d50b7ff72a34092a969bd /src
parent8428eaa66358de6cb96e6177eb3a9d9489847377 (diff)
eolian: move structs 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 0519eb5e5c..7055a510ef 100644
--- a/src/lib/eolian/database_type.c
+++ b/src/lib/eolian/database_type.c
@@ -53,9 +53,9 @@ database_type_add(Eolian_Typedecl *def)
53void 53void
54database_struct_add(Eolian_Typedecl *tp) 54database_struct_add(Eolian_Typedecl *tp)
55{ 55{
56 eina_hash_set(_structs, tp->full_name, tp); 56 eina_hash_set(_state->unit.structs, tp->full_name, tp);
57 eina_hash_set(_structsf, tp->base.file, eina_list_append 57 eina_hash_set(_state->structs_f, tp->base.file, eina_list_append
58 ((Eina_List*)eina_hash_find(_structsf, tp->base.file), tp)); 58 ((Eina_List*)eina_hash_find(_state->structs_f, tp->base.file), tp));
59 database_decl_add(tp->full_name, EOLIAN_DECL_STRUCT, tp->base.file, tp); 59 database_decl_add(tp->full_name, EOLIAN_DECL_STRUCT, tp->base.file, tp);
60} 60}
61 61
diff --git a/src/lib/eolian/database_type_api.c b/src/lib/eolian/database_type_api.c
index 97b2468e20..6704b6b724 100644
--- a/src/lib/eolian/database_type_api.c
+++ b/src/lib/eolian/database_type_api.c
@@ -22,9 +22,9 @@ EAPI const Eolian_Typedecl *
22eolian_typedecl_struct_get_by_name(const Eolian_Unit *unit EINA_UNUSED, 22eolian_typedecl_struct_get_by_name(const Eolian_Unit *unit EINA_UNUSED,
23 const char *name) 23 const char *name)
24{ 24{
25 if (!_structs) return NULL; 25 if (!_state) return NULL;
26 Eina_Stringshare *shr = eina_stringshare_add(name); 26 Eina_Stringshare *shr = eina_stringshare_add(name);
27 Eolian_Typedecl *tp = eina_hash_find(_structs, shr); 27 Eolian_Typedecl *tp = eina_hash_find(_state->unit.structs, shr);
28 eina_stringshare_del(shr); 28 eina_stringshare_del(shr);
29 if (!tp) return NULL; 29 if (!tp) return NULL;
30 return tp; 30 return tp;
@@ -58,9 +58,9 @@ EAPI Eina_Iterator *
58eolian_typedecl_structs_get_by_file(const Eolian_Unit *unit EINA_UNUSED, 58eolian_typedecl_structs_get_by_file(const Eolian_Unit *unit EINA_UNUSED,
59 const char *fname) 59 const char *fname)
60{ 60{
61 if (!_structsf) return NULL; 61 if (!_state) return NULL;
62 Eina_Stringshare *shr = eina_stringshare_add(fname); 62 Eina_Stringshare *shr = eina_stringshare_add(fname);
63 Eina_List *l = eina_hash_find(_structsf, shr); 63 Eina_List *l = eina_hash_find(_state->structs_f, shr);
64 eina_stringshare_del(shr); 64 eina_stringshare_del(shr);
65 if (!l) return NULL; 65 if (!l) return NULL;
66 return eina_list_iterator_new(l); 66 return eina_list_iterator_new(l);
@@ -87,7 +87,7 @@ eolian_typedecl_all_aliases_get(const Eolian_Unit *unit EINA_UNUSED)
87EAPI Eina_Iterator * 87EAPI Eina_Iterator *
88eolian_typedecl_all_structs_get(const Eolian_Unit *unit EINA_UNUSED) 88eolian_typedecl_all_structs_get(const Eolian_Unit *unit EINA_UNUSED)
89{ 89{
90 return (_structs ? eina_hash_iterator_data_new(_structs) : NULL); 90 return (_state ? eina_hash_iterator_data_new(_state->unit.structs) : NULL);
91} 91}
92 92
93EAPI Eina_Iterator * 93EAPI Eina_Iterator *
diff --git a/src/lib/eolian/database_validate.c b/src/lib/eolian/database_validate.c
index ff2d6a9415..40e4a2804c 100644
--- a/src/lib/eolian/database_validate.c
+++ b/src/lib/eolian/database_validate.c
@@ -532,7 +532,7 @@ database_validate(const Eolian_Unit *src)
532 if (!rt.succ) 532 if (!rt.succ)
533 return EINA_FALSE; 533 return EINA_FALSE;
534 534
535 eina_hash_foreach(_structs, (Eina_Hash_Foreach)_typedecl_map_cb, &rt); 535 eina_hash_foreach(_state->unit.structs, (Eina_Hash_Foreach)_typedecl_map_cb, &rt);
536 if (!rt.succ) 536 if (!rt.succ)
537 return EINA_FALSE; 537 return EINA_FALSE;
538 538
diff --git a/src/lib/eolian/eolian_database.c b/src/lib/eolian/eolian_database.c
index f6dae686a3..17b2a54260 100644
--- a/src/lib/eolian/eolian_database.c
+++ b/src/lib/eolian/eolian_database.c
@@ -8,11 +8,9 @@
8#include "eolian_database.h" 8#include "eolian_database.h"
9#include "eolian_priv.h" 9#include "eolian_priv.h"
10 10
11Eina_Hash *_structs = NULL;
12Eina_Hash *_enums = NULL; 11Eina_Hash *_enums = NULL;
13Eina_Hash *_globals = NULL; 12Eina_Hash *_globals = NULL;
14Eina_Hash *_constants = NULL; 13Eina_Hash *_constants = NULL;
15Eina_Hash *_structsf = NULL;
16Eina_Hash *_enumsf = NULL; 14Eina_Hash *_enumsf = NULL;
17Eina_Hash *_globalsf = NULL; 15Eina_Hash *_globalsf = NULL;
18Eina_Hash *_constantsf = NULL; 16Eina_Hash *_constantsf = NULL;
@@ -44,11 +42,9 @@ database_init()
44{ 42{
45 if (_database_init_count > 0) return ++_database_init_count; 43 if (_database_init_count > 0) return ++_database_init_count;
46 eina_init(); 44 eina_init();
47 _structs = eina_hash_stringshared_new(EINA_FREE_CB(database_typedecl_del));
48 _enums = eina_hash_stringshared_new(EINA_FREE_CB(database_typedecl_del)); 45 _enums = eina_hash_stringshared_new(EINA_FREE_CB(database_typedecl_del));
49 _globals = eina_hash_stringshared_new(EINA_FREE_CB(database_var_del)); 46 _globals = eina_hash_stringshared_new(EINA_FREE_CB(database_var_del));
50 _constants = eina_hash_stringshared_new(EINA_FREE_CB(database_var_del)); 47 _constants = eina_hash_stringshared_new(EINA_FREE_CB(database_var_del));
51 _structsf = eina_hash_stringshared_new(_hashlist_free);
52 _enumsf = eina_hash_stringshared_new(_hashlist_free); 48 _enumsf = eina_hash_stringshared_new(_hashlist_free);
53 _globalsf = eina_hash_stringshared_new(_hashlist_free); 49 _globalsf = eina_hash_stringshared_new(_hashlist_free);
54 _constantsf = eina_hash_stringshared_new(_hashlist_free); 50 _constantsf = eina_hash_stringshared_new(_hashlist_free);
@@ -77,11 +73,9 @@ database_shutdown()
77 if (_database_init_count == 0) 73 if (_database_init_count == 0)
78 { 74 {
79 eolian_free(_state); _state = NULL; 75 eolian_free(_state); _state = NULL;
80 eina_hash_free(_structs ); _structs = NULL;
81 eina_hash_free(_enums ); _enums = NULL; 76 eina_hash_free(_enums ); _enums = NULL;
82 eina_hash_free(_globals ); _globals = NULL; 77 eina_hash_free(_globals ); _globals = NULL;
83 eina_hash_free(_constants ); _constants = NULL; 78 eina_hash_free(_constants ); _constants = NULL;
84 eina_hash_free(_structsf ); _structsf = NULL;
85 eina_hash_free(_enumsf ); _enumsf = NULL; 79 eina_hash_free(_enumsf ); _enumsf = NULL;
86 eina_hash_free(_globalsf ); _globalsf = NULL; 80 eina_hash_free(_globalsf ); _globalsf = NULL;
87 eina_hash_free(_constantsf); _constantsf = NULL; 81 eina_hash_free(_constantsf); _constantsf = NULL;
@@ -639,6 +633,7 @@ eolian_new(void)
639 633
640 state->classes_f = eina_hash_stringshared_new(NULL); 634 state->classes_f = eina_hash_stringshared_new(NULL);
641 state->aliases_f = eina_hash_stringshared_new(_hashlist_free); 635 state->aliases_f = eina_hash_stringshared_new(_hashlist_free);
636 state->structs_f = eina_hash_stringshared_new(_hashlist_free);
642 637
643 return state; 638 return state;
644} 639}
diff --git a/src/lib/eolian/eolian_database.h b/src/lib/eolian/eolian_database.h
index 7e9c26b80e..f616a5c4f4 100644
--- a/src/lib/eolian/eolian_database.h
+++ b/src/lib/eolian/eolian_database.h
@@ -31,11 +31,9 @@ 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 *_structs;
35extern Eina_Hash *_enums; 34extern Eina_Hash *_enums;
36extern Eina_Hash *_globals; 35extern Eina_Hash *_globals;
37extern Eina_Hash *_constants; 36extern Eina_Hash *_constants;
38extern Eina_Hash *_structsf;
39extern Eina_Hash *_enumsf; 37extern Eina_Hash *_enumsf;
40extern Eina_Hash *_globalsf; 38extern Eina_Hash *_globalsf;
41extern Eina_Hash *_constantsf; 39extern Eina_Hash *_constantsf;
@@ -76,6 +74,7 @@ struct _Eolian
76 74
77 Eina_Hash *classes_f; 75 Eina_Hash *classes_f;
78 Eina_Hash *aliases_f; 76 Eina_Hash *aliases_f;
77 Eina_Hash *structs_f;
79}; 78};
80 79
81typedef struct _Eolian_Object 80typedef struct _Eolian_Object