home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Vectronix 2
/
VECTRONIX2.iso
/
FILES_01
/
LATTIC_3.LZH
/
HEADERS
/
STDIO.H
< prev
next >
Wrap
C/C++ Source or Header
|
1990-08-21
|
6KB
|
209 lines
/*
* stdio.h - level 2 I/O interface file
*
* Started 30/8/89 Alex G. Kiernan, based on Lattice source
*
* Copyright (c) 1989 HiSoft and Lattice, Inc.
*/
#ifndef _STDIO_H
#define _STDIO_H
#ifndef _SIZE_T
#define _SIZE_T
typedef unsigned long int size_t;
#endif
__regargs long _CXCERR(long); /* always __regargs for efficiency */
#ifndef _VA_LIST
#define _VA_LIST
typedef char *va_list;
#endif
typedef struct _iobuf FILE;
typedef unsigned long fpos_t;
#define NULL ((void *)0)
#define _BUFSIZ 512 /* standard buffer size */
#define BUFSIZ _BUFSIZ /* standard buffer size */
#define OPEN_MAX 20 /* maximum number of files */
#define _NFILE OPEN_MAX /* maximum number of files */
#define FOPEN_MAX OPEN_MAX /* maximum number of files */
#define FILENAME_MAX 128 /* FMSIZE */
#define L_tmpnam 9 /* maximum tmpnam filename length */
#define TMP_MAX 17576 /* Guaranteed unique temp names */
/**
*
* Definitions associated with _iobuf._flag
*
**/
#define _IOFBF 0 /* fully buffered (for setvbuf) */
#define _IOREAD 1 /* read flag */
#define _IOWRT 2 /* write flag */
#define _IONBF 4 /* non-buffered flag */
#define _IOMYBUF 8 /* private buffer flag */
#define _IOEOF 16 /* end-of-file flag */
#define _IOERR 32 /* error flag */
#define _IOLBF 64 /* line-buffered flag */
#define _IORW 128 /* read-write (update) flag */
#define _IOAPP 0x4000 /* append flag */
#define _IOXLAT 0x8000 /* translation flag */
#define EOF (-1) /* end-of-file code */
#define SEEK_SET 0 /* Seek from beginning of file */
#define SEEK_CUR 1 /* Seek from current file position */
#define SEEK_END 2 /* Seek from end of file */
struct _iobuf {
struct _iobuf *_next;
unsigned char *_ptr; /* current buffer pointer */
int _rcnt; /* current byte count for reading */
int _wcnt; /* current byte count for writing */
unsigned char *_base; /* base address of I/O buffer */
int _size; /* size of buffer */
int _flag; /* control flags */
int _file; /* file descriptor */
unsigned char _cbuff; /* single char buffer */
};
extern struct _iobuf _iob[];
#define stdin (&_iob[0]) /* standard input file pointer */
#define stdout (&_iob[1]) /* standard output file pointer */
#define stderr (&_iob[2]) /* standard error file pointer */
#define stdaux (&_iob[3]) /* standard auxiliary file pointer */
#define stdprt (&_iob[4]) /* standard printer file pointer */
/*
* Prototypes for ANSI standard functions.
*/
#undef rename
int rename(const char *,const char *);
#ifndef __NO_STDIO_DEFINES
long _lgscc(int,int,const char *,const char *);
#pragma inline d0=_lgscc((short),(short),,) {register d2,a2; "4e41";}
#define rename(x,y) _CXCERR(_lgscc(0x56,0,x,y))
#endif
#undef remove
int remove(const char *);
#ifndef __NO_STDIO_DEFINES
long _lgc(int,const char *);
#pragma inline d0=_lgc((short),) {register d2,a2; "4e41";}
#define remove(x) _CXCERR(_lgc(0x41,x))
#endif
FILE *tmpfile(void);
char *tmpnam(char *s);
int fclose(FILE *);
int fflush(FILE *);
FILE *fopen(const char *, const char *);
FILE *freopen(const char *, const char *, FILE *);
void setbuf(FILE *, char *);
int setvbuf(FILE *, char *, int, size_t);
int fprintf(FILE *, const char *, ...);
int fscanf(FILE *, const char *, ...);
int printf(const char *, ...);
int lprintf(const char *, ...);
int scanf(const char *, ...);
int sprintf(char *, const char *, ...);
int sscanf(const char *, const char *, ...);
int vfprintf(FILE *, const char *, va_list);
int vprintf(const char *, va_list);
int vsprintf(char *, const char *, va_list);
int __builtin_printf(const char *, ...);
#define printf __builtin_printf
int fgetc(FILE *);
char *fgets(char *, int, FILE *);
int fputc(int, FILE *);
int fputs(const char *, FILE *);
int getc(FILE *);
#define getc(p) (--(p)->_rcnt>=0 ? *(p)->_ptr++ : fgetc(p))
int getchar(void);
#define getchar() getc(stdin)
char *gets(char *);
int putc(int, FILE *);
#define putc(c,p) (--(p)->_wcnt>=0 ? *(p)->_ptr++=(c) : fputc(c,p))
int putchar(int);
#define putchar(c) putc(c,stdout)
int puts(const char *);
int ungetc(int, FILE *);
size_t fread(void *, size_t, size_t, FILE *);
size_t fwrite(const void *, size_t, size_t, FILE *);
int fgetpos(FILE *, fpos_t *);
int fseek(FILE *, long int, int);
int fsetpos(FILE *, const fpos_t *);
long int ftell(FILE *);
void rewind(FILE *);
#ifndef __NO_STDIO_DEFINES
#define rewind(p) fseek(p, 0L, 0)
#endif
void clearerr(FILE *);
#define clearerr(p) ((p)->_flag &= ~(_IOERR | _IOEOF))
int feof(FILE *);
#define feof(p) (((p)->_flag & _IOEOF) != 0)
int ferror(FILE *);
#define ferror(p) (((p)->_flag & _IOERR) != 0)
void perror(const char *);
/*
* Prototypes for Non-ANSI functions.
*/
int fcloseall(void);
FILE *fdopen(int, const char *);
int fgetchar(void);
int fileno(FILE *);
int flushall(void);
void fmode(FILE *, int);
__stdargs int _writes(char *);
int _tinyprintf(char *, ...);
int fputchar(int);
int setnbf(FILE *);
int __flushbuff(int, FILE *);
int access(const char *, int);
int chdir(const char *);
int chmod(const char *, int);
char *getcwd(char *, int);
int mkdir(const char *);
int rmdir(const char *);
FILE *fopene(const char *, const char *,char *);
FILE *popen(const char *,const char *);
int pclose(FILE *);
#undef unlink
int unlink(const char *);
#ifndef __NO_STDIO_DEFINES
#define unlink remove
#endif
char *mktemp(char *s);
short fputw(short,FILE *);
long fputl(long,FILE *);
short fgetw(FILE *);
long fgetl(FILE *);
#define clrerr clearerr
#define fileno(p) ((p)->_file)
#define _flsbf __flushbuff
#define _getbf __getbuff
int _getbf(FILE *);
extern unsigned long __fmask;
extern int _fmode;
extern int _bufsiz; /* default file buffer size */
#endif