fix the last warning
[kugel-rb.git] / apps / plugins / zxbox / spkey_p.h
blob7823f25aa16c968f9e783fa1137df97d78689d60
1 /*
2 * Copyright (C) 1996-1998 Szeredi Miklos
3 * Email: mszeredi@inf.bme.hu
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version. See the file COPYING.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #ifndef SPKEY_P_H
22 #define SPKEY_P_H
24 #include "z80_type.h"
26 struct keystate {
27 dbyte press;
28 byte state;
29 byte base;
30 qbyte frame;
33 struct onekey {
34 int index;
35 unsigned keysym;
36 unsigned shifted;
37 unsigned modif;
40 typedef byte spkeyboard[8];
42 #define SPIP(spk, h) (((qbyte *) (spk))[h])
44 #define SP_COMBINE(spk1, spk2) \
45 SPIP(spk1, 0) |= SPIP(spk2, 0), \
46 SPIP(spk1, 1) |= SPIP(spk2, 1)
49 #define SP_SUBSTRACT(spk1, spk2) \
50 SPIP(spk1, 0) &= ~SPIP(spk2, 0), \
51 SPIP(spk1, 1) &= ~SPIP(spk2, 1)
54 #define SP_NONEMPTY(spk) (SPIP(spk, 0) || SPIP(spk, 1))
56 #define SP_CONTAINS(spk1, spk2) \
57 ((SPIP(spk1, 0) & SPIP(spk2, 0)) || (SPIP(spk1, 1) & SPIP(spk2, 1)))
59 #define SP_SETEMPTY(spk) \
60 SPIP(spk, 0) = 0, \
61 SPIP(spk, 1) = 0
63 #define SP_COPY(spk1, spk2) \
64 SPIP(spk1, 0) = SPIP(spk2, 0), \
65 SPIP(spk1, 1) = SPIP(spk2, 1)
68 #define TRKS(ks) ((ks) - 0xFF00 + 0x100)
69 #define KS_TO_KEY(ks) \
70 (((ks) >= 0x0000 && (ks) <= 0x00FF) ? (int) (ks) : \
71 (((ks) >= 0xFF00 && (ks) <= 0xFFFF) ? (int) TRKS(ks) : -1))
75 /* These are _accidently_ the same as the XK_ counterparts */
77 #define SK_BackSpace 0xFF08 /* back space, back char */
78 #define SK_Tab 0xFF09
79 #define SK_Linefeed 0xFF0A /* Linefeed, LF */
80 #define SK_Clear 0xFF0B
81 #define SK_Return 0xFF0D /* Return, enter */
82 #define SK_Pause 0xFF13 /* Pause, hold */
83 #define SK_Scroll_Lock 0xFF14
84 #define SK_Sys_Req 0xFF15
85 #define SK_Escape 0xFF1B
86 #define SK_Delete 0xFFFF /* Delete, rubout */
88 #define SK_Home 0xFF50
89 #define SK_Left 0xFF51 /* Move left, left arrow */
90 #define SK_Up 0xFF52 /* Move up, up arrow */
91 #define SK_Right 0xFF53 /* Move right, right arrow */
92 #define SK_Down 0xFF54 /* Move down, down arrow */
93 #define SK_Page_Up 0xFF55 /* Prior, previous */
94 #define SK_Page_Down 0xFF56 /* Next */
95 #define SK_End 0xFF57 /* EOL */
96 #define SK_Begin 0xFF58 /* BOL */
98 #define SK_Select 0xFF60 /* Select, mark */
99 #define SK_Print 0xFF61
100 #define SK_Execute 0xFF62 /* Execute, run, do */
101 #define SK_Insert 0xFF63 /* Insert, insert here */
102 #define SK_Undo 0xFF65 /* Undo, oops */
103 #define SK_Redo 0xFF66 /* redo, again */
104 #define SK_Menu 0xFF67
105 #define SK_Find 0xFF68 /* Find, search */
106 #define SK_Cancel 0xFF69 /* Cancel, stop, abort, exit */
107 #define SK_Help 0xFF6A /* Help */
108 #define SK_Break 0xFF6B
109 #define SK_Mode_switch 0xFF7E /* Character set switch */
110 #define SK_Num_Lock 0xFF7F
112 #define SK_KP_Space 0xFF80 /* space */
113 #define SK_KP_Tab 0xFF89
114 #define SK_KP_Enter 0xFF8D /* enter */
115 #define SK_KP_F1 0xFF91 /* PF1, KP_A, ... */
116 #define SK_KP_F2 0xFF92
117 #define SK_KP_F3 0xFF93
118 #define SK_KP_F4 0xFF94
119 #define SK_KP_Home 0xFF95
120 #define SK_KP_Left 0xFF96
121 #define SK_KP_Up 0xFF97
122 #define SK_KP_Right 0xFF98
123 #define SK_KP_Down 0xFF99
124 #define SK_KP_Page_Up 0xFF9A
125 #define SK_KP_Page_Down 0xFF9B
126 #define SK_KP_End 0xFF9C
127 #define SK_KP_Begin 0xFF9D
128 #define SK_KP_Insert 0xFF9E
129 #define SK_KP_Delete 0xFF9F
130 #define SK_KP_Equal 0xFFBD /* equals */
131 #define SK_KP_Multiply 0xFFAA
132 #define SK_KP_Add 0xFFAB
133 #define SK_KP_Separator 0xFFAC /* separator, often comma */
134 #define SK_KP_Subtract 0xFFAD
135 #define SK_KP_Decimal 0xFFAE
136 #define SK_KP_Divide 0xFFAF
138 #define SK_KP_0 0xFFB0
139 #define SK_KP_1 0xFFB1
140 #define SK_KP_2 0xFFB2
141 #define SK_KP_3 0xFFB3
142 #define SK_KP_4 0xFFB4
143 #define SK_KP_5 0xFFB5
144 #define SK_KP_6 0xFFB6
145 #define SK_KP_7 0xFFB7
146 #define SK_KP_8 0xFFB8
147 #define SK_KP_9 0xFFB9
149 #define SK_F1 0xFFBE
150 #define SK_F2 0xFFBF
151 #define SK_F3 0xFFC0
152 #define SK_F4 0xFFC1
153 #define SK_F5 0xFFC2
154 #define SK_F6 0xFFC3
155 #define SK_F7 0xFFC4
156 #define SK_F8 0xFFC5
157 #define SK_F9 0xFFC6
158 #define SK_F10 0xFFC7
159 #define SK_F11 0xFFC8
160 #define SK_F12 0xFFC9
162 #define SK_Shift_L 0xFFE1 /* Left shift */
163 #define SK_Shift_R 0xFFE2 /* Right shift */
164 #define SK_Control_L 0xFFE3 /* Left control */
165 #define SK_Control_R 0xFFE4 /* Right control */
166 #define SK_Caps_Lock 0xFFE5 /* Caps lock */
167 #define SK_Shift_Lock 0xFFE6 /* Shift lock */
169 #define SK_Meta_L 0xFFE7 /* Left meta */
170 #define SK_Meta_R 0xFFE8 /* Right meta */
171 #define SK_Alt_L 0xFFE9 /* Left alt */
172 #define SK_Alt_R 0xFFEA /* Right alt */
173 #define SK_Super_L 0xFFEB /* Left super */
174 #define SK_Super_R 0xFFEC /* Right super */
175 #define SK_Hyper_L 0xFFED /* Left hyper */
176 #define SK_Hyper_R 0xFFEE /* Right hyper */
178 /* Modifier masks */
180 #define SKShiftMask (1<<0)
181 #define SKLockMask (1<<1)
182 #define SKControlMask (1<<2)
183 #define SKMod1Mask (1<<3)
184 #define SKMod2Mask (1<<4)
185 #define SKMod3Mask (1<<5)
186 #define SKMod4Mask (1<<6)
187 #define SKMod5Mask (1<<7)
190 #define NR_SPKEYS 512
192 #define ISFKEY(ks) ((ks) >= SK_F1 && (ks) <= SK_F12)
194 extern volatile int accept_keys;
196 extern qbyte sp_int_ctr;
197 extern struct keystate spkb_kbstate[];
198 extern struct onekey spkb_last;
200 extern int spkb_state_changed;
202 extern spkeyboard spkey_state;
203 extern spkeyboard kb_mkey;
205 extern void spkey_textmode(void);
206 extern void spkey_screenmode(void);
208 extern const int need_switch_mode;
210 extern void spkb_refresh(void);
211 extern void clear_keystates(void);
212 extern int display_keyboard(void);
213 extern void process_keys(void);
214 extern void init_basekeys(void);
216 #endif /* SPKEY_P_H */