diff options
author | Daniel Stone <daniel@fooishbar.org> | 2008-02-16 20:01:18 +0200 |
---|---|---|
committer | Daniel Stone <daniel@fooishbar.org> | 2008-02-17 22:52:08 +0200 |
commit | fbd776894658e7afb2c55dc8582b2a3efab78a3c (patch) | |
tree | 0879ce2f27f34ff86aea76647ea1556724658da7 /xkb/xkbfmisc.c | |
parent | e5f002eddef1abe324033a3155f01d048536a48d (diff) |
XKB: Ditch XkbFileInfo
Sorry about the megacommit, but this touches on a lot of stuff.
Get rid of XkbFileInfo, which was pretty seriously redundant, and move the
only useful thing it had (defined) into XkbDescRec. defined will be removed
pretty soon anyway. Is the compat map pointer non-NULL? Then you have a
compat map, congratulations! Anyhow, I digress.
All functions that took an XkbFileInfoPtr now take an XkbDescPtr, _except_
XkmReadFile, which returns an XkbDescPtr *, because people want to deal in
XkbDescPtrs, not XkbDescRecs.
Diffstat (limited to 'xkb/xkbfmisc.c')
-rw-r--r-- | xkb/xkbfmisc.c | 98 |
1 files changed, 7 insertions, 91 deletions
diff --git a/xkb/xkbfmisc.c b/xkb/xkbfmisc.c index 4182c3a34..866b4b154 100644 --- a/xkb/xkbfmisc.c +++ b/xkb/xkbfmisc.c @@ -146,7 +146,7 @@ XkbWriteSectionFromName(FILE *file,char *sectionName,char *name) /* ARGSUSED */ static void _AddIncl( FILE * file, - XkbFileInfo * result, + XkbDescPtr xkb, Bool topLevel, Bool showImplicit, int index, @@ -169,9 +169,6 @@ unsigned complete; XkbNamesPtr old_names; int multi_section; unsigned wantNames,wantConfig,wantDflts; -XkbFileInfo finfo; - - bzero(&finfo,sizeof(XkbFileInfo)); complete= 0; if ((name=names->keymap)==NULL) name= "default"; @@ -187,14 +184,8 @@ XkbFileInfo finfo; if (want==0) return False; - if (xkb!=NULL) { + if (xkb!=NULL) old_names= xkb->names; - finfo.type= 0; - finfo.defined= 0; - finfo.xkb= xkb; - if (!XkbDetermineFileType(&finfo,XkbXKBFile,NULL)) - return False; - } else old_names= NULL; wantConfig= want&(~complete); @@ -304,7 +295,7 @@ XkbFileInfo finfo; wantNames= complete&(~(wantConfig|wantDflts)); name= names->keycodes; if (wantConfig&XkmKeyNamesMask) - XkbWriteXKBKeycodes(file,&finfo,False,False,_AddIncl,name); + XkbWriteXKBKeycodes(file,xkb,False,False,_AddIncl,name); else if (wantDflts&XkmKeyNamesMask) fprintf(stderr,"Default symbols not implemented yet!\n"); else if (wantNames&XkmKeyNamesMask) @@ -312,7 +303,7 @@ XkbFileInfo finfo; name= names->types; if (wantConfig&XkmTypesMask) - XkbWriteXKBKeyTypes(file,&finfo,False,False,_AddIncl,name); + XkbWriteXKBKeyTypes(file,xkb,False,False,_AddIncl,name); else if (wantDflts&XkmTypesMask) fprintf(stderr,"Default types not implemented yet!\n"); else if (wantNames&XkmTypesMask) @@ -320,7 +311,7 @@ XkbFileInfo finfo; name= names->compat; if (wantConfig&XkmCompatMapMask) - XkbWriteXKBCompatMap(file,&finfo,False,False,_AddIncl,name); + XkbWriteXKBCompatMap(file,xkb,False,False,_AddIncl,name); else if (wantDflts&XkmCompatMapMask) fprintf(stderr,"Default interps not implemented yet!\n"); else if (wantNames&XkmCompatMapMask) @@ -328,13 +319,13 @@ XkbFileInfo finfo; name= names->symbols; if (wantConfig&XkmSymbolsMask) - XkbWriteXKBSymbols(file,&finfo,False,False,_AddIncl,name); + XkbWriteXKBSymbols(file,xkb,False,False,_AddIncl,name); else if (wantNames&XkmSymbolsMask) XkbWriteSectionFromName(file,"symbols",name); name= names->geometry; if (wantConfig&XkmGeometryMask) - XkbWriteXKBGeometry(file,&finfo,False,False,_AddIncl,name); + XkbWriteXKBGeometry(file,xkb,False,False,_AddIncl,name); else if (wantNames&XkmGeometryMask) XkbWriteSectionFromName(file,"geometry",name); @@ -404,81 +395,6 @@ unsigned rtrn; return rtrn; } -Bool -XkbDetermineFileType(XkbFileInfoPtr finfo,int format,int *opts_missing) -{ -unsigned present; -XkbDescPtr xkb; - - if ((!finfo)||(!finfo->xkb)) - return False; - if (opts_missing) - *opts_missing= 0; - xkb= finfo->xkb; - present= 0; - if ((xkb->names)&&(xkb->names->keys)) present|= XkmKeyNamesMask; - if ((xkb->map)&&(xkb->map->types)) present|= XkmTypesMask; - if (xkb->compat) present|= XkmCompatMapMask; - if ((xkb->map)&&(xkb->map->num_syms>1)) present|= XkmSymbolsMask; - if (xkb->indicators) present|= XkmIndicatorsMask; - if (xkb->geom) present|= XkmGeometryMask; - if (!present) - return False; - else switch (present) { - case XkmKeyNamesMask: - finfo->type= XkmKeyNamesIndex; - finfo->defined= present; - return True; - case XkmTypesMask: - finfo->type= XkmTypesIndex; - finfo->defined= present; - return True; - case XkmCompatMapMask: - finfo->type= XkmCompatMapIndex; - finfo->defined= present; - return True; - case XkmSymbolsMask: - if (format!=XkbXKMFile) { - finfo->type= XkmSymbolsIndex; - finfo->defined= present; - return True; - } - break; - case XkmGeometryMask: - finfo->type= XkmGeometryIndex; - finfo->defined= present; - return True; - } - if ((present&(~XkmSemanticsLegal))==0) { - if ((XkmSemanticsRequired&present)==XkmSemanticsRequired) { - if (opts_missing) - *opts_missing= XkmSemanticsOptional&(~present); - finfo->type= XkmSemanticsFile; - finfo->defined= present; - return True; - } - } - else if ((present&(~XkmLayoutLegal))==0) { - if ((XkmLayoutRequired&present)==XkmLayoutRequired) { - if (opts_missing) - *opts_missing= XkmLayoutOptional&(~present); - finfo->type= XkmLayoutFile; - finfo->defined= present; - return True; - } - } - else if ((present&(~XkmKeymapLegal))==0) { - if ((XkmKeymapRequired&present)==XkmKeymapRequired) { - if (opts_missing) - *opts_missing= XkmKeymapOptional&(~present); - finfo->type= XkmKeymapFile; - finfo->defined= present; - return True; - } - } - return False; -} - /* all latin-1 alphanumerics, plus parens, slash, minus, underscore and */ /* wildcards */ |