summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2017-12-07 18:54:00 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2017-12-07 19:11:58 +0100
commit2343e6cc54e76f84bd327c3283d4bb4abf5c9af4 (patch)
tree91b4a48ac4afd50cf0cf18a8b2bfbebccd19bde9 /src
parent9d09d722b96dc6ff49236249de10380080330df4 (diff)
eolian: make parsing/parsed files mapping non-global
Diffstat (limited to 'src')
-rw-r--r--src/lib/eolian/eo_parser.c12
-rw-r--r--src/lib/eolian/eolian_database.c10
-rw-r--r--src/lib/eolian/eolian_database.h7
3 files changed, 12 insertions, 17 deletions
diff --git a/src/lib/eolian/eo_parser.c b/src/lib/eolian/eo_parser.c
index 887bfd3fdf..a077245ab6 100644
--- a/src/lib/eolian/eo_parser.c
+++ b/src/lib/eolian/eo_parser.c
@@ -680,7 +680,7 @@ parse_struct_attrs(Eo_Lexer *ls, Eina_Bool is_enum, Eina_Bool *is_extern,
680static Eolian_Class * 680static Eolian_Class *
681_parse_dep(Eo_Lexer *ls, const char *fname, const char *name) 681_parse_dep(Eo_Lexer *ls, const char *fname, const char *name)
682{ 682{
683 if (eina_hash_find(_parsingeos, fname)) 683 if (eina_hash_find(ls->state->parsing, fname))
684 return NULL; 684 return NULL;
685 Eolian_Class *cl = NULL; 685 Eolian_Class *cl = NULL;
686 if (!eo_parser_database_fill(ls->state, fname, EINA_FALSE, &cl) || !cl) 686 if (!eo_parser_database_fill(ls->state, fname, EINA_FALSE, &cl) || !cl)
@@ -2499,14 +2499,14 @@ end:
2499Eina_Bool 2499Eina_Bool
2500eo_parser_database_fill(Eolian *state, const char *filename, Eina_Bool eot, Eolian_Class **fcl) 2500eo_parser_database_fill(Eolian *state, const char *filename, Eina_Bool eot, Eolian_Class **fcl)
2501{ 2501{
2502 Eolian_Class *cl = eina_hash_find(_parsedeos, filename); 2502 Eolian_Class *cl = eina_hash_find(state->parsed, filename);
2503 if (cl) 2503 if (cl)
2504 { 2504 {
2505 if (!eot && fcl) *fcl = cl; 2505 if (!eot && fcl) *fcl = cl;
2506 return EINA_TRUE; 2506 return EINA_TRUE;
2507 } 2507 }
2508 2508
2509 eina_hash_set(_parsingeos, filename, (void *)EINA_TRUE); 2509 eina_hash_set(state->parsing, filename, (void *)EINA_TRUE);
2510 2510
2511 Eo_Lexer *ls = eo_lexer_new(state, filename); 2511 Eo_Lexer *ls = eo_lexer_new(state, filename);
2512 if (!ls) 2512 if (!ls)
@@ -2544,14 +2544,14 @@ eo_parser_database_fill(Eolian *state, const char *filename, Eina_Bool eot, Eoli
2544 if (fcl) *fcl = cl; 2544 if (fcl) *fcl = cl;
2545 2545
2546done: 2546done:
2547 eina_hash_set(_parsedeos, filename, eot ? (void *)EINA_TRUE : cl); 2547 eina_hash_set(state->parsed, filename, eot ? (void *)EINA_TRUE : cl);
2548 eina_hash_set(_parsingeos, filename, (void *)EINA_FALSE); 2548 eina_hash_set(state->parsing, filename, (void *)EINA_FALSE);
2549 2549
2550 eo_lexer_free(ls); 2550 eo_lexer_free(ls);
2551 return EINA_TRUE; 2551 return EINA_TRUE;
2552 2552
2553error: 2553error:
2554 eina_hash_set(_parsingeos, filename, (void *)EINA_FALSE); 2554 eina_hash_set(state->parsing, filename, (void *)EINA_FALSE);
2555 eo_lexer_free(ls); 2555 eo_lexer_free(ls);
2556 return EINA_FALSE; 2556 return EINA_FALSE;
2557} 2557}
diff --git a/src/lib/eolian/eolian_database.c b/src/lib/eolian/eolian_database.c
index 7f7c5a2788..8ebb974ae0 100644
--- a/src/lib/eolian/eolian_database.c
+++ b/src/lib/eolian/eolian_database.c
@@ -12,9 +12,6 @@ Eina_Hash *_decls = NULL;
12Eina_Hash *_declsf = NULL; 12Eina_Hash *_declsf = NULL;
13Eina_Hash *_units = NULL; 13Eina_Hash *_units = NULL;
14 14
15Eina_Hash *_parsedeos = NULL;
16Eina_Hash *_parsingeos = NULL;
17
18Eina_Hash *_defereos = NULL; 15Eina_Hash *_defereos = NULL;
19 16
20static Eolian_Unit *_cunit = NULL; 17static Eolian_Unit *_cunit = NULL;
@@ -34,8 +31,6 @@ database_init()
34 eina_init(); 31 eina_init();
35 _decls = eina_hash_stringshared_new(free); 32 _decls = eina_hash_stringshared_new(free);
36 _declsf = eina_hash_stringshared_new(_hashlist_free); 33 _declsf = eina_hash_stringshared_new(_hashlist_free);
37 _parsedeos = eina_hash_string_small_new(NULL);
38 _parsingeos = eina_hash_string_small_new(NULL);
39 _defereos = eina_hash_string_small_new(NULL); 34 _defereos = eina_hash_string_small_new(NULL);
40 _units = eina_hash_stringshared_new(EINA_FREE_CB(database_unit_del)); 35 _units = eina_hash_stringshared_new(EINA_FREE_CB(database_unit_del));
41 return ++_database_init_count; 36 return ++_database_init_count;
@@ -55,8 +50,6 @@ database_shutdown()
55 { 50 {
56 eina_hash_free(_decls ); _decls = NULL; 51 eina_hash_free(_decls ); _decls = NULL;
57 eina_hash_free(_declsf ); _declsf = NULL; 52 eina_hash_free(_declsf ); _declsf = NULL;
58 eina_hash_free(_parsedeos ); _parsedeos = NULL;
59 eina_hash_free(_parsingeos); _parsingeos = NULL;
60 eina_hash_free(_defereos ); _defereos = NULL; 53 eina_hash_free(_defereos ); _defereos = NULL;
61 eina_hash_free(_units ); _units = NULL; 54 eina_hash_free(_units ); _units = NULL;
62 eina_shutdown(); 55 eina_shutdown();
@@ -608,6 +601,9 @@ eolian_new(void)
608 state->filenames_eo = eina_hash_string_small_new(free); 601 state->filenames_eo = eina_hash_string_small_new(free);
609 state->filenames_eot = eina_hash_string_small_new(free); 602 state->filenames_eot = eina_hash_string_small_new(free);
610 603
604 state->parsed = eina_hash_string_small_new(NULL);
605 state->parsing = eina_hash_string_small_new(NULL);
606
611 state->classes_f = eina_hash_stringshared_new(NULL); 607 state->classes_f = eina_hash_stringshared_new(NULL);
612 state->aliases_f = eina_hash_stringshared_new(_hashlist_free); 608 state->aliases_f = eina_hash_stringshared_new(_hashlist_free);
613 state->structs_f = eina_hash_stringshared_new(_hashlist_free); 609 state->structs_f = eina_hash_stringshared_new(_hashlist_free);
diff --git a/src/lib/eolian/eolian_database.h b/src/lib/eolian/eolian_database.h
index c59e6e69bd..eaf55f801a 100644
--- a/src/lib/eolian/eolian_database.h
+++ b/src/lib/eolian/eolian_database.h
@@ -37,10 +37,6 @@ extern Eina_Hash *_declsf;
37 37
38extern Eina_Hash *_units; 38extern Eina_Hash *_units;
39 39
40/* holds parsed/currently parsing eot files to keep track */
41extern Eina_Hash *_parsedeos;
42extern Eina_Hash *_parsingeos;
43
44/* for deferred dependency parsing */ 40/* for deferred dependency parsing */
45extern Eina_Hash *_defereos; 41extern Eina_Hash *_defereos;
46 42
@@ -64,6 +60,9 @@ struct _Eolian
64 Eina_Hash *filenames_eo; /* filename to full path mapping */ 60 Eina_Hash *filenames_eo; /* filename to full path mapping */
65 Eina_Hash *filenames_eot; 61 Eina_Hash *filenames_eot;
66 62
63 Eina_Hash *parsing;
64 Eina_Hash *parsed;
65
67 Eina_Hash *classes_f; 66 Eina_Hash *classes_f;
68 Eina_Hash *aliases_f; 67 Eina_Hash *aliases_f;
69 Eina_Hash *structs_f; 68 Eina_Hash *structs_f;