summaryrefslogtreecommitdiff
path: root/xkb/xkbfmisc.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2012-03-21 12:55:09 -0700
committerKeith Packard <keithp@keithp.com>2012-03-21 13:54:42 -0700
commit9838b7032ea9792bec21af424c53c07078636d21 (patch)
treeb72d0827dac50f0f3b8eab29b3b7639546d735d7 /xkb/xkbfmisc.c
parent75199129c603fc8567185ac31866c9518193cb78 (diff)
Introduce a consistent coding style
This is strictly the application of the script 'x-indent-all.sh' from util/modular. Compared to the patch that Daniel posted in January, I've added a few indent flags: -bap -psl -T PrivatePtr -T pmWait -T _XFUNCPROTOBEGIN -T _XFUNCPROTOEND -T _X_EXPORT The typedefs were needed to make the output of sdksyms.sh match the previous output, otherwise, the code is formatted badly enough that sdksyms.sh generates incorrect output. The generated code was compared with the previous version and found to be essentially identical -- "assert" line numbers and BUILD_TIME were the only differences found. The comparison was done with this script: dir1=$1 dir2=$2 for dir in $dir1 $dir2; do (cd $dir && find . -name '*.o' | while read file; do dir=`dirname $file` base=`basename $file .o` dump=$dir/$base.dump objdump -d $file > $dump done) done find $dir1 -name '*.dump' | while read dump; do otherdump=`echo $dump | sed "s;$dir1;$dir2;"` diff -u $dump $otherdump done Signed-off-by: Keith Packard <keithp@keithp.com> Acked-by: Daniel Stone <daniel@fooishbar.org> Acked-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'xkb/xkbfmisc.c')
-rw-r--r--xkb/xkbfmisc.c624
1 files changed, 320 insertions, 304 deletions
diff --git a/xkb/xkbfmisc.c b/xkb/xkbfmisc.c
index 782b823bb..d96ee4b52 100644
--- a/xkb/xkbfmisc.c
+++ b/xkb/xkbfmisc.c
@@ -51,94 +51,92 @@
unsigned
_XkbKSCheckCase(KeySym ks)
{
-unsigned set,rtrn;
+ unsigned set, rtrn;
- set= (ks & (~0xff)) >> 8;
- rtrn= 0;
+ set = (ks & (~0xff)) >> 8;
+ rtrn = 0;
switch (set) {
- case 0: /* latin 1 */
- if (((ks>=XK_A)&&(ks<=XK_Z))||
- ((ks>=XK_Agrave)&&(ks<=XK_THORN)&&(ks!=XK_multiply))) {
- rtrn|= _XkbKSUpper;
- }
- if (((ks>=XK_a)&&(ks<=XK_z))||
- ((ks>=XK_ssharp)&&(ks<=XK_ydiaeresis)&&(ks!=XK_division))) {
- rtrn|= _XkbKSLower;
- }
- break;
- case 1: /* latin 2 */
- if (((ks>=XK_Aogonek)&&(ks<=XK_Zabovedot)&&(ks!=XK_breve))||
- ((ks>=XK_Racute)&&(ks<=XK_Tcedilla))) {
- rtrn|= _XkbKSUpper;
- }
- if (((ks>=XK_aogonek)&&(ks<=XK_zabovedot)&&(ks!=XK_ogonek)&&(ks!=XK_caron)&&(ks!=XK_doubleacute))||
- ((ks>=XK_racute)&&(ks<=XK_tcedilla))) {
- rtrn|= _XkbKSLower;
- }
- break;
- case 2: /* latin 3 */
- if (((ks>=XK_Hstroke)&&(ks<=XK_Jcircumflex))||
- ((ks>=XK_Cabovedot)&&(ks<=XK_Scircumflex))) {
- rtrn|= _XkbKSUpper;
- }
- if (((ks>=XK_hstroke)&&(ks<=XK_jcircumflex))||
- ((ks>=XK_cabovedot)&&(ks<=XK_scircumflex))) {
- rtrn|= _XkbKSLower;
- }
- break;
- case 3: /* latin 4 */
- if (((ks>=XK_Rcedilla)&&(ks<=XK_Tslash))||
- (ks==XK_ENG)||
- ((ks>=XK_Amacron)&&(ks<=XK_Umacron))) {
- rtrn|= _XkbKSUpper;
- }
- if ((ks==XK_kra)||
- ((ks>=XK_rcedilla)&&(ks<=XK_tslash))||
- (ks==XK_eng)||
- ((ks>=XK_amacron)&&(ks<=XK_umacron))) {
- rtrn|= _XkbKSLower;
- }
- break;
- case 18: /* latin 8 */
- if ((ks==XK_Wcircumflex)||
- (ks==XK_Ycircumflex)||
- (ks==XK_Babovedot)||
- (ks==XK_Dabovedot)||
- (ks==XK_Fabovedot)||
- (ks==XK_Mabovedot)||
- (ks==XK_Pabovedot)||
- (ks==XK_Sabovedot)||
- (ks==XK_Tabovedot)||
- (ks==XK_Wgrave)||
- (ks==XK_Wacute)||
- (ks==XK_Wdiaeresis)||
- (ks==XK_Ygrave)) {
- rtrn|= _XkbKSUpper;
- }
- if ((ks==XK_wcircumflex)||
- (ks==XK_ycircumflex)||
- (ks==XK_babovedot)||
- (ks==XK_dabovedot)||
- (ks==XK_fabovedot)||
- (ks==XK_mabovedot)||
- (ks==XK_pabovedot)||
- (ks==XK_sabovedot)||
- (ks==XK_tabovedot)||
- (ks==XK_wgrave)||
- (ks==XK_wacute)||
- (ks==XK_wdiaeresis)||
- (ks==XK_ygrave)) {
- rtrn|= _XkbKSLower;
- }
- break;
- case 19: /* latin 9 */
- if ((ks==XK_OE)||(ks==XK_Ydiaeresis)) {
- rtrn|= _XkbKSUpper;
- }
- if (ks==XK_oe) {
- rtrn|= _XkbKSLower;
- }
- break;
+ case 0: /* latin 1 */
+ if (((ks >= XK_A) && (ks <= XK_Z)) ||
+ ((ks >= XK_Agrave) && (ks <= XK_THORN) && (ks != XK_multiply))) {
+ rtrn |= _XkbKSUpper;
+ }
+ if (((ks >= XK_a) && (ks <= XK_z)) ||
+ ((ks >= XK_ssharp) && (ks <= XK_ydiaeresis) &&
+ (ks != XK_division))) {
+ rtrn |= _XkbKSLower;
+ }
+ break;
+ case 1: /* latin 2 */
+ if (((ks >= XK_Aogonek) && (ks <= XK_Zabovedot) && (ks != XK_breve)) ||
+ ((ks >= XK_Racute) && (ks <= XK_Tcedilla))) {
+ rtrn |= _XkbKSUpper;
+ }
+ if (((ks >= XK_aogonek) && (ks <= XK_zabovedot) && (ks != XK_ogonek) &&
+ (ks != XK_caron) && (ks != XK_doubleacute)) || ((ks >= XK_racute)
+ && (ks <=
+ XK_tcedilla)))
+ {
+ rtrn |= _XkbKSLower;
+ }
+ break;
+ case 2: /* latin 3 */
+ if (((ks >= XK_Hstroke) && (ks <= XK_Jcircumflex)) ||
+ ((ks >= XK_Cabovedot) && (ks <= XK_Scircumflex))) {
+ rtrn |= _XkbKSUpper;
+ }
+ if (((ks >= XK_hstroke) && (ks <= XK_jcircumflex)) ||
+ ((ks >= XK_cabovedot) && (ks <= XK_scircumflex))) {
+ rtrn |= _XkbKSLower;
+ }
+ break;
+ case 3: /* latin 4 */
+ if (((ks >= XK_Rcedilla) && (ks <= XK_Tslash)) ||
+ (ks == XK_ENG) || ((ks >= XK_Amacron) && (ks <= XK_Umacron))) {
+ rtrn |= _XkbKSUpper;
+ }
+ if ((ks == XK_kra) ||
+ ((ks >= XK_rcedilla) && (ks <= XK_tslash)) ||
+ (ks == XK_eng) || ((ks >= XK_amacron) && (ks <= XK_umacron))) {
+ rtrn |= _XkbKSLower;
+ }
+ break;
+ case 18: /* latin 8 */
+ if ((ks == XK_Wcircumflex) ||
+ (ks == XK_Ycircumflex) ||
+ (ks == XK_Babovedot) ||
+ (ks == XK_Dabovedot) ||
+ (ks == XK_Fabovedot) ||
+ (ks == XK_Mabovedot) ||
+ (ks == XK_Pabovedot) ||
+ (ks == XK_Sabovedot) ||
+ (ks == XK_Tabovedot) ||
+ (ks == XK_Wgrave) ||
+ (ks == XK_Wacute) || (ks == XK_Wdiaeresis) || (ks == XK_Ygrave)) {
+ rtrn |= _XkbKSUpper;
+ }
+ if ((ks == XK_wcircumflex) ||
+ (ks == XK_ycircumflex) ||
+ (ks == XK_babovedot) ||
+ (ks == XK_dabovedot) ||
+ (ks == XK_fabovedot) ||
+ (ks == XK_mabovedot) ||
+ (ks == XK_pabovedot) ||
+ (ks == XK_sabovedot) ||
+ (ks == XK_tabovedot) ||
+ (ks == XK_wgrave) ||
+ (ks == XK_wacute) || (ks == XK_wdiaeresis) || (ks == XK_ygrave)) {
+ rtrn |= _XkbKSLower;
+ }
+ break;
+ case 19: /* latin 9 */
+ if ((ks == XK_OE) || (ks == XK_Ydiaeresis)) {
+ rtrn |= _XkbKSUpper;
+ }
+ if (ks == XK_oe) {
+ rtrn |= _XkbKSLower;
+ }
+ break;
}
return rtrn;
}
@@ -146,9 +144,9 @@ unsigned set,rtrn;
/***===================================================================***/
static Bool
-XkbWriteSectionFromName(FILE *file,const char *sectionName,const char *name)
+XkbWriteSectionFromName(FILE * file, const char *sectionName, const char *name)
{
- fprintf(file," xkb_%-20s { include \"%s\" };\n",sectionName,name);
+ fprintf(file, " xkb_%-20s { include \"%s\" };\n", sectionName, name);
return TRUE;
}
@@ -157,43 +155,43 @@ XkbWriteSectionFromName(FILE *file,const char *sectionName,const char *name)
/* ARGSUSED */
static void
-_AddIncl( FILE * file,
- XkbDescPtr xkb,
- Bool topLevel,
- Bool showImplicit,
- int index,
- void * priv)
+_AddIncl(FILE * file,
+ XkbDescPtr xkb,
+ Bool topLevel, Bool showImplicit, int index, void *priv)
{
- if ((priv)&&(strcmp((char *)priv,"%")!=0))
- fprintf(file," include \"%s\"\n",(char *)priv);
+ if ((priv) && (strcmp((char *) priv, "%") != 0))
+ fprintf(file, " include \"%s\"\n", (char *) priv);
return;
}
Bool
-XkbWriteXKBKeymapForNames( FILE * file,
- XkbComponentNamesPtr names,
- XkbDescPtr xkb,
- unsigned want,
- unsigned need)
+XkbWriteXKBKeymapForNames(FILE * file,
+ XkbComponentNamesPtr names,
+ XkbDescPtr xkb, unsigned want, unsigned need)
{
-const char * tmp;
-unsigned complete;
-XkbNamesPtr old_names;
-int multi_section;
-unsigned wantNames,wantConfig,wantDflts;
-
- complete= 0;
- if (COMPLETE(names->keycodes)) complete|= XkmKeyNamesMask;
- if (COMPLETE(names->types)) complete|= XkmTypesMask;
- if (COMPLETE(names->compat)) complete|= XkmCompatMapMask;
- if (COMPLETE(names->symbols)) complete|= XkmSymbolsMask;
- if (COMPLETE(names->geometry)) complete|= XkmGeometryMask;
- want|= (complete|need);
- if (want&XkmSymbolsMask)
- want|= XkmKeyNamesMask|XkmTypesMask;
-
- if (want==0)
- return FALSE;
+ const char *tmp;
+ unsigned complete;
+ XkbNamesPtr old_names;
+ int multi_section;
+ unsigned wantNames, wantConfig, wantDflts;
+
+ complete = 0;
+ if (COMPLETE(names->keycodes))
+ complete |= XkmKeyNamesMask;
+ if (COMPLETE(names->types))
+ complete |= XkmTypesMask;
+ if (COMPLETE(names->compat))
+ complete |= XkmCompatMapMask;
+ if (COMPLETE(names->symbols))
+ complete |= XkmSymbolsMask;
+ if (COMPLETE(names->geometry))
+ complete |= XkmGeometryMask;
+ want |= (complete | need);
+ if (want & XkmSymbolsMask)
+ want |= XkmKeyNamesMask | XkmTypesMask;
+
+ if (want == 0)
+ return FALSE;
if (xkb) {
old_names = xkb->names;
@@ -214,207 +212,224 @@ unsigned wantNames,wantConfig,wantDflts;
xkb->defined |= XkmGeometryMask;
}
else {
- old_names= NULL;
+ old_names = NULL;
}
- wantConfig= want&(~complete);
- if (xkb!=NULL) {
- if (wantConfig&XkmTypesMask) {
- if ((!xkb->map) || (xkb->map->num_types<XkbNumRequiredTypes))
- wantConfig&= ~XkmTypesMask;
- }
- if (wantConfig&XkmCompatMapMask) {
- if ((!xkb->compat) || (xkb->compat->num_si<1))
- wantConfig&= ~XkmCompatMapMask;
- }
- if (wantConfig&XkmSymbolsMask) {
- if ((!xkb->map) || (!xkb->map->key_sym_map))
- wantConfig&= ~XkmSymbolsMask;
- }
- if (wantConfig&XkmIndicatorsMask) {
- if (!xkb->indicators)
- wantConfig&= ~XkmIndicatorsMask;
- }
- if (wantConfig&XkmKeyNamesMask) {
- if ((!xkb->names)||(!xkb->names->keys))
- wantConfig&= ~XkmKeyNamesMask;
- }
- if ((wantConfig&XkmGeometryMask)&&(!xkb->geom))
- wantConfig&= ~XkmGeometryMask;
+ wantConfig = want & (~complete);
+ if (xkb != NULL) {
+ if (wantConfig & XkmTypesMask) {
+ if ((!xkb->map) || (xkb->map->num_types < XkbNumRequiredTypes))
+ wantConfig &= ~XkmTypesMask;
+ }
+ if (wantConfig & XkmCompatMapMask) {
+ if ((!xkb->compat) || (xkb->compat->num_si < 1))
+ wantConfig &= ~XkmCompatMapMask;
+ }
+ if (wantConfig & XkmSymbolsMask) {
+ if ((!xkb->map) || (!xkb->map->key_sym_map))
+ wantConfig &= ~XkmSymbolsMask;
+ }
+ if (wantConfig & XkmIndicatorsMask) {
+ if (!xkb->indicators)
+ wantConfig &= ~XkmIndicatorsMask;
+ }
+ if (wantConfig & XkmKeyNamesMask) {
+ if ((!xkb->names) || (!xkb->names->keys))
+ wantConfig &= ~XkmKeyNamesMask;
+ }
+ if ((wantConfig & XkmGeometryMask) && (!xkb->geom))
+ wantConfig &= ~XkmGeometryMask;
}
else {
- wantConfig= 0;
+ wantConfig = 0;
}
- complete|= wantConfig;
-
- wantDflts= 0;
- wantNames= want&(~complete);
- if ((xkb!=NULL) && (old_names!=NULL)) {
- if (wantNames&XkmTypesMask) {
- if (old_names->types!=None) {
- tmp= NameForAtom(old_names->types);
- names->types= Xstrdup(tmp);
- }
- else {
- wantDflts|= XkmTypesMask;
- }
- complete|= XkmTypesMask;
- }
- if (wantNames&XkmCompatMapMask) {
- if (old_names->compat!=None) {
- tmp= NameForAtom(old_names->compat);
- names->compat= Xstrdup(tmp);
- }
- else wantDflts|= XkmCompatMapMask;
- complete|= XkmCompatMapMask;
- }
- if (wantNames&XkmSymbolsMask) {
- if (old_names->symbols==None)
- return FALSE;
- tmp= NameForAtom(old_names->symbols);
- names->symbols= Xstrdup(tmp);
- complete|= XkmSymbolsMask;
- }
- if (wantNames&XkmKeyNamesMask) {
- if (old_names->keycodes!=None) {
- tmp= NameForAtom(old_names->keycodes);
- names->keycodes= Xstrdup(tmp);
- }
- else wantDflts|= XkmKeyNamesMask;
- complete|= XkmKeyNamesMask;
- }
- if (wantNames&XkmGeometryMask) {
- if (old_names->geometry==None)
- return FALSE;
- tmp= NameForAtom(old_names->geometry);
- names->geometry= Xstrdup(tmp);
- complete|= XkmGeometryMask;
- wantNames&= ~XkmGeometryMask;
- }
+ complete |= wantConfig;
+
+ wantDflts = 0;
+ wantNames = want & (~complete);
+ if ((xkb != NULL) && (old_names != NULL)) {
+ if (wantNames & XkmTypesMask) {
+ if (old_names->types != None) {
+ tmp = NameForAtom(old_names->types);
+ names->types = Xstrdup(tmp);
+ }
+ else {
+ wantDflts |= XkmTypesMask;
+ }
+ complete |= XkmTypesMask;
+ }
+ if (wantNames & XkmCompatMapMask) {
+ if (old_names->compat != None) {
+ tmp = NameForAtom(old_names->compat);
+ names->compat = Xstrdup(tmp);
+ }
+ else
+ wantDflts |= XkmCompatMapMask;
+ complete |= XkmCompatMapMask;
+ }
+ if (wantNames & XkmSymbolsMask) {
+ if (old_names->symbols == None)
+ return FALSE;
+ tmp = NameForAtom(old_names->symbols);
+ names->symbols = Xstrdup(tmp);
+ complete |= XkmSymbolsMask;
+ }
+ if (wantNames & XkmKeyNamesMask) {
+ if (old_names->keycodes != None) {
+ tmp = NameForAtom(old_names->keycodes);
+ names->keycodes = Xstrdup(tmp);
+ }
+ else
+ wantDflts |= XkmKeyNamesMask;
+ complete |= XkmKeyNamesMask;
+ }
+ if (wantNames & XkmGeometryMask) {
+ if (old_names->geometry == None)
+ return FALSE;
+ tmp = NameForAtom(old_names->geometry);
+ names->geometry = Xstrdup(tmp);
+ complete |= XkmGeometryMask;
+ wantNames &= ~XkmGeometryMask;
+ }
}
- if (complete&XkmCompatMapMask)
- complete|= XkmIndicatorsMask|XkmVirtualModsMask;
- else if (complete&(XkmSymbolsMask|XkmTypesMask))
- complete|= XkmVirtualModsMask;
+ if (complete & XkmCompatMapMask)
+ complete |= XkmIndicatorsMask | XkmVirtualModsMask;
+ else if (complete & (XkmSymbolsMask | XkmTypesMask))
+ complete |= XkmVirtualModsMask;
if (need & (~complete))
- return FALSE;
- if ((complete&XkmSymbolsMask)&&((XkmKeyNamesMask|XkmTypesMask)&(~complete)))
- return FALSE;
-
- multi_section= 1;
- if (((complete&XkmKeymapRequired)==XkmKeymapRequired)&&
- ((complete&(~XkmKeymapLegal))==0)) {
- fprintf(file,"xkb_keymap \"default\" {\n");
+ return FALSE;
+ if ((complete & XkmSymbolsMask) &&
+ ((XkmKeyNamesMask | XkmTypesMask) & (~complete)))
+ return FALSE;
+
+ multi_section = 1;
+ if (((complete & XkmKeymapRequired) == XkmKeymapRequired) &&
+ ((complete & (~XkmKeymapLegal)) == 0)) {
+ fprintf(file, "xkb_keymap \"default\" {\n");
}
- else if (((complete&XkmSemanticsRequired)==XkmSemanticsRequired)&&
- ((complete&(~XkmSemanticsLegal))==0)) {
- fprintf(file,"xkb_semantics \"default\" {\n");
+ else if (((complete & XkmSemanticsRequired) == XkmSemanticsRequired) &&
+ ((complete & (~XkmSemanticsLegal)) == 0)) {
+ fprintf(file, "xkb_semantics \"default\" {\n");
}
- else if (((complete&XkmLayoutRequired)==XkmLayoutRequired)&&
- ((complete&(~XkmLayoutLegal))==0)) {
- fprintf(file,"xkb_layout \"default\" {\n");
+ else if (((complete & XkmLayoutRequired) == XkmLayoutRequired) &&
+ ((complete & (~XkmLayoutLegal)) == 0)) {
+ fprintf(file, "xkb_layout \"default\" {\n");
}
- else if (XkmSingleSection(complete&(~XkmVirtualModsMask))) {
- multi_section= 0;
+ else if (XkmSingleSection(complete & (~XkmVirtualModsMask))) {
+ multi_section = 0;
}
else {
- return FALSE;
+ return FALSE;
}
- wantNames= complete&(~(wantConfig|wantDflts));
- if (wantConfig&XkmKeyNamesMask)
- XkbWriteXKBKeycodes(file,xkb,FALSE,FALSE,_AddIncl,names->keycodes);
- else if (wantDflts&XkmKeyNamesMask)
- fprintf(stderr,"Default symbols not implemented yet!\n");
- else if (wantNames&XkmKeyNamesMask)
- XkbWriteSectionFromName(file,"keycodes",names->keycodes);
-
- if (wantConfig&XkmTypesMask)
- XkbWriteXKBKeyTypes(file,xkb,FALSE,FALSE,_AddIncl,names->types);
- else if (wantDflts&XkmTypesMask)
- fprintf(stderr,"Default types not implemented yet!\n");
- else if (wantNames&XkmTypesMask)
- XkbWriteSectionFromName(file,"types",names->types);
-
- if (wantConfig&XkmCompatMapMask)
- XkbWriteXKBCompatMap(file,xkb,FALSE,FALSE,_AddIncl,names->compat);
- else if (wantDflts&XkmCompatMapMask)
- fprintf(stderr,"Default interps not implemented yet!\n");
- else if (wantNames&XkmCompatMapMask)
- XkbWriteSectionFromName(file,"compatibility",names->compat);
-
- if (wantConfig&XkmSymbolsMask)
- XkbWriteXKBSymbols(file,xkb,FALSE,FALSE,_AddIncl,names->symbols);
- else if (wantNames&XkmSymbolsMask)
- XkbWriteSectionFromName(file,"symbols",names->symbols);
-
- if (wantConfig&XkmGeometryMask)
- XkbWriteXKBGeometry(file,xkb,FALSE,FALSE,_AddIncl,names->geometry);
- else if (wantNames&XkmGeometryMask)
- XkbWriteSectionFromName(file,"geometry",names->geometry);
+ wantNames = complete & (~(wantConfig | wantDflts));
+ if (wantConfig & XkmKeyNamesMask)
+ XkbWriteXKBKeycodes(file, xkb, FALSE, FALSE, _AddIncl, names->keycodes);
+ else if (wantDflts & XkmKeyNamesMask)
+ fprintf(stderr, "Default symbols not implemented yet!\n");
+ else if (wantNames & XkmKeyNamesMask)
+ XkbWriteSectionFromName(file, "keycodes", names->keycodes);
+
+ if (wantConfig & XkmTypesMask)
+ XkbWriteXKBKeyTypes(file, xkb, FALSE, FALSE, _AddIncl, names->types);
+ else if (wantDflts & XkmTypesMask)
+ fprintf(stderr, "Default types not implemented yet!\n");
+ else if (wantNames & XkmTypesMask)
+ XkbWriteSectionFromName(file, "types", names->types);
+
+ if (wantConfig & XkmCompatMapMask)
+ XkbWriteXKBCompatMap(file, xkb, FALSE, FALSE, _AddIncl, names->compat);
+ else if (wantDflts & XkmCompatMapMask)
+ fprintf(stderr, "Default interps not implemented yet!\n");
+ else if (wantNames & XkmCompatMapMask)
+ XkbWriteSectionFromName(file, "compatibility", names->compat);
+
+ if (wantConfig & XkmSymbolsMask)
+ XkbWriteXKBSymbols(file, xkb, FALSE, FALSE, _AddIncl, names->symbols);
+ else if (wantNames & XkmSymbolsMask)
+ XkbWriteSectionFromName(file, "symbols", names->symbols);
+
+ if (wantConfig & XkmGeometryMask)
+ XkbWriteXKBGeometry(file, xkb, FALSE, FALSE, _AddIncl, names->geometry);
+ else if (wantNames & XkmGeometryMask)
+ XkbWriteSectionFromName(file, "geometry", names->geometry);
if (multi_section)
- fprintf(file,"};\n");
+ fprintf(file, "};\n");
return TRUE;
}
/***====================================================================***/
int
-XkbFindKeycodeByName(XkbDescPtr xkb,char *name,Bool use_aliases)
+XkbFindKeycodeByName(XkbDescPtr xkb, char *name, Bool use_aliases)
{
-register int i;
+ register int i;
- if ((!xkb)||(!xkb->names)||(!xkb->names->keys))
- return 0;
- for (i=xkb->min_key_code;i<=xkb->max_key_code;i++) {
- if (strncmp(xkb->names->keys[i].name,name,XkbKeyNameLength)==0)
- return i;
+ if ((!xkb) || (!xkb->names) || (!xkb->names->keys))
+ return 0;
+ for (i = xkb->min_key_code; i <= xkb->max_key_code; i++) {
+ if (strncmp(xkb->names->keys[i].name, name, XkbKeyNameLength) == 0)
+ return i;
}
if (!use_aliases)
- return 0;
+ return 0;
if (xkb->geom && xkb->geom->key_aliases) {
- XkbKeyAliasPtr a;
- a= xkb->geom->key_aliases;
- for (i=0;i<xkb->geom->num_key_aliases;i++,a++) {
- if (strncmp(name,a->alias,XkbKeyNameLength)==0)
- return XkbFindKeycodeByName(xkb,a->real,FALSE);
- }
+ XkbKeyAliasPtr a;
+
+ a = xkb->geom->key_aliases;
+ for (i = 0; i < xkb->geom->num_key_aliases; i++, a++) {
+ if (strncmp(name, a->alias, XkbKeyNameLength) == 0)
+ return XkbFindKeycodeByName(xkb, a->real, FALSE);
+ }
}
if (xkb->names && xkb->names->key_aliases) {
- XkbKeyAliasPtr a;
- a= xkb->names->key_aliases;
- for (i=0;i<xkb->names->num_key_aliases;i++,a++) {
- if (strncmp(name,a->alias,XkbKeyNameLength)==0)
- return XkbFindKeycodeByName(xkb,a->real,FALSE);
- }
+ XkbKeyAliasPtr a;
+
+ a = xkb->names->key_aliases;
+ for (i = 0; i < xkb->names->num_key_aliases; i++, a++) {
+ if (strncmp(name, a->alias, XkbKeyNameLength) == 0)
+ return XkbFindKeycodeByName(xkb, a->real, FALSE);
+ }
}
return 0;
}
-
unsigned
-XkbConvertGetByNameComponents(Bool toXkm,unsigned orig)
+XkbConvertGetByNameComponents(Bool toXkm, unsigned orig)
{
-unsigned rtrn;
+ unsigned rtrn;
- rtrn= 0;
+ rtrn = 0;
if (toXkm) {
- if (orig&XkbGBN_TypesMask) rtrn|= XkmTypesMask;
- if (orig&XkbGBN_CompatMapMask) rtrn|= XkmCompatMapMask;
- if (orig&XkbGBN_SymbolsMask) rtrn|= XkmSymbolsMask;
- if (orig&XkbGBN_IndicatorMapMask) rtrn|= XkmIndicatorsMask;
- if (orig&XkbGBN_KeyNamesMask) rtrn|= XkmKeyNamesMask;
- if (orig&XkbGBN_GeometryMask) rtrn|= XkmGeometryMask;
+ if (orig & XkbGBN_TypesMask)
+ rtrn |= XkmTypesMask;
+ if (orig & XkbGBN_CompatMapMask)
+ rtrn |= XkmCompatMapMask;
+ if (orig & XkbGBN_SymbolsMask)
+ rtrn |= XkmSymbolsMask;
+ if (orig & XkbGBN_IndicatorMapMask)
+ rtrn |= XkmIndicatorsMask;
+ if (orig & XkbGBN_KeyNamesMask)
+ rtrn |= XkmKeyNamesMask;
+ if (orig & XkbGBN_GeometryMask)
+ rtrn |= XkmGeometryMask;
}
else {
- if (orig&XkmTypesMask) rtrn|= XkbGBN_TypesMask;
- if (orig&XkmCompatMapMask) rtrn|= XkbGBN_CompatMapMask;
- if (orig&XkmSymbolsMask) rtrn|= XkbGBN_SymbolsMask;
- if (orig&XkmIndicatorsMask) rtrn|= XkbGBN_IndicatorMapMask;
- if (orig&XkmKeyNamesMask) rtrn|= XkbGBN_KeyNamesMask;
- if (orig&XkmGeometryMask) rtrn|= XkbGBN_GeometryMask;
- if (orig!=0) rtrn|= XkbGBN_OtherNamesMask;
+ if (orig & XkmTypesMask)
+ rtrn |= XkbGBN_TypesMask;
+ if (orig & XkmCompatMapMask)
+ rtrn |= XkbGBN_CompatMapMask;
+ if (orig & XkmSymbolsMask)
+ rtrn |= XkbGBN_SymbolsMask;
+ if (orig & XkmIndicatorsMask)
+ rtrn |= XkbGBN_IndicatorMapMask;
+ if (orig & XkmKeyNamesMask)
+ rtrn |= XkbGBN_KeyNamesMask;
+ if (orig & XkmGeometryMask)
+ rtrn |= XkbGBN_GeometryMask;
+ if (orig != 0)
+ rtrn |= XkbGBN_OtherNamesMask;
}
return rtrn;
}
@@ -424,30 +439,31 @@ unsigned rtrn;
#define UNMATCHABLE(c) (((c)=='(')||((c)==')')||((c)=='/'))
Bool
-XkbNameMatchesPattern(char *name,char *ptrn)
+XkbNameMatchesPattern(char *name, char *ptrn)
{
- while (ptrn[0]!='\0') {
- if (name[0]=='\0') {
- if (ptrn[0]=='*') {
- ptrn++;
- continue;
- }
- return FALSE;
- }
- if (ptrn[0]=='?') {
- if (UNMATCHABLE(name[0]))
- return FALSE;
- }
- else if (ptrn[0]=='*') {
- if ((!UNMATCHABLE(name[0]))&&XkbNameMatchesPattern(name+1,ptrn))
- return TRUE;
- return XkbNameMatchesPattern(name,ptrn+1);
- }
- else if (ptrn[0]!=name[0])
- return FALSE;
- name++;
- ptrn++;
+ while (ptrn[0] != '\0') {
+ if (name[0] == '\0') {
+ if (ptrn[0] == '*') {
+ ptrn++;
+ continue;
+ }
+ return FALSE;
+ }
+ if (ptrn[0] == '?') {
+ if (UNMATCHABLE(name[0]))
+ return FALSE;
+ }
+ else if (ptrn[0] == '*') {
+ if ((!UNMATCHABLE(name[0])) &&
+ XkbNameMatchesPattern(name + 1, ptrn))
+ return TRUE;
+ return XkbNameMatchesPattern(name, ptrn + 1);
+ }
+ else if (ptrn[0] != name[0])
+ return FALSE;
+ name++;
+ ptrn++;
}
/* if we get here, the pattern is exhausted (-:just like me:-) */
- return name[0]=='\0';
+ return name[0] == '\0';
}