home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
rtsi.com
/
2014.01.www.rtsi.com.tar
/
www.rtsi.com
/
OS9
/
OSK
/
EFFO
/
pd6.lzh
/
SRC
/
io.h
< prev
next >
Wrap
Text File
|
1989-12-21
|
1KB
|
83 lines
/*
C BASED FORTH-83 MULTI-TASKING IO MANAGEMENT DEFINITIONS
Copyright (c) 1989 by Mikael R.K. Patel
*/
/* INCLUDE FILES: STANDARD INPUT/OUTPUT */
#include <stdio.h>
/* STANDARD INPUT AND OUTPUT DESCRIPTORS */
#define STDIN 0
#define STDOUT 1
/* WHITE SPACE DEFINITION AND CHARACTER MASK */
#define ISSPACE(c) ((c) <= ' ')
#define CMASK 0377
/* FILE BUFFER DEFINITION */
#define BUFSIZE 1024
typedef struct {
int fd;
int bufp;
int cc;
char buf[BUFSIZE];
} FILE_BUFFER;
extern FILE_BUFFER *io_fstack[];
extern int io_fsp;
/* APPEND ORDER FOR IO_PATH */
#define IO_PATH_FIRST 1
#define IO_PATH_LAST 0
/* IO MANAGE ERROR CODES */
#define IO_NO_ERROR 0
#define IO_EOF -1
#define IO_PATH_DEFINED -1
#define IO_FILE_INCLUDED -1
#define IO_UNKNOWN_FILE -2
#define IO_UNKNOWN_PATH -2
#define IO_TOO_MANY_PATHS -3
#define IO_TOO_MANY_FILES -3
/* EXPORTED MACROS, FUNCTIONS, AND PROCEDURES */
#define io_getchar() \
((io_fstack[io_fsp] -> bufp < io_fstack[io_fsp] -> cc) ? \
(long) io_fstack[io_fsp] -> buf[io_fstack[io_fsp] -> bufp++] & CMASK : \
(long) io_fillbuf())
#define io_eof() (io_fsp == -1)
#define io_not_eof() (io_fsp > -1)
int io_path();
int io_infile();
int io_fillbuf();
void io_flush();
void io_skip();
void io_scan();
void io_skipspace();
void io_initiate();
void io_finish();