datasheet: Generating a blank datasheet

Previous: starter: Displaying a process start form ] [ Top: The procdef manager ] [ Next: editor: Displaying an edit form ]

This is basically a straight variation on the starter command.
 
if (argc < 5) {
   printf ("Missing arguments in datasheet command.\n");
   return (1);
}

sprintf (sbuf, "%s%s_%s.xml", PROCESS_DEFINITION_REPOSITORY, argv[2], argv[3]);
file = fopen (sbuf, "r");
if (!file) {
   printf ("Unable to open procdef version file %s.\n", sbuf);
   return (1);
}

version = xml_read (file);
fclose (file);

if (!version) {
   printf ("Corrupt version file %s.\n", sbuf);
   return (1);
}

datasheet = xml_create( "datasheet");
sprintf (sbuf, "%s_%s.xml", argv[2], argv[3]);
xml_set (datasheet, "procdef", sbuf);
xml_set (datasheet, "process", argv[4]);

xml = xml_firstelem (version);
while (xml) {
   if (!strcmp (xml->name, "data")) {
      holder = xml_create ("data");
      xml_set (holder, "id", xml_attrval (xml, "name"));
      xml_set (holder, "type", xml_attrval (xml, "type"));
      xml_append (datasheet, holder);
   } else if (!strcmp (xml->name, "sequence")) {
      break;
   } else if (!strcmp (xml->name, "parallel")) {
      break;
   } else if (!strcmp (xml->name, "task")) {
      break;
   }

   xml = xml_nextelem (xml);
}

xml_write (stdout, datasheet);
Previous: starter: Displaying a process start form ] [ Top: lpml alpha ] [ Next: editor: Displaying an edit form ]


This code and documentation are released under the terms of the GNU license. They are additionally copyright (c) 2000, Vivtek. All rights reserved except those explicitly granted under the terms of the GNU license.