home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_100 / 101_01 / std.h < prev    next >
Text File  |  1985-11-14  |  6KB  |  183 lines

  1.  
  2. /**********************************************************
  3.  ***                            ***
  4.  ***    Copyright (c) 1981 by David M. Fogg        ***
  5.  ***                            ***
  6.  ***        2632 N.E. Fremont            ***
  7.  ***        Portland, OR 97212            ***
  8.  ***                            ***
  9.  ***        (503) 288-3502{HM} || 223-8033{WK}        ***
  10.  ***                            ***
  11.  ***    Permission is herewith granted for non-     ***
  12.  ***    commercial distribution through the BDS C    ***
  13.  ***    User's Group; any and all forms of commercial   ***
  14.  ***    redistribution are strenuously unwished-for.    ***
  15.  ***                            ***
  16.  **********************************************************/
  17.  
  18. /* ---> The BDS C Standard I/O header file    v1.4    July 18, 1980
  19.  
  20.    --> STD.H <--- (personalization of BDSCIO.H) 15 OCT 80
  21.  
  22.    23 Oct: add OR, ORR, LST, TAB
  23.    25 Oct: add FOREVER
  24.    26 Oct: add BDOS stuff (DCIO/OFLAG)
  25.    21 Nov: add ICON, OCON
  26.    22 Nov: add MAXNAM
  27.    25 Nov: add BIOS #defs
  28.    29 Nov: chg BOOL->char; add BYTE: char
  29.    6 Feb 81: fix CUROFF, CURON; VSIZ 25->24
  30.    5 Mar: add HOME, DELCH
  31. */
  32.  
  33. /*******   Console Characteristics:   *******/
  34.  
  35. #define CSTAT    16    /* Console status port    */
  36. #define CDATA    17    /* Console data port    */
  37. #define CIMASK     1    /* Console input data ready mask   */
  38. #define COMASK     2    /* Console output data ready mask  */
  39. #define CAHI    1    /* True if console status active high    */
  40. #define CRESET    0    /* True if status port needs to be reset  */
  41. #define CRESETVAL 0    /* If CRESET is true, this is the value to send */
  42.  
  43. /*---> Z-19 Terminal Parameters & Control Strings <---*/
  44.  
  45. #define HSIZ    80    /* # of columns */
  46. #define VSIZ    24    /* # of lines    */
  47.  
  48. #define BLINON    "\033x1"    /* enable 25th line */
  49. #define CLEAR    "\033E"     /* clear screen */
  50. #define CURDN    "\033B"     /* move cursor down */
  51. #define CURLEF    "\033D"     /* move cursor left */
  52. #define CUROFF    "\033x5"    /* turn cursor OFF */
  53. #define CURON    "\033y5"    /*  "     "    ON */
  54. #define CURRIT    "\033C"     /* move cursor right */
  55. #define CURUP    "\033A"     /* move cursor up */
  56. #define DELCH    "\033N"     /* del char & close up line */
  57. #define DELIN    "\033M"     /* delete current line */
  58. #define EREOL    "\033K"     /* erase to End-Of-Line */
  59. #define GRAOFF    "\033G"     /* turn OFF grafix mode */
  60. #define GRAON    "\033F"     /*  "   ON    "     "   */
  61. #define HOME    "\033H"     /* home cursor: upleft corner */
  62. #define INCHOF    "\033O"     /*  "   OFF insert char mode */
  63. #define INCHON    "\033@"     /*  "   ON    "     "    "   */
  64. #define INSLIN    "\033L"     /* insert a line */
  65. #define PADNOR    "\033y6"    /* set keypad unshifted */
  66. #define POCRT    "\033z"     /* reset term to POC status */
  67. #define RESCUR    "\033k"     /* restore cursor to saved pos */
  68. #define SAVCUR    "\033j"     /* save cursor position */
  69. #define VIDINV    "\033p"     /* set video inverse */
  70. #define VIDNOR    "\033q"     /*  "    "   normal */
  71.  
  72. #define CURLEA    "\033Y"     /* POsition CUrsor Lead-In */
  73.  
  74. /*---> Handy ASCII Characters <---*/
  75.  
  76. #define BEL    '\007'
  77. #define ESC    '\033'
  78. #define FFEED    '\014'
  79. #define TAB    '\011'
  80.  
  81. #define OR    |        /* for compatibility w/ VG vrsn */
  82. #define ORR    ||        /* (MT can't gen | char (!!!) */
  83.  
  84.  
  85. /* ---> BIOS functions <--- */
  86.  
  87. #define CONST  2     /* CONsole STatus (A->00/FF: NO/YES) */
  88. #define CONIN  3     /* CONsole INput (ret'd in A) */
  89. #define CONOUT 4     /* CONsole OUTput (char in C) */
  90. #define LIST   5     /* LIST device output (char in C) */
  91. #define PUNCH  6     /* PUNCH output (char in C) */
  92. #define READER 7     /* READER input (ret'd in A) */
  93. #define HOME   8     /* HOME selected disk head */
  94. #define SELDSK 9     /* SELect DiSK in reg C (A=0, B=1...) */
  95. #define SETTRK 10    /* SET TRacK in reg C (0..76) */
  96. #define SETSEC 11    /* SET SECtor in reg C (1..26) */
  97. #define SETDMA 12    /* BC=0080H (usually) */
  98. #define SREAD  13    /* Sector READ */
  99. #define SWRITE 14    /* Sector WRITE */
  100. #define DMADDR 0x80  /* standard DMA ADDRess */
  101.  
  102.  
  103. /* ---> BDOS functions <--- */
  104.  
  105. #define DCIO      6          /* Direct Console I/O (non-echoing) */
  106. #define OFLAG      0xFF          /* Output mode Flag for DCIO */
  107.  
  108. /**********************************************************************
  109.     General purpose Symbolic constants:
  110. ***********************************************************************/
  111.  
  112. #define BASE 0        /* Base of CP/M system RAM (0 or 0x4200)  */
  113.  
  114. #define NULL 0        /* Used by some functions to indicate zilch */
  115.  
  116. #define READ   0    /* unbuff file I/O mode: input only */
  117. #define WRITE  1    /*   "     "    "   "     output "   */
  118. #define UPDATE 2    /*   "     "    "   "     in & out   */
  119.  
  120. #define EOF -1        /* Physical EOF returned by low level I/O functions */
  121. #define CEOF 255    /* EOF enharmonic if in a char var */
  122.  
  123. #define ERROR -1    /* General "on error" return value */
  124.  
  125. #define OK 0        /* General purpose "no error" return value */
  126.  
  127. #define CPMEOF 0x1a    /* CP/M End-of-text-file marker (sometimes!)  */
  128.  
  129. #define SECSIZ 128    /* Sector size for CP/M read/write calls */
  130.  
  131. #define MAXNAM     15    /* longest CP/M filename */
  132.  
  133. #define MAXLINE 135    /* Longest line of input expected from the console */
  134.  
  135. #define TRUE 1        /* general purpose true value */
  136. #define YES  1        /* ditto */
  137.  
  138. #define FALSE 0     /* general purpose false value */
  139. #define NO    0     /* ditto */
  140.  
  141. #define BOOL  char    /* pseudo-typedef */
  142. #define BYTE  char    /* ditto above */
  143.  
  144. #define FOREVER   for (;;)
  145.  
  146. /*******   Number of sectors to use for buffered I/O: ***********
  147.  *                                *
  148.  * Make sure you use declare all your I/O buffers with the a    *
  149.  * statement such as:                        *
  150.  *        char buf_name[BUFSIZ];                *
  151.  *    (and always #include "dmfio.h" in your programs!)      *
  152.  ****************************************************************/
  153.  
  154. #define ICON    0    /* "iobuf" of Keyboard */
  155. #define OCON    1    /* "iobuf" of CRT screen */
  156. #define LST    2    /* "iobuf" of Printer */
  157.  
  158. #define NSECTS    8    /* Number of sectors to buffer up in ram */
  159.  
  160. #define BUFSIZ (NSECTS * SECSIZ + 6 )    /* Don't touch this */
  161.  
  162. struct _buf {                /* Or this...        */
  163.     int _fd;
  164.     int _nleft;
  165.     char *_nextp;
  166.     char _buff[NSECTS * SECSIZ];
  167. };
  168.  
  169. #define ALLOC_ON 1    /* enables storgage allocation if uncommented */
  170.  
  171.  
  172. #ifdef ALLOC_ON         /* if storage allocation enabled, */
  173.  
  174. struct _header    {
  175.     struct _header *_ptr;
  176.     unsigned _size;
  177.  };
  178.  
  179. struct _header _base;        /* declare this external data to  */
  180. struct _header *_allocp;    /* be used by alloc() and free()  */
  181.  
  182. #endif
  183.