Commit 5e59ef3f4707c673d325006b662ffdff5d65c7d1

Ran Benita 2012-05-09T17:54:37

Remove support for xkb_layout and xkb_semantics file types These are two aggregate file types which are not used anywhere. We maintain useful-enough backward compatibility in the parser, by treating them as xkb_keymap. The keymap type allows for all types of components, so they will still compile fine if they ever come up. Signed-off-by: Ran Benita <ran234@gmail.com>

diff --git a/src/text.c b/src/text.c
index 7603a6a..2ca411b 100644
--- a/src/text.c
+++ b/src/text.c
@@ -189,10 +189,6 @@ const char *
 XkbcConfigText(unsigned config)
 {
     switch (config) {
-    case XkmSemanticsFile:
-        return "Semantics";
-    case XkmLayoutFile:
-        return "Layout";
     case XkmKeymapFile:
         return "Keymap";
     case XkmTypesIndex:
diff --git a/src/xkb-priv.h b/src/xkb-priv.h
index 35f7f8a..7527bf3 100644
--- a/src/xkb-priv.h
+++ b/src/xkb-priv.h
@@ -89,8 +89,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #include "utils.h"
 
 /* From XKM.h */
-#define	XkmSemanticsFile	20
-#define	XkmLayoutFile		21
 #define	XkmKeymapFile		22
 #define	XkmRulesFile		24
 
@@ -106,14 +104,8 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #define	XkmKeyNamesMask		(1<<4)
 #define XkmGeometryMask         (1<<5)
 
-#define	XkmSemanticsRequired	(XkmCompatMapMask)
-#define	XkmSemanticsOptional	(XkmTypesMask|XkmGeometryMask)
-#define	XkmSemanticsLegal	(XkmSemanticsRequired|XkmSemanticsOptional)
-#define	XkmLayoutRequired	(XkmKeyNamesMask|XkmSymbolsMask|XkmTypesMask)
-#define	XkmLayoutOptional	(XkmGeometryMask)
-#define	XkmLayoutLegal		(XkmLayoutRequired|XkmLayoutOptional)
-#define	XkmKeymapRequired	(XkmSemanticsRequired|XkmLayoutRequired)
-#define	XkmKeymapOptional	((XkmSemanticsOptional|XkmLayoutOptional)&(~XkmKeymapRequired))
+#define	XkmKeymapRequired	(XkmCompatMapMask|XkmKeyNamesMask|XkmSymbolsMask|XkmTypesMask)
+#define	XkmKeymapOptional	((XkmTypesMask|XkmGeometryMask)&(~XkmKeymapRequired))
 #define	XkmKeymapLegal		(XkmKeymapRequired|XkmKeymapOptional)
 
 struct xkb_any_action {
diff --git a/src/xkbcomp/keymap.c b/src/xkbcomp/keymap.c
index 58141e0..9967f0e 100644
--- a/src/xkbcomp/keymap.c
+++ b/src/xkbcomp/keymap.c
@@ -57,14 +57,6 @@ CompileKeymap(struct xkb_ctx *ctx, XkbFile *file)
     mainName = file->name ? file->name : "(unnamed)";
     switch (mainType)
     {
-    case XkmSemanticsFile:
-        required = XkmSemanticsRequired;
-        legal = XkmSemanticsLegal;
-        break;
-    case XkmLayoutFile:        /* standard type  if setxkbmap -print */
-        required = XkmLayoutRequired;
-        legal = XkmKeymapLegal;
-        break;
     case XkmKeymapFile:
         required = XkmKeyNamesIndex | XkmTypesIndex | XkmSymbolsIndex |
                    XkmCompatMapIndex;
@@ -114,8 +106,6 @@ CompileKeymap(struct xkb_ctx *ctx, XkbFile *file)
             WSGO("Unknown file type %d\n", file->type);
             ACTION("Ignored\n");
             continue;
-        case XkmSemanticsFile:
-        case XkmLayoutFile:
         case XkmKeymapFile:
             WSGO("Illegal %s configuration in a %s file\n",
                   XkbcConfigText(file->type), XkbcConfigText(mainType));
diff --git a/src/xkbcomp/parser.y b/src/xkbcomp/parser.y
index 2810a13..9eb51fc 100644
--- a/src/xkbcomp/parser.y
+++ b/src/xkbcomp/parser.y
@@ -182,8 +182,8 @@ XkbCompositeMap	:	OptFlags XkbCompositeType OptMapName OBRACE
 		;
 
 XkbCompositeType:	XKB_KEYMAP	{ $$= XkmKeymapFile; }
-		|	XKB_SEMANTICS	{ $$= XkmSemanticsFile; }
-		|	XKB_LAYOUT	{ $$= XkmLayoutFile; }
+		|	XKB_SEMANTICS	{ $$= XkmKeymapFile; }
+		|	XKB_LAYOUT	{ $$= XkmKeymapFile; }
 		;
 
 XkbMapConfigList :	XkbMapConfigList XkbMapConfig
diff --git a/src/xkbcomp/parseutils.c b/src/xkbcomp/parseutils.c
index 8be29cb..82e74ca 100644
--- a/src/xkbcomp/parseutils.c
+++ b/src/xkbcomp/parseutils.c
@@ -850,8 +850,6 @@ FreeXKBFile(XkbFile *file)
         switch (file->type)
         {
         case XkmKeymapFile:
-        case XkmSemanticsFile:
-        case XkmLayoutFile:
             FreeXKBFile((XkbFile *)file->defs);
             break;
         case XkmTypesIndex:
diff --git a/src/xkbcomp/path.c b/src/xkbcomp/path.c
index e10d3cf..f45ab6b 100644
--- a/src/xkbcomp/path.c
+++ b/src/xkbcomp/path.c
@@ -146,10 +146,6 @@ XkbDirectoryForInclude(unsigned type)
 {
     switch (type)
     {
-    case XkmSemanticsFile:
-        return "semantics";
-    case XkmLayoutFile:
-        return "layout";
     case XkmKeymapFile:
         return "keymap";
     case XkmKeyNamesIndex:
@@ -176,7 +172,7 @@ XkbDirectoryForInclude(unsigned type)
  *
  * @param ctx the XKB ctx containing the include paths
  * @param type one of XkbTypesIndex, XkbCompatMapIndex, ..., or
- *             XkbSemanticsFile, XkmKeymapFile, ...
+ *             XkmKeymapFile
  * @param pathReturn is set to the full path of the file if found.
  *
  * @return an FD to the file or NULL. If NULL is returned, the value of
diff --git a/src/xkbcomp/xkbcomp.c b/src/xkbcomp/xkbcomp.c
index bf08b01..a18451f 100644
--- a/src/xkbcomp/xkbcomp.c
+++ b/src/xkbcomp/xkbcomp.c
@@ -199,15 +199,7 @@ compile_keymap(struct xkb_ctx *ctx, XkbFile *file)
 
     /* Find map to use */
     mapToUse = XkbChooseMap(file, NULL);
-    if (!mapToUse)
-        goto err;
-
-    switch (mapToUse->type) {
-    case XkmSemanticsFile:
-    case XkmLayoutFile:
-    case XkmKeymapFile:
-        break;
-    default:
+    if (!mapToUse || mapToUse->type != XkmKeymapFile) {
         ERROR("file type %d not handled\n", mapToUse->type);
         goto err;
     }