redo lazEDC parsing a bit to fix desc.state omission

This commit is contained in:
Mike Blumenkrantz 2014-05-09 15:54:57 -04:00
parent 6a7b0af847
commit a84f19beb7
3 changed files with 59 additions and 8 deletions

View File

@ -288,4 +288,6 @@ extern int threads;
extern int anotate;
extern Eina_Bool current_group_inherit;
extern int had_quote;
#endif

View File

@ -34,6 +34,7 @@
#include <fcntl.h>
#include <sys/mman.h>
#include <unistd.h>
#include <ctype.h>
#include "edje_cc.h"
@ -11341,6 +11342,7 @@ edje_cc_handlers_wildcard(void)
{
Eina_Bool ret;
if (!had_quote) return EINA_FALSE;
free((void*)current_part->name);
current_part->name = token;
ret = _part_name_check();
@ -11350,18 +11352,64 @@ edje_cc_handlers_wildcard(void)
}
if (current_desc && ((!strcmp(last, "desc")) || (!strcmp(last, "description"))))
{
if ((!current_desc->state.name) || strcmp(current_desc->state.name, token))
double st;
char *end;
if (had_quote)
{
free((char*)current_desc->state.name);
current_desc->state.name = token;
_part_description_state_update(current_desc);
if ((!current_desc->state.name) || strcmp(current_desc->state.name, token))
{
free((char*)current_desc->state.name);
current_desc->state.name = token;
_part_description_state_update(current_desc);
}
stack_pop_quick(EINA_FALSE, current_desc->state.name != token);
return EINA_TRUE;
}
stack_pop_quick(EINA_FALSE, current_desc->state.name != token);
if (!isdigit(token[0])) return EINA_FALSE;
st = strtod(token, &end);
if ((end && end[0]) || (fabs(current_desc->state.value) > DBL_EPSILON))
return EINA_FALSE;
if (current_desc == current_part->default_desc)
{
ob_collections_group_parts_part_description();
current_desc->state.name = strdup("default");
}
else
{
unsigned int j;
for (j = 0; j < current_part->other.desc_count; j++)
{
/* check for inherited descriptions */
Edje_Part_Description_Common *ed = current_part->other.desc[j];
if (((!!ed->state.name) != (!!current_desc->state.name)) ||
(ed->state.name && strcmp(ed->state.name, current_desc->state.name)) ||
(fabs(ed->state.value - st) > DBL_EPSILON)) continue;
current_desc = ed;
break;
}
/* not found */
if (j == current_part->other.desc_count)
{
void *name = NULL;
if (current_desc->state.name)
name = strdup(current_desc->state.name);
ob_collections_group_parts_part_description();
current_desc->state.name = name;
}
}
current_desc->state.value = st;
stack_pop_quick(EINA_FALSE, EINA_TRUE);
return EINA_TRUE;
}
}
if (current_program && ((!strcmp(last, "program")) || (!strcmp(last, "sequence"))))
{
if (!had_quote) return EINA_FALSE;
_program_sequence_check();
_program_name(token);
stack_pop_quick(EINA_FALSE, EINA_FALSE);
@ -11369,12 +11417,14 @@ edje_cc_handlers_wildcard(void)
}
if (current_de && (!strcmp(last, "group")))
{
if (!had_quote) return EINA_FALSE;
_group_name(token);
stack_pop_quick(EINA_FALSE, EINA_FALSE);
return EINA_TRUE;
}
if (edje_file->styles && (!strcmp(last, "style")))
{
if (!had_quote) return EINA_FALSE;
_style_name(token);
stack_pop_quick(EINA_FALSE, EINA_FALSE);
return EINA_TRUE;

View File

@ -58,7 +58,7 @@ static int strstrip(const char *in, char *out, size_t size);
int line = 0;
Eina_List *stack = NULL;
Eina_Array params;
static int had_quote = 0;
int had_quote = 0;
static char file_buf[4096];
static int did_wildcard = 0;
@ -193,8 +193,7 @@ new_object(void)
}
else
{
if (had_quote)
did_wildcard = edje_cc_handlers_wildcard();
did_wildcard = edje_cc_handlers_wildcard();
if (!did_wildcard)
{
sh = eina_hash_find(_new_statement_hash, id);