forked from enlightenment/efl
eolian: use fprintf(stderr) instead of logging where it makes sense
This commit is contained in:
parent
edd361b420
commit
98497f8406
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#include <Eina.h>
|
#include <Eina.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
#include "Eolian.h"
|
#include "Eolian.h"
|
||||||
#include "eo_generator.h"
|
#include "eo_generator.h"
|
||||||
|
@ -727,7 +728,8 @@ eo_source_end_generate(const Eolian_Class *class, Eina_Strbuf *buf)
|
||||||
|
|
||||||
if (!str_classtype)
|
if (!str_classtype)
|
||||||
{
|
{
|
||||||
ERR ("Unknown class type for class %s !", class_env.full_classname);
|
fprintf(stderr, "eolian: unknown class type for class '%s'\n",
|
||||||
|
class_env.full_classname);
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -806,7 +808,7 @@ eo_source_end_generate(const Eolian_Class *class, Eina_Strbuf *buf)
|
||||||
{
|
{
|
||||||
const char *name = names[eolian_implement_is_prop_get(impl_desc)
|
const char *name = names[eolian_implement_is_prop_get(impl_desc)
|
||||||
| (eolian_implement_is_prop_set(impl_desc) << 1)];
|
| (eolian_implement_is_prop_set(impl_desc) << 1)];
|
||||||
ERR ("Failed to generate implementation of %s%s - missing form super class",
|
fprintf(stderr, "eolian: failed to generate implementation of '%s%s' - missing from superclass\n",
|
||||||
name, eolian_implement_full_name_get(impl_desc));
|
name, eolian_implement_full_name_get(impl_desc));
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
@ -898,12 +900,7 @@ eo_source_end_generate(const Eolian_Class *class, Eina_Strbuf *buf)
|
||||||
{
|
{
|
||||||
const Eolian_Class *inherit_class = eolian_class_get_by_name(inherit_name);
|
const Eolian_Class *inherit_class = eolian_class_get_by_name(inherit_name);
|
||||||
_eolian_class_vars inherit_env;
|
_eolian_class_vars inherit_env;
|
||||||
if (!inherit_class)
|
assert(inherit_class);
|
||||||
{
|
|
||||||
ERR("Class %s has an unknown inherit %s", class_env.full_classname, inherit_name);
|
|
||||||
eina_iterator_free(itr);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
_class_env_create(inherit_class, NULL, &inherit_env);
|
_class_env_create(inherit_class, NULL, &inherit_env);
|
||||||
eina_strbuf_append_printf(tmpbuf, "%s_%s, ", inherit_env.upper_classname,
|
eina_strbuf_append_printf(tmpbuf, "%s_%s, ", inherit_env.upper_classname,
|
||||||
inherit_env.upper_classtype);
|
inherit_env.upper_classtype);
|
||||||
|
|
|
@ -262,7 +262,7 @@ impl_source_generate(const Eolian_Class *class, Eina_Strbuf *buffer)
|
||||||
{
|
{
|
||||||
const char *name = names[eolian_implement_is_prop_get(impl_desc)
|
const char *name = names[eolian_implement_is_prop_get(impl_desc)
|
||||||
| (eolian_implement_is_prop_set(impl_desc) << 1)];
|
| (eolian_implement_is_prop_set(impl_desc) << 1)];
|
||||||
ERR ("Failed to generate implementation of %s%s - missing from class",
|
fprintf(stderr, "eolian: failed to generate implementation of '%s%s' - missing from class\n",
|
||||||
name, eolian_implement_full_name_get(impl_desc));
|
name, eolian_implement_full_name_get(impl_desc));
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,20 +61,20 @@ _read_file(char *filename, Eina_Strbuf *buffer)
|
||||||
file_size = ftell(fd);
|
file_size = ftell(fd);
|
||||||
if (file_size <= 0)
|
if (file_size <= 0)
|
||||||
{
|
{
|
||||||
ERR("Couldnt determine length for file %s", filename);
|
fprintf(stderr, "eolian: could not get length of '%s'\n", filename);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
fseek(fd, 0, SEEK_SET);
|
fseek(fd, 0, SEEK_SET);
|
||||||
char *content = malloc(file_size + 1);
|
char *content = malloc(file_size + 1);
|
||||||
if (!content)
|
if (!content)
|
||||||
{
|
{
|
||||||
ERR("Couldnt allocate memory for file %s", filename);
|
fprintf(stderr, "eolian: could not allocate memory for '%s'\n", filename);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
long actual_size = (long)fread(content, 1, file_size, fd);
|
long actual_size = (long)fread(content, 1, file_size, fd);
|
||||||
if (actual_size != file_size)
|
if (actual_size != file_size)
|
||||||
{
|
{
|
||||||
ERR("Couldnt read the %ld bytes of file %s (read %ld bytes)",
|
fprintf(stderr, "eolian: could not read %ld bytes from '%s' (read %ld bytes)\n",
|
||||||
file_size, filename, actual_size);
|
file_size, filename, actual_size);
|
||||||
free(content);
|
free(content);
|
||||||
goto end;
|
goto end;
|
||||||
|
@ -103,8 +103,8 @@ _write_file(char *filename, const Eina_Strbuf *buffer, Eina_Bool append)
|
||||||
FILE* fd = fopen(filename, append ? "ab" : "wb");
|
FILE* fd = fopen(filename, append ? "ab" : "wb");
|
||||||
if (!fd)
|
if (!fd)
|
||||||
{
|
{
|
||||||
const char *err = strerror(errno);
|
fprintf(stderr, "eolian: could not open '%s' for writing (%s)\n",
|
||||||
ERR ("Couldn't open file %s for writing. Reason: '%s'", filename, err);
|
filename, strerror(errno));
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ _generate_eo_header_file(char *filename, const char *eo_filename)
|
||||||
|
|
||||||
if (!types_header_generate(eo_filename, buffer, EINA_TRUE))
|
if (!types_header_generate(eo_filename, buffer, EINA_TRUE))
|
||||||
{
|
{
|
||||||
ERR("Failed to generate types of file %s", eo_filename);
|
fprintf(stderr, "eolian: could not generate types of '%s'\n", eo_filename);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -144,7 +144,8 @@ _generate_eo_header_file(char *filename, const char *eo_filename)
|
||||||
{
|
{
|
||||||
if (!eo_header_generate(class, buffer))
|
if (!eo_header_generate(class, buffer))
|
||||||
{
|
{
|
||||||
ERR("Failed to generate header for %s", eolian_class_name_get(class));
|
fprintf(stderr, "eolian: could not generate header for '%s'\n",
|
||||||
|
eolian_class_name_get(class));
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -167,7 +168,7 @@ _generate_stub_header_file(char *filename, const char *eo_filename)
|
||||||
|
|
||||||
if (!types_header_generate(eo_filename, buffer, EINA_FALSE))
|
if (!types_header_generate(eo_filename, buffer, EINA_FALSE))
|
||||||
{
|
{
|
||||||
ERR("Failed to generate types of file %s", eo_filename);
|
fprintf(stderr, "eolian: could not generate types of '%s'\n", eo_filename);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,14 +202,16 @@ _generate_c_file(char *filename, const char *eo_filename, Eina_Bool legacy_suppo
|
||||||
{
|
{
|
||||||
if (!eo_source_generate(class, eo_buf))
|
if (!eo_source_generate(class, eo_buf))
|
||||||
{
|
{
|
||||||
ERR("Failed to generate source for %s", eolian_class_name_get(class));
|
fprintf(stderr, "eolian: could not generate source for '%s'\n",
|
||||||
|
eolian_class_name_get(class));
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (legacy_support)
|
if (legacy_support)
|
||||||
if (!legacy_source_generate(class, legacy_buf))
|
if (!legacy_source_generate(class, legacy_buf))
|
||||||
{
|
{
|
||||||
ERR("Failed to generate source for %s", eolian_class_name_get(class));
|
fprintf(stderr, "eolian: could not generate source for '%s'\n",
|
||||||
|
eolian_class_name_get(class));
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -235,7 +238,8 @@ _generate_impl_c_file(char *filename, const char *eo_filename)
|
||||||
|
|
||||||
if (!impl_source_generate(class, buffer))
|
if (!impl_source_generate(class, buffer))
|
||||||
{
|
{
|
||||||
ERR("Failed to generate source for %s", eolian_class_name_get(class));
|
fprintf(stderr, "eolian: could not generate source for '%s'\n",
|
||||||
|
eolian_class_name_get(class));
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -257,7 +261,7 @@ _generate_legacy_header_file(char *filename, const char *eo_filename)
|
||||||
|
|
||||||
if (!types_header_generate(eo_filename, buffer, EINA_TRUE))
|
if (!types_header_generate(eo_filename, buffer, EINA_TRUE))
|
||||||
{
|
{
|
||||||
ERR("Failed to generate types of file %s", eo_filename);
|
fprintf(stderr, "eolian: could not generate types of '%s'\n", eo_filename);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -279,7 +283,8 @@ _generate_legacy_header_file(char *filename, const char *eo_filename)
|
||||||
{
|
{
|
||||||
if (!legacy_header_generate(class, buffer))
|
if (!legacy_header_generate(class, buffer))
|
||||||
{
|
{
|
||||||
ERR("Failed to generate header for %s", eolian_class_name_get(class));
|
fprintf(stderr, "eolian: could not generate header for '%s'\n",
|
||||||
|
eolian_class_name_get(class));
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -363,7 +368,7 @@ int main(int argc, char **argv)
|
||||||
const char *dir = optarg;
|
const char *dir = optarg;
|
||||||
if (!eolian_directory_scan(dir))
|
if (!eolian_directory_scan(dir))
|
||||||
{
|
{
|
||||||
ERR("Failed to scan %s", dir);
|
fprintf(stderr, "eolian: could not scan '%s'\n", dir);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -391,7 +396,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
if (!eo_filename)
|
if (!eo_filename)
|
||||||
{
|
{
|
||||||
ERR("No input file specified.\nTerminating.\n");
|
fprintf(stderr, "eolian: no input file specified\n");
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -399,13 +404,13 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
if (!eolian_file_parse(eo_filename))
|
if (!eolian_file_parse(eo_filename))
|
||||||
{
|
{
|
||||||
ERR("Error during parsing file %s\n", eo_filename);
|
fprintf(stderr, "eolian: error parsing file '%s'\n", eo_filename);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!eolian_database_validate())
|
if (!eolian_database_validate())
|
||||||
{
|
{
|
||||||
ERR("Error validating database.\n");
|
fprintf(stderr, "eolian: error validating database\n");
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -420,7 +425,8 @@ int main(int argc, char **argv)
|
||||||
/* Only needed for .eo files */
|
/* Only needed for .eo files */
|
||||||
if (is_eo && !eo_needed && !(gen_opt == H_GEN && legacy_support))
|
if (is_eo && !eo_needed && !(gen_opt == H_GEN && legacy_support))
|
||||||
{
|
{
|
||||||
ERR("Eo flag is not specified (use --eo). Aborting eo generation.\n");
|
/* FIXME: perhaps ditch this completely */
|
||||||
|
fprintf(stderr, "eolian: --eo not specified\n");
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -428,7 +434,7 @@ int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
if (!output_filename)
|
if (!output_filename)
|
||||||
{
|
{
|
||||||
ERR("You must use -o argument for files generation.");
|
fprintf(stderr, "eolian: no output file specified\n");
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
switch (gen_opt)
|
switch (gen_opt)
|
||||||
|
|
Loading…
Reference in New Issue