1: /* Copyright (c) 1981 Regents of the University of California */
   2: /* sccs id:	@(#)ex_tty.h	7.3	9/9/81  */
   3: /*
   4:  * Capabilities from termcap
   5:  *
   6:  * The description of terminals is a difficult business, and we only
   7:  * attempt to summarize the capabilities here;  for a full description
   8:  * see the paper describing termcap.
   9:  *
  10:  * Capabilities from termcap are of three kinds - string valued options,
  11:  * numeric valued options, and boolean options.  The string valued options
  12:  * are the most complicated, since they may include padding information,
  13:  * which we describe now.
  14:  *
  15:  * Intelligent terminals often require padding on intelligent operations
  16:  * at high (and sometimes even low) speed.  This is specified by
  17:  * a number before the string in the capability, and has meaning for the
  18:  * capabilities which have a P at the front of their comment.
  19:  * This normally is a number of milliseconds to pad the operation.
  20:  * In the current system which has no true programmible delays, we
  21:  * do this by sending a sequence of pad characters (normally nulls, but
  22:  * specifiable as "pc").  In some cases, the pad is better computed
  23:  * as some number of milliseconds times the number of affected lines
  24:  * (to bottom of screen usually, except when terminals have insert modes
  25:  * which will shift several lines.)  This is specified as '12*' e.g.
  26:  * before the capability to say 12 milliseconds per affected whatever
  27:  * (currently always line).  Capabilities where this makes sense say P*.
  28:  */
  29: var char    tspace[256];    /* Space for capability strings */
  30: var char    *aoftspace; /* Address of tspace for relocation */
  31: 
  32: var char    *AL;        /* P* Add new blank line */
  33: var char    *AL_PARM;   /* P* Add n new blank lines */
  34: extern  char    *BC;        /*    Back cursor */
  35: var char    *BT;        /* P  Back tab */
  36: var char    *CD;        /* P* Clear to end of display */
  37: var char    *CE;        /* P  Clear to end of line */
  38: var char    *CL;        /* P* Clear screen */
  39: var char    *CM;        /* PG Cursor motion */
  40: var char    *CS;        /* PG Change scrolling region (vt100) */
  41: var char    *xCR;       /* P  Carriage return */
  42: var char    *DC;        /* P* Delete character */
  43: var char    *DL;        /* P* Delete line sequence */
  44: var char    *DL_PARM;   /* P* Delete n lines */
  45: var char    *DM;        /*    Delete mode (enter)  */
  46: var char    *DO;        /*    Down line sequence */
  47: var char    *DOWN_PARM; /*    Down n lines */
  48: var char    *ED;        /*    End delete mode */
  49: var char    *EI;        /*    End insert mode */
  50: var char    *F0,*F1,*F2,*F3,*F4,*F5,*F6,*F7,*F8,*F9;
  51:                 /*    Strings sent by various function keys */
  52: var char    *HO;        /*    Home cursor */
  53: var char    *IC;        /* P  Insert character */
  54: var char    *IM;        /*    Insert mode (give as ':im=:' if 'ic' */
  55: var char    *IP;        /* P* Insert pad after char ins'd using IM+IE */
  56: var char    *KD;        /*    Keypad down arrow */
  57: var char    *KE;        /*    Keypad don't xmit */
  58: var char    *KH;        /*    Keypad home key */
  59: var char    *KL;        /*    Keypad left arrow */
  60: var char    *KR;        /*    Keypad right arrow */
  61: var char    *KS;        /*    Keypad start xmitting */
  62: var char    *KU;        /*    Keypad up arrow */
  63: var char    *LEFT_PARM; /*    Left n chars */
  64: var char    *LL;        /*    Quick to last line, column 0 */
  65: var char    *ND;        /*    Non-destructive space */
  66: var char    *RIGHT_PARM;    /*    Right n spaces */
  67: var char    *xNL;       /*    Line feed (new line) */
  68: extern  char    PC;     /*    Pad character */
  69: var char    *RC;        /*    Restore cursor from last SC */
  70: var char    *SC;        /*    Save cursor */
  71: var char    *SE;        /*    Standout end (may leave space) */
  72: var char    *SF;        /* P  Scroll forwards */
  73: var char    *SO;        /*    Stand out begin (may leave space) */
  74: var char    *SR;        /* P  Scroll backwards */
  75: var char    *TA;        /* P  Tab (other than ^I or with padding) */
  76: var char    *TE;        /*    Terminal end sequence */
  77: var char    *TI;        /*    Terminal initial sequence */
  78: extern  char    *UP;        /*    Upline */
  79: var char    *UP_PARM;   /*    Up n lines */
  80: var char    *VB;        /*    Visible bell */
  81: var char    *VE;        /*    Visual end sequence */
  82: var char    *VS;        /*    Visual start sequence */
  83: var bool    AM;     /* Automatic margins */
  84: var bool    BS;     /* Backspace works */
  85: var bool    CA;     /* Cursor addressible */
  86: var bool    DA;     /* Display may be retained above */
  87: var bool    DB;     /* Display may be retained below */
  88: var bool    EO;     /* Can erase overstrikes with ' ' */
  89: var bool    GT;     /* Gtty indicates tabs */
  90: var bool    HC;     /* Hard copy terminal */
  91: var bool    HZ;     /* Hazeltine ~ braindamage */
  92: var bool    IN;     /* Insert-null blessing */
  93: var bool    MI;     /* can move in insert mode */
  94: var bool    NC;     /* No Cr - \r snds \r\n then eats \n (dm2500) */
  95: var bool    NS;     /* No scroll - linefeed at bottom won't scroll */
  96: var bool    OS;     /* Overstrike works */
  97: var bool    UL;     /* Underlining works even though !os */
  98: var bool    XB;     /* Beehive (no escape key, simulate with f1) */
  99: var bool    XN;     /* A newline gets eaten after wrap (concept) */
 100: var bool    XT;     /* Tabs are destructive */
 101: var bool    XX;     /* Tektronix 4025 insert line */
 102:     /* X? is reserved for severely nauseous glitches */
 103:     /* If there are enough of these we may need bit masks! */
 104: 
 105: /*
 106:  * From the tty modes...
 107:  */
 108: var bool    NONL;       /* Terminal can't hack linefeeds doing a CR */
 109: var bool    UPPERCASE;  /* Ick! */
 110: extern  short   LINES;      /* Number of lines on screen */
 111: extern  short   COLUMNS;
 112: var short   OCOLUMNS;   /* Save COLUMNS for a hack in open mode */
 113: 
 114: var short   outcol;     /* Where the cursor is */
 115: var short   outline;
 116: 
 117: var short   destcol;    /* Where the cursor should be */
 118: var short   destline;
 119: 
 120: /*
 121:  * There are several kinds of tty drivers to contend with.  These include:
 122:  * (1)	V6:		no CBREAK, no ioctl.  (Include PWB V1 here).
 123:  * (2)	V7 research:	has CBREAK, has ioctl, and has the tchars (TIOCSETC)
 124:  *			business to change start, stop, etc. chars.
 125:  * (3)	USG V2:		Basically like V6 but RAW mode is like V7 RAW.
 126:  *			(We treat it as V6.)
 127:  * (4)	USG V3:		equivalent to V7 but totally incompatible.
 128:  * (5)  Berkeley:	has ltchars in addition to all of V7.
 129:  *
 130:  * The following attempts to decide what we are on, and declare
 131:  * some variables in the appropriate format.  The wierd looking one (ttymode)
 132:  * is the thing we pass to sTTY and family to turn "RAW" mode on or off
 133:  * when we go into or out of visual mode.  In V7/V6 it's just the flags word
 134:  * to stty.  In USG V3 it's the whole tty structure.
 135:  */
 136: #ifdef  USG3TTY         /* USG V3 */
 137:   var   struct  termio tty; /* Use this one structure to change modes */
 138:   typedef   struct termio ttymode;  /* Mode to contain tty flags */
 139: 
 140: #else               /* All others */
 141:   var   struct  sgttyb tty; /* Always stty/gtty using this one structure */
 142:   typedef   int ttymode;    /* Mode to contain tty flags */
 143: # ifdef     TIOCSETC    /* V7 */
 144:    var  struct  tchars ottyc, nttyc;    /* For V7 character masking */
 145: # endif
 146: # ifdef     TIOCLGET    /* Berkeley */
 147:    var  struct  ltchars olttyc, nlttyc; /* More of tchars style stuff */
 148: # endif
 149: 
 150: #endif
 151: 
 152: var ttymode normf;      /* Restore tty flags to this (someday) */
 153: var bool    normtty;    /* Have to restore normal mode from normf */
 154: 
 155: ttymode ostart(), setty(), unixex();
 156: 
 157: var short   costCM; /* # chars to output a typical CM, with padding etc. */
 158: var short   costSR; /* likewise for scroll reverse */
 159: var short   costAL; /* likewise for insert line */
 160: var short   costDP; /* likewise for DOWN_PARM */
 161: var short   costLP; /* likewise for LEFT_PARM */
 162: var short   costRP; /* likewise for RIGHT_PARM */
 163: 
 164: #ifdef VMUNIX
 165: # define MAXNOMACS  128 /* max number of macros of each kind */
 166: # define MAXCHARMACS    2048    /* max # of chars total in macros */
 167: #else
 168: # define MAXNOMACS  32  /* max number of macros of each kind */
 169: # define MAXCHARMACS    512 /* max # of chars total in macros */
 170: #endif
 171: struct maps {
 172:     char *cap;  /* pressing button that sends this.. */
 173:     char *mapto;    /* .. maps to this string */
 174:     char *descr;    /* legible description of key */
 175: };
 176: var struct maps arrows[MAXNOMACS];  /* macro defs - 1st 5 built in */
 177: var struct maps immacs[MAXNOMACS];  /* for while in insert mode */
 178: var struct maps abbrevs[MAXNOMACS]; /* for word abbreviations */
 179: var int ldisc;          /* line discipline for ucb tty driver */
 180: var char    mapspace[MAXCHARMACS];
 181: var char    *msnext;    /* next free location in mapspace */
 182: var int maphopcnt;  /* check for infinite mapping loops */
 183: var bool    anyabbrs;   /* true if abbr or unabbr has been done */
 184: var char    ttynbuf[20];    /* result of ttyname() */
 185: var int ttymesg;    /* original mode of users tty */

Defined variables

AL_PARM defined in line 33; used 4 times
BT defined in line 35; used 6 times
CD defined in line 36; used 7 times
CS defined in line 40; used 8 times
DC defined in line 42; used 4 times
DL_PARM defined in line 44; used 4 times
DM defined in line 45; used 4 times
DO defined in line 46; used 1 times
DOWN_PARM defined in line 47; used 4 times
ED defined in line 48; used 3 times
EI defined in line 49; used 9 times
F0 defined in line 50; used 2 times
F1 defined in line 50; used 2 times
F2 defined in line 50; used 2 times
F3 defined in line 50; used 2 times
F4 defined in line 50; used 2 times
F5 defined in line 50; used 2 times
F6 defined in line 50; used 2 times
F7 defined in line 50; used 2 times
F8 defined in line 50; used 2 times
F9 defined in line 50; used 2 times
HO defined in line 52; used 3 times
IC defined in line 53; used 4 times
IM defined in line 54; used 11 times
IP defined in line 55; used 2 times
KD defined in line 56; used 2 times
KE defined in line 57; used 2 times
KH defined in line 58; used 2 times
KL defined in line 59; used 2 times
KR defined in line 60; used 4 times
KS defined in line 61; used 2 times
KU defined in line 62; used 2 times
LEFT_PARM defined in line 63; used 4 times
LL defined in line 64; used 3 times
ND defined in line 65; used 3 times
RC defined in line 69; used 5 times
RIGHT_PARM defined in line 66; used 4 times
SC defined in line 70; used 4 times
SF defined in line 72; used 4 times
TA defined in line 75; used 5 times
UP_PARM defined in line 79; used 3 times
VB defined in line 80; used 5 times
VE defined in line 81; used 2 times
VS defined in line 82; used 2 times
abbrevs defined in line 178; used 4 times
aoftspace defined in line 30; used 3 times
costAL defined in line 159; used 2 times
costCM defined in line 157; used 2 times
costDP defined in line 160; used 2 times
costLP defined in line 161; used 2 times
costRP defined in line 162; used 2 times
costSR defined in line 158; used 2 times
immacs defined in line 177; used 2 times
maphopcnt defined in line 182; used 4 times
mapspace defined in line 180; used 2 times
msnext defined in line 181; used 12 times
nlttyc defined in line 147; used 7 times
nttyc defined in line 144; used 9 times
olttyc defined in line 147; used 5 times
ottyc defined in line 144; used 3 times
tspace defined in line 29; used 2 times
ttymesg defined in line 185; used 2 times
ttynbuf defined in line 184; used 8 times
xCR defined in line 41; used 5 times
xNL defined in line 67; used 9 times

Defined struct's

maps defined in line 171; used 12 times

Defined typedef's

Defined macros

MAXCHARMACS defined in line 169; used 2 times
MAXNOMACS defined in line 168; used 4 times

Usage of this include

Last modified: 1981-09-09
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1404
Valid CSS Valid XHTML 1.0 Strict