|
XML * queue_procdef (XML * action)
{
XML * item;
if (action == NULL) return;
if (state == NULL) {
state = xml_create("state");
xml_append (datasheet, state);
}
if (queue == NULL) {
queue = xml_create("queue");
xml_append (state, queue);
}
item = xml_create("item");
xml_setnum (item, "id", idcount++);
xml_set (item, "type", action->name);
xml_getloc (action, sbuf, 1023);
xml_set (item, "loc", sbuf);
xml_append (queue, item);
return (item);
}
void process_procdef()
{
XML * item;
XML * def;
XML * holder;
XML * task;
XML * data;
XML * next;
const char * type;
int count;
int keep;
item = xml_first (queue);
while (item != NULL) {
if (!strcmp("yes", xml_attrval(item, "block"))) {
item = xml_next(item);
continue;
}
def = xml_loc (procdef, xml_attrval(item, "loc"));
type = xml_attrval (item, "type");
keep = 0;
if (!strcmp(type, "workflow") || !strcmp(type, "sequence")) {
See Handling sequence
} else if (!strcmp (type, "parallel")) {
See Handling parallel
} else if (!strcmp (type, "task")) {
See Handling task
} else if (!strcmp (type, "data")) {
See Handling data
} else if (!strcmp (type, "situation")) {
See Handling situation
} else if (!strcmp (type, "if") || !strcmp (type, "elseif")) {
See Handling if and elseif
} else if (!strcmp (type, "alert")) {
See Handling alerts
} else if (!strcmp (type, "start")) {
See start: Starting subprocesses
}
if (keep) {
xml_set (item, "block", "yes");
item = xml_next(item);
} else {
if (strcmp ("workflow", type)) {
sprintf (sbuf, "queue.item[%d]", xml_attrvalnum (item, "parent"));
next = xml_loc (queue, sbuf);
xml_delete (item);
item = next;
xml_set (item, "block", "no");
} else {
xml_delete (item);
item = NULL;
}
}
}
sprintf (sbuf, "%d", idcount);
xml_set (state, "idcount", sbuf);
}
|