jackdanielz pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=e41d1f2cb4bac7a7e33b3f2d5b5abac0222498b8

commit e41d1f2cb4bac7a7e33b3f2d5b5abac0222498b8
Author: Daniel Zaoui <daniel.za...@samsung.com>
Date:   Wed May 20 10:34:58 2015 +0300

    Eolian/Generator: support eot files
---
 src/bin/eolian/main.c                    | 18 ++++++++++++++++--
 src/tests/eolian/data/import_types_ref.h | 17 +++++++++++++++++
 src/tests/eolian/eolian_generation.c     | 18 ++++++++++++++++++
 3 files changed, 51 insertions(+), 2 deletions(-)

diff --git a/src/bin/eolian/main.c b/src/bin/eolian/main.c
index e45d2a7..b198a23 100644
--- a/src/bin/eolian/main.c
+++ b/src/bin/eolian/main.c
@@ -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;
diff --git a/src/tests/eolian/data/import_types_ref.h 
b/src/tests/eolian/data/import_types_ref.h
new file mode 100644
index 0000000..9dcb3cd
--- /dev/null
+++ b/src/tests/eolian/data/import_types_ref.h
@@ -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
diff --git a/src/tests/eolian/eolian_generation.c 
b/src/tests/eolian/eolian_generation.c
index 40ddb74..7c35565 100644
--- a/src/tests/eolian/eolian_generation.c
+++ b/src/tests/eolian/eolian_generation.c
@@ -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);
 }
 

-- 


Reply via email to