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.
master
Dan Nicholson 2009-03-27 19:54:50 -07:00
parent f3677538f4
commit dd25bbc9ac
9 changed files with 44 additions and 79 deletions

View 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;
}

View 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);

View 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)

View 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 */

View 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);

View File

@ -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;
}

View 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);

View 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;
}

View 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)