Fix all -Wsign-compare warnings
[platform/upstream/libxkbcommon.git] / src / xkbcomp / xkbcomp.h
1 /************************************************************
2  Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
3
4  Permission to use, copy, modify, and distribute this
5  software and its documentation for any purpose and without
6  fee is hereby granted, provided that the above copyright
7  notice appear in all copies and that both that copyright
8  notice and this permission notice appear in supporting
9  documentation, and that the name of Silicon Graphics not be
10  used in advertising or publicity pertaining to distribution
11  of the software without specific prior written permission.
12  Silicon Graphics makes no representation about the suitability
13  of this software for any purpose. It is provided "as is"
14  without any express or implied warranty.
15
16  SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
17  SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
18  AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
19  GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
20  DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
21  DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
22  OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
23  THE USE OR PERFORMANCE OF THIS SOFTWARE.
24
25  ********************************************************/
26
27 #ifndef XKBCOMP_H
28 #define XKBCOMP_H 1
29
30 #include <X11/X.h>
31 #include <X11/Xdefs.h>
32
33 #include "utils.h"
34
35 #include "xkbcommon/xkbcommon.h"
36 #include "XKBcommonint.h"
37 #include "xkbmisc.h"
38
39 extern char *scanFile;
40
41 #define TypeUnknown     0
42 #define TypeBoolean     1
43 #define TypeInt         2
44 #define TypeString      4
45 #define TypeAction      5
46 #define TypeKeyName     6
47 #define TypeSymbols     7
48
49 #define StmtUnknown             0
50 #define StmtInclude             1
51 #define StmtKeycodeDef          2
52 #define StmtKeyAliasDef         3
53 #define StmtExpr                4
54 #define StmtVarDef              5
55 #define StmtKeyTypeDef          6
56 #define StmtInterpDef           7
57 #define StmtVModDef             8
58 #define StmtSymbolsDef          9
59 #define StmtModMapDef           10
60 #define StmtGroupCompatDef      11
61 #define StmtIndicatorMapDef     12
62 #define StmtIndicatorNameDef    13
63
64 #define FileSymInterp   100
65
66 typedef struct _ParseCommon
67 {
68     unsigned stmtType;
69     struct _ParseCommon *next;
70 } ParseCommon;
71
72 #define ExprValue       0
73 #define ExprIdent       1
74 #define ExprActionDecl  2
75 #define ExprFieldRef    3
76 #define ExprArrayRef    4
77 #define ExprKeysymList  5
78 #define ExprActionList  6
79
80 #define OpAdd           20
81 #define OpSubtract      21
82 #define OpMultiply      22
83 #define OpDivide        23
84 #define OpAssign        24
85 #define OpNot           25
86 #define OpNegate        26
87 #define OpInvert        27
88 #define OpUnaryPlus     28
89
90 #define MergeDefault    0
91 #define MergeAugment    1
92 #define MergeOverride   2
93 #define MergeReplace    3
94 #define MergeAltForm    4
95
96 #define AutoKeyNames    (1L <<  0)
97 #define CreateKeyNames(x)       ((x)->flags&AutoKeyNames)
98
99 extern unsigned warningLevel;
100
101 typedef struct _IncludeStmt
102 {
103     ParseCommon common;
104     unsigned merge;
105     char *stmt;
106     char *file;
107     char *map;
108     char *modifier;
109     char *path;
110     struct _IncludeStmt *next;
111 } IncludeStmt;
112
113 typedef struct _Expr
114 {
115     ParseCommon common;
116     unsigned op;
117     unsigned type;
118     union
119     {
120         struct
121         {
122             struct _Expr *left;
123             struct _Expr *right;
124         } binary;
125         struct
126         {
127             xkb_atom_t element;
128             xkb_atom_t field;
129         } field;
130         struct
131         {
132             xkb_atom_t element;
133             xkb_atom_t field;
134             struct _Expr *entry;
135         } array;
136         struct
137         {
138             xkb_atom_t name;
139             struct _Expr *args;
140         } action;
141         struct
142         {
143             int nSyms;
144             int szSyms;
145             char **syms;
146         } list;
147         struct _Expr *child;
148         xkb_atom_t str;
149         unsigned uval;
150         int ival;
151         char keyName[5];
152     } value;
153 } ExprDef;
154
155 typedef struct _VarDef
156 {
157     ParseCommon common;
158     unsigned merge;
159     ExprDef *name;
160     ExprDef *value;
161 } VarDef;
162
163 typedef struct _VModDef
164 {
165     ParseCommon common;
166     unsigned merge;
167     xkb_atom_t name;
168     ExprDef *value;
169 } VModDef;
170
171 typedef struct _KeycodeDef
172 {
173     ParseCommon common;
174     unsigned merge;
175     char name[5];
176     unsigned long value;
177 } KeycodeDef;
178
179 typedef struct _KeyAliasDef
180 {
181     ParseCommon common;
182     unsigned merge;
183     char alias[5];
184     char real[5];
185 } KeyAliasDef;
186
187 typedef struct _KeyTypeDef
188 {
189     ParseCommon common;
190     unsigned merge;
191     xkb_atom_t name;
192     VarDef *body;
193 } KeyTypeDef;
194
195 typedef struct _SymbolsDef
196 {
197     ParseCommon common;
198     unsigned merge;
199     char keyName[5];
200     ExprDef *symbols;
201 } SymbolsDef;
202
203 typedef struct _ModMapDef
204 {
205     ParseCommon common;
206     unsigned merge;
207     xkb_atom_t modifier;
208     ExprDef *keys;
209 } ModMapDef;
210
211 typedef struct _GroupCompatDef
212 {
213     ParseCommon common;
214     unsigned merge;
215     int group;
216     ExprDef *def;
217 } GroupCompatDef;
218
219 typedef struct _InterpDef
220 {
221     ParseCommon common;
222     unsigned merge;
223     char *sym;
224     ExprDef *match;
225     VarDef *def;
226 } InterpDef;
227
228 typedef struct _IndicatorNameDef
229 {
230     ParseCommon common;
231     unsigned merge;
232     int ndx;
233     ExprDef *name;
234     Bool virtual;
235 } IndicatorNameDef;
236
237 typedef struct _IndicatorMapDef
238 {
239     ParseCommon common;
240     unsigned merge;
241     unsigned type;
242     xkb_atom_t name;
243     VarDef *body;
244 } IndicatorMapDef;
245
246 typedef struct _XkbFile
247 {
248     ParseCommon common;
249     unsigned type;
250     char *topName;
251     char *name;
252     ParseCommon *defs;
253     int id;
254     unsigned flags;
255     Bool compiled;
256 } XkbFile;
257
258 extern struct xkb_desc *
259 CompileKeymap(XkbFile *file, unsigned merge);
260
261 extern Bool
262 CompileKeycodes(XkbFile *file, struct xkb_desc * xkb, unsigned merge);
263
264 extern Bool
265 CompileKeyTypes(XkbFile *file, struct xkb_desc * xkb, unsigned merge);
266
267 typedef struct _LEDInfo *LEDInfoPtr;
268
269 extern Bool
270 CompileCompatMap(XkbFile *file, struct xkb_desc * xkb, unsigned merge,
271                  LEDInfoPtr *unboundLEDs);
272
273 extern Bool
274 CompileSymbols(XkbFile *file, struct xkb_desc * xkb, unsigned merge);
275
276 extern Bool
277 UpdateModifiersFromCompat(struct xkb_desc *xkb);
278
279 #endif /* XKBCOMP_H */