libxkbcomp: Eradicate XkbFileInfo usage
authorDan Nicholson <dbn.lists@gmail.com>
Sat, 28 Mar 2009 02:54:50 +0000 (19:54 -0700)
committerDan Nicholson <dbn.lists@gmail.com>
Sat, 28 Mar 2009 19:01:28 +0000 (12:01 -0700)
The only real usage was in the frontend to generate a .xkm file. The
rest of the code just operated on the attached XkbDescPtr. Note that
here we've replaced the usage of the defined field in CompileKeymap with
the equivalent field in a XkbcDescPtr.

src/xkbcomp/compat.c
src/xkbcomp/geometry.c
src/xkbcomp/indicators.c
src/xkbcomp/indicators.h
src/xkbcomp/keycodes.c
src/xkbcomp/keymap.c
src/xkbcomp/keytypes.c
src/xkbcomp/symbols.c
src/xkbcomp/xkbcomp.h

index 03c29ef..dc06ebe 100644 (file)
@@ -805,15 +805,13 @@ CopyInterps(CompatInfo * info,
 }
 
 Bool
-CompileCompatMap(XkbFile * file,
-                 XkbFileInfo * result, unsigned merge, LEDInfo ** unboundLEDs)
+CompileCompatMap(XkbFile *file, XkbcDescPtr xkb, unsigned merge,
+                 LEDInfoPtr *unboundLEDs)
 {
     int i;
     CompatInfo info;
-    XkbDescPtr xkb;
     GroupCompatInfo *gcm;
 
-    xkb = result->xkb;
     InitCompatInfo(&info, xkb);
     info.dflt.defs.merge = merge;
     info.ledDflt.defs.merge = merge;
@@ -867,7 +865,7 @@ CompileCompatMap(XkbFile * file,
         }
         if (info.leds != NULL)
         {
-            if (!CopyIndicatorMapDefs(result, info.leds, unboundLEDs))
+            if (!CopyIndicatorMapDefs(xkb, info.leds, unboundLEDs))
                 info.errorCount++;
             info.leds = NULL;
         }
index 64d73fe..d203ec9 100644 (file)
@@ -3658,12 +3658,10 @@ CopySectionDef(XkbGeometryPtr geom, SectionInfo * si, GeometryInfo * info)
 /***====================================================================***/
 
 Bool
-CompileGeometry(XkbFile * file, XkbFileInfo * result, unsigned merge)
+CompileGeometry(XkbFile *file, XkbcDescPtr xkb, unsigned merge)
 {
     GeometryInfo info;
-    XkbDescPtr xkb;
 
-    xkb = result->xkb;
     InitGeometryInfo(&info, file->id, merge);
     info.dpy = xkb->dpy;
     HandleGeometryFile(file, xkb, merge, &info);
index d4a362f..57811d3 100644 (file)
@@ -371,14 +371,11 @@ HandleIndicatorMapDef(IndicatorMapDef * def,
 }
 
 Bool
-CopyIndicatorMapDefs(XkbFileInfo * result, LEDInfo * leds,
-                     LEDInfo ** unboundRtrn)
+CopyIndicatorMapDefs(XkbcDescPtr xkb, LEDInfo *leds, LEDInfo **unboundRtrn)
 {
     LEDInfo *led, *next;
     LEDInfo *unbound, *last;
-    XkbDescPtr xkb;
 
-    xkb = result->xkb;
     if (XkbAllocNames(xkb, XkbIndicatorNamesMask, 0, 0) != Success)
     {
         WSGO("Couldn't allocate names\n");
@@ -441,14 +438,12 @@ CopyIndicatorMapDefs(XkbFileInfo * result, LEDInfo * leds,
 }
 
 Bool
-BindIndicators(XkbFileInfo * result,
-               Bool force, LEDInfo * unbound, LEDInfo ** unboundRtrn)
+BindIndicators(XkbcDescPtr xkb, Bool force, LEDInfo *unbound,
+               LEDInfo **unboundRtrn)
 {
-    XkbDescPtr xkb;
     register int i;
     register LEDInfo *led, *next, *last;
 
-    xkb = result->xkb;
     if (xkb->names != NULL)
     {
         for (led = unbound; led != NULL; led = (LEDInfo *) led->defs.next)
index 35ae38a..f70ea90 100644 (file)
@@ -74,15 +74,11 @@ extern LEDInfo *HandleIndicatorMapDef(IndicatorMapDef * /* stmt */ ,
                                       unsigned  /* mergeMode */
     );
 
-extern Bool CopyIndicatorMapDefs(XkbFileInfo * /* result */ ,
-                                 LEDInfo * /* leds */ ,
-                                 LEDInfo **     /* unboundRtrn */
-    );
+extern Bool
+CopyIndicatorMapDefs(XkbcDescPtr xkb, LEDInfo *leds, LEDInfo **unboundRtrn);
 
-extern Bool BindIndicators(XkbFileInfo * /* result */ ,
-                           Bool /* force */ ,
-                           LEDInfo * /* unbound */ ,
-                           LEDInfo **   /* unboundRtrn */
-    );
+extern Bool
+BindIndicators(XkbcDescPtr xkb, Bool force, LEDInfo *unbound,
+               LEDInfo **unboundRtrn);
 
 #endif /* INDICATORS_H */
index 1bff7fa..d1dbd52 100644 (file)
@@ -822,12 +822,10 @@ HandleKeycodesFile(XkbFile * file,
  * @return True on success, False otherwise.
  */
 Bool
-CompileKeycodes(XkbFile * file, XkbFileInfo * result, unsigned merge)
+CompileKeycodes(XkbFile *file, XkbcDescPtr xkb, unsigned merge)
 {
     KeyNamesInfo info; /* contains all the info after parsing */
-    XkbDescPtr xkb;
 
-    xkb = result->xkb;
     InitKeyNamesInfo(&info);
     HandleKeycodesFile(file, xkb, merge, &info);
 
index a419d8c..1c77ae7 100644 (file)
 static XkbFile *sections[MAX_SECTIONS];
 
 /**
- * Compile the given file and store the output in result.
+ * Compile the given file and store the output in xkb.
  * @param file A list of XkbFiles, each denoting one type (e.g.
  * XkmKeyNamesIdx, etc.)
  */
 Bool
-CompileKeymap(XkbFile * file, XkbFileInfo * result, unsigned merge)
+CompileKeymap(XkbFile *file, XkbcDescPtr xkb, unsigned merge)
 {
     unsigned have;
     Bool ok;
@@ -145,20 +145,20 @@ CompileKeymap(XkbFile * file, XkbFileInfo * result, unsigned merge)
     if (ok)
     {
         if (ok && (sections[KEYCODES] != NULL))
-            ok = CompileKeycodes(sections[KEYCODES], result, MergeOverride);
+            ok = CompileKeycodes(sections[KEYCODES], xkb, MergeOverride);
         if (ok && (sections[GEOMETRY] != NULL))
-            ok = CompileGeometry(sections[GEOMETRY], result, MergeOverride);
+            ok = CompileGeometry(sections[GEOMETRY], xkb, MergeOverride);
         if (ok && (sections[TYPES] != NULL))
-            ok = CompileKeyTypes(sections[TYPES], result, MergeOverride);
+            ok = CompileKeyTypes(sections[TYPES], xkb, MergeOverride);
         if (ok && (sections[COMPAT] != NULL))
-            ok = CompileCompatMap(sections[COMPAT], result, MergeOverride,
+            ok = CompileCompatMap(sections[COMPAT], xkb, MergeOverride,
                                   &unbound);
         if (ok && (sections[SYMBOLS] != NULL))
-            ok = CompileSymbols(sections[SYMBOLS], result, MergeOverride);
+            ok = CompileSymbols(sections[SYMBOLS], xkb, MergeOverride);
     }
     if (!ok)
         return False;
-    result->defined = have;
+    xkb->defined = have;
     if (required & (~have))
     {
         register int i, bit;
@@ -178,6 +178,6 @@ CompileKeymap(XkbFile * file, XkbFileInfo * result, unsigned merge)
                 XkbConfigText(mainType, XkbMessage));
         ok = False;
     }
-    ok = BindIndicators(result, True, unbound, NULL);
+    ok = BindIndicators(xkb, True, unbound, NULL);
     return ok;
 }
index da55d75..65ee19e 100644 (file)
@@ -1205,12 +1205,10 @@ CopyDefToKeyType(XkbDescPtr xkb, XkbKeyTypePtr type, KeyTypeInfo * def)
 }
 
 Bool
-CompileKeyTypes(XkbFile * file, XkbFileInfo * result, unsigned merge)
+CompileKeyTypes(XkbFile *file, XkbcDescPtr xkb, unsigned merge)
 {
     KeyTypesInfo info;
-    XkbDescPtr xkb;
 
-    xkb = result->xkb;
     InitKeyTypesInfo(&info, xkb, NULL);
     info.fileID = file->id;
     HandleKeyTypesFile(file, xkb, merge, &info);
index 47ad67b..5d28282 100644 (file)
@@ -1944,12 +1944,12 @@ PrepareKeyDef(KeyInfo * key)
 }
 
 /**
- * Copy the KeyInfo into result.
+ * Copy the KeyInfo into the keyboard description.
  *
  * This function recurses.
  */
 static Bool
-CopySymbolsDef(XkbFileInfo * result, KeyInfo * key, int start_from)
+CopySymbolsDef(XkbcDescPtr xkb, KeyInfo *key, int start_from)
 {
     register int i;
     unsigned okc, kc, width, tmp, nGroups;
@@ -1957,10 +1957,8 @@ CopySymbolsDef(XkbFileInfo * result, KeyInfo * key, int start_from)
     Bool haveActions, autoType, useAlias;
     KeySym *outSyms;
     XkbAction *outActs;
-    XkbDescPtr xkb;
     unsigned types[XkbNumKbdGroups];
 
-    xkb = result->xkb;
     useAlias = (start_from == 0);
 
     /* get the keycode for the key. */
@@ -2151,17 +2149,15 @@ CopySymbolsDef(XkbFileInfo * result, KeyInfo * key, int start_from)
     }
 
     /* do the same thing for the next key */
-    CopySymbolsDef(result, key, kc + 1);
+    CopySymbolsDef(xkb, key, kc + 1);
     return True;
 }
 
 static Bool
-CopyModMapDef(XkbFileInfo * result, ModMapEntry * entry)
+CopyModMapDef(XkbcDescPtr xkb, ModMapEntry *entry)
 {
     unsigned kc;
-    XkbDescPtr xkb;
 
-    xkb = result->xkb;
     if ((!entry->haveSymbol)
         &&
         (!FindNamedKey
@@ -2198,17 +2194,15 @@ CopyModMapDef(XkbFileInfo * result, ModMapEntry * entry)
  * Handle the xkb_symbols section of an xkb file.
  *
  * @param file The parsed xkb_symbols section of the xkb file.
- * @param result Handle to the data to store the result in.
+ * @param xkb Handle to the keyboard description to store the symbols in.
  * @param merge Merge strategy (e.g. MergeOverride).
  */
 Bool
-CompileSymbols(XkbFile * file, XkbFileInfo * result, unsigned merge)
+CompileSymbols(XkbFile *file, XkbcDescPtr xkb, unsigned merge)
 {
     register int i;
     SymbolsInfo info;
-    XkbDescPtr xkb;
 
-    xkb = result->xkb;
     InitSymbolsInfo(&info, xkb);
     info.dflt.defs.fileID = file->id;
     info.dflt.defs.merge = merge;
@@ -2265,7 +2259,7 @@ CompileSymbols(XkbFile * file, XkbFileInfo * result, unsigned merge)
         /* copy! */
         for (key = info.keys, i = 0; i < info.nKeys; i++, key++)
         {
-            if (!CopySymbolsDef(result, key, 0))
+            if (!CopySymbolsDef(xkb, key, 0))
                 info.errorCount++;
         }
         if (warningLevel > 3)
@@ -2290,7 +2284,7 @@ CompileSymbols(XkbFile * file, XkbFileInfo * result, unsigned merge)
             ModMapEntry *mm, *next;
             for (mm = info.modMap; mm != NULL; mm = next)
             {
-                if (!CopyModMapDef(result, mm))
+                if (!CopyModMapDef(xkb, mm))
                     info.errorCount++;
                 next = (ModMapEntry *) mm->defs.next;
             }
index 5bee485..e544808 100644 (file)
@@ -336,38 +336,26 @@ typedef struct _XkbFile
     Bool compiled;
 } XkbFile;
 
-extern Bool CompileKeymap(XkbFile * /* file */ ,
-                          XkbFileInfo * /* result */ ,
-                          unsigned      /* merge */
-    );
+extern Bool
+CompileKeymap(XkbFile *file, XkbcDescPtr xkb, unsigned merge);
 
-extern Bool CompileKeycodes(XkbFile * /* file */ ,
-                            XkbFileInfo * /* result */ ,
-                            unsigned    /* merge */
-    );
+extern Bool
+CompileKeycodes(XkbFile *file, XkbcDescPtr xkb, unsigned merge);
 
-extern Bool CompileGeometry(XkbFile * /* file */ ,
-                            XkbFileInfo * /* result */ ,
-                            unsigned    /* merge */
-    );
+extern Bool
+CompileGeometry(XkbFile *file, XkbcDescPtr xkb, unsigned merge);
 
-extern Bool CompileKeyTypes(XkbFile * /* file */ ,
-                            XkbFileInfo * /* result */ ,
-                            unsigned    /* merge */
-    );
+extern Bool
+CompileKeyTypes(XkbFile *file, XkbcDescPtr xkb, unsigned merge);
 
 typedef struct _LEDInfo *LEDInfoPtr;
 
-extern Bool CompileCompatMap(XkbFile * /* file */ ,
-                             XkbFileInfo * /* result */ ,
-                             unsigned /* merge */ ,
-                             LEDInfoPtr *       /* unboundLEDs */
-    );
+extern Bool
+CompileCompatMap(XkbFile *file, XkbcDescPtr xkb, unsigned merge,
+                 LEDInfoPtr *unboundLEDs);
 
-extern Bool CompileSymbols(XkbFile * /* file */ ,
-                           XkbFileInfo * /* result */ ,
-                           unsigned     /* merge */
-    );
+extern Bool
+CompileSymbols(XkbFile *file, XkbcDescPtr xkb, unsigned merge);
 
 #define        WantLongListing (1<<0)
 #define        WantPartialMaps (1<<1)