/*
 *  LISTING 4, tape.h
 *
 *  state table macros and structure definitions
 *  for TAPE device.
 */

/* Device states .... */
enum device_states {
    OFF,        //0
    ON,         //1
    READY,      //2
    RECORD,     //3
    PLAY,       //4
    FFORWARD,   //5
    REWIND,     //6
    MAX_STATE   //7
    };

/* User commands (events)..... */
enum user_cmds {
    CMD_POWER_ON,
    CMD_POWER_OFF,
    CMD_INSERT,
    CMD_EJECT,
    CMD_RECORD,
    CMD_PLAY,
    CMD_FFORWARD,
    CMD_REWIND,
    CMD_CHK_STATUS,
    CMD_STOP
    };

#define END -1
#define OK  0
#define NOTOK   -1

typedef struct command_arg    {
    int c_state;    //current state
    int cmd;        //driver command
    int status;     //device status
    } CMDARG;

typedef struct state_table  {
    int event;
    int n_state;
    int (**procs)(CMDARG far *arg);  //-> to array of
                          //....pointers to functions
    } S_TAB;

/* ----- End of File ------------------------------- */
