1 /**
2  * @namespace   biewlib
3  * @file        biewlib/sysdep/ia32/qnxnto/kbd_code.h
4  * @brief       This file contains definitions of keyboard codes for QNX6
5  * @version     -
6  * @remark      this source file is part of Binary vIEW project (BIEW).
7  *              The Binary vIEW (BIEW) is copyright (C) 1995 Nickols_K.
8  *              All rights reserved. This software is redistributable under the
9  *              licence given in the file "Licence.en" ("Licence.ru" in russian
10  *              translation) distributed in the BIEW archive.
11  * @note        Requires POSIX compatible development system
12  *
13  * @author      Andrew Golovnia
14  * @since       2003
15  * @note        Development, fixes and improvements
16 **/
17 
18 #ifndef __KBD_CODE_H
19 #define __KBD_CODE_H
20 
21 #define KS_SHIFT	3
22 #define KS_CTRL		4
23 #define KS_ALT		8
24 #define KS_CTRL_MASK	15
25 #define KS_SCRLOCK	16
26 #define KS_NUMLOCK	32
27 #define KS_CAPSLOCK	64
28 #define KS_INSERT	128
29 
30 /*
31     not real keys, for internal use only
32 */
33 
34 #define KE_SUPERKEY	0xFFFF
35 #define KE_JUSTFIND	0xFFFE
36 #define KE_MOUSE        0xFFFB
37 #define KE_SHIFTKEYS    0xFFFA
38 #define KE_BREAK	0xFFF0
39 
40 /*
41     status control keys
42 */
43 
44 #define KE_STATUS_ALT		'\x01'	/**< CTRL+A */
45 #define KE_STATUS_CONTROL	'\x03'	/**< CTRL+C */
46 #define KE_STATUS_SHIFT		'\x13'	/**< CTRL+S */
47 #define KE_STATUS_RESET		'\x1a'	/**< CTRL+Z */
48 #define KE_C_O			'\x0f'  /**< CTRL+O */
49 
50 /*
51 
52 */
53 
54 #define KE_ESCAPE	'\x1b'
55 #define KE_SPACE	' '
56 #define KE_TAB		'\t'
57 #define KE_ENTER	'\n'
58 #define KE_ENTER2	'\r'
59 #define KE_BKSPACE1	'\x08'
60 #define KE_BKSPACE2	'\x7f'
61 
62 /*
63     All non-symbol keys (function keys, arrows, etc) must be xx00
64     because of biew dos-dependent key treatment (will be fixed)
65 */
66 
67 #include <curses.h>
68 #define _2B(x)	(((x)&0xff)<<8)
69 /* #define KE_ENTER	_2B(KEY_ENTER) */
70 #define KE_BKSPACE	_2B(KEY_BACKSPACE)
71 #define KE_DOWNARROW	_2B(KEY_DOWN)
72 #define KE_UPARROW	_2B(KEY_UP)
73 #define KE_LEFTARROW	_2B(KEY_LEFT)
74 #define KE_RIGHTARROW	_2B(KEY_RIGHT)
75 #define KE_HOME		_2B(KEY_HOME)
76 #define KE_END		_2B(KEY_END)
77 #define KE_PGUP		_2B(KEY_PPAGE)
78 #define KE_PGDN		_2B(KEY_NPAGE)
79 #define KE_INS		_2B(KEY_IC)
80 #define KE_DEL		_2B(KEY_DC)
81 #define KE_F(x)		_2B(KEY_F(x))
82 
83 
84 /*
85     do not edit below
86 */
87 
88 #define ADD_CONTROL	0x010000
89 #define ADD_ALT		0x020000
90 #define ADD_SHIFT	0x040000
91 
92 #define KE_CTL_LEFTARROW	(_2B(0x0189)|ADD_CONTROL)
93 #define KE_CTL_RIGHTARROW	(_2B(0x0192)|ADD_CONTROL)
94 
95 #define KE_SHIFT_TAB	(_2B(0x0161)|ADD_SHIFT)
96 #define KE_CTL_BKSPACE	(KE_BKSPACE|ADD_CONTROL)
97 #define KE_CTL_ENTER	(KE_ENTER|ADD_CONTROL)
98 #define KE_CTL_BREAK	(KE_BREAK|ADD_CONTROL)
99 
100 #define KE_CTL_PGDN	(_2B(0x018c)|ADD_CONTROL)
101 #define KE_CTL_PGUP	(_2B(0x018e)|ADD_CONTROL)
102 #define KE_CTL_HOME	(_2B(0x0187)|ADD_CONTROL)
103 #define KE_CTL_END	(_2B(0x0169)|ADD_CONTROL)
104 
105 #define KE_SHIFT_F(x)	(_2B(0x0114+x)|ADD_SHIFT)
106 #define KE_CTL_F(x)	(_2B(0x0120+x)|ADD_CONTROL)
107 #define KE_ALT_F(x)	(_2B(0x012c+x)|ADD_ALT)
108 
109 /*
110 #define KE_ALT_(x)	( (x) | ADD_ALT)
111 #define KE_CTL_(x)	( (x) | ADD_CONTROL)
112 */
113 
114 #define SCAN_A  0x1e
115 #define SCAN_B  0x30
116 #define SCAN_C  0x2e
117 #define SCAN_D  0x20
118 #define SCAN_E  0x12
119 #define SCAN_F  0x21
120 #define SCAN_G  0x22
121 #define SCAN_H  0x23
122 #define SCAN_I  0x17
123 #define SCAN_J  0x24
124 #define SCAN_K  0x25
125 #define SCAN_L  0x26
126 #define SCAN_M  0x31
127 #define SCAN_N  0x32
128 #define SCAN_O  0x18
129 #define SCAN_P  0x19
130 #define SCAN_Q  0x10
131 #define SCAN_R  0x13
132 #define SCAN_S  0x1f
133 #define SCAN_T  0x14
134 #define SCAN_U  0x16
135 #define SCAN_V  0x2f
136 #define SCAN_W  0x11
137 #define SCAN_X  0x2d
138 #define SCAN_Y  0x15
139 #define SCAN_Z  0x2c
140 
141 #define ENUM_A  0x01
142 #define ENUM_B  0x02
143 #define ENUM_C  0x03
144 #define ENUM_D  0x04
145 #define ENUM_E  0x05
146 #define ENUM_F  0x06
147 #define ENUM_G  0x07
148 #define ENUM_H  0x08
149 #define ENUM_I  0x09
150 #define ENUM_J  0x0a
151 #define ENUM_K  0x0b
152 #define ENUM_L  0x0c
153 #define ENUM_M  0x0d
154 #define ENUM_N  0x0e
155 #define ENUM_O  0x0f
156 #define ENUM_P  0x10
157 #define ENUM_Q  0x11
158 #define ENUM_R  0x12
159 #define ENUM_S  0x13
160 #define ENUM_T  0x14
161 #define ENUM_U  0x15
162 #define ENUM_V  0x16
163 #define ENUM_W  0x17
164 #define ENUM_X  0x18
165 #define ENUM_Y  0x19
166 #define ENUM_Z  0x1a
167 
168 #define __SCAN_(x) (SCAN_##x)
169 #define __ENUM_(x) (ENUM_##x)
170 
171 #define KE_CTL_(x) ((((__SCAN_(x)<<8)&0xFF00)|((__ENUM_(x)-__ENUM_(A)+1)&0x00FF))|ADD_CONTROL)
172 #define KE_ALT_(x) ((((__SCAN_(x)<<8)&0xFF00)|ADD_ALT)
173 
174 #endif	/* __KBD_CODE_H */
175