home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 4 / DATAFILE_PDCD4.iso / utilities / utilss / sockets / include / sys / h / tty < prev    next >
Encoding:
Text File  |  1995-01-11  |  4.7 KB  |  155 lines

  1. /*
  2.  * $Header: /ax/networking:include/sys/tty.h:networking  1.1  $
  3.  * $Source: /ax/networking:include/sys/tty.h: $
  4.  *
  5.  * Copyright (c) 1988 Acorn Computers Ltd., Cambridge, England
  6.  *
  7.  * $Log:    tty.h,v $
  8.  * Revision 1.1  95/01/11  10:20:03  kwelton
  9.  * Initial revision
  10.  * 
  11.  * Revision 1.3  88/06/17  20:22:05  beta
  12.  * Acorn Unix initial beta version
  13.  * 
  14.  */
  15. /* @(#)tty.h    1.2 87/05/15 3.2/4.3NFSSRC */
  16. /*
  17.  * Copyright (c) 1982, 1986 Regents of the University of California.
  18.  * All rights reserved.  The Berkeley software License Agreement
  19.  * specifies the terms and conditions for redistribution.
  20.  *
  21.  *    @(#)tty.h    7.1 (Berkeley) 6/4/86
  22.  */
  23.  
  24. #ifdef KERNEL
  25. #include "ttychars.h"
  26. #include "ttydev.h"
  27. #else
  28. #include <sys/ttychars.h>
  29. #include <sys/ttydev.h>
  30. #endif
  31.  
  32. /*
  33.  * A clist structure is the head of a linked list queue
  34.  * of characters.  The characters are stored in blocks
  35.  * containing a link and CBSIZE (param.h) characters. 
  36.  * The routines in tty_subr.c manipulate these structures.
  37.  */
  38. struct clist {
  39.     int    c_cc;        /* character count */
  40.     char    *c_cf;        /* pointer to first char */
  41.     char    *c_cl;        /* pointer to last char */
  42. };
  43.  
  44. /*
  45.  * Per-tty structure.
  46.  *
  47.  * Should be split in two, into device and tty drivers.
  48.  * Glue could be masks of what to echo and circular buffer
  49.  * (low, high, timeout).
  50.  */
  51. struct tty {
  52.     union {
  53.         struct {
  54.             struct    clist T_rawq;
  55.             struct    clist T_canq;
  56.         } t_t;
  57. #define    t_rawq    t_nu.t_t.T_rawq        /* raw characters or partial line */
  58. #define    t_canq    t_nu.t_t.T_canq        /* raw characters or partial line */
  59.         struct {
  60.             struct    buf *T_bufp;
  61.             char    *T_cp;
  62.             int    T_inbuf;
  63.             int    T_rec;
  64.         } t_n;
  65. #define    t_bufp    t_nu.t_n.T_bufp        /* buffer allocated to protocol */
  66. #define    t_cp    t_nu.t_n.T_cp        /* pointer into the ripped off buffer */
  67. #define    t_inbuf    t_nu.t_n.T_inbuf    /* number chars in the buffer */
  68. #define    t_rec    t_nu.t_n.T_rec        /* have a complete record */
  69.     } t_nu;
  70.     struct    clist t_outq;        /* device */
  71.     int    (*t_oproc)();        /* device */
  72.     struct    proc *t_rsel;        /* tty */
  73.     struct    proc *t_wsel;
  74.                 caddr_t    T_LINEP;    /* ### */
  75.     caddr_t    t_addr;            /* ??? */
  76.     dev_t    t_dev;            /* device */
  77.     int    t_flags;        /* some of both */
  78.     int    t_state;        /* some of both */
  79.     short    t_pgrp;            /* tty */
  80.     char    t_delct;        /* tty */
  81.     char    t_line;            /* glue */
  82.     char    t_col;            /* tty */
  83.     char    t_ispeed, t_ospeed;    /* device */
  84.     char    t_rocount, t_rocol;    /* tty */
  85.     struct    ttychars t_chars;    /* tty */
  86.     struct    winsize t_winsize;    /* window size */
  87. /* be careful of tchars & co. */
  88. #define    t_erase        t_chars.tc_erase
  89. #define    t_kill        t_chars.tc_kill
  90. #define    t_intrc        t_chars.tc_intrc
  91. #define    t_quitc        t_chars.tc_quitc
  92. #define    t_startc    t_chars.tc_startc
  93. #define    t_stopc        t_chars.tc_stopc
  94. #define    t_eofc        t_chars.tc_eofc
  95. #define    t_brkc        t_chars.tc_brkc
  96. #define    t_suspc        t_chars.tc_suspc
  97. #define    t_dsuspc    t_chars.tc_dsuspc
  98. #define    t_rprntc    t_chars.tc_rprntc
  99. #define    t_flushc    t_chars.tc_flushc
  100. #define    t_werasc    t_chars.tc_werasc
  101. #define    t_lnextc    t_chars.tc_lnextc
  102. };
  103.  
  104. #define    TTIPRI    28
  105. #define    TTOPRI    29
  106.  
  107. /* limits */
  108. #define    NSPEEDS    16
  109. #define    TTMASK    15
  110. #define    OBUFSIZ    100
  111. #define    TTYHOG    255
  112. #ifdef KERNEL
  113. short    tthiwat[NSPEEDS], ttlowat[NSPEEDS];
  114. #define    TTHIWAT(tp)    tthiwat[(tp)->t_ospeed&TTMASK]
  115. #define    TTLOWAT(tp)    ttlowat[(tp)->t_ospeed&TTMASK]
  116. extern    struct ttychars ttydefaults;
  117. #endif
  118.  
  119. /* internal state bits */
  120. #define    TS_TIMEOUT    0x000001    /* delay timeout in progress */
  121. #define    TS_WOPEN    0x000002    /* waiting for open to complete */
  122. #define    TS_ISOPEN    0x000004    /* device is open */
  123. #define    TS_FLUSH    0x000008    /* outq has been flushed during DMA */
  124. #define    TS_CARR_ON    0x000010    /* software copy of carrier-present */
  125. #define    TS_BUSY        0x000020    /* output in progress */
  126. #define    TS_ASLEEP    0x000040    /* wakeup when output done */
  127. #define    TS_XCLUDE    0x000080    /* exclusive-use flag against open */
  128. #define    TS_TTSTOP    0x000100    /* output stopped by ctl-s */
  129. #define    TS_HUPCLS    0x000200    /* hang up upon last close */
  130. #define    TS_TBLOCK    0x000400    /* tandem queue blocked */
  131. #define    TS_RCOLL    0x000800    /* collision in read select */
  132. #define    TS_WCOLL    0x001000    /* collision in write select */
  133. #define    TS_NBIO        0x002000    /* tty in non-blocking mode */
  134. #define    TS_ASYNC    0x004000    /* tty in async i/o mode */
  135. /* state for intra-line fancy editing work */
  136. #define    TS_BKSL        0x010000    /* state for lowercase \ work */
  137. #define    TS_QUOT        0x020000    /* last character input was \ */
  138. #define    TS_ERASE    0x040000    /* within a \.../ for PRTRUB */
  139. #define    TS_LNCH        0x080000    /* next character is literal */
  140. #define    TS_TYPEN    0x100000    /* retyping suspended input (PENDIN) */
  141. #define    TS_CNTTB    0x200000    /* counting tab width; leave FLUSHO alone */
  142.  
  143. #define    TS_LOCAL    (TS_BKSL|TS_QUOT|TS_ERASE|TS_LNCH|TS_TYPEN|TS_CNTTB)
  144.  
  145. /* define partab character types */
  146. #define    ORDINARY    0
  147. #define    CONTROL        1
  148. #define    BACKSPACE    2
  149. #define    NEWLINE        3
  150. #define    TAB        4
  151. #define    VTAB        5
  152. #define    RETURN        6
  153.  
  154. /* EOF tty.h */
  155.