1994-06-24 11:31:16 +00:00
|
|
|
/* $Id$ */
|
1987-03-09 21:20:21 +00:00
|
|
|
/*
|
|
|
|
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
|
|
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
|
|
|
*/
|
1991-10-25 14:44:21 +00:00
|
|
|
|
|
|
|
#ifndef _STDIO_H
|
|
|
|
#define _STDIO_H
|
|
|
|
|
1987-01-27 16:33:21 +00:00
|
|
|
#define BUFSIZ 1024
|
1991-09-04 16:18:23 +00:00
|
|
|
#ifdef __vax
|
1989-02-21 10:01:55 +00:00
|
|
|
#define _NBF 8
|
|
|
|
#endif
|
1991-09-04 16:18:23 +00:00
|
|
|
#ifdef __mc68020
|
1989-02-21 10:01:55 +00:00
|
|
|
#define _NBF 8
|
|
|
|
#endif
|
|
|
|
#ifndef _NBF
|
|
|
|
#define _NBF 1
|
|
|
|
#endif
|
|
|
|
#define _BUFSIZ (_NBF * BUFSIZ)
|
1987-01-27 16:33:21 +00:00
|
|
|
#define _NFILES 20
|
|
|
|
#define NULL 0
|
|
|
|
#define EOF (-1)
|
|
|
|
|
|
|
|
#define IO_READMODE 1
|
|
|
|
#define IO_WRITEMODE 2
|
|
|
|
#define IO_UNBUFF 4
|
|
|
|
#define IO_EOF 8
|
|
|
|
#define IO_ERR 16
|
|
|
|
#define IO_MYBUF 32
|
|
|
|
#define IO_PERPRINTF 64
|
|
|
|
|
|
|
|
#ifndef FILE
|
|
|
|
|
|
|
|
extern struct _io_buf {
|
|
|
|
int _count;
|
|
|
|
int _flags;
|
|
|
|
unsigned char *_buf;
|
|
|
|
unsigned char *_ptr;
|
1989-02-21 10:01:55 +00:00
|
|
|
int _bufsiz;
|
1989-04-20 15:27:00 +00:00
|
|
|
int _fd;
|
1987-01-28 14:21:56 +00:00
|
|
|
} *_io_table[_NFILES], _stdin, _stdout, _stderr;
|
1987-01-27 16:33:21 +00:00
|
|
|
|
|
|
|
|
|
|
|
#endif /* FILE */
|
|
|
|
|
|
|
|
#define FILE struct _io_buf
|
|
|
|
|
|
|
|
|
1987-01-28 14:21:56 +00:00
|
|
|
#define stdin (&_stdin)
|
|
|
|
#define stdout (&_stdout)
|
|
|
|
#define stderr (&_stderr)
|
1987-01-27 16:33:21 +00:00
|
|
|
|
|
|
|
#define getchar() getc(stdin)
|
|
|
|
#define putchar(c) putc(c,stdout)
|
|
|
|
#define getc(p) (--(p)->_count >= 0 ? (int) (*(p)->_ptr++) : \
|
|
|
|
_fillbuf(p))
|
|
|
|
#define putc(c, p) (--(p)->_count >= 0 ? \
|
|
|
|
(int) (*(p)->_ptr++ = (c)) : \
|
|
|
|
_flushbuf((c),(p)))
|
|
|
|
#define feof(p) (((p)->_flags & IO_EOF) != 0)
|
|
|
|
#define ferror(p) (((p)->_flags & IO_ERR) != 0)
|
|
|
|
#define fileno(p) ((p)->_fd)
|
|
|
|
#define io_testflag(p,x) ((p)->_flags & (x))
|
|
|
|
|
|
|
|
/* If you want a stream to be flushed after each printf use:
|
|
|
|
*
|
|
|
|
* io_perprintf(stream);
|
|
|
|
*
|
|
|
|
* If you want to stop with this kind of buffering use:
|
|
|
|
*
|
|
|
|
* io_noperprintf(stream);
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define io_noperprintf(p) ((p)->_flags &= ~IO_PERPRINTF)
|
|
|
|
#define io_perprintf(p) ((p)->_flags |= IO_PERPRINTF)
|
|
|
|
|
|
|
|
extern FILE *fopen(), *fdopen(), *freopen(), *popen();
|
|
|
|
extern long ftell();
|
|
|
|
extern setbuf(), rewind();
|
|
|
|
extern char *fgets(), *gets();
|
1991-10-25 14:44:21 +00:00
|
|
|
|
|
|
|
#endif /* _STDIO_H */
|