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