xref: /original-bsd/usr.bin/tn3270/ctlr/function.h (revision bdd86a84)
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  *	@(#)function.h	3.3 (Berkeley) 06/29/88
18  */
19 
20 /*
21  * The following are the various functions which the keyboard can ask
22  * the controller to perform.
23  *
24  * Note that this file (the following entries) are scanned by mkhit.c,
25  * and that the format must remain more-or-less consistent
26  * [ \t]*TOKEN
27  */
28 
29 enum ctlrfcn {
30 
31 	undefined = 0,			/* Not yet touched */
32 
33 	FCN_NULL,	  		/* Illegal sequence */
34 
35 	FCN_RESET,			/* unlock keyboard */
36 	FCN_MAKE_SHIFT_LOCK,
37 	FCN_BREAK_SHIFT_LOCK,
38 
39 	FCN_MAKE_SHIFT,			/* shift key pressed DOWN */
40 	FCN_BREAK_SHIFT,		/* shift key released */
41 
42 	FCN_MAKE_ALT,			/* alt key pressed DOWN */
43 	FCN_BREAK_ALT,			/* alt key released */
44 
45 	FCN_MAKE_CTRL,
46 
47 	FCN_CAPS_LOCK,
48 
49 	FCN_MONOCASE,			/* DISPLAY in upper case */
50 	FCN_DVCNL,
51 
52 	FCN_CHARACTER,			/* Not one of the following, but ... */
53 	FCN_VERTICAL_BAR,		/* EBCDIC solid vertical bar */
54 	FCN_CENTSIGN,			/* EBCDIC cent sign */
55 	FCN_SPACE,			/* EBCDIC space */
56 	FCN_DP,				/* EBCDIC dup character */
57 	FCN_FM,				/* EBCDIC field mark */
58 
59 	FCN_AID,			/* Some AID key */
60 	FCN_ATTN,
61 	FCN_CURSEL,			/* Cursor select function (and aid) */
62 	FCN_TEST,			/* Test function */
63 
64 	FCN_EINP,			/* erase input (dangerous) */
65 	FCN_EEOF,
66 	FCN_DELETE,
67 	FCN_INSRT,
68 	FCN_TAB,
69 	FCN_BTAB,
70 	FCN_NL,
71 	FCN_HOME,
72 	FCN_UP,
73 	FCN_DOWN,
74 	FCN_RIGHT,
75 	FCN_LEFT,
76 	FCN_LEFT2,
77 	FCN_RIGHT2,
78 
79 #if	!defined(PURE3274)
80 	/*
81 	 * Local editing functions
82 	 */
83 	FCN_SETTAB,			/* set a column tab */
84 	FCN_DELTAB,
85 	FCN_COLTAB,
86 	FCN_COLBAK,
87 	FCN_INDENT,			/* more margin over one col tab */
88 	FCN_UNDENT,
89 	FCN_SETMRG,
90 	FCN_SETHOM,
91 	FCN_CLRTAB,
92 	FCN_ERASE,			/* erase last character */
93 	FCN_WERASE,
94 	FCN_FERASE,
95 	FCN_WORDTAB,			/* tab to start of next word */
96 	FCN_WORDBACKTAB,
97 	FCN_WORDEND,			/* find next end of word */
98 	FCN_FIELDEND,			/* find next end of field */
99 
100 	/*
101 	 * APL functions
102 	 */
103 	FCN_APLON,			/* start using apl character set */
104 	FCN_APLOFF,
105 	FCN_APLEND,
106 
107 	FCN_PCON,
108 	FCN_PCOFF,
109 	FCN_INIT,			/* re-init screen */
110 	FCN_SYNCH,			/* synch up after line/control error */
111 	FCN_FLINP,			/* flush input buffer */
112 	FCN_RESHOW,			/* redraw screen */
113 	FCN_MASTER_RESET,		/* FLINP, RESET, RESHOW, + more */
114 
115 	FCN_DISC,			/* suspend application */
116 	FCN_ESCAPE,			/* enter command mode */
117 
118 	FCN_ALTK,			/* Dvorak keyboard */
119 
120 	FCN_XOFF,			/* suspend output to screen */
121 	FCN_XON,			/* resume output to screen */
122 
123 	FCN_LPRT			/* print screen on printer */
124 #endif	/* !defined(PURE3274) */
125 };
126 /*
127  * The following is the structure which defines what a 3270 keystroke
128  * can do.
129  */
130 
131 struct hits {
132     unsigned char keynumber;
133     struct hit {
134 	enum ctlrfcn ctlrfcn;
135 	unsigned char code;	/* AID value or 3270 display code */
136     } hit[4];	/* plain, shifted, alted, shiftalted */
137 };
138 
139 extern struct hits hits[];
140 
141 /*
142  * Definitions of the shift state (and the left/right shift key position).
143  */
144 
145 #define	SHIFT_RIGHT	0x20	/* Right shift key is down */
146 #define	SHIFT_LEFT	0x10	/* Left shift key is down */
147 #define	SHIFT_CONTROL	0x08	/* Control shift state (unused) */
148 #define	SHIFT_ALT	0x04	/* ALT shift state */
149 #define	SHIFT_CAPS	0x02	/* Caps lock state */
150 #define	SHIFT_UPSHIFT	0x01	/* Upshift state */
151