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