home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 1 / 1340 / setup.h < prev   
Encoding:
C/C++ Source or Header  |  1990-12-28  |  3.0 KB  |  79 lines

  1. /*
  2.  * Setup the variables for the kef subroutines.
  3.  * This header file includes config.h which has
  4.  * been generated from config.h.SH by the Configure script,
  5.  * which in turn was generated by metaconfig.
  6.  *
  7.  * config.h includes only simple definitions for variables.
  8.  * If you want to have complex ones we have to do it yourself.
  9.  * This comes from the way metaconfig is working. Maybe a future version
  10.  * has this problem fixed.
  11.  *
  12.  * sccsid = @(#)  setup.h  (v1.3 4/24/90)
  13.  *
  14.  */
  15.  
  16. # include "config.h"
  17.  
  18. /*
  19.  * Several ways are possible to determine whether input is available.
  20.  * there is at least one character available.
  21.  * 
  22.  * - USE_SELECT : select(2) is available and works. This is usually the case
  23.  *        on 4BSD derived systems like 43BSD, SunOS 3.5.
  24.  *        returns:
  25.  *        0 : no characters available, timeout
  26.  *        -1: some error, like intr, error number in errno.
  27.  *        else : (1 << fd) : filedescriptor for which stuff is available
  28.  * - USE_RDCHK : rdchk is available. Call as
  29.  *            ret = rdchk(fd)
  30.  *        it returns : -1 : error, 0 : no char available, 1 : char available
  31.  *        This is usually the case on SYS III derived systems
  32.  * - USE_FIONREAD: there is an ioctl which returns the number of characters
  33.  *         available.
  34.  *        Call it as:
  35.  *            ret = ioctl (fd, FIONREAD, &num)
  36.  *            int num;
  37.  *        where the number of characters is returned in num.
  38.  *        This is usually the case on 4BSD systems. On some systems both
  39.  *        rdchk and FIONREAD are available (Sinix 2.1), on some both
  40.  *        select and FIONREAD are possible (BSD), use select then.
  41.  */
  42.  
  43. /*
  44.  * What method should the "wait" routine use to wait for input
  45.  * to become available?
  46.  * One of the flags
  47.  *        WAITSELECT
  48.  *        SEERDCHK
  49.  * must be set.
  50.  * Define symbol KEF_SEE_C with one of the symbols USE_SELECT or USE_RDCHK.
  51.  * If you specify WAITSELECT the "wait" routine calls "select". The operating
  52.  * system (UNIX) stops the process and wakens it if either a specified
  53.  * timeout expired or some character(s) are available. Thus your process
  54.  * does not spend time.
  55.  * If you specify WAITRDCHK the "wait" routine will execute a loop when
  56.  * it is waiting for characters checking with the "see" routine in each
  57.  * pass through the loop for input. This is only done when the prefix of
  58.  * a string in the database is found, and typically does not spend much
  59.  * processor time. For example, if you push a key that sends "\E[A" the
  60.  * three characters are made available rather quickly to the program.
  61.  * If you are lucky it takes only one read to get them, most often it takes
  62.  * 2 reads : "[" and "A" are made available while the "\E" is being processed
  63.  * by the program.
  64.  */
  65.  
  66. /*
  67.  * Some parts of the program uses a routine to copy memory from
  68.  * one place to another. The destination does never overlap the target.
  69.  * BSD systems have bcopy, SYS 5 systems have memcpy. If your system
  70.  * has both, bcopy is preferred, if your system has none, I supply my own.
  71.  * Define FASTCOPY(source,target,length)
  72.  */
  73. #ifdef BCOPY
  74. #    define FASTCOPY(s,t,l)    (void)bcopy(s,t,l)
  75. #endif
  76. #if defined(MEMCPY) && ! defined(BCOPY)
  77. #    define FASTCOPY(s,t,l)    (void)memcpy(t,s,l)
  78. #endif
  79.