summaryrefslogtreecommitdiff
path: root/symbols.c
diff options
context:
space:
mode:
Diffstat (limited to 'symbols.c')
-rw-r--r--symbols.c430
1 files changed, 199 insertions, 231 deletions
diff --git a/symbols.c b/symbols.c
index 79f76de..4eb2ef1 100644
--- a/symbols.c
+++ b/symbols.c
@@ -24,6 +24,7 @@
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/xkbcomp/symbols.c,v 3.14 2002/12/20 20:18:33 paulo Exp $ */
#include "xkbcomp.h"
#include "tokens.h"
@@ -31,6 +32,7 @@
#include <X11/keysym.h>
#include <X11/Xutil.h>
+#include <stdlib.h>
#include "expr.h"
#include "vmod.h"
@@ -78,12 +80,7 @@ typedef struct _KeyInfo {
} KeyInfo;
static void
-#if NeedFunctionPrototypes
InitKeyInfo(KeyInfo *info)
-#else
-InitKeyInfo(info)
- KeyInfo * info;
-#endif
{
register int i;
static char dflt[4]= "*";
@@ -112,12 +109,7 @@ static char dflt[4]= "*";
}
static void
-#if NeedFunctionPrototypes
FreeKeyInfo(KeyInfo *info)
-#else
-FreeKeyInfo(info)
- KeyInfo * info;
-#endif
{
register int i;
@@ -147,14 +139,7 @@ register int i;
}
static Bool
-#if NeedFunctionPrototypes
CopyKeyInfo(KeyInfo *old,KeyInfo *new,Bool clearOld)
-#else
-CopyKeyInfo(old,new,clearOld)
- KeyInfo * old;
- KeyInfo * new;
- Bool clearOld;
-#endif
{
register int i;
@@ -214,6 +199,7 @@ typedef struct _SymbolsInfo {
int errorCount;
unsigned fileID;
unsigned merge;
+ unsigned explicit_group;
unsigned groupInfo;
unsigned szKeys;
unsigned nKeys;
@@ -228,13 +214,7 @@ typedef struct _SymbolsInfo {
} SymbolsInfo;
static void
-#if NeedFunctionPrototypes
InitSymbolsInfo(SymbolsInfo *info,XkbDescPtr xkb)
-#else
-InitSymbolsInfo(info,xkb)
- SymbolsInfo * info;
- XkbDescPtr xkb;
-#endif
{
register int i;
@@ -242,6 +222,7 @@ register int i;
tok_TWO_LEVEL= XkbInternAtom(NULL,"TWO_LEVEL",False);
tok_KEYPAD= XkbInternAtom(NULL,"KEYPAD",False);
info->name= NULL;
+ info->explicit_group= 0;
info->errorCount= 0;
info->fileID= 0;
info->merge= MergeOverride;
@@ -260,12 +241,7 @@ register int i;
}
static void
-#if NeedFunctionPrototypes
FreeSymbolsInfo(SymbolsInfo *info)
-#else
-FreeSymbolsInfo(info)
- SymbolsInfo * info;
-#endif
{
register int i;
@@ -292,18 +268,10 @@ register int i;
}
static Bool
-#if NeedFunctionPrototypes
ResizeKeyGroup( KeyInfo * key,
unsigned group,
unsigned atLeastSize,
Bool forceActions)
-#else
-ResizeKeyGroup(key,group,atLeastSize,forceActions)
- KeyInfo * key;
- unsigned group;
- unsigned atLeastSize;
- Bool forceActions;
-#endif
{
Bool tooSmall;
unsigned newWidth;
@@ -332,18 +300,10 @@ unsigned newWidth;
}
static Bool
-#if NeedFunctionPrototypes
MergeKeyGroups( SymbolsInfo * info,
KeyInfo * into,
KeyInfo * from,
unsigned group)
-#else
-MergeKeyGroups(info,into,from,group)
- SymbolsInfo * info;
- KeyInfo * into;
- KeyInfo * from;
- unsigned group;
-#endif
{
KeySym * resultSyms;
XkbAction * resultActs;
@@ -437,23 +397,24 @@ Bool report,clobber;
uFree(into->syms[group]);
if ((from->syms[group]!=NULL)&&(resultSyms!=from->syms[group]))
uFree(from->syms[group]);
+ if ((into->acts[group]!=NULL)&&(resultActs!=into->acts[group]))
+ uFree(into->acts[group]);
+ if ((from->acts[group]!=NULL)&&(resultActs!=from->acts[group]))
+ uFree(from->acts[group]);
into->numLevels[group]= resultWidth;
into->syms[group]= resultSyms;
from->syms[group]= NULL;
+ into->acts[group]= resultActs;
+ from->acts[group]= NULL;
into->symsDefined|= (1<<group);
from->symsDefined&= ~(1<<group);
+ into->actsDefined|= (1<<group);
+ from->actsDefined&= ~(1<<group);
return True;
}
static Bool
-#if NeedFunctionPrototypes
MergeKeys(SymbolsInfo *info,KeyInfo *into,KeyInfo *from)
-#else
-MergeKeys(info,into,from)
- SymbolsInfo * info;
- KeyInfo * into;
- KeyInfo * from;
-#endif
{
register int i;
unsigned collide= 0;
@@ -551,20 +512,21 @@ Bool report;
}
static Bool
-#if NeedFunctionPrototypes
-AddKeySymbols(SymbolsInfo *info,KeyInfo *key)
-#else
-AddKeySymbols(info,key)
- SymbolsInfo * info;
- KeyInfo * key;
-#endif
+AddKeySymbols(SymbolsInfo *info,KeyInfo *key,XkbDescPtr xkb)
{
register int i;
+unsigned long real_name;
for (i=0;i<info->nKeys;i++) {
if (info->keys[i].name==key->name)
return MergeKeys(info,&info->keys[i],key);
}
+ if(FindKeyNameForAlias(xkb, key->name, &real_name)) {
+ for (i=0;i<info->nKeys;i++) {
+ if (info->keys[i].name==real_name)
+ return MergeKeys(info,&info->keys[i],key);
+ }
+ }
if (info->nKeys>=info->szKeys) {
info->szKeys+= SYMBOLS_CHUNK;
info->keys= uTypedRecalloc(info->keys,info->nKeys,info->szKeys,KeyInfo);
@@ -578,13 +540,7 @@ register int i;
}
static Bool
-#if NeedFunctionPrototypes
AddModMapEntry(SymbolsInfo *info,ModMapEntry *new)
-#else
-AddModMapEntry(info,new)
- SymbolsInfo * info;
- ModMapEntry * new;
-#endif
{
ModMapEntry * mm;
Bool clobber;
@@ -649,14 +605,8 @@ Bool clobber;
/***====================================================================***/
static void
-#if NeedFunctionPrototypes
-MergeIncludedSymbols(SymbolsInfo *into,SymbolsInfo *from,unsigned merge)
-#else
-MergeIncludedSymbols(into,from,merge)
- SymbolsInfo * into;
- SymbolsInfo * from;
- unsigned merge;
-#endif
+MergeIncludedSymbols(SymbolsInfo *into,SymbolsInfo *from,
+ unsigned merge,XkbDescPtr xkb)
{
register int i;
KeyInfo * key;
@@ -678,7 +628,7 @@ KeyInfo * key;
for (i=0,key=from->keys;i<from->nKeys;i++,key++) {
if (merge!=MergeDefault)
key->defs.merge= merge;
- if (!AddKeySymbols(into,key))
+ if (!AddKeySymbols(into,key,xkb))
into->errorCount++;
}
if (from->modMap!=NULL) {
@@ -699,27 +649,17 @@ KeyInfo * key;
}
typedef void (*FileHandler)(
-#if NeedFunctionPrototypes
XkbFile * /* rtrn */,
XkbDescPtr /* xkb */,
unsigned /* merge */,
SymbolsInfo * /* included */
-#endif
);
static Bool
-#if NeedFunctionPrototypes
HandleIncludeSymbols( IncludeStmt * stmt,
XkbDescPtr xkb,
SymbolsInfo * info,
FileHandler hndlr)
-#else
-HandleIncludeSymbols(stmt,xkb,info,hndlr)
- IncludeStmt * stmt;
- XkbDescPtr xkb;
- SymbolsInfo * info;
- void (*hndlr)();
-#endif
{
unsigned newMerge;
XkbFile * rtrn;
@@ -736,6 +676,11 @@ Bool haveSelf;
InitSymbolsInfo(&included,xkb);
included.fileID= included.dflt.defs.fileID= rtrn->id;
included.merge= included.dflt.defs.merge= MergeOverride;
+ if (stmt->modifier) {
+ included.explicit_group= atoi(stmt->modifier) - 1;
+ } else {
+ included.explicit_group= info->explicit_group;
+ }
(*hndlr)(rtrn,xkb,MergeOverride,&included);
if (stmt->stmt!=NULL) {
if (included.name!=NULL)
@@ -756,15 +701,20 @@ Bool haveSelf;
for (next=stmt->next;next!=NULL;next=next->next) {
if ((next->file==NULL)&&(next->map==NULL)) {
haveSelf= True;
- MergeIncludedSymbols(&included,info,next->merge);
+ MergeIncludedSymbols(&included,info,next->merge,xkb);
FreeSymbolsInfo(info);
}
else if (ProcessIncludeFile(next,XkmSymbolsIndex,&rtrn,&op)) {
InitSymbolsInfo(&next_incl,xkb);
next_incl.fileID= next_incl.dflt.defs.fileID= rtrn->id;
next_incl.merge= next_incl.dflt.defs.merge= MergeOverride;
+ if (next->modifier) {
+ next_incl.explicit_group= atoi(next->modifier) - 1;
+ } else {
+ next_incl.explicit_group= info->explicit_group;
+ }
(*hndlr)(rtrn,xkb,MergeOverride,&next_incl);
- MergeIncludedSymbols(&included,&next_incl,op);
+ MergeIncludedSymbols(&included,&next_incl,op,xkb);
FreeSymbolsInfo(&next_incl);
}
else {
@@ -776,7 +726,7 @@ Bool haveSelf;
if (haveSelf)
*info= included;
else {
- MergeIncludedSymbols(info,&included,newMerge);
+ MergeIncludedSymbols(info,&included,newMerge,xkb);
FreeSymbolsInfo(&included);
}
return (info->errorCount==0);
@@ -799,18 +749,10 @@ static LookupEntry groupNames[]= {
#define ACTIONS 2
static Bool
-#if NeedFunctionPrototypes
GetGroupIndex( KeyInfo * key,
ExprDef * arrayNdx,
unsigned what,
unsigned * ndx_rtrn)
-#else
-GetGroupIndex(key,arrayNdx,what,ndx_rtrn)
- KeyInfo * key;
- ExprDef * arrayNdx;
- unsigned what;
- unsigned * ndx_rtrn;
-#endif
{
char * name;
ExprResult tmp;
@@ -854,22 +796,12 @@ ExprResult tmp;
}
static Bool
-#if NeedFunctionPrototypes
AddSymbolsToKey( KeyInfo * key,
XkbDescPtr xkb,
char * field,
ExprDef * arrayNdx,
ExprDef * value,
SymbolsInfo * info)
-#else
-AddSymbolsToKey(key,xkb,field,arrayNdx,value,info)
- KeyInfo * key;
- XkbDescPtr xkb;
- char * field;
- ExprDef * arrayNdx;
- ExprDef * value;
- SymbolsInfo * info;
-#endif
{
unsigned ndx,nSyms;
int i;
@@ -903,8 +835,6 @@ int i;
key->symsDefined|= (1<<ndx);
memcpy((char *)key->syms[ndx],(char *)value->value.list.syms,
nSyms*sizeof(KeySym));
- uFree(value->value.list.syms);
- value->value.list.syms= NULL;
for (i=key->numLevels[ndx]-1;(i>=0)&&(key->syms[ndx][i]==NoSymbol);i--) {
key->numLevels[ndx]--;
}
@@ -912,22 +842,12 @@ int i;
}
static Bool
-#if NeedFunctionPrototypes
AddActionsToKey( KeyInfo * key,
XkbDescPtr xkb,
char * field,
ExprDef * arrayNdx,
ExprDef * value,
SymbolsInfo * info)
-#else
-AddActionsToKey(key,xkb,field,arrayNdx,value,info)
- KeyInfo * key;
- XkbDescPtr xkb;
- char * field;
- ExprDef * arrayNdx;
- ExprDef * value;
- SymbolsInfo * info;
-#endif
{
register int i;
unsigned ndx,nActs;
@@ -983,14 +903,7 @@ XkbAnyAction * toAct;
}
static int
-#if NeedFunctionPrototypes
SetAllowNone(KeyInfo *key,ExprDef *arrayNdx,ExprDef *value)
-#else
-SetAllowNone(key,arrayNdx,value)
- KeyInfo * key;
- ExprDef * arrayNdx;
- ExprDef * value;
-#endif
{
ExprResult tmp;
unsigned radio_groups= 0;
@@ -1052,22 +965,12 @@ static LookupEntry rgEntries[]= {
};
static Bool
-#if NeedFunctionPrototypes
SetSymbolsField( KeyInfo * key,
XkbDescPtr xkb,
char * field,
ExprDef * arrayNdx,
ExprDef * value,
SymbolsInfo * info)
-#else
-SetSymbolsField(key,xkb,field,arrayNdx,value,info)
- KeyInfo * key;
- XkbDescPtr xkb;
- char * field;
- ExprDef * arrayNdx;
- ExprDef * value;
- SymbolsInfo * info;
-#endif
{
Bool ok= True;
ExprResult tmp;
@@ -1271,14 +1174,7 @@ ExprResult tmp;
}
static int
-#if NeedFunctionPrototypes
SetGroupName(SymbolsInfo *info,ExprDef *arrayNdx,ExprDef *value)
-#else
-SetGroupName(info,arrayNdx,value)
- SymbolsInfo * info;
- ExprDef * arrayNdx;
- ExprDef * value;
-#endif
{
ExprResult tmp,name;
@@ -1303,19 +1199,14 @@ ExprResult tmp,name;
ACTION1("Illegal name for group %d ignored\n",tmp.uval);
return False;
}
- info->groupNames[tmp.uval-1]= XkbInternAtom(NULL,name.str,False);
+ info->groupNames[tmp.uval-1+info->explicit_group]=
+ XkbInternAtom(NULL,name.str,False);
+
return True;
}
static int
-#if NeedFunctionPrototypes
HandleSymbolsVar(VarDef *stmt,XkbDescPtr xkb,SymbolsInfo *info)
-#else
-HandleSymbolsVar(stmt,xkb,info)
- VarDef * stmt;
- XkbDescPtr xkb;
- SymbolsInfo * info;
-#endif
{
ExprResult elem,field,tmp;
ExprDef * arrayNdx;
@@ -1377,18 +1268,10 @@ ExprDef * arrayNdx;
}
static Bool
-#if NeedFunctionPrototypes
HandleSymbolsBody( VarDef * def,
XkbDescPtr xkb,
KeyInfo * key,
SymbolsInfo * info)
-#else
-HandleSymbolsBody(def,xkb,key,info)
- VarDef * def;
- XkbDescPtr xkb;
- KeyInfo * key;
- SymbolsInfo * info;
-#endif
{
Bool ok= True;
ExprResult tmp,field;
@@ -1416,19 +1299,50 @@ ExprDef * arrayNdx;
return ok;
}
+static Bool
+SetExplicitGroup( SymbolsInfo * info,
+ KeyInfo * key)
+{
+ unsigned group = info->explicit_group;
+
+ if (group == 0)
+ return True;
+
+ if ((key->typesDefined|key->symsDefined|key->actsDefined) & ~1) {
+ int i;
+ WARN1("For the map %s an explicit group specified\n", info->name);
+ WARN1("but key %s has more than one group defined\n",
+ longText(key->name,XkbMessage));
+ ACTION("All groups except first one will be ignored\n");
+ for (i = 1; i < XkbNumKbdGroups ; i++) {
+ key->numLevels[i]= 0;
+ if (key->syms[i]!=NULL)
+ uFree(key->syms[i]);
+ key->syms[i]= (KeySym*) NULL;
+ if (key->acts[i]!=NULL)
+ uFree(key->acts[i]);
+ key->acts[i]= (XkbAction*) NULL;
+ key->types[i]= (Atom) 0;
+ }
+ }
+ key->typesDefined = key->symsDefined = key->actsDefined = 1 << group;
+
+ key->numLevels[group]= key->numLevels[0];
+ key->numLevels[0]= 0;
+ key->syms[group]= key->syms[0];
+ key->syms[0]= (KeySym*) NULL;
+ key->acts[group]= key->acts[0];
+ key->acts[0]= (XkbAction*) NULL;
+ key->types[group]= key->types[0];
+ key->types[0]= (Atom) 0;
+ return True;
+}
+
static int
-#if NeedFunctionPrototypes
HandleSymbolsDef( SymbolsDef * stmt,
XkbDescPtr xkb,
unsigned merge,
SymbolsInfo * info)
-#else
-HandleSymbolsDef(stmt,xkb,merge,info)
- SymbolsDef * stmt;
- XkbDescPtr xkb;
- unsigned merge;
- SymbolsInfo * info;
-#endif
{
KeyInfo key;
@@ -1441,7 +1355,12 @@ KeyInfo key;
return False;
}
- if (!AddKeySymbols(info,&key)) {
+ if (!SetExplicitGroup(info,&key)) {
+ info->errorCount++;
+ return False;
+ }
+
+ if (!AddKeySymbols(info,&key,xkb)) {
info->errorCount++;
return False;
}
@@ -1449,18 +1368,10 @@ KeyInfo key;
}
static Bool
-#if NeedFunctionPrototypes
HandleModMapDef( ModMapDef * def,
XkbDescPtr xkb,
unsigned merge,
SymbolsInfo * info)
-#else
-HandleModMapDef(def,xkb,merge,info)
- ModMapDef * def;
- XkbDescPtr xkb;
- unsigned merge;
- SymbolsInfo * info;
-#endif
{
ExprDef * key;
ModMapEntry tmp;
@@ -1497,22 +1408,14 @@ Bool ok;
}
static void
-#if NeedFunctionPrototypes
HandleSymbolsFile( XkbFile * file,
XkbDescPtr xkb,
unsigned merge,
SymbolsInfo * info)
-#else
-HandleSymbolsFile(file,xkb,merge,info)
- XkbFile * file;
- XkbDescPtr xkb;
- unsigned merge;
- SymbolsInfo * info;
-#endif
{
ParseCommon *stmt;
- info->name= file->name;
+ info->name= uStringDup(file->name);
stmt= file->defs;
while (stmt) {
switch (stmt->stmtType) {
@@ -1565,14 +1468,7 @@ ParseCommon *stmt;
}
static Bool
-#if NeedFunctionPrototypes
FindKeyForSymbol(XkbDescPtr xkb,KeySym sym,unsigned int *kc_rtrn)
-#else
-FindKeyForSymbol(xkb,sym,kc_rtrn)
- XkbDescPtr xkb;
- KeySym sym;
- unsigned int * kc_rtrn;
-#endif
{
register int i, j;
register Bool gotOne;
@@ -1595,14 +1491,7 @@ register Bool gotOne;
}
static Bool
-#if NeedFunctionPrototypes
FindNamedType(XkbDescPtr xkb,Atom name,unsigned *type_rtrn)
-#else
-FindNamedType(xkb,name,type_rtrn)
- XkbDescPtr xkb;
- Atom name;
- unsigned * type_rtrn;
-#endif
{
register unsigned n;
@@ -1618,34 +1507,121 @@ register unsigned n;
}
static Bool
-#if NeedFunctionPrototypes
FindAutomaticType(int width,KeySym *syms,Atom *typeNameRtrn)
-#else
-FindAutomaticType(width,syms,typeNameRtrn)
- int width;
- KeySym * syms;
- Atom * typeNameRtrn;
-#endif
{
- if ((width==1)||(width==0))
+ if ((width==1)||(width==0)) {
*typeNameRtrn= XkbInternAtom(NULL,"ONE_LEVEL",False);
- else if ( syms && XkbKSIsLower(syms[0]) && XkbKSIsUpper(syms[1]) )
- *typeNameRtrn= XkbInternAtom(NULL,"ALPHABETIC",False);
- else if ( syms && (XkbKSIsKeypad(syms[0]) || XkbKSIsKeypad(syms[1])) )
- *typeNameRtrn= XkbInternAtom(NULL,"KEYPAD",False);
- else *typeNameRtrn= XkbInternAtom(NULL,"TWO_LEVEL",False);
- return ((width>=0)&&(width<=2));
+ } else if (width == 2) {
+ if ( syms && XkbKSIsLower(syms[0]) && XkbKSIsUpper(syms[1]) )
+ *typeNameRtrn= XkbInternAtom(NULL,"ALPHABETIC",False);
+ else if ( syms && (XkbKSIsKeypad(syms[0]) || XkbKSIsKeypad(syms[1])) )
+ *typeNameRtrn= XkbInternAtom(NULL,"KEYPAD",False);
+ else *typeNameRtrn= XkbInternAtom(NULL,"TWO_LEVEL",False);
+ } else if (width <= 4 ) {
+ if ( syms && XkbKSIsLower(syms[0]) && XkbKSIsUpper(syms[1]) )
+ *typeNameRtrn= XkbInternAtom(NULL,
+ "FOUR_LEVEL_ALPHABETIC",False);
+ else if ( syms && (XkbKSIsKeypad(syms[0]) || XkbKSIsKeypad(syms[1])) )
+ *typeNameRtrn= XkbInternAtom(NULL,
+ "FOUR_LEVEL_KEYPAD",False);
+ else *typeNameRtrn= XkbInternAtom(NULL,"FOUR_LEVEL",False);
+ }
+ return ((width>=0)&&(width<=4));
+}
+
+static void
+PrepareKeyDef(KeyInfo *key)
+{
+ int i, j, width, defined, lastGroup;
+ Bool identical;
+
+ defined = key->symsDefined | key->actsDefined | key->typesDefined;
+ for (i = XkbNumKbdGroups - 1; i >= 0; i--) {
+ if (defined & (1<<i))
+ break;
+ }
+ lastGroup = i;
+
+ if (lastGroup == 0)
+ return;
+
+ /* If there are empty groups between non-empty ones fill them with data */
+ /* from the first group. */
+ /* We can make a wrong assumption here. But leaving gaps is worse. */
+ for (i = lastGroup; i > 0; i--) {
+ if (defined & (1<<i))
+ continue;
+ width = key->numLevels[0];
+ if (key->typesDefined & 1) {
+ for (j = 0; j < width; j++) {
+ key->types[i] = key->types[0];
+ }
+ key->typesDefined |= 1 << i;
+ }
+ if (key->actsDefined & 1) {
+ key->acts[i]= uTypedCalloc(width, XkbAction);
+ if (key->acts[i] == NULL)
+ continue;
+ memcpy((void *) key->acts[i], (void *) key->acts[0],
+ width * sizeof(XkbAction));
+ key->actsDefined |= 1 << i;
+ }
+ if (key->symsDefined & 1) {
+ key->syms[i]= uTypedCalloc(width, KeySym);
+ if (key->syms[i] == NULL)
+ continue;
+ memcpy((void *) key->syms[i], (void *) key->syms[0],
+ width * sizeof(KeySym));
+ key->symsDefined |= 1 << i;
+ }
+ if (defined & 1) {
+ key->numLevels[i] = key->numLevels[0];
+ }
+ }
+ /* If all groups are completely identical remove them all */
+ /* exept the first one. */
+ identical = True;
+ for (i = lastGroup; i > 0; i--) {
+ if ((key->numLevels[i] != key->numLevels[0]) ||
+ (key->types[i] != key->types[0])) {
+ identical = False;
+ break;
+ }
+ if ((key->syms[i] != key->syms[0]) &&
+ (key->syms[i] == NULL || key->syms[0] == NULL ||
+ memcmp((void*) key->syms[i], (void*) key->syms[0],
+ sizeof(KeySym) * key->numLevels[0])) ) {
+ identical = False;
+ break;
+ }
+ if ((key->acts[i] != key->acts[0]) &&
+ (key->acts[i] == NULL || key->acts[0] == NULL ||
+ memcmp((void*) key->acts[i], (void*) key->acts[0],
+ sizeof(XkbAction) * key->numLevels[0]))) {
+ identical = False;
+ break;
+ }
+ }
+ if (identical) {
+ for (i = lastGroup; i > 0; i--) {
+ key->numLevels[i]= 0;
+ if (key->syms[i] != NULL)
+ uFree(key->syms[i]);
+ key->syms[i]= (KeySym*) NULL;
+ if (key->acts[i] != NULL)
+ uFree(key->acts[i]);
+ key->acts[i]= (XkbAction*) NULL;
+ key->types[i]= (Atom) 0;
+ }
+ key->symsDefined &= 1;
+ key->actsDefined &= 1;
+ key->typesDefined &= 1;
+ }
+ return;
}
static Bool
-#if NeedFunctionPrototypes
CopySymbolsDef(XkbFileInfo *result,KeyInfo *key,int start_from)
-#else
-CopySymbolsDef(result,key,start_from)
- XkbFileInfo * result;
- KeyInfo * key;
- int start_from;
-#endif
{
register int i;
unsigned okc,kc,width,tmp,nGroups;
@@ -1695,7 +1671,7 @@ unsigned types[XkbNumKbdGroups];
}
}
if (FindNamedType(xkb,key->types[i],&types[i])) {
- if (!autoType)
+ if (!autoType || key->numLevels[i] > 2)
xkb->server->explicit[kc]|= (1<<i);
}
else {
@@ -1803,13 +1779,7 @@ unsigned types[XkbNumKbdGroups];
}
static Bool
-#if NeedFunctionPrototypes
CopyModMapDef(XkbFileInfo *result,ModMapEntry *entry)
-#else
-CopyModMapDef(result,entry)
- XkbFileInfo * result;
- ModMapEntry * entry;
-#endif
{
unsigned kc;
XkbDescPtr xkb;
@@ -1841,14 +1811,7 @@ XkbDescPtr xkb;
}
Bool
-#if NeedFunctionPrototypes
CompileSymbols(XkbFile *file,XkbFileInfo *result,unsigned merge)
-#else
-CompileSymbols(file,result,merge)
- XkbFile * file;
- XkbFileInfo * result;
- unsigned merge;
-#endif
{
register int i;
SymbolsInfo info;
@@ -1860,6 +1823,8 @@ XkbDescPtr xkb;
info.dflt.defs.merge= merge;
HandleSymbolsFile(file,xkb,merge,&info);
+ if (info.nKeys == 0)
+ return True;
if (info.errorCount==0) {
KeyInfo *key;
if (XkbAllocNames(xkb,XkbSymbolsNameMask|XkbGroupNamesMask,0,0)
@@ -1891,6 +1856,9 @@ XkbDescPtr xkb;
xkb->names->groups[i]= info.groupNames[i];
}
for (key=info.keys,i=0;i<info.nKeys;i++,key++) {
+ PrepareKeyDef(key);
+ }
+ for (key=info.keys,i=0;i<info.nKeys;i++,key++) {
if (!CopySymbolsDef(result,key,0))
info.errorCount++;
}