1/*
2 *	@(#)termcodes.m4	3.1  10/29/86
3 */
4
5/* the following allows us to generate our TC values.  it is a bit painful. */
6
7define(TCvalue, 128)
8define(TCbump, `define(`TCvalue', eval(TCvalue+1))')
9define(TCdefine, ``#define'')
10define(TC, `TCdefine define(`TCstring', TC_$1) TCstring TCvalue TCbump `
11		'InitialAscii("$1", TCstring) InitialAids(ifelse($2,,0,0x$2))')
12define(Is, `TCdefine TC_$1 TCvalue')
13
14#define IsTc(x) (((x)&0xff) >= TC_LOWEST)
15
16/* This lists the codes which are output from termin() */
17
18typedef char TC_Aids_t;
19
20typedef struct {
21    char	*tc_name;		/* what the name is */
22    char	tc_value;		/* what the value is */
23} TC_Ascii_t;
24
25typedef struct {
26    char	*tc_name;		/* what the name is */
27    char	tc_value;		/* what the value is */
28    char	tc_aid;			/* what the AID is */
29} TC_AsciiAids_t;
30
31#ifdef DEFINEAIDS
32#define InitialAids(x)	x,
33#else
34#define InitialAids(x)
35#endif /* DEFINEAIDS */
36#ifdef LETS_SEE_ASCII
37#define InitialAscii(x, y) x, y,
38#else
39#define InitialAscii(x, y)
40#endif /* LETS_SEE_ASCII */
41
42#ifdef LETS_SEE_ASCII
43#ifdef DEFINEAIDS
44static TC_AsciiAids_t TC_AsciiAids[] = {
45#else /* so, no aids */
46static TC_Ascii_t TC_Ascii[] = {
47#endif /* DEFINEAIDS */
48#else
49#ifdef DEFINEAIDS
50static TC_Aids_t TC_Aids[] = {
51#endif /* LETS_SEE_ASCII */
52#endif
53
54Is(LOWEST)
55
56/* the following are internal to the parser and generator */
57/* (and, generally, should not be specified by the user...) */
58TC(CALL)			/* INT: call a state sequence */
59TC(RETURN)			/* INT: return from TC_CALL */
60TC(GOTO)			/* INT: goto next entry */
61TC(NULL)			/* Illegal sequence; bell */
62
63
64
65Is(LOWEST_USER)			/* lowest code settable by user */
66
67TC(VERTICAL_BAR)
68TC(CAPS_LOCK)
69TC(MAKE_SHIFT)
70TC(BREAK_SHIFT)
71TC(DVCNL)
72TC(MAKE_ALT)
73TC(BREAK_ALT)
74TC(SPACE)
75TC(LEFT2)
76TC(RIGHT2)
77TC(MONOCASE)
78TC(ATTN)			/* attention generator */
79TC(LPRT)			/* local print */
80TC(DP)				/* dup character */
81TC(FM)				/* field mark character */
82TC(CURSEL)			/* cursor select */
83TC(CENTSIGN)			/* EBCDIC cent sign */
84TC(RESHOW)			/* redisplay the screen */
85TC(EINP)			/* erase input */
86TC(EEOF)			/* erase end of field */
87TC(DELETE)			/* delete character */
88TC(INSRT)			/* toggle insert mode */
89TC(TAB)				/* field tab */
90TC(BTAB)			/* field back tab */
91TC(COLTAB)			/* column tab */
92TC(COLBAK)			/* column back tab */
93TC(INDENT)			/* indent one tab stop */
94TC(UNDENT)			/* undent one tab stop */
95TC(NL)				/* new line */
96TC(HOME)			/* home the cursor */
97TC(UP)				/* up cursor */
98TC(DOWN)			/* down cursor */
99TC(RIGHT)			/* right cursor */
100TC(LEFT)			/* left cursor */
101TC(SETTAB)			/* set a column tab */
102TC(DELTAB)			/* delete a column tab */
103TC(SETMRG)			/* set left margin */
104TC(SETHOM)			/* set home position */
105TC(CLRTAB)			/* clear all column tabs */
106TC(APLON)			/* apl on */
107TC(APLOFF)			/* apl off */
108TC(APLEND)			/* treat input as ascii */
109TC(PCON)			/* xon/xoff on */
110TC(PCOFF)			/* xon/xoff off */
111TC(DISC)			/* disconnect (suspend) */
112TC(INIT)			/* new terminal type */
113TC(ALTK)			/* alternate keyboard dvorak */
114TC(FLINP)			/* flush input */
115TC(ERASE)			/* erase last character */
116TC(WERASE)			/* erase last word */
117TC(FERASE)			/* erase field */
118TC(SYNCH)			/* user and us are in synch */
119TC(RESET)			/* reset key -unlock keyboard */
120TC(MASTER_RESET)		/* master reset key; flush, reset, repaint */
121TC(XOFF)			/* please hold output */
122TC(XON)				/* please give me output */
123TC(ESCAPE)			/* enter telnet command mode */
124TC(WORDTAB)			/* Go to first character of next word */
125TC(WORDBACKTAB)			/* Go to first character of last word */
126TC(WORDEND)			/* Go to last character of this/next word */
127TC(FIELDEND)			/* Go to last non-blank of this field */
128
129
130Is(LOWEST_AID)			/* lowest attn generator */
131
132/* the attention generating keys... */
133
134TC(PA1, 6c)
135TC(PA2, 6e)
136TC(PA3, 6b)
137TC(CLEAR, 6d)
138TC(TREQ, f0)
139TC(ENTER, 7d)
140TC(SELPEN, 7e)	/* Really, only SELPEN with DESIGNATOR = space or null */
141TC(PFK1, f1)
142TC(PFK2, f2)
143TC(PFK3, f3)
144TC(PFK4, f4)
145TC(PFK5, f5)
146TC(PFK6, f6)
147TC(PFK7, f7)
148TC(PFK8, f8)
149TC(PFK9, f9)
150TC(PFK10, 7a)
151TC(PFK11, 7b)
152TC(PFK12, 7c)
153TC(PFK13, c1)
154TC(PFK14, c2)
155TC(PFK15, c3)
156TC(PFK16, c4)
157TC(PFK17, c5)
158TC(PFK18, c6)
159TC(PFK19, c7)
160TC(PFK20, c8)
161TC(PFK21, c9)
162TC(PFK22, 4a)
163TC(PFK23, 4b)
164TC(PFK24, 4c)
165TC(PFK25, d1)
166TC(PFK26, d2)
167TC(PFK27, d3)
168TC(PFK28, d4)
169TC(PFK29, d5)
170TC(PFK30, d6)
171TC(PFK31, d7)
172TC(PFK32, d8)
173TC(PFK33, d9)
174TC(PFK34, 5a)
175TC(PFK35, 5b)
176TC(PFK36, 5c)
177
178Is(HIGHEST_AID)-1			/* highest AID value */
179#define IsAid(x)	(((x) >= TC_LOWEST_AID) && ((x) <= TC_HIGHEST_AID))
180
181Is(HIGHEST)-1			/* highest TC value */
182
183#ifdef LETS_SEE_ASCII
184};
185#else
186#ifdef DEFINEAIDS
187};
188#endif
189#endif
190
191#ifdef DEFINEAIDS
192#ifdef LETS_SEE_ASCII
193#define TCtoAid(x)	TC_AsciiAids[(x)-TC_LOWEST].tc_aid
194#else
195#define TCtoAid(x)	TC_Aids[x-TC_LOWEST]
196#endif
197#endif
198