From 5f4c2f7b798ec1eceae536471996e35768b8809a Mon Sep 17 00:00:00 2001 From: Daniel Kolesa Date: Thu, 11 May 2017 16:35:19 +0200 Subject: [PATCH] eolian: initial structure for units Units are Eolian files (eo/eot). Each unit contains information about its class, dependencies, variables and types. This allows for saner checking to be done. --- src/lib/eolian/Eolian.h | 6 ++++++ src/lib/eolian/eolian_database.c | 8 ++++++++ src/lib/eolian/eolian_database.h | 14 ++++++++++++++ 3 files changed, 28 insertions(+) diff --git a/src/lib/eolian/Eolian.h b/src/lib/eolian/Eolian.h index c7b6324..e882f2e 100644 --- a/src/lib/eolian/Eolian.h +++ b/src/lib/eolian/Eolian.h @@ -171,6 +171,12 @@ typedef struct _Eolian_Declaration Eolian_Declaration; */ typedef struct _Eolian_Documentation Eolian_Documentation; +/* Unit information + * + * @ingroup Eolian + */ +typedef struct _Eolian_Unit Eolian_Unit; + typedef enum { EOLIAN_UNRESOLVED = 0, diff --git a/src/lib/eolian/eolian_database.c b/src/lib/eolian/eolian_database.c index d4551e7..b86b115 100644 --- a/src/lib/eolian/eolian_database.c +++ b/src/lib/eolian/eolian_database.c @@ -23,6 +23,7 @@ Eina_Hash *_filenames = NULL; Eina_Hash *_tfilenames = NULL; Eina_Hash *_decls = NULL; Eina_Hash *_declsf = NULL; +Eina_Hash *_units = NULL; Eina_Hash *_parsedeos = NULL; Eina_Hash *_parsingeos = NULL; @@ -61,6 +62,7 @@ database_init() _parsedeos = eina_hash_string_small_new(NULL); _parsingeos = eina_hash_string_small_new(NULL); _defereos = eina_hash_string_small_new(NULL); + _units = eina_hash_stringshared_new(EINA_FREE_CB(database_unit_del)); return ++_database_init_count; } @@ -95,6 +97,7 @@ database_shutdown() eina_hash_free(_parsedeos ); _parsedeos = NULL; eina_hash_free(_parsingeos); _parsingeos = NULL; eina_hash_free(_defereos ); _defereos = NULL; + eina_hash_free(_units ); _units = NULL; eina_shutdown(); } return _database_init_count; @@ -592,6 +595,11 @@ eolian_doc_token_ref_get(const Eolian_Doc_Token *tok, const void **data, return EOLIAN_DOC_REF_FUNC; } +void +database_unit_del(Eolian_Unit *unit) +{ +} + #define EO_SUFFIX ".eo" #define EOT_SUFFIX ".eot" diff --git a/src/lib/eolian/eolian_database.h b/src/lib/eolian/eolian_database.h index 9c54615..0feaaf7 100644 --- a/src/lib/eolian/eolian_database.h +++ b/src/lib/eolian/eolian_database.h @@ -279,6 +279,18 @@ struct _Eolian_Variable Eina_Bool is_extern :1; }; +struct _Eolian_Unit +{ + Eolian_Object base; + Eolian_Class *klass; + Eina_List *dependencies; + Eina_List *globals; + Eina_List *constants; + Eina_List *aliases; + Eina_List *structs; + Eina_List *enums; +}; + int database_init(void); int database_shutdown(void); @@ -290,6 +302,8 @@ void database_decl_add(Eina_Stringshare *name, Eolian_Declaration_Type type, void database_doc_del(Eolian_Documentation *doc); +void database_unit_del(Eolian_Unit *unit); + /* types */ void database_type_add(Eolian_Typedecl *def); -- 2.7.4