]> git.jsancho.org Git - lugaru.git/blob - Source/SDLInput.cpp
More work: compiles, missing like 5 symbols.
[lugaru.git] / Source / SDLInput.cpp
1 #if USE_SDL
2
3 /**> HEADER FILES <**/
4 #include "SDLInput.h"
5 #include <stdio.h>
6 #include <stdlib.h>
7 #include <string.h>
8
9 extern bool keyboardfrozen;
10 extern bool buttons[3];
11 /********************> IsKeyDown() <*****/
12 Boolean IsKeyDown( unsigned char *keyMap, unsigned short theKey )
13 {
14         if(keyboardfrozen)return 0;
15         if(theKey< 0x80 /*1000*/){
16                 static long     keyMapIndex;
17                 static Boolean  isKeyDown;
18                 static short    bitToCheck;
19
20                 // Calculate the key map index
21                 keyMapIndex = keyMap[theKey/8];
22
23                 // Calculate the individual bit to check
24                 bitToCheck = theKey%8;
25
26                 // Check the status of the key
27                 isKeyDown = ( keyMapIndex >> bitToCheck ) & 0x01;
28
29                 // Return the status of the key
30                 return isKeyDown;
31         }
32         else if(theKey==MAC_MOUSEBUTTON1)
33                 return buttons[0];
34         else if(theKey==MAC_MOUSEBUTTON2)
35                 return buttons[1];
36
37         return 0;
38 }
39
40 unsigned short  CharToKey(char* which)
41 {
42         // alphabetic keys
43         if(!stricmp(which,"a")){
44                 return MAC_A_KEY;
45         }
46         if(!stricmp(which,"b")){
47                 return MAC_B_KEY;
48         }
49         if(!stricmp(which,"c")){
50                 return MAC_C_KEY;
51         }
52         if(!stricmp(which,"d")){
53                 return MAC_D_KEY;
54         }
55         if(!stricmp(which,"e")){
56                 return MAC_E_KEY;
57         }
58         if(!stricmp(which,"f")){
59                 return MAC_F_KEY;
60         }
61         if(!stricmp(which,"g")){
62                 return MAC_G_KEY;
63         }
64         if(!stricmp(which,"h")){
65                 return MAC_H_KEY;
66         }
67         if(!stricmp(which,"i")){
68                 return MAC_I_KEY;
69         }
70         if(!stricmp(which,"j")){
71                 return MAC_J_KEY;
72         }
73         if(!stricmp(which,"k")){
74                 return MAC_K_KEY;
75         }
76         if(!stricmp(which,"l")){
77                 return MAC_L_KEY;
78         }
79         if(!stricmp(which,"m")){
80                 return MAC_M_KEY;
81         }
82         if(!stricmp(which,"n")){
83                 return MAC_N_KEY;
84         }
85         if(!stricmp(which,"o")){
86                 return MAC_O_KEY;
87         }
88         if(!stricmp(which,"p")){
89                 return MAC_P_KEY;
90         }
91         if(!stricmp(which,"q")){
92                 return MAC_Q_KEY;
93         }
94         if(!stricmp(which,"r")){
95                 return MAC_R_KEY;
96         }
97         if(!stricmp(which,"s")){
98                 return MAC_S_KEY;
99         }
100         if(!stricmp(which,"t")){
101                 return MAC_T_KEY;
102         }
103         if(!stricmp(which,"u")){
104                 return MAC_U_KEY;
105         }
106         if(!stricmp(which,"v")){
107                 return MAC_V_KEY;
108         }
109         if(!stricmp(which,"w")){
110                 return MAC_W_KEY;
111         }
112         if(!stricmp(which,"x")){
113                 return MAC_X_KEY;
114         }
115         if(!stricmp(which,"y")){
116                 return MAC_Y_KEY;
117         }
118         if(!stricmp(which,"z")){
119                 return MAC_Z_KEY;
120         }
121
122         // keypad keys
123         if(!stricmp(which,"KP0")){
124                 return MAC_NUMPAD_0_KEY;
125         }
126         if(!stricmp(which,"KP1")){
127                 return MAC_NUMPAD_1_KEY;
128         }
129         if(!stricmp(which,"KP2")){
130                 return MAC_NUMPAD_2_KEY;
131         }
132         if(!stricmp(which,"KP3")){
133                 return MAC_NUMPAD_3_KEY;
134         }
135         if(!stricmp(which,"KP4")){
136                 return MAC_NUMPAD_4_KEY;
137         }
138         if(!stricmp(which,"KP5")){
139                 return MAC_NUMPAD_5_KEY;
140         }
141         if(!stricmp(which,"KP6")){
142                 return MAC_NUMPAD_6_KEY;
143         }
144         if(!stricmp(which,"KP7")){
145                 return MAC_NUMPAD_7_KEY;
146         }
147         if(!stricmp(which,"KP8")){
148                 return MAC_NUMPAD_8_KEY;
149         }
150         if(!stricmp(which,"KP9")){
151                 return MAC_NUMPAD_9_KEY;
152         }
153
154         // enter
155         if(!stricmp(which,"enter")){
156                 return MAC_ENTER_KEY;
157         }
158
159         // number keys
160         if(!stricmp(which,"0")){
161                 return MAC_0_KEY;
162         }
163         if(!stricmp(which,"1")){
164                 return MAC_1_KEY;
165         }
166         if(!stricmp(which,"2")){
167                 return MAC_2_KEY;
168         }
169         if(!stricmp(which,"3")){
170                 return MAC_3_KEY;
171         }
172         if(!stricmp(which,"4")){
173                 return MAC_4_KEY;
174         }
175         if(!stricmp(which,"5")){
176                 return MAC_5_KEY;
177         }
178         if(!stricmp(which,"6")){
179                 return MAC_6_KEY;
180         }
181         if(!stricmp(which,"7")){
182                 return MAC_7_KEY;
183         }
184         if(!stricmp(which,"8")){
185                 return MAC_8_KEY;
186         }
187         if(!stricmp(which,"9")){
188                 return MAC_9_KEY;
189         }
190
191         // function keys
192         if(!stricmp(which,"F1")){
193                 return MAC_F1_KEY;
194         }
195         if(!stricmp(which,"F2")){
196                 return MAC_F2_KEY;
197         }
198         if(!stricmp(which,"F3")){
199                 return MAC_F3_KEY;
200         }
201         if(!stricmp(which,"F4")){
202                 return MAC_F4_KEY;
203         }
204         if(!stricmp(which,"F5")){
205                 return MAC_F5_KEY;
206         }
207         if(!stricmp(which,"F6")){
208                 return MAC_F6_KEY;
209         }
210         if(!stricmp(which,"F7")){
211                 return MAC_F7_KEY;
212         }
213         if(!stricmp(which,"F8")){
214                 return MAC_F8_KEY;
215         }
216         if(!stricmp(which,"F9")){
217                 return MAC_F9_KEY;
218         }
219         if(!stricmp(which,"F10")){
220                 return MAC_F10_KEY;
221         }
222         if(!stricmp(which,"F11")){
223                 return MAC_F11_KEY;
224         }
225         if(!stricmp(which,"F12")){
226                 return MAC_F12_KEY;
227         }
228
229         // escape
230         if(!stricmp(which,"escape")){
231                 return MAC_ESCAPE_KEY;
232         }
233         if(!stricmp(which,"backspace")){
234                 return MAC_DELETE_KEY;
235         }
236         if(!stricmp(which,"tab")){
237                 return MAC_TAB_KEY;
238         }
239         if(!stricmp(which,"`")){
240                 return MAC_TILDE_KEY;
241         }
242         if(!stricmp(which,"caps_lock")){
243                 return MAC_CAPS_LOCK_KEY;
244         }
245 //      if(which==){
246 //              return "";
247 //      }
248         if(!stricmp(which,"command")){
249                 return MAC_COMMAND_KEY;
250         }
251         if(!stricmp(which,"option")){
252                 return MAC_OPTION_KEY;
253         }
254         if(!stricmp(which,"delete")){
255                 return MAC_DEL_KEY;
256         }
257         if(!stricmp(which,"insert")){
258                 return MAC_INSERT_KEY;
259         }
260         if(!stricmp(which,"home")){
261                 return MAC_HOME_KEY;
262         }
263         if(!stricmp(which,"end")){
264                 return MAC_END_KEY;
265         }
266         if(!stricmp(which,"page_up")){
267                 return MAC_PAGE_UP_KEY;
268         }
269         if(!stricmp(which,"page_down")){
270                 return MAC_PAGE_DOWN_KEY;
271         }
272         if(!stricmp(which,"clear")){
273                 return MAC_NUMPAD_CLEAR_KEY;
274         }
275
276         if(!stricmp(which,"control")){
277                 return MAC_CONTROL_KEY;
278         }
279         if(!stricmp(which,"return")){
280                 return MAC_RETURN_KEY;
281         }
282         if(!stricmp(which,"space")){
283                 return MAC_SPACE_KEY;
284         }
285         if(!stricmp(which,"shift")){
286                 return MAC_SHIFT_KEY;
287         }
288         if(!stricmp(which,"uparrow")){
289                 return MAC_ARROW_UP_KEY;
290         }
291         if(!stricmp(which,"downarrow")){
292                 return MAC_ARROW_DOWN_KEY;
293         }
294         if(!stricmp(which,"leftarrow")){
295                 return MAC_ARROW_LEFT_KEY;
296         }
297         if(!stricmp(which,"rightarrow")){
298                 return MAC_ARROW_RIGHT_KEY;
299         }
300         if(!stricmp(which,"mouse1")){
301                 return MAC_MOUSEBUTTON1;
302         }
303         if(!stricmp(which,"mouse2")){
304                 return MAC_MOUSEBUTTON2;
305         }
306         if(!stricmp(which,"+")){
307                 return MAC_NUMPAD_PLUS_KEY;
308         }
309         if(!stricmp(which,"*")){
310                 return MAC_NUMPAD_ASTERISK_KEY;
311         }
312         if(!stricmp(which,"/")){
313                 return MAC_SLASH_KEY;
314         }
315         if(!stricmp(which,"\\")){
316                 return MAC_BACKSLASH_KEY;
317         }
318         if(!stricmp(which,"[")){
319                 return MAC_LEFTBRACKET_KEY;
320         }
321         if(!stricmp(which,"]")){
322                 return MAC_RIGHTBRACKET_KEY;
323         }
324         if(!stricmp(which,".")){
325                 return MAC_PERIOD_KEY;
326         }
327         if(!stricmp(which,",")){
328                 return MAC_COMMA_KEY;
329         }
330         if(!stricmp(which,"\"")){
331                 return MAC_APOSTROPHE_KEY;
332         }
333         if(!stricmp(which,";")){
334                 return MAC_SEMICOLON_KEY;
335         }
336         return UNKNOWN_KEY;
337 }
338
339 char*   KeyToChar(unsigned short which)
340 {
341         static int i;
342
343         // alphabetic keys
344         if(which==MAC_A_KEY){
345                 return "a";
346         }
347         if(which==MAC_B_KEY){
348                 return "b";
349         }
350         if(which==MAC_C_KEY){
351                 return "c";
352         }
353         if(which==MAC_D_KEY){
354                 return "d";
355         }
356         if(which==MAC_E_KEY){
357                 return "e";
358         }
359         if(which==MAC_F_KEY){
360                 return "f";
361         }
362         if(which==MAC_G_KEY){
363                 return "g";
364         }
365         if(which==MAC_H_KEY){
366                 return "h";
367         }
368         if(which==MAC_I_KEY){
369                 return "i";
370         }
371         if(which==MAC_J_KEY){
372                 return "j";
373         }
374         if(which==MAC_K_KEY){
375                 return "k";
376         }
377         if(which==MAC_L_KEY){
378                 return "l";
379         }
380         if(which==MAC_M_KEY){
381                 return "m";
382         }
383         if(which==MAC_N_KEY){
384                 return "n";
385         }
386         if(which==MAC_O_KEY){
387                 return "o";
388         }
389         if(which==MAC_P_KEY){
390                 return "p";
391         }
392         if(which==MAC_Q_KEY){
393                 return "q";
394         }
395         if(which==MAC_R_KEY){
396                 return "r";
397         }
398         if(which==MAC_S_KEY){
399                 return "s";
400         }
401         if(which==MAC_T_KEY){
402                 return "t";
403         }
404         if(which==MAC_U_KEY){
405                 return "u";
406         }
407         if(which==MAC_V_KEY){
408                 return "v";
409         }
410         if(which==MAC_W_KEY){
411                 return "w";
412         }
413         if(which==MAC_X_KEY){
414                 return "x";
415         }
416         if(which==MAC_Y_KEY){
417                 return "y";
418         }
419         if(which==MAC_Z_KEY){
420                 return "z";
421         }
422
423         // keypad keys
424         if(which==MAC_NUMPAD_1_KEY){
425                 return "KP1";
426         }
427         if(which==MAC_NUMPAD_2_KEY){
428                 return "KP2";
429         }
430         if(which==MAC_NUMPAD_3_KEY){
431                 return "KP3";
432         }
433         if(which==MAC_NUMPAD_4_KEY){
434                 return "KP4";
435         }
436         if(which==MAC_NUMPAD_5_KEY){
437                 return "KP5";
438         }
439         if(which==MAC_NUMPAD_6_KEY){
440                 return "KP6";
441         }
442         if(which==MAC_NUMPAD_7_KEY){
443                 return "KP7";
444         }
445         if(which==MAC_NUMPAD_8_KEY){
446                 return "KP8";
447         }
448         if(which==MAC_NUMPAD_9_KEY){
449                 return "KP9";
450         }
451         if(which==MAC_NUMPAD_0_KEY){
452                 return "KP0";
453         }
454
455         // enter
456         if(which==MAC_ENTER_KEY){
457                 return "enter";
458         }
459
460         // number keys
461         if(which==MAC_1_KEY){
462                 return "1";
463         }
464         if(which==MAC_2_KEY){
465                 return "2";
466         }
467         if(which==MAC_3_KEY){
468                 return "3";
469         }
470         if(which==MAC_4_KEY){
471                 return "4";
472         }
473         if(which==MAC_5_KEY){
474                 return "5";
475         }
476         if(which==MAC_6_KEY){
477                 return "6";
478         }
479         if(which==MAC_7_KEY){
480                 return "7";
481         }
482         if(which==MAC_8_KEY){
483                 return "8";
484         }
485         if(which==MAC_9_KEY){
486                 return "9";
487         }
488         if(which==MAC_0_KEY){
489                 return "0";
490         }
491
492         // function keys
493         if(which==MAC_F1_KEY){
494                 return "F1";
495         }
496         if(which==MAC_F2_KEY){
497                 return "F2";
498         }
499         if(which==MAC_F3_KEY){
500                 return "F3";
501         }
502         if(which==MAC_F4_KEY){
503                 return "F4";
504         }
505         if(which==MAC_F5_KEY){
506                 return "F5";
507         }
508         if(which==MAC_F6_KEY){
509                 return "F6";
510         }
511         if(which==MAC_F7_KEY){
512                 return "F7";
513         }
514         if(which==MAC_F8_KEY){
515                 return "F8";
516         }
517         if(which==MAC_F9_KEY){
518                 return "F9";
519         }
520         if(which==MAC_F10_KEY){
521                 return "F10";
522         }
523         if(which==MAC_F11_KEY){
524                 return "F11";
525         }
526         if(which==MAC_F12_KEY){
527                 return "F12";
528         }
529
530         // escape
531         if(which==MAC_ESCAPE_KEY){
532                 return "escape";
533         }
534         if(which==MAC_DELETE_KEY){
535                 return "backspace";
536         }
537         if(which==MAC_TAB_KEY){
538                 return "tab";
539         }
540         if(which==MAC_TILDE_KEY){
541                 return "`";
542         }
543         if(which==MAC_CAPS_LOCK_KEY){
544                 return "caps_lock";
545         }
546         if(which==MAC_COMMAND_KEY){
547                 return "command";
548         }
549         if(which==MAC_OPTION_KEY){
550                 return "option";
551         }
552         if(which==MAC_DEL_KEY){
553                 return "delete";
554         }
555         if(which==MAC_INSERT_KEY){
556                 return "insert";
557         }
558         if(which==MAC_HOME_KEY){
559                 return "home";
560         }
561         if(which==MAC_END_KEY){
562                 return "end";
563         }
564         if(which==MAC_PAGE_UP_KEY){
565                 return "page_up";
566         }
567         if(which==MAC_PAGE_DOWN_KEY){
568                 return "page_down";
569         }
570         if(which==MAC_NUMPAD_CLEAR_KEY){
571                 return "clear";
572         }
573         if(which==MAC_CONTROL_KEY){
574                 return "control";
575         }
576         if(which==MAC_SPACE_KEY){
577                 return "space";
578         }
579         if(which==MAC_RETURN_KEY){
580                 return "return";
581         }
582         if(which==MAC_SHIFT_KEY){
583                 return "shift";
584         }
585         if(which==MAC_ARROW_UP_KEY){
586                 return "uparrow";
587         }
588         if(which==MAC_ARROW_DOWN_KEY){
589                 return "downarrow";
590         }
591         if(which==MAC_ARROW_LEFT_KEY){
592                 return "leftarrow";
593         }
594         if(which==MAC_ARROW_RIGHT_KEY){
595                 return "rightarrow";
596         }
597         if(which==MAC_MOUSEBUTTON1){
598                 return "mouse1";
599         }
600         if(which==MAC_MOUSEBUTTON2){
601                 return "mouse2";
602         }
603         if(which==MAC_ARROW_RIGHT_KEY){
604                 return "rightarrow";
605         }
606         if(which==MAC_MINUS_KEY||which==MAC_NUMPAD_MINUS_KEY){
607                 return "-";
608         }
609         if(which==MAC_PLUS_KEY||which==MAC_NUMPAD_EQUALS_KEY){
610                 return "=";
611         }
612         if(which==MAC_NUMPAD_PLUS_KEY){
613                 return "+";
614         }
615         if(which==MAC_NUMPAD_ASTERISK_KEY){
616                 return "*";
617         }
618         if(which==MAC_SLASH_KEY||which==MAC_NUMPAD_SLASH_KEY){
619                 return "/";
620         }
621         if(which==MAC_BACKSLASH_KEY){
622                 return "\\";
623         }
624         if(which==MAC_LEFTBRACKET_KEY){
625                 return "[";
626         }
627         if(which==MAC_RIGHTBRACKET_KEY){
628                 return "]";
629         }
630         if(which==MAC_PERIOD_KEY||which==MAC_NUMPAD_PERIOD_KEY){
631                 return ".";
632         }
633         if(which==MAC_COMMA_KEY){
634                 return ",";
635         }
636         if(which==MAC_APOSTROPHE_KEY){
637                 return "\"";
638         }
639         if(which==MAC_SEMICOLON_KEY){
640                 return ";";
641         }
642         return "unknown";
643 }
644
645 char    KeyToSingleChar(unsigned short which)
646 {
647         static int i;
648
649         if(which==MAC_A_KEY){
650                 return 'a';
651         }
652         if(which==MAC_B_KEY){
653                 return 'b';
654         }
655         if(which==MAC_C_KEY){
656                 return 'c';
657         }
658         if(which==MAC_D_KEY){
659                 return 'd';
660         }
661         if(which==MAC_E_KEY){
662                 return 'e';
663         }
664         if(which==MAC_F_KEY){
665                 return 'f';
666         }
667         if(which==MAC_G_KEY){
668                 return 'g';
669         }
670         if(which==MAC_H_KEY){
671                 return 'h';
672         }
673         if(which==MAC_I_KEY){
674                 return 'i';
675         }
676         if(which==MAC_J_KEY){
677                 return 'j';
678         }
679         if(which==MAC_K_KEY){
680                 return 'k';
681         }
682         if(which==MAC_L_KEY){
683                 return 'l';
684         }
685         if(which==MAC_M_KEY){
686                 return 'm';
687         }
688         if(which==MAC_N_KEY){
689                 return 'n';
690         }
691         if(which==MAC_O_KEY){
692                 return 'o';
693         }
694         if(which==MAC_P_KEY){
695                 return 'p';
696         }
697         if(which==MAC_Q_KEY){
698                 return 'q';
699         }
700         if(which==MAC_R_KEY){
701                 return 'r';
702         }
703         if(which==MAC_S_KEY){
704                 return 's';
705         }
706         if(which==MAC_T_KEY){
707                 return 't';
708         }
709         if(which==MAC_U_KEY){
710                 return 'u';
711         }
712         if(which==MAC_V_KEY){
713                 return 'v';
714         }
715         if(which==MAC_W_KEY){
716                 return 'w';
717         }
718         if(which==MAC_X_KEY){
719                 return 'x';
720         }
721         if(which==MAC_Y_KEY){
722                 return 'y';
723         }
724         if(which==MAC_Z_KEY){
725                 return 'z';
726         }
727         if(which==MAC_NUMPAD_1_KEY){
728                 return '1';
729         }
730         if(which==MAC_NUMPAD_2_KEY){
731                 return '2';
732         }
733         if(which==MAC_NUMPAD_3_KEY){
734                 return '3';
735         }
736         if(which==MAC_NUMPAD_4_KEY){
737                 return '4';
738         }
739         if(which==MAC_NUMPAD_5_KEY){
740                 return '5';
741         }
742         if(which==MAC_NUMPAD_6_KEY){
743                 return '6';
744         }
745         if(which==MAC_NUMPAD_7_KEY){
746                 return '7';
747         }
748         if(which==MAC_NUMPAD_8_KEY){
749                 return '8';
750         }
751         if(which==MAC_NUMPAD_9_KEY){
752                 return '9';
753         }
754         if(which==MAC_NUMPAD_0_KEY){
755                 return '0';
756         }
757         if(which==MAC_1_KEY){
758                 return '1';
759         }
760         if(which==MAC_2_KEY){
761                 return '2';
762         }
763         if(which==MAC_3_KEY){
764                 return '3';
765         }
766         if(which==MAC_4_KEY){
767                 return '4';
768         }
769         if(which==MAC_5_KEY){
770                 return '5';
771         }
772         if(which==MAC_6_KEY){
773                 return '6';
774         }
775         if(which==MAC_7_KEY){
776                 return '7';
777         }
778         if(which==MAC_8_KEY){
779                 return '8';
780         }
781         if(which==MAC_9_KEY){
782                 return '9';
783         }
784         if(which==MAC_0_KEY){
785                 return '0';
786         }
787         if(which==MAC_SPACE_KEY){
788                 return ' ';
789         }
790         if(which==MAC_MINUS_KEY||which==MAC_NUMPAD_MINUS_KEY){
791                 return '-';
792         }
793         if(which==MAC_PLUS_KEY||which==MAC_NUMPAD_EQUALS_KEY){
794                 return '=';
795         }
796         if(which==MAC_NUMPAD_PLUS_KEY){
797                 return '+';
798         }
799         if(which==MAC_NUMPAD_ASTERISK_KEY){
800                 return '*';
801         }
802         if(which==MAC_SLASH_KEY||which==MAC_NUMPAD_SLASH_KEY){
803                 return '/';
804         }
805         if(which==MAC_BACKSLASH_KEY){
806                 return '\\';
807         }
808         if(which==MAC_LEFTBRACKET_KEY){
809                 return '[';
810         }
811         if(which==MAC_RIGHTBRACKET_KEY){
812                 return ']';
813         }
814         if(which==MAC_PERIOD_KEY||which==MAC_NUMPAD_PERIOD_KEY){
815                 return '.';
816         }
817         if(which==MAC_COMMA_KEY){
818                 return ',';
819         }
820         if(which==MAC_APOSTROPHE_KEY){
821                 return '\'';
822         }
823         if(which==MAC_SEMICOLON_KEY){
824                 return ';';
825         }
826         return '\0';
827 }
828
829 char    Shift(char which)
830 {
831         static int i;
832
833         if(which=='a'){
834                 return 'A';
835         }
836         if(which=='b'){
837                 return 'B';
838         }
839         if(which=='c'){
840                 return 'C';
841         }
842         if(which=='d'){
843                 return 'D';
844         }
845         if(which=='e'){
846                 return 'E';
847         }
848         if(which=='f'){
849                 return 'F';
850         }
851         if(which=='g'){
852                 return 'G';
853         }
854         if(which=='h'){
855                 return 'H';
856         }
857         if(which=='e'){
858                 return 'E';
859         }
860         if(which=='f'){
861                 return 'F';
862         }
863         if(which=='g'){
864                 return 'G';
865         }
866         if(which=='h'){
867                 return 'H';
868         }
869         if(which=='i'){
870                 return 'I';
871         }
872         if(which=='j'){
873                 return 'J';
874         }
875         if(which=='k'){
876                 return 'K';
877         }
878         if(which=='l'){
879                 return 'L';
880         }
881         if(which=='m'){
882                 return 'M';
883         }
884         if(which=='n'){
885                 return 'N';
886         }
887         if(which=='o'){
888                 return 'O';
889         }
890         if(which=='p'){
891                 return 'P';
892         }
893         if(which=='q'){
894                 return 'Q';
895         }
896         if(which=='r'){
897                 return 'R';
898         }
899         if(which=='s'){
900                 return 'S';
901         }
902         if(which=='t'){
903                 return 'T';
904         }
905         if(which=='u'){
906                 return 'U';
907         }
908         if(which=='v'){
909                 return 'V';
910         }
911         if(which=='w'){
912                 return 'W';
913         }
914         if(which=='x'){
915                 return 'X';
916         }
917         if(which=='y'){
918                 return 'Y';
919         }
920         if(which=='z'){
921                 return 'Z';
922         }
923         if(which=='1'){
924                 return '!';
925         }
926         if(which=='2'){
927                 return '@';
928         }
929         if(which=='3'){
930                 return '#';
931         }
932         if(which=='4'){
933                 return '$';
934         }
935         if(which=='5'){
936                 return '%';
937         }
938         if(which=='6'){
939                 return '^';
940         }
941         if(which=='7'){
942                 return '&';
943         }
944         if(which=='8'){
945                 return '*';
946         }
947         if(which=='9'){
948                 return '(';
949         }
950         if(which=='0'){
951                 return ')';
952         }
953         if(which=='-'){
954                 return '_';
955         }
956         if(which=='='){
957                 return '+';
958         }
959         if(which=='['){
960                 return '{';
961         }
962         if(which==']'){
963                 return '}';
964         }
965         if(which=='\\'){
966                 return '|';
967         }
968         if(which=='.'){
969                 return '>';
970         }
971         if(which==','){
972                 return '<';
973         }
974         if(which=='/'){
975                 return '?';
976         }
977         if(which==';'){
978                 return ':';
979         }
980         if(which=='\''){
981                 return '\"';
982         }
983         return which;
984 }
985
986 bool    Compare(char *thestring, char *tocompare, int start, int end)
987 {
988         static int i;
989         for(i=start;i<=end;i++){
990                 if(thestring[i]!=tocompare[i-start]&&thestring[i]!=tocompare[i-start]+'A'-'a')return 0;
991         }
992         return 1;
993 }
994
995 #endif
996
997