131058Sminshall/*
233817Sbostic * Copyright (c) 1988 Regents of the University of California.
333817Sbostic * All rights reserved.
433817Sbostic *
533817Sbostic * Redistribution and use in source and binary forms are permitted
634995Sbostic * provided that the above copyright notice and this paragraph are
734995Sbostic * duplicated in all such forms and that any documentation,
834995Sbostic * advertising materials, and other materials related to such
934995Sbostic * distribution and use acknowledge that the software was developed
1034995Sbostic * by the University of California, Berkeley.  The name of the
1134995Sbostic * University may not be used to endorse or promote products derived
1234995Sbostic * from this software without specific prior written permission.
1334995Sbostic * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
1434995Sbostic * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
1534995Sbostic * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
1633817Sbostic *
17*36284Sminshall *	@(#)termcodes.m4	4.1 (Berkeley) 12/04/88
1831058Sminshall */
1931058Sminshall
2031058Sminshall/* the following allows us to generate our TC values.  it is a bit painful. */
2131058Sminshall
2231058Sminshalldefine(TCvalue, 128)
2331058Sminshalldefine(TCbump, `define(`TCvalue', eval(TCvalue+1))')
2431058Sminshalldefine(TCdefine, ``#define'')
2531058Sminshalldefine(TC, `TCdefine define(`TCstring', TC_$1) TCstring TCvalue TCbump `
2631058Sminshall		'InitialAscii("$1", TCstring) InitialAids(ifelse($2,,0,0x$2))')
2731058Sminshalldefine(Is, `TCdefine TC_$1 TCvalue')
2831058Sminshall
2931058Sminshall#define IsTc(x) (((x)&0xff) >= TC_LOWEST)
3031058Sminshall
3131058Sminshall/* This lists the codes which are output from termin() */
3231058Sminshall
3331058Sminshalltypedef char TC_Aids_t;
3431058Sminshall
3531058Sminshalltypedef struct {
3631058Sminshall    char	*tc_name;		/* what the name is */
3731058Sminshall    char	tc_value;		/* what the value is */
3831058Sminshall} TC_Ascii_t;
3931058Sminshall
4031058Sminshalltypedef struct {
4131058Sminshall    char	*tc_name;		/* what the name is */
4231058Sminshall    char	tc_value;		/* what the value is */
4331058Sminshall    char	tc_aid;			/* what the AID is */
4431058Sminshall} TC_AsciiAids_t;
4531058Sminshall
4631058Sminshall#ifdef DEFINEAIDS
4731058Sminshall#define InitialAids(x)	x,
4831058Sminshall#else
4931058Sminshall#define InitialAids(x)
5031058Sminshall#endif /* DEFINEAIDS */
5131058Sminshall#ifdef LETS_SEE_ASCII
5231058Sminshall#define InitialAscii(x, y) x, y,
5331058Sminshall#else
5431058Sminshall#define InitialAscii(x, y)
5531058Sminshall#endif /* LETS_SEE_ASCII */
5631058Sminshall
5731058Sminshall#ifdef LETS_SEE_ASCII
5831058Sminshall#ifdef DEFINEAIDS
5931058Sminshallstatic TC_AsciiAids_t TC_AsciiAids[] = {
6031058Sminshall#else /* so, no aids */
6131058Sminshallstatic TC_Ascii_t TC_Ascii[] = {
6231058Sminshall#endif /* DEFINEAIDS */
6331058Sminshall#else
6431058Sminshall#ifdef DEFINEAIDS
6531058Sminshallstatic TC_Aids_t TC_Aids[] = {
6631058Sminshall#endif /* LETS_SEE_ASCII */
6731058Sminshall#endif
6831058Sminshall
6931058SminshallIs(LOWEST)
7031058Sminshall
7131058Sminshall/* the following are internal to the parser and generator */
7231058Sminshall/* (and, generally, should not be specified by the user...) */
7331058SminshallTC(CALL)			/* INT: call a state sequence */
7431058SminshallTC(RETURN)			/* INT: return from TC_CALL */
7531058SminshallTC(GOTO)			/* INT: goto next entry */
7631058SminshallTC(NULL)			/* Illegal sequence; bell */
7731058Sminshall
7831058Sminshall
7931058Sminshall
8031058SminshallIs(LOWEST_USER)			/* lowest code settable by user */
8131058Sminshall
8231058SminshallTC(VERTICAL_BAR)
8331058SminshallTC(CAPS_LOCK)
8431058SminshallTC(MAKE_SHIFT)
8531058SminshallTC(BREAK_SHIFT)
8631058SminshallTC(DVCNL)
8731058SminshallTC(MAKE_ALT)
8831058SminshallTC(BREAK_ALT)
8931058SminshallTC(SPACE)
9031058SminshallTC(LEFT2)
9131058SminshallTC(RIGHT2)
9231058SminshallTC(MONOCASE)
9331058SminshallTC(ATTN)			/* attention generator */
9431058SminshallTC(LPRT)			/* local print */
9531058SminshallTC(DP)				/* dup character */
9631058SminshallTC(FM)				/* field mark character */
9731058SminshallTC(CURSEL)			/* cursor select */
9831058SminshallTC(CENTSIGN)			/* EBCDIC cent sign */
9931058SminshallTC(RESHOW)			/* redisplay the screen */
10031058SminshallTC(EINP)			/* erase input */
10131058SminshallTC(EEOF)			/* erase end of field */
10231058SminshallTC(DELETE)			/* delete character */
10331058SminshallTC(INSRT)			/* toggle insert mode */
10431058SminshallTC(TAB)				/* field tab */
10531058SminshallTC(BTAB)			/* field back tab */
10631058SminshallTC(COLTAB)			/* column tab */
10731058SminshallTC(COLBAK)			/* column back tab */
10831058SminshallTC(INDENT)			/* indent one tab stop */
10931058SminshallTC(UNDENT)			/* undent one tab stop */
11031058SminshallTC(NL)				/* new line */
11131058SminshallTC(HOME)			/* home the cursor */
11231058SminshallTC(UP)				/* up cursor */
11331058SminshallTC(DOWN)			/* down cursor */
11431058SminshallTC(RIGHT)			/* right cursor */
11531058SminshallTC(LEFT)			/* left cursor */
11631058SminshallTC(SETTAB)			/* set a column tab */
11731058SminshallTC(DELTAB)			/* delete a column tab */
11831058SminshallTC(SETMRG)			/* set left margin */
11931058SminshallTC(SETHOM)			/* set home position */
12031058SminshallTC(CLRTAB)			/* clear all column tabs */
12131058SminshallTC(APLON)			/* apl on */
12231058SminshallTC(APLOFF)			/* apl off */
12331058SminshallTC(APLEND)			/* treat input as ascii */
12431058SminshallTC(PCON)			/* xon/xoff on */
12531058SminshallTC(PCOFF)			/* xon/xoff off */
12631058SminshallTC(DISC)			/* disconnect (suspend) */
12731058SminshallTC(INIT)			/* new terminal type */
12831058SminshallTC(ALTK)			/* alternate keyboard dvorak */
12931058SminshallTC(FLINP)			/* flush input */
13031058SminshallTC(ERASE)			/* erase last character */
13131058SminshallTC(WERASE)			/* erase last word */
13231058SminshallTC(FERASE)			/* erase field */
13331058SminshallTC(SYNCH)			/* user and us are in synch */
13431058SminshallTC(RESET)			/* reset key -unlock keyboard */
13531058SminshallTC(MASTER_RESET)		/* master reset key; flush, reset, repaint */
13631058SminshallTC(XOFF)			/* please hold output */
13731058SminshallTC(XON)				/* please give me output */
13831058SminshallTC(ESCAPE)			/* enter telnet command mode */
13931058SminshallTC(WORDTAB)			/* Go to first character of next word */
14031058SminshallTC(WORDBACKTAB)			/* Go to first character of last word */
14131058SminshallTC(WORDEND)			/* Go to last character of this/next word */
14231058SminshallTC(FIELDEND)			/* Go to last non-blank of this field */
14331058Sminshall
14431058Sminshall
14531058SminshallIs(LOWEST_AID)			/* lowest attn generator */
14631058Sminshall
14731058Sminshall/* the attention generating keys... */
14831058Sminshall
14931058SminshallTC(PA1, 6c)
15031058SminshallTC(PA2, 6e)
15131058SminshallTC(PA3, 6b)
15231058SminshallTC(CLEAR, 6d)
15331058SminshallTC(TREQ, f0)
15431058SminshallTC(ENTER, 7d)
15531058SminshallTC(SELPEN, 7e)	/* Really, only SELPEN with DESIGNATOR = space or null */
15631058SminshallTC(PFK1, f1)
15731058SminshallTC(PFK2, f2)
15831058SminshallTC(PFK3, f3)
15931058SminshallTC(PFK4, f4)
16031058SminshallTC(PFK5, f5)
16131058SminshallTC(PFK6, f6)
16231058SminshallTC(PFK7, f7)
16331058SminshallTC(PFK8, f8)
16431058SminshallTC(PFK9, f9)
16531058SminshallTC(PFK10, 7a)
16631058SminshallTC(PFK11, 7b)
16731058SminshallTC(PFK12, 7c)
16831058SminshallTC(PFK13, c1)
16931058SminshallTC(PFK14, c2)
17031058SminshallTC(PFK15, c3)
17131058SminshallTC(PFK16, c4)
17231058SminshallTC(PFK17, c5)
17331058SminshallTC(PFK18, c6)
17431058SminshallTC(PFK19, c7)
17531058SminshallTC(PFK20, c8)
17631058SminshallTC(PFK21, c9)
17731058SminshallTC(PFK22, 4a)
17831058SminshallTC(PFK23, 4b)
17931058SminshallTC(PFK24, 4c)
18031058SminshallTC(PFK25, d1)
18131058SminshallTC(PFK26, d2)
18231058SminshallTC(PFK27, d3)
18331058SminshallTC(PFK28, d4)
18431058SminshallTC(PFK29, d5)
18531058SminshallTC(PFK30, d6)
18631058SminshallTC(PFK31, d7)
18731058SminshallTC(PFK32, d8)
18831058SminshallTC(PFK33, d9)
18931058SminshallTC(PFK34, 5a)
19031058SminshallTC(PFK35, 5b)
19131058SminshallTC(PFK36, 5c)
19231058Sminshall
19331058SminshallIs(HIGHEST_AID)-1			/* highest AID value */
19431058Sminshall#define IsAid(x)	(((x) >= TC_LOWEST_AID) && ((x) <= TC_HIGHEST_AID))
19531058Sminshall
19631058SminshallIs(HIGHEST)-1			/* highest TC value */
19731058Sminshall
19831058Sminshall#ifdef LETS_SEE_ASCII
19931058Sminshall};
20031058Sminshall#else
20131058Sminshall#ifdef DEFINEAIDS
20231058Sminshall};
20331058Sminshall#endif
20431058Sminshall#endif
20531058Sminshall
20631058Sminshall#ifdef DEFINEAIDS
20731058Sminshall#ifdef LETS_SEE_ASCII
20831058Sminshall#define TCtoAid(x)	TC_AsciiAids[(x)-TC_LOWEST].tc_aid
20931058Sminshall#else
21031058Sminshall#define TCtoAid(x)	TC_Aids[x-TC_LOWEST]
21131058Sminshall#endif
21231058Sminshall#endif
213