4 XCSoar Glide Computer - http://www.xcsoar.org/
5 Copyright (C) 2000-2013 The XCSoar Project
6 A detailed list of copyright holders can be found in the file "AUTHORS".
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 #include "Input/InputParser.hpp"
25 #include "Input/InputConfig.hpp"
26 #include "Input/InputLookup.hpp"
27 #include "Menu/MenuData.hpp"
28 #include "IO/FileLineReader.hpp"
29 #include "OS/Args.hpp"
35 InputEvents::findEvent(const TCHAR
*data
)
47 InputEvents::findGCE(const TCHAR
*data
)
53 InputEvents::findNE(const TCHAR
*data
)
59 Dump(InputConfig::Event
&event
, unsigned id
)
61 _tprintf(_T(" Event[%u]: '%s' misc='%s'\n"), id
,
62 (const TCHAR
*)event
.event
, event
.misc
);
65 int main(int argc
, char **argv
)
67 Args
args(argc
, argv
, "PATH");
68 const char *path
= args
.ExpectNext();
71 FileLineReader
reader(path
);
73 fprintf(stderr
, "Failed to open input file\n");
79 ParseInputFile(config
, reader
);
81 for (unsigned mode
= 0; mode
< config
.modes
.size(); ++mode
) {
82 _tprintf(_T("Mode '%s'\n"), config
.modes
[mode
].c_str());
84 for (unsigned key
= 0; key
< InputConfig::MAX_KEY
; ++key
) {
85 unsigned event
= config
.Key2Event
[mode
][key
];
86 assert(event
< InputConfig::MAX_EVENTS
);
90 printf(" Key 0x%x\n", key
);
92 Dump(config
.events
[event
], event
);
93 assert(config
.events
[event
].next
< InputConfig::MAX_EVENTS
);
94 event
= config
.events
[event
].next
;
98 for (unsigned i
= 0; i
< Menu::MAX_ITEMS
; ++i
) {
99 const MenuItem
&mi
= config
.menus
[mode
][i
];
100 if (mi
.IsDefined()) {
101 _tprintf(_T(" Menu[%u] = '%s'\n"), i
, mi
.label
);
102 unsigned event
= mi
.event
;
103 assert(event
< InputConfig::MAX_EVENTS
);
105 Dump(config
.events
[event
], event
);
106 assert(config
.events
[event
].next
< InputConfig::MAX_EVENTS
);
107 event
= config
.events
[event
].next
;