home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 9 / 09.iso / l / l200 / 6.ddi / LIB / BIO.H < prev    next >
Encoding:
C/C++ Source or Header  |  1986-08-21  |  2.5 KB  |  72 lines

  1. /*    BASIC I/O Header file
  2.  
  3.     Copyright (c) 1983 by James F. Gimpel
  4.     Copyright (c) 1983, 1984, 1985 by JMI Software Consultants, Inc.
  5. */
  6. #include "acom.h"
  7.  
  8. #define NUMSF 7        /* Number of Special Files --  itemized below */
  9. #define sf_IN    0    /* Standard Input */
  10. #define sf_OUT    1    /* Standard Output */
  11. #define sf_ERR    2    /* Standard Error */
  12. #define sf_DATA 3    /* the data unit -- the internal
  13.                      * slot no. associated with the DATA stmts */
  14. #define sf_IR 4        /* Internal Read -- for redirecting input to
  15.                      * come from a string pointed to by bf_ptr */
  16. #define sf_IW 5        /* Internal Write -- for redirecting output
  17.                      * to a string pointed to by the bf_ptr */
  18. #define sf_PR 6        /* Printer -- LPRINT statements direct information
  19.                      * to this special file.  Its name is an 
  20.                      * administrative variable defined in admvar.c */
  21. #define MAX_LINE 5000    /* Maximum No. of chars. per input line  */
  22. #define EOB -2        /* End-of-Buffer, used only for pseudo-sequential I/O */
  23.  
  24. /* structure used to represent BASIC's DATA statement */
  25.  
  26. typedef struct
  27.     {
  28.     BYTES d_line;        /* line number of DATA statement */
  29.     TEXT *d_text;        /* data in DATA statement */
  30.     } DATA;
  31.  
  32. /*    Basic File Structure -- one of these for each slot number */
  33.  
  34. typedef struct bfstruct
  35.     {
  36.     INT  bf_fd;            /* file descriptor */
  37.     TEXT *bf_buf;        /* used as buffer or ptr */
  38.     TEXT *bf_bufptr;    /* current position within buffer */
  39.     COUNT bf_reclen;    /* record or buffer length */
  40.     COUNT bf_count;        /* chars. or pos. remaining in buffer */
  41.     DATA **bf_dstmt;        /* used by sf_DATA to 
  42.                         point to current data statement */
  43.     BITS bf_flags;
  44.     TEXT *bf_name;
  45.     COUNT bf_col;        /* current column */
  46.     TEXT  bf_char;        /* place to store an unget */
  47.     COUNT bf_margin;    /* right margin */
  48.     LONG bf_loc;        /* number of bytes read/written to sequential file */
  49.     } BF;
  50.  
  51. /*    bf_flags    */
  52.  
  53. #define bf_ASSOC    0x01    /* slot is in use */
  54. #define bf_READ        0x02    /* open for reading */
  55. #define bf_WRITE    0x04    /* open for writing */
  56. #define bf_ERROR    0x08    /* an error has been detected */
  57. #define bf_CHAR        0x10    /* bf_char holds a character */
  58. #define bf_EOF        0x20    /* end-of-file has been pushed back */
  59. #define bf_DA        0x40    /* Direct access */
  60. #define bf_RECL        0x80    /* fixed length records */
  61. #define bf_LOCK        0x100    /* file is locked, and needs unlocking at closure */
  62. #define bf_KYBD        0x200    /* file is opened to keyboard */
  63.  
  64. /*    device line widths (see WIDTH statement) */
  65.  
  66. typedef struct wdth
  67.     {
  68.     struct wdth *w_next;
  69.     COUNT w_size;
  70.     TEXT w_name[1];
  71.     } WDTH;
  72.