summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Zaoui <daniel.zaoui@samsung.com>2015-05-20 10:34:58 +0300
committerDaniel Zaoui <daniel.zaoui@samsung.com>2015-05-20 10:37:07 +0300
commite41d1f2cb4bac7a7e33b3f2d5b5abac0222498b8 (patch)
tree857b2aa0f9cd7cfa8f1a5db89c19028697b1550f
parent1b47e2e0133623d0a22342e9fbdad57b3c4fb484 (diff)
Eolian/Generator: support eot files
-rw-r--r--src/bin/eolian/main.c18
-rw-r--r--src/tests/eolian/data/import_types_ref.h17
-rw-r--r--src/tests/eolian/eolian_generation.c18
3 files changed, 51 insertions, 2 deletions
diff --git a/src/bin/eolian/main.c b/src/bin/eolian/main.c
index e45d2a7ee1..b198a234ed 100644
--- a/src/bin/eolian/main.c
+++ b/src/bin/eolian/main.c
@@ -304,6 +304,9 @@ static int gen_opt = NO_WAY_GEN;
304static int eo_needed = 0; 304static int eo_needed = 0;
305static int legacy_support = 0; 305static int legacy_support = 0;
306 306
307#define EO_SUFFIX ".eo"
308#define EOT_SUFFIX ".eot"
309
307int main(int argc, char **argv) 310int main(int argc, char **argv)
308{ 311{
309 int ret = 1; 312 int ret = 1;
@@ -311,6 +314,7 @@ int main(int argc, char **argv)
311 const char *eo_filename = NULL; 314 const char *eo_filename = NULL;
312 char *output_filename = NULL; /* if NULL, have to generate, otherwise use the name stored there */ 315 char *output_filename = NULL; /* if NULL, have to generate, otherwise use the name stored there */
313 char *eo_filename_copy = NULL, *eo_file_basename; 316 char *eo_filename_copy = NULL, *eo_file_basename;
317 Eina_Bool is_eo = EINA_FALSE;
314 318
315 eina_init(); 319 eina_init();
316 eolian_init(); 320 eolian_init();
@@ -391,7 +395,16 @@ int main(int argc, char **argv)
391 goto end; 395 goto end;
392 } 396 }
393 397
394 if (!eolian_eo_file_parse(eo_filename)) 398 is_eo = eina_str_has_suffix(eo_filename, EO_SUFFIX);
399
400 if (!is_eo && !eina_str_has_suffix(eo_filename, EOT_SUFFIX))
401 {
402 ERR("The input file %s doesn't have a correct extension (.eo/.eot).\n", eo_filename);
403 goto end;
404 }
405
406 if ((is_eo && !eolian_eo_file_parse(eo_filename)) ||
407 (!is_eo && !eolian_eot_file_parse(eo_filename)))
395 { 408 {
396 ERR("Error during parsing file %s\n", eo_filename); 409 ERR("Error during parsing file %s\n", eo_filename);
397 goto end; 410 goto end;
@@ -411,7 +424,8 @@ int main(int argc, char **argv)
411 if (class) eolian_show_class(class); 424 if (class) eolian_show_class(class);
412 } 425 }
413 426
414 if (!eo_needed && !(gen_opt == H_GEN && legacy_support)) 427 /* Only needed for .eo files */
428 if (is_eo && !eo_needed && !(gen_opt == H_GEN && legacy_support))
415 { 429 {
416 ERR("Eo flag is not specified (use --eo). Aborting eo generation.\n"); 430 ERR("Eo flag is not specified (use --eo). Aborting eo generation.\n");
417 goto end; 431 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 0000000000..9dcb3cd98d
--- /dev/null
+++ b/src/tests/eolian/data/import_types_ref.h
@@ -0,0 +1,17 @@
1#ifndef _EOLIAN_IMPORT_TYPES_H_
2#define _EOLIAN_IMPORT_TYPES_H_
3
4#ifndef _IMPORT_TYPES_EOT_TYPES
5#define _IMPORT_TYPES_EOT_TYPES
6
7typedef int Imported;
8
9typedef struct _Imported_Struct
10{
11 float foo;
12} Imported_Struct;
13
14
15#endif
16
17#endif
diff --git a/src/tests/eolian/eolian_generation.c b/src/tests/eolian/eolian_generation.c
index 40ddb74567..7c35565e8b 100644
--- a/src/tests/eolian/eolian_generation.c
+++ b/src/tests/eolian/eolian_generation.c
@@ -175,6 +175,23 @@ START_TEST(eolian_functions_descriptions)
175} 175}
176END_TEST 176END_TEST
177 177
178START_TEST(eolian_import)
179{
180 char output_filepath[PATH_MAX] = "";
181 snprintf(output_filepath, PATH_MAX, "%s/eolian_import_types.h",
182#ifdef HAVE_EVIL
183 (char *)evil_tmpdir_get()
184#else
185 "/tmp"
186#endif
187 );
188 remove(output_filepath);
189 fail_if(0 != _eolian_gen_execute(PACKAGE_DATA_DIR"/data/import_types.eot", "--gh", output_filepath));
190 fail_if(!_files_compare(PACKAGE_DATA_DIR"/data/import_types_ref.h", output_filepath));
191 remove(output_filepath);
192}
193END_TEST
194
178void eolian_generation_test(TCase *tc) 195void eolian_generation_test(TCase *tc)
179{ 196{
180 tcase_add_test(tc, eolian_types_generation); 197 tcase_add_test(tc, eolian_types_generation);
@@ -182,5 +199,6 @@ void eolian_generation_test(TCase *tc)
182 tcase_add_test(tc, eolian_override_generation); 199 tcase_add_test(tc, eolian_override_generation);
183 tcase_add_test(tc, eolian_dev_impl_code); 200 tcase_add_test(tc, eolian_dev_impl_code);
184 tcase_add_test(tc, eolian_functions_descriptions); 201 tcase_add_test(tc, eolian_functions_descriptions);
202 tcase_add_test(tc, eolian_import);
185} 203}
186 204