home *** CD-ROM | disk | FTP | other *** search
- /*_ stdio.h Mon Oct 3 1988 Modified by: Walter Bright */
- /* Copyright (C) 1985-1988 by Northwest Software */
- /* All rights reserved. */
-
- /* Standard I/O header file */
-
- #ifndef STDIO_H /* if not already included */
- #define STDIO_H
-
- #define _NFILE 20 /* # of files we can have open at once */
- #define EOF (-1)
-
- #define SEEK_SET 0 /* seek from start of file */
- #define SEEK_CUR 1 /* relative to current position */
- #define SEEK_END 2 /* relative to end of file */
-
- #ifdef LPTR
- #define NULL 0L
- #else
- #define NULL 0
- #endif
-
- /* I/O buffer size */
- #define BUFSIZ 512
- #ifdef SPTR
- #define BIGBUF (40 * BUFSIZ)
- #endif
-
- #ifndef size_t
- #define size_t unsigned
- #endif
-
- /**** structure for high level file I/O ********/
-
- typedef struct
- {
- char *_ptr; /* pointer to next character position */
- int _cnt; /* number of characters left in buffer */
- char *_base; /* pointer to start of buffer */
- int _flag; /* various info about this channel */
- int _file; /* file "handle" */
- unsigned _bufsiz; /* size of buffer being used */
- #ifdef BIGBUF
- int _seg; /* segment of buffer if _IOBIGBUF */
- #endif
- } FILE;
-
- extern FILE _iob[_NFILE];
-
- /***********************
- * Flags for FILE._flag
- * _IOREAD file is opened for read
- * _IOWRT file is opened for write
- * _IONBF file I/O is not buffered
- * _IOLBF file is line buffered
- * _IOFBF file is fully buffered
- * _IOEOF end of file has occurred
- * _IOERR error has occurred
- * _IORW file is opened for reading and writing
- * _IOTRAN I/O is translated (not binary)
- * _IOBIGBUF the buffer is outside the data segment
- * _IOMYBUF buffer allocated by setvbuf()
- */
-
- #define _IOREAD 1
- #define _IOWRT 2
- #define _IONBF 4
- #define _IOMYBUF 8
- #define _IOEOF 0x10
- #define _IOERR 0x20
- #define _IOLBF 0x40
- #define _IORW 0x80
- #define _IOFBF 0
-
- #define _IOTRAN 0x100
- #ifdef BIGBUF
- #define _IOBIGBUF 0x400
- #endif
-
- #define stdin (&_iob[0])
- #define stdout (&_iob[1])
- #define stderr (&_iob[2])
- #define stdaux (&_iob[3])
- #define stdprn (&_iob[4])
-
- #define getchar() getc(stdin)
- #define putchar(c) putc((c),stdout)
- #define getc(fp) fgetc(fp)
- #define putc(c,fp) fputc((c),(fp))
-
- #define fileno(fp) ((fp)->_file)
- #define ferror(fp) ((fp)->_flag&_IOERR)
- #define feof(fp) ((fp)->_flag&_IOEOF)
- #define clearerr(fp) ((fp)->_flag&=~(_IOERR|_IOEOF))
- #define rewind(fp) (fseek(fp,0L,0),((fp)->_flag&=~_IOERR))
-
- #if 0
- #define max(x,y) (((x) > (y)) ? (x) : (y))
- #define min(x,y) (((x) > (y)) ? (y) : (x))
- #endif
-
- extern int bdos(char,...);
- extern int getche(void),getch(void);
- extern FILE *fopen(char *,char *),*freopen(char *,char *,FILE *);
- extern int fseek(FILE *,long,int);
- extern long ftell(FILE *),filesize(char *);
- extern char *gets(char *),*fgets(char *,unsigned,FILE *);
- extern int fgetc(FILE *);
- extern int fflush(FILE *),fclose(FILE *);
- extern int flushall(void);
- extern int fcloseall(void);
- extern int fwrite(void *,unsigned,unsigned,FILE *);
- extern int fread(void *,unsigned,unsigned,FILE *);
- extern int fputs(char *,FILE *),fputc(int,FILE *);
- extern int puts(char *),ungetc(int,FILE *);
- extern int printf(char *,...),fprintf(FILE *,char *,...);
- extern int vfprintf(FILE *,char *,char *);
- extern int vprintf(char *,char *);
- extern int sprintf(char *,char *,...),vsprintf(char *,char *,char *);
- extern int scanf(char *,...),fscanf(FILE *,char *,...),
- sscanf(char *,char *,...);
- extern void setbuf(FILE *,char *);
- extern int setvbuf(FILE *,char *,int,size_t);
- extern int rename(char *,char *);
-
- #endif /* STDIO_H */
-
-