Remove unused 'which' and 'merge' arguments
[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 "utils.h"
31
32 #include "xkbcommon/xkbcommon.h"
33 #include "XKBcommonint.h"
34 #include "xkbmisc.h"
35
36 #define TypeUnknown     0
37 #define TypeBoolean     1
38 #define TypeInt         2
39 #define TypeString      4
40 #define TypeAction      5
41 #define TypeKeyName     6
42 #define TypeSymbols     7
43
44 #define StmtUnknown             0
45 #define StmtInclude             1
46 #define StmtKeycodeDef          2
47 #define StmtKeyAliasDef         3
48 #define StmtExpr                4
49 #define StmtVarDef              5
50 #define StmtKeyTypeDef          6
51 #define StmtInterpDef           7
52 #define StmtVModDef             8
53 #define StmtSymbolsDef          9
54 #define StmtModMapDef           10
55 #define StmtGroupCompatDef      11
56 #define StmtIndicatorMapDef     12
57 #define StmtIndicatorNameDef    13
58
59 #define FileSymInterp   100
60
61 typedef struct _ParseCommon
62 {
63     unsigned stmtType;
64     struct _ParseCommon *next;
65 } ParseCommon;
66
67 #define ExprValue       0
68 #define ExprIdent       1
69 #define ExprActionDecl  2
70 #define ExprFieldRef    3
71 #define ExprArrayRef    4
72 #define ExprKeysymList  5
73 #define ExprActionList  6
74
75 #define OpAdd           20
76 #define OpSubtract      21
77 #define OpMultiply      22
78 #define OpDivide        23
79 #define OpAssign        24
80 #define OpNot           25
81 #define OpNegate        26
82 #define OpInvert        27
83 #define OpUnaryPlus     28
84
85 #define MergeDefault    0
86 #define MergeAugment    1
87 #define MergeOverride   2
88 #define MergeReplace    3
89 #define MergeAltForm    4
90
91 #define AutoKeyNames    (1L <<  0)
92 #define CreateKeyNames(x)       ((x)->flags&AutoKeyNames)
93
94 extern unsigned warningLevel;
95
96 typedef struct _IncludeStmt
97 {
98     ParseCommon common;
99     unsigned merge;
100     char *stmt;
101     char *file;
102     char *map;
103     char *modifier;
104     char *path;
105     struct _IncludeStmt *next;
106 } IncludeStmt;
107
108 typedef struct _Expr
109 {
110     ParseCommon common;
111     unsigned op;
112     unsigned type;
113     union
114     {
115         struct
116         {
117             struct _Expr *left;
118             struct _Expr *right;
119         } binary;
120         struct
121         {
122             xkb_atom_t element;
123             xkb_atom_t field;
124         } field;
125         struct
126         {
127             xkb_atom_t element;
128             xkb_atom_t field;
129             struct _Expr *entry;
130         } array;
131         struct
132         {
133             xkb_atom_t name;
134             struct _Expr *args;
135         } action;
136         struct
137         {
138             int nSyms;
139             int szSyms;
140             char **syms;
141             int nLevels;
142             int szLevels;
143             int *symsMapIndex;
144             unsigned int *symsNumEntries;
145         } list;
146         struct _Expr *child;
147         xkb_atom_t str;
148         unsigned uval;
149         int ival;
150         char keyName[5];
151     } value;
152 } ExprDef;
153
154 typedef struct _VarDef
155 {
156     ParseCommon common;
157     unsigned merge;
158     ExprDef *name;
159     ExprDef *value;
160 } VarDef;
161
162 typedef struct _VModDef
163 {
164     ParseCommon common;
165     unsigned merge;
166     xkb_atom_t name;
167     ExprDef *value;
168 } VModDef;
169
170 typedef struct _KeycodeDef
171 {
172     ParseCommon common;
173     unsigned merge;
174     char name[5];
175     unsigned long value;
176 } KeycodeDef;
177
178 typedef struct _KeyAliasDef
179 {
180     ParseCommon common;
181     unsigned merge;
182     char alias[5];
183     char real[5];
184 } KeyAliasDef;
185
186 typedef struct _KeyTypeDef
187 {
188     ParseCommon common;
189     unsigned merge;
190     xkb_atom_t name;
191     VarDef *body;
192 } KeyTypeDef;
193
194 typedef struct _SymbolsDef
195 {
196     ParseCommon common;
197     unsigned merge;
198     char keyName[5];
199     ExprDef *symbols;
200 } SymbolsDef;
201
202 typedef struct _ModMapDef
203 {
204     ParseCommon common;
205     unsigned merge;
206     xkb_atom_t modifier;
207     ExprDef *keys;
208 } ModMapDef;
209
210 typedef struct _GroupCompatDef
211 {
212     ParseCommon common;
213     unsigned merge;
214     int group;
215     ExprDef *def;
216 } GroupCompatDef;
217
218 typedef struct _InterpDef
219 {
220     ParseCommon common;
221     unsigned merge;
222     char *sym;
223     ExprDef *match;
224     VarDef *def;
225 } InterpDef;
226
227 typedef struct _IndicatorNameDef
228 {
229     ParseCommon common;
230     unsigned merge;
231     int ndx;
232     ExprDef *name;
233     bool virtual;
234 } IndicatorNameDef;
235
236 typedef struct _IndicatorMapDef
237 {
238     ParseCommon common;
239     unsigned merge;
240     unsigned type;
241     xkb_atom_t name;
242     VarDef *body;
243 } IndicatorMapDef;
244
245 typedef struct _XkbFile
246 {
247     ParseCommon common;
248     unsigned type;
249     char *topName;
250     char *name;
251     ParseCommon *defs;
252     int id;
253     unsigned flags;
254 } XkbFile;
255
256 extern struct xkb_keymap *
257 CompileKeymap(struct xkb_context *context, XkbFile *file);
258
259 extern bool
260 CompileKeycodes(XkbFile *file, struct xkb_keymap * xkb, unsigned merge);
261
262 extern bool
263 CompileKeyTypes(XkbFile *file, struct xkb_keymap * xkb, unsigned merge);
264
265 typedef struct _LEDInfo *LEDInfoPtr;
266
267 extern bool
268 CompileCompatMap(XkbFile *file, struct xkb_keymap * xkb, unsigned merge,
269                  LEDInfoPtr *unboundLEDs);
270
271 extern bool
272 CompileSymbols(XkbFile *file, struct xkb_keymap * xkb, unsigned merge);
273
274 extern bool
275 UpdateModifiersFromCompat(struct xkb_keymap *xkb);
276
277 #endif /* XKBCOMP_H */