summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2014-08-21 16:23:37 +0100
committerDaniel Kolesa <d.kolesa@samsung.com>2014-08-21 16:23:37 +0100
commitc1afa1b6b5b90df8e688841d84a250fe03e9f029 (patch)
treeab9279569eaf908367b2cc1bf22640b56700b245 /src
parentbe39c49554d9464edfd451901930453b9db285df (diff)
eolian: add entry point for database validation stage
Diffstat (limited to 'src')
-rw-r--r--src/Makefile_Eolian.am3
-rw-r--r--src/lib/eolian/database_validate.c7
-rw-r--r--src/lib/eolian/eolian_database.c22
-rw-r--r--src/lib/eolian/eolian_database.h1
4 files changed, 27 insertions, 6 deletions
diff --git a/src/Makefile_Eolian.am b/src/Makefile_Eolian.am
index cebdbda..5f881e3 100644
--- a/src/Makefile_Eolian.am
+++ b/src/Makefile_Eolian.am
@@ -33,7 +33,8 @@ lib_eolian_libeolian_la_SOURCES = \
33 lib/eolian/database_expr.c \ 33 lib/eolian/database_expr.c \
34 lib/eolian/database_expr_api.c \ 34 lib/eolian/database_expr_api.c \
35 lib/eolian/database_var.c \ 35 lib/eolian/database_var.c \
36 lib/eolian/database_var_api.c 36 lib/eolian/database_var_api.c \
37 lib/eolian/database_validate.c
37 38
38lib_eolian_libeolian_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl @EOLIAN_CFLAGS@ \ 39lib_eolian_libeolian_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl @EOLIAN_CFLAGS@ \
39 -DPACKAGE_DATA_DIR=\"$(datadir)/eolian\" 40 -DPACKAGE_DATA_DIR=\"$(datadir)/eolian\"
diff --git a/src/lib/eolian/database_validate.c b/src/lib/eolian/database_validate.c
new file mode 100644
index 0000000..4f91aee
--- /dev/null
+++ b/src/lib/eolian/database_validate.c
@@ -0,0 +1,7 @@
1#include "eolian_database.h"
2
3Eina_Bool
4database_validate(void)
5{
6 return EINA_TRUE;
7}
diff --git a/src/lib/eolian/eolian_database.c b/src/lib/eolian/eolian_database.c
index f7efe13..b954a94 100644
--- a/src/lib/eolian/eolian_database.c
+++ b/src/lib/eolian/eolian_database.c
@@ -19,6 +19,7 @@ Eina_Hash *_filenames = NULL;
19Eina_Hash *_tfilenames = NULL; 19Eina_Hash *_tfilenames = NULL;
20 20
21static int _database_init_count = 0; 21static int _database_init_count = 0;
22static int _parse_depth = 0;
22 23
23static void 24static void
24_hashlist_free(void *data) 25_hashlist_free(void *data)
@@ -159,19 +160,20 @@ eolian_eo_file_parse(const char *filepath)
159 const Eolian_Class *class = eolian_class_get_by_file(bfilename); 160 const Eolian_Class *class = eolian_class_get_by_file(bfilename);
160 const char *inherit_name; 161 const char *inherit_name;
161 Eolian_Implement *impl; 162 Eolian_Implement *impl;
163 ++_parse_depth;
162 if (!class) 164 if (!class)
163 { 165 {
164 if (!eo_parser_database_fill(filepath, EINA_FALSE)) 166 if (!eo_parser_database_fill(filepath, EINA_FALSE))
165 { 167 {
166 free(bfiledup); 168 free(bfiledup);
167 return EINA_FALSE; 169 goto error;
168 } 170 }
169 class = eolian_class_get_by_file(bfilename); 171 class = eolian_class_get_by_file(bfilename);
170 if (!class) 172 if (!class)
171 { 173 {
172 ERR("No class for file %s", bfilename); 174 ERR("No class for file %s", bfilename);
173 free(bfiledup); 175 free(bfiledup);
174 return EINA_FALSE; 176 goto error;
175 } 177 }
176 } 178 }
177 free(bfiledup); 179 free(bfiledup);
@@ -186,9 +188,9 @@ eolian_eo_file_parse(const char *filepath)
186 if (!filepath) 188 if (!filepath)
187 { 189 {
188 ERR("Unable to find a file for class %s", inherit_name); 190 ERR("Unable to find a file for class %s", inherit_name);
189 return EINA_FALSE; 191 goto error;
190 } 192 }
191 if (!eolian_eo_file_parse(filepath)) return EINA_FALSE; 193 if (!eolian_eo_file_parse(filepath)) goto error;
192 } 194 }
193 } 195 }
194 eina_iterator_free(itr); 196 eina_iterator_free(itr);
@@ -200,11 +202,21 @@ eolian_eo_file_parse(const char *filepath)
200 if (!impl_func) 202 if (!impl_func)
201 { 203 {
202 ERR("Unable to find function %s", eolian_implement_full_name_get(impl)); 204 ERR("Unable to find function %s", eolian_implement_full_name_get(impl));
203 return EINA_FALSE; 205 goto error;
204 } 206 }
205 } 207 }
206 eina_iterator_free(itr); 208 eina_iterator_free(itr);
209
210 --_parse_depth;
211 if (!_parse_depth && !database_validate())
212 goto error;
213
214 _parse_depth = 0;
207 return EINA_TRUE; 215 return EINA_TRUE;
216
217error:
218 _parse_depth = 0;
219 return EINA_FALSE;
208} 220}
209 221
210static Eina_Bool _tfile_parse(const Eina_Hash *hash EINA_UNUSED, const void *key EINA_UNUSED, void *data, void *fdata) 222static Eina_Bool _tfile_parse(const Eina_Hash *hash EINA_UNUSED, const void *key EINA_UNUSED, void *data, void *fdata)
diff --git a/src/lib/eolian/eolian_database.h b/src/lib/eolian/eolian_database.h
index 14a7c94..970cb7b 100644
--- a/src/lib/eolian/eolian_database.h
+++ b/src/lib/eolian/eolian_database.h
@@ -251,6 +251,7 @@ int database_init();
251int database_shutdown(); 251int database_shutdown();
252 252
253char *database_class_to_filename(const char *cname); 253char *database_class_to_filename(const char *cname);
254Eina_Bool database_validate(void);
254 255
255/* types */ 256/* types */
256 257