1 /************************************************************
2 * Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
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.
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.
25 ********************************************************/
28 * Copyright © 2012 Ran Benita <ran234@gmail.com>
30 * Permission is hereby granted, free of charge, to any person obtaining a
31 * copy of this software and associated documentation files (the "Software"),
32 * to deal in the Software without restriction, including without limitation
33 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
34 * and/or sell copies of the Software, and to permit persons to whom the
35 * Software is furnished to do so, subject to the following conditions:
37 * The above copyright notice and this permission notice (including the next
38 * paragraph) shall be included in all copies or substantial portions of the
41 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
42 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
43 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
44 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
45 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
46 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
47 * DEALINGS IN THE SOFTWARE.
50 #include "xkbcomp-priv.h"
58 SI_FIELD_VIRTUAL_MOD = (1 << 0),
59 SI_FIELD_ACTION = (1 << 1),
60 SI_FIELD_AUTO_REPEAT = (1 << 2),
61 SI_FIELD_LEVEL_ONE_ONLY = (1 << 3),
65 enum si_field defined;
66 enum merge_mode merge;
68 struct xkb_sym_interpret interp;
72 LED_FIELD_MODS = (1 << 0),
73 LED_FIELD_GROUPS = (1 << 1),
74 LED_FIELD_CTRLS = (1 << 2),
78 enum led_field defined;
79 enum merge_mode merge;
87 SymInterpInfo default_interp;
88 darray(SymInterpInfo) interps;
92 struct xkb_keymap *keymap;
96 siText(SymInterpInfo *si, CompatInfo *info)
98 char *buf = xkb_context_get_buffer(info->keymap->ctx, 128);
100 if (si == &info->default_interp)
103 snprintf(buf, 128, "%s+%s(%s)",
104 KeysymText(info->keymap->ctx, si->interp.sym),
105 SIMatchText(si->interp.match),
106 ModMaskText(info->keymap, si->interp.mods));
112 ReportSINotArray(CompatInfo *info, SymInterpInfo *si, const char *field)
114 return ReportNotArray(info->keymap->ctx, "symbol interpretation", field,
119 ReportSIBadType(CompatInfo *info, SymInterpInfo *si, const char *field,
122 return ReportBadType(info->keymap->ctx, "symbol interpretation", field,
123 siText(si, info), wanted);
127 ReportLedBadType(CompatInfo *info, LedInfo *ledi, const char *field,
130 return ReportBadType(info->keymap->ctx, "indicator map", field,
131 xkb_atom_text(info->keymap->ctx, ledi->led.name),
136 ReportLedNotArray(CompatInfo *info, LedInfo *ledi, const char *field)
138 return ReportNotArray(info->keymap->ctx, "indicator map", field,
139 xkb_atom_text(info->keymap->ctx, ledi->led.name));
143 InitCompatInfo(CompatInfo *info, struct xkb_keymap *keymap,
144 ActionsInfo *actions)
146 memset(info, 0, sizeof(*info));
147 info->keymap = keymap;
148 info->actions = actions;
149 info->default_interp.merge = MERGE_OVERRIDE;
150 info->default_interp.interp.virtual_mod = XKB_MOD_INVALID;
151 info->default_led.merge = MERGE_OVERRIDE;
155 ClearCompatInfo(CompatInfo *info)
158 darray_free(info->interps);
159 darray_free(info->leds);
162 static SymInterpInfo *
163 FindMatchingInterp(CompatInfo *info, SymInterpInfo *new)
167 darray_foreach(old, info->interps)
168 if (old->interp.sym == new->interp.sym &&
169 old->interp.mods == new->interp.mods &&
170 old->interp.match == new->interp.match)
177 UseNewInterpField(enum si_field field, SymInterpInfo *old, SymInterpInfo *new,
178 bool report, enum si_field *collide)
180 if (!(old->defined & field))
183 if (new->defined & field) {
187 if (new->merge != MERGE_AUGMENT)
195 AddInterp(CompatInfo *info, SymInterpInfo *new, bool same_file)
197 SymInterpInfo *old = FindMatchingInterp(info, new);
199 const int verbosity = xkb_context_get_log_verbosity(info->keymap->ctx);
200 const bool report = (same_file && verbosity > 0) || verbosity > 9;
201 enum si_field collide = 0;
203 if (new->merge == MERGE_REPLACE) {
205 log_warn(info->keymap->ctx,
206 "Multiple definitions for \"%s\"; "
207 "Earlier interpretation ignored\n",
213 if (UseNewInterpField(SI_FIELD_VIRTUAL_MOD, old, new, report,
215 old->interp.virtual_mod = new->interp.virtual_mod;
216 old->defined |= SI_FIELD_VIRTUAL_MOD;
218 if (UseNewInterpField(SI_FIELD_ACTION, old, new, report,
220 old->interp.action = new->interp.action;
221 old->defined |= SI_FIELD_ACTION;
223 if (UseNewInterpField(SI_FIELD_AUTO_REPEAT, old, new, report,
225 old->interp.repeat = new->interp.repeat;
226 old->defined |= SI_FIELD_AUTO_REPEAT;
228 if (UseNewInterpField(SI_FIELD_LEVEL_ONE_ONLY, old, new, report,
230 old->interp.level_one_only = new->interp.level_one_only;
231 old->defined |= SI_FIELD_LEVEL_ONE_ONLY;
235 log_warn(info->keymap->ctx,
236 "Multiple interpretations of \"%s\"; "
237 "Using %s definition for duplicate fields\n",
239 (new->merge != MERGE_AUGMENT ? "last" : "first"));
245 darray_append(info->interps, *new);
249 /***====================================================================***/
252 ResolveStateAndPredicate(ExprDef *expr, enum xkb_match_operation *pred_rtrn,
253 xkb_mod_mask_t *mods_rtrn, CompatInfo *info)
256 *pred_rtrn = MATCH_ANY_OR_NONE;
257 *mods_rtrn = MOD_REAL_MASK_ALL;
261 *pred_rtrn = MATCH_EXACTLY;
262 if (expr->expr.op == EXPR_ACTION_DECL) {
263 const char *pred_txt = xkb_atom_text(info->keymap->ctx,
265 if (!LookupString(symInterpretMatchMaskNames, pred_txt, pred_rtrn)) {
266 log_err(info->keymap->ctx,
267 "Illegal modifier predicate \"%s\"; Ignored\n", pred_txt);
270 expr = expr->action.args;
272 else if (expr->expr.op == EXPR_IDENT) {
273 const char *pred_txt = xkb_atom_text(info->keymap->ctx,
275 if (pred_txt && istreq(pred_txt, "any")) {
276 *pred_rtrn = MATCH_ANY;
277 *mods_rtrn = MOD_REAL_MASK_ALL;
282 return ExprResolveModMask(info->keymap, expr, MOD_REAL, mods_rtrn);
285 /***====================================================================***/
288 UseNewLEDField(enum led_field field, LedInfo *old, LedInfo *new,
289 bool report, enum led_field *collide)
291 if (!(old->defined & field))
294 if (new->defined & field) {
298 if (new->merge != MERGE_AUGMENT)
306 AddLedMap(CompatInfo *info, LedInfo *new, bool same_file)
309 enum led_field collide;
310 struct xkb_context *ctx = info->keymap->ctx;
311 const int verbosity = xkb_context_get_log_verbosity(ctx);
312 const bool report = (same_file && verbosity > 0) || verbosity > 9;
314 darray_foreach(old, info->leds) {
315 if (old->led.name != new->led.name)
318 if (old->led.mods.mods == new->led.mods.mods &&
319 old->led.groups == new->led.groups &&
320 old->led.ctrls == new->led.ctrls &&
321 old->led.which_mods == new->led.which_mods &&
322 old->led.which_groups == new->led.which_groups) {
323 old->defined |= new->defined;
327 if (new->merge == MERGE_REPLACE) {
329 log_warn(info->keymap->ctx,
330 "Map for indicator %s redefined; "
331 "Earlier definition ignored\n",
332 xkb_atom_text(ctx, old->led.name));
338 if (UseNewLEDField(LED_FIELD_MODS, old, new, report, &collide)) {
339 old->led.which_mods = new->led.which_mods;
340 old->led.mods = new->led.mods;
341 old->defined |= LED_FIELD_MODS;
343 if (UseNewLEDField(LED_FIELD_GROUPS, old, new, report, &collide)) {
344 old->led.which_groups = new->led.which_groups;
345 old->led.groups = new->led.groups;
346 old->defined |= LED_FIELD_GROUPS;
348 if (UseNewLEDField(LED_FIELD_CTRLS, old, new, report, &collide)) {
349 old->led.ctrls = new->led.ctrls;
350 old->defined |= LED_FIELD_CTRLS;
354 log_warn(info->keymap->ctx,
355 "Map for indicator %s redefined; "
356 "Using %s definition for duplicate fields\n",
357 xkb_atom_text(ctx, old->led.name),
358 (new->merge == MERGE_AUGMENT ? "first" : "last"));
364 darray_append(info->leds, *new);
369 MergeIncludedCompatMaps(CompatInfo *into, CompatInfo *from,
370 enum merge_mode merge)
375 if (from->errorCount > 0) {
376 into->errorCount += from->errorCount;
380 if (into->name == NULL) {
381 into->name = from->name;
385 if (darray_empty(into->interps)) {
386 into->interps = from->interps;
387 darray_init(from->interps);
390 darray_foreach(si, from->interps) {
391 si->merge = (merge == MERGE_DEFAULT ? si->merge : merge);
392 if (!AddInterp(into, si, false))
397 if (darray_empty(into->leds)) {
398 into->leds = from->leds;
399 darray_init(from->leds);
402 darray_foreach(ledi, from->leds) {
403 ledi->merge = (merge == MERGE_DEFAULT ? ledi->merge : merge);
404 if (!AddLedMap(into, ledi, false))
411 HandleCompatMapFile(CompatInfo *info, XkbFile *file, enum merge_mode merge);
414 HandleIncludeCompatMap(CompatInfo *info, IncludeStmt *include)
418 InitCompatInfo(&included, info->keymap, info->actions);
419 included.name = include->stmt;
420 include->stmt = NULL;
422 for (IncludeStmt *stmt = include; stmt; stmt = stmt->next_incl) {
423 CompatInfo next_incl;
426 file = ProcessIncludeFile(info->keymap->ctx, stmt, FILE_TYPE_COMPAT);
428 info->errorCount += 10;
429 ClearCompatInfo(&included);
433 InitCompatInfo(&next_incl, info->keymap, info->actions);
434 next_incl.default_interp = info->default_interp;
435 next_incl.default_interp.merge = stmt->merge;
436 next_incl.default_led = info->default_led;
437 next_incl.default_led.merge = stmt->merge;
439 HandleCompatMapFile(&next_incl, file, MERGE_OVERRIDE);
441 MergeIncludedCompatMaps(&included, &next_incl, stmt->merge);
443 ClearCompatInfo(&next_incl);
447 MergeIncludedCompatMaps(info, &included, include->merge);
448 ClearCompatInfo(&included);
450 return (info->errorCount == 0);
454 SetInterpField(CompatInfo *info, SymInterpInfo *si, const char *field,
455 ExprDef *arrayNdx, ExprDef *value)
457 struct xkb_keymap *keymap = info->keymap;
460 if (istreq(field, "action")) {
462 return ReportSINotArray(info, si, field);
464 if (!HandleActionDef(value, keymap, &si->interp.action, info->actions))
467 si->defined |= SI_FIELD_ACTION;
469 else if (istreq(field, "virtualmodifier") ||
470 istreq(field, "virtualmod")) {
472 return ReportSINotArray(info, si, field);
474 if (!ExprResolveMod(keymap, value, MOD_VIRT, &ndx))
475 return ReportSIBadType(info, si, field, "virtual modifier");
477 si->interp.virtual_mod = ndx;
478 si->defined |= SI_FIELD_VIRTUAL_MOD;
480 else if (istreq(field, "repeat")) {
484 return ReportSINotArray(info, si, field);
486 if (!ExprResolveBoolean(keymap->ctx, value, &set))
487 return ReportSIBadType(info, si, field, "boolean");
489 si->interp.repeat = set;
491 si->defined |= SI_FIELD_AUTO_REPEAT;
493 else if (istreq(field, "locking")) {
494 log_dbg(info->keymap->ctx,
495 "The \"locking\" field in symbol interpretation is unsupported; "
498 else if (istreq(field, "usemodmap") ||
499 istreq(field, "usemodmapmods")) {
503 return ReportSINotArray(info, si, field);
505 if (!ExprResolveEnum(keymap->ctx, value, &val, useModMapValueNames))
506 return ReportSIBadType(info, si, field, "level specification");
508 si->interp.level_one_only = !!val;
509 si->defined |= SI_FIELD_LEVEL_ONE_ONLY;
512 return ReportBadField(keymap->ctx, "symbol interpretation", field,
520 SetLedMapField(CompatInfo *info, LedInfo *ledi, const char *field,
521 ExprDef *arrayNdx, ExprDef *value)
524 struct xkb_keymap *keymap = info->keymap;
526 if (istreq(field, "modifiers") || istreq(field, "mods")) {
528 return ReportLedNotArray(info, ledi, field);
530 if (!ExprResolveModMask(keymap, value, MOD_BOTH, &ledi->led.mods.mods))
531 return ReportLedBadType(info, ledi, field, "modifier mask");
533 ledi->defined |= LED_FIELD_MODS;
535 else if (istreq(field, "groups")) {
539 return ReportLedNotArray(info, ledi, field);
541 if (!ExprResolveMask(keymap->ctx, value, &mask, groupMaskNames))
542 return ReportLedBadType(info, ledi, field, "group mask");
544 ledi->led.groups = mask;
545 ledi->defined |= LED_FIELD_GROUPS;
547 else if (istreq(field, "controls") || istreq(field, "ctrls")) {
551 return ReportLedNotArray(info, ledi, field);
553 if (!ExprResolveMask(keymap->ctx, value, &mask, ctrlMaskNames))
554 return ReportLedBadType(info, ledi, field, "controls mask");
556 ledi->led.ctrls = mask;
557 ledi->defined |= LED_FIELD_CTRLS;
559 else if (istreq(field, "allowexplicit")) {
560 log_dbg(info->keymap->ctx,
561 "The \"allowExplicit\" field in indicator statements is unsupported; "
564 else if (istreq(field, "whichmodstate") ||
565 istreq(field, "whichmodifierstate")) {
569 return ReportLedNotArray(info, ledi, field);
571 if (!ExprResolveMask(keymap->ctx, value, &mask,
572 modComponentMaskNames))
573 return ReportLedBadType(info, ledi, field,
574 "mask of modifier state components");
576 ledi->led.which_mods = mask;
578 else if (istreq(field, "whichgroupstate")) {
582 return ReportLedNotArray(info, ledi, field);
584 if (!ExprResolveMask(keymap->ctx, value, &mask,
585 groupComponentMaskNames))
586 return ReportLedBadType(info, ledi, field,
587 "mask of group state components");
589 ledi->led.which_groups = mask;
591 else if (istreq(field, "driveskbd") ||
592 istreq(field, "driveskeyboard") ||
593 istreq(field, "leddriveskbd") ||
594 istreq(field, "leddriveskeyboard") ||
595 istreq(field, "indicatordriveskbd") ||
596 istreq(field, "indicatordriveskeyboard")) {
597 log_dbg(info->keymap->ctx,
598 "The \"%s\" field in indicator statements is unsupported; "
601 else if (istreq(field, "index")) {
602 /* Users should see this, it might cause unexpected behavior. */
603 log_err(info->keymap->ctx,
604 "The \"index\" field in indicator statements is unsupported; "
608 log_err(info->keymap->ctx,
609 "Unknown field %s in map for %s indicator; "
610 "Definition ignored\n",
611 field, xkb_atom_text(keymap->ctx, ledi->led.name));
619 HandleGlobalVar(CompatInfo *info, VarDef *stmt)
621 const char *elem, *field;
625 if (!ExprResolveLhs(info->keymap->ctx, stmt->name, &elem, &field, &ndx))
627 else if (elem && istreq(elem, "interpret"))
628 ret = SetInterpField(info, &info->default_interp, field, ndx,
630 else if (elem && istreq(elem, "indicator"))
631 ret = SetLedMapField(info, &info->default_led, field, ndx,
634 ret = SetActionField(info->keymap, elem, field, ndx, stmt->value,
640 HandleInterpBody(CompatInfo *info, VarDef *def, SymInterpInfo *si)
643 const char *elem, *field;
646 for (; def; def = (VarDef *) def->common.next) {
647 if (def->name && def->name->expr.op == EXPR_FIELD_REF) {
648 log_err(info->keymap->ctx,
649 "Cannot set a global default value from within an interpret statement; "
650 "Move statements to the global file scope\n");
655 ok = ExprResolveLhs(info->keymap->ctx, def->name, &elem, &field,
660 ok = SetInterpField(info, si, field, arrayNdx, def->value);
667 HandleInterpDef(CompatInfo *info, InterpDef *def, enum merge_mode merge)
669 enum xkb_match_operation pred;
673 if (!ResolveStateAndPredicate(def->match, &pred, &mods, info)) {
674 log_err(info->keymap->ctx,
675 "Couldn't determine matching modifiers; "
676 "Symbol interpretation ignored\n");
680 si = info->default_interp;
681 si.merge = merge = (def->merge == MERGE_DEFAULT ? merge : def->merge);
682 si.interp.sym = def->sym;
683 si.interp.match = pred;
684 si.interp.mods = mods;
686 if (!HandleInterpBody(info, def->def, &si)) {
691 if (!AddInterp(info, &si, true)) {
700 HandleLedMapDef(CompatInfo *info, LedMapDef *def, enum merge_mode merge)
706 if (def->merge != MERGE_DEFAULT)
709 ledi = info->default_led;
711 ledi.led.name = def->name;
714 for (var = def->body; var != NULL; var = (VarDef *) var->common.next) {
715 const char *elem, *field;
717 if (!ExprResolveLhs(info->keymap->ctx, var->name, &elem, &field,
724 log_err(info->keymap->ctx,
725 "Cannot set defaults for \"%s\" element in indicator map; "
726 "Assignment to %s.%s ignored\n", elem, elem, field);
730 ok = SetLedMapField(info, &ledi, field, arrayNdx, var->value) && ok;
735 return AddLedMap(info, &ledi, true);
741 HandleCompatMapFile(CompatInfo *info, XkbFile *file, enum merge_mode merge)
745 merge = (merge == MERGE_DEFAULT ? MERGE_AUGMENT : merge);
748 info->name = strdup_safe(file->name);
750 for (ParseCommon *stmt = file->defs; stmt; stmt = stmt->next) {
751 switch (stmt->type) {
753 ok = HandleIncludeCompatMap(info, (IncludeStmt *) stmt);
756 ok = HandleInterpDef(info, (InterpDef *) stmt, merge);
758 case STMT_GROUP_COMPAT:
759 log_dbg(info->keymap->ctx,
760 "The \"group\" statement in compat is unsupported; "
765 ok = HandleLedMapDef(info, (LedMapDef *) stmt, merge);
768 ok = HandleGlobalVar(info, (VarDef *) stmt);
771 ok = HandleVModDef(info->keymap, (VModDef *) stmt);
774 log_err(info->keymap->ctx,
775 "Compat files may not include other types; "
776 "Ignoring %s\n", stmt_type_to_string(stmt->type));
784 if (info->errorCount > 10) {
785 log_err(info->keymap->ctx,
786 "Abandoning compatibility map \"%s\"\n", file->topName);
792 /* Temporary struct for CopyInterps. */
794 darray(struct xkb_sym_interpret) sym_interprets;
798 CopyInterps(CompatInfo *info, bool needSymbol, enum xkb_match_operation pred,
799 struct collect *collect)
803 darray_foreach(si, info->interps)
804 if (si->interp.match == pred &&
805 (si->interp.sym != XKB_KEY_NoSymbol) == needSymbol)
806 darray_append(collect->sym_interprets, si->interp);
810 CopyLedMapDefs(CompatInfo *info)
815 struct xkb_keymap *keymap = info->keymap;
817 darray_foreach(ledi, info->leds) {
819 * Find the LED with the given name, if it was already declared
822 darray_enumerate(i, led, keymap->leds)
823 if (led->name == ledi->led.name)
826 /* Not previously declared; create it with next free index. */
827 if (i >= darray_size(keymap->leds)) {
829 "Indicator name \"%s\" was not declared in the keycodes section; "
830 "Adding new indicator\n",
831 xkb_atom_text(keymap->ctx, ledi->led.name));
833 darray_enumerate(i, led, keymap->leds)
834 if (led->name == XKB_ATOM_NONE)
837 if (i >= darray_size(keymap->leds)) {
838 /* Not place to put it; ignore. */
839 if (i >= XKB_MAX_LEDS) {
841 "Too many indicators (maximum is %d); "
842 "Indicator name \"%s\" ignored\n",
844 xkb_atom_text(keymap->ctx, ledi->led.name));
848 darray_resize(keymap->leds, i + 1);
849 led = &darray_item(keymap->leds, i);
854 if (led->groups != 0 && led->which_groups == 0)
855 led->which_groups = XKB_STATE_LAYOUT_EFFECTIVE;
856 if (led->mods.mods != 0 && led->which_mods == 0)
857 led->which_mods = XKB_STATE_MODS_EFFECTIVE;
862 CopyCompatToKeymap(struct xkb_keymap *keymap, CompatInfo *info)
864 keymap->compat_section_name = strdup_safe(info->name);
865 XkbEscapeMapName(keymap->compat_section_name);
867 if (!darray_empty(info->interps)) {
868 struct collect collect;
869 darray_init(collect.sym_interprets);
871 /* Most specific to least specific. */
872 CopyInterps(info, true, MATCH_EXACTLY, &collect);
873 CopyInterps(info, true, MATCH_ALL, &collect);
874 CopyInterps(info, true, MATCH_NONE, &collect);
875 CopyInterps(info, true, MATCH_ANY, &collect);
876 CopyInterps(info, true, MATCH_ANY_OR_NONE, &collect);
877 CopyInterps(info, false, MATCH_EXACTLY, &collect);
878 CopyInterps(info, false, MATCH_ALL, &collect);
879 CopyInterps(info, false, MATCH_NONE, &collect);
880 CopyInterps(info, false, MATCH_ANY, &collect);
881 CopyInterps(info, false, MATCH_ANY_OR_NONE, &collect);
883 keymap->num_sym_interprets = darray_size(collect.sym_interprets);
884 keymap->sym_interprets = darray_mem(collect.sym_interprets, 0);
887 CopyLedMapDefs(info);
893 CompileCompatMap(XkbFile *file, struct xkb_keymap *keymap,
894 enum merge_mode merge)
897 ActionsInfo *actions;
899 actions = NewActionsInfo();
903 InitCompatInfo(&info, keymap, actions);
904 info.default_interp.merge = merge;
905 info.default_led.merge = merge;
907 HandleCompatMapFile(&info, file, merge);
908 if (info.errorCount != 0)
911 if (!CopyCompatToKeymap(keymap, &info))
914 ClearCompatInfo(&info);
915 FreeActionsInfo(actions);
919 ClearCompatInfo(&info);
920 FreeActionsInfo(actions);