
/*******************************************************************************
*
* File tasks.h
*
* Copyright (C) 2006 Martin Luescher
*
* This software is distributed under the terms of the GNU General Public
* License (GPL)
*
* Task descriptions
*
*******************************************************************************/

#define TASKS_H

#if (defined FLAGS_C)

static int (*task_fcts[TASKS])(void)={NULL};


static int TaskAction(void)
{
   return ((lat.u>0)&&(lat.u==lat.ubuf)&&(lat.bc==lat.bcbuf));
}

static int TaskActionDble(void)
{
   return ((lat.ud>0)&&(lat.ud==lat.udbuf)&&(lat.bcd==lat.bcdbuf));
}

static int TaskSwTerm(void)
{
   return ((lat.ud>0)&&(lat.ud==lat.udbuf)&&(lat.bcd==lat.bcdbuf));
}

static int TaskQhat(void)
{
   return ((lat.u>0)&&(lat.u==lat.sw[0])&&
           (lat.sw[1]==0)&&(lat.sw[2]==1));
}

static int TaskQnohat(void)
{
   return ((lat.u>0)&&(lat.u==lat.sw[0])&&
           (lat.sw[1]==0)&&(lat.sw[2]==0));
}

static int TaskQeo(void)
{
   return ((lat.u>0));
}

static int TaskQoe(void)
{
   return ((lat.u>0));
}

static int TaskQhatDble(void)
{
   return ((lat.ud>0)&&(lat.ud==lat.swd[0])&&
           (lat.swd[1]==0)&&(lat.swd[2]==1));
}

static int TaskQnohatDble(void)
{
   return ((lat.ud>0)&&(lat.ud==lat.swd[0])&&
           (lat.swd[1]==0)&&(lat.swd[2]==0));
}

static int TaskQeoDble(void)
{
   return ((lat.ud>0));
}

static int TaskQoeDble(void)
{
   return ((lat.ud>0));
}

static int TaskShiftU(void)
{
   return (lat.u>0);
}

static int TaskShiftUd(void)
{
   return (lat.ud>0);
}

static void set_tasks(void)
{
   task_fcts[ACTION]=TaskAction;
   task_fcts[ACTION_DBLE]=TaskActionDble;
   task_fcts[SW_TERM]=TaskSwTerm;
   task_fcts[QHAT]=TaskQhat;
   task_fcts[QNOHAT]=TaskQnohat;
   task_fcts[QEO]=TaskQeo;
   task_fcts[QOE]=TaskQoe;
   task_fcts[QHAT_DBLE]=TaskQhatDble;
   task_fcts[QNOHAT_DBLE]=TaskQnohatDble;
   task_fcts[QEO_DBLE]=TaskQeoDble;
   task_fcts[QOE_DBLE]=TaskQoeDble;
   task_fcts[SHIFT_U]=TaskShiftU;
   task_fcts[SHIFT_UD]=TaskShiftUd;
}

#endif
