Eolian/Generator: support eot files

This commit is contained in:
Daniel Zaoui 2015-05-20 10:34:58 +03:00
parent 1b47e2e013
commit e41d1f2cb4
3 changed files with 51 additions and 2 deletions

View File

@ -304,6 +304,9 @@ static int gen_opt = NO_WAY_GEN;
static int eo_needed = 0;
static int legacy_support = 0;
#define EO_SUFFIX ".eo"
#define EOT_SUFFIX ".eot"
int main(int argc, char **argv)
{
int ret = 1;
@ -311,6 +314,7 @@ int main(int argc, char **argv)
const char *eo_filename = NULL;
char *output_filename = NULL; /* if NULL, have to generate, otherwise use the name stored there */
char *eo_filename_copy = NULL, *eo_file_basename;
Eina_Bool is_eo = EINA_FALSE;
eina_init();
eolian_init();
@ -391,7 +395,16 @@ int main(int argc, char **argv)
goto end;
}
if (!eolian_eo_file_parse(eo_filename))
is_eo = eina_str_has_suffix(eo_filename, EO_SUFFIX);
if (!is_eo && !eina_str_has_suffix(eo_filename, EOT_SUFFIX))
{
ERR("The input file %s doesn't have a correct extension (.eo/.eot).\n", eo_filename);
goto end;
}
if ((is_eo && !eolian_eo_file_parse(eo_filename)) ||
(!is_eo && !eolian_eot_file_parse(eo_filename)))
{
ERR("Error during parsing file %s\n", eo_filename);
goto end;
@ -411,7 +424,8 @@ int main(int argc, char **argv)
if (class) eolian_show_class(class);
}
if (!eo_needed && !(gen_opt == H_GEN && legacy_support))
/* Only needed for .eo files */
if (is_eo && !eo_needed && !(gen_opt == H_GEN && legacy_support))
{
ERR("Eo flag is not specified (use --eo). Aborting eo generation.\n");
goto end;

View File

@ -0,0 +1,17 @@
#ifndef _EOLIAN_IMPORT_TYPES_H_
#define _EOLIAN_IMPORT_TYPES_H_
#ifndef _IMPORT_TYPES_EOT_TYPES
#define _IMPORT_TYPES_EOT_TYPES
typedef int Imported;
typedef struct _Imported_Struct
{
float foo;
} Imported_Struct;
#endif
#endif

View File

@ -175,6 +175,23 @@ START_TEST(eolian_functions_descriptions)
}
END_TEST
START_TEST(eolian_import)
{
char output_filepath[PATH_MAX] = "";
snprintf(output_filepath, PATH_MAX, "%s/eolian_import_types.h",
#ifdef HAVE_EVIL
(char *)evil_tmpdir_get()
#else
"/tmp"
#endif
);
remove(output_filepath);
fail_if(0 != _eolian_gen_execute(PACKAGE_DATA_DIR"/data/import_types.eot", "--gh", output_filepath));
fail_if(!_files_compare(PACKAGE_DATA_DIR"/data/import_types_ref.h", output_filepath));
remove(output_filepath);
}
END_TEST
void eolian_generation_test(TCase *tc)
{
tcase_add_test(tc, eolian_types_generation);
@ -182,5 +199,6 @@ void eolian_generation_test(TCase *tc)
tcase_add_test(tc, eolian_override_generation);
tcase_add_test(tc, eolian_dev_impl_code);
tcase_add_test(tc, eolian_functions_descriptions);
tcase_add_test(tc, eolian_import);
}