if (!rt.succ)
return EINA_FALSE;
- eina_hash_foreach(_constants, (Eina_Hash_Foreach)_var_map_cb, &rt);
+ eina_hash_foreach(_state->unit.constants, (Eina_Hash_Foreach)_var_map_cb, &rt);
if (!rt.succ)
return EINA_FALSE;
static void
database_var_constant_add(Eolian_Variable *var)
{
- eina_hash_set(_constants, var->full_name, var);
- eina_hash_set(_constantsf, var->base.file, eina_list_append
- ((Eina_List*)eina_hash_find(_constantsf, var->base.file), var));
+ eina_hash_set(_state->unit.constants, var->full_name, var);
+ eina_hash_set(_state->constants_f, var->base.file, eina_list_append
+ ((Eina_List*)eina_hash_find(_state->constants_f, var->base.file), var));
database_decl_add(var->full_name, EOLIAN_DECL_VAR, var->base.file, var);
}
eolian_variable_constant_get_by_name(const Eolian_Unit *unit EINA_UNUSED,
const char *name)
{
- if (!_constants) return NULL;
+ if (!_state) return NULL;
Eina_Stringshare *shr = eina_stringshare_add(name);
- Eolian_Variable *v = eina_hash_find(_constants, shr);
+ Eolian_Variable *v = eina_hash_find(_state->unit.constants, shr);
eina_stringshare_del(shr);
return v;
}
eolian_variable_constants_get_by_file(const Eolian_Unit *unit EINA_UNUSED,
const char *fname)
{
- if (!_constantsf) return NULL;
+ if (!_state) return NULL;
Eina_Stringshare *shr = eina_stringshare_add(fname);
- Eina_List *l = eina_hash_find(_constantsf, shr);
+ Eina_List *l = eina_hash_find(_state->constants_f, shr);
eina_stringshare_del(shr);
if (!l) return NULL;
return eina_list_iterator_new(l);
EAPI Eina_Iterator *
eolian_variable_all_constants_get(const Eolian_Unit *unit EINA_UNUSED)
{
- return (_constants ? eina_hash_iterator_data_new(_constants) : NULL);
+ return (_state ? eina_hash_iterator_data_new(_state->unit.constants) : NULL);
}
EAPI Eina_Iterator *
#include "eolian_database.h"
#include "eolian_priv.h"
-Eina_Hash *_constants = NULL;
-Eina_Hash *_constantsf = NULL;
Eina_Hash *_filenames = NULL;
Eina_Hash *_tfilenames = NULL;
Eina_Hash *_decls = NULL;
{
if (_database_init_count > 0) return ++_database_init_count;
eina_init();
- _constants = eina_hash_stringshared_new(EINA_FREE_CB(database_var_del));
- _constantsf = eina_hash_stringshared_new(_hashlist_free);
_filenames = eina_hash_string_small_new(free);
_tfilenames = eina_hash_string_small_new(free);
_decls = eina_hash_stringshared_new(free);
if (_database_init_count == 0)
{
eolian_free(_state); _state = NULL;
- eina_hash_free(_constants ); _constants = NULL;
- eina_hash_free(_constantsf); _constantsf = NULL;
eina_hash_free(_filenames ); _filenames = NULL;
eina_hash_free(_tfilenames); _tfilenames = NULL;
eina_hash_free(_decls ); _decls = NULL;
database_unit_init(&state->unit, NULL);
- state->classes_f = eina_hash_stringshared_new(NULL);
- state->aliases_f = eina_hash_stringshared_new(_hashlist_free);
- state->structs_f = eina_hash_stringshared_new(_hashlist_free);
- state->enums_f = eina_hash_stringshared_new(_hashlist_free);
- state->globals_f = eina_hash_stringshared_new(_hashlist_free);
+ state->classes_f = eina_hash_stringshared_new(NULL);
+ state->aliases_f = eina_hash_stringshared_new(_hashlist_free);
+ state->structs_f = eina_hash_stringshared_new(_hashlist_free);
+ state->enums_f = eina_hash_stringshared_new(_hashlist_free);
+ state->globals_f = eina_hash_stringshared_new(_hashlist_free);
+ state->constants_f = eina_hash_stringshared_new(_hashlist_free);
return state;
}
#endif
#define DBG(...) EINA_LOG_DOM_DBG(_eolian_log_dom, __VA_ARGS__)
-extern Eina_Hash *_constants;
-extern Eina_Hash *_constantsf;
extern Eina_Hash *_filenames; /* Hash: filename without extension -> full path */
extern Eina_Hash *_tfilenames;
Eina_Hash *structs_f;
Eina_Hash *enums_f;
Eina_Hash *globals_f;
+ Eina_Hash *constants_f;
};
typedef struct _Eolian_Object