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 ********************************************************/
29 #include "parseutils.h"
32 longText(unsigned long val)
36 LongToKeyName(val, buf);
37 return XkbcKeyNameText(buf);
40 /***====================================================================***/
43 LongToKeyName(unsigned long val, char *name)
45 name[0] = ((val >> 24) & 0xff);
46 name[1] = ((val >> 16) & 0xff);
47 name[2] = ((val >> 8) & 0xff);
48 name[3] = (val & 0xff);
51 /***====================================================================***/
53 typedef struct _AliasInfo {
54 enum merge_mode merge;
58 char alias[XkbKeyNameLength + 1];
59 char real[XkbKeyNameLength + 1];
62 typedef struct _IndicatorNameInfo {
63 enum merge_mode merge;
72 typedef struct _KeyNamesInfo {
73 char *name; /* e.g. evdev+aliases(qwerty) */
76 enum merge_mode merge;
77 xkb_keycode_t computedMin; /* lowest keycode stored */
78 xkb_keycode_t computedMax; /* highest keycode stored */
79 xkb_keycode_t explicitMin;
80 xkb_keycode_t explicitMax;
81 darray(unsigned long) names;
82 darray(unsigned int) files;
88 HandleKeycodesFile(XkbFile *file, struct xkb_keymap *keymap,
89 enum merge_mode merge,
93 ResizeKeyNameArrays(KeyNamesInfo *info, int newMax)
95 if (newMax < darray_size(info->names))
98 darray_resize0(info->names, newMax + 1);
99 darray_resize0(info->files, newMax + 1);
103 InitAliasInfo(AliasInfo *info, enum merge_mode merge, unsigned file_id,
104 char *alias, char *real)
106 memset(info, 0, sizeof(*info));
108 info->file_id = file_id;
109 strncpy(info->alias, alias, XkbKeyNameLength);
110 strncpy(info->real, real, XkbKeyNameLength);
114 InitIndicatorNameInfo(IndicatorNameInfo * ii, KeyNamesInfo * info)
116 ii->merge = info->merge;
117 ii->file_id = info->file_id;
119 ii->name = XKB_ATOM_NONE;
123 static IndicatorNameInfo *
124 NextIndicatorName(KeyNamesInfo * info)
126 IndicatorNameInfo *ii;
128 ii = malloc(sizeof(*ii));
132 InitIndicatorNameInfo(ii, info);
133 list_append(&ii->entry, &info->leds);
138 static IndicatorNameInfo *
139 FindIndicatorByIndex(KeyNamesInfo * info, int ndx)
141 IndicatorNameInfo *old;
143 list_foreach(old, &info->leds, entry)
150 static IndicatorNameInfo *
151 FindIndicatorByName(KeyNamesInfo * info, xkb_atom_t name)
153 IndicatorNameInfo *old;
155 list_foreach(old, &info->leds, entry)
156 if (old->name == name)
163 AddIndicatorName(KeyNamesInfo *info, struct xkb_keymap *keymap,
164 enum merge_mode merge,
165 IndicatorNameInfo *new)
167 IndicatorNameInfo *old;
170 replace = (merge == MERGE_REPLACE) || (merge == MERGE_OVERRIDE);
172 old = FindIndicatorByName(info, new->name);
174 if ((old->file_id == new->file_id && warningLevel > 0) ||
176 WARN("Multiple indicators named %s\n",
177 xkb_atom_text(keymap->ctx, new->name));
178 if (old->ndx == new->ndx) {
179 if (old->virtual != new->virtual) {
181 old->virtual = new->virtual;
182 ACTION("Using %s instead of %s\n",
183 (old->virtual ? "virtual" : "real"),
184 (old->virtual ? "real" : "virtual"));
187 ACTION("Identical definitions ignored\n");
193 ACTION("Ignoring %d, using %d\n", old->ndx, new->ndx);
195 ACTION("Using %d, ignoring %d\n", old->ndx, new->ndx);
199 list_del(&old->entry);
205 old = FindIndicatorByIndex(info, new->ndx);
207 if ((old->file_id == new->file_id && warningLevel > 0) ||
209 WARN("Multiple names for indicator %d\n", new->ndx);
210 if ((old->name == new->name) && (old->virtual == new->virtual))
211 ACTION("Identical definitions ignored\n");
213 const char *oldType, *newType;
214 xkb_atom_t using, ignoring;
216 oldType = "virtual indicator";
218 oldType = "real indicator";
220 newType = "virtual indicator";
222 newType = "real indicator";
225 ignoring = old->name;
229 ignoring = new->name;
231 ACTION("Using %s %s, ignoring %s %s\n",
232 oldType, xkb_atom_text(keymap->ctx, using),
233 newType, xkb_atom_text(keymap->ctx, ignoring));
237 old->name = new->name;
238 old->virtual = new->virtual;
243 new = NextIndicatorName(info);
245 WSGO("Couldn't allocate name for indicator %d\n", old->ndx);
249 new->name = old->name;
251 new->virtual = old->virtual;
256 ClearKeyNamesInfo(KeyNamesInfo * info)
258 AliasInfo *alias, *next_alias;
259 IndicatorNameInfo *ii, *next_ii;
263 info->computedMax = info->explicitMax = info->explicitMin = 0;
264 info->computedMin = XKB_KEYCODE_MAX;
265 darray_free(info->names);
266 darray_free(info->files);
267 list_foreach_safe(ii, next_ii, &info->leds, entry)
269 list_foreach_safe(alias, next_alias, &info->aliases, entry)
271 list_init(&info->aliases);
275 InitKeyNamesInfo(KeyNamesInfo * info, unsigned file_id)
278 list_init(&info->leds);
279 list_init(&info->aliases);
280 info->file_id = file_id;
281 darray_init(info->names);
282 darray_init(info->files);
283 ClearKeyNamesInfo(info);
284 info->errorCount = 0;
288 FindKeyByLong(KeyNamesInfo * info, unsigned long name)
292 for (i = info->computedMin; i <= info->computedMax; i++)
293 if (darray_item(info->names, i) == name)
300 * Store the name of the key as a long in the info struct under the given
301 * keycode. If the same keys is referred to twice, print a warning.
302 * Note that the key's name is stored as a long, the keycode is the index.
305 AddKeyName(KeyNamesInfo * info,
306 xkb_keycode_t kc, char *name, enum merge_mode merge,
307 unsigned file_id, bool reportCollisions)
312 ResizeKeyNameArrays(info, kc);
314 if (kc < info->computedMin)
315 info->computedMin = kc;
316 if (kc > info->computedMax)
317 info->computedMax = kc;
318 lval = KeyNameToLong(name);
320 if (reportCollisions) {
321 reportCollisions = (warningLevel > 7 ||
323 file_id == darray_item(info->files, kc)));
326 if (darray_item(info->names, kc) != 0) {
329 LongToKeyName(darray_item(info->names, kc), buf);
331 if (darray_item(info->names, kc) == lval && reportCollisions) {
332 WARN("Multiple identical key name definitions\n");
333 ACTION("Later occurences of \"<%s> = %d\" ignored\n",
337 if (merge == MERGE_AUGMENT) {
338 if (reportCollisions) {
339 WARN("Multiple names for keycode %d\n", kc);
340 ACTION("Using <%s>, ignoring <%s>\n", buf, name);
345 if (reportCollisions) {
346 WARN("Multiple names for keycode %d\n", kc);
347 ACTION("Using <%s>, ignoring <%s>\n", name, buf);
349 darray_item(info->names, kc) = 0;
350 darray_item(info->files, kc) = 0;
353 old = FindKeyByLong(info, lval);
354 if ((old != 0) && (old != kc)) {
355 if (merge == MERGE_OVERRIDE) {
356 darray_item(info->names, old) = 0;
357 darray_item(info->files, old) = 0;
358 if (reportCollisions) {
359 WARN("Key name <%s> assigned to multiple keys\n", name);
360 ACTION("Using %d, ignoring %d\n", kc, old);
364 if ((reportCollisions) && (warningLevel > 3)) {
365 WARN("Key name <%s> assigned to multiple keys\n", name);
366 ACTION("Using %d, ignoring %d\n", old, kc);
371 darray_item(info->names, kc) = lval;
372 darray_item(info->files, kc) = file_id;
376 /***====================================================================***/
379 HandleAliasDef(KeyAliasDef *def, enum merge_mode merge, unsigned file_id,
383 MergeAliases(KeyNamesInfo *into, KeyNamesInfo *from, enum merge_mode merge)
385 AliasInfo *alias, *next;
388 if (list_empty(&from->aliases))
391 if (list_empty(&into->aliases)) {
392 list_replace(&from->aliases, &into->aliases);
393 list_init(&from->aliases);
397 memset(&def, 0, sizeof(def));
399 list_foreach_safe(alias, next, &from->aliases, entry) {
400 def.merge = (merge == MERGE_DEFAULT) ? alias->merge : merge;
401 memcpy(def.alias, alias->alias, XkbKeyNameLength);
402 memcpy(def.real, alias->real, XkbKeyNameLength);
404 if (!HandleAliasDef(&def, def.merge, alias->file_id, into))
412 MergeIncludedKeycodes(KeyNamesInfo *into, struct xkb_keymap *keymap,
413 KeyNamesInfo *from, enum merge_mode merge)
417 IndicatorNameInfo *led;
419 if (from->errorCount > 0) {
420 into->errorCount += from->errorCount;
423 if (into->name == NULL) {
424 into->name = from->name;
428 ResizeKeyNameArrays(into, from->computedMax);
430 for (i = from->computedMin; i <= from->computedMax; i++) {
431 if (darray_item(from->names, i) == 0)
433 LongToKeyName(darray_item(from->names, i), buf);
435 if (!AddKeyName(into, i, buf, merge, from->file_id, false))
439 list_foreach(led, &from->leds, entry) {
440 led->merge = (merge == MERGE_DEFAULT ? led->merge : merge);
441 if (!AddIndicatorName(into, keymap, led->merge, led))
445 if (!MergeAliases(into, from, merge))
447 if (from->explicitMin != 0) {
448 if ((into->explicitMin == 0)
449 || (into->explicitMin > from->explicitMin))
450 into->explicitMin = from->explicitMin;
452 if (from->explicitMax > 0) {
453 if ((into->explicitMax == 0)
454 || (into->explicitMax < from->explicitMax))
455 into->explicitMax = from->explicitMax;
460 * Handle the given include statement (e.g. "include "evdev+aliases(qwerty)").
462 * @param stmt The include statement from the keymap file.
463 * @param keymap Unused for all but the keymap->flags.
464 * @param info Struct to store the key info in.
467 HandleIncludeKeycodes(IncludeStmt *stmt, struct xkb_keymap *keymap,
470 enum merge_mode newMerge;
472 KeyNamesInfo included;
475 memset(&included, 0, sizeof(included));
478 if ((stmt->file == NULL) && (stmt->map == NULL)) {
481 memset(info, 0, sizeof(KeyNamesInfo));
483 else if (stmt->file && strcmp(stmt->file, "computed") == 0) {
484 keymap->flags |= AutoKeyNames;
485 info->explicitMin = 0;
486 info->explicitMax = XKB_KEYCODE_MAX;
487 return (info->errorCount == 0);
488 } /* parse file, store returned info in the xkb struct */
489 else if (ProcessIncludeFile(keymap->ctx, stmt, FILE_TYPE_KEYCODES, &rtrn,
491 InitKeyNamesInfo(&included, rtrn->id);
492 HandleKeycodesFile(rtrn, keymap, MERGE_OVERRIDE, &included);
493 if (stmt->stmt != NULL) {
495 included.name = stmt->stmt;
501 info->errorCount += 10; /* XXX: why 10?? */
504 /* Do we have more than one include statement? */
505 if ((stmt->next != NULL) && (included.errorCount < 1)) {
508 KeyNamesInfo next_incl;
510 for (next = stmt->next; next != NULL; next = next->next) {
511 if ((next->file == NULL) && (next->map == NULL)) {
513 MergeIncludedKeycodes(&included, keymap, info, next->merge);
514 ClearKeyNamesInfo(info);
516 else if (ProcessIncludeFile(keymap->ctx, next, FILE_TYPE_KEYCODES,
518 InitKeyNamesInfo(&next_incl, rtrn->id);
519 HandleKeycodesFile(rtrn, keymap, MERGE_OVERRIDE, &next_incl);
520 MergeIncludedKeycodes(&included, keymap, &next_incl, op);
521 ClearKeyNamesInfo(&next_incl);
525 info->errorCount += 10; /* XXX: Why 10?? */
526 ClearKeyNamesInfo(&included);
534 MergeIncludedKeycodes(info, keymap, &included, newMerge);
535 ClearKeyNamesInfo(&included);
537 return (info->errorCount == 0);
541 * Parse the given statement and store the output in the info struct.
545 HandleKeycodeDef(KeycodeDef *stmt, enum merge_mode merge, KeyNamesInfo *info)
547 if ((info->explicitMin != 0 && stmt->value < info->explicitMin) ||
548 (info->explicitMax != 0 && stmt->value > info->explicitMax)) {
549 ERROR("Illegal keycode %lu for name <%s>\n", stmt->value, stmt->name);
550 ACTION("Must be in the range %d-%d inclusive\n",
552 info->explicitMax ? info->explicitMax : XKB_KEYCODE_MAX);
555 if (stmt->merge != MERGE_DEFAULT) {
556 if (stmt->merge == MERGE_REPLACE)
557 merge = MERGE_OVERRIDE;
561 return AddKeyName(info, stmt->value, stmt->name, merge, info->file_id,
566 HandleAliasCollision(AliasInfo *old, AliasInfo *new)
568 if (strncmp(new->real, old->real, XkbKeyNameLength) == 0) {
569 if ((new->file_id == old->file_id && warningLevel > 0) ||
571 WARN("Alias of %s for %s declared more than once\n",
572 XkbcKeyNameText(new->alias), XkbcKeyNameText(new->real));
573 ACTION("First definition ignored\n");
579 if (new->merge == MERGE_AUGMENT) {
588 if ((old->file_id == new->file_id && warningLevel > 0) ||
590 WARN("Multiple definitions for alias %s\n",
591 XkbcKeyNameText(old->alias));
592 ACTION("Using %s, ignoring %s\n",
593 XkbcKeyNameText(use), XkbcKeyNameText(ignore));
596 if (use != old->real)
597 memcpy(old->real, use, XkbKeyNameLength);
600 old->file_id = new->file_id;
601 old->merge = new->merge;
605 HandleAliasDef(KeyAliasDef *def, enum merge_mode merge, unsigned file_id,
610 list_foreach(alias, &info->aliases, entry) {
611 if (strncmp(alias->alias, def->alias, XkbKeyNameLength) == 0) {
613 InitAliasInfo(&new, merge, file_id, def->alias, def->real);
614 HandleAliasCollision(alias, &new);
619 alias = calloc(1, sizeof(*alias));
621 WSGO("Allocation failure in HandleAliasDef\n");
625 alias->file_id = file_id;
626 alias->merge = merge;
627 memcpy(alias->alias, def->alias, XkbKeyNameLength);
628 memcpy(alias->real, def->real, XkbKeyNameLength);
629 list_append(&alias->entry, &info->aliases);
634 #define MIN_KEYCODE_DEF 0
635 #define MAX_KEYCODE_DEF 1
638 * Handle the minimum/maximum statement of the xkb file.
639 * Sets explicitMin/Max of the info struct.
641 * @return 1 on success, 0 otherwise.
644 HandleKeyNameVar(VarDef *stmt, struct xkb_keymap *keymap, KeyNamesInfo *info)
646 ExprResult tmp, field;
650 if (ExprResolveLhs(keymap, stmt->name, &tmp, &field, &arrayNdx) == 0)
651 return 0; /* internal error, already reported */
653 if (tmp.str != NULL) {
654 ERROR("Unknown element %s encountered\n", tmp.str);
655 ACTION("Default for field %s ignored\n", field.str);
658 if (strcasecmp(field.str, "minimum") == 0)
659 which = MIN_KEYCODE_DEF;
660 else if (strcasecmp(field.str, "maximum") == 0)
661 which = MAX_KEYCODE_DEF;
663 ERROR("Unknown field encountered\n");
664 ACTION("Assigment to field %s ignored\n", field.str);
667 if (arrayNdx != NULL) {
668 ERROR("The %s setting is not an array\n", field.str);
669 ACTION("Illegal array reference ignored\n");
673 if (ExprResolveKeyCode(keymap->ctx, stmt->value, &tmp) == 0) {
674 ACTION("Assignment to field %s ignored\n", field.str);
677 if (tmp.uval > XKB_KEYCODE_MAX) {
679 ("Illegal keycode %d (must be in the range %d-%d inclusive)\n",
680 tmp.uval, 0, XKB_KEYCODE_MAX);
681 ACTION("Value of \"%s\" not changed\n", field.str);
684 if (which == MIN_KEYCODE_DEF) {
685 if ((info->explicitMax > 0) && (info->explicitMax < tmp.uval)) {
687 ("Minimum key code (%d) must be <= maximum key code (%d)\n",
688 tmp.uval, info->explicitMax);
689 ACTION("Minimum key code value not changed\n");
692 if ((info->computedMax > 0) && (info->computedMin < tmp.uval)) {
694 ("Minimum key code (%d) must be <= lowest defined key (%d)\n",
695 tmp.uval, info->computedMin);
696 ACTION("Minimum key code value not changed\n");
699 info->explicitMin = tmp.uval;
701 if (which == MAX_KEYCODE_DEF) {
702 if ((info->explicitMin > 0) && (info->explicitMin > tmp.uval)) {
703 ERROR("Maximum code (%d) must be >= minimum key code (%d)\n",
704 tmp.uval, info->explicitMin);
705 ACTION("Maximum code value not changed\n");
708 if ((info->computedMax > 0) && (info->computedMax > tmp.uval)) {
710 ("Maximum code (%d) must be >= highest defined key (%d)\n",
711 tmp.uval, info->computedMax);
712 ACTION("Maximum code value not changed\n");
715 info->explicitMax = tmp.uval;
727 HandleIndicatorNameDef(IndicatorNameDef *def, struct xkb_keymap *keymap,
728 enum merge_mode merge, KeyNamesInfo *info)
730 IndicatorNameInfo ii;
733 if ((def->ndx < 1) || (def->ndx > XkbNumIndicators)) {
735 ERROR("Name specified for illegal indicator index %d\n", def->ndx);
739 InitIndicatorNameInfo(&ii, info);
741 if (!ExprResolveString(keymap->ctx, def->name, &tmp)) {
743 snprintf(buf, sizeof(buf), "%d", def->ndx);
745 return ReportBadType("indicator", "name", buf, "string");
747 ii.name = xkb_atom_intern(keymap->ctx, tmp.str);
749 ii.virtual = def->virtual;
750 if (!AddIndicatorName(info, keymap, merge, &ii))
756 * Handle the xkb_keycodes section of a xkb file.
757 * All information about parsed keys is stored in the info struct.
759 * Such a section may have include statements, in which case this function is
760 * semi-recursive (it calls HandleIncludeKeycodes, which may call
761 * HandleKeycodesFile again).
763 * @param file The input file (parsed xkb_keycodes section)
764 * @param xkb Necessary to pass down, may have flags changed.
765 * @param merge Merge strategy (MERGE_OVERRIDE, etc.)
766 * @param info Struct to contain the fully parsed key information.
769 HandleKeycodesFile(XkbFile *file, struct xkb_keymap *keymap,
770 enum merge_mode merge, KeyNamesInfo *info)
775 info->name = uDupString(file->name);
779 switch (stmt->stmtType) {
780 case StmtInclude: /* e.g. include "evdev+aliases(qwerty)" */
781 if (!HandleIncludeKeycodes((IncludeStmt *) stmt, keymap, info))
784 case StmtKeycodeDef: /* e.g. <ESC> = 9; */
785 if (!HandleKeycodeDef((KeycodeDef *) stmt, merge, info))
788 case StmtKeyAliasDef: /* e.g. alias <MENU> = <COMP>; */
789 if (!HandleAliasDef((KeyAliasDef *) stmt, merge, info->file_id,
793 case StmtVarDef: /* e.g. minimum, maximum */
794 if (!HandleKeyNameVar((VarDef *) stmt, keymap, info))
797 case StmtIndicatorNameDef: /* e.g. indicator 1 = "Caps Lock"; */
798 if (!HandleIndicatorNameDef((IndicatorNameDef *) stmt, keymap,
804 ERROR("Keycode files may define key and indicator names only\n");
805 ACTION("Ignoring definition of %s\n",
807 StmtInterpDef) ? "a symbol interpretation" :
808 "virtual modifiers"));
812 WSGO("Unexpected statement type %d in HandleKeycodesFile\n",
817 if (info->errorCount > 10) {
819 ERROR("Too many errors\n");
821 ACTION("Abandoning keycodes file \"%s\"\n", file->topName);
828 ApplyAliases(struct xkb_keymap *keymap, KeyNamesInfo *info)
832 struct xkb_key_alias *old, *a;
833 AliasInfo *alias, *next;
836 nOld = darray_size(keymap->key_aliases);
837 old = &darray_item(keymap->key_aliases, 0);
839 list_foreach(alias, &info->aliases, entry) {
842 lname = KeyNameToLong(alias->real);
843 key = FindNamedKey(keymap, lname, false, CreateKeyNames(keymap), 0);
845 if (warningLevel > 4) {
846 WARN("Attempt to alias %s to non-existent key %s\n",
847 XkbcKeyNameText(alias->alias),
848 XkbcKeyNameText(alias->real));
851 alias->alias[0] = '\0';
855 lname = KeyNameToLong(alias->alias);
856 key = FindNamedKey(keymap, lname, false, false, 0);
858 if (warningLevel > 4) {
859 WARN("Attempt to create alias with the name of a real key\n");
860 ACTION("Alias \"%s = %s\" ignored\n",
861 XkbcKeyNameText(alias->alias),
862 XkbcKeyNameText(alias->real));
864 alias->alias[0] = '\0';
873 for (i = 0, a = old; i < nOld; i++, a++) {
876 if (strncmp(a->alias, alias->alias, XkbKeyNameLength) != 0)
879 InitAliasInfo(&old_alias, MERGE_AUGMENT, 0, a->alias, a->real);
880 HandleAliasCollision(&old_alias, alias);
881 memcpy(old_alias.real, a->real, XkbKeyNameLength);
882 alias->alias[0] = '\0';
891 darray_resize0(keymap->key_aliases, nOld + nNew);
893 a = &darray_item(keymap->key_aliases, nOld);
894 list_foreach(alias, &info->aliases, entry) {
895 if (alias->alias[0] != '\0') {
896 strncpy(a->alias, alias->alias, XkbKeyNameLength);
897 strncpy(a->real, alias->real, XkbKeyNameLength);
903 list_foreach_safe(alias, next, &info->aliases, entry)
905 list_init(&info->aliases);
910 * Compile the xkb_keycodes section, parse it's output, return the results.
912 * @param file The parsed XKB file (may have include statements requiring
914 * @param result The effective keycodes, as gathered from the file.
915 * @param merge Merge strategy.
917 * @return true on success, false otherwise.
920 CompileKeycodes(XkbFile *file, struct xkb_keymap *keymap,
921 enum merge_mode merge)
924 KeyNamesInfo info; /* contains all the info after parsing */
925 IndicatorNameInfo *ii;
927 InitKeyNamesInfo(&info, file->id);
929 HandleKeycodesFile(file, keymap, merge, &info);
931 /* all the keys are now stored in info */
933 if (info.errorCount != 0)
936 if (info.explicitMin > 0) /* if "minimum" statement was present */
937 keymap->min_key_code = info.explicitMin;
939 keymap->min_key_code = info.computedMin;
941 if (info.explicitMax > 0) /* if "maximum" statement was present */
942 keymap->max_key_code = info.explicitMax;
944 keymap->max_key_code = info.computedMax;
946 darray_resize0(keymap->keys, keymap->max_key_code + 1);
947 for (kc = info.computedMin; kc <= info.computedMax; kc++)
948 LongToKeyName(darray_item(info.names, kc),
949 XkbKey(keymap, kc)->name);
952 keymap->keycodes_section_name = strdup(info.name);
954 list_foreach(ii, &info.leds, entry) {
955 free(keymap->indicator_names[ii->ndx - 1]);
956 keymap->indicator_names[ii->ndx - 1] =
957 xkb_atom_strdup(keymap->ctx, ii->name);
960 ApplyAliases(keymap, &info);
962 ClearKeyNamesInfo(&info);
966 ClearKeyNamesInfo(&info);