summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2018-02-23 15:34:52 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2018-02-23 15:34:52 +0100
commita11e70ab3c35ec6d70348b3d2f99fcd6adf449c3 (patch)
tree326df99de04485da72e5482c049ea6d7563ee2f4
parent39820fb5f58ea9528982d8ee63f37be0639f57a1 (diff)
eolian: perform correct unit lookups in public API
This finally enables looking up things from the current unit rather than from a backing storage in the Eolian state. This also means that the benefits of having a unit system will finally be visible.
-rw-r--r--src/lib/eolian/database_class_api.c4
-rw-r--r--src/lib/eolian/database_type.c2
-rw-r--r--src/lib/eolian/database_type_api.c12
-rw-r--r--src/lib/eolian/database_var_api.c8
-rw-r--r--src/lib/eolian/eolian_database.c4
5 files changed, 15 insertions, 15 deletions
diff --git a/src/lib/eolian/database_class_api.c b/src/lib/eolian/database_class_api.c
index ae151f4e82..dbb6dee56e 100644
--- a/src/lib/eolian/database_class_api.c
+++ b/src/lib/eolian/database_class_api.c
@@ -36,7 +36,7 @@ eolian_class_get_by_name(const Eolian_Unit *unit, const char *class_name)
36{ 36{
37 if (!unit) return NULL; 37 if (!unit) return NULL;
38 Eina_Stringshare *shr = eina_stringshare_add(class_name); 38 Eina_Stringshare *shr = eina_stringshare_add(class_name);
39 Eolian_Class *cl = eina_hash_find(unit->state->unit.classes, shr); 39 Eolian_Class *cl = eina_hash_find(unit->classes, shr);
40 eina_stringshare_del(shr); 40 eina_stringshare_del(shr);
41 return cl; 41 return cl;
42} 42}
@@ -61,7 +61,7 @@ eolian_class_type_get(const Eolian_Class *cl)
61EAPI Eina_Iterator * 61EAPI Eina_Iterator *
62eolian_all_classes_get(const Eolian_Unit *unit) 62eolian_all_classes_get(const Eolian_Unit *unit)
63{ 63{
64 return (unit ? eina_hash_iterator_data_new(unit->state->unit.classes) : NULL); 64 return (unit ? eina_hash_iterator_data_new(unit->classes) : NULL);
65} 65}
66 66
67EAPI const Eolian_Documentation * 67EAPI const Eolian_Documentation *
diff --git a/src/lib/eolian/database_type.c b/src/lib/eolian/database_type.c
index 1b881be415..7ffeda303f 100644
--- a/src/lib/eolian/database_type.c
+++ b/src/lib/eolian/database_type.c
@@ -278,7 +278,7 @@ Eolian_Typedecl *database_type_decl_find(const Eolian_Unit *unit, const Eolian_T
278 int kw = eo_lexer_keyword_str_to_id(tp->full_name); 278 int kw = eo_lexer_keyword_str_to_id(tp->full_name);
279 if (!kw || kw < KW_byte || kw >= KW_true) 279 if (!kw || kw < KW_byte || kw >= KW_true)
280 { 280 {
281 Eolian_Declaration *decl = eina_hash_find(unit->state->unit.decls, tp->full_name); 281 Eolian_Declaration *decl = eina_hash_find(unit->decls, tp->full_name);
282 if (decl && decl->type != EOLIAN_DECL_CLASS 282 if (decl && decl->type != EOLIAN_DECL_CLASS
283 && decl->type != EOLIAN_DECL_VAR) 283 && decl->type != EOLIAN_DECL_VAR)
284 return decl->data; 284 return decl->data;
diff --git a/src/lib/eolian/database_type_api.c b/src/lib/eolian/database_type_api.c
index 510cae835d..7041fd8db4 100644
--- a/src/lib/eolian/database_type_api.c
+++ b/src/lib/eolian/database_type_api.c
@@ -11,7 +11,7 @@ eolian_typedecl_alias_get_by_name(const Eolian_Unit *unit, const char *name)
11{ 11{
12 if (!unit) return NULL; 12 if (!unit) return NULL;
13 Eina_Stringshare *shr = eina_stringshare_add(name); 13 Eina_Stringshare *shr = eina_stringshare_add(name);
14 Eolian_Typedecl *tp = eina_hash_find(unit->state->unit.aliases, shr); 14 Eolian_Typedecl *tp = eina_hash_find(unit->aliases, shr);
15 eina_stringshare_del(shr); 15 eina_stringshare_del(shr);
16 if (!tp) return NULL; 16 if (!tp) return NULL;
17 return tp; 17 return tp;
@@ -22,7 +22,7 @@ eolian_typedecl_struct_get_by_name(const Eolian_Unit *unit, const char *name)
22{ 22{
23 if (!unit) return NULL; 23 if (!unit) return NULL;
24 Eina_Stringshare *shr = eina_stringshare_add(name); 24 Eina_Stringshare *shr = eina_stringshare_add(name);
25 Eolian_Typedecl *tp = eina_hash_find(unit->state->unit.structs, shr); 25 Eolian_Typedecl *tp = eina_hash_find(unit->structs, shr);
26 eina_stringshare_del(shr); 26 eina_stringshare_del(shr);
27 if (!tp) return NULL; 27 if (!tp) return NULL;
28 return tp; 28 return tp;
@@ -33,7 +33,7 @@ eolian_typedecl_enum_get_by_name(const Eolian_Unit *unit, const char *name)
33{ 33{
34 if (!unit) return NULL; 34 if (!unit) return NULL;
35 Eina_Stringshare *shr = eina_stringshare_add(name); 35 Eina_Stringshare *shr = eina_stringshare_add(name);
36 Eolian_Typedecl *tp = eina_hash_find(unit->state->unit.enums, shr); 36 Eolian_Typedecl *tp = eina_hash_find(unit->enums, shr);
37 eina_stringshare_del(shr); 37 eina_stringshare_del(shr);
38 if (!tp) return NULL; 38 if (!tp) return NULL;
39 return tp; 39 return tp;
@@ -75,19 +75,19 @@ eolian_typedecl_enums_get_by_file(const Eolian_Unit *unit, const char *fname)
75EAPI Eina_Iterator * 75EAPI Eina_Iterator *
76eolian_typedecl_all_aliases_get(const Eolian_Unit *unit) 76eolian_typedecl_all_aliases_get(const Eolian_Unit *unit)
77{ 77{
78 return (unit ? eina_hash_iterator_data_new(unit->state->unit.aliases) : NULL); 78 return (unit ? eina_hash_iterator_data_new(unit->aliases) : NULL);
79} 79}
80 80
81EAPI Eina_Iterator * 81EAPI Eina_Iterator *
82eolian_typedecl_all_structs_get(const Eolian_Unit *unit) 82eolian_typedecl_all_structs_get(const Eolian_Unit *unit)
83{ 83{
84 return (unit ? eina_hash_iterator_data_new(unit->state->unit.structs) : NULL); 84 return (unit ? eina_hash_iterator_data_new(unit->structs) : NULL);
85} 85}
86 86
87EAPI Eina_Iterator * 87EAPI Eina_Iterator *
88eolian_typedecl_all_enums_get(const Eolian_Unit *unit) 88eolian_typedecl_all_enums_get(const Eolian_Unit *unit)
89{ 89{
90 return (unit ? eina_hash_iterator_data_new(unit->state->unit.enums) : NULL); 90 return (unit ? eina_hash_iterator_data_new(unit->enums) : NULL);
91} 91}
92 92
93EAPI Eolian_Type_Type 93EAPI Eolian_Type_Type
diff --git a/src/lib/eolian/database_var_api.c b/src/lib/eolian/database_var_api.c
index a0d0e4ec1a..1e92c62e8b 100644
--- a/src/lib/eolian/database_var_api.c
+++ b/src/lib/eolian/database_var_api.c
@@ -10,7 +10,7 @@ eolian_variable_global_get_by_name(const Eolian_Unit *unit, const char *name)
10{ 10{
11 if (!unit) return NULL; 11 if (!unit) return NULL;
12 Eina_Stringshare *shr = eina_stringshare_add(name); 12 Eina_Stringshare *shr = eina_stringshare_add(name);
13 Eolian_Variable *v = eina_hash_find(unit->state->unit.globals, shr); 13 Eolian_Variable *v = eina_hash_find(unit->globals, shr);
14 eina_stringshare_del(shr); 14 eina_stringshare_del(shr);
15 return v; 15 return v;
16} 16}
@@ -20,7 +20,7 @@ eolian_variable_constant_get_by_name(const Eolian_Unit *unit, const char *name)
20{ 20{
21 if (!unit) return NULL; 21 if (!unit) return NULL;
22 Eina_Stringshare *shr = eina_stringshare_add(name); 22 Eina_Stringshare *shr = eina_stringshare_add(name);
23 Eolian_Variable *v = eina_hash_find(unit->state->unit.constants, shr); 23 Eolian_Variable *v = eina_hash_find(unit->constants, shr);
24 eina_stringshare_del(shr); 24 eina_stringshare_del(shr);
25 return v; 25 return v;
26} 26}
@@ -51,13 +51,13 @@ eolian_variable_constants_get_by_file(const Eolian_Unit *unit,
51EAPI Eina_Iterator * 51EAPI Eina_Iterator *
52eolian_variable_all_constants_get(const Eolian_Unit *unit) 52eolian_variable_all_constants_get(const Eolian_Unit *unit)
53{ 53{
54 return (unit ? eina_hash_iterator_data_new(unit->state->unit.constants) : NULL); 54 return (unit ? eina_hash_iterator_data_new(unit->constants) : NULL);
55} 55}
56 56
57EAPI Eina_Iterator * 57EAPI Eina_Iterator *
58eolian_variable_all_globals_get(const Eolian_Unit *unit) 58eolian_variable_all_globals_get(const Eolian_Unit *unit)
59{ 59{
60 return (unit ? eina_hash_iterator_data_new(unit->state->unit.globals) : NULL); 60 return (unit ? eina_hash_iterator_data_new(unit->globals) : NULL);
61} 61}
62 62
63EAPI Eolian_Variable_Type 63EAPI Eolian_Variable_Type
diff --git a/src/lib/eolian/eolian_database.c b/src/lib/eolian/eolian_database.c
index ab58486b46..da5cc8766b 100644
--- a/src/lib/eolian/eolian_database.c
+++ b/src/lib/eolian/eolian_database.c
@@ -38,7 +38,7 @@ eolian_declaration_get_by_name(const Eolian_Unit *unit, const char *name)
38{ 38{
39 if (!unit) return NULL; 39 if (!unit) return NULL;
40 Eina_Stringshare *shr = eina_stringshare_add(name); 40 Eina_Stringshare *shr = eina_stringshare_add(name);
41 const Eolian_Declaration *decl = eina_hash_find(unit->state->unit.decls, shr); 41 const Eolian_Declaration *decl = eina_hash_find(unit->decls, shr);
42 eina_stringshare_del(shr); 42 eina_stringshare_del(shr);
43 return decl; 43 return decl;
44} 44}
@@ -57,7 +57,7 @@ eolian_declarations_get_by_file(const Eolian *state, const char *fname)
57EAPI Eina_Iterator * 57EAPI Eina_Iterator *
58eolian_all_declarations_get(const Eolian_Unit *unit) 58eolian_all_declarations_get(const Eolian_Unit *unit)
59{ 59{
60 return (unit ? eina_hash_iterator_data_new(unit->state->unit.decls) : NULL); 60 return (unit ? eina_hash_iterator_data_new(unit->decls) : NULL);
61} 61}
62 62
63EAPI Eolian_Declaration_Type 63EAPI Eolian_Declaration_Type