| 1 | /* Copyright (c) 1979 Regents of the University of California */ |
| 2 | /* |
| 3 | * Capabilities from termcap |
| 4 | * |
| 5 | * The description of terminals is a difficult business, and we only |
| 6 | * attempt to summarize the capabilities here; for a full description |
| 7 | * see the paper describing termcap. |
| 8 | * |
| 9 | * Capabilities from termcap are of three kinds - string valued options, |
| 10 | * numeric valued options, and boolean options. The string valued options |
| 11 | * are the most complicated, since they may include padding information, |
| 12 | * which we describe now. |
| 13 | * |
| 14 | * Intelligent terminals often require padding on intelligent operations |
| 15 | * at high (and sometimes even low) speed. This is specified by |
| 16 | * a number before the string in the capability, and has meaning for the |
| 17 | * capabilities which have a P at the front of their comment. |
| 18 | * This normally is a number of milliseconds to pad the operation. |
| 19 | * In the current system which has no true programmible delays, we |
| 20 | * do this by sending a sequence of pad characters (normally nulls, but |
| 21 | * specifiable as "pc"). In some cases, the pad is better computed |
| 22 | * as some number of milliseconds times the number of affected lines |
| 23 | * (to bottom of screen usually, except when terminals have insert modes |
| 24 | * which will shift several lines.) This is specified as '12*' e.g. |
| 25 | * before the capability to say 12 milliseconds per affected whatever |
| 26 | * (currently always line). Capabilities where this makes sense say P*. |
| 27 | */ |
| 28 | char tspace[256]; /* Space for capability strings */ |
| 29 | char *aoftspace; /* Address of tspace for relocation */ |
| 30 | |
| 31 | char *AL; /* P* Add new blank line */ |
| 32 | char *BC; /* Back cursor */ |
| 33 | char *BT; /* P Back tab */ |
| 34 | char *CD; /* P* Clear to end of display */ |
| 35 | char *CE; /* P Clear to end of line */ |
| 36 | char *CL; /* P* Clear screen */ |
| 37 | char *CM; /* P Cursor motion */ |
| 38 | char *DC; /* P* Delete character */ |
| 39 | char *DL; /* P* Delete line sequence */ |
| 40 | char *DM; /* Delete mode (enter) */ |
| 41 | char *DO; /* Down line sequence */ |
| 42 | char *ED; /* End delete mode */ |
| 43 | char *EI; /* End insert mode */ |
| 44 | char *F0,*F1,*F2,*F3,*F4,*F5,*F6,*F7,*F8,*F9; |
| 45 | /* Strings sent by various function keys */ |
| 46 | char *HO; /* Home cursor */ |
| 47 | char *IC; /* P Insert character */ |
| 48 | char *IM; /* Insert mode (give as ':im=:' if 'ic' */ |
| 49 | char *IP; /* P* Insert pad after char ins'd using IM+IE */ |
| 50 | char *KD; /* Keypad down arrow */ |
| 51 | char *KE; /* Keypad don't xmit */ |
| 52 | char *KH; /* Keypad home key */ |
| 53 | char *KL; /* Keypad left arrow */ |
| 54 | char *KR; /* Keypad right arrow */ |
| 55 | char *KS; /* Keypad start xmitting */ |
| 56 | char *KU; /* Keypad up arrow */ |
| 57 | char *LL; /* Quick to last line, column 0 */ |
| 58 | char *ND; /* Non-destructive space */ |
| 59 | char PC; /* Pad character */ |
| 60 | char *SE; /* Standout end (may leave space) */ |
| 61 | char *SF; /* P Scroll forwards */ |
| 62 | char *SO; /* Stand out begin (may leave space) */ |
| 63 | char *SR; /* P Scroll backwards */ |
| 64 | char *TA; /* P Tab (other than ^I or with padding) */ |
| 65 | char *TE; /* Terminal end sequence */ |
| 66 | char *TI; /* Terminal initial sequence */ |
| 67 | char *UP; /* Upline */ |
| 68 | char *VB; /* Visible bell */ |
| 69 | char *VE; /* Visual end sequence */ |
| 70 | char *VS; /* Visual start sequence */ |
| 71 | bool AM; /* Automatic margins */ |
| 72 | bool BS; /* Backspace works */ |
| 73 | bool CA; /* Cursor addressible */ |
| 74 | bool DA; /* Display may be retained above */ |
| 75 | bool DB; /* Display may be retained below */ |
| 76 | bool EO; /* Can erase overstrikes with ' ' */ |
| 77 | bool GT; /* Gtty indicates tabs */ |
| 78 | bool HC; /* Hard copy terminal */ |
| 79 | bool HZ; /* Hazeltine ~ braindamage */ |
| 80 | bool IN; /* Insert-null blessing */ |
| 81 | bool MI; /* can move in insert mode */ |
| 82 | bool NC; /* No Cr - \r snds \r\n then eats \n (dm2500) */ |
| 83 | bool OS; /* Overstrike works */ |
| 84 | bool UL; /* Underlining works even though !os */ |
| 85 | bool XN; /* A newline gets eaten after wrap (concept) */ |
| 86 | bool XT; /* Tabs are destructive */ |
| 87 | /* X? is reserved for severely nauseous glitches */ |
| 88 | /* If there are enough of these we may need bit masks! */ |
| 89 | |
| 90 | /* |
| 91 | * From the tty modes... |
| 92 | */ |
| 93 | bool NONL; /* Terminal can't hack linefeeds doing a CR */ |
| 94 | bool UPPERCASE; /* Ick! */ |
| 95 | short LINES; /* Number of lines on screen */ |
| 96 | short COLUMNS; |
| 97 | short OCOLUMNS; /* Save COLUMNS for a hack in open mode */ |
| 98 | |
| 99 | short outcol; /* Where the cursor is */ |
| 100 | short outline; |
| 101 | |
| 102 | short destcol; /* Where the cursor should be */ |
| 103 | short destline; |
| 104 | |
| 105 | #ifdef TIOCSETC |
| 106 | struct tchars ottyc, nttyc; /* For V7 character masking */ |
| 107 | #endif |
| 108 | struct sgttyb tty; /* Always stty/gtty using this one structure */ |
| 109 | bool normtty; /* Have to restor normal mode from normf */ |
| 110 | int normf; /* Restore tty flags to this (someday) */ |
| 111 | |
| 112 | short WBOT; |
| 113 | short WECHO; |
| 114 | |
| 115 | short costCM; |
| 116 | |
| 117 | #define MAXNOMACS 32 /* max number of macros */ |
| 118 | #define MAXCHARMACS 512 /* max # of chars total in macros */ |
| 119 | struct maps { |
| 120 | char *cap; /* pressing button that sends this.. */ |
| 121 | char *mapto; /* .. maps to this string */ |
| 122 | char *descr; /* legible description of key */ |
| 123 | }; |
| 124 | struct maps arrows[MAXNOMACS]; /* macro defs - 1st 5 built in */ |
| 125 | char mapspace[MAXCHARMACS]; |
| 126 | char *msnext; /* next free location in mapspace */ |