Move include path from X11/extensions/ to xkbcommon/
[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 "xkbcommon/xkbcommon.h"
40 #include "XKBcommonint.h"
41
42 extern char *scanFile;
43
44 #define TypeUnknown     0
45 #define TypeBoolean     1
46 #define TypeInt         2
47 #define TypeFloat       3
48 #define TypeString      4
49 #define TypeAction      5
50 #define TypeKeyName     6
51 #define TypeSymbols     7
52
53 #define StmtUnknown             0
54 #define StmtInclude             1
55 #define StmtKeycodeDef          2
56 #define StmtKeyAliasDef         3
57 #define StmtExpr                4
58 #define StmtVarDef              5
59 #define StmtKeyTypeDef          6
60 #define StmtInterpDef           7
61 #define StmtVModDef             8
62 #define StmtSymbolsDef          9
63 #define StmtModMapDef           10
64 #define StmtGroupCompatDef      11
65 #define StmtIndicatorMapDef     12
66 #define StmtIndicatorNameDef    13
67 #define StmtOutlineDef          14
68 #define StmtShapeDef            15
69 #define StmtKeyDef              16
70 #define StmtRowDef              17
71 #define StmtSectionDef          18
72 #define StmtOverlayKeyDef       19
73 #define StmtOverlayDef          20
74 #define StmtDoodadDef           21
75
76 #define FileSymInterp   100
77
78 typedef struct _ParseCommon
79 {
80     unsigned stmtType;
81     struct _ParseCommon *next;
82 } ParseCommon;
83
84 #define ExprValue       0
85 #define ExprIdent       1
86 #define ExprActionDecl  2
87 #define ExprFieldRef    3
88 #define ExprArrayRef    4
89 #define ExprKeysymList  5
90 #define ExprActionList  6
91 #define ExprCoord       7
92
93 #define OpAdd           20
94 #define OpSubtract      21
95 #define OpMultiply      22
96 #define OpDivide        23
97 #define OpAssign        24
98 #define OpNot           25
99 #define OpNegate        26
100 #define OpInvert        27
101 #define OpUnaryPlus     28
102
103 #define MergeDefault    0
104 #define MergeAugment    1
105 #define MergeOverride   2
106 #define MergeReplace    3
107 #define MergeAltForm    4
108
109 #define AutoKeyNames    (1L <<  0)
110 #define CreateKeyNames(x)       ((x)->flags&AutoKeyNames)
111
112 extern unsigned warningLevel;
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             uint32_t element;
141             uint32_t field;
142         } field;
143         struct
144         {
145             uint32_t element;
146             uint32_t field;
147             struct _Expr *entry;
148         } array;
149         struct
150         {
151             uint32_t name;
152             struct _Expr *args;
153         } action;
154         struct
155         {
156             int nSyms;
157             int szSyms;
158             char **syms;
159         } list;
160         struct
161         {
162             int x;
163             int y;
164         } coord;
165         struct _Expr *child;
166         uint32_t str;
167         unsigned uval;
168         int ival;
169         char keyName[5];
170         void * 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     uint32_t 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     uint32_t 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     uint32_t 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     char *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     uint32_t field;
260     int nPoints;
261     ExprDef *points;
262 } OutlineDef;
263
264 typedef struct _ShapeDef
265 {
266     ParseCommon common;
267     unsigned merge;
268     uint32_t 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     uint32_t 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     uint32_t 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     uint32_t 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, struct xkb_desc * xkb, unsigned merge);
341
342 extern Bool
343 CompileKeycodes(XkbFile *file, struct xkb_desc * xkb, unsigned merge);
344
345 extern Bool
346 CompileGeometry(XkbFile *file, struct xkb_desc * xkb, unsigned merge);
347
348 extern Bool
349 CompileKeyTypes(XkbFile *file, struct xkb_desc * xkb, unsigned merge);
350
351 typedef struct _LEDInfo *LEDInfoPtr;
352
353 extern Bool
354 CompileCompatMap(XkbFile *file, struct xkb_desc * xkb, unsigned merge,
355                  LEDInfoPtr *unboundLEDs);
356
357 extern Bool
358 CompileSymbols(XkbFile *file, struct xkb_desc * xkb, unsigned merge);
359
360 #endif /* XKBCOMP_H */