EVEN better parsing! :) lots of NULL handlers need filling in. i need to unify

common type parameter parsing to use smaller common functions to save space.


SVN revision: 7012
This commit is contained in:
Carsten Haitzler 2003-06-11 14:14:23 +00:00
parent 61586a277f
commit dd7fe79b30
2 changed files with 65 additions and 12 deletions

View File

@ -4,17 +4,47 @@ static void ob_images(void);
static void ob_images_image(void);
static void st_images_image(void);
static void ob_collections(void);
/*****/
New_Object_Handler object_handlers[] =
{
{"images", ob_images},
{"images.image", ob_images_image}
{"images.image", ob_images_image},
{"collections", ob_collections},
{"collections.group", NULL},
{"collections.group.name", NULL},
{"collections.group.parts", NULL},
{"collections.group.parts.part", NULL},
{"collections.group.parts.part.name", NULL},
{"collections.group.parts.part.type", NULL},
{"collections.group.parts.part.mouse_events", NULL},
{"collections.group.parts.part.color_class", NULL},
{"collections.group.parts.part.description", NULL},
{"collections.group.parts.part.description.state", NULL},
{"collections.group.parts.part.description.visible", NULL},
{"collections.group.parts.part.description.dragable", NULL},
{"collections.group.parts.part.description.dragable.x", NULL},
{"collections.group.parts.part.description.dragable.y", NULL},
{"collections.group.parts.part.description.dragable.confine", NULL},
{"collections.group.programs", NULL},
{"collections.group.programs.program", NULL}
};
New_Statement_Handler statement_handlers[] =
{
{"images.image", st_images_image}
{"images.image", st_images_image},
{"collections.group.name", NULL},
{"collections.group.parts.part.name", NULL},
{"collections.group.parts.part.type", NULL},
{"collections.group.parts.part.mouse_events", NULL},
{"collections.group.parts.part.color_class", NULL},
{"collections.group.parts.part.description.state", NULL},
{"collections.group.parts.part.description.visible", NULL},
{"collections.group.parts.part.description.dragable.x", NULL},
{"collections.group.parts.part.description.dragable.y", NULL},
{"collections.group.parts.part.description.dragable.confine", NULL}
};
/*****/
@ -128,3 +158,8 @@ st_images_image(void)
exit(-1);
}
}
static void
ob_collections(void)
{
}

View File

@ -17,16 +17,27 @@ new_object(void)
{
char *id;
int i;
int handled = 0;
id = stack_id();
// printf("+++: %s\n", id);
for (i = 0; i < object_handler_num(); i++)
{
if (!strcmp(object_handlers[i].type, id))
{
if (object_handlers[i].func) object_handlers[i].func();
handled = 1;
if (object_handlers[i].func)
{
object_handlers[i].func();
}
break;
}
}
if (!handled)
{
fprintf(stderr, "%s: Error. %s:%i unhandled keyword %s\n",
progname, file_in, line, evas_list_data(evas_list_last(stack)));
exit(-1);
}
free(id);
}
@ -35,21 +46,27 @@ new_statement(void)
{
char *id;
int i;
int handled = 0;
id = stack_id();
// {
// Evas_List *l;
// printf("===: %s", id);
// for (l = params; l; l = l->next) printf(" [%s]", l->data);
// printf("\n");
// }
for (i = 0; i < statement_handler_num(); i++)
{
if (!strcmp(statement_handlers[i].type, id))
{
if (statement_handlers[i].func) statement_handlers[i].func();
handled = 1;
if (statement_handlers[i].func)
{
statement_handlers[i].func();
}
break;
}
}
}
if (!handled)
{
fprintf(stderr, "%s: Error. %s:%i unhandled keyword %s\n",
progname, file_in, line, evas_list_data(evas_list_last(stack)));
exit(-1);
}
free(id);
}
@ -141,6 +158,7 @@ next_token(char *p, char *end, char **new_p, int *delim)
{
in_tok = 0;
tok_end = p - 1;
if (*p == '\n') line--;
goto done;
}
}