forked from enlightenment/efl
eolian: make deferred parsing map non-global
This commit is contained in:
parent
2343e6cc54
commit
e7bf69fc04
|
@ -278,7 +278,7 @@ doc_ref_class(Eo_Lexer *ls, const char *cname)
|
||||||
const char *eop = eina_hash_find(ls->state->filenames_eo, buf);
|
const char *eop = eina_hash_find(ls->state->filenames_eo, buf);
|
||||||
if (!eop)
|
if (!eop)
|
||||||
return;
|
return;
|
||||||
eina_hash_set(_defereos, buf, eop);
|
eina_hash_set(ls->state->defer, buf, eop);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -2189,7 +2189,7 @@ parse_unit(Eo_Lexer *ls, Eina_Bool eot)
|
||||||
eo_lexer_syntax_error(ls, errbuf);
|
eo_lexer_syntax_error(ls, errbuf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
eina_hash_set(_defereos, eina_strbuf_string_get(buf), found);
|
eina_hash_set(ls->state->defer, eina_strbuf_string_get(buf), found);
|
||||||
pop_strbuf(ls);
|
pop_strbuf(ls);
|
||||||
eo_lexer_get(ls);
|
eo_lexer_get(ls);
|
||||||
check_next(ls, ';');
|
check_next(ls, ';');
|
||||||
|
|
|
@ -12,8 +12,6 @@ Eina_Hash *_decls = NULL;
|
||||||
Eina_Hash *_declsf = NULL;
|
Eina_Hash *_declsf = NULL;
|
||||||
Eina_Hash *_units = NULL;
|
Eina_Hash *_units = NULL;
|
||||||
|
|
||||||
Eina_Hash *_defereos = NULL;
|
|
||||||
|
|
||||||
static Eolian_Unit *_cunit = NULL;
|
static Eolian_Unit *_cunit = NULL;
|
||||||
|
|
||||||
static int _database_init_count = 0;
|
static int _database_init_count = 0;
|
||||||
|
@ -31,7 +29,6 @@ database_init()
|
||||||
eina_init();
|
eina_init();
|
||||||
_decls = eina_hash_stringshared_new(free);
|
_decls = eina_hash_stringshared_new(free);
|
||||||
_declsf = eina_hash_stringshared_new(_hashlist_free);
|
_declsf = eina_hash_stringshared_new(_hashlist_free);
|
||||||
_defereos = eina_hash_string_small_new(NULL);
|
|
||||||
_units = eina_hash_stringshared_new(EINA_FREE_CB(database_unit_del));
|
_units = eina_hash_stringshared_new(EINA_FREE_CB(database_unit_del));
|
||||||
return ++_database_init_count;
|
return ++_database_init_count;
|
||||||
}
|
}
|
||||||
|
@ -50,7 +47,6 @@ database_shutdown()
|
||||||
{
|
{
|
||||||
eina_hash_free(_decls ); _decls = NULL;
|
eina_hash_free(_decls ); _decls = NULL;
|
||||||
eina_hash_free(_declsf ); _declsf = NULL;
|
eina_hash_free(_declsf ); _declsf = NULL;
|
||||||
eina_hash_free(_defereos ); _defereos = NULL;
|
|
||||||
eina_hash_free(_units ); _units = NULL;
|
eina_hash_free(_units ); _units = NULL;
|
||||||
eina_shutdown();
|
eina_shutdown();
|
||||||
}
|
}
|
||||||
|
@ -603,6 +599,7 @@ eolian_new(void)
|
||||||
|
|
||||||
state->parsed = eina_hash_string_small_new(NULL);
|
state->parsed = eina_hash_string_small_new(NULL);
|
||||||
state->parsing = eina_hash_string_small_new(NULL);
|
state->parsing = eina_hash_string_small_new(NULL);
|
||||||
|
state->defer = eina_hash_string_small_new(NULL);
|
||||||
|
|
||||||
state->classes_f = eina_hash_stringshared_new(NULL);
|
state->classes_f = eina_hash_stringshared_new(NULL);
|
||||||
state->aliases_f = eina_hash_stringshared_new(_hashlist_free);
|
state->aliases_f = eina_hash_stringshared_new(_hashlist_free);
|
||||||
|
@ -621,6 +618,7 @@ eolian_free(Eolian *state)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
database_unit_del(&state->unit);
|
database_unit_del(&state->unit);
|
||||||
|
|
||||||
free(state);
|
free(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -715,11 +713,11 @@ _eolian_file_parse_nodep(Eolian *state, const char *filepath)
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_parse_deferred(Eolian *state)
|
_parse_deferred(Eolian *state)
|
||||||
{
|
{
|
||||||
Eina_Hash *defer = _defereos;
|
Eina_Hash *defer = state->defer;
|
||||||
if (!defer || !eina_hash_population(defer))
|
if (!defer || !eina_hash_population(defer))
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
/* clean room for more deps for later parsing */
|
/* clean room for more deps for later parsing */
|
||||||
_defereos = eina_hash_string_small_new(NULL);
|
state->defer = eina_hash_string_small_new(NULL);
|
||||||
Eina_Iterator *itr = eina_hash_iterator_data_new(defer);
|
Eina_Iterator *itr = eina_hash_iterator_data_new(defer);
|
||||||
const char *dep;
|
const char *dep;
|
||||||
EINA_ITERATOR_FOREACH(itr, dep)
|
EINA_ITERATOR_FOREACH(itr, dep)
|
||||||
|
@ -727,7 +725,7 @@ _parse_deferred(Eolian *state)
|
||||||
if (!_eolian_file_parse_nodep(state, dep))
|
if (!_eolian_file_parse_nodep(state, dep))
|
||||||
{
|
{
|
||||||
eina_iterator_free(itr);
|
eina_iterator_free(itr);
|
||||||
eina_hash_free_buckets(_defereos);
|
eina_hash_free_buckets(state->defer);
|
||||||
eina_hash_free(defer);
|
eina_hash_free(defer);
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,9 +37,6 @@ extern Eina_Hash *_declsf;
|
||||||
|
|
||||||
extern Eina_Hash *_units;
|
extern Eina_Hash *_units;
|
||||||
|
|
||||||
/* for deferred dependency parsing */
|
|
||||||
extern Eina_Hash *_defereos;
|
|
||||||
|
|
||||||
struct _Eolian_Unit
|
struct _Eolian_Unit
|
||||||
{
|
{
|
||||||
Eolian *state;
|
Eolian *state;
|
||||||
|
@ -62,6 +59,7 @@ struct _Eolian
|
||||||
|
|
||||||
Eina_Hash *parsing;
|
Eina_Hash *parsing;
|
||||||
Eina_Hash *parsed;
|
Eina_Hash *parsed;
|
||||||
|
Eina_Hash *defer;
|
||||||
|
|
||||||
Eina_Hash *classes_f;
|
Eina_Hash *classes_f;
|
||||||
Eina_Hash *aliases_f;
|
Eina_Hash *aliases_f;
|
||||||
|
|
Loading…
Reference in New Issue