xkbcomp.h revision f46a6179
1/* $Xorg: xkbcomp.h,v 1.3 2000/08/17 19:54:33 cpqbld Exp $ */
2/************************************************************
3 Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
4
5 Permission to use, copy, modify, and distribute this
6 software and its documentation for any purpose and without
7 fee is hereby granted, provided that the above copyright
8 notice appear in all copies and that both that copyright
9 notice and this permission notice appear in supporting
10 documentation, and that the name of Silicon Graphics not be
11 used in advertising or publicity pertaining to distribution
12 of the software without specific prior written permission.
13 Silicon Graphics makes no representation about the suitability
14 of this software for any purpose. It is provided "as is"
15 without any express or implied warranty.
16
17 SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
18 SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
19 AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
20 GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
21 DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
22 DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
23 OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
24 THE USE OR PERFORMANCE OF THIS SOFTWARE.
25
26 ********************************************************/
27/* $XFree86: xc/programs/xkbcomp/xkbcomp.h,v 3.8 2001/12/19 21:30:30 dawes Exp $ */
28
29#ifndef XKBCOMP_H
30#define	XKBCOMP_H 1
31
32#ifndef DEBUG_VAR
33#define	DEBUG_VAR_NOT_LOCAL
34#define	DEBUG_VAR debugFlags
35#endif
36
37#include <X11/Xlib.h>
38#include <X11/XKBlib.h>
39
40#include "utils.h"
41
42#include <X11/extensions/XKM.h>
43#include <X11/extensions/XKBfile.h>
44
45extern char *scanFile;
46
47#define	TypeUnknown	0
48#define	TypeBoolean	1
49#define	TypeInt		2
50#define	TypeFloat	3
51#define	TypeString	4
52#define	TypeAction	5
53#define	TypeKeyName	6
54#define	TypeSymbols	7
55
56#define	StmtUnknown		0
57#define	StmtInclude		1
58#define	StmtKeycodeDef		2
59#define	StmtKeyAliasDef		3
60#define	StmtExpr		4
61#define	StmtVarDef		5
62#define	StmtKeyTypeDef		6
63#define	StmtInterpDef		7
64#define	StmtVModDef		8
65#define	StmtSymbolsDef		9
66#define	StmtModMapDef		10
67#define	StmtGroupCompatDef 	11
68#define	StmtIndicatorMapDef	12
69#define	StmtIndicatorNameDef	13
70#define	StmtOutlineDef		14
71#define	StmtShapeDef		15
72#define	StmtKeyDef		16
73#define	StmtRowDef		17
74#define	StmtSectionDef		18
75#define	StmtOverlayKeyDef	19
76#define	StmtOverlayDef		20
77#define	StmtDoodadDef		21
78
79#define	FileSymInterp	100
80
81typedef	struct _ParseCommon {
82    unsigned		 stmtType;
83    struct _ParseCommon	*next;
84} ParseCommon;
85
86#define	ExprValue	0
87#define	ExprIdent	1
88#define	ExprActionDecl	2
89#define	ExprFieldRef	3
90#define	ExprArrayRef	4
91#define	ExprKeysymList	5
92#define	ExprActionList	6
93#define	ExprCoord	7
94
95#define	OpAdd		20
96#define	OpSubtract	21
97#define	OpMultiply	22
98#define	OpDivide	23
99#define	OpAssign	24
100#define	OpNot		25
101#define	OpNegate	26
102#define	OpInvert	27
103#define	OpUnaryPlus	28
104
105#define	MergeDefault	0
106#define	MergeAugment	1
107#define	MergeOverride	2
108#define	MergeReplace	3
109#define	MergeAltForm	4
110
111#define	AutoKeyNames	(1L <<  0)
112#define	CreateKeyNames(x)	((x)->flags&AutoKeyNames)
113
114extern	unsigned	warningLevel;
115extern	unsigned	optionalParts;
116
117typedef struct _IncludeStmt {
118    ParseCommon		common;
119    unsigned		merge;
120    char 		*stmt;
121    char		*file;
122    char		*map;
123    char		*modifier;
124    char		*path;
125    struct _IncludeStmt	*next;
126} IncludeStmt;
127
128typedef struct _Expr {
129    ParseCommon		common;
130    unsigned		op;
131    unsigned		type;
132    union {
133	struct {
134	    struct _Expr *left;
135	    struct _Expr *right;
136	} binary;
137	struct {
138	    Atom	element;
139	    Atom field;
140	} field;
141	struct {
142	    Atom	element;
143	    Atom	field;
144	    struct _Expr *entry;
145	} array;
146	struct {
147	    Atom	  name;
148	    struct _Expr *args;
149	} action;
150	struct {
151	    int		 nSyms;
152	    int		 szSyms;
153	    KeySym *	 syms;
154	} list;
155	struct {
156	    int		 x;
157	    int		 y;
158	} coord;
159	struct _Expr	*child;
160	Atom	 str;
161	unsigned	 uval;
162	int		 ival;
163	char	 	 keyName[5];
164	Opaque		 ptr;
165    } value;
166} ExprDef;
167
168typedef struct _VarDef {
169    ParseCommon	common;
170    unsigned	 merge;
171    ExprDef 	*name;
172    ExprDef	*value;
173} VarDef;
174
175typedef struct _VModDef {
176    ParseCommon	 common;
177    unsigned	 merge;
178    Atom	 name;
179    ExprDef	*value;
180} VModDef;
181
182typedef struct _KeycodeDef {
183    ParseCommon	common;
184    unsigned	merge;
185    char 	name[5];
186    ExprDef	*value;
187} KeycodeDef;
188
189typedef struct _KeyAliasDef {
190    ParseCommon	common;
191    unsigned	merge;
192    char 	alias[5];
193    char 	real[5];
194} KeyAliasDef;
195
196typedef struct _KeyTypeDef {
197    ParseCommon	 common;
198    unsigned	 merge;
199    Atom	 name;
200    VarDef	*body;
201} KeyTypeDef;
202
203typedef struct _SymbolsDef {
204    ParseCommon	 common;
205    unsigned	 merge;
206    char 	 keyName[5];
207    ExprDef *	 symbols;
208} SymbolsDef;
209
210typedef struct _ModMapDef {
211    ParseCommon	 common;
212    unsigned	 merge;
213    Atom	 modifier;
214    ExprDef *	 keys;
215} ModMapDef;
216
217typedef struct _GroupCompatDef {
218    ParseCommon	 common;
219    unsigned	 merge;
220    int	 	 group;
221    ExprDef *	 def;
222} GroupCompatDef;
223
224typedef struct _InterpDef {
225    ParseCommon	 common;
226    unsigned	 merge;
227    KeySym	 sym;
228    ExprDef	*match;
229    VarDef	*def;
230} InterpDef;
231
232typedef struct _IndicatorNameDef {
233    ParseCommon	 common;
234    unsigned	 merge;
235    int		 ndx;
236    ExprDef *	 name;
237    Bool	 virtual;
238} IndicatorNameDef;
239
240typedef struct _OutlineDef {
241    ParseCommon	 	common;
242    Atom 	field;
243    int		 	nPoints;
244    ExprDef *		points;
245} OutlineDef;
246
247typedef struct _ShapeDef {
248    ParseCommon	 common;
249    unsigned	 merge;
250    Atom	 name;
251    int		 nOutlines;
252    OutlineDef * outlines;
253} ShapeDef;
254
255typedef struct _KeyDef {
256    ParseCommon	 	common;
257    unsigned		defined;
258    char *		name;
259    ExprDef *		expr;
260} KeyDef;
261
262typedef struct _RowDef {
263    ParseCommon		common;
264    int			nKeys;
265    KeyDef *		keys;
266} RowDef;
267
268typedef struct _SectionDef {
269    ParseCommon	 common;
270    unsigned	 merge;
271    Atom	 name;
272    int		 nRows;
273    RowDef *	 rows;
274} SectionDef;
275
276typedef struct _OverlayKeyDef {
277    ParseCommon		common;
278    char 		over[5];
279    char 		under[5];
280} OverlayKeyDef;
281
282typedef struct _OverlayDef {
283    ParseCommon	 	common;
284    unsigned	 	merge;
285    Atom	 	name;
286    int		 	nKeys;
287    OverlayKeyDef *	keys;
288} OverlayDef;
289
290typedef struct _DoodadDef {
291    ParseCommon	 common;
292    unsigned	 merge;
293    unsigned	 type;
294    Atom	 name;
295    VarDef *	 body;
296} DoodadDef;
297
298/* IndicatorMapDef doesn't use the type field, but the rest of the fields
299   need to be at the same offsets as in DoodadDef.  Use #define to avoid
300   any strict aliasing problems.  */
301#define IndicatorMapDef DoodadDef
302
303typedef struct _XkbFile {
304    ParseCommon	 common;
305    int		 type;
306    char *	 topName;
307    char *	 name;
308    ParseCommon	*defs;
309    int		 id;
310    unsigned	 flags;
311    Bool	 compiled;
312} XkbFile;
313
314extern	Bool	CompileKeymap(
315    XkbFile	*	/* file */,
316    XkbFileInfo *	/* result */,
317    unsigned	 	/* merge */
318);
319
320extern	Bool	CompileKeycodes(
321    XkbFile	*	/* file */,
322    XkbFileInfo *	/* result */,
323    unsigned	 	/* merge */
324);
325
326extern	Bool	CompileGeometry(
327    XkbFile	*	/* file */,
328    XkbFileInfo *	/* result */,
329    unsigned	 	/* merge */
330);
331
332extern	Bool	CompileKeyTypes(
333    XkbFile	*	/* file */,
334    XkbFileInfo *	/* result */,
335    unsigned	 	/* merge */
336);
337
338typedef struct _LEDInfo *LEDInfoPtr;
339
340extern	Bool	CompileCompatMap(
341    XkbFile	*	/* file */,
342    XkbFileInfo *	/* result */,
343    unsigned	 	/* merge */,
344    LEDInfoPtr *	/* unboundLEDs */
345);
346
347extern	Bool	CompileSymbols(
348    XkbFile	*	/* file */,
349    XkbFileInfo *	/* result */,
350    unsigned	 	/* merge */
351);
352
353#define	WantLongListing	(1<<0)
354#define	WantPartialMaps	(1<<1)
355#define	WantHiddenMaps	(1<<2)
356#define	WantFullNames	(1<<3)
357#define	ListRecursive	(1<<4)
358
359extern char *	rootDir;
360extern unsigned verboseLevel;
361extern unsigned	dirsToStrip;
362
363extern	Bool	AddListing(
364    char *	/* file */,
365    char *	/* map */
366);
367
368extern Bool AddMatchingFiles(
369    char *	/* head_in */
370);
371
372extern	int AddMapOnly(
373    char *	/* map */
374);
375
376extern	int GenerateListing(
377    char *	/* filename */
378);
379
380#endif /* XKBCOMP_H */
381