summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2015-05-29 14:57:14 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2015-05-29 14:57:32 +0100
commit98497f84069cdfc432fa43d13caeb2a80a6dbdff (patch)
tree332584f059bb417380dc42f19fdbc362e57a9142 /src/bin
parentedd361b420adc46f206b11f72dc6965da1633098 (diff)
eolian: use fprintf(stderr) instead of logging where it makes sense
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/eolian/eo_generator.c15
-rw-r--r--src/bin/eolian/impl_generator.c4
-rw-r--r--src/bin/eolian/main.c44
3 files changed, 33 insertions, 30 deletions
diff --git a/src/bin/eolian/eo_generator.c b/src/bin/eolian/eo_generator.c
index 800d1cea50..6f86a3cd32 100644
--- a/src/bin/eolian/eo_generator.c
+++ b/src/bin/eolian/eo_generator.c
@@ -4,6 +4,7 @@
4 4
5#include <Eina.h> 5#include <Eina.h>
6#include <string.h> 6#include <string.h>
7#include <assert.h>
7 8
8#include "Eolian.h" 9#include "Eolian.h"
9#include "eo_generator.h" 10#include "eo_generator.h"
@@ -727,7 +728,8 @@ eo_source_end_generate(const Eolian_Class *class, Eina_Strbuf *buf)
727 728
728 if (!str_classtype) 729 if (!str_classtype)
729 { 730 {
730 ERR ("Unknown class type for class %s !", class_env.full_classname); 731 fprintf(stderr, "eolian: unknown class type for class '%s'\n",
732 class_env.full_classname);
731 return EINA_FALSE; 733 return EINA_FALSE;
732 } 734 }
733 735
@@ -806,8 +808,8 @@ eo_source_end_generate(const Eolian_Class *class, Eina_Strbuf *buf)
806 { 808 {
807 const char *name = names[eolian_implement_is_prop_get(impl_desc) 809 const char *name = names[eolian_implement_is_prop_get(impl_desc)
808 | (eolian_implement_is_prop_set(impl_desc) << 1)]; 810 | (eolian_implement_is_prop_set(impl_desc) << 1)];
809 ERR ("Failed to generate implementation of %s%s - missing form super class", 811 fprintf(stderr, "eolian: failed to generate implementation of '%s%s' - missing from superclass\n",
810 name, eolian_implement_full_name_get(impl_desc)); 812 name, eolian_implement_full_name_get(impl_desc));
811 goto end; 813 goto end;
812 } 814 }
813 815
@@ -898,12 +900,7 @@ eo_source_end_generate(const Eolian_Class *class, Eina_Strbuf *buf)
898 { 900 {
899 const Eolian_Class *inherit_class = eolian_class_get_by_name(inherit_name); 901 const Eolian_Class *inherit_class = eolian_class_get_by_name(inherit_name);
900 _eolian_class_vars inherit_env; 902 _eolian_class_vars inherit_env;
901 if (!inherit_class) 903 assert(inherit_class);
902 {
903 ERR("Class %s has an unknown inherit %s", class_env.full_classname, inherit_name);
904 eina_iterator_free(itr);
905 goto end;
906 }
907 _class_env_create(inherit_class, NULL, &inherit_env); 904 _class_env_create(inherit_class, NULL, &inherit_env);
908 eina_strbuf_append_printf(tmpbuf, "%s_%s, ", inherit_env.upper_classname, 905 eina_strbuf_append_printf(tmpbuf, "%s_%s, ", inherit_env.upper_classname,
909 inherit_env.upper_classtype); 906 inherit_env.upper_classtype);
diff --git a/src/bin/eolian/impl_generator.c b/src/bin/eolian/impl_generator.c
index 36fa2bc2d7..4103a2110d 100644
--- a/src/bin/eolian/impl_generator.c
+++ b/src/bin/eolian/impl_generator.c
@@ -262,8 +262,8 @@ impl_source_generate(const Eolian_Class *class, Eina_Strbuf *buffer)
262 { 262 {
263 const char *name = names[eolian_implement_is_prop_get(impl_desc) 263 const char *name = names[eolian_implement_is_prop_get(impl_desc)
264 | (eolian_implement_is_prop_set(impl_desc) << 1)]; 264 | (eolian_implement_is_prop_set(impl_desc) << 1)];
265 ERR ("Failed to generate implementation of %s%s - missing from class", 265 fprintf(stderr, "eolian: failed to generate implementation of '%s%s' - missing from class\n",
266 name, eolian_implement_full_name_get(impl_desc)); 266 name, eolian_implement_full_name_get(impl_desc));
267 goto end; 267 goto end;
268 } 268 }
269 switch (ftype) 269 switch (ftype)
diff --git a/src/bin/eolian/main.c b/src/bin/eolian/main.c
index 22675fcb0a..0e7c0901f4 100644
--- a/src/bin/eolian/main.c
+++ b/src/bin/eolian/main.c
@@ -61,20 +61,20 @@ _read_file(char *filename, Eina_Strbuf *buffer)
61 file_size = ftell(fd); 61 file_size = ftell(fd);
62 if (file_size <= 0) 62 if (file_size <= 0)
63 { 63 {
64 ERR("Couldnt determine length for file %s", filename); 64 fprintf(stderr, "eolian: could not get length of '%s'\n", filename);
65 goto end; 65 goto end;
66 } 66 }
67 fseek(fd, 0, SEEK_SET); 67 fseek(fd, 0, SEEK_SET);
68 char *content = malloc(file_size + 1); 68 char *content = malloc(file_size + 1);
69 if (!content) 69 if (!content)
70 { 70 {
71 ERR("Couldnt allocate memory for file %s", filename); 71 fprintf(stderr, "eolian: could not allocate memory for '%s'\n", filename);
72 goto end; 72 goto end;
73 } 73 }
74 long actual_size = (long)fread(content, 1, file_size, fd); 74 long actual_size = (long)fread(content, 1, file_size, fd);
75 if (actual_size != file_size) 75 if (actual_size != file_size)
76 { 76 {
77 ERR("Couldnt read the %ld bytes of file %s (read %ld bytes)", 77 fprintf(stderr, "eolian: could not read %ld bytes from '%s' (read %ld bytes)\n",
78 file_size, filename, actual_size); 78 file_size, filename, actual_size);
79 free(content); 79 free(content);
80 goto end; 80 goto end;
@@ -103,8 +103,8 @@ _write_file(char *filename, const Eina_Strbuf *buffer, Eina_Bool append)
103 FILE* fd = fopen(filename, append ? "ab" : "wb"); 103 FILE* fd = fopen(filename, append ? "ab" : "wb");
104 if (!fd) 104 if (!fd)
105 { 105 {
106 const char *err = strerror(errno); 106 fprintf(stderr, "eolian: could not open '%s' for writing (%s)\n",
107 ERR ("Couldn't open file %s for writing. Reason: '%s'", filename, err); 107 filename, strerror(errno));
108 return EINA_FALSE; 108 return EINA_FALSE;
109 } 109 }
110 110
@@ -122,7 +122,7 @@ _generate_eo_header_file(char *filename, const char *eo_filename)
122 122
123 if (!types_header_generate(eo_filename, buffer, EINA_TRUE)) 123 if (!types_header_generate(eo_filename, buffer, EINA_TRUE))
124 { 124 {
125 ERR("Failed to generate types of file %s", eo_filename); 125 fprintf(stderr, "eolian: could not generate types of '%s'\n", eo_filename);
126 goto end; 126 goto end;
127 } 127 }
128 else 128 else
@@ -144,7 +144,8 @@ _generate_eo_header_file(char *filename, const char *eo_filename)
144 { 144 {
145 if (!eo_header_generate(class, buffer)) 145 if (!eo_header_generate(class, buffer))
146 { 146 {
147 ERR("Failed to generate header for %s", eolian_class_name_get(class)); 147 fprintf(stderr, "eolian: could not generate header for '%s'\n",
148 eolian_class_name_get(class));
148 goto end; 149 goto end;
149 } 150 }
150 } 151 }
@@ -167,7 +168,7 @@ _generate_stub_header_file(char *filename, const char *eo_filename)
167 168
168 if (!types_header_generate(eo_filename, buffer, EINA_FALSE)) 169 if (!types_header_generate(eo_filename, buffer, EINA_FALSE))
169 { 170 {
170 ERR("Failed to generate types of file %s", eo_filename); 171 fprintf(stderr, "eolian: could not generate types of '%s'\n", eo_filename);
171 goto end; 172 goto end;
172 } 173 }
173 174
@@ -201,14 +202,16 @@ _generate_c_file(char *filename, const char *eo_filename, Eina_Bool legacy_suppo
201 { 202 {
202 if (!eo_source_generate(class, eo_buf)) 203 if (!eo_source_generate(class, eo_buf))
203 { 204 {
204 ERR("Failed to generate source for %s", eolian_class_name_get(class)); 205 fprintf(stderr, "eolian: could not generate source for '%s'\n",
206 eolian_class_name_get(class));
205 goto end; 207 goto end;
206 } 208 }
207 209
208 if (legacy_support) 210 if (legacy_support)
209 if (!legacy_source_generate(class, legacy_buf)) 211 if (!legacy_source_generate(class, legacy_buf))
210 { 212 {
211 ERR("Failed to generate source for %s", eolian_class_name_get(class)); 213 fprintf(stderr, "eolian: could not generate source for '%s'\n",
214 eolian_class_name_get(class));
212 goto end; 215 goto end;
213 } 216 }
214 } 217 }
@@ -235,7 +238,8 @@ _generate_impl_c_file(char *filename, const char *eo_filename)
235 238
236 if (!impl_source_generate(class, buffer)) 239 if (!impl_source_generate(class, buffer))
237 { 240 {
238 ERR("Failed to generate source for %s", eolian_class_name_get(class)); 241 fprintf(stderr, "eolian: could not generate source for '%s'\n",
242 eolian_class_name_get(class));
239 goto end; 243 goto end;
240 } 244 }
241 245
@@ -257,7 +261,7 @@ _generate_legacy_header_file(char *filename, const char *eo_filename)
257 261
258 if (!types_header_generate(eo_filename, buffer, EINA_TRUE)) 262 if (!types_header_generate(eo_filename, buffer, EINA_TRUE))
259 { 263 {
260 ERR("Failed to generate types of file %s", eo_filename); 264 fprintf(stderr, "eolian: could not generate types of '%s'\n", eo_filename);
261 goto end; 265 goto end;
262 } 266 }
263 else 267 else
@@ -279,7 +283,8 @@ _generate_legacy_header_file(char *filename, const char *eo_filename)
279 { 283 {
280 if (!legacy_header_generate(class, buffer)) 284 if (!legacy_header_generate(class, buffer))
281 { 285 {
282 ERR("Failed to generate header for %s", eolian_class_name_get(class)); 286 fprintf(stderr, "eolian: could not generate header for '%s'\n",
287 eolian_class_name_get(class));
283 goto end; 288 goto end;
284 } 289 }
285 290
@@ -363,7 +368,7 @@ int main(int argc, char **argv)
363 const char *dir = optarg; 368 const char *dir = optarg;
364 if (!eolian_directory_scan(dir)) 369 if (!eolian_directory_scan(dir))
365 { 370 {
366 ERR("Failed to scan %s", dir); 371 fprintf(stderr, "eolian: could not scan '%s'\n", dir);
367 goto end; 372 goto end;
368 } 373 }
369 break; 374 break;
@@ -391,7 +396,7 @@ int main(int argc, char **argv)
391 396
392 if (!eo_filename) 397 if (!eo_filename)
393 { 398 {
394 ERR("No input file specified.\nTerminating.\n"); 399 fprintf(stderr, "eolian: no input file specified\n");
395 goto end; 400 goto end;
396 } 401 }
397 402
@@ -399,13 +404,13 @@ int main(int argc, char **argv)
399 404
400 if (!eolian_file_parse(eo_filename)) 405 if (!eolian_file_parse(eo_filename))
401 { 406 {
402 ERR("Error during parsing file %s\n", eo_filename); 407 fprintf(stderr, "eolian: error parsing file '%s'\n", eo_filename);
403 goto end; 408 goto end;
404 } 409 }
405 410
406 if (!eolian_database_validate()) 411 if (!eolian_database_validate())
407 { 412 {
408 ERR("Error validating database.\n"); 413 fprintf(stderr, "eolian: error validating database\n");
409 goto end; 414 goto end;
410 } 415 }
411 416
@@ -420,7 +425,8 @@ int main(int argc, char **argv)
420 /* Only needed for .eo files */ 425 /* Only needed for .eo files */
421 if (is_eo && !eo_needed && !(gen_opt == H_GEN && legacy_support)) 426 if (is_eo && !eo_needed && !(gen_opt == H_GEN && legacy_support))
422 { 427 {
423 ERR("Eo flag is not specified (use --eo). Aborting eo generation.\n"); 428 /* FIXME: perhaps ditch this completely */
429 fprintf(stderr, "eolian: --eo not specified\n");
424 goto end; 430 goto end;
425 } 431 }
426 432
@@ -428,7 +434,7 @@ int main(int argc, char **argv)
428 { 434 {
429 if (!output_filename) 435 if (!output_filename)
430 { 436 {
431 ERR("You must use -o argument for files generation."); 437 fprintf(stderr, "eolian: no output file specified\n");
432 goto end; 438 goto end;
433 } 439 }
434 switch (gen_opt) 440 switch (gen_opt)