/************************************************************************** * This program is Copyright (C) 1986-2002 by Jonathan Payne. JOVE is * * provided by Jonathan and Jovehacks without charge and without * * warranty. You may copy, modify, and/or distribute JOVE, provided that * * this notice is included in all the source files and documentation. * **************************************************************************/ #ifdef NO_JSTDOUT extern void scr_putchar(char c); /* defined in win32.c */ # ifdef IBMPCDOS # define flushscreen() { } # else /* !IBMPCDOS */ extern void flushscreen(void); # endif /* !IBMPCDOS */ #else /* !NO_JSTDOUT */ extern File *jstdout; # define scr_putchar(c) f_putc((c), jstdout) extern void flushscreen(void); #endif /* !NO_JSTDOUT */ #define f_putc(c, fp) { while (--(fp)->f_cnt < 0) flushout(fp); *(fp)->f_ptr++ = (c); } #define f_getc(fp) \ ((--(fp)->f_cnt < 0) ? f_filbuf(fp) : ZXRC(*(fp)->f_ptr++)) #define f_eof(fp) (((fp)->f_flags & F_EOF) != 0) /* typedef struct FileStruct File in jove.h */ struct FileStruct { int f_cnt, /* number of characters left in buffer */ f_bufsize, /* size of what f_base points to */ f_fd, /* fildes */ f_flags; /* various flags */ char *f_ptr, /* current offset */ *f_base; /* pointer to base */ char *f_name; /* name of open file */ }; #define F_READ 01 #define F_WRITE 02 #define F_APPEND 04 #define F_MODE(x) ((x)&07) #define F_EOF 010 #define F_STRING 020 #define F_ERR 040 #define F_LOCKED 0100 /* don't close this file upon error */ #define F_MYBUF 0200 /* f_alloc allocated the buffer, so f_close knows to free it up */ #define F_TELLALL 0400 /* whether to display info upon close */ #define F_READONLY 01000 /* file is read only */ #define F_LINETOOLONG 02000 /* read lines that are too long */ /* ScrBufSize is the size of the buffer for jstdout. It is also the * number of characters to be output between checks for input, so * it is meaningful even if jstdout isn't used. Its value is set by * settout based on the baud rate of output (on systems with baud rates). */ extern int ScrBufSize; extern File *f_open(const char *name, int flags, char *buffer, int buf_size), *fd_open(const char *name, int flags, int fd, char *buffer, int bsize); extern int f_filbuf(File *fp); #ifdef PIPEPROCS extern size_t f_readn(File *fp,char *addr,size_t n); #endif extern void f_close(File *fp), f_seek(File *fp, off_t offset), f_toNL(File *fp), flushout(File *fp), fputnchar(char *s,int n,File *fp), gc_openfiles(void), putstr(const char *s); extern jbool f_gets(File *fp,char *buf,size_t max);