Remove useless stuff from utils
[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 #define ExprCoord       7
80
81 #define OpAdd           20
82 #define OpSubtract      21
83 #define OpMultiply      22
84 #define OpDivide        23
85 #define OpAssign        24
86 #define OpNot           25
87 #define OpNegate        26
88 #define OpInvert        27
89 #define OpUnaryPlus     28
90
91 #define MergeDefault    0
92 #define MergeAugment    1
93 #define MergeOverride   2
94 #define MergeReplace    3
95 #define MergeAltForm    4
96
97 #define AutoKeyNames    (1L <<  0)
98 #define CreateKeyNames(x)       ((x)->flags&AutoKeyNames)
99
100 extern unsigned warningLevel;
101
102 typedef struct _IncludeStmt
103 {
104     ParseCommon common;
105     unsigned merge;
106     char *stmt;
107     char *file;
108     char *map;
109     char *modifier;
110     char *path;
111     struct _IncludeStmt *next;
112 } IncludeStmt;
113
114 typedef struct _Expr
115 {
116     ParseCommon common;
117     unsigned op;
118     unsigned type;
119     union
120     {
121         struct
122         {
123             struct _Expr *left;
124             struct _Expr *right;
125         } binary;
126         struct
127         {
128             xkb_atom_t element;
129             xkb_atom_t field;
130         } field;
131         struct
132         {
133             xkb_atom_t element;
134             xkb_atom_t field;
135             struct _Expr *entry;
136         } array;
137         struct
138         {
139             xkb_atom_t name;
140             struct _Expr *args;
141         } action;
142         struct
143         {
144             int nSyms;
145             int szSyms;
146             char **syms;
147         } list;
148         struct
149         {
150             int x;
151             int y;
152         } coord;
153         struct _Expr *child;
154         xkb_atom_t str;
155         unsigned uval;
156         int ival;
157         char keyName[5];
158         void * ptr;
159     } value;
160 } ExprDef;
161
162 typedef struct _VarDef
163 {
164     ParseCommon common;
165     unsigned merge;
166     ExprDef *name;
167     ExprDef *value;
168 } VarDef;
169
170 typedef struct _VModDef
171 {
172     ParseCommon common;
173     unsigned merge;
174     xkb_atom_t name;
175     ExprDef *value;
176 } VModDef;
177
178 typedef struct _KeycodeDef
179 {
180     ParseCommon common;
181     unsigned merge;
182     char name[5];
183     unsigned long value;
184 } KeycodeDef;
185
186 typedef struct _KeyAliasDef
187 {
188     ParseCommon common;
189     unsigned merge;
190     char alias[5];
191     char real[5];
192 } KeyAliasDef;
193
194 typedef struct _KeyTypeDef
195 {
196     ParseCommon common;
197     unsigned merge;
198     xkb_atom_t name;
199     VarDef *body;
200 } KeyTypeDef;
201
202 typedef struct _SymbolsDef
203 {
204     ParseCommon common;
205     unsigned merge;
206     char keyName[5];
207     ExprDef *symbols;
208 } SymbolsDef;
209
210 typedef struct _ModMapDef
211 {
212     ParseCommon common;
213     unsigned merge;
214     xkb_atom_t modifier;
215     ExprDef *keys;
216 } ModMapDef;
217
218 typedef struct _GroupCompatDef
219 {
220     ParseCommon common;
221     unsigned merge;
222     int group;
223     ExprDef *def;
224 } GroupCompatDef;
225
226 typedef struct _InterpDef
227 {
228     ParseCommon common;
229     unsigned merge;
230     char *sym;
231     ExprDef *match;
232     VarDef *def;
233 } InterpDef;
234
235 typedef struct _IndicatorNameDef
236 {
237     ParseCommon common;
238     unsigned merge;
239     int ndx;
240     ExprDef *name;
241     Bool virtual;
242 } IndicatorNameDef;
243
244 typedef struct _IndicatorMapDef
245 {
246     ParseCommon common;
247     unsigned merge;
248     unsigned type;
249     xkb_atom_t name;
250     VarDef *body;
251 } IndicatorMapDef;
252
253 typedef struct _XkbFile
254 {
255     ParseCommon common;
256     int type;
257     char *topName;
258     char *name;
259     ParseCommon *defs;
260     int id;
261     unsigned flags;
262     Bool compiled;
263 } XkbFile;
264
265 extern struct xkb_desc *
266 CompileKeymap(XkbFile *file, unsigned merge);
267
268 extern Bool
269 CompileKeycodes(XkbFile *file, struct xkb_desc * xkb, unsigned merge);
270
271 extern Bool
272 CompileKeyTypes(XkbFile *file, struct xkb_desc * xkb, unsigned merge);
273
274 typedef struct _LEDInfo *LEDInfoPtr;
275
276 extern Bool
277 CompileCompatMap(XkbFile *file, struct xkb_desc * xkb, unsigned merge,
278                  LEDInfoPtr *unboundLEDs);
279
280 extern Bool
281 CompileSymbols(XkbFile *file, struct xkb_desc * xkb, unsigned merge);
282
283 extern Bool
284 UpdateModifiersFromCompat(struct xkb_desc *xkb);
285
286 #endif /* XKBCOMP_H */