/*
 * 5799-WZQ (C) COPYRIGHT IBM CORPORATION 1986
 * LICENSED MATERIALS - PROPERTY OF IBM
 * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
 */
/* $Header:vybus.c 12.0$ */
/* $ACIS:vybus.c 12.0$ */
/* $Source: /ibm/acis/usr/src/ibm/aedtest/RCS/vybus.c,v $ */

#ifndef lint
static char *rcsid = "$Header:vybus.c 12.0$";
#endif

/* vybus.c */
#include "vikst.h"
static INT16 a,err[9];

#ifdef BSD
  extern FILE *out,*spool;
	extern dumpspool();
	extern int v_control;
#endif

ybus()
{ UINT16 k,type,finished;
  extern UINT16 zero;
  load("ybus.vkt");
  for (k = 0; k<9; k++) err[k] = 0;
  finished = false;
  a=false;
  while( finished == false)
     { if (look(&type,&k,&k)) 
#ifndef NOTIMEOUT
		abortb("Time out in Y-Bus test.\n");
#else
		{
		p1d("\007Time out in Y-Bus test -- continuing.\n");
		p2d("look returned %x\n",type);
		dumptime();
		return(0);
		}
#endif
       switch(type)
	  { case vikdone: finished=true; break;
	    case chkpt:   VIKCONT; p1m("."); break;
	    default:	  yerr(type);  VIKCONT; break;
	  }
     }
  if (a == false) return(false);
  p1d("Errors in Y-bus test:\n");
  for (k=0; k<9; k++) p3d("       Type %d: %d\n",k,err[k]);
  return(a);
}

yerr(type)
INT16 type;
{ a = true;

  if ((0 < type) && (type < 9)) err[type] += 1;
  else PRINTF("yerr: (debug) type was %d (= %04x)\n",type,type);
}
