[CSRSS]
[reactos.git] / reactos / base / applications / network / telnet / src / tmapldr.h
1 ///////////////////////////////////////////////////////////////////
2 // //
3 // File format : //
4 // //
5 // Comments with a ; in column 1 //
6 // Empty Lines ignored //
7 // The words are separated by a space, a tab, or a plus ("+") //
8 // //
9 // First a [GLOBAL] section : //
10 // [GLOBAL] //
11 // VK_F1 112 //
12 // . //
13 // . //
14 // [END_GLOBAL] //
15 // //
16 // The GLOBAL section defines the names of the keys //
17 // and the virtual key code they have. //
18 // If you repeat a name you'll overwrite the code. //
19 // You can name the keys anything you like //
20 // The Virtual key nymber must be in Decimal //
21 // After the number you can put anything : it is ignored //
22 // Here you must put ALL the keys you'll use in the //
23 // other sections. //
24 // //
25 // Then the emulations sections : //
26 // //
27 // [SCO_ANSI] //
28 // //
29 // VK_F1 \027[M or //
30 // VK_F1 ^[[M or //
31 // VK_F1 SHIFT ^[[W etc //
32 // . //
33 // . //
34 // [SCO_ANSI_END] //
35 // //
36 // There are three parts : //
37 // a) the key name //
38 // b) the shift state //
39 // here you put compination of the words : //
40 // //
41 // RIGHT_ALT //
42 // LEFT_ALT //
43 // RIGHT_CTRL //
44 // LEFT_CTRL //
45 // SHIFT //
46 // NUMLOCK //
47 // SCROLLLOCK //
48 // CAPSLOCK //
49 // ENHANCED //
50 // APP_KEY //
51 // c) the assigned string : //
52 // you can use the ^ for esc (^[ = 0x1b) //
53 // \ and a three digit decimal number //
54 // (\027) //
55 // You can't use the NULL !!! //
56 // Also (for the moment) you can't use spaces //
57 // in the string : everything after the 3rd word is //
58 // ignored - use unsderscore instead. //
59 // //
60 // for example : //
61 // //
62 // VK_F4 SHIFT+LEFT_ALT \0274m^[[M = 0x1b 4 m 0x1b [ M //
63 // VK_F1 RIGHT_CTRL This_is_ctrl_f1 //
64 // //
65 // You may have as many sections as you like //
66 // If you repeat any section (even the GLOBAL) you'll overwrite //
67 // the common parts. //
68 // //
69 ///////////////////////////////////////////////////////////////////
70
71 #pragma once
72
73 #include "keytrans.h"
74 #include "tcharmap.h"
75
76 // AVS
77 typedef TArrayAsVector<string> stringArray;
78
79 class TMapLoader {
80 public:
81 TMapLoader(KeyTranslator &RefKeyTrans, TCharmap &RefCharmap):
82 KeyTrans(RefKeyTrans), Charmap(RefCharmap) {}
83 ~TMapLoader() {}
84
85 // If called more than once the new map replaces the old one.
86 // load with a different KeysetName to change keysets
87 // Return 0 on error
88 int Load(const char * filename, const char * szKeysetName);
89
90 void Display();
91 private:
92 KeyTranslator &KeyTrans;
93 TCharmap &Charmap;
94
95 int LookForPart(stringArray& sa, const char* partType, const char* partName);
96 char* ParseKeyDef(const char* buf, WORD& vk_code, DWORD& control);
97
98 int LoadGlobal(string& buf);
99 int LoadKeyMap(string buf);
100 int LoadCharMap(string buf);
101
102 };