eolian_class_get_by_name(const Eolian_Unit *unit EINA_UNUSED,
const char *class_name)
{
- if (!_state->unit.classes) return NULL;
+ if (!_state) return NULL;
Eina_Stringshare *shr = eina_stringshare_add(class_name);
Eolian_Class *cl = eina_hash_find(_state->unit.classes, shr);
eina_stringshare_del(shr);
eolian_class_get_by_file(const Eolian_Unit *unit EINA_UNUSED,
const char *file_name)
{
- if (!_state->classes_f) return NULL;
+ if (!_state) return NULL;
Eina_Stringshare *shr = eina_stringshare_add(file_name);
Eolian_Class *cl = eina_hash_find(_state->classes_f, shr);
eina_stringshare_del(shr);
void
database_type_add(Eolian_Typedecl *def)
{
- eina_hash_set(_aliases, def->full_name, def);
- eina_hash_set(_aliasesf, def->base.file, eina_list_append
- ((Eina_List*)eina_hash_find(_aliasesf, def->base.file), def));
+ eina_hash_set(_state->unit.aliases, def->full_name, def);
+ eina_hash_set(_state->aliases_f, def->base.file, eina_list_append
+ ((Eina_List*)eina_hash_find(_state->aliases_f, def->base.file),
+ def));
database_decl_add(def->full_name, EOLIAN_DECL_ALIAS, def->base.file, def);
}
eolian_typedecl_alias_get_by_name(const Eolian_Unit *unit EINA_UNUSED,
const char *name)
{
- if (!_aliases) return NULL;
+ if (!_state) return NULL;
Eina_Stringshare *shr = eina_stringshare_add(name);
- Eolian_Typedecl *tp = eina_hash_find(_aliases, shr);
+ Eolian_Typedecl *tp = eina_hash_find(_state->unit.aliases, shr);
eina_stringshare_del(shr);
if (!tp) return NULL;
return tp;
eolian_typedecl_aliases_get_by_file(const Eolian_Unit *unit EINA_UNUSED,
const char *fname)
{
- if (!_aliasesf) return NULL;
+ if (!_state) return NULL;
Eina_Stringshare *shr = eina_stringshare_add(fname);
- Eina_List *l = eina_hash_find(_aliasesf, shr);
+ Eina_List *l = eina_hash_find(_state->aliases_f, shr);
eina_stringshare_del(shr);
if (!l) return NULL;
return eina_list_iterator_new(l);
EAPI Eina_Iterator *
eolian_typedecl_all_aliases_get(const Eolian_Unit *unit EINA_UNUSED)
{
- return (_aliases ? eina_hash_iterator_data_new(_aliases) : NULL);
+ return (_state ? eina_hash_iterator_data_new(_state->unit.aliases) : NULL);
}
EAPI Eina_Iterator *
Cb_Ret rt = { src, EINA_TRUE };
- eina_hash_foreach(_aliases, (Eina_Hash_Foreach)_typedecl_map_cb, &rt);
+ eina_hash_foreach(_state->unit.aliases, (Eina_Hash_Foreach)_typedecl_map_cb, &rt);
if (!rt.succ)
return EINA_FALSE;
#include "eolian_database.h"
#include "eolian_priv.h"
-Eina_Hash *_aliases = NULL;
Eina_Hash *_structs = NULL;
Eina_Hash *_enums = NULL;
Eina_Hash *_globals = NULL;
Eina_Hash *_constants = NULL;
-Eina_Hash *_aliasesf = NULL;
Eina_Hash *_structsf = NULL;
Eina_Hash *_enumsf = NULL;
Eina_Hash *_globalsf = NULL;
{
if (_database_init_count > 0) return ++_database_init_count;
eina_init();
- _aliases = eina_hash_stringshared_new(EINA_FREE_CB(database_typedecl_del));
_structs = eina_hash_stringshared_new(EINA_FREE_CB(database_typedecl_del));
_enums = eina_hash_stringshared_new(EINA_FREE_CB(database_typedecl_del));
_globals = eina_hash_stringshared_new(EINA_FREE_CB(database_var_del));
_constants = eina_hash_stringshared_new(EINA_FREE_CB(database_var_del));
- _aliasesf = eina_hash_stringshared_new(_hashlist_free);
_structsf = eina_hash_stringshared_new(_hashlist_free);
_enumsf = eina_hash_stringshared_new(_hashlist_free);
_globalsf = eina_hash_stringshared_new(_hashlist_free);
if (_database_init_count == 0)
{
eolian_free(_state); _state = NULL;
- eina_hash_free(_aliases ); _aliases = NULL;
eina_hash_free(_structs ); _structs = NULL;
eina_hash_free(_enums ); _enums = NULL;
eina_hash_free(_globals ); _globals = NULL;
eina_hash_free(_constants ); _constants = NULL;
- eina_hash_free(_aliasesf ); _aliasesf = NULL;
eina_hash_free(_structsf ); _structsf = NULL;
eina_hash_free(_enumsf ); _enumsf = NULL;
eina_hash_free(_globalsf ); _globalsf = NULL;
database_unit_init(&state->unit, NULL);
state->classes_f = eina_hash_stringshared_new(NULL);
+ state->aliases_f = eina_hash_stringshared_new(_hashlist_free);
return state;
}
#endif
#define DBG(...) EINA_LOG_DOM_DBG(_eolian_log_dom, __VA_ARGS__)
-extern Eina_Hash *_aliases;
extern Eina_Hash *_structs;
extern Eina_Hash *_enums;
extern Eina_Hash *_globals;
extern Eina_Hash *_constants;
-extern Eina_Hash *_aliasesf;
extern Eina_Hash *_structsf;
extern Eina_Hash *_enumsf;
extern Eina_Hash *_globalsf;
Eolian_Unit unit;
Eina_Hash *classes_f;
+ Eina_Hash *aliases_f;
};
typedef struct _Eolian_Object