More useful errors for invalid keysyms
authorDaniel Stone <daniel@fooishbar.org>
Fri, 16 Mar 2012 14:22:04 +0000 (14:22 +0000)
committerDaniel Stone <daniel@fooishbar.org>
Fri, 16 Mar 2012 14:22:04 +0000 (14:22 +0000)
Instead of generating a fairly droll internal error, generate a warning
also telling us exactly where the bad definition was.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
src/xkbcomp/compat.c
src/xkbcomp/symbols.c

index 044c715..f9e0199 100644 (file)
@@ -648,8 +648,8 @@ HandleInterpDef(InterpDef * def, struct xkb_desc * xkb, unsigned merge,
     si.defs.merge = merge;
     if (!LookupKeysym(def->sym, &si.interp.sym))
     {
-        WARN("Could not resolve keysym %s\n", def->sym);
-        info->errorCount++;
+        ERROR("Could not resolve keysym %s\n", def->sym);
+        ACTION("Symbol interpretation ignored\n");
         return False;
     }
     si.interp.match = pred & XkbSI_OpMask;
index 1065e16..7391251 100644 (file)
@@ -898,31 +898,32 @@ AddSymbolsToKey(KeyInfo * key,
     }
     if (value->op != ExprKeysymList)
     {
-        ERROR("Expected a list of symbols, found %s\n",
-               exprOpText(value->op));
+        ERROR("Expected a list of symbols, found %s\n", exprOpText(value->op));
         ACTION("Ignoring symbols for group %d of %s\n", ndx,
                 longText(key->name));
         return False;
     }
     if (key->syms[ndx] != NULL)
     {
-        WSGO("Symbols for key %s, group %d already defined\n",
-              longText(key->name), ndx);
+        ERROR("Symbols for key %s, group %d already defined\n",
+               longText(key->name), ndx);
+        ACTION("Ignoring duplicate definition\n");
         return False;
     }
     nSyms = value->value.list.nSyms;
     if (((key->numLevels[ndx] < nSyms) || (key->syms[ndx] == NULL)) &&
         (!ResizeKeyGroup(key, ndx, nSyms, False)))
     {
-        WSGO("Could not resize group %d of key %s\n", ndx,
-              longText(key->name));
+        WSGO("Could not resize group %d of key %s to contain %d levels\n", ndx,
+             longText(key->name), nSyms);
         ACTION("Symbols lost\n");
         return False;
     }
     key->symsDefined |= (1 << ndx);
     for (i = 0; i < nSyms; i++) {
         if (!LookupKeysym(value->value.list.syms[i], &key->syms[ndx][i])) {
-            WSGO("Could not resolve keysym %s\n", value->value.list.syms[i]);
+            WARN("Could not resolve keysym %s for key %s, group %d, level %d\n",
+                  value->value.list.syms[i], longText(key->name), ndx, nSyms);
             key->syms[ndx][i] = NoSymbol;
         }
     }