Use CARD32 instead of Atom, move geom headers in
[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 #ifndef DEBUG_VAR
31 #define DEBUG_VAR debugFlags
32 #endif
33
34 #include <X11/X.h>
35 #include <X11/Xdefs.h>
36
37 #include "utils.h"
38
39 #include <X11/extensions/XKM.h>
40 #include <X11/extensions/XKBstrcommon.h>
41 #include <X11/extensions/XKBrulescommon.h>
42 #include "X11/extensions/XKBcommon.h"
43 #include "XKBcommonint.h"
44
45 extern char *scanFile;
46
47 #define TypeUnknown     0
48 #define TypeBoolean     1
49 #define TypeInt         2
50 #define TypeFloat       3
51 #define TypeString      4
52 #define TypeAction      5
53 #define TypeKeyName     6
54 #define TypeSymbols     7
55
56 #define StmtUnknown             0
57 #define StmtInclude             1
58 #define StmtKeycodeDef          2
59 #define StmtKeyAliasDef         3
60 #define StmtExpr                4
61 #define StmtVarDef              5
62 #define StmtKeyTypeDef          6
63 #define StmtInterpDef           7
64 #define StmtVModDef             8
65 #define StmtSymbolsDef          9
66 #define StmtModMapDef           10
67 #define StmtGroupCompatDef      11
68 #define StmtIndicatorMapDef     12
69 #define StmtIndicatorNameDef    13
70 #define StmtOutlineDef          14
71 #define StmtShapeDef            15
72 #define StmtKeyDef              16
73 #define StmtRowDef              17
74 #define StmtSectionDef          18
75 #define StmtOverlayKeyDef       19
76 #define StmtOverlayDef          20
77 #define StmtDoodadDef           21
78
79 #define FileSymInterp   100
80
81 typedef struct _ParseCommon
82 {
83     unsigned stmtType;
84     struct _ParseCommon *next;
85 } ParseCommon;
86
87 #define ExprValue       0
88 #define ExprIdent       1
89 #define ExprActionDecl  2
90 #define ExprFieldRef    3
91 #define ExprArrayRef    4
92 #define ExprKeysymList  5
93 #define ExprActionList  6
94 #define ExprCoord       7
95
96 #define OpAdd           20
97 #define OpSubtract      21
98 #define OpMultiply      22
99 #define OpDivide        23
100 #define OpAssign        24
101 #define OpNot           25
102 #define OpNegate        26
103 #define OpInvert        27
104 #define OpUnaryPlus     28
105
106 #define MergeDefault    0
107 #define MergeAugment    1
108 #define MergeOverride   2
109 #define MergeReplace    3
110 #define MergeAltForm    4
111
112 #define AutoKeyNames    (1L <<  0)
113 #define CreateKeyNames(x)       ((x)->flags&AutoKeyNames)
114
115 extern unsigned warningLevel;
116
117 typedef struct _IncludeStmt
118 {
119     ParseCommon common;
120     unsigned merge;
121     char *stmt;
122     char *file;
123     char *map;
124     char *modifier;
125     char *path;
126     struct _IncludeStmt *next;
127 } IncludeStmt;
128
129 typedef struct _Expr
130 {
131     ParseCommon common;
132     unsigned op;
133     unsigned type;
134     union
135     {
136         struct
137         {
138             struct _Expr *left;
139             struct _Expr *right;
140         } binary;
141         struct
142         {
143             CARD32 element;
144             CARD32 field;
145         } field;
146         struct
147         {
148             CARD32 element;
149             CARD32 field;
150             struct _Expr *entry;
151         } array;
152         struct
153         {
154             CARD32 name;
155             struct _Expr *args;
156         } action;
157         struct
158         {
159             int nSyms;
160             int szSyms;
161             char **syms;
162         } list;
163         struct
164         {
165             int x;
166             int y;
167         } coord;
168         struct _Expr *child;
169         CARD32 str;
170         unsigned uval;
171         int ival;
172         char keyName[5];
173         Opaque ptr;
174     } value;
175 } ExprDef;
176
177 typedef struct _VarDef
178 {
179     ParseCommon common;
180     unsigned merge;
181     ExprDef *name;
182     ExprDef *value;
183 } VarDef;
184
185 typedef struct _VModDef
186 {
187     ParseCommon common;
188     unsigned merge;
189     CARD32 name;
190     ExprDef *value;
191 } VModDef;
192
193 typedef struct _KeycodeDef
194 {
195     ParseCommon common;
196     unsigned merge;
197     char name[5];
198     ExprDef *value;
199 } KeycodeDef;
200
201 typedef struct _KeyAliasDef
202 {
203     ParseCommon common;
204     unsigned merge;
205     char alias[5];
206     char real[5];
207 } KeyAliasDef;
208
209 typedef struct _KeyTypeDef
210 {
211     ParseCommon common;
212     unsigned merge;
213     CARD32 name;
214     VarDef *body;
215 } KeyTypeDef;
216
217 typedef struct _SymbolsDef
218 {
219     ParseCommon common;
220     unsigned merge;
221     char keyName[5];
222     ExprDef *symbols;
223 } SymbolsDef;
224
225 typedef struct _ModMapDef
226 {
227     ParseCommon common;
228     unsigned merge;
229     CARD32 modifier;
230     ExprDef *keys;
231 } ModMapDef;
232
233 typedef struct _GroupCompatDef
234 {
235     ParseCommon common;
236     unsigned merge;
237     int group;
238     ExprDef *def;
239 } GroupCompatDef;
240
241 typedef struct _InterpDef
242 {
243     ParseCommon common;
244     unsigned merge;
245     char *sym;
246     ExprDef *match;
247     VarDef *def;
248 } InterpDef;
249
250 typedef struct _IndicatorNameDef
251 {
252     ParseCommon common;
253     unsigned merge;
254     int ndx;
255     ExprDef *name;
256     Bool virtual;
257 } IndicatorNameDef;
258
259 typedef struct _OutlineDef
260 {
261     ParseCommon common;
262     CARD32 field;
263     int nPoints;
264     ExprDef *points;
265 } OutlineDef;
266
267 typedef struct _ShapeDef
268 {
269     ParseCommon common;
270     unsigned merge;
271     CARD32 name;
272     int nOutlines;
273     OutlineDef *outlines;
274 } ShapeDef;
275
276 typedef struct _KeyDef
277 {
278     ParseCommon common;
279     unsigned defined;
280     char *name;
281     ExprDef *expr;
282 } KeyDef;
283
284 typedef struct _RowDef
285 {
286     ParseCommon common;
287     int nKeys;
288     KeyDef *keys;
289 } RowDef;
290
291 typedef struct _SectionDef
292 {
293     ParseCommon common;
294     unsigned merge;
295     CARD32 name;
296     int nRows;
297     RowDef *rows;
298 } SectionDef;
299
300 typedef struct _OverlayKeyDef
301 {
302     ParseCommon common;
303     char over[5];
304     char under[5];
305 } OverlayKeyDef;
306
307 typedef struct _OverlayDef
308 {
309     ParseCommon common;
310     unsigned merge;
311     CARD32 name;
312     int nKeys;
313     OverlayKeyDef *keys;
314 } OverlayDef;
315
316 typedef struct _DoodadDef
317 {
318     ParseCommon common;
319     unsigned merge;
320     unsigned type;
321     CARD32 name;
322     VarDef *body;
323 } DoodadDef;
324
325 /* IndicatorMapDef doesn't use the type field, but the rest of the fields
326    need to be at the same offsets as in DoodadDef.  Use #define to avoid
327    any strict aliasing problems.  */
328 #define IndicatorMapDef DoodadDef
329
330 typedef struct _XkbFile
331 {
332     ParseCommon common;
333     int type;
334     char *topName;
335     char *name;
336     ParseCommon *defs;
337     int id;
338     unsigned flags;
339     Bool compiled;
340 } XkbFile;
341
342 extern Bool
343 CompileKeymap(XkbFile *file, XkbcDescPtr xkb, unsigned merge);
344
345 extern Bool
346 CompileKeycodes(XkbFile *file, XkbcDescPtr xkb, unsigned merge);
347
348 extern Bool
349 CompileGeometry(XkbFile *file, XkbcDescPtr xkb, unsigned merge);
350
351 extern Bool
352 CompileKeyTypes(XkbFile *file, XkbcDescPtr xkb, unsigned merge);
353
354 typedef struct _LEDInfo *LEDInfoPtr;
355
356 extern Bool
357 CompileCompatMap(XkbFile *file, XkbcDescPtr xkb, unsigned merge,
358                  LEDInfoPtr *unboundLEDs);
359
360 extern Bool
361 CompileSymbols(XkbFile *file, XkbcDescPtr xkb, unsigned merge);
362
363 #endif /* XKBCOMP_H */