This breaks the C# bindings as some Eolian APIs are changed :( On Wed, Dec 6, 2017 at 12:42 AM, Daniel Kolesa <dan...@octaforge.org> wrote:
> q66 pushed a commit to branch master. > > http://git.enlightenment.org/core/efl.git/commit/?id= > 8a1f93f698315b43de28b755bce5fc9a4d85d59a > > commit 8a1f93f698315b43de28b755bce5fc9a4d85d59a > Author: Daniel Kolesa <d.kol...@osg.samsung.com> > Date: Tue Dec 5 16:40:04 2017 +0100 > > eolian: pass state where necessary > > This modifies the API so that global state removal is made > possible. It's still used internally for now but externally > the state is contained. > --- > src/bin/eolian/main.c | 9 ++- > src/bin/eolian_cxx/eolian_cxx.cc | 23 +++++-- > src/bindings/luajit/eolian.lua | 96 ++++++++++++++++------------ > src/lib/eolian/Eolian.h | 116 +++++++++++++++++++----------- > ---- > src/lib/eolian/eolian_database.c | 20 +++--- > src/scripts/elua/modules/lualian.lua | 16 +++-- > src/tests/eolian/eolian_parsing.c | 119 ++++++++++++++++++++++++++---- > ----- > 7 files changed, 258 insertions(+), 141 deletions(-) > > diff --git a/src/bin/eolian/main.c b/src/bin/eolian/main.c > index fdb5ca2568..92643c6f7e 100644 > --- a/src/bin/eolian/main.c > +++ b/src/bin/eolian/main.c > @@ -430,6 +430,8 @@ main(int argc, char **argv) > eina_init(); > eolian_init(); > > + Eolian *eos = eolian_new(); > + > const char *dom = "eolian_gen"; > _eolian_gen_log_dom = eina_log_domain_register(dom, EINA_COLOR_GREEN); > if (_eolian_gen_log_dom < 0) > @@ -530,7 +532,7 @@ main(int argc, char **argv) > > if (scan_system) > { > - if (!eolian_system_directory_scan()) > + if (!eolian_system_directory_scan(eos)) > { > fprintf(stderr, "eolian: could not scan system directory\n"); > goto end; > @@ -540,14 +542,14 @@ main(int argc, char **argv) > const char *inc; > EINA_LIST_FREE(includes, inc) > { > - if (!eolian_directory_scan(inc)) > + if (!eolian_directory_scan(eos, inc)) > { > fprintf(stderr, "eolian: could not scan '%s'\n", inc); > goto end; > } > } > > - const Eolian_Unit *src = eolian_file_parse(input); > + const Eolian_Unit *src = eolian_file_parse(eos, input); > if (!src) > { > fprintf(stderr, "eolian: could not parse file '%s'\n", input); > @@ -589,6 +591,7 @@ end: > free(outs[i]); > free(basen); > > + eolian_free(eos); > eolian_shutdown(); > eina_shutdown(); > > diff --git a/src/bin/eolian_cxx/eolian_cxx.cc b/src/bin/eolian_cxx/eolian_ > cxx.cc > index 134700ae6c..fac96da5e2 100644 > --- a/src/bin/eolian_cxx/eolian_cxx.cc > +++ b/src/bin/eolian_cxx/eolian_cxx.cc > @@ -34,6 +34,7 @@ struct options_type > { > std::vector<std::string> include_dirs; > std::vector<std::string> in_files; > + mutable Eolian* state; > mutable Eolian_Unit const* unit; > std::string out_file; > bool main_header; > @@ -298,7 +299,7 @@ run(options_type const& opts) > > for(auto&& name : opts.in_files) > { > - Eolian_Unit const* unit = ::eolian_file_parse(name.c_str()); > + Eolian_Unit const* unit = ::eolian_file_parse(opts.state, > name.c_str()); > if(!unit) > { > EINA_CXX_DOM_LOG_ERR(eolian_cxx::domain) > @@ -346,17 +347,30 @@ run(options_type const& opts) > } > > static void > +state_init(options_type const& opts) > +{ > + Eolian *eos = ::eolian_new(); > + if (!eos) > + { > + EINA_CXX_DOM_LOG_ERR(eolian_cxx::domain) > + << "Eolian failed creating state"; > + assert(false && "Error creating Eolian state"); > + } > + opts.state = eos; > +} > + > +static void > database_load(options_type const& opts) > { > for (auto src : opts.include_dirs) > { > - if (!::eolian_directory_scan(src.c_str())) > + if (!::eolian_directory_scan(opts.state, src.c_str())) > { > EINA_CXX_DOM_LOG_WARN(eolian_cxx::domain) > << "Couldn't load eolian from '" << src << "'."; > } > } > - if (!::eolian_all_eot_files_parse()) > + if (!::eolian_all_eot_files_parse(opts.state)) > { > EINA_CXX_DOM_LOG_ERR(eolian_cxx::domain) > << "Eolian failed parsing eot files"; > @@ -368,7 +382,7 @@ database_load(options_type const& opts) > << "No input file."; > assert(false && "Error parsing input file"); > } > - if (!opts.main_header && !::eolian_file_parse(opts.in_ > files[0].c_str())) > + if (!opts.main_header && !::eolian_file_parse(opts.state, > opts.in_files[0].c_str())) > { > EINA_CXX_DOM_LOG_ERR(eolian_cxx::domain) > << "Failed parsing: " << opts.in_files[0] << "."; > @@ -480,6 +494,7 @@ int main(int argc, char **argv) > efl::eina::eina_init eina_init; > efl::eolian::eolian_init eolian_init; > eolian_cxx::options_type opts = opts_get(argc, argv); > + eolian_cxx::state_init(opts); > eolian_cxx::database_load(opts); > eolian_cxx::run(opts); > } > diff --git a/src/bindings/luajit/eolian.lua b/src/bindings/luajit/eolian. > lua > index b0c0f7c67e..b7d4d6ec0d 100644 > --- a/src/bindings/luajit/eolian.lua > +++ b/src/bindings/luajit/eolian.lua > @@ -13,6 +13,7 @@ ffi.cdef [[ > typedef unsigned char Eina_Bool; > typedef struct _Eina_Iterator Eina_Iterator; > > + typedef struct _Eolian Eolian; > typedef struct _Eolian_Class Eolian_Class; > typedef struct _Eolian_Function Eolian_Function; > typedef struct _Eolian_Type Eolian_Type; > @@ -284,17 +285,19 @@ ffi.cdef [[ > const char *text, *text_end; > } Eolian_Doc_Token; > > - const Eolian_Unit *eolian_file_parse(const char *filepath); > - Eina_Iterator *eolian_all_eo_file_paths_get(void); > - Eina_Iterator *eolian_all_eot_file_paths_get(void); > - Eina_Iterator *eolian_all_eo_files_get(void); > - Eina_Iterator *eolian_all_eot_files_get(void); > int eolian_init(void); > int eolian_shutdown(void); > - Eina_Bool eolian_directory_scan(const char *dir); > - Eina_Bool eolian_system_directory_scan(); > - Eina_Bool eolian_all_eo_files_parse(); > - Eina_Bool eolian_all_eot_files_parse(); > + Eolian *eolian_new(void); > + void eolian_free(Eolian *state); > + const Eolian_Unit *eolian_file_parse(Eolian *state, const char > *filepath); > + Eina_Iterator *eolian_all_eo_file_paths_get(Eolian *state); > + Eina_Iterator *eolian_all_eot_file_paths_get(Eolian *state); > + Eina_Iterator *eolian_all_eo_files_get(Eolian *state); > + Eina_Iterator *eolian_all_eot_files_get(Eolian *state); > + Eina_Bool eolian_directory_scan(Eolian *state, const char *dir); > + Eina_Bool eolian_system_directory_scan(Eolian *state); > + Eina_Bool eolian_all_eo_files_parse(Eolian *state); > + Eina_Bool eolian_all_eot_files_parse(Eolian *state); > const Eolian_Class *eolian_class_get_by_name(const Eolian_Unit > *unit, const char *class_name); > const Eolian_Class *eolian_class_get_by_file(const Eolian_Unit > *unit, const char *file_name); > const char *eolian_class_file_get(const Eolian_Class *klass); > @@ -509,44 +512,59 @@ M.object_scope = { > PROTECTED = 3 > } > > -M.directory_scan = function(dir) > - return eolian.eolian_directory_scan(dir) ~= 0 > -end > +ffi.metatype("Eolian", { > + __index = { > + directory_scan = function(self, dir) > + return eolian.eolian_directory_scan(self, dir) ~= 0 > + end, > > -M.system_directory_scan = function() > - return eolian.eolian_system_directory_scan() ~= 0 > -end > + system_directory_scan = function(self) > + return eolian.eolian_system_directory_scan(self) ~= 0 > + end, > > -M.file_parse = function(fpath) > - local v = eolian.eolian_file_parse(fpath) > - if v == nil then > - return nil > - end > - return v > -end > + file_parse = function(self, fpath) > + local v = eolian.eolian_file_parse(self, fpath) > + if v == nil then > + return nil > + end > + return v > + end, > > -M.all_eo_files_parse = function() > - return eolian.eolian_all_eo_files_parse() ~= 0 > -end > + all_eo_files_parse = function(self) > + return eolian.eolian_all_eo_files_parse(self) ~= 0 > + end, > > -M.all_eot_files_parse = function() > - return eolian.eolian_all_eot_files_parse() ~= 0 > -end > + all_eot_files_parse = function(self) > + return eolian.eolian_all_eot_files_parse(self) ~= 0 > + end, > > -M.all_eo_file_paths_get = function() > - return iterator.String_Iterator(eolian.eolian_all_eo_file_ > paths_get()) > -end > + all_eo_file_paths_get = function(self) > + return iterator.String_Iterator(eolian.eolian_all_eo_file_ > paths_get(self)) > + end, > > -M.all_eot_file_paths_get = function() > - return iterator.String_Iterator(eolian.eolian_all_eot_file_ > paths_get()) > -end > + all_eot_file_paths_get = function(self) > + return iterator.String_Iterator(eolian.eolian_all_eot_file_ > paths_get(self)) > + end, > > -M.all_eo_files_get = function() > - return iterator.String_Iterator(eolian.eolian_all_eo_files_get()) > -end > + all_eo_files_get = function(self) > + return iterator.String_Iterator(eolian.eolian_all_eo_files_ > get(self)) > + end, > + > + all_eot_files_get = function(self) > + return iterator.String_Iterator(eolian.eolian_all_eot_files_ > get(self)) > + end, > + > + unit_get = function(self) > + return ffi.cast("Eolian_Unit *", self) > + end > + }, > + __gc = function(self) > + eolian.eolian_free(self) > + end > +}) > > -M.all_eot_files_get = function() > - return iterator.String_Iterator(eolian.eolian_all_eot_files_get()) > +M.new = function() > + return eolian.eolian_new() > end > > M.declaration_type = { > diff --git a/src/lib/eolian/Eolian.h b/src/lib/eolian/Eolian.h > index 0e8b9d59c7..bfb8c5387a 100644 > --- a/src/lib/eolian/Eolian.h > +++ b/src/lib/eolian/Eolian.h > @@ -456,11 +456,53 @@ typedef struct _Eolian_Doc_Token > } Eolian_Doc_Token; > > /* > + * @brief Init Eolian. > + * > + * @ingroup Eolian > + */ > +EAPI int eolian_init(void); > + > +/* > + * @brief Shutdown Eolian. > + * > + * @ingroup Eolian > + */ > +EAPI int eolian_shutdown(void); > + > +/* > + * @brief Create a new Eolian state. > + * > + * This creates a new Eolian state that consists of a "master unit" with > + * the same address (therefore, you can cast it to Eolian_Unit) plus extra > + * state information. > + * > + * You need to free this with eolian_free once you're done. > + * > + * @return A new state (or NULL on failure). > + * > + * @ingroup Eolian > + */ > +EAPI Eolian *eolian_new(void); > + > +/* > + * @brief Free an Eolian state. > + * > + * You can use this to free an Eolian state. > + * > + * If the input is NULL, this function has no effect. > + * > + * @param[in] state the state to free > + * > + */ > +EAPI void eolian_free(Eolian *state); > + > +/* > * @brief Parse the given .eo or .eot file and fill the database. > * > * The input can be either a full path to the file or only a filename. > * If it's a filename, it must be scanned for first. > * > + * @param[in] state The Eolian state. > * @param[in] filepath Path to the file to parse. > * @return The unit corresponding to the parsed file or NULL. > * > @@ -468,92 +510,59 @@ typedef struct _Eolian_Doc_Token > * > * @ingroup Eolian > */ > -EAPI const Eolian_Unit *eolian_file_parse(const char *filepath); > +EAPI const Eolian_Unit *eolian_file_parse(Eolian *state, const char > *filepath); > > /* > * @brief Get an iterator to all .eo file names with paths. > * > + * @param[in] state The Eolian state. > + * > * @see eolian_all_eo_files_get > * @see eolian_all_eot_file_paths_get > * @see eolian_all_eot_files_get > * > * @ingroup Eolian > */ > -EAPI Eina_Iterator *eolian_all_eo_file_paths_get(void); > +EAPI Eina_Iterator *eolian_all_eo_file_paths_get(Eolian *state); > > /* > * @brief Get an iterator to all .eot file names with paths. > * > + * @param[in] state The Eolian state. > + * > * @see eolian_all_eo_files_get > * @see eolian_all_eo_file_paths_get > * @see eolian_all_eot_files_get > * > * @ingroup Eolian > */ > -EAPI Eina_Iterator *eolian_all_eot_file_paths_get(void); > +EAPI Eina_Iterator *eolian_all_eot_file_paths_get(Eolian *state); > > /* > * @brief Get an iterator to all .eo file names (without paths). > * > + * @param[in] state The Eolian state. > + * > * @see eolian_all_eo_file_paths_get > * @see eolian_all_eot_file_paths_get > * @see eolian_all_eot_files_get > * > * @ingroup Eolian > */ > -EAPI Eina_Iterator *eolian_all_eo_files_get(void); > +EAPI Eina_Iterator *eolian_all_eo_files_get(Eolian *state); > > /* > * @brief Get an iterator to all .eot file names (without paths). > * > + * @param[in] state The Eolian state. > + * > * @see eolian_all_eo_file_paths_get > * @see eolian_all_eot_file_paths_get > * @see eolian_all_eo_files_get > * > * @ingroup Eolian > */ > -EAPI Eina_Iterator *eolian_all_eot_files_get(void); > - > -/* > - * @brief Init Eolian. > - * > - * @ingroup Eolian > - */ > -EAPI int eolian_init(void); > - > -/* > - * @brief Shutdown Eolian. > - * > - * @ingroup Eolian > - */ > -EAPI int eolian_shutdown(void); > - > -/* > - * @brief Create a new Eolian state. > - * > - * This creates a new Eolian state that consists of a "master unit" with > - * the same address (therefore, you can cast it to Eolian_Unit) plus extra > - * state information. > - * > - * You need to free this with eolian_free once you're done. > - * > - * @return A new state (or NULL on failure). > - * > - * @ingroup Eolian > - */ > -EAPI Eolian *eolian_new(void); > - > -/* > - * @brief Free an Eolian state. > - * > - * You can use this to free an Eolian state. > - * > - * If the input is NULL, this function has no effect. > - * > - * @param[in] unit the state to free > - * > - */ > -EAPI void eolian_free(Eolian *state); > +EAPI Eina_Iterator *eolian_all_eot_files_get(Eolian *state); > > /* > * @brief Scan the given directory (recursively) and search for .eo and > @@ -561,6 +570,7 @@ EAPI void eolian_free(Eolian *state); > * > * The found files are just open to extract the class name. > * > + * @param[in] state The Eolian state. > * @param[in] dir the directory to scan > * @return EINA_TRUE on success, EINA_FALSE otherwise. > * > @@ -568,24 +578,28 @@ EAPI void eolian_free(Eolian *state); > * > * @ingroup Eolian > */ > -EAPI Eina_Bool eolian_directory_scan(const char *dir); > +EAPI Eina_Bool eolian_directory_scan(Eolian *state, const char *dir); > > /* > * @brief Scan the system directory (recursively) and search for .eo and > * .eot files. > * > + * @param[in] state The Eolian state. > + * > * @return EINA_TRUE on success, EINA_FALSE otherwise. > * > * @see eolian_directory_scan > * > * @ingroup Eolian > */ > -EAPI Eina_Bool eolian_system_directory_scan(void); > +EAPI Eina_Bool eolian_system_directory_scan(Eolian *state); > > /* > * @brief Force parsing of all the .eo files located in the directories > * given in eolian_directory_scan.. > * > + * @param[in] state The Eolian state. > + * > * @return EINA_TRUE on success, EINA_FALSE otherwise. > * > * @see eolian_directory_scan > @@ -593,12 +607,14 @@ EAPI Eina_Bool eolian_system_directory_scan(void); > * > * @ingroup Eolian > */ > -EAPI Eina_Bool eolian_all_eo_files_parse(void); > +EAPI Eina_Bool eolian_all_eo_files_parse(Eolian *state); > > /* > * @brief Force parsing of all the .eot files located in the directories > * given in eolian_directory_scan.. > * > + * @param[in] state The Eolian state. > + * > * @return EINA_TRUE on success, EINA_FALSE otherwise. > * > * @see eolian_directory_scan > @@ -606,7 +622,7 @@ EAPI Eina_Bool eolian_all_eo_files_parse(void); > * > * @ingroup Eolian > */ > -EAPI Eina_Bool eolian_all_eot_files_parse(void); > +EAPI Eina_Bool eolian_all_eot_files_parse(Eolian *state); > > /* > * @brief Gets a class by its name > diff --git a/src/lib/eolian/eolian_database.c b/src/lib/eolian/eolian_ > database.c > index e68e9d3b0a..0a6601b539 100644 > --- a/src/lib/eolian/eolian_database.c > +++ b/src/lib/eolian/eolian_database.c > @@ -685,7 +685,7 @@ _scan_cb(const char *name, const char *path, void > *data EINA_UNUSED) > } > > EAPI Eina_Bool > -eolian_directory_scan(const char *dir) > +eolian_directory_scan(Eolian *state EINA_UNUSED, const char *dir) > { > if (!dir) return EINA_FALSE; > eina_file_dir_list(dir, EINA_TRUE, _scan_cb, NULL); > @@ -693,13 +693,13 @@ eolian_directory_scan(const char *dir) > } > > EAPI Eina_Bool > -eolian_system_directory_scan() > +eolian_system_directory_scan(Eolian *state) > { > Eina_Bool ret; > Eina_Strbuf *buf = eina_strbuf_new(); > eina_strbuf_append(buf, eina_prefix_data_get(_eolian_prefix)); > eina_strbuf_append(buf, "/include"); > - ret = eolian_directory_scan(eina_strbuf_string_get(buf)); > + ret = eolian_directory_scan(state, eina_strbuf_string_get(buf)); > eina_strbuf_free(buf); > return ret; > } > @@ -773,7 +773,7 @@ _parse_deferred() > static Eolian_Unit unit_tmp; > > EAPI const Eolian_Unit * > -eolian_file_parse(const char *filepath) > +eolian_file_parse(Eolian *state EINA_UNUSED, const char *filepath) > { > if (!_eolian_file_parse_nodep(filepath)) > return NULL; > @@ -794,7 +794,7 @@ static Eina_Bool _tfile_parse(const Eina_Hash *hash > EINA_UNUSED, const void *key > } > > EAPI Eina_Bool > -eolian_all_eot_files_parse() > +eolian_all_eot_files_parse(Eolian *state EINA_UNUSED) > { > Eina_Bool ret = EINA_TRUE; > > @@ -819,7 +819,7 @@ static Eina_Bool _file_parse(const Eina_Hash *hash > EINA_UNUSED, const void *key > } > > EAPI Eina_Bool > -eolian_all_eo_files_parse() > +eolian_all_eo_files_parse(Eolian *state EINA_UNUSED) > { > Eina_Bool ret = EINA_TRUE; > > @@ -836,28 +836,28 @@ eolian_all_eo_files_parse() > } > > EAPI Eina_Iterator * > -eolian_all_eot_files_get(void) > +eolian_all_eot_files_get(Eolian *state EINA_UNUSED) > { > if (!_tfilenames) return NULL; > return eina_hash_iterator_key_new(_tfilenames); > } > > EAPI Eina_Iterator * > -eolian_all_eo_files_get(void) > +eolian_all_eo_files_get(Eolian *state EINA_UNUSED) > { > if (!_filenames) return NULL; > return eina_hash_iterator_key_new(_filenames); > } > > EAPI Eina_Iterator * > -eolian_all_eot_file_paths_get(void) > +eolian_all_eot_file_paths_get(Eolian *state EINA_UNUSED) > { > if (!_tfilenames) return NULL; > return eina_hash_iterator_data_new(_tfilenames); > } > > EAPI Eina_Iterator * > -eolian_all_eo_file_paths_get(void) > +eolian_all_eo_file_paths_get(Eolian *state EINA_UNUSED) > { > if (!_filenames) return NULL; > return eina_hash_iterator_data_new(_filenames); > diff --git a/src/scripts/elua/modules/lualian.lua > b/src/scripts/elua/modules/lualian.lua > index 035c24db96..3864bd1d02 100644 > --- a/src/scripts/elua/modules/lualian.lua > +++ b/src/scripts/elua/modules/lualian.lua > @@ -16,6 +16,14 @@ local obj_scope = eolian.object_scope > local param_dir = eolian.parameter_dir > > local gen_unit > +local gen_state > + > +local get_state = function() > + if not gen_state then > + gen_state = eolian.new() > + end > + return assert(gen_state, "could not create eolian state") > +end > > cutil.init_module(function() > dom = log.Domain("lualian") > @@ -683,21 +691,21 @@ local gen_class = function(klass) > end > > M.include_dir = function(dir) > - if not eolian.directory_scan(dir) then > + if not get_state():directory_scan(dir) then > error("Failed including directory: " .. dir) > end > end > > M.load_eot_files = function() > - return eolian.all_eot_files_parse() > + return get_state():all_eot_files_parse() > end > > M.system_directory_scan = function() > - return eolian.system_directory_scan() > + return get_state():system_directory_scan() > end > > M.generate = function(fname, fstream) > - local unit = eolian.file_parse(fname) > + local unit = get_state():file_parse(fname) > if unit == nil then > error("Failed parsing file: " .. fname) > end > diff --git a/src/tests/eolian/eolian_parsing.c b/src/tests/eolian/eolian_ > parsing.c > index ce18e4e137..788ca774c3 100644 > --- a/src/tests/eolian/eolian_parsing.c > +++ b/src/tests/eolian/eolian_parsing.c > @@ -23,9 +23,10 @@ START_TEST(eolian_namespaces) > void *dummy; > > eolian_init(); > + Eolian *eos = eolian_new(); > /* Parsing */ > - fail_if(!eolian_directory_scan(PACKAGE_DATA_DIR"/data")); > - fail_if(!(unit = eolian_file_parse(PACKAGE_ > DATA_DIR"/data/nmsp1_class1.eo"))); > + fail_if(!eolian_directory_scan(eos, PACKAGE_DATA_DIR"/data")); > + fail_if(!(unit = eolian_file_parse(eos, PACKAGE_DATA_DIR"/data/nmsp1_ > class1.eo"))); > > /* Classes existence */ > fail_if(!(class11 = eolian_class_get_by_name(unit, "nmsp1.class1"))); > @@ -89,6 +90,7 @@ START_TEST(eolian_namespaces) > fail_if(eina_iterator_next(iter, &dummy)); > eina_iterator_free(iter); > > + eolian_free(eos); > eolian_shutdown(); > } > END_TEST > @@ -104,8 +106,10 @@ START_TEST(eolian_events) > void *dummy; > > eolian_init(); > + Eolian *eos = eolian_new(); > /* Parsing */ > - fail_if(!(unit = eolian_file_parse(PACKAGE_ > DATA_DIR"/data/events.eo"))); > + fail_if(!eolian_directory_scan(eos, PACKAGE_DATA_DIR"/data")); > + fail_if(!(unit = eolian_file_parse(eos, PACKAGE_DATA_DIR"/data/events. > eo"))); > > /* Class */ > fail_if(!(class = eolian_class_get_by_name(unit, "Events"))); > @@ -162,6 +166,7 @@ START_TEST(eolian_events) > fail_if(!eolian_class_event_get_by_name(class, "clicked,double")); > fail_if(eolian_class_event_get_by_name(class, "clicked,triple")); > > + eolian_free(eos); > eolian_shutdown(); > } > END_TEST > @@ -176,9 +181,10 @@ START_TEST(eolian_override) > const Eolian_Unit *unit; > > eolian_init(); > + Eolian *eos = eolian_new(); > /* Parsing */ > - fail_if(!eolian_directory_scan(PACKAGE_DATA_DIR"/data")); > - fail_if(!(unit = eolian_file_parse(PACKAGE_ > DATA_DIR"/data/override.eo"))); > + fail_if(!eolian_directory_scan(eos, PACKAGE_DATA_DIR"/data")); > + fail_if(!(unit = eolian_file_parse(eos, PACKAGE_DATA_DIR"/data/ > override.eo"))); > > /* Class */ > fail_if(!(class = eolian_class_get_by_name(unit, "Override"))); > @@ -220,6 +226,7 @@ START_TEST(eolian_override) > > eina_iterator_free(iter); > > + eolian_free(eos); > eolian_shutdown(); > } > END_TEST > @@ -231,14 +238,17 @@ START_TEST(eolian_consts) > const Eolian_Unit *unit; > > eolian_init(); > + Eolian *eos = eolian_new(); > /* Parsing */ > - fail_if(!(unit = eolian_file_parse(PACKAGE_ > DATA_DIR"/data/consts.eo"))); > + fail_if(!eolian_directory_scan(eos, PACKAGE_DATA_DIR"/data")); > + fail_if(!(unit = eolian_file_parse(eos, PACKAGE_DATA_DIR"/data/consts. > eo"))); > fail_if(!(class = eolian_class_get_by_name(unit, "Consts"))); > > /* Method */ > fail_if(!(fid = eolian_class_function_get_by_name(class, "foo", > EOLIAN_METHOD))); > fail_if(EINA_FALSE == eolian_function_object_is_const(fid)); > > + eolian_free(eos); > eolian_shutdown(); > } > END_TEST > @@ -255,9 +265,10 @@ START_TEST(eolian_ctor_dtor) > void *dummy; > > eolian_init(); > + Eolian *eos = eolian_new(); > /* Parsing */ > - fail_if(!eolian_directory_scan(PACKAGE_DATA_DIR"/data")); > - fail_if(!(unit = eolian_file_parse(PACKAGE_ > DATA_DIR"/data/ctor_dtor.eo"))); > + fail_if(!eolian_directory_scan(eos, PACKAGE_DATA_DIR"/data")); > + fail_if(!(unit = eolian_file_parse(eos, PACKAGE_DATA_DIR"/data/ctor_ > dtor.eo"))); > fail_if(!(class = eolian_class_get_by_name(unit, "Ctor_Dtor"))); > fail_if(!(base = eolian_class_get_by_name(unit, "Base"))); > > @@ -307,6 +318,7 @@ START_TEST(eolian_ctor_dtor) > fail_if(eina_iterator_next(iter, &dummy)); > eina_iterator_free(iter); > > + eolian_free(eos); > eolian_shutdown(); > } > END_TEST > @@ -322,8 +334,10 @@ START_TEST(eolian_typedef) > const char *file; > > eolian_init(); > + Eolian *eos = eolian_new(); > /* Parsing */ > - fail_if(!(unit = eolian_file_parse(PACKAGE_ > DATA_DIR"/data/typedef.eo"))); > + fail_if(!eolian_directory_scan(eos, PACKAGE_DATA_DIR"/data")); > + fail_if(!(unit = eolian_file_parse(eos, PACKAGE_DATA_DIR"/data/ > typedef.eo"))); > > /* Check that the class Dummy is still readable */ > fail_if(!(class = eolian_class_get_by_name(unit, "Typedef"))); > @@ -388,6 +402,7 @@ START_TEST(eolian_typedef) > fail_if(!eina_iterator_next(iter, (void**)&tdl)); > fail_if(eina_iterator_next(iter, (void**)&tdl)); > > + eolian_free(eos); > eolian_shutdown(); > } > END_TEST > @@ -404,8 +419,10 @@ START_TEST(eolian_complex_type) > void *dummy; > > eolian_init(); > + Eolian *eos = eolian_new(); > /* Parsing */ > - fail_if(!(unit = eolian_file_parse(PACKAGE_ > DATA_DIR"/data/complex_type.eo"))); > + fail_if(!eolian_directory_scan(eos, PACKAGE_DATA_DIR"/data")); > + fail_if(!(unit = eolian_file_parse(eos, PACKAGE_DATA_DIR"/data/ > complex_type.eo"))); > fail_if(!(class = eolian_class_get_by_name(unit, "Complex_Type"))); > > /* Properties return type */ > @@ -474,6 +491,7 @@ START_TEST(eolian_complex_type) > fail_if(strcmp(type_name, "char *")); > eina_stringshare_del(type_name); > > + eolian_free(eos); > eolian_shutdown(); > } > END_TEST > @@ -485,8 +503,10 @@ START_TEST(eolian_scope) > const Eolian_Unit *unit; > > eolian_init(); > + Eolian *eos = eolian_new(); > /* Parsing */ > - fail_if(!(unit = eolian_file_parse(PACKAGE_ > DATA_DIR"/data/scope.eo"))); > + fail_if(!eolian_directory_scan(eos, PACKAGE_DATA_DIR"/data")); > + fail_if(!(unit = eolian_file_parse(eos, PACKAGE_DATA_DIR"/data/scope. > eo"))); > fail_if(!(class = eolian_class_get_by_name(unit, "Scope"))); > > /* Property scope */ > @@ -507,6 +527,7 @@ START_TEST(eolian_scope) > fail_if(!(fid = eolian_class_function_get_by_name(class, "foobar", > EOLIAN_METHOD))); > fail_if(eolian_function_scope_get(fid, EOLIAN_METHOD) != > EOLIAN_SCOPE_PUBLIC); > > + eolian_free(eos); > eolian_shutdown(); > } > END_TEST > @@ -525,8 +546,10 @@ START_TEST(eolian_simple_parsing) > void *dummy; > > eolian_init(); > + Eolian *eos = eolian_new(); > /* Parsing */ > - fail_if(!(unit = eolian_file_parse(PACKAGE_ > DATA_DIR"/data/class_simple.eo"))); > + fail_if(!eolian_directory_scan(eos, PACKAGE_DATA_DIR"/data")); > + fail_if(!(unit = eolian_file_parse(eos, PACKAGE_DATA_DIR"/data/class_ > simple.eo"))); > fail_if(!(class = eolian_class_get_by_name(unit, "Class_Simple"))); > fail_if(eolian_class_get_by_file(unit, "class_simple.eo") != class); > fail_if(strcmp(eolian_class_file_get(class), "class_simple.eo")); > @@ -643,6 +666,7 @@ START_TEST(eolian_simple_parsing) > fail_if(eolian_function_is_beta(fid)); > fail_if(!eolian_type_is_ptr(eolian_function_return_type_get(fid, > EOLIAN_METHOD))); > > + eolian_free(eos); > eolian_shutdown(); > } > END_TEST > @@ -659,9 +683,11 @@ START_TEST(eolian_struct) > const char *file; > > eolian_init(); > + Eolian *eos = eolian_new(); > > /* Parsing */ > - fail_if(!(unit = eolian_file_parse(PACKAGE_ > DATA_DIR"/data/struct.eo"))); > + fail_if(!eolian_directory_scan(eos, PACKAGE_DATA_DIR"/data")); > + fail_if(!(unit = eolian_file_parse(eos, PACKAGE_DATA_DIR"/data/struct. > eo"))); > > /* Check that the class Dummy is still readable */ > fail_if(!(class = eolian_class_get_by_name(unit, "Struct"))); > @@ -713,6 +739,7 @@ START_TEST(eolian_struct) > fail_if(!(tdl = eolian_type_typedecl_get(type))); > fail_if(eolian_typedecl_type_get(tdl) != EOLIAN_TYPEDECL_STRUCT); > > + eolian_free(eos); > eolian_shutdown(); > } > END_TEST > @@ -724,9 +751,11 @@ START_TEST(eolian_extern) > const Eolian_Unit *unit; > > eolian_init(); > + Eolian *eos = eolian_new(); > > /* Parsing */ > - fail_if(!(unit = eolian_file_parse(PACKAGE_ > DATA_DIR"/data/extern.eo"))); > + fail_if(!eolian_directory_scan(eos, PACKAGE_DATA_DIR"/data")); > + fail_if(!(unit = eolian_file_parse(eos, PACKAGE_DATA_DIR"/data/extern. > eo"))); > > /* Check that the class Dummy is still readable */ > fail_if(!(class = eolian_class_get_by_name(unit, "Extern"))); > @@ -748,6 +777,7 @@ START_TEST(eolian_extern) > fail_if(!(tdl = eolian_typedecl_struct_get_by_name(unit, "Y"))); > fail_if(!eolian_typedecl_is_extern(tdl)); > > + eolian_free(eos); > eolian_shutdown(); > } > END_TEST > @@ -763,9 +793,11 @@ START_TEST(eolian_var) > const char *name; > > eolian_init(); > + Eolian *eos = eolian_new(); > > /* Parsing */ > - fail_if(!(unit = eolian_file_parse(PACKAGE_DATA_DIR"/data/var.eo"))); > + fail_if(!eolian_directory_scan(eos, PACKAGE_DATA_DIR"/data")); > + fail_if(!(unit = eolian_file_parse(eos, PACKAGE_DATA_DIR"/data/var.eo" > ))); > > /* Check that the class Dummy is still readable */ > fail_if(!(class = eolian_class_get_by_name(unit, "Var"))); > @@ -813,6 +845,7 @@ START_TEST(eolian_var) > fail_if(strcmp(name, "double")); > fail_if(eolian_variable_value_get(var)); > > + eolian_free(eos); > eolian_shutdown(); > } > END_TEST > @@ -831,9 +864,11 @@ START_TEST(eolian_enum) > Eolian_Value v; > > eolian_init(); > + Eolian *eos = eolian_new(); > > /* Parsing */ > - fail_if(!(unit = eolian_file_parse(PACKAGE_DATA_DIR"/data/enum.eo"))); > + fail_if(!eolian_directory_scan(eos, PACKAGE_DATA_DIR"/data")); > + fail_if(!(unit = eolian_file_parse(eos, PACKAGE_DATA_DIR"/data/enum. > eo"))); > > /* Check that the class Dummy is still readable */ > fail_if(!(class = eolian_class_get_by_name(unit, "Enum"))); > @@ -914,6 +949,7 @@ START_TEST(eolian_enum) > fail_if(v.type != EOLIAN_EXPR_INT); > fail_if(v.value.i != 5); > > + eolian_free(eos); > eolian_shutdown(); > } > END_TEST > @@ -925,8 +961,10 @@ START_TEST(eolian_class_funcs) > const Eolian_Unit *unit; > > eolian_init(); > + Eolian *eos = eolian_new(); > /* Parsing */ > - fail_if(!(unit = eolian_file_parse(PACKAGE_ > DATA_DIR"/data/class_funcs.eo"))); > + fail_if(!eolian_directory_scan(eos, PACKAGE_DATA_DIR"/data")); > + fail_if(!(unit = eolian_file_parse(eos, PACKAGE_DATA_DIR"/data/class_ > funcs.eo"))); > fail_if(!(class = eolian_class_get_by_name(unit, "Class_Funcs"))); > > /* Class properties */ > @@ -950,6 +988,7 @@ START_TEST(eolian_class_funcs) > fail_if(eolian_function_is_class(fid)); > fail_if(eolian_function_scope_get(fid, EOLIAN_METHOD) != > EOLIAN_SCOPE_PROTECTED); > > + eolian_free(eos); > eolian_shutdown(); > } > END_TEST > @@ -962,9 +1001,11 @@ START_TEST(eolian_free_func) > const Eolian_Unit *unit; > > eolian_init(); > + Eolian *eos = eolian_new(); > > /* Parsing */ > - fail_if(!(unit = eolian_file_parse(PACKAGE_ > DATA_DIR"/data/free_func.eo"))); > + fail_if(!eolian_directory_scan(eos, PACKAGE_DATA_DIR"/data")); > + fail_if(!(unit = eolian_file_parse(eos, PACKAGE_DATA_DIR"/data/free_ > func.eo"))); > > /* Check that the class Dummy is still readable */ > fail_if(!(class = eolian_class_get_by_name(unit, "Free_Func"))); > @@ -996,6 +1037,7 @@ START_TEST(eolian_free_func) > fail_if(!(type = eolian_typedecl_base_type_get(tdl))); > fail_if(strcmp(eolian_type_free_func_get(type), "ptr_free")); > > + eolian_free(eos); > eolian_shutdown(); > } > END_TEST > @@ -1009,9 +1051,11 @@ START_TEST(eolian_null) > Eina_Iterator *iter; > > eolian_init(); > + Eolian *eos = eolian_new(); > > /* Parsing */ > - fail_if(!(unit = eolian_file_parse(PACKAGE_DATA_DIR"/data/null.eo"))); > + fail_if(!eolian_directory_scan(eos, PACKAGE_DATA_DIR"/data")); > + fail_if(!(unit = eolian_file_parse(eos, PACKAGE_DATA_DIR"/data/null. > eo"))); > > fail_if(!(class = eolian_class_get_by_name(unit, "Null"))); > fail_if(!(func = eolian_class_function_get_by_name(class, "foo", > EOLIAN_METHOD))); > @@ -1045,6 +1089,7 @@ START_TEST(eolian_null) > fail_if(eina_iterator_next(iter, (void**)¶m)); > eina_iterator_free(iter); > > + eolian_free(eos); > eolian_shutdown(); > } > END_TEST > @@ -1056,10 +1101,11 @@ START_TEST(eolian_import) > const Eolian_Unit *unit; > > eolian_init(); > + Eolian *eos = eolian_new(); > > - fail_if(!eolian_directory_scan(PACKAGE_DATA_DIR"/data")); > + fail_if(!eolian_directory_scan(eos, PACKAGE_DATA_DIR"/data")); > > - fail_if(!(unit = eolian_file_parse(PACKAGE_ > DATA_DIR"/data/import.eo"))); > + fail_if(!(unit = eolian_file_parse(eos, PACKAGE_DATA_DIR"/data/import. > eo"))); > fail_if(!(class = eolian_class_get_by_name(unit, "Import"))); > > fail_if(!(tdl = eolian_typedecl_alias_get_by_name(unit, "Imported"))); > @@ -1068,6 +1114,7 @@ START_TEST(eolian_import) > fail_if(!(tdl = eolian_typedecl_struct_get_by_name(unit, > "Imported_Struct"))); > fail_if(strcmp(eolian_typedecl_file_get(tdl), "import_types.eot")); > > + eolian_free(eos); > eolian_shutdown(); > } > END_TEST > @@ -1082,10 +1129,11 @@ START_TEST(eolian_decl) > Eina_Iterator *itr; > > eolian_init(); > + Eolian *eos = eolian_new(); > > - fail_if(!eolian_directory_scan(PACKAGE_DATA_DIR"/data")); > + fail_if(!eolian_directory_scan(eos, PACKAGE_DATA_DIR"/data")); > > - fail_if(!(unit = eolian_file_parse(PACKAGE_DATA_DIR"/data/decl.eo"))); > + fail_if(!(unit = eolian_file_parse(eos, PACKAGE_DATA_DIR"/data/decl. > eo"))); > fail_if(!(class = eolian_class_get_by_name(unit, "Decl"))); > > fail_if(!(itr = eolian_declarations_get_by_file("decl.eo"))); > @@ -1130,6 +1178,7 @@ START_TEST(eolian_decl) > fail_if(!(decl = eolian_declaration_get_by_name("A"))); > fail_if(eolian_declaration_type_get(decl) != EOLIAN_DECL_STRUCT); > > + eolian_free(eos); > eolian_shutdown(); > } > END_TEST > @@ -1149,10 +1198,11 @@ START_TEST(eolian_docs) > Eina_Iterator *itr; > > eolian_init(); > + Eolian *eos = eolian_new(); > > - fail_if(!eolian_directory_scan(PACKAGE_DATA_DIR"/data")); > + fail_if(!eolian_directory_scan(eos, PACKAGE_DATA_DIR"/data")); > > - fail_if(!(unit = eolian_file_parse(PACKAGE_DATA_DIR"/data/docs.eo"))); > + fail_if(!(unit = eolian_file_parse(eos, PACKAGE_DATA_DIR"/data/docs. > eo"))); > > fail_if(!(tdl = eolian_typedecl_struct_get_by_name(unit, "Foo"))); > fail_if(!(doc = eolian_typedecl_documentation_get(tdl))); > @@ -1374,6 +1424,7 @@ START_TEST(eolian_docs) > "Event docs.")); > fail_if(eolian_documentation_description_get(doc)); > > + eolian_free(eos); > eolian_shutdown(); > } > END_TEST > @@ -1391,11 +1442,12 @@ START_TEST(eolian_function_types) > void *dummy; > > eolian_init(); > + Eolian *eos = eolian_new(); > > - fail_if(!eolian_directory_scan(PACKAGE_DATA_DIR"/data")); > + fail_if(!eolian_directory_scan(eos, PACKAGE_DATA_DIR"/data")); > > /* Parsing */ > - fail_if(!(unit = eolian_file_parse(PACKAGE_ > DATA_DIR"/data/function_types.eot"))); > + fail_if(!(unit = eolian_file_parse(eos, PACKAGE_DATA_DIR"/data/ > function_types.eot"))); > > /* void func(void); */ > fail_if(!(decl = eolian_typedecl_alias_get_by_name(unit, > "VoidFunc"))); > @@ -1500,6 +1552,7 @@ START_TEST(eolian_function_types) > > fail_if(eina_iterator_next(iter, &dummy)); > > + eolian_free(eos); > eolian_shutdown(); > } > END_TEST > @@ -1517,10 +1570,11 @@ START_TEST(eolian_function_as_arguments) > void *dummy; > > eolian_init(); > + Eolian *eos = eolian_new(); > > - fail_if(!eolian_directory_scan(PACKAGE_DATA_DIR"/data")); > + fail_if(!eolian_directory_scan(eos, PACKAGE_DATA_DIR"/data")); > > - fail_if(!(unit = eolian_file_parse(PACKAGE_DATA_DIR"/data/function_as_ > argument.eo"))); > + fail_if(!(unit = eolian_file_parse(eos, PACKAGE_DATA_DIR"/data/ > function_as_argument.eo"))); > > fail_if(!(cls = eolian_class_get_by_name(unit, > "Function_As_Argument"))); > > @@ -1540,6 +1594,7 @@ START_TEST(eolian_function_as_arguments) > > fail_if(eina_iterator_next(iter, &dummy)); > > + eolian_free(eos); > eolian_shutdown(); > } > END_TEST > @@ -1557,10 +1612,11 @@ START_TEST(eolian_parts) > }; > > eolian_init(); > + Eolian *eos = eolian_new(); > > - fail_if(!eolian_directory_scan(PACKAGE_DATA_DIR"/data")); > + fail_if(!eolian_directory_scan(eos, PACKAGE_DATA_DIR"/data")); > > - fail_if(!(unit = eolian_file_parse(PACKAGE_ > DATA_DIR"/data/parts.eo"))); > + fail_if(!(unit = eolian_file_parse(eos, PACKAGE_DATA_DIR"/data/parts. > eo"))); > > fail_if(!(cls = eolian_class_get_by_name(unit, "Parts"))); > > @@ -1585,6 +1641,7 @@ START_TEST(eolian_parts) > } > eina_iterator_free(iter); > > + eolian_free(eos); > eolian_shutdown(); > } > END_TEST > > -- > > -- > Jean-Philippe André > > ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel