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