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