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