use timer_delay instead of d_delay
[btb/d2x.git] / arch / sdl / key.c
1 /* $Id: key.c,v 1.3 2003-02-27 22:07:21 btb Exp $ */
2 /*
3  *
4  * SDL keyboard input support
5  *
6  *
7  */
8
9 #ifdef HAVE_CONFIG_H
10 #include <conf.h>
11 #endif
12
13 #include <stdio.h>
14 #include <stdlib.h>
15
16 #include <SDL.h>
17
18 #include "event.h"
19 #include "error.h"
20 #include "key.h"
21 #include "timer.h"
22
23
24 #define KEY_BUFFER_SIZE 16
25
26 static unsigned char Installed = 0;
27
28 //-------- Variable accessed by outside functions ---------
29 unsigned char           keyd_buffer_type;               // 0=No buffer, 1=buffer ASCII, 2=buffer scans
30 unsigned char           keyd_repeat;
31 unsigned char           keyd_editor_mode;
32 volatile unsigned char  keyd_last_pressed;
33 volatile unsigned char  keyd_last_released;
34 volatile unsigned char  keyd_pressed[256];
35 volatile int            keyd_time_when_last_pressed;
36
37 typedef struct Key_info {
38         ubyte           state;                  // state of key 1 == down, 0 == up
39         ubyte           last_state;             // previous state of key
40         int             counter;                // incremented each time key is down in handler
41         fix             timewentdown;   // simple counter incremented each time in interrupt and key is down
42         fix             timehelddown;   // counter to tell how long key is down -- gets reset to 0 by key routines
43         ubyte           downcount;              // number of key counts key was down
44         ubyte           upcount;                // number of times key was released
45 } Key_info;
46
47 typedef struct keyboard {
48         unsigned short          keybuffer[KEY_BUFFER_SIZE];
49         Key_info                keys[256];
50         fix                     time_pressed[KEY_BUFFER_SIZE];
51         unsigned int            keyhead, keytail;
52 } keyboard;
53
54 static keyboard key_data;
55
56 typedef struct key_props {
57         char *key_text;
58         unsigned char ascii_value;
59         unsigned char shifted_ascii_value;
60         SDLKey sym;
61 } key_props;
62
63 key_props key_properties[256] = {
64 { "",       255,    255,    -1                 },
65 { "ESC",    255,    255,    SDLK_ESCAPE        },
66 { "1",      '1',    '!',    SDLK_1             },
67 { "2",      '2',    '@',    SDLK_2             },
68 { "3",      '3',    '#',    SDLK_3             },
69 { "4",      '4',    '$',    SDLK_4             },
70 { "5",      '5',    '%',    SDLK_5             },
71 { "6",      '6',    '^',    SDLK_6             },
72 { "7",      '7',    '&',    SDLK_7             },
73 { "8",      '8',    '*',    SDLK_8             },
74 { "9",      '9',    '(',    SDLK_9             },
75 { "0",      '0',    ')',    SDLK_0             },
76 { "-",      '-',    '_',    SDLK_MINUS         },
77 { "=",      '=',    '+',    SDLK_EQUALS        },
78 { "BSPC",   255,    255,    SDLK_BACKSPACE     },
79 { "TAB",    255,    255,    SDLK_TAB           },
80 { "Q",      'q',    'Q',    SDLK_q             },
81 { "W",      'w',    'W',    SDLK_w             },
82 { "E",      'e',    'E',    SDLK_e             },
83 { "R",      'r',    'R',    SDLK_r             },
84 { "T",      't',    'T',    SDLK_t             },
85 { "Y",      'y',    'Y',    SDLK_y             },
86 { "U",      'u',    'U',    SDLK_u             },
87 { "I",      'i',    'I',    SDLK_i             },
88 { "O",      'o',    'O',    SDLK_o             },
89 { "P",      'p',    'P',    SDLK_p             },
90 { "[",      '[',    '{',    SDLK_LEFTBRACKET   },
91 { "]",      ']',    '}',    SDLK_RIGHTBRACKET  },
92 //edited 06/08/99 Matt Mueller - set to correct key_text
93 { "\83",      255,    255,    SDLK_RETURN        },
94 //end edit -MM
95 { "LCTRL",  255,    255,    SDLK_LCTRL         },
96 { "A",      'a',    'A',    SDLK_a             },
97 { "S",      's',    'S',    SDLK_s             },
98 { "D",      'd',    'D',    SDLK_d             },
99 { "F",      'f',    'F',    SDLK_f             },
100 { "G",      'g',    'G',    SDLK_g             },
101 { "H",      'h',    'H',    SDLK_h             },
102 { "J",      'j',    'J',    SDLK_j             },
103 { "K",      'k',    'K',    SDLK_k             },
104 { "L",      'l',    'L',    SDLK_l             },
105 //edited 06/08/99 Matt Mueller - set to correct sym
106 { ";",      ';',    ':',    SDLK_SEMICOLON         },
107 //end edit -MM
108 { "'",      '\'',   '"',    SDLK_QUOTE         },
109 //edited 06/08/99 Matt Mueller - set to correct sym
110 { "`",      '`',    '~',    SDLK_BACKQUOTE     },
111 //end edit -MM
112 { "LSHFT",  255,    255,    SDLK_LSHIFT        },
113 { "\\",     '\\',   '|',    SDLK_BACKSLASH     },
114 { "Z",      'z',    'Z',    SDLK_z             },
115 { "X",      'x',    'X',    SDLK_x             },
116 { "C",      'c',    'C',    SDLK_c             },
117 { "V",      'v',    'V',    SDLK_v             },
118 { "B",      'b',    'B',    SDLK_b             },
119 { "N",      'n',    'N',    SDLK_n             },
120 { "M",      'm',    'M',    SDLK_m             },
121 //edited 06/08/99 Matt Mueller - set to correct syms
122 { ",",      ',',    '<',    SDLK_COMMA  },
123 { ".",      '.',    '>',    SDLK_PERIOD },
124 { "/",      '/',    '?',    SDLK_SLASH  },
125 //end edit -MM
126 { "RSHFT",  255,    255,    SDLK_RSHIFT },
127 { "PAD*",   '*',    255,    SDLK_KP_MULTIPLY   },
128 { "LALT",   255,    255,    SDLK_LALT          },
129 { "SPC",    ' ',    ' ',    SDLK_SPACE         },
130 { "CPSLK",  255,    255,    SDLK_CAPSLOCK      },
131 { "F1",     255,    255,    SDLK_F1            },
132 { "F2",     255,    255,    SDLK_F2            },
133 { "F3",     255,    255,    SDLK_F3            },
134 { "F4",     255,    255,    SDLK_F4            },
135 { "F5",     255,    255,    SDLK_F5            },
136 { "F6",     255,    255,    SDLK_F6            },
137 { "F7",     255,    255,    SDLK_F7            },
138 { "F8",     255,    255,    SDLK_F8            },
139 { "F9",     255,    255,    SDLK_F9            },
140 { "F10",    255,    255,    SDLK_F10           },
141 { "NMLCK",  255,    255,    SDLK_NUMLOCK       },
142 { "SCLK",   255,    255,    SDLK_SCROLLOCK     },
143 { "PAD7",   255,    255,    SDLK_KP7           },
144 { "PAD8",   255,    255,    SDLK_KP8           },
145 { "PAD9",   255,    255,    SDLK_KP9           },
146 { "PAD-",   255,    255,    SDLK_KP_MINUS      },
147 { "PAD4",   255,    255,    SDLK_KP4           },
148 { "PAD5",   255,    255,    SDLK_KP5           },
149 { "PAD6",   255,    255,    SDLK_KP6           },
150 { "PAD+",   255,    255,    SDLK_KP_PLUS       },
151 { "PAD1",   255,    255,    SDLK_KP1           },
152 { "PAD2",   255,    255,    SDLK_KP2           },
153 { "PAD3",   255,    255,    SDLK_KP3           },
154 { "PAD0",   255,    255,    SDLK_KP0           },
155 { "PAD.",   255,    255,    SDLK_KP_PERIOD     },
156 { "",       255,    255,    -1                 },
157 { "",       255,    255,    -1                 },
158 { "",       255,    255,    -1                 },
159 { "F11",    255,    255,    SDLK_F11           },
160 { "F12",    255,    255,    SDLK_F12           },
161 { "",       255,    255,    -1                 },       
162 { "",       255,    255,    -1                 },
163 { "",       255,    255,    -1                 },
164 { "",       255,    255,    -1                 },
165 { "",       255,    255,    -1                 },
166 { "",       255,    255,    -1                 },
167 { "",       255,    255,    -1                 },
168 { "",       255,    255,    -1                 },
169 //edited 06/08/99 Matt Mueller - add pause ability
170 { "PAUSE",       255,    255,    SDLK_PAUSE                 },
171 //end edit -MM
172 { "",       255,    255,    -1                 },
173 { "",       255,    255,    -1                 },
174 { "",       255,    255,    -1                 },
175 { "",       255,    255,    -1                 },
176 { "",       255,    255,    -1                 },
177 { "",       255,    255,    -1                 },
178 { "",       255,    255,    -1                 },
179 { "",       255,    255,    -1                 },
180 { "",       255,    255,    -1                 },
181 { "",       255,    255,    -1                 },
182 { "",       255,    255,    -1                 },
183 { "",       255,    255,    -1                 },
184 { "",       255,    255,    -1                 },
185 { "",       255,    255,    -1                 },
186 { "",       255,    255,    -1                 },
187 { "",       255,    255,    -1                 },
188 { "",       255,    255,    -1                 },
189 { "",       255,    255,    -1                 },
190 { "",       255,    255,    -1                 },
191 { "",       255,    255,    -1                 },
192 { "",       255,    255,    -1                 },
193 { "",       255,    255,    -1                 },
194 { "",       255,    255,    -1                 },
195 { "",       255,    255,    -1                 },
196 { "",       255,    255,    -1                 },
197 { "",       255,    255,    -1                 },
198 { "",       255,    255,    -1                 },
199 { "",       255,    255,    -1                 },
200 { "",       255,    255,    -1                 },
201 { "",       255,    255,    -1                 },
202 { "",       255,    255,    -1                 },
203 { "",       255,    255,    -1                 },
204 { "",       255,    255,    -1                 },
205 { "",       255,    255,    -1                 },
206 { "",       255,    255,    -1                 },
207 { "",       255,    255,    -1                 },
208 { "",       255,    255,    -1                 },
209 { "",       255,    255,    -1                 },
210 { "",       255,    255,    -1                 },
211 { "",       255,    255,    -1                 },
212 { "",       255,    255,    -1                 },
213 { "",       255,    255,    -1                 },
214 { "",       255,    255,    -1                 },
215 { "",       255,    255,    -1                 },
216 { "",       255,    255,    -1                 },
217 { "",       255,    255,    -1                 },
218 { "",       255,    255,    -1                 },
219 { "",       255,    255,    -1                 },
220 { "",       255,    255,    -1                 },
221 { "",       255,    255,    -1                 },
222 { "",       255,    255,    -1                 },
223 { "",       255,    255,    -1                 },
224 { "",       255,    255,    -1                 },
225 { "",       255,    255,    -1                 },
226 { "",       255,    255,    -1                 },
227 { "",       255,    255,    -1                 },
228 { "",       255,    255,    -1                 },
229 { "",       255,    255,    -1                 },
230 //edited 06/08/99 Matt Mueller - set to correct key_text
231 { "PAD\83",   255,    255,    SDLK_KP_ENTER      },
232 //end edit -MM
233 //edited 06/08/99 Matt Mueller - set to correct sym
234 { "RCTRL",  255,    255,    SDLK_RCTRL            },
235 //end edit -MM
236 { "",       255,    255,    -1                 },
237 { "",       255,    255,    -1                 },
238 { "",       255,    255,    -1                 },
239 { "",       255,    255,    -1                 },
240 { "",       255,    255,    -1                 },
241 { "",       255,    255,    -1                 },
242 { "",       255,    255,    -1                 },
243 { "",       255,    255,    -1                 },
244 { "",       255,    255,    -1                 },
245 { "",       255,    255,    -1                 },
246 { "",       255,    255,    -1                 },
247 { "",       255,    255,    -1                 },
248 { "",       255,    255,    -1                 },
249 { "",       255,    255,    -1                 },
250 { "",       255,    255,    -1                 },
251 { "",       255,    255,    -1                 },
252 { "",       255,    255,    -1                 },
253 { "",       255,    255,    -1                 },
254 { "",       255,    255,    -1                 },
255 { "",       255,    255,    -1                 },
256 { "",       255,    255,    -1                 },
257 { "",       255,    255,    -1                 },
258 { "",       255,    255,    -1                 },
259 { "PAD/",   255,    255,    SDLK_KP_DIVIDE     },
260 { "",       255,    255,    -1                 },
261 //edited 06/08/99 Matt Mueller - add printscreen ability
262 { "PRSCR",       255,    255,    SDLK_PRINT                 },
263 //end edit -MM
264 { "RALT",   255,    255,    SDLK_RALT          },
265 { "",       255,    255,    -1                 },
266 { "",       255,    255,    -1                 },
267 { "",       255,    255,    -1                 },
268 { "",       255,    255,    -1                 },
269 { "",       255,    255,    -1                 },
270 { "",       255,    255,    -1                 },
271 { "",       255,    255,    -1                 },
272 { "",       255,    255,    -1                 },
273 { "",       255,    255,    -1                 },
274 { "",       255,    255,    -1                 },
275 { "",       255,    255,    -1                 },
276 { "",       255,    255,    -1                 },
277 { "",       255,    255,    -1                 },
278 { "",       255,    255,    -1                 },
279 { "HOME",   255,    255,    SDLK_HOME          },
280 //edited 06/08/99 Matt Mueller - set to correct key_text
281 { "UP",         255,    255,    SDLK_UP            },
282 //end edit -MM
283 { "PGUP",   255,    255,    SDLK_PAGEUP        },
284 { "",       255,    255,    -1                 },
285 //edited 06/08/99 Matt Mueller - set to correct key_text
286 { "LEFT",       255,    255,    SDLK_LEFT          },
287 //end edit -MM
288 { "",       255,    255,    -1                 },
289 //edited 06/08/99 Matt Mueller - set to correct key_text
290 { "RIGHT",      255,    255,    SDLK_RIGHT         },
291 //end edit -MM
292 { "",       255,    255,    -1                 },
293 //edited 06/08/99 Matt Mueller - set to correct key_text
294 { "END",    255,    255,    SDLK_END           },
295 //end edit -MM
296 { "DOWN",       255,    255,    SDLK_DOWN          },
297 { "PGDN",       255,    255,    SDLK_PAGEDOWN      },
298 { "INS",        255,    255,    SDLK_INSERT        },
299 { "DEL",        255,    255,    SDLK_DELETE        },
300 { "",       255,    255,    -1                 },
301 { "",       255,    255,    -1                 },
302 { "",       255,    255,    -1                 },
303 { "",       255,    255,    -1                 },
304 { "",       255,    255,    -1                 },
305 { "",       255,    255,    -1                 },
306 { "",       255,    255,    -1                 },
307 { "",       255,    255,    -1                 },
308 { "",       255,    255,    -1                 },
309 { "",       255,    255,    -1                 },
310 { "",       255,    255,    -1                 },
311 { "",       255,    255,    -1                 },
312 { "",       255,    255,    -1                 },
313 { "",       255,    255,    -1                 },
314 { "",       255,    255,    -1                 },
315 { "",       255,    255,    -1                 },
316 { "",       255,    255,    -1                 },
317 { "",       255,    255,    -1                 },
318 { "",       255,    255,    -1                 },
319 { "",       255,    255,    -1                 },
320 { "",       255,    255,    -1                 },
321 { "",       255,    255,    -1                 },
322 { "",       255,    255,    -1                 },
323 { "",       255,    255,    -1                 },
324 { "",       255,    255,    -1                 },
325 { "",       255,    255,    -1                 },
326 { "",       255,    255,    -1                 },
327 { "",       255,    255,    -1                 },
328 { "",       255,    255,    -1                 },
329 { "",       255,    255,    -1                 },
330 { "",       255,    255,    -1                 },
331 { "",       255,    255,    -1                 },
332 { "",       255,    255,    -1                 },
333 { "",       255,    255,    -1                 },
334 { "",       255,    255,    -1                 },
335 { "",       255,    255,    -1                 },
336 { "",       255,    255,    -1                 },
337 { "",       255,    255,    -1                 },
338 { "",       255,    255,    -1                 },
339 { "",       255,    255,    -1                 },
340 { "",       255,    255,    -1                 },
341 { "",       255,    255,    -1                 },
342 { "",       255,    255,    -1                 },
343 { "",       255,    255,    -1                 },
344 };
345
346 char *key_text[256];
347
348 void key_buid_key_text(void)
349 {
350 }
351
352 unsigned char key_to_ascii(int keycode )
353 {
354         int shifted;
355
356         shifted = keycode & KEY_SHIFTED;
357         keycode &= 0xFF;
358
359         if (shifted)
360                 return key_properties[keycode].shifted_ascii_value;
361         else
362                 return key_properties[keycode].ascii_value;
363 }
364
365 void key_handler(SDL_KeyboardEvent *event)
366 {
367         ubyte state;
368         int i, keycode, event_key, key_state;
369         Key_info *key;
370         unsigned char temp;
371
372         event_key = event->keysym.sym;
373
374         key_state = (event->state == SDL_PRESSED); //  !(wInfo & KF_UP);
375         //=====================================================
376         //Here a translation from win keycodes to mac keycodes!
377         //=====================================================
378
379         for (i = 255; i >= 0; i--) {
380
381                 keycode = i;
382                 key = &(key_data.keys[keycode]);
383                 if (key_properties[i].sym == event_key)
384                         state = key_state;
385                 else
386                         state = key->last_state;
387                         
388                 if ( key->last_state == state ) {
389                         if (state) {
390                                 key->counter++;
391                                 keyd_last_pressed = keycode;
392                                 keyd_time_when_last_pressed = timer_get_fixed_seconds();
393                         }
394                 } else {
395                         if (state)      {
396                                 keyd_last_pressed = keycode;
397                                 keyd_pressed[keycode] = 1;
398                                 key->downcount += state;
399                                 key->state = 1;
400                                 key->timewentdown = keyd_time_when_last_pressed = timer_get_fixed_seconds();
401                                 key->counter++;
402                         } else {        
403                                 keyd_pressed[keycode] = 0;
404                                 keyd_last_released = keycode;
405                                 key->upcount += key->state;
406                                 key->state = 0;
407                                 key->counter = 0;
408                                 key->timehelddown += timer_get_fixed_seconds() - key->timewentdown;
409                         }
410                 }
411                 if ( (state && !key->last_state) || (state && key->last_state && (key->counter > 30) && (key->counter & 0x01)) ) {
412                         if ( keyd_pressed[KEY_LSHIFT] || keyd_pressed[KEY_RSHIFT])
413                                 keycode |= KEY_SHIFTED;
414                         if ( keyd_pressed[KEY_LALT] || keyd_pressed[KEY_RALT])
415                                 keycode |= KEY_ALTED;
416                         if ( keyd_pressed[KEY_LCTRL] || keyd_pressed[KEY_RCTRL])
417                                 keycode |= KEY_CTRLED;
418                         if ( keyd_pressed[KEY_DELETE] )
419                                 keycode |= KEY_DEBUGGED;
420                         temp = key_data.keytail+1;
421                         if ( temp >= KEY_BUFFER_SIZE ) temp=0;
422                         if (temp!=key_data.keyhead)     {
423                                 key_data.keybuffer[key_data.keytail] = keycode;
424                                 key_data.time_pressed[key_data.keytail] = keyd_time_when_last_pressed;
425                                 key_data.keytail = temp;
426                         }
427                 }
428                 key->last_state = state;
429         }
430 }
431
432 void key_close()
433 {
434  Installed = 0;
435 }
436
437 void key_init()
438 {
439   int i;
440   
441   if (Installed) return;
442
443   Installed=1;
444
445   keyd_time_when_last_pressed = timer_get_fixed_seconds();
446   keyd_buffer_type = 1;
447   keyd_repeat = 1;
448   
449   for(i=0; i<256; i++)
450      key_text[i] = key_properties[i].key_text;
451      
452   // Clear the keyboard array
453   key_flush();
454   atexit(key_close);
455 }
456
457 void key_flush()
458 {
459         int i;
460         fix curtime;
461
462         if (!Installed)
463                 key_init();
464
465         key_data.keyhead = key_data.keytail = 0;
466
467         //Clear the keyboard buffer
468         for (i=0; i<KEY_BUFFER_SIZE; i++ )      {
469                 key_data.keybuffer[i] = 0;
470                 key_data.time_pressed[i] = 0;
471         }
472
473 //use gettimeofday here:
474         curtime = timer_get_fixed_seconds();
475
476         for (i=0; i<256; i++ )  {
477                 keyd_pressed[i] = 0;
478                 key_data.keys[i].state = 1;
479                 key_data.keys[i].last_state = 0;
480                 key_data.keys[i].timewentdown = curtime;
481                 key_data.keys[i].downcount=0;
482                 key_data.keys[i].upcount=0;
483                 key_data.keys[i].timehelddown = 0;
484                 key_data.keys[i].counter = 0;
485         }
486 }
487
488 int add_one(int n)
489 {
490  n++;
491  if ( n >= KEY_BUFFER_SIZE ) n=0;
492  return n;
493 }
494
495 int key_checkch()
496 {
497         int is_one_waiting = 0;
498         event_poll();
499         if (key_data.keytail!=key_data.keyhead)
500                 is_one_waiting = 1;
501         return is_one_waiting;
502 }
503
504 int key_inkey()
505 {
506         int key = 0;
507         if (!Installed)
508                 key_init();
509         event_poll();
510         if (key_data.keytail!=key_data.keyhead) {
511                 key = key_data.keybuffer[key_data.keyhead];
512                 key_data.keyhead = add_one(key_data.keyhead);
513         }
514 //added 9/3/98 by Matt Mueller to free cpu time instead of hogging during menus and such
515         else timer_delay(1);
516 //end addition - Matt Mueller
517              
518         return key;
519 }
520
521 int key_inkey_time(fix * time)
522 {
523         int key = 0;
524
525         if (!Installed)
526                 key_init();
527         event_poll();
528         if (key_data.keytail!=key_data.keyhead) {
529                 key = key_data.keybuffer[key_data.keyhead];
530                 *time = key_data.time_pressed[key_data.keyhead];
531                 key_data.keyhead = add_one(key_data.keyhead);
532         }
533         return key;
534 }
535
536 int key_peekkey()
537 {
538         int key = 0;
539         event_poll();
540         if (key_data.keytail!=key_data.keyhead)
541                 key = key_data.keybuffer[key_data.keyhead];
542
543         return key;
544 }
545
546 int key_getch()
547 {
548         int dummy=0;
549
550         if (!Installed)
551                 return 0;
552 //              return getch();
553
554         while (!key_checkch())
555                 dummy++;
556         return key_inkey();
557 }
558
559 unsigned int key_get_shift_status()
560 {
561         unsigned int shift_status = 0;
562
563         if ( keyd_pressed[KEY_LSHIFT] || keyd_pressed[KEY_RSHIFT] )
564                 shift_status |= KEY_SHIFTED;
565
566         if ( keyd_pressed[KEY_LALT] || keyd_pressed[KEY_RALT] )
567                 shift_status |= KEY_ALTED;
568
569         if ( keyd_pressed[KEY_LCTRL] || keyd_pressed[KEY_RCTRL] )
570                 shift_status |= KEY_CTRLED;
571
572 #ifndef NDEBUG
573         if (keyd_pressed[KEY_DELETE])
574                 shift_status |=KEY_DEBUGGED;
575 #endif
576
577         return shift_status;
578 }
579
580 // Returns the number of seconds this key has been down since last call.
581 fix key_down_time(int scancode)
582 {
583         fix time_down, time;
584
585         event_poll();
586         if ((scancode<0)|| (scancode>255)) return 0;
587
588         if (!keyd_pressed[scancode]) {
589                 time_down = key_data.keys[scancode].timehelddown;
590                 key_data.keys[scancode].timehelddown = 0;
591         } else {
592                 time = timer_get_fixed_seconds();
593                 time_down = time - key_data.keys[scancode].timewentdown;
594                 key_data.keys[scancode].timewentdown = time;
595         }
596
597         return time_down;
598 }
599
600 unsigned int key_down_count(int scancode)
601 {
602         int n;
603         event_poll();
604         if ((scancode<0)|| (scancode>255)) return 0;
605
606         n = key_data.keys[scancode].downcount;
607         key_data.keys[scancode].downcount = 0;
608
609         return n;
610 }
611
612 unsigned int key_up_count(int scancode)
613 {
614         int n;
615         event_poll();
616         if ((scancode<0)|| (scancode>255)) return 0;
617
618         n = key_data.keys[scancode].upcount;
619         key_data.keys[scancode].upcount = 0;
620
621         return n;
622 }