home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_200 / 213_01 / bdscio.h < prev    next >
Text File  |  1979-12-31  |  3KB  |  114 lines

  1. /* BDSCIO.H    VERS:- 01.00  DATE:- 09/26/86  TIME:- 09:36:00 PM */
  2. /* 
  3. Description:
  4.  
  5. Standard header file.
  6.  
  7. From Van Nuys Toolkit and the BDS-C distribution package.
  8.  
  9. By J.A. Rupley, Tucson, Arizona
  10. Coded for BDS C compiler, version 1.50a
  11. */
  12. /*
  13.  *    The BDS C Standard I/O header file --  v1.50    12/29/82
  14.  *
  15.  *    This file contains global definitions, for use in all C programs
  16.  *    in PLACE of (yechhh) CONSTANTS. Characteristics of your system such
  17.  *    buffered I/O allocations, storage allocator state, etc., should all
  18.  *    be configured just once within this file. Any program which needs
  19.  *    them should contain the preprocessor directive:
  20.  *
  21.  *        #include <bdscio.h>
  22.  *
  23.  *    near the beginning. 
  24.  */
  25.  
  26.  
  27. /*
  28.  *    General purpose Symbolic constants:
  29.  */
  30.  
  31. #define BASE 0        /* Base of CP/M system RAM (0 or 0x4200)  */
  32. #define NULL 0
  33. #define EOF -1        /* Physical EOF returned by low level I/O functions */
  34. #define ERROR -1    /* General "on error" return value */
  35. #define OK 0        /* General purpose "no error" return value */
  36. #define JBUFSIZE 6    /* Length of setjump/longjump buffer    */
  37. #define CPMEOF 0x1a    /* CP/M End-of-text-file marker (sometimes!)  */
  38. #define SECSIZ 128    /* Sector size for CP/M read/write calls */
  39. #define MAXLINE 150    /* Longest line of input expected from the console */
  40. #define TRUE 1        /* logical true constant */
  41. #define FALSE 0        /* logical false constant */
  42. #DEFINE THEN {
  43. #DEFINE LOOP {
  44. #DEFINE ENDIF }
  45. #DEFINE ENDLOOP }
  46. #DEFINE FUNCTION /**/
  47.  
  48. #DEFINE STDIN  0
  49. #DEFINE STDOUT 1
  50. #DEFINE STDERR 4
  51. #DEFINE STDLST 2
  52. #DEFINE STDRDR 3
  53. #DEFINE STDPUN 3
  54.  
  55. /* FOR USE WITH OPEN */
  56. #DEFINE READ   0
  57. #DEFINE WRITE  1
  58. #DEFINE READWRITE 2
  59.  
  60. /*
  61.  *    The NSECTS symbol controls the compilation of the buffered
  62.  *    I/O routines within STDLIB2.C, allowing each user to set the
  63.  *    buffer size most convenient for his system, while keeping
  64.  *    the numbers totally invisible to the C source programs using
  65.  *    buffered I/O (via the BUFSIZ defined symbol.) For larger
  66.  *    NSECTS, the disk I/O is faster...but more ram is taken up.
  67.  *    To change the buffer size allocation, follow these steps:
  68.  *
  69.  *    1) Change NSECTS below
  70.  *    2) Re-compile STDLIB1.C and STDLIB2.C
  71.  *    3) Use CLIB to combine STDLIB1.CRL and STDLIB2.CRL to make
  72.  *       a new DEFF.CRL. This isn't as touch as it sounds.
  73.  *
  74.  *    Make sure you declare all your I/O buffers with the a
  75.  *    statement such as:
  76.  *
  77.  *        char buf_name[BUFSIZ];
  78.  */
  79.  
  80. #define NSECTS 8    /* Number of sectors to buffer up in ram */
  81.  
  82. #define BUFSIZ (NSECTS * SECSIZ + 7)    /* Don't touch this */
  83.  
  84. struct _buf {                /* Or this...        */
  85.     int _fd;
  86.     int _nleft;
  87.     char *_nextp;
  88.     char _buff[NSECTS * SECSIZ];
  89.     char _flags;
  90. };
  91.  
  92. #define FILE struct _buf    /* Poor man's "typedef" */
  93.  
  94. #define _READ 1
  95. #define _WRITE 2
  96.  
  97. struct _long {char _lc[2];};
  98. struct _float {char _ft[5];};
  99. #define LONG struct _long    /* LONG typedef */
  100. #define FLOAT struct _float    /* FLOAT typedef */
  101. #define REAL struct _float    /* REAL typedef */
  102.  
  103. /*
  104.  * Storage allocation data, used by "alloc" and "free"
  105.  */
  106.  
  107. struct _header  {
  108.     struct _header *_ptr;
  109.     unsigned _size;
  110.  };
  111.  
  112. struct _header _base;        /* declare this external data to  */
  113. struct _header *_allocp;    /* be used by alloc() and free()  */
  114.