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