#ifndef STDIO_H #define STDIO_H 1 #ifndef NULL #define NULL 0L #endif #define EOF -1 /* size of the buffer for buffered files... */ #define BUFSIZ 1024L #define _BUSY (1<<0) #define _ALLBUF (1<<1) #define _DIRTY (1<<2) #define _EOF (1<<3) #define _IOERR (1<<4) #define _TEMP (1<<5) /* Flags for setvbuf */ #define _IOFBF 1L #define _IOLBF 2L #define _IONBF 3L /* errors from setvbuf */ #define HASBUF 1L #define NOBUFMEM 2L /* seek positions */ #define SEEK_SET 0L #define SEEK_CUR 1L #define SEEK_END 2L typedef struct { long _unit; /* token returned by open -> FileDesc */ char *_bp; /* position in character buffer */ char *_bend; /* end of buffer */ char *_buff; /* start */ char _flags; /* open mode */ char _bytbuf; /* single character buffer (non-bufered files) */ short _buflen; /* # characters in buffer */ char *_tmpname; /* temporary file name */ } FILE; extern FILE *stdin, *stdout, *stderr; /* use function calls instead, if NOMACROS is defined */ #ifndef NOMACROS #define getchar() agetc(stdin) #define putchar(c) aputc(c, stdout) #else short getchar(); short putchar(); #endif /* macros... */ #define feof(STREAM) ( ((FILE *)STREAM)->_flags&_EOF ) #define ferror(STREAM) ( ((FILE *)STREAM)->_flags&_IOERR ) #define clearerr(STREAM) ( ((FILE *)STREAM)->_flags &= ~(_IOERR|_EOF) ) #define fileno(STREAM) ( ((FILE *)STREAM)->_unit ) #define rewind(STREAM) (fseek((FILE *)STREAM, 0L, SEEK_SET)) #define remove(NAME) ( unlink((char *)NAME) ) #define setbuf(STREAM,BUFFER)\ (setvbuf(STREAM,BUFFER,BUFFER ? _IOFBF : _IONBF,BUFSIZ)) #define fgetc(STREAM) ((int)agetc(STREAM)) #define fputc(CH,STREAM) ((int)aputc((int)CH,STREAM)) /* The name of the C DLL is here. */ #define CCLIBNAME "CClib.library" /* The only practical limit to the number of * opened files is the amount of memory in the * computer. */ #define FOPEN_MAX 2147483647L /* the length of a temporary file name */ #define L_tmpnam 30 #define TMP_MAX FOPEN_MAX /* The theoretical maximum of the number of * characters in a file is 107 but the current * limit is set to 30. This doesn't include * the path name. */ #define FILENAME_MAX 107 typedef unsigned long size_t; typedef long fpos_t; #ifdef ANSIC #ifndef STDARG_H #include "stdarg.h" #endif FILE *fopen(char *,char *); FILE *freopen(char *, char *, FILE *); long fflush(FILE *); long fclose(FILE *); long unlink(char *); long rename(char *,char *); FILE *tmpfile(void); char *tmpnam(char *); long setvbuf(FILE *,char *,long,size_t); long fprintf(FILE *, char *, ...); long printf(char *, ...); long sprintf(char *, char *, ...); long vprintf(char *,va_list); long vfprintf(FILE *,char *,va_list); long vsprintf(char *,char *,va_list); long fscanf(FILE *, char *, ...); long scanf(char *, ...); long sscanf(char *, char *, ...); char *fgets(char *, long, FILE *); long fputs(char *, FILE *); short getc(FILE *); char *gets(char *); short putc(short ,FILE *); short aputc(short, FILE *); short agetc(FILE *); short puts(char *); short ungetc(short,FILE *); size_t fread(void *,size_t,size_t,FILE *); size_t fwrite(void *,size_t,size_t,FILE *); long fseek(FILE *,long,long); long ftell(FILE *); long fgetpos(FILE *,fpos_t *); long fsetpos(FILE *,fpos_t *); long perror(char *); #else FILE *fopen(); FILE *freopen(); long fflush(); long fclose(); long unlink(); long rename(); FILE *tmpfile(); char *tmpnam(); long setvbuf(); long fprintf(); long printf(); long sprintf(); long vprintf(); long vfprintf(); long vsprintf(); long fscanf(); long scanf(); long sscanf(); char *fgets(); long fputs(); short getc(); char *gets(); short putc(); short aputc(); short agetc(); short puts(); short ungetc(); size_t fread(); size_t fwrite(); long fseek(); long ftell(); long fgetpos(); long fsetpos(); long perror(); #endif #endif