EDJE_EDIT_IMAGE_COMP_LOSSY
} Edje_Edit_Image_Comp;
+struct _Edje_Edit_Script_Error
+{
+ const char *program_name; /* null == group shared script */
+ int line;
+ const char *error_str;
+};
+typedef struct _Edje_Edit_Script_Error Edje_Edit_Script_Error;
+
/**
* @file
* @brief Functions to deal with edje internal object. Don't use in standard
*/
EAPI Eina_Bool edje_edit_script_compile(Evas_Object *obj);
+/**
+ * Get the list of errors resulting from the last script build
+ *
+ * Get the list of errors that resulted from the last attempt to rebuild
+ * the Embryo script for the edited group. This will be a standard Eina_List
+ * with Edje_Edit_Script_Error pointers as its data.
+ * The user should not do anything else but read the contents of this list.
+ * These errors can be the output of the embryo compiler, or internal errors
+ * generated by Edje_Edit if the preprocessing of the scripts failed.
+ *
+ * @param obj The object being edited
+ *
+ * @return A constant list of Edje_Edit_Script_Error, or NULL if there are none
+ */
+EAPI const Eina_List *edje_edit_script_error_list_get(Evas_Object *obj);
//@}
/******************************************************************************/
char *embryo_processed;
Eina_Hash *program_scripts;
+ Eina_List *errors;
+
Eina_Bool bytecode_dirty:1;
Eina_Bool embryo_source_dirty:1;
Eina_Bool all_dirty:1;
static void
_edje_edit_data_clean(Edje_Edit *eed)
{
+ Edje_Edit_Script_Error *se;
+
free(eed->bytecode);
free(eed->embryo_source);
free(eed->embryo_processed);
if (eed->program_scripts)
eina_hash_free(eed->program_scripts);
+ EINA_LIST_FREE(eed->errors, se)
+ {
+ eina_stringshare_del(se->program_name);
+ eina_stringshare_del(se->error_str);
+ free(se);
+ }
+
eed->bytecode = NULL;
eed->embryo_source = NULL;
eed->embryo_processed = NULL;
}
static char *
-_edje_edit_script_process(Edje_Edit *eed, char *code)
+_edje_edit_script_process(Edje_Edit *eed, const char *progname, char *code)
{
char *pcode, *psrc, *pdst;
int codesize, pcodesize;
int quoted = 0, escaped = 0;
+ int line = 1;
Eina_Bool success = EINA_TRUE;
codesize = strlen(code);
if (!quoted)
{
char *ptr = NULL;
+ const char *what = NULL;
int (*func)(Edje_Edit *, char *, char *);
if (*psrc == 'P')
psrc += 6;
ptr = psrc;
func = __part_replace;
+ what = "part";
}
else if (!strncmp(psrc, "PROGRAM:\"", 9))
{
psrc += 9;
ptr = psrc;
func = __program_replace;
+ what = "program";
}
}
else if (*psrc == 'G')
psrc += 7;
ptr = psrc;
func = __group_replace;
+ what = "group";
}
}
else if (*psrc == 'I')
psrc += 7;
ptr = psrc;
func = __image_replace;
+ what = "image";
}
}
else if (*psrc == '#')
while (*psrc)
if (*psrc == '\n')
break;
+ line++;
continue;
}
else if (*psrc == '\"')
quoted = 1;
+ else if (*psrc == '\n')
+ line++;
if (ptr)
{
i = func(eed, pdst, name);
if (!i)
{
- /* something was not found, report it, keep track of
- * it to inform of non-existant referenced things
- * and continue processing to find all of those errors
- */
+ Edje_Edit_Script_Error *se;
+ se = malloc(sizeof(Edje_Edit_Script_Error));
+ se->program_name = progname ?
+ eina_stringshare_add(progname) : NULL;
+ se->line = line;
+ se->error_str = eina_stringshare_printf(
+ "Referenced %s '%s' could not be found in object.",
+ what, name);
+ eed->errors = eina_list_append(eed->errors, se);
success = EINA_FALSE;
}
else
Program_Script *ps;
Edje_Part_Collection *edc;
Eina_Bool success = EINA_TRUE; /* we are optimists! */
+ Edje_Edit_Script_Error *se;
+
+ EINA_LIST_FREE(eed->errors, se)
+ {
+ eina_stringshare_del(se->program_name);
+ eina_stringshare_del(se->error_str);
+ free(se);
+ }
#ifdef HAVE_EVIL
tmp_dir = evil_tmpdir_get();
eed->embryo_processed = NULL;
}
if (!eed->embryo_processed)
- eed->embryo_processed = _edje_edit_script_process(eed,
+ eed->embryo_processed = _edje_edit_script_process(eed, NULL,
eed->embryo_source);
if (!eed->embryo_processed)
{
it = eina_hash_iterator_data_new(eed->program_scripts);
EINA_ITERATOR_FOREACH(it, ps)
{
+ Edje_Program *epr;
+
if (ps->delete_me)
continue;
if (eed->all_dirty)
free(ps->processed);
ps->processed = NULL;
}
+ epr = eed->base.table_programs[ps->id];
if (!ps->processed)
- ps->processed = _edje_edit_script_process(eed, ps->code);
+ ps->processed = _edje_edit_script_process(eed, epr->name, ps->code);
if (!ps->processed)
{
/* oops.. an error finding references parts or something.
return _edje_edit_embryo_rebuild(eed);
}
+EAPI const Eina_List *
+edje_edit_script_error_list_get(Evas_Object *obj)
+{
+ GET_ED_OR_RETURN(NULL);
+ return eed->errors;
+}
+
/***************************/
/* EDC SOURCE GENERATION */
/***************************/