#include #include #include "callback.h" /******************************************************************************/ /* S T A T E S */ /******************************************************************************/ // (exec / edit) X (state / rules / measure) X (observ / interpret / read / write) enum { EXEC_STOP, EXEC_RUN, EXEC_STOP_EDIT_RULE, EXEC_RUN_EDIT_RULE, EXEC_STOP_EDIT_MEASURE, EXEC_RUN_EDIT_MEASURE, EDIT_STATE, EDIT_RULE, OBSERVE, INTERPRET, HELP, CONFIGURE }; static int status = EXEC_STOP; int get_status () {return status;} /******************************************************************************/ /* T R A N S I T I O N S */ /******************************************************************************/ void set_status (int prescribed) { status = prescribed; if (0) printf ("status = %d\n", status); switch (status) { case (0) : /* EXEC_STOP */ status = EXEC_RUN; break; case (1) : /* EXEC_RUN */ status = EXEC_STOP; break; case (2) : /* EXEC_STOP_EDIT_STOP */ status = EXEC_RUN_EDIT_RULE; break; case (3) : /* EXEC_RUN_EDIT_RULE */ status = EXEC_STOP_EDIT_RULE; break; case (4) : /* EXEC_STOP_EDIT_MEASURE */ status = EXEC_RUN_EDIT_MEASURE; break; case (5) : /* EXEC_RUN_EDIT_MEASURE */ status = EXEC_STOP_EDIT_MEASURE; break; case (6) : /* EDIT_STATE */ break; case (7) : /* EDIT_RULE */ break; case (8) : /* OBSERVE */ break; case (9) : /* INTERPRET */ break; case (10) : /* HELP */ break; case (11) : /* CONFIGURE */ break; case (12) : /* OTHER */ break; default : ; } }