summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bin/elua/modules/lualian.lua3
-rw-r--r--src/bin/eolian/main.c6
-rw-r--r--src/bin/eolian_cxx/eolian_cxx.cc6
-rw-r--r--src/bindings/luajit/eolian.lua5
-rw-r--r--src/lib/eolian/Eolian.h11
-rw-r--r--src/lib/eolian/eolian_database.c13
6 files changed, 36 insertions, 8 deletions
diff --git a/src/bin/elua/modules/lualian.lua b/src/bin/elua/modules/lualian.lua
index 9b664a2301..1a963f73a6 100644
--- a/src/bin/elua/modules/lualian.lua
+++ b/src/bin/elua/modules/lualian.lua
@@ -677,6 +677,9 @@ M.generate = function(fname, libname, fstream)
677 if not eolian.eo_file_parse(fname) then 677 if not eolian.eo_file_parse(fname) then
678 error("Failed parsing file: " .. fname) 678 error("Failed parsing file: " .. fname)
679 end 679 end
680 if not eolian.database_validate() then
681 error("Failed validating database.")
682 end
680 local sfn = fname:match(".*[\\/](.+)$") or fname 683 local sfn = fname:match(".*[\\/](.+)$") or fname
681 local klass = eolian.class_get_by_file(sfn) 684 local klass = eolian.class_get_by_file(sfn)
682 local tp = klass:type_get() 685 local tp = klass:type_get()
diff --git a/src/bin/eolian/main.c b/src/bin/eolian/main.c
index bcd13fc482..fed76e94b6 100644
--- a/src/bin/eolian/main.c
+++ b/src/bin/eolian/main.c
@@ -358,6 +358,12 @@ int main(int argc, char **argv)
358 goto end; 358 goto end;
359 } 359 }
360 360
361 if (!eolian_database_validate())
362 {
363 ERR("Error validating database.\n");
364 goto end;
365 }
366
361 eo_filename_copy = strdup(eo_filename); 367 eo_filename_copy = strdup(eo_filename);
362 eo_file_basename = basename(eo_filename_copy); 368 eo_file_basename = basename(eo_filename_copy);
363 if (show) 369 if (show)
diff --git a/src/bin/eolian_cxx/eolian_cxx.cc b/src/bin/eolian_cxx/eolian_cxx.cc
index 8090f3cf97..4a689c50fb 100644
--- a/src/bin/eolian_cxx/eolian_cxx.cc
+++ b/src/bin/eolian_cxx/eolian_cxx.cc
@@ -219,6 +219,12 @@ database_load(options_type const& opts)
219 << "Eolian failed parsing input files"; 219 << "Eolian failed parsing input files";
220 assert(false && "Error parsing input files"); 220 assert(false && "Error parsing input files");
221 } 221 }
222 if (!::eolian_database_validate())
223 {
224 EINA_CXX_DOM_LOG_ERR(eolian_cxx::domain)
225 << "Eolian failed validating database.";
226 assert(false && "Error validating database");
227 }
222} 228}
223 229
224} // namespace eolian_cxx { 230} // namespace eolian_cxx {
diff --git a/src/bindings/luajit/eolian.lua b/src/bindings/luajit/eolian.lua
index 6cf9a9a216..9b8f65c1a6 100644
--- a/src/bindings/luajit/eolian.lua
+++ b/src/bindings/luajit/eolian.lua
@@ -138,6 +138,7 @@ ffi.cdef [[
138 Eina_Bool eolian_system_directory_scan(); 138 Eina_Bool eolian_system_directory_scan();
139 Eina_Bool eolian_all_eo_files_parse(); 139 Eina_Bool eolian_all_eo_files_parse();
140 Eina_Bool eolian_all_eot_files_parse(); 140 Eina_Bool eolian_all_eot_files_parse();
141 Eina_Bool eolian_database_validate(void);
141 Eina_Bool eolian_show_class(const Eolian_Class *klass); 142 Eina_Bool eolian_show_class(const Eolian_Class *klass);
142 Eina_Bool eolian_show_typedef(const char *alias); 143 Eina_Bool eolian_show_typedef(const char *alias);
143 Eina_Bool eolian_show_struct(const char *name); 144 Eina_Bool eolian_show_struct(const char *name);
@@ -304,6 +305,10 @@ M.all_eot_files_parse = function()
304 return eolian.eolian_all_eot_files_parse() ~= 0 305 return eolian.eolian_all_eot_files_parse() ~= 0
305end 306end
306 307
308M.database_validate = function()
309 return eolian.eolian_databasE_validate() ~= 0
310end
311
307M.eot_file_parse = function(fname) 312M.eot_file_parse = function(fname)
308 return eolian.eolian_eot_file_parse(fname) ~= 0 313 return eolian.eolian_eot_file_parse(fname) ~= 0
309end 314end
diff --git a/src/lib/eolian/Eolian.h b/src/lib/eolian/Eolian.h
index 3098f49a33..7135a456a0 100644
--- a/src/lib/eolian/Eolian.h
+++ b/src/lib/eolian/Eolian.h
@@ -291,6 +291,17 @@ EAPI Eina_Bool eolian_all_eo_files_parse();
291EAPI Eina_Bool eolian_all_eot_files_parse(); 291EAPI Eina_Bool eolian_all_eot_files_parse();
292 292
293/* 293/*
294 * @brief Validates the database, printing errors and warnings.
295 *
296 * @return EINA_TRUE on success, EINA_FALSE otherwise.
297 *
298 * Useful to catch type errors etc. early on.
299 *
300 * @ingroup Eolian
301 */
302EAPI Eina_Bool eolian_database_validate(void);
303
304/*
294 * @brief Show information about a given class. 305 * @brief Show information about a given class.
295 * 306 *
296 * If klass is NULL, this function will print information of 307 * If klass is NULL, this function will print information of
diff --git a/src/lib/eolian/eolian_database.c b/src/lib/eolian/eolian_database.c
index b954a94b0c..757f8894f6 100644
--- a/src/lib/eolian/eolian_database.c
+++ b/src/lib/eolian/eolian_database.c
@@ -19,7 +19,6 @@ 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;
23 22
24static void 23static void
25_hashlist_free(void *data) 24_hashlist_free(void *data)
@@ -160,7 +159,6 @@ eolian_eo_file_parse(const char *filepath)
160 const Eolian_Class *class = eolian_class_get_by_file(bfilename); 159 const Eolian_Class *class = eolian_class_get_by_file(bfilename);
161 const char *inherit_name; 160 const char *inherit_name;
162 Eolian_Implement *impl; 161 Eolian_Implement *impl;
163 ++_parse_depth;
164 if (!class) 162 if (!class)
165 { 163 {
166 if (!eo_parser_database_fill(filepath, EINA_FALSE)) 164 if (!eo_parser_database_fill(filepath, EINA_FALSE))
@@ -207,15 +205,9 @@ eolian_eo_file_parse(const char *filepath)
207 } 205 }
208 eina_iterator_free(itr); 206 eina_iterator_free(itr);
209 207
210 --_parse_depth;
211 if (!_parse_depth && !database_validate())
212 goto error;
213
214 _parse_depth = 0;
215 return EINA_TRUE; 208 return EINA_TRUE;
216 209
217error: 210error:
218 _parse_depth = 0;
219 return EINA_FALSE; 211 return EINA_FALSE;
220} 212}
221 213
@@ -249,3 +241,8 @@ eolian_all_eo_files_parse()
249 return ret; 241 return ret;
250} 242}
251 243
244EAPI Eina_Bool
245eolian_database_validate(void)
246{
247 return database_validate();
248}