home *** CD-ROM | disk | FTP | other *** search
- /*
- * stdio.h
- *
- * Copyright (C) MicroWay, Inc., 1987, 1988, 1989
- *
- */
-
- #ifndef FILE
- #define NULL 0
- #define EOF (-1)
- #define BLOCKSIZE 4096 /* block size to allocate with sbrk in malloc */
-
-
- #define BUFSIZ 8*1024 /* Default buffer size and number of buffers */
- #define _NBUFFER 1 /* when program begins execution. */
-
- #define _NFILE 64
-
- typedef struct { unsigned char *base, *lastwritable;
- unsigned char *firstvalid, *lastvalid;
- int page;
- char dirty_bit, dos_ascii,dum2,dum3; } _a_buffer;
-
- extern struct iobuf {
- _a_buffer *buffers, temp_storage;
- _a_buffer *curbuf;
- unsigned char *next, *oldnext;
- long curpos, lastpos;
- unsigned char *ref_stack;
- unsigned int bufsiz;
- unsigned char _nbuffer;
- unsigned int recsize; /* 1 for all files except fortran direct
- access unformatted files. */
-
- short io_channel; /* OS I/O channel number */
- char io_tmp; /* used by ungetc on unbuffered files */
- unsigned have_done_ungetc:1;
- unsigned io_buffering:2; /* UN_BUFFER,BLOCK_BUFFER,LINE_BUFFER*/
- unsigned io_eof: 1; /* have read end of file */
- unsigned io_error:1; /* have detected io error in file */
- unsigned io_stdio_buffer:1; /* buffer for this file created by stdio */
- unsigned io_readable:1; /* file may be read at this time */
- unsigned io_writable:1; /* file may be written at this time */
- unsigned io_readwrite:1; /* file opened for both reading and writing */
- } _iob[_NFILE];
-
- #define UN_BUFFER 0
- #define BLOCK_BUFFER 1
- #define LINE_BUFFER 2
- #define STRING_BUFFER 3
-
- #define UNKNOWN -1
- #define _MULTIBUFFERS(file) (file->io_readable && file->io_buffering ==\
- BLOCK_BUFFER && file->io_stdio_buffer &&\
- !file->curbuf->dos_ascii )
-
- #define FILE struct iobuf
- #define stdin (&_iob[0])
- #define stdout (&_iob[1])
- #define stderr (&_iob[2])
-
- #define getc(f) ((f)->next < (f)->curbuf->firstvalid || (f)->next >=\
- (f)->curbuf->lastvalid ? _filbuf(f) : *(f)->next++ )
-
- #define getchar() getc(stdin)
-
- #define putc(ch,f) ((f)->next>=(f)->curbuf->lastwritable?_flsbuf((ch),f):\
- ((f)->curbuf->dirty_bit = 1, *(f)->next++ = (ch)))
-
- #define putchar(ch) putc(ch,stdout)
- #define fileno(file) ((file)->io_channel)
- #define feof(file) ((file)->io_eof)
- #define ferror(file) ((file)->io_error)
- #define clearerr(file) ((file)->io_eof=0,(file)->io_error=0)
- #endif
-
- char *fgets(), *gets();
- char *getenv();
- FILE *fopen(), *fdopen(), *freopen();
- long strtol(), ftell(), getl(), putl();
-
- extern int _pmode;
-
- int setmode ();
- #define O_TEXT 0x4000 /* input parameter for setmode */
- #define O_BINARY 0x8000 /* input parameter for setmode */
-
-
- /* additions to stdio.h for MS-C compatibility */
-
- #define fgetchar() fgetc(stdin)
- #define fputchar() fputc(stdout)
-
-
-
- /* additions to stdlib for MS-C compatibility */
-
- #define min(a,b) ((a < b)? a : b)
- #define max(a,b) ((a > b)? a : b)
-
- #define onexit(a) atexit(a)
-
-
-