/*------------------------------------*
 | File: DT.h - Include file for DT.c |
 *------------------------------------*/

/**
 | Parameters (#define):
 | - length of various buffers (track check, file check, file names)
 | - arguments for Motor()
 | - break flag bits
 | - "break window" parameters
 | - AppWindow ID
**/

#define SLATE_DIM     128
#define FILBUF_DIM    (512 * 11)
#define FILENAME_MAX  128

#define ON            1
#define OFF           0

#define BRK_DETECTED  0x1
#define WARN_PRINTED  0x10
#define INTERNAL_ERR  (BRK_DETECTED | WARN_PRINTED)

#define BKW_LEFT      390
#define BKW_TOP       110
#define BKW_WIDTH     210
#define BKW_HEIGHT     55
#define BKW_IDCMP     BUTTONIDCMP

#define AW_ID   17

/**
 | A structure to store directory entries, when checking
 | file integrity.
**/

typedef struct sdirEntry {
  struct sdirEntry *next;
  char name[1];
} dirEntry;

/**
 | Local global variables
**/

static char slate[SLATE_DIM];         /* All-purpose buffer */
static ULONG diskChangeCount;         /* Disk change count */
static int nErFil;                    /* Total number of errors */
static int nDirs;                     /* Nr. of checked directories */
static int nFiles;                    /* Nr. of checked files */
static BOOL listFileNames = TRUE;     /* "List file names" flag */
static unsigned abortDT = 0;          /* True when CTRL-C hit */
static struct DriveGeometry drGeom;   /* Floppy drive characteristics */
static ULONG cylSize;                 /* Bytes per cylinder */

/**
 | Local procedures
**/

static unsigned CheckBreak(void);
static void     CheckDir(char *path, const BOOL root);
static void     CheckFile(char *name);
static void     DiskCheck(const int drive);
static void     EndTest(void);
static void     GetBuffer(const ULONG size);
static void     Motor(const ULONG action);
static void     OutLine(const BOOL last, char *fmt, ...);
static void     ReadCyl(const int cyl, const int hd);
static void     SeekFullRange(const SHORT howmany);
static void     StartTest(void);
