summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorDaniel Zaoui <daniel.zaoui@samsung.com>2014-02-13 17:12:19 +0200
committerDaniel Zaoui <daniel.zaoui@samsung.com>2014-03-03 14:09:54 +0200
commitab8d877150d00f29f51bb1cdb20613f82cfc071a (patch)
tree6a8b074f7b9674563bc5ecb2505f86c8c637f460 /src/bin
parent327202ef371814f6e61bae77d43990198edf1363 (diff)
Eolian/Generator: support legacy as option.
For the moment, the option works for C files. Have to add support for H files.
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/eolian/legacy_generator.c8
-rw-r--r--src/bin/eolian/legacy_generator.h3
-rw-r--r--src/bin/eolian/main.c8
3 files changed, 12 insertions, 7 deletions
diff --git a/src/bin/eolian/legacy_generator.c b/src/bin/eolian/legacy_generator.c
index 207772859b..099f8b4d16 100644
--- a/src/bin/eolian/legacy_generator.c
+++ b/src/bin/eolian/legacy_generator.c
@@ -397,7 +397,7 @@ legacy_header_append(const char *classname, int eo_version, Eina_Strbuf *header)
397} 397}
398 398
399Eina_Bool 399Eina_Bool
400legacy_source_generate(const char *classname, int eo_version, Eina_Strbuf *buf) 400legacy_source_generate(const char *classname, Eina_Bool legacy, int eo_version, Eina_Strbuf *buf)
401{ 401{
402 const Eina_List *itr; 402 const Eina_List *itr;
403 403
@@ -424,12 +424,12 @@ legacy_source_generate(const char *classname, int eo_version, Eina_Strbuf *buf)
424 if (prop_read) 424 if (prop_read)
425 { 425 {
426 eo1_bind_func_generate(classname, fn, GET, str_bodyf); 426 eo1_bind_func_generate(classname, fn, GET, str_bodyf);
427 _eapi_func_generate(classname, fn, GET, str_bodyf); 427 if (legacy) _eapi_func_generate(classname, fn, GET, str_bodyf);
428 } 428 }
429 if (prop_write) 429 if (prop_write)
430 { 430 {
431 eo1_bind_func_generate(classname, fn, SET, str_bodyf); 431 eo1_bind_func_generate(classname, fn, SET, str_bodyf);
432 _eapi_func_generate(classname, fn, SET, str_bodyf); 432 if (legacy) _eapi_func_generate(classname, fn, SET, str_bodyf);
433 } 433 }
434 } 434 }
435 435
@@ -437,7 +437,7 @@ legacy_source_generate(const char *classname, int eo_version, Eina_Strbuf *buf)
437 EINA_LIST_FOREACH(eolian_class_functions_list_get(classname, METHOD_FUNC), itr, fn) 437 EINA_LIST_FOREACH(eolian_class_functions_list_get(classname, METHOD_FUNC), itr, fn)
438 { 438 {
439 eo1_bind_func_generate(classname, fn, UNRESOLVED, str_bodyf); 439 eo1_bind_func_generate(classname, fn, UNRESOLVED, str_bodyf);
440 _eapi_func_generate(classname, fn, UNRESOLVED, str_bodyf); 440 if (legacy) _eapi_func_generate(classname, fn, UNRESOLVED, str_bodyf);
441 } 441 }
442 442
443 eina_strbuf_append(buf, eina_strbuf_string_get(str_bodyf)); 443 eina_strbuf_append(buf, eina_strbuf_string_get(str_bodyf));
diff --git a/src/bin/eolian/legacy_generator.h b/src/bin/eolian/legacy_generator.h
index 5f22afa811..39445f30ad 100644
--- a/src/bin/eolian/legacy_generator.h
+++ b/src/bin/eolian/legacy_generator.h
@@ -41,13 +41,14 @@ Eina_Bool legacy_header_append(const char *classname, int eo_version, Eina_Strbu
41 * code from scratch. 41 * code from scratch.
42 * 42 *
43 * @param[in] classname class name 43 * @param[in] classname class name
44 * @param[in] legacy indicates if the legacy has to be generated
44 * @param[in] eo_version Eo version to generate 45 * @param[in] eo_version Eo version to generate
45 * @param[inout] buf buffer to fill 46 * @param[inout] buf buffer to fill
46 * 47 *
47 * @return EINA_TRUE on success, EINA_FALSE on error. 48 * @return EINA_TRUE on success, EINA_FALSE on error.
48 * 49 *
49 */ 50 */
50Eina_Bool legacy_source_generate(const char *classname, int eo_version, Eina_Strbuf *buf); 51Eina_Bool legacy_source_generate(const char *classname, Eina_Bool legacy, int eo_version, Eina_Strbuf *buf);
51 52
52#endif 53#endif
53 54
diff --git a/src/bin/eolian/main.c b/src/bin/eolian/main.c
index 08d0bae989..ab74a3b246 100644
--- a/src/bin/eolian/main.c
+++ b/src/bin/eolian/main.c
@@ -10,6 +10,7 @@
10#define EO_SUFFIX ".eo" 10#define EO_SUFFIX ".eo"
11 11
12static int eo_version = 0; 12static int eo_version = 0;
13static Eina_Bool legacy_support = EINA_FALSE;
13 14
14static Eina_Bool 15static Eina_Bool
15_generate_h_file(char *filename, char *classname, Eina_Bool append) 16_generate_h_file(char *filename, char *classname, Eina_Bool append)
@@ -58,7 +59,7 @@ _generate_c_file(char *filename, char *classname, Eina_Bool append)
58 Eina_Bool ret = EINA_FALSE; 59 Eina_Bool ret = EINA_FALSE;
59 60
60 Eina_Strbuf *cfile = eina_strbuf_new(); 61 Eina_Strbuf *cfile = eina_strbuf_new();
61 legacy_source_generate(classname, eo_version, cfile); 62 legacy_source_generate(classname, legacy_support, eo_version, cfile);
62 63
63 FILE* fd = fopen(filename, (append) ? "a" : "w"); 64 FILE* fd = fopen(filename, (append) ? "a" : "w");
64 if (!fd) 65 if (!fd)
@@ -171,6 +172,7 @@ int main(int argc, char **argv)
171 {"ah", required_argument, 0, 3}, 172 {"ah", required_argument, 0, 3},
172 {"al", required_argument, 0, 4}, 173 {"al", required_argument, 0, 4},
173 {"gle", required_argument, 0, 5}, 174 {"gle", required_argument, 0, 5},
175 {"legacy", no_argument, 0, 6},
174 {"include", required_argument, 0, 'I'}, 176 {"include", required_argument, 0, 'I'},
175 {"class", required_argument, 0, 'c'}, 177 {"class", required_argument, 0, 'c'},
176 {0, 0, 0, 0} 178 {0, 0, 0, 0}
@@ -185,6 +187,7 @@ int main(int argc, char **argv)
185 case 3: h_filename = optarg; happend = EINA_TRUE; break; 187 case 3: h_filename = optarg; happend = EINA_TRUE; break;
186 case 4: leg_filename = optarg; lappend = EINA_TRUE; break; 188 case 4: leg_filename = optarg; lappend = EINA_TRUE; break;
187 case 5: eoleg_filename = optarg; break; 189 case 5: eoleg_filename = optarg; break;
190 case 6: legacy_support = EINA_TRUE; break;
188 case 'V': show = EINA_TRUE; break; 191 case 'V': show = EINA_TRUE; break;
189 case 'h': help = EINA_TRUE; break; 192 case 'h': help = EINA_TRUE; break;
190 case 'I': 193 case 'I':
@@ -225,13 +228,14 @@ int main(int argc, char **argv)
225 228
226 if (!files || help || !classname) 229 if (!files || help || !classname)
227 { 230 {
228 printf("Usage: %s [-h/--help] [-V/--verbose] [-I/--include input_dir] [--gh|--gc|--ah] filename [-c/--class] classname \n", argv[0]); 231 printf("Usage: %s [-h/--help] [-V/--verbose] [-I/--include input_dir] [--legacy] [--gh|--gc|--ah] filename [-c/--class] classname \n", argv[0]);
229 printf(" --eo1/--eo2 Set generator to eo1/eo2 mode. Must be specified\n"); 232 printf(" --eo1/--eo2 Set generator to eo1/eo2 mode. Must be specified\n");
230 printf(" --gh Generate c header file [.h] for eo class specified by classname\n"); 233 printf(" --gh Generate c header file [.h] for eo class specified by classname\n");
231 printf(" --gc Generate c source file [.c] for eo class specified by classname\n"); 234 printf(" --gc Generate c source file [.c] for eo class specified by classname\n");
232 printf(" --ah Append eo class definitions to an existing c header file [.h]\n"); 235 printf(" --ah Append eo class definitions to an existing c header file [.h]\n");
233 printf(" --al Append legacy function definitions to an existing c header file [.h]\n"); 236 printf(" --al Append legacy function definitions to an existing c header file [.h]\n");
234 printf(" --gle Generate eo and legacy file [.h]\n"); 237 printf(" --gle Generate eo and legacy file [.h]\n");
238 printf(" --legacy Generate legacy\n");
235 return 0; 239 return 0;
236 } 240 }
237 241