home *** CD-ROM | disk | FTP | other *** search
- /* BASIC I/O Header file
-
- Copyright (c) 1983 by James F. Gimpel
- Copyright (c) 1983, 1984, 1985 by JMI Software Consultants, Inc.
- */
- #include "acom.h"
-
- #define NUMSF 7 /* Number of Special Files -- itemized below */
- #define sf_IN 0 /* Standard Input */
- #define sf_OUT 1 /* Standard Output */
- #define sf_ERR 2 /* Standard Error */
- #define sf_DATA 3 /* the data unit -- the internal
- * slot no. associated with the DATA stmts */
- #define sf_IR 4 /* Internal Read -- for redirecting input to
- * come from a string pointed to by bf_ptr */
- #define sf_IW 5 /* Internal Write -- for redirecting output
- * to a string pointed to by the bf_ptr */
- #define sf_PR 6 /* Printer -- LPRINT statements direct information
- * to this special file. Its name is an
- * administrative variable defined in admvar.c */
- #define MAX_LINE 5000 /* Maximum No. of chars. per input line */
- #define EOB -2 /* End-of-Buffer, used only for pseudo-sequential I/O */
-
- /* structure used to represent BASIC's DATA statement */
-
- typedef struct
- {
- BYTES d_line; /* line number of DATA statement */
- TEXT *d_text; /* data in DATA statement */
- } DATA;
-
- /* Basic File Structure -- one of these for each slot number */
-
- typedef struct bfstruct
- {
- INT bf_fd; /* file descriptor */
- TEXT *bf_buf; /* used as buffer or ptr */
- TEXT *bf_bufptr; /* current position within buffer */
- COUNT bf_reclen; /* record or buffer length */
- COUNT bf_count; /* chars. or pos. remaining in buffer */
- DATA **bf_dstmt; /* used by sf_DATA to
- point to current data statement */
- BITS bf_flags;
- TEXT *bf_name;
- COUNT bf_col; /* current column */
- TEXT bf_char; /* place to store an unget */
- COUNT bf_margin; /* right margin */
- LONG bf_loc; /* number of bytes read/written to sequential file */
- } BF;
-
- /* bf_flags */
-
- #define bf_ASSOC 0x01 /* slot is in use */
- #define bf_READ 0x02 /* open for reading */
- #define bf_WRITE 0x04 /* open for writing */
- #define bf_ERROR 0x08 /* an error has been detected */
- #define bf_CHAR 0x10 /* bf_char holds a character */
- #define bf_EOF 0x20 /* end-of-file has been pushed back */
- #define bf_DA 0x40 /* Direct access */
- #define bf_RECL 0x80 /* fixed length records */
- #define bf_LOCK 0x100 /* file is locked, and needs unlocking at closure */
- #define bf_KYBD 0x200 /* file is opened to keyboard */
-
- /* device line widths (see WIDTH statement) */
-
- typedef struct wdth
- {
- struct wdth *w_next;
- COUNT w_size;
- TEXT w_name[1];
- } WDTH;