merge local state and flags; move ioctl stuff to other files
authorSam Leffler <sam@ucbvax.Berkeley.EDU>
Mon, 6 Dec 1982 13:52:44 +0000 (05:52 -0800)
committerSam Leffler <sam@ucbvax.Berkeley.EDU>
Mon, 6 Dec 1982 13:52:44 +0000 (05:52 -0800)
SCCS-vsn: sys/sys/tty.h 4.12

usr/src/sys/sys/tty.h

index f1ce693..f5624d6 100644 (file)
@@ -1,16 +1,18 @@
-/*     tty.h   4.11    82/03/15        */
+/*     tty.h   4.12    82/12/05        */
 
 #ifdef KERNEL
 
 #ifdef KERNEL
-#include "../h/ioctl.h"
+#include "../h/ttychars.h"
+#include "../h/ttydev.h"
 #else
 #else
-#include <sys/ioctl.h>
+#include <sys/ttychars.h>
+#include <sys/ttydev.h>
 #endif
 #endif
-#include <sgtty.h>
 
 /*
 
 /*
- * A clist structure is the head of a linked list queue of characters.
- * The characters are stored in blocks containing a link and CBSIZE (param.h)
- * characters.  The routines in prim.c manipulate these structures.
+ * A clist structure is the head of a linked list queue
+ * of characters.  The characters are stored in blocks
+ * containing a link and CBSIZE (param.h) characters. 
+ * The routines in tty_subr.c manipulate these structures.
  */
 struct clist {
        int     c_cc;           /* character count */
  */
 struct clist {
        int     c_cc;           /* character count */
@@ -19,14 +21,13 @@ struct clist {
 };
 
 /*
 };
 
 /*
- * Per-tty structre.
+ * Per-tty structure.
  *
  * Should be split in two, into device and tty drivers.
  * Glue could be masks of what to echo and circular buffer
  * (low, high, timeout).
  */
  *
  * Should be split in two, into device and tty drivers.
  * Glue could be masks of what to echo and circular buffer
  * (low, high, timeout).
  */
-struct tty
-{
+struct tty {
        union {
                struct {
                        struct  clist T_rawq;
        union {
                struct {
                        struct  clist T_rawq;
@@ -52,75 +53,73 @@ struct tty
                                caddr_t T_LINEP;        /* ### */
        caddr_t t_addr;                 /* ??? */
        dev_t   t_dev;                  /* device */
                                caddr_t T_LINEP;        /* ### */
        caddr_t t_addr;                 /* ??? */
        dev_t   t_dev;                  /* device */
-       short   t_flags;                /* some of both */
-       short   t_state;                /* some of both */
+       int     t_flags;                /* some of both */
+       int     t_state;                /* some of both */
        short   t_pgrp;                 /* tty */
        char    t_delct;                /* tty */
        short   t_pgrp;                 /* tty */
        char    t_delct;                /* tty */
+       char    t_char;                 /* tty */
        char    t_line;                 /* glue */
        char    t_col;                  /* tty */
        char    t_line;                 /* glue */
        char    t_col;                  /* tty */
-       char    t_erase, t_kill;        /* tty */
-       char    t_char;                 /* tty */
        char    t_ispeed, t_ospeed;     /* device */
        char    t_ispeed, t_ospeed;     /* device */
-/* begin local */
        char    t_rocount, t_rocol;     /* tty */
        char    t_rocount, t_rocol;     /* tty */
-       struct  ltchars t_lchr;         /* tty */
-       short   t_local;                /* tty */
-       short   t_lstate;               /* tty */
-/* end local */
-       union {
-               struct tchars t_chr;    /* tty */
-               struct clist T_CTLQ;
-       } t_un;
+       struct  ttychars t_chars;       /* tty */
+/* be careful of tchars & co. */
+#define        t_erase         t_chars.tc_erase
+#define        t_kill          t_chars.tc_kill
+#define        t_intrc         t_chars.tc_intrc
+#define        t_quitc         t_chars.tc_quitc
+#define        t_startc        t_chars.tc_startc
+#define        t_stopc         t_chars.tc_stopc
+#define        t_eofc          t_chars.tc_eofc
+#define        t_brkc          t_chars.tc_brkc
+#define        t_suspc         t_chars.tc_suspc
+#define        t_dsuspc        t_chars.tc_dsuspc
+#define        t_rprntc        t_chars.tc_rprntc
+#define        t_flushc        t_chars.tc_flushc
+#define        t_werasc        t_chars.tc_werasc
+#define        t_lnextc        t_chars.tc_lnextc
 };
 
 };
 
-#define        tun     tp->t_un.t_chr
-#define        tlun    tp->t_lchr
-
 #define        TTIPRI  28
 #define        TTOPRI  29
 
 #define        TTIPRI  28
 #define        TTOPRI  29
 
-#define        CTRL(c) ('c'&037)
-
-/* default special characters */
-#define        CERASE  '#'
-#define        CEOT    CTRL(d)
-#define        CKILL   '@'
-#define        CQUIT   034             /* FS, cntl shift L */
-#define        CINTR   0177            /* DEL */
-#define        CSTOP   CTRL(s)
-#define        CSTART  CTRL(q)
-#define        CBRK    0377
-
 /* limits */
 #define        NSPEEDS 16
 #define        TTMASK  15
 /* limits */
 #define        NSPEEDS 16
 #define        TTMASK  15
+#define        OBUFSIZ 100
+#define        TTYHOG  255
 #ifdef KERNEL
 short  tthiwat[NSPEEDS], ttlowat[NSPEEDS];
 #define        TTHIWAT(tp)     tthiwat[(tp)->t_ospeed&TTMASK]
 #define        TTLOWAT(tp)     ttlowat[(tp)->t_ospeed&TTMASK]
 #ifdef KERNEL
 short  tthiwat[NSPEEDS], ttlowat[NSPEEDS];
 #define        TTHIWAT(tp)     tthiwat[(tp)->t_ospeed&TTMASK]
 #define        TTLOWAT(tp)     ttlowat[(tp)->t_ospeed&TTMASK]
+extern struct ttychars ttydefaults;
 #endif
 #endif
-#define        TTYHOG  255
-
-/* hardware bits */
-#define        DONE    0200
-#define        IENABLE 0100
 
 /* internal state bits */
 
 /* internal state bits */
-#define        TS_TIMEOUT      000001          /* delay timeout in progress */
-#define        TS_WOPEN        000002          /* waiting for open to complete */
-#define        TS_ISOPEN       000004          /* device is open */
-#define        TS_FLUSH        000010          /* outq has been flushed during DMA */
-#define        TS_CARR_ON      000020          /* software copy of carrier-present */
-#define        TS_BUSY         000040          /* output in progress */
-#define        TS_ASLEEP       000100          /* wakeup when output done */
-#define        TS_XCLUDE       000200          /* exclusive-use flag against open */
-#define        TS_TTSTOP       000400          /* output stopped by ctl-s */
-#define        TS_HUPCLS       001000          /* hang up upon last close */
-#define        TS_TBLOCK       002000          /* tandem queue blocked */
-#define        TS_RCOLL        004000          /* collision in read select */
-#define        TS_WCOLL        010000          /* collision in write select */
-#define        TS_NBIO         020000          /* tty in non-blocking mode */
-#define        TS_ASYNC        040000          /* tty in async i/o mode */
+#define        TS_TIMEOUT      0x000001        /* delay timeout in progress */
+#define        TS_WOPEN        0x000002        /* waiting for open to complete */
+#define        TS_ISOPEN       0x000004        /* device is open */
+#define        TS_FLUSH        0x000008        /* outq has been flushed during DMA */
+#define        TS_CARR_ON      0x000010        /* software copy of carrier-present */
+#define        TS_BUSY         0x000020        /* output in progress */
+#define        TS_ASLEEP       0x000040        /* wakeup when output done */
+#define        TS_XCLUDE       0x000080        /* exclusive-use flag against open */
+#define        TS_TTSTOP       0x000100        /* output stopped by ctl-s */
+#define        TS_HUPCLS       0x000200        /* hang up upon last close */
+#define        TS_TBLOCK       0x000400        /* tandem queue blocked */
+#define        TS_RCOLL        0x000800        /* collision in read select */
+#define        TS_WCOLL        0x001000        /* collision in write select */
+#define        TS_NBIO         0x002000        /* tty in non-blocking mode */
+#define        TS_ASYNC        0x004000        /* tty in async i/o mode */
+/* state for intra-line fancy editing work */
+#define        TS_BKSL         0x010000        /* state for lowercase \ work */
+#define        TS_QUOT         0x020000        /* last character input was \ */
+#define        TS_ERASE        0x040000        /* within a \.../ for PRTRUB */
+#define        TS_LNCH         0x080000        /* next character is literal */
+#define        TS_TYPEN        0x100000        /* retyping suspended input (PENDIN) */
+#define        TS_CNTTB        0x200000        /* counting tab width; leave FLUSHO alone */
+
+#define        TS_LOCAL        (TS_BKSL|TS_QUOT|TS_ERASE|TS_LNCH|TS_TYPEN|TS_CNTTB)
 
 /* define partab character types */
 #define        ORDINARY        0
 
 /* define partab character types */
 #define        ORDINARY        0
@@ -130,9 +129,3 @@ short       tthiwat[NSPEEDS], ttlowat[NSPEEDS];
 #define        TAB             4
 #define        VTAB            5
 #define        RETURN          6
 #define        TAB             4
 #define        VTAB            5
 #define        RETURN          6
-
-/* define dmctl actions */
-#define        DMSET           0
-#define        DMBIS           1
-#define        DMBIC           2
-#define        DMGET           3