xref: /aosp_15_r20/external/libxkbcommon/src/xkbcomp/xkbcomp-priv.h (revision 2b949d0487e80d67f1fda82db69e101e761f8064)
1*2b949d04SAndroid Build Coastguard Worker /************************************************************
2*2b949d04SAndroid Build Coastguard Worker  * Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
3*2b949d04SAndroid Build Coastguard Worker  *
4*2b949d04SAndroid Build Coastguard Worker  * Permission to use, copy, modify, and distribute this
5*2b949d04SAndroid Build Coastguard Worker  * software and its documentation for any purpose and without
6*2b949d04SAndroid Build Coastguard Worker  * fee is hereby granted, provided that the above copyright
7*2b949d04SAndroid Build Coastguard Worker  * notice appear in all copies and that both that copyright
8*2b949d04SAndroid Build Coastguard Worker  * notice and this permission notice appear in supporting
9*2b949d04SAndroid Build Coastguard Worker  * documentation, and that the name of Silicon Graphics not be
10*2b949d04SAndroid Build Coastguard Worker  * used in advertising or publicity pertaining to distribution
11*2b949d04SAndroid Build Coastguard Worker  * of the software without specific prior written permission.
12*2b949d04SAndroid Build Coastguard Worker  * Silicon Graphics makes no representation about the suitability
13*2b949d04SAndroid Build Coastguard Worker  * of this software for any purpose. It is provided "as is"
14*2b949d04SAndroid Build Coastguard Worker  * without any express or implied warranty.
15*2b949d04SAndroid Build Coastguard Worker  *
16*2b949d04SAndroid Build Coastguard Worker  * SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
17*2b949d04SAndroid Build Coastguard Worker  * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
18*2b949d04SAndroid Build Coastguard Worker  * AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
19*2b949d04SAndroid Build Coastguard Worker  * GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
20*2b949d04SAndroid Build Coastguard Worker  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
21*2b949d04SAndroid Build Coastguard Worker  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
22*2b949d04SAndroid Build Coastguard Worker  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
23*2b949d04SAndroid Build Coastguard Worker  * THE USE OR PERFORMANCE OF THIS SOFTWARE.
24*2b949d04SAndroid Build Coastguard Worker  *
25*2b949d04SAndroid Build Coastguard Worker  ********************************************************/
26*2b949d04SAndroid Build Coastguard Worker 
27*2b949d04SAndroid Build Coastguard Worker #ifndef XKBCOMP_PRIV_H
28*2b949d04SAndroid Build Coastguard Worker #define XKBCOMP_PRIV_H
29*2b949d04SAndroid Build Coastguard Worker 
30*2b949d04SAndroid Build Coastguard Worker #include "keymap.h"
31*2b949d04SAndroid Build Coastguard Worker #include "ast.h"
32*2b949d04SAndroid Build Coastguard Worker 
33*2b949d04SAndroid Build Coastguard Worker struct xkb_component_names {
34*2b949d04SAndroid Build Coastguard Worker     char *keycodes;
35*2b949d04SAndroid Build Coastguard Worker     char *types;
36*2b949d04SAndroid Build Coastguard Worker     char *compat;
37*2b949d04SAndroid Build Coastguard Worker     char *symbols;
38*2b949d04SAndroid Build Coastguard Worker };
39*2b949d04SAndroid Build Coastguard Worker 
40*2b949d04SAndroid Build Coastguard Worker char *
41*2b949d04SAndroid Build Coastguard Worker text_v1_keymap_get_as_string(struct xkb_keymap *keymap);
42*2b949d04SAndroid Build Coastguard Worker 
43*2b949d04SAndroid Build Coastguard Worker XkbFile *
44*2b949d04SAndroid Build Coastguard Worker XkbParseFile(struct xkb_context *ctx, FILE *file,
45*2b949d04SAndroid Build Coastguard Worker              const char *file_name, const char *map);
46*2b949d04SAndroid Build Coastguard Worker 
47*2b949d04SAndroid Build Coastguard Worker XkbFile *
48*2b949d04SAndroid Build Coastguard Worker XkbParseString(struct xkb_context *ctx,
49*2b949d04SAndroid Build Coastguard Worker                const char *string, size_t len,
50*2b949d04SAndroid Build Coastguard Worker                const char *file_name, const char *map);
51*2b949d04SAndroid Build Coastguard Worker 
52*2b949d04SAndroid Build Coastguard Worker void
53*2b949d04SAndroid Build Coastguard Worker FreeXkbFile(XkbFile *file);
54*2b949d04SAndroid Build Coastguard Worker 
55*2b949d04SAndroid Build Coastguard Worker XkbFile *
56*2b949d04SAndroid Build Coastguard Worker XkbFileFromComponents(struct xkb_context *ctx,
57*2b949d04SAndroid Build Coastguard Worker                       const struct xkb_component_names *kkctgs);
58*2b949d04SAndroid Build Coastguard Worker 
59*2b949d04SAndroid Build Coastguard Worker bool
60*2b949d04SAndroid Build Coastguard Worker CompileKeycodes(XkbFile *file, struct xkb_keymap *keymap,
61*2b949d04SAndroid Build Coastguard Worker                 enum merge_mode merge);
62*2b949d04SAndroid Build Coastguard Worker 
63*2b949d04SAndroid Build Coastguard Worker bool
64*2b949d04SAndroid Build Coastguard Worker CompileKeyTypes(XkbFile *file, struct xkb_keymap *keymap,
65*2b949d04SAndroid Build Coastguard Worker                 enum merge_mode merge);
66*2b949d04SAndroid Build Coastguard Worker 
67*2b949d04SAndroid Build Coastguard Worker bool
68*2b949d04SAndroid Build Coastguard Worker CompileCompatMap(XkbFile *file, struct xkb_keymap *keymap,
69*2b949d04SAndroid Build Coastguard Worker                  enum merge_mode merge);
70*2b949d04SAndroid Build Coastguard Worker 
71*2b949d04SAndroid Build Coastguard Worker bool
72*2b949d04SAndroid Build Coastguard Worker CompileSymbols(XkbFile *file, struct xkb_keymap *keymap,
73*2b949d04SAndroid Build Coastguard Worker                enum merge_mode merge);
74*2b949d04SAndroid Build Coastguard Worker 
75*2b949d04SAndroid Build Coastguard Worker bool
76*2b949d04SAndroid Build Coastguard Worker CompileKeymap(XkbFile *file, struct xkb_keymap *keymap,
77*2b949d04SAndroid Build Coastguard Worker               enum merge_mode merge);
78*2b949d04SAndroid Build Coastguard Worker 
79*2b949d04SAndroid Build Coastguard Worker /***====================================================================***/
80*2b949d04SAndroid Build Coastguard Worker 
81*2b949d04SAndroid Build Coastguard Worker static inline bool
ReportNotArray(struct xkb_context * ctx,const char * type,const char * field,const char * name)82*2b949d04SAndroid Build Coastguard Worker ReportNotArray(struct xkb_context *ctx, const char *type, const char *field,
83*2b949d04SAndroid Build Coastguard Worker                const char *name)
84*2b949d04SAndroid Build Coastguard Worker {
85*2b949d04SAndroid Build Coastguard Worker     log_err(ctx,
86*2b949d04SAndroid Build Coastguard Worker             "The %s %s field is not an array; "
87*2b949d04SAndroid Build Coastguard Worker             "Ignoring illegal assignment in %s\n",
88*2b949d04SAndroid Build Coastguard Worker             type, field, name);
89*2b949d04SAndroid Build Coastguard Worker     return false;
90*2b949d04SAndroid Build Coastguard Worker }
91*2b949d04SAndroid Build Coastguard Worker 
92*2b949d04SAndroid Build Coastguard Worker static inline bool
ReportShouldBeArray(struct xkb_context * ctx,const char * type,const char * field,const char * name)93*2b949d04SAndroid Build Coastguard Worker ReportShouldBeArray(struct xkb_context *ctx, const char *type,
94*2b949d04SAndroid Build Coastguard Worker                     const char *field, const char *name)
95*2b949d04SAndroid Build Coastguard Worker {
96*2b949d04SAndroid Build Coastguard Worker     log_err(ctx,
97*2b949d04SAndroid Build Coastguard Worker             "Missing subscript for %s %s; "
98*2b949d04SAndroid Build Coastguard Worker             "Ignoring illegal assignment in %s\n",
99*2b949d04SAndroid Build Coastguard Worker             type, field, name);
100*2b949d04SAndroid Build Coastguard Worker     return false;
101*2b949d04SAndroid Build Coastguard Worker }
102*2b949d04SAndroid Build Coastguard Worker 
103*2b949d04SAndroid Build Coastguard Worker static inline bool
ReportBadType(struct xkb_context * ctx,const char * type,const char * field,const char * name,const char * wanted)104*2b949d04SAndroid Build Coastguard Worker ReportBadType(struct xkb_context *ctx, const char *type, const char *field,
105*2b949d04SAndroid Build Coastguard Worker               const char *name, const char *wanted)
106*2b949d04SAndroid Build Coastguard Worker {
107*2b949d04SAndroid Build Coastguard Worker     log_err(ctx, "The %s %s field must be a %s; "
108*2b949d04SAndroid Build Coastguard Worker             "Ignoring illegal assignment in %s\n",
109*2b949d04SAndroid Build Coastguard Worker             type, field, wanted, name);
110*2b949d04SAndroid Build Coastguard Worker     return false;
111*2b949d04SAndroid Build Coastguard Worker }
112*2b949d04SAndroid Build Coastguard Worker 
113*2b949d04SAndroid Build Coastguard Worker static inline bool
ReportBadField(struct xkb_context * ctx,const char * type,const char * field,const char * name)114*2b949d04SAndroid Build Coastguard Worker ReportBadField(struct xkb_context *ctx, const char *type, const char *field,
115*2b949d04SAndroid Build Coastguard Worker                const char *name)
116*2b949d04SAndroid Build Coastguard Worker {
117*2b949d04SAndroid Build Coastguard Worker     log_err(ctx,
118*2b949d04SAndroid Build Coastguard Worker             "Unknown %s field %s in %s; "
119*2b949d04SAndroid Build Coastguard Worker             "Ignoring assignment to unknown field in %s\n",
120*2b949d04SAndroid Build Coastguard Worker             type, field, name, name);
121*2b949d04SAndroid Build Coastguard Worker     return false;
122*2b949d04SAndroid Build Coastguard Worker }
123*2b949d04SAndroid Build Coastguard Worker 
124*2b949d04SAndroid Build Coastguard Worker #endif
125