summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorDaniel Zaoui <daniel.zaoui@samsung.com>2014-02-18 09:01:23 +0200
committerDaniel Zaoui <daniel.zaoui@samsung.com>2014-03-03 14:09:55 +0200
commit61b180448ae41f63684958488b7a2b73c5a82ab8 (patch)
tree245bfcbe96f627e2af17ebfd0a8d12c4c2186569 /src/bin
parentb8cc668a9f7d72a7b065903981c68147e83d066b (diff)
Eolian/Generator: improve the files management.
Now, the .eo file given as parameter doesn't have to be into the given include paths.
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/eolian/main.c62
1 files changed, 30 insertions, 32 deletions
diff --git a/src/bin/eolian/main.c b/src/bin/eolian/main.c
index fc73594bc4..3a2df701e4 100644
--- a/src/bin/eolian/main.c
+++ b/src/bin/eolian/main.c
@@ -192,43 +192,33 @@ int main(int argc, char **argv)
192 case 'I': 192 case 'I':
193 { 193 {
194 printf("%s\n", optarg); 194 printf("%s\n", optarg);
195 char *dir = ecore_file_realpath(optarg); 195 const char *dir = optarg;
196 if (strlen(dir) != 0) 196 if (ecore_file_is_dir(dir))
197 { 197 {
198 if (ecore_file_is_dir(dir)) 198 Eina_List *dir_files;
199 char *file;
200 /* Get all files from directory. Not recursively!!!*/
201 dir_files = ecore_file_ls(dir);
202 EINA_LIST_FREE(dir_files, file)
199 { 203 {
200 Eina_List *dir_files; 204 char *filepath = malloc(strlen(dir) + 1 + strlen(file) + 1);
201 char *file; 205 sprintf(filepath, "%s/%s", dir, file);
202 /* Get all files from directory. Not recursively!!!*/ 206 if ((!ecore_file_is_dir(filepath)) && eina_str_has_suffix(filepath, EO_SUFFIX))
203 dir_files = ecore_file_ls(dir);
204 EINA_LIST_FREE(dir_files, file)
205 { 207 {
206 char *filepath = malloc(strlen(dir) + 1 + strlen(file) + 1); 208 /* Allocated string will be freed during deletion of "included_files" list. */
207 sprintf(filepath, "%s/%s", dir, file); 209 included_files = eina_list_append(included_files, strdup(filepath));
208 if ((!ecore_file_is_dir(filepath)) && eina_str_has_suffix(filepath, EO_SUFFIX))
209 {
210 /* Allocated string will be freed during deletion of "included_files" list. */
211 included_files = eina_list_append(included_files, strdup(filepath));
212 }
213 free(filepath);
214 free(file);
215 } 210 }
211 free(filepath);
212 free(file);
216 } 213 }
217 } 214 }
218 free(dir);
219 break; 215 break;
220 } 216 }
221 default: help = EINA_TRUE; 217 default: help = EINA_TRUE;
222 } 218 }
223 } 219 }
224 while (optind < argc) 220 while (optind < argc)
225 { 221 files4gen = eina_list_append(files4gen, argv[optind++]);
226 char *short_name = argv[optind++];
227 char *included_file;
228 EINA_LIST_FOREACH(included_files, itr, included_file)
229 if (strstr(included_file, short_name))
230 files4gen = eina_list_append(files4gen, included_file);
231 }
232 222
233 if (!included_files || help || !files4gen) 223 if (!included_files || help || !files4gen)
234 { 224 {
@@ -254,19 +244,27 @@ int main(int argc, char **argv)
254 } 244 }
255 } 245 }
256 246
257 char *fname; 247 EINA_LIST_FOREACH(files4gen, itr, filename)
248 {
249 if (!eolian_eo_file_parse(filename))
250 {
251 printf("Error during parsing file %s\n", filename);
252 goto end;
253 }
254 }
255
258 if (show) 256 if (show)
259 { 257 {
260 EINA_LIST_FOREACH(files4gen, itr, fname) 258 EINA_LIST_FOREACH(files4gen, itr, filename)
261 { 259 {
262 const char *cname = eolian_class_find_by_file(fname); 260 const char *cname = eolian_class_find_by_file(filename);
263 eolian_show(cname); 261 if (cname) eolian_show(cname);
264 } 262 }
265 } 263 }
266 264
267 if (!eo_version) 265 if (!eo_version)
268 { 266 {
269 printf("No eo version specified (use -eo1 or -eo2). Aborting eo generation.\n"); 267 printf("No eo version specified (use --eo1 or --eo2). Aborting eo generation.\n");
270 ret = 1; 268 ret = 1;
271 goto end; 269 goto end;
272 } 270 }
@@ -283,9 +281,9 @@ int main(int argc, char **argv)
283 { 281 {
284 printf("Generating source file %s\n", c_filename); 282 printf("Generating source file %s\n", c_filename);
285 const char *cname; 283 const char *cname;
286 EINA_LIST_FOREACH(files4gen, itr, fname) 284 EINA_LIST_FOREACH(files4gen, itr, filename)
287 { 285 {
288 cname = eolian_class_find_by_file(fname); 286 cname = eolian_class_find_by_file(filename);
289 _generate_c_file(c_filename, cname, (files4gen != itr)); 287 _generate_c_file(c_filename, cname, (files4gen != itr));
290 } 288 }
291 } 289 }