/*********************************************************************/
/*                                                                   */
/*  This Program Written by Paul Edwards, 3:711/934@fidonet.         */
/*  and modified by Chris Moran 3:713/708@fidonet                    */
/*  Released to the Public Domain                                    */
/*                                                                   */
/*********************************************************************/
/*********************************************************************/
/*                                                                   */
/*  pdcommw.h - see pdcommw.c for doco                               */
/*                                                                   */
/*********************************************************************/

#ifndef PDCOMMW_INCLUDED
#define PDCOMMW_INCLUDED

#include <stdio.h>
#include <string.h>

#include <windows.h>
/* Unfortunately windows pollutes the namespace too much */
#ifdef ERROR
#undef ERROR
#endif

#include "error.h"

#define COMERROR "COM001 A comms error has occured\n"
#define PDCOMM_NO_PARITY 0
#define PDCOMM_EVEN_PARITY 1
#define PDCOMM_ODD_PARITY 2


typedef struct
{
    HANDLE hfile;
} PDCOMM;

void pdcommDefaults(PDCOMM *pdcomm);
void pdcommInit(PDCOMM *pdcomm, char *name);
void pdcommSetSpeed(PDCOMM *pdcomm, long bps);
void pdcommSetParms(PDCOMM *pdcomm, int parity, int data, int stop);
void pdcommRaiseDTR(PDCOMM *pdcomm);                    
void pdcommDropDTR(PDCOMM *pdcomm);                    
int pdcommWriteCh(PDCOMM *pdcomm, int ch);
size_t pdcommWriteBuf(PDCOMM *pdcomm, void *buf, size_t num);
int pdcommReadCh(PDCOMM *pdcomm);
size_t pdcommReadBuf(PDCOMM *pdcomm, void *buf, size_t num);
void pdcommTerm(PDCOMM *pdcomm);

#define pdcommSetWBuf(a, b, c, d)
#define pdcommSetRBuf(a, b, c, d)
#define pdcommWFlush(a)
#define pdcommRFlush(a)

#endif
