libxkbcomp: Eradicate XkbFileInfo usage 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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345
diff --git a/src/xkbcomp/compat.c b/src/xkbcomp/compat.c
index 03c29ef..dc06ebe 100644
--- a/src/xkbcomp/compat.c
+++ b/src/xkbcomp/compat.c
@@ -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;
}
diff --git a/src/xkbcomp/geometry.c b/src/xkbcomp/geometry.c
index 64d73fe..d203ec9 100644
--- a/src/xkbcomp/geometry.c
+++ b/src/xkbcomp/geometry.c
@@ -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);
diff --git a/src/xkbcomp/indicators.c b/src/xkbcomp/indicators.c
index d4a362f..57811d3 100644
--- a/src/xkbcomp/indicators.c
+++ b/src/xkbcomp/indicators.c
@@ -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)
diff --git a/src/xkbcomp/indicators.h b/src/xkbcomp/indicators.h
index 35ae38a..f70ea90 100644
--- a/src/xkbcomp/indicators.h
+++ b/src/xkbcomp/indicators.h
@@ -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 */
diff --git a/src/xkbcomp/keycodes.c b/src/xkbcomp/keycodes.c
index 1bff7fa..d1dbd52 100644
--- a/src/xkbcomp/keycodes.c
+++ b/src/xkbcomp/keycodes.c
@@ -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);
diff --git a/src/xkbcomp/keymap.c b/src/xkbcomp/keymap.c
index a419d8c..1c77ae7 100644
--- a/src/xkbcomp/keymap.c
+++ b/src/xkbcomp/keymap.c
@@ -42,12 +42,12 @@
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;
}
diff --git a/src/xkbcomp/keytypes.c b/src/xkbcomp/keytypes.c
index da55d75..65ee19e 100644
--- a/src/xkbcomp/keytypes.c
+++ b/src/xkbcomp/keytypes.c
@@ -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);
diff --git a/src/xkbcomp/symbols.c b/src/xkbcomp/symbols.c
index 47ad67b..5d28282 100644
--- a/src/xkbcomp/symbols.c
+++ b/src/xkbcomp/symbols.c
@@ -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;
}
diff --git a/src/xkbcomp/xkbcomp.h b/src/xkbcomp/xkbcomp.h
index 5bee485..e544808 100644
--- a/src/xkbcomp/xkbcomp.h
+++ b/src/xkbcomp/xkbcomp.h
@@ -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)