summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Zaoui <daniel.zaoui@samsung.com>2014-04-23 08:55:15 +0300
committerDaniel Zaoui <daniel.zaoui@samsung.com>2014-04-23 08:55:15 +0300
commit5ea1ffac5b0f6c7915c4781e60f745290721143e (patch)
treea223fbede803f2f3658322a10192f895832f2393
parent9122f603f9ea368f1ac197f20d1c0703c2d6df01 (diff)
Eolian/Generator: support --eo.
--eo1 is still supported but it will be removed soon.
-rw-r--r--src/Makefile_Eolian_Helper.am4
-rw-r--r--src/bin/eolian/eo1_generator.c2
-rw-r--r--src/bin/eolian/eo1_generator.h3
-rw-r--r--src/bin/eolian/legacy_generator.c4
-rw-r--r--src/bin/eolian/legacy_generator.h6
-rw-r--r--src/bin/eolian/main.c25
6 files changed, 20 insertions, 24 deletions
diff --git a/src/Makefile_Eolian_Helper.am b/src/Makefile_Eolian_Helper.am
index 8d78ff0..fed2e66 100644
--- a/src/Makefile_Eolian_Helper.am
+++ b/src/Makefile_Eolian_Helper.am
@@ -13,10 +13,10 @@ am__v_EOL_0 = @echo " EOLIAN " $@;
13SUFFIXES = .eo .eo.c .eo.h .eo.legacy.h 13SUFFIXES = .eo .eo.c .eo.h .eo.legacy.h
14 14
15%.eo.c: %.eo ${_EOLIAN_GEN_DEP} 15%.eo.c: %.eo ${_EOLIAN_GEN_DEP}
16 $(AM_V_EOL)$(EOLIAN_GEN) --eo1 --legacy $(EOLIAN_FLAGS) --gc -o $@ $< 16 $(AM_V_EOL)$(EOLIAN_GEN) --eo --legacy $(EOLIAN_FLAGS) --gc -o $@ $<
17 17
18%.eo.h: %.eo ${_EOLIAN_GEN_DEP} 18%.eo.h: %.eo ${_EOLIAN_GEN_DEP}
19 $(AM_V_EOL)$(EOLIAN_GEN) --eo1 $(EOLIAN_FLAGS) --gh -o $@ $< 19 $(AM_V_EOL)$(EOLIAN_GEN) --eo $(EOLIAN_FLAGS) --gh -o $@ $<
20 20
21%.eo.legacy.h: %.eo ${_EOLIAN_GEN_DEP} 21%.eo.legacy.h: %.eo ${_EOLIAN_GEN_DEP}
22 $(AM_V_EOL)$(EOLIAN_GEN) --legacy $(EOLIAN_FLAGS) --gh -o $@ $< 22 $(AM_V_EOL)$(EOLIAN_GEN) --legacy $(EOLIAN_FLAGS) --gh -o $@ $<
diff --git a/src/bin/eolian/eo1_generator.c b/src/bin/eolian/eo1_generator.c
index 43e06ca..1eac03a 100644
--- a/src/bin/eolian/eo1_generator.c
+++ b/src/bin/eolian/eo1_generator.c
@@ -876,7 +876,7 @@ end:
876} 876}
877 877
878Eina_Bool 878Eina_Bool
879eo_source_generate(const char *classname, int eo_version EINA_UNUSED, Eina_Strbuf *buf) 879eo_source_generate(const char *classname, Eina_Strbuf *buf)
880{ 880{
881 Eina_Bool ret = EINA_FALSE; 881 Eina_Bool ret = EINA_FALSE;
882 const Eina_List *itr; 882 const Eina_List *itr;
diff --git a/src/bin/eolian/eo1_generator.h b/src/bin/eolian/eo1_generator.h
index 959d092..7bab054 100644
--- a/src/bin/eolian/eo1_generator.h
+++ b/src/bin/eolian/eo1_generator.h
@@ -9,14 +9,13 @@
9 * This function generates all the source code for Eo. 9 * This function generates all the source code for Eo.
10 * 10 *
11 * @param[in] classname class name 11 * @param[in] classname class name
12 * @param[in] eo_version Eo version to generate
13 * @param[inout] buf buffer to fill 12 * @param[inout] buf buffer to fill
14 * 13 *
15 * @return EINA_TRUE on success, EINA_FALSE on error. 14 * @return EINA_TRUE on success, EINA_FALSE on error.
16 * 15 *
17 */ 16 */
18Eina_Bool 17Eina_Bool
19eo_source_generate(const char *classname, int eo_version, Eina_Strbuf *buf); 18eo_source_generate(const char *classname, Eina_Strbuf *buf);
20 19
21/* 20/*
22 * @brief Generate the header code for a specific Eo class. 21 * @brief Generate the header code for a specific Eo class.
diff --git a/src/bin/eolian/legacy_generator.c b/src/bin/eolian/legacy_generator.c
index 36d2158..e0bbc93 100644
--- a/src/bin/eolian/legacy_generator.c
+++ b/src/bin/eolian/legacy_generator.c
@@ -344,7 +344,7 @@ end:
344} 344}
345 345
346Eina_Bool 346Eina_Bool
347legacy_header_generate(const char *classname, int eo_version EINA_UNUSED, Eina_Strbuf *buf) 347legacy_header_generate(const char *classname, Eina_Strbuf *buf)
348{ 348{
349 const Eolian_Function_Type ftype_order[] = {EOLIAN_PROPERTY, EOLIAN_METHOD}; 349 const Eolian_Function_Type ftype_order[] = {EOLIAN_PROPERTY, EOLIAN_METHOD};
350 const Eina_List *l; 350 const Eina_List *l;
@@ -381,7 +381,7 @@ legacy_header_generate(const char *classname, int eo_version EINA_UNUSED, Eina_S
381} 381}
382 382
383Eina_Bool 383Eina_Bool
384legacy_source_generate(const char *classname, int eo_version EINA_UNUSED, Eina_Strbuf *buf) 384legacy_source_generate(const char *classname, Eina_Strbuf *buf)
385{ 385{
386 Eina_Bool ret = EINA_FALSE; 386 Eina_Bool ret = EINA_FALSE;
387 const Eina_List *itr; 387 const Eina_List *itr;
diff --git a/src/bin/eolian/legacy_generator.h b/src/bin/eolian/legacy_generator.h
index 6a3964f..cf7faa9 100644
--- a/src/bin/eolian/legacy_generator.h
+++ b/src/bin/eolian/legacy_generator.h
@@ -11,13 +11,12 @@
11 * There will not be respect of the order of the Eo Op Ids. 11 * There will not be respect of the order of the Eo Op Ids.
12 * 12 *
13 * @param[in] classname class name 13 * @param[in] classname class name
14 * @param[in] eo_version Eo version to generate
15 * @param[inout] buf buffer to fill 14 * @param[inout] buf buffer to fill
16 * 15 *
17 * @return EINA_TRUE on success, EINA_FALSE on error. 16 * @return EINA_TRUE on success, EINA_FALSE on error.
18 * 17 *
19 */ 18 */
20Eina_Bool legacy_header_generate(const char *classname, int eo_version, Eina_Strbuf *buf); 19Eina_Bool legacy_header_generate(const char *classname, Eina_Strbuf *buf);
21 20
22/* 21/*
23 * @brief Generate C source code for Eo class 22 * @brief Generate C source code for Eo class
@@ -26,13 +25,12 @@ Eina_Bool legacy_header_generate(const char *classname, int eo_version, Eina_Str
26 * code from scratch. 25 * code from scratch.
27 * 26 *
28 * @param[in] classname class name 27 * @param[in] classname class name
29 * @param[in] eo_version Eo version to generate
30 * @param[inout] buf buffer to fill 28 * @param[inout] buf buffer to fill
31 * 29 *
32 * @return EINA_TRUE on success, EINA_FALSE on error. 30 * @return EINA_TRUE on success, EINA_FALSE on error.
33 * 31 *
34 */ 32 */
35Eina_Bool legacy_source_generate(const char *classname, int eo_version, Eina_Strbuf *buf); 33Eina_Bool legacy_source_generate(const char *classname, Eina_Strbuf *buf);
36 34
37#endif 35#endif
38 36
diff --git a/src/bin/eolian/main.c b/src/bin/eolian/main.c
index bee857e..07746cf 100644
--- a/src/bin/eolian/main.c
+++ b/src/bin/eolian/main.c
@@ -9,9 +9,6 @@
9 9
10#define EO_SUFFIX ".eo" 10#define EO_SUFFIX ".eo"
11 11
12static int eo_version = 0;
13static Eina_Bool legacy_support = EINA_FALSE;
14
15static char* 12static char*
16_include_guard_enclose(const char *fname, const char *fbody) 13_include_guard_enclose(const char *fname, const char *fbody)
17{ 14{
@@ -82,21 +79,21 @@ end:
82} 79}
83 80
84static Eina_Bool 81static Eina_Bool
85_generate_c_file(char *filename, const char *classname) 82_generate_c_file(char *filename, const char *classname, Eina_Bool legacy_support)
86{ 83{
87 Eina_Bool ret = EINA_FALSE; 84 Eina_Bool ret = EINA_FALSE;
88 85
89 Eina_Strbuf *eo_buf = eina_strbuf_new(); 86 Eina_Strbuf *eo_buf = eina_strbuf_new();
90 Eina_Strbuf *legacy_buf = eina_strbuf_new(); 87 Eina_Strbuf *legacy_buf = eina_strbuf_new();
91 88
92 if (!eo_source_generate(classname, eo_version, eo_buf)) 89 if (!eo_source_generate(classname, eo_buf))
93 { 90 {
94 ERR("Failed to generate source for %s", classname); 91 ERR("Failed to generate source for %s", classname);
95 goto end; 92 goto end;
96 } 93 }
97 94
98 if (legacy_support) 95 if (legacy_support)
99 if (!legacy_source_generate(classname, eo_version, legacy_buf)) 96 if (!legacy_source_generate(classname, legacy_buf))
100 { 97 {
101 ERR("Failed to generate source for %s", classname); 98 ERR("Failed to generate source for %s", classname);
102 goto end; 99 goto end;
@@ -131,7 +128,7 @@ _generate_legacy_header_file(char *filename, const char *classname)
131 128
132 Eina_Strbuf *lfile = eina_strbuf_new(); 129 Eina_Strbuf *lfile = eina_strbuf_new();
133 130
134 if (!legacy_header_generate(classname, eo_version, lfile)) 131 if (!legacy_header_generate(classname, lfile))
135 { 132 {
136 ERR("Failed to generate header for %s", classname); 133 ERR("Failed to generate header for %s", classname);
137 goto end; 134 goto end;
@@ -167,7 +164,9 @@ enum
167 H_GEN, 164 H_GEN,
168 C_GEN 165 C_GEN
169}; 166};
170int gen_opt = NO_WAY_GEN; 167static int gen_opt = NO_WAY_GEN;
168static int eo_needed = 0;
169static Eina_Bool legacy_support = EINA_FALSE;
171 170
172int main(int argc, char **argv) 171int main(int argc, char **argv)
173{ 172{
@@ -196,8 +195,8 @@ int main(int argc, char **argv)
196 static struct option long_options[] = 195 static struct option long_options[] =
197 { 196 {
198 /* These options set a flag. */ 197 /* These options set a flag. */
199 {"eo1", no_argument, &eo_version, 1}, 198 {"eo1", no_argument, &eo_needed, 1},
200 {"eo", no_argument, &eo_version, 2}, 199 {"eo", no_argument, &eo_needed, 1},
201 {"verbose", no_argument, 0, 'v'}, 200 {"verbose", no_argument, 0, 'v'},
202 {"help", no_argument, 0, 'h'}, 201 {"help", no_argument, 0, 'h'},
203 {"gh", no_argument, &gen_opt, H_GEN}, 202 {"gh", no_argument, &gen_opt, H_GEN},
@@ -293,9 +292,9 @@ int main(int argc, char **argv)
293 } 292 }
294 } 293 }
295 294
296 if (!eo_version && !(gen_opt==H_GEN && legacy_support)) 295 if (!eo_needed && !(gen_opt == H_GEN && legacy_support))
297 { 296 {
298 ERR("No eo version specified (use --eo). Aborting eo generation.\n"); 297 ERR("Eo flag is not specified (use --eo). Aborting eo generation.\n");
299 goto end; 298 goto end;
300 } 299 }
301 300
@@ -324,7 +323,7 @@ int main(int argc, char **argv)
324 case C_GEN: 323 case C_GEN:
325 { 324 {
326 INF("Generating source file %s\n", output_filename); 325 INF("Generating source file %s\n", output_filename);
327 ret = _generate_c_file(output_filename, classname)?0:1; 326 ret = _generate_c_file(output_filename, classname, legacy_support)?0:1;
328 break; 327 break;
329 } 328 }
330 default: 329 default: