- /* Check for duplicate entries in the input file */
- for (file = (XkbFile *) file->defs; file;
- file = (XkbFile *) file->common.next) {
- if (have & file->file_type) {
- log_err(ctx,
- "More than one %s section in a keymap file; "
- "All sections after the first ignored\n",
- FileTypeText(file->file_type));
- continue;
- }
-
- switch (file->file_type) {
- case FILE_TYPE_KEYCODES:
- keycodes = file;
- break;
-
- case FILE_TYPE_TYPES:
- types = file;
- break;
-
- case FILE_TYPE_SYMBOLS:
- symbols = file;
- break;
-
- case FILE_TYPE_COMPAT:
- compat = file;
- break;
-
- default:
- log_err(ctx, "Cannot define %s in a keymap file\n",
- FileTypeText(file->file_type));
- continue;
- }
-
- if (!file->topName) {
- free(file->topName);
- file->topName = strdup(main_name);
- }
-
- have |= file->file_type;
- }
-
- if (REQUIRED_FILE_TYPES & (~have)) {
- enum xkb_file_type bit;
- enum xkb_file_type missing;
-
- missing = REQUIRED_FILE_TYPES & (~have);
-
- for (bit = 1; missing != 0; bit <<= 1) {
- if (missing & bit) {
- log_err(ctx, "Required section %s missing from keymap\n",
- FileTypeText(bit));
- missing &= ~bit;
- }
- }
-
- goto err;
- }
-
- ok = CompileKeycodes(keycodes, keymap, MERGE_OVERRIDE);
- if (!ok) {
- log_err(ctx, "Failed to compile keycodes\n");
- goto err;
- }
- ok = CompileKeyTypes(types, keymap, MERGE_OVERRIDE);
- if (!ok) {
- log_err(ctx, "Failed to compile key types\n");
- goto err;
- }
- ok = CompileCompatMap(compat, keymap, MERGE_OVERRIDE);
- if (!ok) {
- log_err(ctx, "Failed to compile compat map\n");
- goto err;