#ifndef lint
static char rcsid[] = "$Header: /ful/chris/ctex_dist/lib/RCS/fio.c,v 1.1 84/05/20 23:12:06 chris Exp $";
#endif

/* File I/O subroutines for getting bytes, words, 3bytes, and longwords */

#include <stdio.h>
#include "types.h"
#include "fio.h"

static char eofmsg[] = "unexpected EOF";

#define fGetByte(fp,r) ((r) = getc (fp))

#define make(name,func,signextend) \
name (fp) \
register FILE *fp; \
{ \
    register n; \
    func (fp, n); \
    if (feof (fp)) \
	error (1, 0, eofmsg); \
    return signextend (n); \
}

make (GetByte, fGetByte, Sign8)
make (GetWord, fGetWord, Sign16)
make (Get3Byte, fGet3Byte, Sign24)
make (GetLong, fGetLong, )
