/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* |_o_o|\\ Copyright (c) 1987 The Software Distillery.  All Rights Reserved */
/* |. o.| || This program may not be distributed without the permission of   */
/* | .  | || the authors:                                          BBS:      */
/* | o  | ||   John Toebes     Dave Baker                                    */
/* |  . |//                                                                  */
/* ======                                                                    */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* Process Control */

/* ActDie ActInhibit ActFlush ActTimer */
#include "handler.h"

void ActDie(global, pkt)
GLOBAL global;
struct DosPacket *pkt;              /* a pointer to the dos packet sent       */
{
   BUG(("ActDie\n"));
   global->run = -1;
}

void ActInhibit(global, pkt)
GLOBAL global;
struct DosPacket *pkt;              /* a pointer to the dos packet sent       */
{
   BUG(("ActInhibit: %ld\n", pkt->dp_Arg1));
   if (pkt->dp_Arg1 == DOS_TRUE)
      DisMount(global);
   else
      Mount(global);
   pkt->dp_Res1 = DOS_TRUE;
}

void ActFlush(global, pkt)
GLOBAL global;
struct DosPacket *pkt;
{
   BUG(("ActFlush\n"));
   FlushBuffers(global, 0);
   Motor(global, 0);
}

void ActTimer(global, pkt)
GLOBAL global;
struct DosPacket *pkt;        /* a pointer to the dos packet sent */
{
   BUG(("ActTimer\n"));
   if (global->deviotimeout == 0)
      {
      WriteBitMap(global);
      FlushBuffers(global,0);
      Motor(global,0);
      }
   else
      {
      if (global->deviotimeout > 0)
         global->deviotimeout--;
      }

   if (global->run == -1)
      global->run = 0;
   else
      PostTimerReq(global);

   /* Prevent them from replying to the message */
   global->reply = 0;
}
