Loading the datasheet for an active process

Previous: Interpreting command streams ] [ Top: wftk core index ] [ Next: Interpreting the process definition ]

This is a function, to be called at the beginning of every command except for "start". If the datasheet is already loaded, then nothing happens.
 
void load_datasheet ()
{
   FILE * temp;
   if (datasheet) return;

   sprintf (sbuf, "%s%s", DATASHEET_REPOSITORY, process);
   temp = fopen (sbuf, "r");
   if (!temp) {
      output ('E', "Can't open datasheet for process %s.", process);
      return;
   }
   datasheet = xml_read (temp);
   fclose (temp);
   state = xml_loc (datasheet, "datasheet.state");
   idcount = xml_attrvalnum (state, "idcount");
   queue = xml_loc (datasheet, "datasheet.state.queue");
   sprintf (sbuf, "%s%s", PROCESS_DEFINITION_REPOSITORY, xml_attrval (datasheet, "procdef"));
   temp = fopen (sbuf, "r");
   if (!temp) {
      output ('E', "Can't open process definition for process %s.", process);
      xml_delete (datasheet);
      datasheet = NULL;
      return;
   }
   procdef = xml_read (temp);
   fclose (temp);
}
Previous: Interpreting command streams ] [ Top: wftk core index ] [ Next: Interpreting the process definition ]


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.