#include <Eina.h>
#include <string.h>
+#include <assert.h>
#include "Eolian.h"
#include "eo_generator.h"
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;
}
{
const char *name = names[eolian_implement_is_prop_get(impl_desc)
| (eolian_implement_is_prop_set(impl_desc) << 1)];
- ERR ("Failed to generate implementation of %s%s - missing form super class",
- name, eolian_implement_full_name_get(impl_desc));
+ fprintf(stderr, "eolian: failed to generate implementation of '%s%s' - missing from superclass\n",
+ name, eolian_implement_full_name_get(impl_desc));
goto end;
}
{
const Eolian_Class *inherit_class = eolian_class_get_by_name(inherit_name);
_eolian_class_vars inherit_env;
- if (!inherit_class)
- {
- ERR("Class %s has an unknown inherit %s", class_env.full_classname, inherit_name);
- eina_iterator_free(itr);
- goto end;
- }
+ assert(inherit_class);
_class_env_create(inherit_class, NULL, &inherit_env);
eina_strbuf_append_printf(tmpbuf, "%s_%s, ", inherit_env.upper_classname,
inherit_env.upper_classtype);
file_size = ftell(fd);
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;
}
fseek(fd, 0, SEEK_SET);
char *content = malloc(file_size + 1);
if (!content)
{
- ERR("Couldnt allocate memory for file %s", filename);
+ fprintf(stderr, "eolian: could not allocate memory for '%s'\n", filename);
goto end;
}
long actual_size = (long)fread(content, 1, file_size, fd);
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);
free(content);
goto end;
FILE* fd = fopen(filename, append ? "ab" : "wb");
if (!fd)
{
- const char *err = strerror(errno);
- ERR ("Couldn't open file %s for writing. Reason: '%s'", filename, err);
+ fprintf(stderr, "eolian: could not open '%s' for writing (%s)\n",
+ filename, strerror(errno));
return EINA_FALSE;
}
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;
}
else
{
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;
}
}
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;
}
{
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;
}
if (legacy_support)
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;
}
}
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;
}
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;
}
else
{
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;
}
const char *dir = optarg;
if (!eolian_directory_scan(dir))
{
- ERR("Failed to scan %s", dir);
+ fprintf(stderr, "eolian: could not scan '%s'\n", dir);
goto end;
}
break;
if (!eo_filename)
{
- ERR("No input file specified.\nTerminating.\n");
+ fprintf(stderr, "eolian: no input file specified\n");
goto end;
}
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;
}
if (!eolian_database_validate())
{
- ERR("Error validating database.\n");
+ fprintf(stderr, "eolian: error validating database\n");
goto end;
}
/* Only needed for .eo files */
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;
}
{
if (!output_filename)
{
- ERR("You must use -o argument for files generation.");
+ fprintf(stderr, "eolian: no output file specified\n");
goto end;
}
switch (gen_opt)