summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaleb Keithley <kaleb@freedesktop.org>2003-11-14 16:49:22 +0000
committerKaleb Keithley <kaleb@freedesktop.org>2003-11-14 16:49:22 +0000
commit287ac4c6af61d8f9f95cd3b3219c979e1329a2fe (patch)
tree8e4ea351343b9404a9724600e98d417794c14c4b
parent262961d88faf67f69f4630acb8234a4f2c5a6e80 (diff)
downloadxorg-app-xkbcomp-287ac4c6af61d8f9f95cd3b3219c979e1329a2fe.tar.gz
-rw-r--r--action.c255
-rw-r--r--action.h9
-rw-r--r--alias.c43
-rw-r--r--alias.h9
-rw-r--r--compat.c136
-rw-r--r--expr.c145
-rw-r--r--expr.h47
-rw-r--r--geometry.c511
-rw-r--r--indicators.c58
-rw-r--r--indicators.h13
-rw-r--r--keycodes.c132
-rw-r--r--keycodes.h5
-rw-r--r--keymap.c8
-rw-r--r--keytypes.c198
-rw-r--r--listing.c46
-rw-r--r--misc.c110
-rw-r--r--misc.h33
-rw-r--r--parseutils.c230
-rw-r--r--parseutils.h83
-rw-r--r--symbols.c430
-rw-r--r--utils.c243
-rw-r--r--utils.h257
-rw-r--r--vmod.c53
-rw-r--r--vmod.h18
-rw-r--r--xkbcomp.c87
-rw-r--r--xkbcomp.h48
-rw-r--r--xkbcomp.man24
-rw-r--r--xkbparse.y24
-rw-r--r--xkbpath.c77
-rw-r--r--xkbpath.h24
-rw-r--r--xkbscan.c47
31 files changed, 563 insertions, 2840 deletions
diff --git a/action.c b/action.c
index bc2b281..af0648e 100644
--- a/action.c
+++ b/action.c
@@ -24,6 +24,7 @@
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/xkbcomp/action.c,v 3.11 2002/11/22 22:56:04 tsi Exp $ */
#include "xkbcomp.h"
#include "tokens.h"
@@ -31,6 +32,7 @@
#include "keycodes.h"
#include "vmod.h"
+#include "misc.h"
#include "action.h"
#include "misc.h"
@@ -41,13 +43,7 @@ static ExprDef constFalse;
/***====================================================================***/
static Bool
-#if NeedFunctionPrototypes
stringToAction(char *str,unsigned *type_rtrn)
-#else
-stringToAction(str,type_rtrn)
- char * str;
- unsigned * type_rtrn;
-#endif
{
if (str==NULL)
return False;
@@ -108,13 +104,7 @@ stringToAction(str,type_rtrn)
}
static Bool
-#if NeedFunctionPrototypes
stringToField(char *str,unsigned *field_rtrn)
-#else
-stringToField(str,field_rtrn)
- char * str;
- unsigned * field_rtrn;
-#endif
{
if (str==NULL)
@@ -159,12 +149,7 @@ stringToField(str,field_rtrn)
}
static char *
-#if NeedFunctionPrototypes
fieldText(unsigned field)
-#else
-fieldText(field)
- unsigned field;
-#endif
{
static char buf[32];
@@ -200,14 +185,7 @@ static char buf[32];
/***====================================================================***/
static Bool
-#if NeedFunctionPrototypes
ReportMismatch(unsigned action,unsigned field,char *type)
-#else
-ReportMismatch(action,field,type)
- unsigned action;
- unsigned field;
- char * type;
-#endif
{
ERROR2("Value of %s field must be of type %s\n",fieldText(field),type);
ACTION1("Action %s definition ignored\n",
@@ -216,13 +194,7 @@ ReportMismatch(action,field,type)
}
static Bool
-#if NeedFunctionPrototypes
ReportIllegal(unsigned action,unsigned field)
-#else
-ReportIllegal(action,field)
- unsigned action;
- unsigned field;
-#endif
{
ERROR2("Field %s is not defined for an action of type %s\n",
fieldText(field),
@@ -232,13 +204,7 @@ ReportIllegal(action,field)
}
static Bool
-#if NeedFunctionPrototypes
ReportActionNotArray(unsigned action,unsigned field)
-#else
-ReportActionNotArray(action,field)
- unsigned action;
- unsigned field;
-#endif
{
ERROR2("The %s field in the %s action is not an array\n",
fieldText(field),
@@ -248,15 +214,7 @@ ReportActionNotArray(action,field)
}
static Bool
-#if NeedFunctionPrototypes
ReportNotFound(unsigned action,unsigned field,char *what,char *bad)
-#else
-ReportNotFound(action,field,what,bad)
- unsigned action;
- unsigned field;
- char * what;
- char * bad;
-#endif
{
ERROR2("%s named %s not found\n",what,bad);
ACTION2("Ignoring the %s field of an %s action\n",fieldText(field),
@@ -265,37 +223,20 @@ ReportNotFound(action,field,what,bad)
}
static Bool
-#if NeedFunctionPrototypes
HandleNoAction( XkbDescPtr xkb,
XkbAnyAction * action,
unsigned field,
ExprDef * array_ndx,
ExprDef * value)
-#else
-HandleNoAction(xkb,action,field,array_ndx,value)
- XkbDescPtr xkb;
- XkbAnyAction * action;
- unsigned field;
- ExprDef * array_ndx;
- ExprDef * value;
-#endif
{
return ReportIllegal(action->type,field);
}
static Bool
-#if NeedFunctionPrototypes
CheckLatchLockFlags( unsigned action,
unsigned field,
ExprDef * value,
unsigned * flags_inout)
-#else
-CheckLatchLockFlags(action,field,value,flags_inout)
- unsigned action;
- unsigned field;
- ExprDef * value;
- unsigned * flags_inout;
-#endif
{
unsigned tmp;
ExprResult result;
@@ -311,20 +252,11 @@ ExprResult result;
}
static Bool
-#if NeedFunctionPrototypes
CheckModifierField( XkbDescPtr xkb,
unsigned action,
ExprDef * value,
unsigned * flags_inout,
unsigned * mods_rtrn)
-#else
-CheckModifierField(xkb,action,value,flags_inout,mods_rtrn)
- XkbDescPtr xkb;
- unsigned action;
- ExprDef * value;
- unsigned * flags_inout;
- unsigned * mods_rtrn;
-#endif
{
ExprResult rtrn;
@@ -347,20 +279,11 @@ ExprResult rtrn;
}
static Bool
-#if NeedFunctionPrototypes
HandleSetLatchMods( XkbDescPtr xkb,
XkbAnyAction * action,
unsigned field,
ExprDef * array_ndx,
ExprDef * value)
-#else
-HandleSetLatchMods(xkb,action,field,array_ndx,value)
- XkbDescPtr xkb;
- XkbAnyAction * action;
- unsigned field;
- ExprDef * array_ndx;
- ExprDef * value;
-#endif
{
XkbModAction * act;
unsigned rtrn;
@@ -398,20 +321,11 @@ unsigned t1,t2;
}
static Bool
-#if NeedFunctionPrototypes
HandleLockMods( XkbDescPtr xkb,
XkbAnyAction * action,
unsigned field,
ExprDef * array_ndx,
ExprDef * value)
-#else
-HandleLockMods(xkb,action,field,array_ndx,value)
- XkbDescPtr xkb;
- XkbAnyAction * action;
- unsigned field;
- ExprDef * array_ndx;
- ExprDef * value;
-#endif
{
XkbModAction * act;
unsigned t1,t2;
@@ -447,18 +361,10 @@ static LookupEntry groupNames[] = {
};
static Bool
-#if NeedFunctionPrototypes
CheckGroupField( unsigned action,
ExprDef * value,
unsigned * flags_inout,
int * grp_rtrn)
-#else
-CheckGroupField(action,value,flags_inout,grp_rtrn)
- unsigned action;
- ExprDef * value;
- unsigned * flags_inout;
- int * grp_rtrn;
-#endif
{
ExprDef * spec;
ExprResult rtrn;
@@ -488,20 +394,11 @@ ExprResult rtrn;
}
static Bool
-#if NeedFunctionPrototypes
HandleSetLatchGroup( XkbDescPtr xkb,
XkbAnyAction * action,
unsigned field,
ExprDef * array_ndx,
ExprDef * value)
-#else
-HandleSetLatchGroup(xkb,action,field,array_ndx,value)
- XkbDescPtr xkb;
- XkbAnyAction * action;
- unsigned field;
- ExprDef * array_ndx;
- ExprDef * value;
-#endif
{
XkbGroupAction * act;
unsigned rtrn;
@@ -538,20 +435,11 @@ int t2;
}
static Bool
-#if NeedFunctionPrototypes
HandleLockGroup( XkbDescPtr xkb,
XkbAnyAction * action,
unsigned field,
ExprDef * array_ndx,
ExprDef * value)
-#else
-HandleLockGroup(xkb,action,field,array_ndx,value)
- XkbDescPtr xkb;
- XkbAnyAction * action;
- unsigned field;
- ExprDef * array_ndx;
- ExprDef * value;
-#endif
{
XkbGroupAction * act;
unsigned t1;
@@ -573,20 +461,11 @@ int t2;
}
static Bool
-#if NeedFunctionPrototypes
HandleMovePtr( XkbDescPtr xkb,
XkbAnyAction * action,
unsigned field,
ExprDef * array_ndx,
ExprDef * value)
-#else
-HandleMovePtr(xkb,action,field,array_ndx,value)
- XkbDescPtr xkb;
- XkbAnyAction * action;
- unsigned field;
- ExprDef * array_ndx;
- ExprDef * value;
-#endif
{
ExprResult rtrn;
XkbPtrAction * act;
@@ -642,20 +521,11 @@ static LookupEntry lockWhich[] = {
};
static Bool
-#if NeedFunctionPrototypes
HandlePtrBtn( XkbDescPtr xkb,
XkbAnyAction * action,
unsigned field,
ExprDef * array_ndx,
ExprDef * value)
-#else
-HandlePtrBtn(xkb,action,field,array_ndx,value)
- XkbDescPtr xkb;
- XkbAnyAction * action;
- unsigned field;
- ExprDef * array_ndx;
- ExprDef * value;
-#endif
{
ExprResult rtrn;
XkbPtrBtnAction * act;
@@ -707,20 +577,11 @@ static LookupEntry ptrDflts[] = {
};
static Bool
-#if NeedFunctionPrototypes
HandleSetPtrDflt( XkbDescPtr xkb,
XkbAnyAction * action,
unsigned field,
ExprDef * array_ndx,
ExprDef * value)
-#else
-HandleSetPtrDflt(xkb,action,field,array_ndx,value)
- XkbDescPtr xkb;
- XkbAnyAction * action;
- unsigned field;
- ExprDef * array_ndx;
- ExprDef * value;
-#endif
{
ExprResult rtrn;
XkbPtrDfltAction * act;
@@ -782,20 +643,11 @@ static LookupEntry isoNames[] = {
};
static Bool
-#if NeedFunctionPrototypes
HandleISOLock( XkbDescPtr xkb,
XkbAnyAction * action,
unsigned field,
ExprDef * array_ndx,
ExprDef * value)
-#else
-HandleISOLock(xkb,action,field,array_ndx,value)
- XkbDescPtr xkb;
- XkbAnyAction * action;
- unsigned field;
- ExprDef * array_ndx;
- ExprDef * value;
-#endif
{
ExprResult rtrn;
XkbISOAction * act;
@@ -838,20 +690,11 @@ int group;
}
static Bool
-#if NeedFunctionPrototypes
HandleSwitchScreen( XkbDescPtr xkb,
XkbAnyAction * action,
unsigned field,
ExprDef * array_ndx,
ExprDef * value)
-#else
-HandleSwitchScreen(xkb,action,field,array_ndx,value)
- XkbDescPtr xkb;
- XkbAnyAction * action;
- unsigned field;
- ExprDef * array_ndx;
- ExprDef * value;
-#endif
{
ExprResult rtrn;
XkbSwitchScreenAction * act;
@@ -906,7 +749,6 @@ LookupEntry ctrlNames[]= {
{ "accessxkeys", XkbAccessXKeysMask },
{ "accessxtimeout", XkbAccessXTimeoutMask },
{ "accessxfeedback", XkbAccessXFeedbackMask },
- { "groupswrap", XkbGroupsWrapMask },
{ "audiblebell", XkbAudibleBellMask },
{ "overlay1", XkbOverlay1Mask },
{ "overlay2", XkbOverlay2Mask },
@@ -917,20 +759,11 @@ LookupEntry ctrlNames[]= {
};
static Bool
-#if NeedFunctionPrototypes
HandleSetLockControls( XkbDescPtr xkb,
XkbAnyAction * action,
unsigned field,
ExprDef * array_ndx,
ExprDef * value)
-#else
-HandleSetLockControls(xkb,action,field,array_ndx,value)
- XkbDescPtr xkb;
- XkbAnyAction * action;
- unsigned field;
- ExprDef * array_ndx;
- ExprDef * value;
-#endif
{
ExprResult rtrn;
XkbCtrlsAction * act;
@@ -958,20 +791,11 @@ static LookupEntry evNames[]= {
};
static Bool
-#if NeedFunctionPrototypes
HandleActionMessage( XkbDescPtr xkb,
XkbAnyAction * action,
unsigned field,
ExprDef * array_ndx,
ExprDef * value)
-#else
-HandleActionMessage(xkb,action,field,array_ndx,value)
- XkbDescPtr xkb;
- XkbAnyAction * action;
- unsigned field;
- ExprDef * array_ndx;
- ExprDef * value;
-#endif
{
ExprResult rtrn;
XkbMessageAction * act;
@@ -1036,20 +860,11 @@ XkbMessageAction * act;
}
static Bool
-#if NeedFunctionPrototypes
HandleRedirectKey( XkbDescPtr xkb,
XkbAnyAction * action,
unsigned field,
ExprDef * array_ndx,
ExprDef * value)
-#else
-HandleRedirectKey(xkb,action,field,array_ndx,value)
- XkbDescPtr xkb;
- XkbAnyAction * action;
- unsigned field;
- ExprDef * array_ndx;
- ExprDef * value;
-#endif
{
ExprResult rtrn;
XkbRedirectKeyAction * act;
@@ -1097,20 +912,11 @@ unsigned long tmp;
}
static Bool
-#if NeedFunctionPrototypes
HandleDeviceBtn( XkbDescPtr xkb,
XkbAnyAction * action,
unsigned field,
ExprDef * array_ndx,
ExprDef * value)
-#else
-HandleDeviceBtn(xkb,action,field,array_ndx,value)
- XkbDescPtr xkb;
- XkbAnyAction * action;
- unsigned field;
- ExprDef * array_ndx;
- ExprDef * value;
-#endif
{
ExprResult rtrn;
XkbDeviceBtnAction * act;
@@ -1168,20 +974,28 @@ XkbDeviceBtnAction * act;
}
static Bool
-#if NeedFunctionPrototypes
+HandleDeviceValuator( XkbDescPtr xkb,
+ XkbAnyAction * action,
+ unsigned field,
+ ExprDef * array_ndx,
+ ExprDef * value)
+{
+#if 0
+ExprResult rtrn;
+XkbDeviceValuatorAction * act;
+
+ act= (XkbDeviceValuatorAction *)action;
+ /* XXX - Not yet implemented */
+#endif
+ return False;
+}
+
+static Bool
HandlePrivate( XkbDescPtr xkb,
XkbAnyAction * action,
unsigned field,
ExprDef * array_ndx,
ExprDef * value)
-#else
-HandlePrivate(xkb,action,field,array_ndx,value)
- XkbDescPtr xkb;
- XkbAnyAction * action;
- unsigned field;
- ExprDef * array_ndx;
- ExprDef * value;
-#endif
{
ExprResult rtrn;
@@ -1239,13 +1053,11 @@ ExprResult rtrn;
}
typedef Bool (*actionHandler)(
-#if NeedFunctionPrototypes
XkbDescPtr /* xkb */,
XkbAnyAction * /* action */,
unsigned /* field */,
ExprDef * /* array_ndx */,
ExprDef * /* value */
-#endif
);
static actionHandler handleAction[XkbSA_NumActions+1] = {
@@ -1269,18 +1081,14 @@ static actionHandler handleAction[XkbSA_NumActions+1] = {
HandleRedirectKey /* RedirectKey */,
HandleDeviceBtn /* DeviceBtn */,
HandleDeviceBtn /* LockDeviceBtn*/,
+ HandleDeviceValuator /* DeviceValuatr*/,
HandlePrivate /* Private */
};
/***====================================================================***/
static void
-#if NeedFunctionPrototypes
ApplyActionFactoryDefaults(XkbAction *action)
-#else
-ApplyActionFactoryDefaults(action)
- XkbAction * action;
-#endif
{
if (action->type==XkbSA_SetPtrDflt) { /* increment default button */
action->dflt.affect= XkbSA_AffectDfltBtn;
@@ -1295,20 +1103,11 @@ ApplyActionFactoryDefaults(action)
int
-#if NeedFunctionPrototypes
HandleActionDef( ExprDef * def,
XkbDescPtr xkb,
XkbAnyAction * action,
unsigned mergeMode,
ActionInfo * info)
-#else
-HandleActionDef(def,xkb,action,mergeMode,info)
- ExprDef * def;
- XkbDescPtr xkb;
- XkbAnyAction * action;
- unsigned mergeMode;
- ActionInfo * info;
-#endif
{
ExprDef * arg;
register char * str;
@@ -1386,22 +1185,12 @@ unsigned tmp,hndlrType;
/***====================================================================***/
int
-#if NeedFunctionPrototypes
SetActionField( XkbDescPtr xkb,
char * elem,
char * field,
ExprDef * array_ndx,
ExprDef * value,
ActionInfo ** info_rtrn)
-#else
-SetActionField(xkb,elem,field,array_ndx,value,info_rtrn)
- XkbDescPtr xkb;
- char * elem;
- char * field;
- ExprDef * array_ndx;
- ExprDef * value;
- ActionInfo ** info_rtrn;
-#endif
{
ActionInfo *new,*old;
@@ -1441,11 +1230,7 @@ ActionInfo *new,*old;
/***====================================================================***/
void
-#if NeedFunctionPrototypes
ActionsInit(void)
-#else
-ActionsInit()
-#endif
{
if (!actionsInitialized) {
bzero((char *)&constTrue,sizeof(constTrue));
diff --git a/action.h b/action.h
index f588ff4..c442a41 100644
--- a/action.h
+++ b/action.h
@@ -24,6 +24,7 @@
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/xkbcomp/action.h,v 3.3 2002/07/01 02:26:00 tsi Exp $ */
#ifndef ACTION_H
#define ACTION_H 1
@@ -65,30 +66,26 @@ typedef struct _ActionInfo {
} ActionInfo;
extern int HandleActionDef(
-#if NeedFunctionPrototypes
ExprDef * /* def */,
XkbDescPtr /* xkb */,
XkbAnyAction * /* action */,
unsigned /* mergeMode */,
ActionInfo * /* info */
-#endif
);
extern int SetActionField(
-#if NeedFunctionPrototypes
XkbDescPtr /* xkb */,
char * /* elem */,
char * /* field */,
ExprDef * /* index */,
ExprDef * /* value */,
ActionInfo ** /* info_rtrn */
-#endif
);
extern void ActionsInit(
-#if NeedFunctionPrototypes
void
-#endif
);
+extern LookupEntry ctrlNames[];
+
#endif /* ACTION_H */
diff --git a/alias.c b/alias.c
index dc51b82..3447341 100644
--- a/alias.c
+++ b/alias.c
@@ -24,6 +24,7 @@
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/xkbcomp/alias.c,v 1.5 2002/07/01 02:26:00 tsi Exp $ */
#include "xkbcomp.h"
#include "misc.h"
@@ -33,13 +34,7 @@
#include <X11/extensions/XKBgeom.h>
static void
-#if NeedFunctionPrototypes
HandleCollision(AliasInfo *old,AliasInfo *new)
-#else
-HandleCollision(old,new)
- AliasInfo * old;
- AliasInfo * new;
-#endif
{
if (strncmp(new->real,old->real,XkbKeyNameLength)==0) {
if (((new->def.fileID==old->def.fileID)&&(warningLevel>0))||
@@ -76,20 +71,11 @@ HandleCollision(old,new)
}
static void
-#if NeedFunctionPrototypes
InitAliasInfo( AliasInfo * info,
unsigned merge,
unsigned file_id,
char * alias,
char * real)
-#else
-InitAliasInfo(info,merge,file_id,alias,real)
- AliasInfo * info;
- unsigned merge;
- unsigned file_id;
- char * alias;
- char * real;
-#endif
{
bzero(info,sizeof(AliasInfo));
info->def.merge= merge;
@@ -100,18 +86,10 @@ InitAliasInfo(info,merge,file_id,alias,real)
}
int
-#if NeedFunctionPrototypes
HandleAliasDef( KeyAliasDef * def,
unsigned merge,
unsigned file_id,
AliasInfo ** info_in)
-#else
-HandleAliasDef(def,merge,file_id,info_in)
- KeyAliasDef * def;
- unsigned merge;
- unsigned file_id;
- AliasInfo ** info_in;
-#endif
{
AliasInfo * info;
@@ -138,12 +116,7 @@ AliasInfo * info;
}
void
-#if NeedFunctionPrototypes
ClearAliases(AliasInfo **info_in)
-#else
-ClearAliases(info_in)
- AliasInfo ** info_in;
-#endif
{
if ((info_in)&&(*info_in))
ClearCommonInfo(&(*info_in)->def);
@@ -151,14 +124,7 @@ ClearAliases(info_in)
}
Bool
-#if NeedFunctionPrototypes
MergeAliases(AliasInfo **into,AliasInfo **merge,unsigned how_merge)
-#else
-MergeAliases(into,merge,how_merge)
- AliasInfo ** into;
- AliasInfo ** merge;
- unsigned how_merge;
-#endif
{
AliasInfo * tmp;
KeyAliasDef def;
@@ -184,14 +150,7 @@ KeyAliasDef def;
}
int
-#if NeedFunctionPrototypes
ApplyAliases(XkbDescPtr xkb,Bool toGeom,AliasInfo **info_in)
-#else
-ApplyAliases(xkb,toGeom,info_in)
- XkbDescPtr xkb;
- Bool toGeom;
- AliasInfo ** info_in;
-#endif
{
register int i;
XkbKeyAliasPtr old,a;
diff --git a/alias.h b/alias.h
index 7c76083..b1a1905 100644
--- a/alias.h
+++ b/alias.h
@@ -24,6 +24,7 @@
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/xkbcomp/alias.h,v 1.3 2002/07/01 02:26:01 tsi Exp $ */
#ifndef ALIAS_H
#define ALIAS_H 1
@@ -35,34 +36,26 @@ typedef struct _AliasInfo {
} AliasInfo;
extern int HandleAliasDef(
-#if NeedFunctionPrototypes
KeyAliasDef * /* def */,
unsigned /* merge */,
unsigned /* file_id */,
AliasInfo ** /* info */
-#endif
);
extern void ClearAliases(
-#if NeedFunctionPrototypes
AliasInfo ** /* info */
-#endif
);
extern Bool MergeAliases(
-#if NeedFunctionPrototypes
AliasInfo ** /* into */,
AliasInfo ** /* merge */,
unsigned /* how_merge */
-#endif
);
extern int ApplyAliases(
-#if NeedFunctionPrototypes
XkbDescPtr /* xkb */,
Bool /* toGeom */,
AliasInfo ** /* info */
-#endif
);
#endif /* ALIAS_H */
diff --git a/compat.c b/compat.c
index 2b44523..5e28590 100644
--- a/compat.c
+++ b/compat.c
@@ -24,6 +24,7 @@
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/xkbcomp/compat.c,v 3.4 2002/06/05 00:00:37 dawes Exp $ */
#include <X11/Xos.h>
#include "xkbcomp.h"
@@ -77,13 +78,7 @@ typedef struct _CompatInfo {
/***====================================================================***/
static char *
-#if NeedFunctionPrototypes
siText(SymInterpInfo * si,CompatInfo * info)
-#else
-siText(si,info)
- SymInterpInfo * si;
- CompatInfo * info;
-#endif
{
static char buf[128];
@@ -99,13 +94,7 @@ static char buf[128];
}
static void
-#if NeedFunctionPrototypes
InitCompatInfo(CompatInfo *info,XkbDescPtr xkb)
-#else
-InitCompatInfo(info,xkb)
- CompatInfo * info;
- XkbDescPtr xkb;
-#endif
{
register int i;
@@ -136,13 +125,7 @@ register int i;
}
static void
-#if NeedFunctionPrototypes
ClearCompatInfo(CompatInfo *info,XkbDescPtr xkb)
-#else
-ClearCompatInfo(info,xkb)
- CompatInfo * info;
- XkbDescPtr xkb;
-#endif
{
register int i;
@@ -168,12 +151,7 @@ register int i;
}
static SymInterpInfo *
-#if NeedFunctionPrototypes
NextInterp(CompatInfo *info)
-#else
-NextInterp(info)
- CompatInfo * info;
-#endif
{
SymInterpInfo * si;
@@ -188,13 +166,7 @@ SymInterpInfo * si;
}
static SymInterpInfo *
-#if NeedFunctionPrototypes
FindMatchingInterp(CompatInfo *info,SymInterpInfo *new)
-#else
-FindMatchingInterp(info,new)
- CompatInfo * info;
- SymInterpInfo * new;
-#endif
{
SymInterpInfo * old;
@@ -209,13 +181,7 @@ SymInterpInfo * old;
}
static Bool
-#if NeedFunctionPrototypes
AddInterp(CompatInfo *info,SymInterpInfo *new)
-#else
-AddInterp(info,new)
- CompatInfo * info;
- SymInterpInfo * new;
-#endif
{
unsigned collide;
SymInterpInfo * old;
@@ -273,23 +239,15 @@ SymInterpInfo * old;
}
static Bool
-#if NeedFunctionPrototypes
AddGroupCompat(CompatInfo *info,unsigned group,GroupCompatInfo *newGC)
-#else
-AddGroupCompat(info,group,newGC)
- CompatInfo * info;
- unsigned group;
- GroupCompatInfo * newGC;
-#endif
{
GroupCompatInfo * gc;
unsigned merge;
merge= newGC->merge;
gc= &info->groupCompat[group];
- if ((gc->fileID<1)||
+ if ((newGC->fileID<1)||
((gc->real_mods==newGC->real_mods)&&(gc->vmods==newGC->vmods))) {
- *gc= *newGC;
return True;
}
if (((gc->fileID==newGC->fileID)&&(warningLevel>0))||(warningLevel>9)) {
@@ -304,18 +262,10 @@ unsigned merge;
/***====================================================================***/
static Bool
-#if NeedFunctionPrototypes
ResolveStateAndPredicate( ExprDef * expr,
unsigned * pred_rtrn,
unsigned * mods_rtrn,
CompatInfo * info)
-#else
-ResolveStateAndPredicate(expr,pred_rtrn,mods_rtrn,info)
- ExprDef * expr;
- unsigned * pred_rtrn;
- unsigned * mods_rtrn;
- CompatInfo * info;
-#endif
{
ExprResult result;
@@ -364,16 +314,9 @@ ExprResult result;
/***====================================================================***/
static void
-#if NeedFunctionPrototypes
MergeIncludedCompatMaps( CompatInfo * into,
CompatInfo * from,
unsigned merge)
-#else
-MergeIncludedCompatMaps(into,from,merge)
- CompatInfo * into;
- CompatInfo * from;
- unsigned merge;
-#endif
{
SymInterpInfo * si;
LEDInfo * led,*rtrn,*next;
@@ -413,27 +356,17 @@ register int i;
}
typedef void (*FileHandler)(
-#if NeedFunctionPrototypes
XkbFile * /* rtrn */,
XkbDescPtr /* xkb */,
unsigned /* merge */,
CompatInfo * /* info */
-#endif
);
static Bool
-#if NeedFunctionPrototypes
HandleIncludeCompatMap( IncludeStmt * stmt,
XkbDescPtr xkb,
CompatInfo * info,
FileHandler hndlr)
-#else
-HandleIncludeCompatMap(stmt,xkb,info,hndlr)
- IncludeStmt * stmt;
- XkbDescPtr xkb;
- CompatInfo * info;
- FileHandler hndlr;
-#endif
{
unsigned newMerge;
XkbFile * rtrn;
@@ -515,22 +448,12 @@ static LookupEntry useModMapValues[] = {
};
static int
-#if NeedFunctionPrototypes
SetInterpField( SymInterpInfo * si,
XkbDescPtr xkb,
char * field,
ExprDef * arrayNdx,
ExprDef * value,
CompatInfo * info)
-#else
-SetInterpField(si,xkb,field,arrayNdx,value,info)
- SymInterpInfo * si;
- XkbDescPtr xkb;
- char * field;
- ExprDef * arrayNdx;
- ExprDef * value;
- CompatInfo * info;
-#endif
{
int ok= 1;
ExprResult tmp;
@@ -608,14 +531,7 @@ LookupEntry groupNames[]= {
};
static int
-#if NeedFunctionPrototypes
HandleInterpVar(VarDef *stmt,XkbDescPtr xkb,CompatInfo *info)
-#else
-HandleInterpVar(stmt,xkb,info)
- VarDef * stmt;
- XkbDescPtr xkb;
- CompatInfo * info;
-#endif
{
ExprResult elem,field;
ExprDef * ndx;
@@ -632,15 +548,7 @@ ExprDef * ndx;
}
static int
-#if NeedFunctionPrototypes
HandleInterpBody(VarDef *def,XkbDescPtr xkb,SymInterpInfo *si,CompatInfo *info)
-#else
-HandleInterpBody(def,xkb,si,info)
- VarDef * def;
- XkbDescPtr xkb;
- SymInterpInfo * si;
- CompatInfo * info;
-#endif
{
int ok= 1;
ExprResult tmp,field;
@@ -659,15 +567,7 @@ ExprDef * arrayNdx;
}
static int
-#if NeedFunctionPrototypes
HandleInterpDef(InterpDef *def,XkbDescPtr xkb,unsigned merge,CompatInfo *info)
-#else
-HandleInterpDef(def,xkb,merge,info)
- InterpDef * def;
- XkbDescPtr xkb;
- unsigned merge;
- CompatInfo * info;
-#endif
{
unsigned pred,mods;
SymInterpInfo si;
@@ -698,18 +598,10 @@ SymInterpInfo si;
}
static int
-#if NeedFunctionPrototypes
HandleGroupCompatDef( GroupCompatDef * def,
XkbDescPtr xkb,
unsigned merge,
CompatInfo * info)
-#else
-HandleGroupCompatDef(def,xkb,merge,info)
- GroupCompatDef * def;
- XkbDescPtr xkb;
- unsigned merge;
- CompatInfo * info;
-#endif
{
ExprResult val;
GroupCompatInfo tmp;
@@ -734,18 +626,10 @@ GroupCompatInfo tmp;
}
static void
-#if NeedFunctionPrototypes
HandleCompatMapFile( XkbFile * file,
XkbDescPtr xkb,
unsigned merge,
CompatInfo * info)
-#else
-HandleCompatMapFile(file,xkb,merge,info)
- XkbFile *file;
- XkbDescPtr xkb;
- unsigned merge;
- CompatInfo *info;
-#endif
{
ParseCommon *stmt;
@@ -810,18 +694,10 @@ ParseCommon *stmt;
}
static void
-#if NeedFunctionPrototypes
CopyInterps( CompatInfo * info,
XkbCompatMapPtr compat,
Bool needSymbol,
unsigned pred)
-#else
-CopyInterps(info,compat,needSymbol,pred)
- CompatInfo * info;
- XkbCompatMapPtr compat;
- Bool needSymbol;
- unsigned pred;
-#endif
{
SymInterpInfo * si;
@@ -841,18 +717,10 @@ SymInterpInfo * si;
}
Bool
-#if NeedFunctionPrototypes
CompileCompatMap( XkbFile * file,
XkbFileInfo * result,
unsigned merge,
LEDInfo ** unboundLEDs)
-#else
-CompileCompatMap(file,result,merge,unboundLEDs)
- XkbFile * file;
- XkbFileInfo * result;
- unsigned merge;
- LEDInfo ** unboundLEDs;
-#endif
{
int i;
CompatInfo info;
diff --git a/expr.c b/expr.c
index 0e1bded..2b98266 100644
--- a/expr.c
+++ b/expr.c
@@ -24,6 +24,7 @@
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/xkbcomp/expr.c,v 3.6 2002/06/05 00:00:37 dawes Exp $ */
#include "xkbcomp.h"
#include "tokens.h"
@@ -34,12 +35,7 @@
/***====================================================================***/
char *
-#if NeedFunctionPrototypes
exprOpText(unsigned type)
-#else
-exprOpText(type)
- unsigned type;
-#endif
{
static char buf[32];
@@ -100,12 +96,7 @@ static char buf[32];
}
char *
-#if NeedFunctionPrototypes
exprTypeText(unsigned type)
-#else
-exprTypeText(type)
- unsigned type;
-#endif
{
static char buf[20];
@@ -136,18 +127,10 @@ static char buf[20];
}
int
-#if NeedFunctionPrototypes
ExprResolveLhs( ExprDef * expr,
ExprResult * elem_rtrn,
ExprResult * field_rtrn,
ExprDef ** index_rtrn)
-#else
-ExprResolveLhs(expr,elem_rtrn,field_rtrn,index_rtrn)
- ExprDef * expr;
- ExprResult * elem_rtrn;
- ExprResult * field_rtrn;
- ExprDef ** index_rtrn;
-#endif
{
switch (expr->op) {
case ExprIdent:
@@ -171,20 +154,11 @@ ExprResolveLhs(expr,elem_rtrn,field_rtrn,index_rtrn)
}
Bool
-#if NeedFunctionPrototypes
SimpleLookup( XPointer priv,
Atom elem,
Atom field,
unsigned type,
ExprResult * val_rtrn)
-#else
-SimpleLookup(priv,elem,field,type,val_rtrn)
- XPointer priv;
- Atom elem;
- Atom field;
- unsigned type;
- ExprResult * val_rtrn;
-#endif
{
LookupEntry * entry;
register char * str;
@@ -207,20 +181,11 @@ register char * str;
}
Bool
-#if NeedFunctionPrototypes
RadioLookup( XPointer priv,
Atom elem,
Atom field,
unsigned type,
ExprResult * val_rtrn)
-#else
-RadioLookup(priv,elem,field,type,val_rtrn)
- XPointer priv;
- Atom elem;
- Atom field;
- unsigned type;
- ExprResult * val_rtrn;
-#endif
{
register char * str;
int rg;
@@ -245,20 +210,11 @@ int rg;
}
int
-#if NeedFunctionPrototypes
TableLookup( XPointer priv,
Atom elem,
Atom field,
unsigned type,
ExprResult * val_rtrn)
-#else
-TableLookup(priv,elem,field,type,val_rtrn)
- XPointer priv;
- Atom elem;
- Atom field;
- unsigned type;
- ExprResult * val_rtrn;
-#endif
{
LookupTable * tbl= (LookupTable *)priv;
register char * str;
@@ -293,39 +249,21 @@ static LookupEntry modIndexNames[] = {
};
int
-#if NeedFunctionPrototypes
LookupModIndex( XPointer priv,
Atom elem,
Atom field,
unsigned type,
ExprResult * val_rtrn)
-#else
-LookupModIndex(priv,elem,field,type,val_rtrn)
- XPointer priv;
- Atom elem;
- Atom field;
- unsigned type;
- ExprResult * val_rtrn;
-#endif
{
return SimpleLookup((XPointer)modIndexNames,elem,field,type,val_rtrn);
}
int
-#if NeedFunctionPrototypes
LookupModMask( XPointer priv,
Atom elem,
Atom field,
unsigned type,
ExprResult * val_rtrn)
-#else
-LookupModMask(priv,elem,field,type,val_rtrn)
- XPointer priv;
- Atom elem;
- Atom field;
- unsigned type;
- ExprResult * val_rtrn;
-#endif
{
char *str;
@@ -351,18 +289,10 @@ char *str;
}
int
-#if NeedFunctionPrototypes
ExprResolveModIndex( ExprDef * expr,
ExprResult * val_rtrn,
IdentLookupFunc lookup,
XPointer lookupPriv)
-#else
-ExprResolveModIndex(expr,val_rtrn,lookup,lookupPriv)
- ExprDef * expr;
- ExprResult * val_rtrn;
- IdentLookupFunc lookup;
- XPointer lookupPriv;
-#endif
{
int ok= 0;
char *bogus= NULL;
@@ -429,18 +359,10 @@ char *bogus= NULL;
}
int
-#if NeedFunctionPrototypes
ExprResolveModMask( ExprDef * expr,
ExprResult * val_rtrn,
IdentLookupFunc lookup,
XPointer lookupPriv)
-#else
-ExprResolveModMask(expr,val_rtrn,lookup,lookupPriv)
- ExprDef * expr;
- ExprResult * val_rtrn;
- IdentLookupFunc lookup;
- XPointer lookupPriv;
-#endif
{
LookupPriv priv;
@@ -451,18 +373,10 @@ LookupPriv priv;
}
int
-#if NeedFunctionPrototypes
ExprResolveBoolean( ExprDef * expr,
ExprResult * val_rtrn,
IdentLookupFunc lookup,
XPointer lookupPriv)
-#else
-ExprResolveBoolean(expr,val_rtrn,lookup,lookupPriv)
- ExprDef * expr;
- ExprResult * val_rtrn;
- IdentLookupFunc lookup;
- XPointer lookupPriv;
-#endif
{
int ok= 0;
char * bogus= NULL;
@@ -537,18 +451,10 @@ char * bogus= NULL;
}
int
-#if NeedFunctionPrototypes
ExprResolveFloat( ExprDef * expr,
ExprResult * val_rtrn,
IdentLookupFunc lookup,
XPointer lookupPriv)
-#else
-ExprResolveFloat(expr,val_rtrn,lookup,lookupPriv)
- ExprDef * expr;
- ExprResult * val_rtrn;
- IdentLookupFunc lookup;
- XPointer lookupPriv;
-#endif
{
int ok= 0;
ExprResult leftRtrn,rightRtrn;
@@ -649,18 +555,10 @@ ExprDef *left,*right;
}
int
-#if NeedFunctionPrototypes
ExprResolveInteger( ExprDef * expr,
ExprResult * val_rtrn,
IdentLookupFunc lookup,
XPointer lookupPriv)
-#else
-ExprResolveInteger(expr,val_rtrn,lookup,lookupPriv)
- ExprDef * expr;
- ExprResult * val_rtrn;
- IdentLookupFunc lookup;
- XPointer lookupPriv;
-#endif
{
int ok= 0;
ExprResult leftRtrn,rightRtrn;
@@ -761,18 +659,10 @@ ExprDef *left,*right;
}
int
-#if NeedFunctionPrototypes
ExprResolveString( ExprDef * expr,
ExprResult * val_rtrn,
IdentLookupFunc lookup,
XPointer lookupPriv)
-#else
-ExprResolveString(expr,val_rtrn,lookup,lookupPriv)
- ExprDef * expr;
- ExprResult * val_rtrn;
- IdentLookupFunc lookup;
- XPointer lookupPriv;
-#endif
{
int ok= 0;
ExprResult leftRtrn,rightRtrn;
@@ -858,18 +748,10 @@ char * bogus= NULL;
}
int
-#if NeedFunctionPrototypes
ExprResolveKeyName( ExprDef * expr,
ExprResult * val_rtrn,
IdentLookupFunc lookup,
XPointer lookupPriv)
-#else
-ExprResolveKeyName(expr,val_rtrn,lookup,lookupPriv)
- ExprDef * expr;
- ExprResult * val_rtrn;
- IdentLookupFunc lookup;
- XPointer lookupPriv;
-#endif
{
int ok= 0;
ExprDef * left;
@@ -937,14 +819,7 @@ char * bogus= NULL;
/***====================================================================***/
int
-#if NeedFunctionPrototypes
ExprResolveEnum(ExprDef *expr,ExprResult *val_rtrn,LookupEntry *values)
-#else
-ExprResolveEnum(expr,val_rtrn,values)
- ExprDef * expr;
- ExprResult * val_rtrn;
- LookupEntry * values;
-#endif
{
if (expr->op!=ExprIdent) {
ERROR1("Found a %s where an enumerated value was expected\n",
@@ -959,6 +834,8 @@ ExprResolveEnum(expr,val_rtrn,values)
while (values && values->name) {
if (nOut!=0) INFO1(", %s",values->name);
else INFO1("%s",values->name);
+ values++;
+ nOut++;
}
INFO(")\n");
return False;
@@ -967,18 +844,10 @@ ExprResolveEnum(expr,val_rtrn,values)
}
int
-#if NeedFunctionPrototypes
ExprResolveMask( ExprDef * expr,
ExprResult * val_rtrn,
IdentLookupFunc lookup,
XPointer lookupPriv)
-#else
-ExprResolveMask(expr,val_rtrn,lookup,lookupPriv)
- ExprDef * expr;
- ExprResult * val_rtrn;
- IdentLookupFunc lookup;
- XPointer lookupPriv;
-#endif
{
int ok= 0;
ExprResult leftRtrn,rightRtrn;
@@ -1075,18 +944,10 @@ char * bogus= NULL;
}
int
-#if NeedFunctionPrototypes
ExprResolveKeySym( ExprDef * expr,
ExprResult * val_rtrn,
IdentLookupFunc lookup,
XPointer lookupPriv)
-#else
-ExprResolveKeySym(expr,val_rtrn,lookup,lookupPriv)
- ExprDef * expr;
- ExprResult * val_rtrn;
- IdentLookupFunc lookup;
- XPointer lookupPriv;
-#endif
{
int ok= 0;
KeySym sym;
diff --git a/expr.h b/expr.h
index 53263b8..4e33dac 100644
--- a/expr.h
+++ b/expr.h
@@ -24,6 +24,7 @@
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/xkbcomp/expr.h,v 3.3 2002/07/01 02:26:01 tsi Exp $ */
#ifndef EXPR_H
#define EXPR_H 1
@@ -35,33 +36,23 @@ typedef union _ExprResult {
XkbKeyNameRec keyName;
} ExprResult;
-_XFUNCPROTOBEGIN
-
typedef Bool (*IdentLookupFunc)(
-#if NeedFunctionPrototypes
XPointer /* priv */,
Atom /* elem */,
Atom /* field */,
unsigned /* type */,
ExprResult * /* val_rtrn */
-#endif
);
extern char *exprTypeText(
-#if NeedFunctionPrototypes
unsigned /* type */
-#endif
);
-_XFUNCPROTOEND
-
extern int ExprResolveLhs(
-#if NeedFunctionPrototypes
ExprDef * /* expr */,
ExprResult * /* elem_rtrn */,
ExprResult * /* field_rtrn */,
ExprDef ** /* index_rtrn */
-#endif
);
typedef struct _LookupPriv {
@@ -81,154 +72,118 @@ typedef struct _LookupTable {
struct _LookupTable * nextElement;
} LookupTable;
-_XFUNCPROTOBEGIN
-
extern char *exprOpText(
-#if NeedFunctionPrototypes
unsigned /* type */
-#endif
);
extern int RadioLookup(
-#if NeedFunctionPrototypes
XPointer /* priv */,
Atom /* elem */,
Atom /* field */,
unsigned /* type */,
ExprResult * /* val_rtrn */
-#endif
);
extern int SimpleLookup(
-#if NeedFunctionPrototypes
XPointer /* priv */,
Atom /* elem */,
Atom /* field */,
unsigned /* type */,
ExprResult * /* val_rtrn */
-#endif
);
extern int TableLookup(
-#if NeedFunctionPrototypes
XPointer /* priv */,
Atom /* elem */,
Atom /* field */,
unsigned /* type */,
ExprResult * /* val_rtrn */
-#endif
);
extern int LookupModIndex(
-#if NeedFunctionPrototypes
XPointer /* priv */,
Atom /* elem */,
Atom /* field */,
unsigned /* type */,
ExprResult * /* val_rtrn */
-#endif
);
extern int LookupModMask(
-#if NeedFunctionPrototypes
XPointer /* priv */,
Atom /* elem */,
Atom /* field */,
unsigned /* type */,
ExprResult * /* val_rtrn */
-#endif
);
extern int ExprResolveModIndex(
-#if NeedFunctionPrototypes
ExprDef * /* expr */,
ExprResult * /* val_rtrn */,
IdentLookupFunc /* lookup */,
XPointer /* lookupPriv */
-#endif
);
extern int ExprResolveModMask(
-#if NeedFunctionPrototypes
ExprDef * /* expr */,
ExprResult * /* val_rtrn */,
IdentLookupFunc /* lookup */,
XPointer /* priv */
-#endif
);
extern int ExprResolveBoolean(
-#if NeedFunctionPrototypes
ExprDef * /* expr */,
ExprResult * /* val_rtrn */,
IdentLookupFunc /* lookup */,
XPointer /* lookupPriv */
-#endif
);
extern int ExprResolveInteger(
-#if NeedFunctionPrototypes
ExprDef * /* expr */,
ExprResult * /* val_rtrn */,
IdentLookupFunc /* lookup */,
XPointer /* lookupPriv */
-#endif
);
extern int ExprResolveFloat(
-#if NeedFunctionPrototypes
ExprDef * /* expr */,
ExprResult * /* val_rtrn */,
IdentLookupFunc /* lookup */,
XPointer /* lookupPriv */
-#endif
);
extern int ExprResolveString(
-#if NeedFunctionPrototypes
ExprDef * /* expr */,
ExprResult * /* val_rtrn */,
IdentLookupFunc /* lookup */,
XPointer /* lookupPriv */
-#endif
);
extern int ExprResolveKeyName(
-#if NeedFunctionPrototypes
ExprDef * /* expr */,
ExprResult * /* val_rtrn */,
IdentLookupFunc /* lookup */,
XPointer /* lookupPriv */
-#endif
);
extern int ExprResolveEnum(
-#if NeedFunctionPrototypes
ExprDef * /* expr */,
ExprResult * /* val_rtrn */,
LookupEntry * /* values */
-#endif
);
extern int ExprResolveMask(
-#if NeedFunctionPrototypes
ExprDef * /* expr */,
ExprResult * /* val_rtrn */,
IdentLookupFunc /* lookup */,
XPointer /* lookupPriv */
-#endif
);
extern int ExprResolveKeySym(
-#if NeedFunctionPrototypes
ExprDef * /* expr */,
ExprResult * /* val_rtrn */,
IdentLookupFunc /* lookup */,
XPointer /* lookupPriv */
-#endif
);
-_XFUNCPROTOEND
-
#endif /* EXPR_H */
diff --git a/geometry.c b/geometry.c
index 3e84a96..2cffc33 100644
--- a/geometry.c
+++ b/geometry.c
@@ -24,6 +24,7 @@
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/xkbcomp/geometry.c,v 1.4 2002/06/05 00:00:37 dawes Exp $ */
#include "xkbcomp.h"
#include "tokens.h"
@@ -240,13 +241,7 @@ typedef struct _GeometryInfo {
} GeometryInfo;
static char *
-#if NeedFunctionPrototypes
ddText(Display *dpy,DoodadInfo *di)
-#else
-ddText(dpy,di)
- Display * dpy;
- DoodadInfo * di;
-#endif
{
static char buf[64];
@@ -265,13 +260,7 @@ static char buf[64];
/***====================================================================***/
static void
-#if NeedFunctionPrototypes
InitPropertyInfo(PropertyInfo *pi,GeometryInfo *info)
-#else
-InitPropertyInfo(pi,info)
- PropertyInfo * pi;
- GeometryInfo * info;
-#endif
{
pi->defs.defined= 0;
pi->defs.fileID= info->fileID;
@@ -281,13 +270,7 @@ InitPropertyInfo(pi,info)
}
static void
-#if NeedFunctionPrototypes
FreeProperties(PropertyInfo *pi,GeometryInfo *info)
-#else
-FreeProperties(pi,info)
- PropertyInfo * pi;
- GeometryInfo * info;
-#endif
{
PropertyInfo * tmp;
PropertyInfo * next;
@@ -309,14 +292,7 @@ PropertyInfo * next;
}
static void
-#if NeedFunctionPrototypes
InitKeyInfo(KeyInfo *key,RowInfo *row,GeometryInfo *info)
-#else
-InitKeyInfo(key,row,info)
- KeyInfo * key;
- RowInfo * row;
- GeometryInfo * info;
-#endif
{
if (key!=&row->dfltKey) {
@@ -337,12 +313,7 @@ InitKeyInfo(key,row,info)
}
static void
-#if NeedFunctionPrototypes
ClearKeyInfo(KeyInfo *key)
-#else
-ClearKeyInfo(key)
- KeyInfo * key;
-#endif
{
key->defs.defined&= ~_GK_Default;
strcpy(key->name,"default");
@@ -353,14 +324,7 @@ ClearKeyInfo(key)
}
static void
-#if NeedFunctionPrototypes
FreeKeys(KeyInfo *key,RowInfo *row,GeometryInfo *info)
-#else
-FreeKeys(key,row,info)
- KeyInfo * key;
- RowInfo * row;
- GeometryInfo * info;
-#endif
{
KeyInfo * tmp;
KeyInfo * next;
@@ -378,14 +342,7 @@ KeyInfo * next;
}
static void
-#if NeedFunctionPrototypes
InitRowInfo(RowInfo *row,SectionInfo *section,GeometryInfo *info)
-#else
-InitRowInfo(row,section,info)
- RowInfo * row;
- SectionInfo * section;
- GeometryInfo * info;
-#endif
{
if (row!= &section->dfltRow) {
*row= section->dfltRow;
@@ -406,13 +363,7 @@ InitRowInfo(row,section,info)
}
static void
-#if NeedFunctionPrototypes
ClearRowInfo(RowInfo *row,GeometryInfo *info)
-#else
-ClearRowInfo(row,info)
- RowInfo * row;
- GeometryInfo * info;
-#endif
{
row->defs.defined&= ~_GR_Default;
row->top= row->left= 0;
@@ -426,14 +377,7 @@ ClearRowInfo(row,info)
}
static void
-#if NeedFunctionPrototypes
FreeRows(RowInfo *row,SectionInfo *section,GeometryInfo *info)
-#else
-FreeRows(row,section,info)
- RowInfo * row;
- SectionInfo * section;
- GeometryInfo * info;
-#endif
{
RowInfo * next;
RowInfo * tmp;
@@ -451,13 +395,7 @@ RowInfo * tmp;
}
static DoodadInfo *
-#if NeedFunctionPrototypes
FindDoodadByType(DoodadInfo *di,unsigned type)
-#else
-FindDoodadByType(di,type)
- DoodadInfo * di;
- unsigned type;
-#endif
{
while (di) {
if (di->type==type)
@@ -468,13 +406,7 @@ FindDoodadByType(di,type)
}
static DoodadInfo *
-#if NeedFunctionPrototypes
FindDoodadByName(DoodadInfo *di,Atom name)
-#else
-FindDoodadByName(di,name)
- DoodadInfo * di;
- Atom name;
-#endif
{
while (di) {
if (di->name==name)
@@ -485,15 +417,7 @@ FindDoodadByName(di,name)
}
static void
-#if NeedFunctionPrototypes
InitDoodadInfo(DoodadInfo *di,unsigned type,SectionInfo *si,GeometryInfo *info)
-#else
-InitDoodadInfo(di,type,si,info)
- DoodadInfo * di;
- unsigned type;
- SectionInfo * si;
- GeometryInfo * info;
-#endif
{
DoodadInfo * dflt;
@@ -526,12 +450,7 @@ DoodadInfo * dflt;
}
static void
-#if NeedFunctionPrototypes
ClearDoodadInfo(DoodadInfo *di)
-#else
-ClearDoodadInfo(di)
- DoodadInfo * di;
-#endif
{
CommonInfo defs;
@@ -543,12 +462,7 @@ CommonInfo defs;
}
static void
-#if NeedFunctionPrototypes
ClearOverlayInfo(OverlayInfo *ol)
-#else
-ClearOverlayInfo(ol)
- OverlayInfo * ol;
-#endif
{
if (ol && ol->keys) {
ol->keys= (OverlayKeyInfo *)ClearCommonInfo(&ol->keys->defs);
@@ -558,14 +472,7 @@ ClearOverlayInfo(ol)
}
static void
-#if NeedFunctionPrototypes
FreeDoodads(DoodadInfo *di,SectionInfo *si,GeometryInfo *info)
-#else
-FreeDoodads(di,si,info)
- DoodadInfo * di;
- SectionInfo * si;
- GeometryInfo * info;
-#endif
{
DoodadInfo * tmp;
DoodadInfo * next;
@@ -593,13 +500,7 @@ DoodadInfo * next;
}
static void
-#if NeedFunctionPrototypes
InitSectionInfo(SectionInfo *si,GeometryInfo *info)
-#else
-InitSectionInfo(si,info)
- SectionInfo * si;
- GeometryInfo * info;
-#endif
{
if (si!=&info->dfltSection) {
*si= info->dfltSection;
@@ -622,14 +523,7 @@ InitSectionInfo(si,info)
}
static void
-#if NeedFunctionPrototypes
DupSectionInfo(SectionInfo *into,SectionInfo *from,GeometryInfo *info)
-#else
-DupSectionInfo(into,from,info)
- SectionInfo * into;
- SectionInfo * from;
- GeometryInfo * info;
-#endif
{
CommonInfo defs;
@@ -650,13 +544,7 @@ CommonInfo defs;
}
static void
-#if NeedFunctionPrototypes
ClearSectionInfo(SectionInfo *si,GeometryInfo *info)
-#else
-ClearSectionInfo(si,info)
- SectionInfo * si;
- GeometryInfo * info;
-#endif
{
si->defs.defined&= ~_GS_Default;
@@ -678,13 +566,7 @@ ClearSectionInfo(si,info)
}
static void
-#if NeedFunctionPrototypes
FreeSections(SectionInfo *si,GeometryInfo *info)
-#else
-FreeSections(si,info)
- SectionInfo * si;
- GeometryInfo * info;
-#endif
{
SectionInfo * tmp;
SectionInfo * next;
@@ -702,13 +584,7 @@ SectionInfo * next;
}
static void
-#if NeedFunctionPrototypes
FreeShapes(ShapeInfo *si,GeometryInfo *info)
-#else
-FreeShapes(si,info)
- ShapeInfo * si;
- GeometryInfo * info;
-#endif
{
ShapeInfo * tmp;
ShapeInfo * next;
@@ -742,14 +618,7 @@ ShapeInfo * next;
/***====================================================================***/
static void
-#if NeedFunctionPrototypes
InitGeometryInfo(GeometryInfo *info,unsigned fileID,unsigned merge)
-#else
-InitGeometryInfo(info,fileID,merge)
- GeometryInfo * info;
- unsigned fileID;
- unsigned merge;
-#endif
{
bzero(info,sizeof(GeometryInfo));
info->fileID= fileID;
@@ -760,12 +629,7 @@ InitGeometryInfo(info,fileID,merge)
}
static void
-#if NeedFunctionPrototypes
ClearGeometryInfo(GeometryInfo *info)
-#else
-ClearGeometryInfo(info)
- GeometryInfo * info;
-#endif
{
if (info->name)
uFree(info->name);
@@ -789,12 +653,7 @@ ClearGeometryInfo(info)
/***====================================================================***/
static PropertyInfo *
-#if NeedFunctionPrototypes
NextProperty(GeometryInfo *info)
-#else
-NextProperty(info)
- GeometryInfo * info;
-#endif
{
PropertyInfo * pi;
@@ -809,13 +668,7 @@ PropertyInfo * pi;
}
static PropertyInfo *
-#if NeedFunctionPrototypes
FindProperty(GeometryInfo *info,char *name)
-#else
-FindProperty(info,name)
- GeometryInfo * info;
- char * name;
-#endif
{
PropertyInfo * old;
@@ -829,13 +682,7 @@ PropertyInfo * old;
}
static Bool
-#if NeedFunctionPrototypes
AddProperty(GeometryInfo *info,PropertyInfo *new)
-#else
-AddProperty(info,new)
- GeometryInfo * info;
- PropertyInfo * new;
-#endif
{
PropertyInfo * old;
@@ -875,12 +722,7 @@ PropertyInfo * old;
/***====================================================================***/
static ShapeInfo *
-#if NeedFunctionPrototypes
NextShape(GeometryInfo *info)
-#else
-NextShape(info)
- GeometryInfo * info;
-#endif
{
ShapeInfo * si;
@@ -896,15 +738,7 @@ ShapeInfo * si;
}
static ShapeInfo *
-#if NeedFunctionPrototypes
FindShape(GeometryInfo *info,Atom name,char *type,char *which)
-#else
-FindShape(info,name,type,which)
- GeometryInfo * info;
- Atom name;
- char * type;
- char * which;
-#endif
{
ShapeInfo * old;
@@ -927,13 +761,7 @@ ShapeInfo * old;
}
static Bool
-#if NeedFunctionPrototypes
AddShape(GeometryInfo *info,ShapeInfo *new)
-#else
-AddShape(info,new)
- GeometryInfo * info;
- ShapeInfo * new;
-#endif
{
ShapeInfo * old;
@@ -972,13 +800,7 @@ ShapeInfo * old;
/***====================================================================***/
static void
-#if NeedFunctionPrototypes
ReplaceDoodad(DoodadInfo *into,DoodadInfo *from)
-#else
-ReplaceDoodad(into,from)
- DoodadInfo * into;
- DoodadInfo * from;
-#endif
{
CommonInfo * next;
@@ -993,13 +815,7 @@ CommonInfo * next;
}
static DoodadInfo *
-#if NeedFunctionPrototypes
NextDfltDoodad(SectionInfo *si,GeometryInfo *info)
-#else
-NextDfltDoodad(si,info)
- SectionInfo * si;
- GeometryInfo * info;
-#endif
{
DoodadInfo * di;
@@ -1018,13 +834,7 @@ DoodadInfo * di;
}
static DoodadInfo *
-#if NeedFunctionPrototypes
NextDoodad(SectionInfo *si,GeometryInfo *info)
-#else
-NextDoodad(si,info)
- SectionInfo * si;
- GeometryInfo * info;
-#endif
{
DoodadInfo * di;
@@ -1045,14 +855,7 @@ DoodadInfo * di;
}
static Bool
-#if NeedFunctionPrototypes
AddDoodad(SectionInfo *si,GeometryInfo *info,DoodadInfo *new)
-#else
-AddDoodad(si,info,new)
- SectionInfo * si;
- GeometryInfo * info;
- DoodadInfo * new;
-#endif
{
DoodadInfo * old;
@@ -1087,14 +890,7 @@ DoodadInfo * old;
}
static DoodadInfo *
-#if NeedFunctionPrototypes
FindDfltDoodadByTypeName(char *name,SectionInfo *si,GeometryInfo *info)
-#else
-FindDfltDoodadByTypeName(name,si,info)
- char * name;
- SectionInfo * si;
- GeometryInfo * info;
-#endif
{
DoodadInfo * dflt;
unsigned type;
@@ -1123,14 +919,7 @@ unsigned type;
/***====================================================================***/
static Bool
-#if NeedFunctionPrototypes
AddOverlay(SectionInfo *si,GeometryInfo *info,OverlayInfo *new)
-#else
-AddOverlay(si,info,new)
- SectionInfo *si;
- GeometryInfo *info;
- OverlayInfo *new;
-#endif
{
OverlayInfo * old;
@@ -1186,12 +975,7 @@ OverlayInfo * old;
/***====================================================================***/
static SectionInfo *
-#if NeedFunctionPrototypes
NextSection(GeometryInfo *info)
-#else
-NextSection(info)
- GeometryInfo * info;
-#endif
{
SectionInfo * si;
@@ -1210,13 +994,7 @@ SectionInfo * si;
}
static SectionInfo *
-#if NeedFunctionPrototypes
FindMatchingSection(GeometryInfo *info,SectionInfo *new)
-#else
-FindMatchingSection(info,new)
- GeometryInfo * info;
- SectionInfo * new;
-#endif
{
SectionInfo * old;
@@ -1228,13 +1006,7 @@ SectionInfo * old;
}
static Bool
-#if NeedFunctionPrototypes
AddSection(GeometryInfo *info,SectionInfo *new)
-#else
-AddSection(info,new)
- GeometryInfo * info;
- SectionInfo * new;
-#endif
{
SectionInfo * old;
@@ -1283,12 +1055,7 @@ SectionInfo * old;
/***====================================================================***/
static RowInfo *
-#if NeedFunctionPrototypes
NextRow(SectionInfo *si)
-#else
-NextRow(si)
- SectionInfo * si;
-#endif
{
RowInfo * row;
@@ -1306,13 +1073,7 @@ RowInfo * row;
}
static Bool
-#if NeedFunctionPrototypes
AddRow(SectionInfo *si,RowInfo *new)
-#else
-AddRow(si,new)
- SectionInfo * si;
- RowInfo * new;
-#endif
{
RowInfo * old;
@@ -1329,12 +1090,7 @@ RowInfo * old;
/***====================================================================***/
static KeyInfo *
-#if NeedFunctionPrototypes
NextKey(RowInfo *row)
-#else
-NextKey(row)
- RowInfo * row;
-#endif
{
KeyInfo * key;
@@ -1349,13 +1105,7 @@ KeyInfo * key;
}
static Bool
-#if NeedFunctionPrototypes
AddKey(RowInfo *row,KeyInfo *new)
-#else
-AddKey(row,new)
- RowInfo * row;
- KeyInfo * new;
-#endif
{
KeyInfo * old;
@@ -1371,14 +1121,7 @@ KeyInfo * old;
/***====================================================================***/
static void
-#if NeedFunctionPrototypes
MergeIncludedGeometry(GeometryInfo *into,GeometryInfo *from,unsigned merge)
-#else
-MergeIncludedGeometry(into,from,merge)
- GeometryInfo * into;
- GeometryInfo * from;
- unsigned merge;
-#endif
{
Bool clobber;
@@ -1453,25 +1196,15 @@ Bool clobber;
}
typedef void (*FileHandler)(
-#if NeedFunctionPrototypes
XkbFile * /* file */,
XkbDescPtr /* xkb */,
unsigned /* merge */,
GeometryInfo * /* info */
-#endif
);
static Bool
-#if NeedFunctionPrototypes
HandleIncludeGeometry(IncludeStmt *stmt,XkbDescPtr xkb,GeometryInfo *info,
FileHandler hndlr)
-#else
-HandleIncludeGeometry(stmt,xkb,info,hndlr)
- IncludeStmt * stmt;
- XkbDescPtr xkb;
- GeometryInfo * info;
- FileHandler hndlr;
-#endif
{
unsigned newMerge;
XkbFile * rtrn;
@@ -1538,20 +1271,11 @@ Bool haveSelf;
}
static int
-#if NeedFunctionPrototypes
SetShapeField( ShapeInfo * si,
char * field,
ExprDef * arrayNdx,
ExprDef * value,
GeometryInfo * info)
-#else
-SetShapeField(si,field,arrayNdx,value,info)
- ShapeInfo * si;
- char * field;
- ExprDef * arrayNdx;
- ExprDef * value;
- GeometryInfo * info;
-#endif
{
ExprResult tmp;
@@ -1576,22 +1300,12 @@ ExprResult tmp;
}
static int
-#if NeedFunctionPrototypes
SetShapeDoodadField( DoodadInfo * di,
char * field,
ExprDef * arrayNdx,
ExprDef * value,
SectionInfo * si,
GeometryInfo * info)
-#else
-SetShapeDoodadField(di,field,arrayNdx,value,si,info)
- DoodadInfo * di;
- char * field;
- ExprDef * arrayNdx;
- ExprDef * value;
- SectionInfo * si;
- GeometryInfo * info;
-#endif
{
ExprResult tmp;
char * typeName;
@@ -1644,22 +1358,12 @@ char * typeName;
#define FIELD_USHORT 2
static int
-#if NeedFunctionPrototypes
SetTextDoodadField( DoodadInfo * di,
char * field,
ExprDef * arrayNdx,
ExprDef * value,
SectionInfo * si,
GeometryInfo * info)
-#else
-SetTextDoodadField(di,field,arrayNdx,value,si,info)
- DoodadInfo * di;
- char * field;
- ExprDef * arrayNdx;
- ExprDef * value;
- SectionInfo * si;
- GeometryInfo * info;
-#endif
{
ExprResult tmp;
unsigned def;
@@ -1780,22 +1484,12 @@ union {
}
static int
-#if NeedFunctionPrototypes
SetIndicatorDoodadField( DoodadInfo * di,
char * field,
ExprDef * arrayNdx,
ExprDef * value,
SectionInfo * si,
GeometryInfo * info)
-#else
-SetIndicatorDoodadField(di,field,arrayNdx,value,si,info)
- DoodadInfo * di;
- char * field;
- ExprDef * arrayNdx;
- ExprDef * value;
- SectionInfo * si;
- GeometryInfo * info;
-#endif
{
ExprResult tmp;
@@ -1829,22 +1523,12 @@ ExprResult tmp;
}
static int
-#if NeedFunctionPrototypes
SetLogoDoodadField( DoodadInfo * di,
char * field,
ExprDef * arrayNdx,
ExprDef * value,
SectionInfo * si,
GeometryInfo * info)
-#else
-SetLogoDoodadField(di,field,arrayNdx,value,si,info)
- DoodadInfo * di;
- char * field;
- ExprDef * arrayNdx;
- ExprDef * value;
- SectionInfo * si;
- GeometryInfo * info;
-#endif
{
ExprResult tmp;
char * typeName= "logo doodad";
@@ -1904,22 +1588,12 @@ char * typeName= "logo doodad";
}
static int
-#if NeedFunctionPrototypes
SetDoodadField( DoodadInfo * di,
char * field,
ExprDef * arrayNdx,
ExprDef * value,
SectionInfo * si,
GeometryInfo * info)
-#else
-SetDoodadField(di,field,arrayNdx,value,si,info)
- DoodadInfo * di;
- char * field;
- ExprDef * arrayNdx;
- ExprDef * value;
- SectionInfo * si;
- GeometryInfo * info;
-#endif
{
ExprResult tmp;
@@ -1999,20 +1673,11 @@ ExprResult tmp;
}
static int
-#if NeedFunctionPrototypes
SetSectionField( SectionInfo * si,
char * field,
ExprDef * arrayNdx,
ExprDef * value,
GeometryInfo * info)
-#else
-SetSectionField(si,field,arrayNdx,value,info)
- SectionInfo * si;
- char * field;
- ExprDef * arrayNdx;
- ExprDef * value;
- GeometryInfo * info;
-#endif
{
unsigned short * pField;
unsigned def;
@@ -2081,20 +1746,11 @@ ExprResult tmp;
}
static int
-#if NeedFunctionPrototypes
SetRowField( RowInfo * row,
char * field,
ExprDef * arrayNdx,
ExprDef * value,
GeometryInfo * info)
-#else
-SetRowField(row,field,arrayNdx,value,info)
- RowInfo * row;
- char * field;
- ExprDef * arrayNdx;
- ExprDef * value;
- GeometryInfo * info;
-#endif
{
ExprResult tmp;
@@ -2145,20 +1801,11 @@ ExprResult tmp;
}
static int
-#if NeedFunctionPrototypes
SetKeyField( KeyInfo *key,
char *field,
ExprDef *arrayNdx,
ExprDef *value,
GeometryInfo *info)
-#else
-SetKeyField(key,field,arrayNdx,value,info)
- KeyInfo * key;
- char * field;
- ExprDef * arrayNdx;
- ExprDef * value;
- GeometryInfo * info;
-#endif
{
ExprResult tmp;
@@ -2220,14 +1867,7 @@ ExprResult tmp;
}
static int
-#if NeedFunctionPrototypes
SetGeometryProperty(GeometryInfo *info,char *property,ExprDef *value)
-#else
-SetGeometryProperty(info,property,value)
- GeometryInfo * info;
- char * property;
- ExprDef * value;
-#endif
{
PropertyInfo pi;
ExprResult result;
@@ -2245,14 +1885,7 @@ ExprResult result;
}
static int
-#if NeedFunctionPrototypes
HandleGeometryVar(VarDef *stmt,XkbDescPtr xkb,GeometryInfo *info)
-#else
-HandleGeometryVar(stmt,xkb,info)
- VarDef * stmt;
- XkbDescPtr xkb;
- GeometryInfo * info;
-#endif
{
ExprResult elem,field,tmp;
ExprDef * ndx;
@@ -2463,15 +2096,7 @@ Atom * pField;
/***====================================================================***/
static Bool
-#if NeedFunctionPrototypes
HandleShapeBody(ShapeDef *def,ShapeInfo *si,unsigned merge,GeometryInfo *info)
-#else
-HandleShapeBody(def,si,merge,info)
- ShapeDef * def;
- ShapeInfo * si;
- unsigned merge;
- GeometryInfo * info;
-#endif
{
OutlineDef * ol;
int nOut,nPt;
@@ -2550,15 +2175,7 @@ ExprDef * pt;
}
static int
-#if NeedFunctionPrototypes
HandleShapeDef(ShapeDef *def,XkbDescPtr xkb,unsigned merge,GeometryInfo *info)
-#else
-HandleShapeDef(def,xkb,merge,info)
- ShapeDef * def;
- XkbDescPtr xkb;
- unsigned merge;
- GeometryInfo * info;
-#endif
{
ShapeInfo si;
@@ -2579,18 +2196,10 @@ ShapeInfo si;
/***====================================================================***/
static int
-#if NeedFunctionPrototypes
HandleDoodadDef( DoodadDef *def,
unsigned merge,
SectionInfo *si,
GeometryInfo *info)
-#else
-HandleDoodadDef(def,merge,si,info)
- DoodadDef * def;
- unsigned merge;
- SectionInfo * si;
- GeometryInfo * info;
-#endif
{
ExprResult elem,field;
ExprDef * ndx;
@@ -2598,13 +2207,8 @@ DoodadInfo new;
VarDef * var;
if (def->common.stmtType==StmtIndicatorMapDef) {
- IndicatorMapDef *imap= (IndicatorMapDef *)def;
- Atom name= imap->name;
- VarDef * body= imap->body;
def->common.stmtType= StmtDoodadDef;
def->type= XkbIndicatorDoodad;
- def->name= name;
- def->body= body;
}
InitDoodadInfo(&new,def->type,si,info);
new.name= XkbInternAtom(info->dpy,XkbAtomGetString(NULL,def->name),False);
@@ -2628,18 +2232,10 @@ VarDef * var;
/***====================================================================***/
static int
-#if NeedFunctionPrototypes
HandleOverlayDef( OverlayDef * def,
unsigned merge,
SectionInfo * si,
GeometryInfo * info)
-#else
-HandleOverlayDef(def,merge,si,info)
- OverlayDef * def;
- unsigned merge;
- SectionInfo * si;
- GeometryInfo * info;
-#endif
{
OverlayKeyDef * keyDef;
OverlayKeyInfo *key;
@@ -2680,14 +2276,7 @@ OverlayInfo ol;
/***====================================================================***/
static Bool
-#if NeedFunctionPrototypes
HandleComplexKey(KeyDef *def,KeyInfo *key,GeometryInfo *info)
-#else
-HandleComplexKey(def,key,info)
- KeyDef * def;
- KeyInfo * key;
- GeometryInfo * info;
-#endif
{
RowInfo * row;
ExprDef * expr;
@@ -2736,15 +2325,7 @@ ExprDef * expr;
}
static Bool
-#if NeedFunctionPrototypes
HandleRowBody(RowDef *def,RowInfo *row,unsigned merge,GeometryInfo *info)
-#else
-HandleRowBody(def,row,merge,info)
- RowDef * def;
- RowInfo * row;
- unsigned merge;
- GeometryInfo * info;
-#endif
{
KeyDef * keyDef;
@@ -2804,18 +2385,10 @@ KeyDef * keyDef;
}
static Bool
-#if NeedFunctionPrototypes
HandleSectionBody( SectionDef * def,
SectionInfo * si,
unsigned merge,
GeometryInfo * info)
-#else
-HandleSectionBody(def,si,merge,info)
- SectionDef * def;
- SectionInfo * si;
- unsigned merge;
- GeometryInfo * info;
-#endif
{
RowDef * rowDef;
DoodadInfo * di;
@@ -2883,18 +2456,10 @@ DoodadInfo * di;
}
static int
-#if NeedFunctionPrototypes
HandleSectionDef( SectionDef * def,
XkbDescPtr xkb,
unsigned merge,
GeometryInfo * info)
-#else
-HandleSectionDef(def,xkb,merge,info)
- SectionDef * def;
- XkbDescPtr xkb;
- unsigned merge;
- GeometryInfo * info;
-#endif
{
SectionInfo si;
char * str;
@@ -2920,18 +2485,10 @@ char * str;
/***====================================================================***/
static void
-#if NeedFunctionPrototypes
HandleGeometryFile( XkbFile * file,
XkbDescPtr xkb,
unsigned merge,
GeometryInfo * info)
-#else
-HandleGeometryFile(file,xkb,merge,info)
- XkbFile * file;
- XkbDescPtr xkb;
- unsigned merge;
- GeometryInfo * info;
-#endif
{
ParseCommon * stmt;
char * failWhat;
@@ -3003,14 +2560,7 @@ char * failWhat;
/***====================================================================***/
static Bool
-#if NeedFunctionPrototypes
CopyShapeDef(Display *dpy,XkbGeometryPtr geom,ShapeInfo *si)
-#else
-CopyShapeDef(dpy,geom,si)
- Display * dpy;
- XkbGeometryPtr geom;
- ShapeInfo * si;
-#endif
{
register int i,n;
XkbShapePtr shape;
@@ -3051,13 +2601,7 @@ Atom name;
}
static Bool
-#if NeedFunctionPrototypes
VerifyDoodadInfo(DoodadInfo *di,GeometryInfo *info)
-#else
-VerifyDoodadInfo(di,info)
- DoodadInfo * di;
- GeometryInfo * info;
-#endif
{
if ((di->defs.defined&(_GD_Top|_GD_Left))!=(_GD_Top|_GD_Left)) {
if (warningLevel<9) {
@@ -3066,7 +2610,7 @@ VerifyDoodadInfo(di,info)
return False;
}
}
- if (di->defs.defined&_GD_Priority==0) {
+ if ((di->defs.defined & _GD_Priority) == 0) {
/* calculate priority -- should be just above previous doodad/row */
}
switch (di->type) {
@@ -3307,7 +2851,6 @@ VerifyDoodadInfo(di,info)
#define FONT_TEMPLATE "-*-%s-%s-%s-%s-%s-*-%d-*-*-*-*-%s"
static char *
-#if NeedFunctionPrototypes
FontFromParts( Atom fontTok,
Atom weightTok,
Atom slantTok,
@@ -3315,16 +2858,6 @@ FontFromParts( Atom fontTok,
Atom varTok,
int size,
Atom encodingTok)
-#else
-FontFromParts(fontTok,weightTok,slantTok,setWidthTok,varTok,size,encodingTok)
- Atom fontTok;
- Atom weightTok;
- Atom slantTok;
- Atom setWidthTok;
- Atom varTok;
- int size;
- Atom encodingTok;
-#endif
{
int totalSize;
char *font,*weight,*slant,*setWidth,*variant,*encoding;
@@ -3351,18 +2884,10 @@ char * rtrn;
}
static Bool
-#if NeedFunctionPrototypes
CopyDoodadDef( XkbGeometryPtr geom,
XkbSectionPtr section,
DoodadInfo * di,
GeometryInfo * info)
-#else
-CopyDoodadDef(geom,section,di,info)
- XkbGeometryPtr geom;
- XkbSectionPtr section;
- DoodadInfo * di;
- GeometryInfo * info;
-#endif
{
Atom name;
XkbDoodadPtr doodad;
@@ -3440,22 +2965,12 @@ ShapeInfo * si;
/***====================================================================***/
static Bool
-#if NeedFunctionPrototypes
VerifyOverlayInfo( XkbGeometryPtr geom,
XkbSectionPtr section,
OverlayInfo * oi,
GeometryInfo * info,
short rowMap[256],
short rowSize[256])
-#else
-VerifyOverlayInfo(geom,section,oi,info,rowMap,rowSize)
- XkbGeometryPtr geom;
- XkbSectionPtr section;
- OverlayInfo * oi;
- GeometryInfo * info;
- short rowMap[256];
- short rowSize[256];
-#endif
{
register OverlayKeyInfo * ki,*next;
unsigned long oKey,uKey,sKey;
@@ -3533,18 +3048,10 @@ int r,k;
}
static Bool
-#if NeedFunctionPrototypes
CopyOverlayDef( XkbGeometryPtr geom,
XkbSectionPtr section,
OverlayInfo * oi,
GeometryInfo * info)
-#else
-CopyOverlayDef(geom,section,oi,info)
- XkbGeometryPtr geom;
- XkbSectionPtr section;
- OverlayInfo * oi;
- GeometryInfo * info;
-#endif
{
Atom name;
XkbOverlayPtr ol;
@@ -3590,14 +3097,7 @@ int i;
/***====================================================================***/
static Bool
-#if NeedFunctionPrototypes
CopySectionDef(XkbGeometryPtr geom,SectionInfo *si,GeometryInfo *info)
-#else
-CopySectionDef(geom,si,info)
- XkbGeometryPtr geom;
- SectionInfo * si;
- GeometryInfo * info;
-#endif
{
XkbSectionPtr section;
XkbRowPtr row;
@@ -3686,14 +3186,7 @@ Atom name;
/***====================================================================***/
Bool
-#if NeedFunctionPrototypes
CompileGeometry(XkbFile *file,XkbFileInfo *result,unsigned merge)
-#else
-CompileGeometry(file,result,merge)
- XkbFile * file;
- XkbFileInfo * result;
- unsigned merge;
-#endif
{
GeometryInfo info;
XkbDescPtr xkb;
diff --git a/indicators.c b/indicators.c
index cb09da9..9ff2ffa 100644
--- a/indicators.c
+++ b/indicators.c
@@ -24,6 +24,7 @@
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/xkbcomp/indicators.c,v 1.5 2002/06/05 00:00:37 dawes Exp $ */
#include "xkbcomp.h"
#include "misc.h"
@@ -31,6 +32,8 @@
#include "expr.h"
#include "vmod.h"
#include "indicators.h"
+#include "action.h"
+#include "compat.h"
/***====================================================================***/
@@ -44,13 +47,7 @@
/***====================================================================***/
void
-#if NeedFunctionPrototypes
ClearIndicatorMapInfo(Display *dpy,LEDInfo *info)
-#else
-ClearIndicatorMapInfo(dpy,info)
- Display * dpy;
- LEDInfo * info;
-#endif
{
info->name= XkbInternAtom(dpy,"default",False);
info->indicator= _LED_NotBound;
@@ -62,13 +59,7 @@ ClearIndicatorMapInfo(dpy,info)
}
LEDInfo *
-#if NeedFunctionPrototypes
AddIndicatorMap(LEDInfo *oldLEDs,LEDInfo *new)
-#else
-AddIndicatorMap(oldLEDs,new)
- LEDInfo * oldLEDs;
- LEDInfo * new;
-#endif
{
LEDInfo *old,*last;
unsigned collide;
@@ -171,6 +162,7 @@ LookupEntry modComponentNames[] = {
{ NULL, 0 }
};
LookupEntry groupComponentNames[] = {
+ { "base", XkbIM_UseBase },
{ "latched", XkbIM_UseLatched },
{ "locked", XkbIM_UseLocked },
{ "effective", XkbIM_UseEffective },
@@ -180,20 +172,11 @@ LookupEntry groupComponentNames[] = {
};
int
-#if NeedFunctionPrototypes
SetIndicatorMapField( LEDInfo * led,
XkbDescPtr xkb,
char * field,
ExprDef * arrayNdx,
ExprDef * value)
-#else
-SetIndicatorMapField(led,xkb,field,arrayNdx,value)
- LEDInfo * led;
- XkbDescPtr xkb;
- char * field;
- ExprDef * arrayNdx;
- ExprDef * value;
-#endif
{
ExprResult rtrn;
Bool ok;
@@ -209,7 +192,6 @@ Bool ok;
led->defs.defined|= _LED_Mods;
}
else if (uStrCaseCmp(field,"groups")==0) {
- extern LookupEntry groupNames[];
if (arrayNdx!=NULL)
return ReportIndicatorNotArray(xkb->dpy,led,field);
if (!ExprResolveMask(value,&rtrn,SimpleLookup,(XPointer)groupNames))
@@ -219,7 +201,6 @@ Bool ok;
}
else if ((uStrCaseCmp(field,"controls")==0)||
(uStrCaseCmp(field,"ctrls")==0)) {
- extern LookupEntry ctrlNames[];
if (arrayNdx!=NULL)
return ReportIndicatorNotArray(xkb->dpy,led,field);
if (!ExprResolveMask(value,&rtrn,SimpleLookup,(XPointer)ctrlNames))
@@ -255,13 +236,6 @@ Bool ok;
return ReportIndicatorBadType(xkb->dpy,led,field,
"mask of group state components");
}
- if ((rtrn.uval&XkbIM_UseCompat)&&(warningLevel>0)) {
- WARN("Cannot use the compatibilty state for groups\n");
- ACTION2("Not set in the %s field of the map for indicator %s\n",
- field,
- XkbAtomText(NULL,led->name,XkbMessage));
- rtrn.uval&= ~XkbIM_UseCompat;
- }
led->which_groups= rtrn.uval;
}
else if ((uStrCaseCmp(field,"driveskbd")==0)||
@@ -303,20 +277,11 @@ Bool ok;
}
LEDInfo *
-#if NeedFunctionPrototypes
HandleIndicatorMapDef( IndicatorMapDef * def,
XkbDescPtr xkb,
LEDInfo * dflt,
LEDInfo * oldLEDs,
unsigned merge)
-#else
-HandleIndicatorMapDef(def,xkb,dflt,oldLEDs,merge)
- IndicatorMapDef * def;
- XkbDescPtr xkb;
- LEDInfo * dflt;
- LEDInfo * oldLEDs;
- unsigned merge;
-#endif
{
LEDInfo led,*rtrn;
VarDef * var;
@@ -355,14 +320,7 @@ Bool ok;
}
Bool
-#if NeedFunctionPrototypes
CopyIndicatorMapDefs(XkbFileInfo *result,LEDInfo *leds,LEDInfo **unboundRtrn)
-#else
-CopyIndicatorMapDefs(result,leds,unboundRtrn)
- XkbFileInfo * result;
- LEDInfo * leds;
- LEDInfo ** unboundRtrn;
-#endif
{
LEDInfo * led,*next;
LEDInfo * unbound,*last;
@@ -420,18 +378,10 @@ XkbDescPtr xkb;
}
Bool
-#if NeedFunctionPrototypes
BindIndicators( XkbFileInfo * result,
Bool force,
LEDInfo * unbound,
LEDInfo ** unboundRtrn)
-#else
-BindIndicators(result,force,unbound,unboundRtrn)
- XkbFileInfo * result;
- Bool force;
- LEDInfo * unbound;
- LEDInfo ** unboundRtrn;
-#endif
{
XkbDescPtr xkb;
register int i;
diff --git a/indicators.h b/indicators.h
index 461866b..c1d5ea9 100644
--- a/indicators.h
+++ b/indicators.h
@@ -24,6 +24,7 @@
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/xkbcomp/indicators.h,v 1.3 2002/07/01 02:26:01 tsi Exp $ */
#ifndef INDICATORS_H
#define INDICATORS_H 1
@@ -52,55 +53,43 @@ typedef struct _LEDInfo {
} LEDInfo;
extern void ClearIndicatorMapInfo(
-#if NeedFunctionPrototypes
Display * /* dpy */,
LEDInfo * /* info */
-#endif
);
extern LEDInfo *AddIndicatorMap(
-#if NeedFunctionPrototypes
LEDInfo * /* oldLEDs */,
LEDInfo * /* newLED */
-#endif
);
extern int SetIndicatorMapField(
-#if NeedFunctionPrototypes
LEDInfo * /* led */,
XkbDescPtr /* xkb */,
char * /* field */,
ExprDef * /* arrayNdx */,
ExprDef * /* value */
-#endif
);
extern LEDInfo *HandleIndicatorMapDef(
-#if NeedFunctionPrototypes
IndicatorMapDef * /* stmt */,
XkbDescPtr /* xkb */,
LEDInfo * /* dflt */,
LEDInfo * /* oldLEDs */,
unsigned /* mergeMode */
-#endif
);
extern Bool CopyIndicatorMapDefs(
-#if NeedFunctionPrototypes
XkbFileInfo * /* result */,
LEDInfo * /* leds */,
LEDInfo ** /* unboundRtrn */
-#endif
);
extern Bool BindIndicators(
-#if NeedFunctionPrototypes
XkbFileInfo * /* result */,
Bool /* force */,
LEDInfo * /* unbound */,
LEDInfo ** /* unboundRtrn */
-#endif
);
#endif /* INDICATORS_H */
diff --git a/keycodes.c b/keycodes.c
index 6acf0ac..47b6624 100644
--- a/keycodes.c
+++ b/keycodes.c
@@ -24,6 +24,7 @@
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/xkbcomp/keycodes.c,v 3.5 2002/07/01 02:26:01 tsi Exp $ */
#include "xkbcomp.h"
#include "tokens.h"
@@ -33,13 +34,7 @@
#include "alias.h"
char *
-#if NeedFunctionPrototypes
longText(unsigned long val,unsigned format)
-#else
-longText(val,format)
- unsigned long val;
- unsigned format;
-#endif
{
char buf[4];
@@ -50,13 +45,7 @@ char buf[4];
/***====================================================================***/
void
-#if NeedFunctionPrototypes
LongToKeyName(unsigned long val,char *name)
-#else
-LongToKeyName(val,name)
- unsigned long val;
- char * name;
-#endif
{
name[0]= ((val>>24)&0xff);
name[1]= ((val>>16)&0xff);
@@ -93,13 +82,7 @@ typedef struct _KeyNamesInfo {
} KeyNamesInfo;
static void
-#if NeedFunctionPrototypes
InitIndicatorNameInfo(IndicatorNameInfo *ii,KeyNamesInfo *info)
-#else
-InitIndicatorNameInfo(ii,info)
- IndicatorNameInfo * ii;
- KeyNamesInfo * info;
-#endif
{
ii->defs.defined= 0;
ii->defs.merge= info->merge;
@@ -112,13 +95,7 @@ InitIndicatorNameInfo(ii,info)
}
static void
-#if NeedFunctionPrototypes
ClearIndicatorNameInfo(IndicatorNameInfo *ii,KeyNamesInfo *info)
-#else
-ClearIndicatorNameInfo(ii,info)
- IndicatorNameInfo * ii;
- KeyNamesInfo * info;
-#endif
{
if (ii==info->leds) {
ClearCommonInfo(&ii->defs);
@@ -128,12 +105,7 @@ ClearIndicatorNameInfo(ii,info)
}
static IndicatorNameInfo *
-#if NeedFunctionPrototypes
NextIndicatorName(KeyNamesInfo *info)
-#else
-NextIndicatorName(info)
- KeyNamesInfo * info;
-#endif
{
IndicatorNameInfo * ii;
@@ -147,13 +119,7 @@ IndicatorNameInfo * ii;
}
static IndicatorNameInfo *
-#if NeedFunctionPrototypes
FindIndicatorByIndex(KeyNamesInfo *info,int ndx)
-#else
-FindIndicatorByIndex(info,ndx)
- KeyNamesInfo * info;
- int ndx;
-#endif
{
IndicatorNameInfo * old;
@@ -165,13 +131,7 @@ IndicatorNameInfo * old;
}
static IndicatorNameInfo *
-#if NeedFunctionPrototypes
FindIndicatorByName(KeyNamesInfo *info,Atom name)
-#else
-FindIndicatorByName(info,name)
- KeyNamesInfo * info;
- Atom name;
-#endif
{
IndicatorNameInfo * old;
@@ -183,13 +143,7 @@ IndicatorNameInfo * old;
}
static Bool
-#if NeedFunctionPrototypes
AddIndicatorName(KeyNamesInfo *info,IndicatorNameInfo *new)
-#else
-AddIndicatorName(info,new)
- KeyNamesInfo * info;
- IndicatorNameInfo *new;
-#endif
{
IndicatorNameInfo *old;
Bool replace;
@@ -285,12 +239,7 @@ char * action;
}
static void
-#if NeedFunctionPrototypes
ClearKeyNamesInfo(KeyNamesInfo *info)
-#else
-ClearKeyNamesInfo(info)
- KeyNamesInfo *info;
-#endif
{
if (info->name!=NULL)
uFree(info->name);
@@ -310,12 +259,7 @@ ClearKeyNamesInfo(info)
}
static void
-#if NeedFunctionPrototypes
InitKeyNamesInfo(KeyNamesInfo *info)
-#else
-InitKeyNamesInfo(info)
- KeyNamesInfo *info;
-#endif
{
info->name= NULL;
info->leds= NULL;
@@ -325,14 +269,8 @@ InitKeyNamesInfo(info)
return;
}
-int
-#if NeedFunctionPrototypes
+static int
FindKeyByLong(KeyNamesInfo *info,unsigned long name)
-#else
-FindKeyByLong(info,name)
- KeyNamesInfo * info;
- unsigned long name;
-#endif
{
register int i;
@@ -344,22 +282,12 @@ register int i;
}
static Bool
-#if NeedFunctionPrototypes
AddKeyName( KeyNamesInfo * info,
int kc,
char * name,
unsigned merge,
unsigned fileID,
Bool reportCollisions)
-#else
-AddKeyName(info,kc,name,merge,fileID,reportCollisions)
- KeyNamesInfo * info;
- int kc;
- char * name;
- unsigned merge;
- unsigned fileID;
- Bool reportCollisions;
-#endif
{
int old;
unsigned long lval;
@@ -442,14 +370,7 @@ unsigned long lval;
/***====================================================================***/
static void
-#if NeedFunctionPrototypes
MergeIncludedKeycodes(KeyNamesInfo *into,KeyNamesInfo *from,unsigned merge)
-#else
-MergeIncludedKeycodes(into,from,merge)
- KeyNamesInfo * into;
- KeyNamesInfo * from;
- unsigned merge;
-#endif
{
register int i;
char buf[5];
@@ -498,27 +419,17 @@ char buf[5];
}
typedef void (*FileHandler)(
-#if NeedFunctionPrototypes
XkbFile * /* rtrn */,
XkbDescPtr /* xkb */,
unsigned /* merge */,
KeyNamesInfo * /* included */
-#endif
);
static Bool
-#if NeedFunctionPrototypes
HandleIncludeKeycodes( IncludeStmt * stmt,
XkbDescPtr xkb,
KeyNamesInfo * info,
FileHandler hndlr)
-#else
-HandleIncludeKeycodes(stmt,xkb,info,hndlr)
- IncludeStmt * stmt;
- XkbDescPtr xkb;
- KeyNamesInfo * info;
- FileHandler hndlr;
-#endif
{
unsigned newMerge;
XkbFile * rtrn;
@@ -584,18 +495,10 @@ Bool haveSelf;
}
static int
-#if NeedFunctionPrototypes
HandleKeycodeDef( KeycodeDef * stmt,
XkbDescPtr xkb,
unsigned merge,
KeyNamesInfo * info)
-#else
-HandleKeycodeDef(stmt,xkb,merge,info)
- KeycodeDef * stmt;
- XkbDescPtr xkb;
- unsigned merge;
- KeyNamesInfo * info;
-#endif
{
int code;
ExprResult result;
@@ -623,15 +526,7 @@ ExprResult result;
#define MAX_KEYCODE_DEF 1
static int
-#if NeedFunctionPrototypes
HandleKeyNameVar(VarDef *stmt,XkbDescPtr xkb,unsigned merge,KeyNamesInfo *info)
-#else
-HandleKeyNameVar(stmt,xkb,merge,info)
- VarDef * stmt;
- XkbDescPtr xkb;
- unsigned merge;
- KeyNamesInfo * info;
-#endif
{
ExprResult tmp,field;
ExprDef * arrayNdx;
@@ -704,18 +599,10 @@ int which;
}
static int
-#if NeedFunctionPrototypes
HandleIndicatorNameDef( IndicatorNameDef * def,
XkbDescPtr xkb,
unsigned merge,
KeyNamesInfo * info)
-#else
-HandleIndicatorNameDef(def,xkb,merge,info)
- IndicatorNameDef * def;
- XkbDescPtr xkb;
- unsigned merge;
- KeyNamesInfo * info;
-#endif
{
IndicatorNameInfo ii;
ExprResult tmp;
@@ -742,18 +629,10 @@ ExprResult tmp;
}
static void
-#if NeedFunctionPrototypes
HandleKeycodesFile( XkbFile * file,
XkbDescPtr xkb,
unsigned merge,
KeyNamesInfo * info)
-#else
-HandleKeycodesFile(file,xkb,merge,info)
- XkbFile *file;
- XkbDescPtr xkb;
- unsigned merge;
- KeyNamesInfo *info;
-#endif
{
ParseCommon *stmt;
@@ -812,14 +691,7 @@ ParseCommon *stmt;
}
Bool
-#if NeedFunctionPrototypes
CompileKeycodes(XkbFile *file,XkbFileInfo *result,unsigned merge)
-#else
-CompileKeycodes(file,result,merge)
- XkbFile * file;
- XkbFileInfo * result;
- unsigned merge;
-#endif
{
KeyNamesInfo info;
XkbDescPtr xkb;
diff --git a/keycodes.h b/keycodes.h
index 3e93054..3558073 100644
--- a/keycodes.h
+++ b/keycodes.h
@@ -24,6 +24,7 @@
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/xkbcomp/keycodes.h,v 1.3 2002/07/01 02:26:01 tsi Exp $ */
#ifndef KEYCODES_H
#define KEYCODES_H 1
@@ -31,17 +32,13 @@
#define KeyNameToLong(n) ((((unsigned long)n[0])<<24)|(((unsigned long)n[1])<<16)|(((unsigned long)n[2])<<8)|n[3])
extern char * longText(
-#if NeedFunctionPrototypes
unsigned long /* val */,
unsigned /* format */
-#endif
);
extern void LongToKeyName(
-#if NeedFunctionPrototypes
unsigned long /* val */,
char * /* name_rtrn */
-#endif
);
#endif /* KEYCODES_H */
diff --git a/keymap.c b/keymap.c
index e696e8d..a654abd 100644
--- a/keymap.c
+++ b/keymap.c
@@ -24,6 +24,7 @@
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/xkbcomp/keymap.c,v 1.3 2002/07/01 02:26:01 tsi Exp $ */
#include "xkbcomp.h"
#include "tokens.h"
@@ -43,14 +44,7 @@
XkbFile * sections[MAX_SECTIONS];
Bool
-#if NeedFunctionPrototypes
CompileKeymap(XkbFile *file,XkbFileInfo *result,unsigned merge)
-#else
-CompileKeymap(file,result,merge)
- XkbFile * file;
- XkbFileInfo * result;
- unsigned merge;
-#endif
{
unsigned have;
Bool ok;
diff --git a/keytypes.c b/keytypes.c
index 2b2db13..3e829e8 100644
--- a/keytypes.c
+++ b/keytypes.c
@@ -24,6 +24,7 @@
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/xkbcomp/keytypes.c,v 1.5 2002/06/05 00:00:37 dawes Exp $ */
#include "xkbcomp.h"
#include "tokens.h"
@@ -90,40 +91,30 @@ Atom tok_KEYPAD;
/***====================================================================***/
-_XFUNCPROTOBEGIN
-
extern Bool AddMapEntry(
-#if NeedFunctionPrototypes
XkbDescPtr /* xkb */,
KeyTypeInfo * /* type */,
XkbKTMapEntryPtr /* new */,
Bool /* clobber */,
Bool /* report */
-#endif
);
extern Bool AddPreserve(
-#if NeedFunctionPrototypes
XkbDescPtr /* xkb */,
KeyTypeInfo * /* type */,
PreserveInfo * /* new */,
Bool /* clobber */,
Bool /* report */
-#endif
);
extern Bool AddLevelName(
-#if NeedFunctionPrototypes
KeyTypeInfo * /* type */,
unsigned /* level */,
Atom /* name */,
Bool /* clobber */,
Bool /* report */
-#endif
);
-_XFUNCPROTOEND
-
#define MapEntryTxt(t,x,e) \
XkbVModMaskText((t)->dpy,(x),(e)->mods.real_mods,(e)->mods.vmods,XkbMessage)
#define PreserveIndexTxt(t,x,p) \
@@ -137,14 +128,7 @@ _XFUNCPROTOEND
/***====================================================================***/
static void
-#if NeedFunctionPrototypes
InitKeyTypesInfo(KeyTypesInfo *info,XkbDescPtr xkb,KeyTypesInfo *from)
-#else
-InitKeyTypesInfo(info,xkb,from)
- KeyTypesInfo * info;
- XkbDescPtr xkb;
- KeyTypesInfo * from;
-#endif
{
tok_ONE_LEVEL= XkbInternAtom(NULL,"ONE_LEVEL",False);
tok_TWO_LEVEL= XkbInternAtom(NULL,"TWO_LEVEL",False);
@@ -209,12 +193,7 @@ InitKeyTypesInfo(info,xkb,from)
}
static void
-#if NeedFunctionPrototypes
FreeKeyTypeInfo(KeyTypeInfo *type)
-#else
-FreeKeyTypeInfo(type)
- KeyTypeInfo * type;
-#endif
{
if (type->entries!=NULL) {
uFree(type->entries);
@@ -232,12 +211,7 @@ FreeKeyTypeInfo(type)
}
static void
-#if NeedFunctionPrototypes
FreeKeyTypesInfo(KeyTypesInfo *info)
-#else
-FreeKeyTypesInfo(info)
- KeyTypesInfo * info;
-#endif
{
info->dpy= NULL;
if (info->name)
@@ -255,12 +229,7 @@ FreeKeyTypesInfo(info)
}
static KeyTypeInfo *
-#if NeedFunctionPrototypes
NextKeyType(KeyTypesInfo *info)
-#else
-NextKeyType(info)
- KeyTypesInfo * info;
-#endif
{
KeyTypeInfo * type;
@@ -277,13 +246,7 @@ KeyTypeInfo * type;
}
static KeyTypeInfo *
-#if NeedFunctionPrototypes
FindMatchingKeyType(KeyTypesInfo *info,KeyTypeInfo *new)
-#else
-FindMatchingKeyType(info,new)
- KeyTypesInfo * info;
- KeyTypeInfo * new;
-#endif
{
KeyTypeInfo *old;
@@ -295,14 +258,7 @@ KeyTypeInfo *old;
}
static Bool
-#if NeedFunctionPrototypes
ReportTypeBadWidth(char *type,int has,int needs)
-#else
-ReportTypeBadWidth(type,has,needs)
- char * type;
- int has;
- int needs;
-#endif
{
ERROR3("Key type \"%s\" has %d levels, must have %d\n",type,has,needs);
ACTION("Illegal type definition ignored\n");
@@ -310,14 +266,7 @@ ReportTypeBadWidth(type,has,needs)
}
static Bool
-#if NeedFunctionPrototypes
AddKeyType(XkbDescPtr xkb,KeyTypesInfo *info,KeyTypeInfo *new)
-#else
-AddKeyType(xkb,info,new)
- XkbDescPtr xkb;
- KeyTypesInfo * info;
- KeyTypeInfo * new;
-#endif
{
KeyTypeInfo * old;
@@ -393,18 +342,10 @@ KeyTypeInfo * old;
/***====================================================================***/
static void
-#if NeedFunctionPrototypes
MergeIncludedKeyTypes( KeyTypesInfo * into,
KeyTypesInfo * from,
unsigned merge,
XkbDescPtr xkb)
-#else
-MergeIncludedKeyTypes(into,from,merge,xkb)
- KeyTypesInfo *into;
- KeyTypesInfo *from;
- unsigned merge;
- XkbDescPtr xkb;
-#endif
{
KeyTypeInfo * type;
@@ -427,27 +368,17 @@ KeyTypeInfo * type;
}
typedef void (*FileHandler)(
-#if NeedFunctionPrototypes
XkbFile * /* file */,
XkbDescPtr /* xkb */,
unsigned /* merge */,
KeyTypesInfo * /* included */
-#endif
);
static Bool
-#if NeedFunctionPrototypes
HandleIncludeKeyTypes( IncludeStmt * stmt,
XkbDescPtr xkb,
KeyTypesInfo * info,
FileHandler hndlr)
-#else
-HandleIncludeKeyTypes(stmt,xkb,info,hndlr)
- IncludeStmt * stmt;
- XkbDescPtr xkb;
- KeyTypesInfo * info;
- FileHandler hndlr;
-#endif
{
unsigned newMerge;
XkbFile * rtrn;
@@ -514,14 +445,7 @@ Bool haveSelf;
/***====================================================================***/
static XkbKTMapEntryPtr
-#if NeedFunctionPrototypes
FindMatchingMapEntry(KeyTypeInfo *type,unsigned mask,unsigned vmask)
-#else
-FindMatchingMapEntry(type,mask,vmask)
- KeyTypeInfo * type;
- unsigned mask;
- unsigned vmask;
-#endif
{
register int i;
XkbKTMapEntryPtr entry;
@@ -534,12 +458,7 @@ XkbKTMapEntryPtr entry;
}
static void
-#if NeedFunctionPrototypes
DeleteLevel1MapEntries(KeyTypeInfo *type)
-#else
-DeleteLevel1MapEntries(type)
- KeyTypeInfo * type;
-#endif
{
register int i,n;
@@ -555,12 +474,7 @@ register int i,n;
}
static XkbKTMapEntryPtr
-#if NeedFunctionPrototypes
NextMapEntry(KeyTypeInfo *type)
-#else
-NextMapEntry(type)
- KeyTypeInfo * type;
-#endif
{
if (type->entries==NULL) {
type->entries= uTypedCalloc(2,XkbKTMapEntryRec);
@@ -587,20 +501,11 @@ NextMapEntry(type)
}
Bool
-#if NeedFunctionPrototypes
AddPreserve( XkbDescPtr xkb,
KeyTypeInfo * type,
PreserveInfo * new,
Bool clobber,
Bool report)
-#else
-AddPreserve(xkb,type,new,clobber,report)
- XkbDescPtr xkb;
- KeyTypeInfo * type;
- PreserveInfo * new;
- Bool clobber;
- Bool report;
-#endif
{
PreserveInfo *old;
@@ -650,20 +555,11 @@ PreserveInfo *old;
}
Bool
-#if NeedFunctionPrototypes
AddMapEntry( XkbDescPtr xkb,
KeyTypeInfo * type,
XkbKTMapEntryPtr new,
Bool clobber,
Bool report)
-#else
-AddMapEntry(xkb,type,new,clobber,report)
- XkbDescPtr xkb;
- KeyTypeInfo * type;
- XkbKTMapEntryPtr new;
- Bool clobber;
- Bool report;
-#endif
{
XkbKTMapEntryPtr old;
@@ -718,18 +614,10 @@ static LookupEntry lnames[] = {
};
static Bool
-#if NeedFunctionPrototypes
SetMapEntry( KeyTypeInfo * type,
XkbDescPtr xkb,
ExprDef * arrayNdx,
ExprDef * value)
-#else
-SetMapEntry(type,xkb,arrayNdx,value)
- KeyTypeInfo * type;
- XkbDescPtr xkb;
- ExprDef * arrayNdx;
- ExprDef * value;
-#endif
{
ExprResult rtrn;
XkbKTMapEntryRec entry;
@@ -771,18 +659,10 @@ XkbKTMapEntryRec entry;
}
static Bool
-#if NeedFunctionPrototypes
SetPreserve( KeyTypeInfo * type,
XkbDescPtr xkb,
ExprDef * arrayNdx,
ExprDef * value)
-#else
-SetPreserve(type,xkb,arrayNdx,value)
- KeyTypeInfo * type;
- XkbDescPtr xkb;
- ExprDef * arrayNdx;
- ExprDef * value;
-#endif
{
ExprResult rtrn;
PreserveInfo new;
@@ -834,20 +714,11 @@ PreserveInfo new;
/***====================================================================***/
Bool
-#if NeedFunctionPrototypes
AddLevelName( KeyTypeInfo * type,
unsigned level,
Atom name,
Bool clobber,
Bool report)
-#else
-AddLevelName(type,level,name,clobber,report)
- KeyTypeInfo * type;
- unsigned level;
- Atom name;
- Bool clobber;
- Bool report;
-#endif
{
if ((type->lvlNames==NULL)||(type->szNames<=level)) {
type->lvlNames=
@@ -889,14 +760,7 @@ AddLevelName(type,level,name,clobber,report)
}
static Bool
-#if NeedFunctionPrototypes
SetLevelName(KeyTypeInfo *type,ExprDef *arrayNdx,ExprDef *value)
-#else
-SetLevelName(type,arrayNdx,value)
- KeyTypeInfo * type;
- ExprDef * arrayNdx;
- ExprDef * value;
-#endif
{
ExprResult rtrn;
unsigned level;
@@ -927,22 +791,12 @@ unsigned level;
/***====================================================================***/
static Bool
-#if NeedFunctionPrototypes
SetKeyTypeField( KeyTypeInfo * type,
XkbDescPtr xkb,
char * field,
ExprDef * arrayNdx,
ExprDef * value,
KeyTypesInfo * info)
-#else
-SetKeyTypeField(type,xkb,field,arrayNdx,value,info)
- KeyTypeInfo * type;
- XkbDescPtr xkb;
- char * field;
- ExprDef * arrayNdx;
- ExprDef * value;
- KeyTypesInfo * info;
-#endif
{
ExprResult tmp;
@@ -992,14 +846,7 @@ ExprResult tmp;
}
static Bool
-#if NeedFunctionPrototypes
HandleKeyTypeVar(VarDef *stmt,XkbDescPtr xkb,KeyTypesInfo *info)
-#else
-HandleKeyTypeVar(stmt,xkb,info)
- VarDef * stmt;
- XkbDescPtr xkb;
- KeyTypesInfo * info;
-#endif
{
ExprResult elem,field;
ExprDef * arrayNdx;
@@ -1021,18 +868,10 @@ ExprDef * arrayNdx;
}
static int
-#if NeedFunctionPrototypes
HandleKeyTypeBody( VarDef * def,
XkbDescPtr xkb,
KeyTypeInfo * type,
KeyTypesInfo * info)
-#else
-HandleKeyTypeBody(def,xkb,type,info)
- VarDef * def;
- XkbDescPtr xkb;
- KeyTypeInfo * type;
- KeyTypesInfo * info;
-#endif
{
int ok= 1;
ExprResult tmp,field;
@@ -1051,18 +890,10 @@ ExprDef * arrayNdx;
}
static int
-#if NeedFunctionPrototypes
HandleKeyTypeDef( KeyTypeDef * def,
XkbDescPtr xkb,
unsigned merge,
KeyTypesInfo * info)
-#else
-HandleKeyTypeDef(def,xkb,merge,info)
- KeyTypeDef * def;
- XkbDescPtr xkb;
- unsigned merge;
- KeyTypesInfo * info;
-#endif
{
register int i;
KeyTypeInfo type;
@@ -1124,25 +955,14 @@ KeyTypeInfo type;
}
static void
-#if NeedFunctionPrototypes
HandleKeyTypesFile( XkbFile * file,
XkbDescPtr xkb,
unsigned merge,
KeyTypesInfo * info)
-#else
-HandleKeyTypesFile(file,xkb,merge,info)
- XkbFile *file;
- XkbDescPtr xkb;
- unsigned merge;
- KeyTypesInfo *info;
-#endif
{
ParseCommon *stmt;
- if ((merge==MergeOverride)||(info->name==None))
- info->name= file->name;
-
- info->name= file->name;
+ info->name= uStringDup(file->name);
stmt= file->defs;
while (stmt) {
switch (stmt->stmtType) {
@@ -1196,14 +1016,7 @@ ParseCommon *stmt;
}
static Bool
-#if NeedFunctionPrototypes
CopyDefToKeyType(XkbDescPtr xkb,XkbKeyTypePtr type,KeyTypeInfo *def)
-#else
-CopyDefToKeyType(xkb,type,def)
- XkbDescPtr xkb;
- XkbKeyTypePtr type;
- KeyTypeInfo * def;
-#endif
{
register int i;
PreserveInfo *pre;
@@ -1265,14 +1078,7 @@ PreserveInfo *pre;
}
Bool
-#if NeedFunctionPrototypes
CompileKeyTypes(XkbFile *file,XkbFileInfo *result,unsigned merge)
-#else
-CompileKeyTypes(file,result,merge)
- XkbFile * file;
- XkbFileInfo * result;
- unsigned merge;
-#endif
{
KeyTypesInfo info;
XkbDescPtr xkb;
diff --git a/listing.c b/listing.c
index c87e178..ac4ee61 100644
--- a/listing.c
+++ b/listing.c
@@ -70,6 +70,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
+/* $XFree86: xc/programs/xkbcomp/listing.c,v 3.10 2002/06/05 00:00:37 dawes Exp $ */
#include <stdio.h>
@@ -85,9 +86,7 @@ SOFTWARE.
#define DEBUG_VAR_NOT_LOCAL
#define DEBUG_VAR listingDebug
#include "xkbcomp.h"
-#ifndef X_NOT_STDC_ENV
#include <stdlib.h>
-#endif
#ifndef X_NOT_POSIX
#ifdef _POSIX_SOURCE
#include <limits.h>
@@ -163,12 +162,7 @@ static Listing * list= NULL;
/***====================================================================***/
int
-#if NeedFunctionPrototypes
AddMapOnly(char *map)
-#else
-AddMapOnly(map)
- char *map;
-#endif
{
if (nMapOnly>=szMapOnly) {
if (szMapOnly<1) szMapOnly= 5;
@@ -184,13 +178,7 @@ AddMapOnly(map)
}
int
-#if NeedFunctionPrototypes
AddListing(char *file,char *map)
-#else
-AddListing(file,map)
- char *file;
- char *map;
-#endif
{
if (nListed>=szListing) {
if (szListing<1) szListing= 10;
@@ -214,14 +202,7 @@ AddListing(file,map)
/***====================================================================***/
static void
-#if NeedFunctionPrototypes
ListFile(FILE *outFile,char *fileName,XkbFile *map)
-#else
-ListFile(outFile,fileName,map)
-FILE * outFile;
-char * fileName;
-XkbFile * map;
-#endif
{
register unsigned flags;
char * mapName;
@@ -269,15 +250,7 @@ char * mapName;
/***====================================================================***/
static int
-#if NeedFunctionPrototypes
AddDirectory(char *head,char *ptrn,char *rest,char *map)
-#else
-AddDirectory(head,ptrn,rest,map)
- char * head;
- char * ptrn;
- char * rest;
- char * map;
-#endif
{
#ifdef WIN32
HANDLE dirh;
@@ -359,12 +332,7 @@ AddDirectory(head,ptrn,rest,map)
/***====================================================================***/
Bool
-#if NeedFunctionPrototypes
AddMatchingFiles(char *head_in)
-#else
-AddMatchingFiles(head_in)
- char * head_in;
-#endif
{
char *str,*head,*ptrn,*rest= NULL;
@@ -406,10 +374,8 @@ char *str,*head,*ptrn,*rest= NULL;
/***====================================================================***/
-Bool
-MapMatches(mapToConsider,ptrn)
- char * mapToConsider;
- char * ptrn;
+static Bool
+MapMatches(char *mapToConsider, char *ptrn)
{
int i;
@@ -425,12 +391,7 @@ int i;
}
int
-#if NeedFunctionPrototypes
GenerateListing(char *out_name)
-#else
-GenerateListing(out_name)
- char * out_name;
-#endif
{
int i;
FILE * inputFile,*outFile;
@@ -482,6 +443,7 @@ char * mapName;
WARN1("Couldn't open \"%s\"\n",list[i].file);
continue;
}
+ setScanState(list[i].file, 1);
if (XKBParseFile(inputFile,&rtrn)&&(rtrn!=NULL)) {
mapName= list[i].map;
mapToUse= rtrn;
diff --git a/misc.c b/misc.c
index d9dd413..1cdbf1f 100644
--- a/misc.c
+++ b/misc.c
@@ -24,6 +24,7 @@
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/xkbcomp/misc.c,v 3.6 2002/12/20 20:18:33 paulo Exp $ */
#include "xkbcomp.h"
#include "xkbpath.h"
@@ -38,18 +39,10 @@
/***====================================================================***/
Bool
-#if NeedFunctionPrototypes
ProcessIncludeFile( IncludeStmt * stmt,
unsigned file_type,
XkbFile ** file_rtrn,
unsigned * merge_rtrn)
-#else
-ProcessIncludeFile(stmt,file_type,file_rtrn,merge_rtrn)
- IncludeStmt * stmt;
- unsigned file_type;
- XkbFile ** file_rtrn;
- unsigned * merge_rtrn;
-#endif
{
FILE *file;
XkbFile *rtrn,*mapToUse;
@@ -107,12 +100,8 @@ int oldLine = lineNum;
ACTION1("Include file \"%s\" ignored\n",stmt->file);
return False;
}
- if (mapToUse->compiled) {
- ERROR2("Map \"%s(%s)\" included more than once\n",stmt->file,
- rtrn->name);
- ACTION("Later inclusion ignored\n");
- return False;
- }
+ /* FIXME: we have to check recursive includes here (or somewhere) */
+
mapToUse->compiled= True;
*file_rtrn= mapToUse;
*merge_rtrn= stmt->merge;
@@ -122,14 +111,7 @@ int oldLine = lineNum;
/***====================================================================***/
int
-#if NeedFunctionPrototypes
ReportNotArray(char *type,char *field,char *name)
-#else
-ReportNotArray(type,field,name)
- char * type;
- char * field;
- char * name;
-#endif
{
ERROR2("The %s %s field is not an array\n",type,field);
ACTION1("Ignoring illegal assignment in %s\n",name);
@@ -137,14 +119,7 @@ ReportNotArray(type,field,name)
}
int
-#if NeedFunctionPrototypes
ReportShouldBeArray(char *type,char *field,char *name)
-#else
-ReportShouldBeArray(type,field,name)
- char * type;
- char * field;
- char * name;
-#endif
{
ERROR2("Missing subscript for %s %s\n",type,field);
ACTION1("Ignoring illegal assignment in %s\n",name);
@@ -152,15 +127,7 @@ ReportShouldBeArray(type,field,name)
}
int
-#if NeedFunctionPrototypes
ReportBadType(char *type,char *field,char *name,char *wanted)
-#else
-ReportBadType(type,field,name,wanted)
- char *type;
- char *field;
- char *name;
- char *wanted;
-#endif
{
ERROR3("The %s %s field must be a %s\n",type,field,wanted);
ACTION1("Ignoring illegal assignment in %s\n",name);
@@ -168,15 +135,7 @@ ReportBadType(type,field,name,wanted)
}
int
-#if NeedFunctionPrototypes
ReportBadIndexType(char *type,char *field,char *name,char *wanted)
-#else
-ReportBadIndexType(type,field,name,wanted)
- char *type;
- char *field;
- char *name;
- char *wanted;
-#endif
{
ERROR3("Index for the %s %s field must be a %s\n",type,field,wanted);
ACTION1("Ignoring assignment to illegal field in %s\n",name);
@@ -184,14 +143,7 @@ ReportBadIndexType(type,field,name,wanted)
}
int
-#if NeedFunctionPrototypes
ReportBadField(char *type,char *field,char *name)
-#else
-ReportBadField(type,field,name)
- char *type;
- char *field;
- char *name;
-#endif
{
ERROR3("Unknown %s field %s in %s\n",type,field,name);
ACTION1("Ignoring assignment to unknown field in %s\n",name);
@@ -199,14 +151,7 @@ ReportBadField(type,field,name)
}
int
-#if NeedFunctionPrototypes
ReportMultipleDefs(char *type,char *field,char *name)
-#else
-ReportMultipleDefs(type,field,name)
- char *type;
- char *field;
- char *name;
-#endif
{
WARN3("Multiple definitions of %s in %s \"%s\"\n",field,type,name);
ACTION("Using last definition\n");
@@ -216,18 +161,10 @@ ReportMultipleDefs(type,field,name)
/***====================================================================***/
Bool
-#if NeedFunctionPrototypes
UseNewField( unsigned field,
CommonInfo * oldDefs,
CommonInfo * newDefs,
unsigned * pCollide)
-#else
-UseNewField(field,oldDefs,newDefs,pCollide)
- unsigned field;
- CommonInfo * oldDefs;
- CommonInfo * newDefs;
- unsigned * pCollide;
-#endif
{
Bool useNew;
@@ -248,18 +185,10 @@ Bool useNew;
}
Bool
-#if NeedFunctionPrototypes
MergeNewField( unsigned field,
CommonInfo * oldDefs,
CommonInfo * newDefs,
unsigned * pCollide)
-#else
-MergeNewField(field,oldDefs,newDefs,pCollide)
- unsigned field;
- CommonInfo * oldDefs;
- CommonInfo * newDefs;
- unsigned * pCollide;
-#endif
{
if ((oldDefs->defined&field)&&(newDefs->defined&field)) {
if (((oldDefs->fileID==newDefs->fileID)&&(warningLevel>0))||
@@ -273,12 +202,7 @@ MergeNewField(field,oldDefs,newDefs,pCollide)
}
XPointer
-#if NeedFunctionPrototypes
ClearCommonInfo(CommonInfo *cmn)
-#else
-ClearCommonInfo(cmn)
- CommonInfo * cmn;
-#endif
{
if (cmn!=NULL) {
CommonInfo *this,*next;
@@ -291,13 +215,7 @@ ClearCommonInfo(cmn)
}
XPointer
-#if NeedFunctionPrototypes
AddCommonInfo(CommonInfo *old,CommonInfo *new)
-#else
-AddCommonInfo(old,new)
- CommonInfo * old;
- CommonInfo * new;
-#endif
{
CommonInfo * first;
@@ -432,12 +350,7 @@ KeyNameDesc dfltKeys[] = {
};
Status
-#if NeedFunctionPrototypes
ComputeKbdDefaults(XkbDescPtr xkb)
-#else
-ComputeKbdDefaults(xkb)
- XkbDescPtr xkb;
-#endif
{
Status rtrn;
register int i,tmp,nUnknown;
@@ -494,22 +407,12 @@ KeySym * syms;
}
Bool
-#if NeedFunctionPrototypes
FindNamedKey( XkbDescPtr xkb,
unsigned long name,
unsigned int * kc_rtrn,
Bool use_aliases,
Bool create,
int start_from)
-#else
-FindNamedKey(xkb,name,kc_rtrn,use_aliases,create,start_from)
- XkbDescPtr xkb;
- unsigned long name;
- unsigned int * kc_rtrn;
- Bool use_aliases;
- Bool create;
- int start_from;
-#endif
{
register unsigned n;
@@ -565,14 +468,7 @@ register unsigned n;
}
Bool
-#if NeedFunctionPrototypes
FindKeyNameForAlias(XkbDescPtr xkb,unsigned long lname,unsigned long *real_name)
-#else
-FindKeyNameForAlias(xkb,lname,real_name)
- XkbDescPtr xkb;
- unsigned long lname;
- unsigned long * real_name;
-#endif
{
register int i;
char name[XkbKeyNameLength+1];
diff --git a/misc.h b/misc.h
index 24dfc7d..6789330 100644
--- a/misc.h
+++ b/misc.h
@@ -24,6 +24,7 @@
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/xkbcomp/misc.h,v 1.5 2002/07/01 02:26:01 tsi Exp $ */
#ifndef MISC_H
#define MISC_H 1
@@ -35,123 +36,91 @@ typedef struct _CommonInfo {
struct _CommonInfo * next;
} CommonInfo;
-_XFUNCPROTOBEGIN
-
extern Bool UseNewField(
-#if NeedFunctionPrototypes
unsigned /* field */,
CommonInfo * /* oldDefs */,
CommonInfo * /* newDefs */,
unsigned * /* pCollide */
-#endif
);
extern Bool MergeNewField(
-#if NeedFunctionPrototypes
unsigned /* field */,
CommonInfo * /* oldDefs */,
CommonInfo * /* newDefs */,
unsigned * /* pCollide */
-#endif
);
extern XPointer ClearCommonInfo(
-#if NeedFunctionPrototypes
CommonInfo * /* cmn */
-#endif
);
extern XPointer AddCommonInfo(
-#if NeedFunctionPrototypes
CommonInfo * /* old */,
CommonInfo * /* new */
-#endif
);
extern int ReportNotArray(
-#if NeedFunctionPrototypes
char * /* type */,
char * /* field */,
char * /* name */
-#endif
);
extern int ReportShouldBeArray(
-#if NeedFunctionPrototypes
char * /* type */,
char * /* field */,
char * /* name */
-#endif
);
extern int ReportBadType(
-#if NeedFunctionPrototypes
char * /* type */,
char * /* field */,
char * /* name */,
char * /* wanted */
-#endif
);
extern int ReportBadIndexType(
-#if NeedFunctionPrototypes
char * /* type */,
char * /* field */,
char * /* name */,
char * /* wanted */
-#endif
);
extern int ReportBadField(
-#if NeedFunctionPrototypes
char * /* type */,
char * /* field */,
char * /* name */
-#endif
);
extern int ReportMultipleDefs(
-#if NeedFunctionPrototypes
char * /* type */,
char * /* field */,
char * /* which */
-#endif
);
extern Bool ProcessIncludeFile(
-#if NeedFunctionPrototypes
IncludeStmt * /* stmt */,
unsigned /* file_type */,
XkbFile ** /* file_rtrn */,
unsigned * /* merge_rtrn */
-#endif
);
extern Status ComputeKbdDefaults(
-#if NeedFunctionPrototypes
XkbDescPtr /* xkb */
-#endif
);
extern Bool FindNamedKey(
-#if NeedFunctionPrototypes
XkbDescPtr /* xkb */,
unsigned long /* name */,
unsigned int * /* kc_rtrn */,
Bool /* use_aliases */,
Bool /* create */,
int /* start_from */
-#endif
);
extern Bool FindKeyNameForAlias(
-#if NeedFunctionPrototypes
XkbDescPtr /* xkb */,
unsigned long /* lname */,
unsigned long * /* real_name */
-#endif
);
-_XFUNCPROTOEND
-
#endif /* MISC_H */
diff --git a/parseutils.c b/parseutils.c
index 468d620..88a2b20 100644
--- a/parseutils.c
+++ b/parseutils.c
@@ -24,6 +24,8 @@
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/xkbcomp/parseutils.c,v 1.5 2002/07/01 02:26:01 tsi Exp $ */
+
#define DEBUG_VAR_NOT_LOCAL
#define DEBUG_VAR parseDebug
#include "parseutils.h"
@@ -35,13 +37,7 @@
XkbFile *rtrnValue;
ParseCommon *
-#if NeedFunctionPrototypes
AppendStmt(ParseCommon *to,ParseCommon *append)
-#else
-AppendStmt(to,append)
- ParseCommon * to;
- ParseCommon * append;
-#endif
{
ParseCommon *start= to;
@@ -58,13 +54,7 @@ ParseCommon *start= to;
}
ExprDef *
-#if NeedFunctionPrototypes
ExprCreate(unsigned op,unsigned type)
-#else
-ExprCreate(op,type)
- unsigned op;
- unsigned type;
-#endif
{
ExprDef *expr;
expr= uTypedAlloc(ExprDef);
@@ -82,14 +72,7 @@ ExprDef *expr;
}
ExprDef *
-#if NeedFunctionPrototypes
ExprCreateUnary(unsigned op,unsigned type,ExprDef *child)
-#else
-ExprCreateUnary(op,type,child)
- unsigned op;
- unsigned type;
- ExprDef *child;
-#endif
{
ExprDef *expr;
expr= uTypedAlloc(ExprDef);
@@ -108,14 +91,7 @@ ExprDef *expr;
}
ExprDef *
-#if NeedFunctionPrototypes
ExprCreateBinary(unsigned op,ExprDef *left,ExprDef *right)
-#else
-ExprCreateBinary(op,left,right)
- unsigned op;
- ExprDef *left;
- ExprDef *right;
-#endif
{
ExprDef *expr;
expr= uTypedAlloc(ExprDef);
@@ -139,13 +115,7 @@ ExprDef *expr;
}
KeycodeDef *
-#if NeedFunctionPrototypes
KeycodeCreate(char *name,ExprDef *value)
-#else
-KeycodeCreate(name,value)
- char * name;
- ExprDef * value;
-#endif
{
KeycodeDef *def;
@@ -165,13 +135,7 @@ KeycodeDef *def;
}
KeyAliasDef *
-#if NeedFunctionPrototypes
KeyAliasCreate(char *alias,char *real)
-#else
-KeyAliasCreate(alias,real)
- char * alias;
- char * real;
-#endif
{
KeyAliasDef *def;
@@ -192,13 +156,7 @@ KeyAliasDef *def;
}
VModDef *
-#if NeedFunctionPrototypes
VModCreate(Atom name,ExprDef *value)
-#else
-VModCreate(name,value)
- Atom name;
- ExprDef * value;
-#endif
{
VModDef *def;
def= uTypedAlloc(VModDef);
@@ -216,13 +174,7 @@ VModDef *def;
}
VarDef *
-#if NeedFunctionPrototypes
VarCreate(ExprDef *name,ExprDef *value)
-#else
-VarCreate(name,value)
- ExprDef * name;
- ExprDef * value;
-#endif
{
VarDef *def;
def= uTypedAlloc(VarDef);
@@ -240,13 +192,7 @@ VarDef *def;
}
VarDef *
-#if NeedFunctionPrototypes
BoolVarCreate(Atom nameToken,unsigned set)
-#else
-BoolVarCreate(nameToken,set)
- Atom nameToken;
- unsigned set;
-#endif
{
ExprDef *name,*value;
@@ -258,13 +204,7 @@ ExprDef *name,*value;
}
InterpDef *
-#if NeedFunctionPrototypes
InterpCreate(KeySym sym,ExprDef *match)
-#else
-InterpCreate(sym,match)
- KeySym sym;
- ExprDef * match;
-#endif
{
InterpDef *def;
@@ -283,13 +223,7 @@ InterpDef *def;
}
KeyTypeDef *
-#if NeedFunctionPrototypes
KeyTypeCreate(Atom name,VarDef *body)
-#else
-KeyTypeCreate(name,body)
- Atom name;
- VarDef * body;
-#endif
{
KeyTypeDef *def;
@@ -309,13 +243,7 @@ KeyTypeDef *def;
}
SymbolsDef *
-#if NeedFunctionPrototypes
SymbolsCreate(char *keyName,ExprDef *symbols)
-#else
-SymbolsCreate(keyName,symbols)
- char * keyName;
- ExprDef * symbols;
-#endif
{
SymbolsDef *def;
@@ -336,13 +264,7 @@ SymbolsDef *def;
}
GroupCompatDef *
-#if NeedFunctionPrototypes
GroupCompatCreate(int group,ExprDef *val)
-#else
-GroupCompatCreate(group,val)
- int group;
- ExprDef * val;
-#endif
{
GroupCompatDef *def;
@@ -362,13 +284,7 @@ GroupCompatDef *def;
}
ModMapDef *
-#if NeedFunctionPrototypes
ModMapCreate(Atom modifier,ExprDef *keys)
-#else
-ModMapCreate(modifier,keys)
- Atom modifier;
- ExprDef * keys;
-#endif
{
ModMapDef *def;
@@ -388,13 +304,7 @@ ModMapDef *def;
}
IndicatorMapDef *
-#if NeedFunctionPrototypes
IndicatorMapCreate(Atom name,VarDef *body)
-#else
-IndicatorMapCreate(name,body)
- Atom name;
- VarDef * body;
-#endif
{
IndicatorMapDef *def;
@@ -414,14 +324,7 @@ IndicatorMapDef *def;
}
IndicatorNameDef *
-#if NeedFunctionPrototypes
IndicatorNameCreate(int ndx,ExprDef *name,Bool virtual)
-#else
-IndicatorNameCreate(ndx,name,virtual)
- int ndx;
- ExprDef * name;
- Bool virtual;
-#endif
{
IndicatorNameDef *def;
@@ -442,13 +345,7 @@ IndicatorNameDef *def;
}
ExprDef *
-#if NeedFunctionPrototypes
ActionCreate(Atom name,ExprDef *args)
-#else
-ActionCreate(name,args)
- Atom name;
- ExprDef *args;
-#endif
{
ExprDef *act;
@@ -466,12 +363,7 @@ ExprDef *act;
}
ExprDef *
-#if NeedFunctionPrototypes
CreateKeysymList(KeySym sym)
-#else
-CreateKeysymList(sym)
- KeySym sym;
-#endif
{
ExprDef *def;
@@ -490,13 +382,7 @@ ExprDef *def;
}
ShapeDef *
-#if NeedFunctionPrototypes
ShapeDeclCreate(Atom name,OutlineDef *outlines)
-#else
-ShapeDeclCreate(name,outlines)
- Atom name;
- OutlineDef * outlines;
-#endif
{
ShapeDef * shape;
OutlineDef * ol;
@@ -519,13 +405,7 @@ OutlineDef * ol;
}
OutlineDef *
-#if NeedFunctionPrototypes
OutlineCreate(Atom field,ExprDef *points)
-#else
-OutlineCreate(field,points)
- Atom field;
- ExprDef * points;
-#endif
{
OutlineDef * outline;
ExprDef * pt;
@@ -548,13 +428,7 @@ ExprDef * pt;
}
KeyDef *
-#if NeedFunctionPrototypes
KeyDeclCreate(char *name,ExprDef *expr)
-#else
-KeyDeclCreate(name,expr)
- char * name;
- ExprDef * expr;
-#endif
{
KeyDef * key;
@@ -570,13 +444,7 @@ KeyDef * key;
}
KeyDef *
-#if NeedFunctionPrototypes
KeyDeclMerge(KeyDef *into,KeyDef *from)
-#else
-KeyDeclMerge(into,from)
- KeyDef * into;
- KeyDef * from;
-#endif
{
into->expr= (ExprDef *)AppendStmt(&into->expr->common,&from->expr->common);
from->expr= NULL;
@@ -585,12 +453,7 @@ KeyDeclMerge(into,from)
}
RowDef *
-#if NeedFunctionPrototypes
RowDeclCreate(KeyDef * keys)
-#else
-RowDeclCreate(keys)
- KeyDef * keys;
-#endif
{
RowDef * row;
KeyDef * key;
@@ -611,13 +474,7 @@ KeyDef * key;
}
SectionDef *
-#if NeedFunctionPrototypes
SectionDeclCreate(Atom name,RowDef *rows)
-#else
-SectionDeclCreate(name,rows)
- Atom name;
- RowDef * rows;
-#endif
{
SectionDef * section;
RowDef * row;
@@ -639,13 +496,7 @@ RowDef * row;
}
OverlayKeyDef *
-#if NeedFunctionPrototypes
OverlayKeyCreate(char * under,char *over)
-#else
-OverlayKeyCreate(under,over)
- char * under;
- char * over;
-#endif
{
OverlayKeyDef * key;
@@ -662,13 +513,7 @@ OverlayKeyDef * key;
}
OverlayDef *
-#if NeedFunctionPrototypes
OverlayDeclCreate(Atom name,OverlayKeyDef *keys)
-#else
-OverlayDeclCreate(name,keys)
- Atom name;
- OverlayKeyDef * keys;
-#endif
{
OverlayDef * ol;
OverlayKeyDef * key;
@@ -687,14 +532,7 @@ OverlayKeyDef * key;
}
DoodadDef *
-#if NeedFunctionPrototypes
DoodadCreate(unsigned type,Atom name,VarDef *body)
-#else
-DoodadCreate(type,name,body)
- unsigned type;
- Atom name;
- VarDef * body;
-#endif
{
DoodadDef * doodad;
@@ -711,13 +549,7 @@ DoodadDef * doodad;
}
ExprDef *
-#if NeedFunctionPrototypes
AppendKeysymList(ExprDef *list,KeySym sym)
-#else
-AppendKeysymList(list,sym)
- ExprDef * list;
- KeySym sym;
-#endif
{
if (list->value.list.nSyms>=list->value.list.szSyms) {
list->value.list.szSyms*=2;
@@ -735,13 +567,7 @@ AppendKeysymList(list,sym)
}
int
-#if NeedFunctionPrototypes
LookupKeysym(char *str,KeySym *sym_rtrn)
-#else
-LookupKeysym(str,sym_rtrn)
- char *str;
- KeySym *sym_rtrn;
-#endif
{
KeySym sym;
@@ -762,16 +588,10 @@ KeySym sym;
}
IncludeStmt *
-#if NeedFunctionPrototypes
IncludeCreate(char *str,unsigned merge)
-#else
-IncludeCreate(str,merge)
- char * str;
- unsigned merge;
-#endif
{
IncludeStmt * incl,*first;
-char * file,*map,*stmt,*tmp;
+char * file,*map,*stmt,*tmp, *extra_data;
char nextop;
Bool haveSelf;
@@ -781,7 +601,7 @@ Bool haveSelf;
tmp= str;
stmt= uStringDup(str);
while ((tmp)&&(*tmp)) {
- if (XkbParseIncludeMap(&tmp,&file,&map,&nextop)) {
+ if (XkbParseIncludeMap(&tmp,&file,&map,&nextop,&extra_data)) {
if ((file==NULL)&&(map==NULL)) {
if (haveSelf)
goto BAIL;
@@ -800,6 +620,7 @@ Bool haveSelf;
incl->stmt= NULL;
incl->file= file;
incl->map= map;
+ incl->modifier= extra_data;
incl->path= NULL;
incl->next= NULL;
}
@@ -825,6 +646,7 @@ BAIL:
incl= first->next;
if (first->file) uFree(first->file);
if (first->map) uFree(first->map);
+ if (first->modifier) uFree(first->modifier);
if (first->path) uFree(first->path);
first->file= first->map= first->path= NULL;
uFree(first);
@@ -837,12 +659,7 @@ BAIL:
#ifdef DEBUG
void
-#if NeedFunctionPrototypes
PrintStmtAddrs(ParseCommon *stmt)
-#else
-PrintStmtAddrs(stmt)
- ParseCommon * stmt;
-#endif
{
fprintf(stderr,"0x%x",stmt);
if (stmt) {
@@ -856,12 +673,7 @@ PrintStmtAddrs(stmt)
#endif
static void
-#if NeedFunctionPrototypes
CheckDefaultMap(XkbFile *maps)
-#else
-CheckDefaultMap(maps)
-XkbFile *maps;
-#endif
{
XkbFile * dflt,*tmp;
@@ -885,24 +697,8 @@ XkbFile * dflt,*tmp;
return;
}
-_XFUNCPROTOBEGIN
-extern int yyparse(
-#if NeedFunctionPrototypes
- void
-#endif
-);
-_XFUNCPROTOEND
-
-extern FILE * yyin;
-
int
-#if NeedFunctionPrototypes
XKBParseFile(FILE *file,XkbFile **pRtrn)
-#else
-XKBParseFile(file,pRtrn)
-FILE *file;
-XkbFile **pRtrn;
-#endif
{
if (file) {
yyin= file;
@@ -921,15 +717,7 @@ XkbFile **pRtrn;
}
XkbFile *
-#if NeedFunctionPrototypes
CreateXKBFile(int type,char *name,ParseCommon *defs,unsigned flags)
-#else
-CreateXKBFile(type,name,defs,flags)
-int type;
-char * name;
-ParseCommon * defs;
-unsigned flags;
-#endif
{
XkbFile * file;
static int fileID;
@@ -950,13 +738,7 @@ static int fileID;
}
unsigned
-#if NeedFunctionPrototypes
StmtSetMerge(ParseCommon *stmt,unsigned merge)
-#else
-StmtSetMerge(stmt,merge)
- ParseCommon * stmt;
- unsigned merge;
-#endif
{
if ((merge==MergeAltForm) && (stmt->stmtType!=StmtKeycodeDef)) {
yyerror("illegal use of 'alternate' merge mode");
diff --git a/parseutils.h b/parseutils.h
index 6393747..7be50d1 100644
--- a/parseutils.h
+++ b/parseutils.h
@@ -24,6 +24,7 @@
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/xkbcomp/parseutils.h,v 1.5 2002/07/01 02:26:01 tsi Exp $ */
#ifndef XKBPARSE_H
#define XKBPARSE_H 1
@@ -50,270 +51,198 @@ extern XkbFile *rtrnValue;
#define d2(str,a,b)
#endif
-_XFUNCPROTOBEGIN
extern ParseCommon *AppendStmt(
-#if NeedFunctionPrototypes
ParseCommon * /* to */,
ParseCommon * /* append */
-#endif
);
extern ExprDef *ExprCreate(
-#if NeedFunctionPrototypes
unsigned /* op */,
unsigned /* type */
-#endif
);
extern ExprDef *ExprCreateUnary(
-#if NeedFunctionPrototypes
unsigned /* op */,
unsigned /* type */,
ExprDef * /* child */
-#endif
);
extern ExprDef *ExprCreateBinary(
-#if NeedFunctionPrototypes
unsigned /* op */,
ExprDef * /* left */,
ExprDef * /* right */
-#endif
);
extern KeycodeDef *KeycodeCreate(
-#if NeedFunctionPrototypes
char * /* name */,
ExprDef * /* value */
-#endif
);
extern KeyAliasDef *KeyAliasCreate(
-#if NeedFunctionPrototypes
char * /* alias */,
char * /* real */
-#endif
);
extern VModDef *VModCreate(
-#if NeedFunctionPrototypes
Atom /* name */,
ExprDef * /* value */
-#endif
);
extern VarDef *VarCreate(
-#if NeedFunctionPrototypes
ExprDef * /* name */,
ExprDef * /* value */
-#endif
);
extern VarDef *BoolVarCreate(
-#if NeedFunctionPrototypes
Atom /* nameToken */,
unsigned /* set */
-#endif
);
extern InterpDef *InterpCreate(
-#if NeedFunctionPrototypes
KeySym /* sym */,
ExprDef * /* match */
-#endif
);
extern KeyTypeDef *KeyTypeCreate(
-#if NeedFunctionPrototypes
Atom /* name */,
VarDef * /* body */
-#endif
);
extern SymbolsDef *SymbolsCreate(
-#if NeedFunctionPrototypes
char * /* keyName */,
ExprDef * /* symbols */
-#endif
);
extern GroupCompatDef *GroupCompatCreate(
-#if NeedFunctionPrototypes
int /* group */,
ExprDef * /* def */
-#endif
);
extern ModMapDef *ModMapCreate(
-#if NeedFunctionPrototypes
Atom /* modifier */,
ExprDef * /* keys */
-#endif
);
extern IndicatorMapDef *IndicatorMapCreate(
-#if NeedFunctionPrototypes
Atom /* name */,
VarDef * /* body */
-#endif
);
extern IndicatorNameDef *IndicatorNameCreate(
-#if NeedFunctionPrototypes
int /* ndx */,
ExprDef * /* name */,
Bool /* virtual */
-#endif
);
extern ExprDef *ActionCreate(
-#if NeedFunctionPrototypes
Atom /* name */,
ExprDef * /* args */
-#endif
);
extern ExprDef *CreateKeysymList(
-#if NeedFunctionPrototypes
KeySym /* sym */
-#endif
);
extern ShapeDef *ShapeDeclCreate(
-#if NeedFunctionPrototypes
Atom /* name */,
OutlineDef * /* outlines */
-#endif
);
extern OutlineDef *OutlineCreate(
-#if NeedFunctionPrototypes
Atom /* field */,
ExprDef * /* points */
-#endif
);
extern KeyDef *KeyDeclCreate(
-#if NeedFunctionPrototypes
char * /* name */,
ExprDef * /* expr */
-#endif
);
extern KeyDef *KeyDeclMerge(
-#if NeedFunctionPrototypes
KeyDef * /* into */,
KeyDef * /* from */
-#endif
);
extern RowDef *RowDeclCreate(
-#if NeedFunctionPrototypes
KeyDef * /* keys */
-#endif
);
extern SectionDef *SectionDeclCreate(
-#if NeedFunctionPrototypes
Atom /* name */,
RowDef * /* rows */
-#endif
);
extern OverlayKeyDef *OverlayKeyCreate(
-#if NeedFunctionPrototypes
char * /* under */,
char * /* over */
-#endif
);
extern OverlayDef *OverlayDeclCreate(
-#if NeedFunctionPrototypes
Atom /* name */,
OverlayKeyDef * /* rows */
-#endif
);
extern DoodadDef *DoodadCreate(
-#if NeedFunctionPrototypes
unsigned /* type */,
Atom /* name */,
VarDef * /* body */
-#endif
);
extern ExprDef *AppendKeysymList(
-#if NeedFunctionPrototypes
ExprDef * /* list */,
KeySym /* sym */
-#endif
);
extern int LookupKeysym(
-#if NeedFunctionPrototypes
char * /* str */,
KeySym * /* sym_rtrn */
-#endif
);
extern IncludeStmt *IncludeCreate(
-#if NeedFunctionPrototypes
char * /* str */,
unsigned /* merge */
-#endif
);
extern unsigned StmtSetMerge(
-#if NeedFunctionPrototypes
ParseCommon * /* stmt */,
unsigned /* merge */
-#endif
);
#ifdef DEBUG
extern void PrintStmtAddrs(
-#if NeedFunctionPrototypes
ParseCommon * /* stmt */
-#endif
);
#endif
extern int XKBParseFile(
-#if NeedFunctionPrototypes
-FILE * /* file */,
+ FILE * /* file */,
XkbFile ** /* pRtrn */
-#endif
);
extern XkbFile *CreateXKBFile(
-#if NeedFunctionPrototypes
int /* type */,
char * /* name */,
ParseCommon * /* defs */,
unsigned /* flags */
-#endif
);
extern void yyerror(
-#if NeedFunctionPrototypes
char * /* s */
-#endif
);
extern int yywrap(
-#if NeedFunctionPrototypes
void
-#endif
);
+extern int yylex(void);
+extern int yyparse(void);
+
extern int setScanState(
-#if NeedFunctionPrototypes
char * /* file */,
int /* line */
-#endif
);
-_XFUNCPROTOEND
+extern FILE *yyin;
#endif /* XKBPARSE_H */
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++;
}
diff --git a/utils.c b/utils.c
index 37058c7..db4bee2 100644
--- a/utils.c
+++ b/utils.c
@@ -25,24 +25,17 @@
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
\*/
+/* $XFree86: xc/programs/xkbcomp/utils.c,v 3.7 2002/06/05 00:00:37 dawes Exp $ */
#include "utils.h"
#include <ctype.h>
-#ifndef X_NOT_STDC_ENV
-#include <stdlib.h>
-#else
-char *malloc();
-#endif
+#include <stdlib.h>
+#include <stdarg.h>
/***====================================================================***/
Opaque
-#if NeedFunctionPrototypes
uAlloc(unsigned size)
-#else
-uAlloc(size)
- unsigned size;
-#endif
{
return((Opaque)malloc(size));
}
@@ -50,13 +43,7 @@ uAlloc(size)
/***====================================================================***/
Opaque
-#if NeedFunctionPrototypes
uCalloc(unsigned n,unsigned size)
-#else
-uCalloc(n,size)
- unsigned n;
- unsigned size;
-#endif
{
return((Opaque)calloc(n,size));
}
@@ -64,13 +51,7 @@ uCalloc(n,size)
/***====================================================================***/
Opaque
-#if NeedFunctionPrototypes
uRealloc(Opaque old,unsigned newSize)
-#else
-uRealloc(old,newSize)
- Opaque old;
- unsigned newSize;
-#endif
{
if (old==NULL)
return((Opaque)malloc(newSize));
@@ -80,15 +61,7 @@ uRealloc(old,newSize)
/***====================================================================***/
Opaque
-#if NeedFunctionPrototypes
uRecalloc(Opaque old,unsigned nOld,unsigned nNew,unsigned itemSize)
-#else
-uRecalloc(old,nOld,nNew,itemSize)
- Opaque old;
- unsigned nOld;
- unsigned nNew;
- unsigned itemSize;
-#endif
{
char *rtrn;
@@ -106,12 +79,7 @@ char *rtrn;
/***====================================================================***/
void
-#if NeedFunctionPrototypes
uFree(Opaque ptr)
-#else
-uFree(ptr)
- Opaque ptr;
-#endif
{
if (ptr!=(Opaque)NULL)
free((char *)ptr);
@@ -122,16 +90,11 @@ uFree(ptr)
/*** FUNCTION ENTRY TRACKING ***/
/***====================================================================***/
-static FILE *entryFile= stderr;
+static FILE *entryFile= NULL;
int uEntryLevel;
Boolean
-#if NeedFunctionPrototypes
uSetEntryFile(char *name)
-#else
-uSetEntryFile(name)
- char *name;
-#endif
{
if ((entryFile!=NULL)&&(entryFile!=stderr)) {
fprintf(entryFile,"switching to %s\n",name?name:"stderr");
@@ -147,34 +110,22 @@ uSetEntryFile(name)
}
void
-#if NeedFunctionPrototypes
-uEntry(int l,char *s,Opaque a1,Opaque a2,Opaque a3,Opaque a4,Opaque a5,
- Opaque a6)
-#else
-uEntry(l,s,a1,a2,a3,a4,a5,a6)
-int l;
-char *s;
-Opaque a1,a2,a3,a4,a5,a6;
-#endif
+uEntry(int l,char *s,...)
{
int i;
+va_list args;
for (i=0;i<uEntryLevel;i++) {
putc(' ',entryFile);
}
- fprintf(entryFile,s,a1,a2,a3,a4,a5,a6);
+ va_start(args, s);
+ vfprintf(entryFile,s,args);
+ va_end(args);
uEntryLevel+= l;
- return;
}
void
-#if NeedFunctionPrototypes
uExit(int l,char *rtVal)
-#else
-uExit(l,rtVal)
- int l;
- char * rtVal;
-#endif
{
int i;
@@ -183,7 +134,7 @@ int i;
for (i=0;i<uEntryLevel;i++) {
putc(' ',entryFile);
}
- fprintf(entryFile,"---> 0x%x\n",rtVal);
+ fprintf(entryFile,"---> %p\n",rtVal);
return;
}
@@ -191,17 +142,12 @@ int i;
/*** PRINT FUNCTIONS ***/
/***====================================================================***/
- FILE *uDebugFile= stderr;
+ FILE *uDebugFile= NULL;
int uDebugIndentLevel= 0;
int uDebugIndentSize= 4;
Boolean
-#if NeedFunctionPrototypes
uSetDebugFile(char *name)
-#else
-uSetDebugFile(name)
- char *name;
-#endif
{
if ((uDebugFile!=NULL)&&(uDebugFile!=stderr)) {
fprintf(uDebugFile,"switching to %s\n",name?name:"stderr");
@@ -217,53 +163,41 @@ uSetDebugFile(name)
}
void
-#if NeedFunctionPrototypes
-uDebug(char *s,Opaque a1,Opaque a2,Opaque a3,Opaque a4,Opaque a5,Opaque a6)
-#else
-uDebug(s,a1,a2,a3,a4,a5,a6)
-char *s;
-Opaque a1,a2,a3,a4,a5,a6;
-#endif
+uDebug(char *s,...)
{
int i;
+va_list args;
for (i=(uDebugIndentLevel*uDebugIndentSize);i>0;i--) {
putc(' ',uDebugFile);
}
- fprintf(uDebugFile,s,a1,a2,a3,a4,a5,a6);
+ va_start(args, s);
+ vfprintf(uDebugFile,s,args);
+ va_end(args);
fflush(uDebugFile);
- return;
}
void
-#if NeedFunctionPrototypes
-uDebugNOI(char *s,Opaque a1,Opaque a2,Opaque a3,Opaque a4,Opaque a5,Opaque a6)
-#else
-uDebugNOI(s,a1,a2,a3,a4,a5,a6)
-char *s;
-Opaque a1,a2,a3,a4,a5,a6;
-#endif
+uDebugNOI(char *s,...)
{
- fprintf(uDebugFile,s,a1,a2,a3,a4,a5,a6);
+va_list args;
+
+ va_start(args, s);
+ vfprintf(uDebugFile,s,args);
+ va_end(args);
fflush(uDebugFile);
- return;
}
/***====================================================================***/
-static FILE *errorFile= stderr;
+static FILE *errorFile= NULL;
static int outCount= 0;
static char *preMsg= NULL;
static char *postMsg= NULL;
static char *prefix= NULL;
Boolean
-#if NeedFunctionPrototypes
uSetErrorFile(char *name)
-#else
-uSetErrorFile(name)
- char *name;
-#endif
{
if ((errorFile!=NULL)&&(errorFile!=stderr)) {
fprintf(errorFile,"switching to %s\n",name?name:"stderr");
@@ -279,100 +213,85 @@ uSetErrorFile(name)
}
void
-#if NeedFunctionPrototypes
-uInformation(char *s,Opaque a1,Opaque a2,Opaque a3,Opaque a4,Opaque a5,
- Opaque a6)
-#else
-uInformation(s,a1,a2,a3,a4,a5,a6)
-char *s;
-Opaque a1,a2,a3,a4,a5,a6;
-#endif
+uInformation(char *s, ...)
{
- fprintf(errorFile,s,a1,a2,a3,a4,a5,a6);
+va_list args;
+
+ va_start(args, s);
+ vfprintf(errorFile,s,args);
+ va_end(args);
fflush(errorFile);
- return;
}
/***====================================================================***/
void
-#if NeedFunctionPrototypes
-uAction(char *s,Opaque a1,Opaque a2,Opaque a3,Opaque a4,Opaque a5,Opaque a6)
-#else
-uAction(s,a1,a2,a3,a4,a5,a6)
-char *s;
-Opaque a1,a2,a3,a4,a5,a6;
-#endif
+uAction(char *s, ...)
{
+va_list args;
+
if (prefix!=NULL)
fprintf(errorFile,"%s",prefix);
fprintf(errorFile," ");
- fprintf(errorFile,s,a1,a2,a3,a4,a5,a6);
+ va_start(args, s);
+ vfprintf(errorFile,s,args);
+ va_end(args);
fflush(errorFile);
- return;
}
/***====================================================================***/
void
-#if NeedFunctionPrototypes
-uWarning(char *s,Opaque a1,Opaque a2,Opaque a3,Opaque a4,Opaque a5,Opaque a6)
-#else
-uWarning(s,a1,a2,a3,a4,a5,a6)
-char *s;
-Opaque a1,a2,a3,a4,a5,a6;
-#endif
+uWarning(char *s, ...)
{
+va_list args;
+
if ((outCount==0)&&(preMsg!=NULL))
fprintf(errorFile,"%s\n",preMsg);
if (prefix!=NULL)
fprintf(errorFile,"%s",prefix);
fprintf(errorFile,"Warning: ");
- fprintf(errorFile,s,a1,a2,a3,a4,a5,a6);
+ va_start(args, s);
+ vfprintf(errorFile,s,args);
+ va_end(args);
fflush(errorFile);
outCount++;
- return;
}
/***====================================================================***/
void
-#if NeedFunctionPrototypes
-uError(char *s,Opaque a1,Opaque a2,Opaque a3,Opaque a4,Opaque a5,Opaque a6)
-#else
-uError(s,a1,a2,a3,a4,a5,a6)
-char *s;
-Opaque a1,a2,a3,a4,a5,a6;
-#endif
+uError(char *s, ...)
{
+va_list args;
+
if ((outCount==0)&&(preMsg!=NULL))
fprintf(errorFile,"%s\n",preMsg);
if (prefix!=NULL)
fprintf(errorFile,"%s",prefix);
fprintf(errorFile,"Error: ");
- fprintf(errorFile,s,a1,a2,a3,a4,a5,a6);
+ va_start(args, s);
+ vfprintf(errorFile,s,args);
+ va_end(args);
fflush(errorFile);
outCount++;
- return;
}
/***====================================================================***/
void
-#if NeedFunctionPrototypes
-uFatalError(char *s,Opaque a1,Opaque a2,Opaque a3,Opaque a4,Opaque a5,Opaque a6)
-#else
-uFatalError(s,a1,a2,a3,a4,a5,a6)
-char *s;
-Opaque a1,a2,a3,a4,a5,a6;
-#endif
+uFatalError(char *s, ...)
{
+va_list args;
+
if ((outCount==0)&&(preMsg!=NULL))
fprintf(errorFile,"%s\n",preMsg);
if (prefix!=NULL)
fprintf(errorFile,"%s",prefix);
fprintf(errorFile,"Fatal Error: ");
- fprintf(errorFile,s,a1,a2,a3,a4,a5,a6);
+ va_start(args, s);
+ vfprintf(errorFile,s,args);
+ va_end(args);
fprintf(errorFile," Exiting\n");
fflush(errorFile);
outCount++;
@@ -383,33 +302,24 @@ Opaque a1,a2,a3,a4,a5,a6;
/***====================================================================***/
void
-#if NeedFunctionPrototypes
-uInternalError(char *s,Opaque a1,Opaque a2,Opaque a3,Opaque a4,Opaque a5,
- Opaque a6)
-#else
-uInternalError(s,a1,a2,a3,a4,a5,a6)
-char *s;
-Opaque a1,a2,a3,a4,a5,a6;
-#endif
+uInternalError(char *s, ...)
{
+va_list args;
+
if ((outCount==0)&&(preMsg!=NULL))
fprintf(errorFile,"%s\n",preMsg);
if (prefix!=NULL)
fprintf(errorFile,"%s",prefix);
fprintf(errorFile,"Internal error: ");
- fprintf(errorFile,s,a1,a2,a3,a4,a5,a6);
+ va_start(args, s);
+ vfprintf(errorFile,s,args);
+ va_end(args);
fflush(errorFile);
outCount++;
- return;
}
void
-#if NeedFunctionPrototypes
uSetPreErrorMessage(char *msg)
-#else
-uSetPreErrorMessage(msg)
- char *msg;
-#endif
{
outCount= 0;
preMsg= msg;
@@ -417,35 +327,21 @@ uSetPreErrorMessage(msg)
}
void
-#if NeedFunctionPrototypes
uSetPostErrorMessage(char *msg)
-#else
-uSetPostErrorMessage(msg)
- char *msg;
-#endif
{
postMsg= msg;
return;
}
void
-#if NeedFunctionPrototypes
uSetErrorPrefix(char *pre)
-#else
-uSetErrorPrefix(pre)
- char *pre;
-#endif
{
prefix= pre;
return;
}
void
-#if NeedFunctionPrototypes
uFinishUp(void)
-#else
-uFinishUp()
-#endif
{
if ((outCount>0)&&(postMsg!=NULL))
fprintf(errorFile,"%s\n",postMsg);
@@ -456,12 +352,7 @@ uFinishUp()
#ifndef HAVE_STRDUP
char *
-#if NeedFunctionPrototypes
uStringDup(char *str)
-#else
-uStringDup(str)
- char *str;
-#endif
{
char *rtrn;
@@ -475,12 +366,7 @@ char *rtrn;
#ifndef HAVE_STRCASECMP
int
-#if NeedFunctionPrototypes
uStrCaseCmp(char *str1,char *str2)
-#else
-uStrCaseCmp(str1, str2)
- char *str1, *str2;
-#endif
{
char buf1[512],buf2[512];
char c, *s;
@@ -506,21 +392,16 @@ uStrCaseCmp(str1, str2)
}
int
-#if NeedFunctionPrototypes
-uStrCasePrefix(char *prefix,char *str)
-#else
-uStrCasePrefix(prefix, str)
- char *prefix, *str;
-#endif
+uStrCasePrefix(char *my_prefix,char *str)
{
char c1;
char c2;
- while (((c1=*prefix)!='\0')&&((c2=*str)!='\0')) {
+ while (((c1=*my_prefix)!='\0')&&((c2=*str)!='\0')) {
if (isupper(c1)) c1= tolower(c1);
if (isupper(c2)) c2= tolower(c2);
if (c1!=c2)
return 0;
- prefix++; str++;
+ my_prefix++; str++;
}
if (c1!='\0')
return 0;
diff --git a/utils.h b/utils.h
index e3a71c9..d150642 100644
--- a/utils.h
+++ b/utils.h
@@ -27,6 +27,7 @@
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
\*/
+/* $XFree86: xc/programs/xkbcomp/utils.h,v 3.6 2002/12/24 17:43:00 tsi Exp $ */
/***====================================================================***/
@@ -35,9 +36,7 @@
#include <X11/Xfuncproto.h>
#include <X11/Xfuncs.h>
-#ifndef NULL
-#define NULL 0
-#endif
+#include <stddef.h>
#ifndef NUL
#define NUL '\0'
@@ -72,46 +71,36 @@ typedef int Comparison;
#define comparisonText(c) ((c)?((c)<0?"Less":"Greater"):"Equal")
#endif
-_XFUNCPROTOBEGIN
-
+#if 0
typedef union {
int i;
unsigned u;
void *p;
void *(*fp)();
} Union;
+#endif
/***====================================================================***/
extern Opaque uAlloc(
-#if NeedFunctionPrototypes
unsigned /* size */
-#endif
);
extern Opaque uCalloc(
-#if NeedFunctionPrototypes
unsigned /* n */,
unsigned /* size */
-#endif
);
extern Opaque uRealloc(
-#if NeedFunctionPrototypes
Opaque /* old */,
unsigned /* newSize */
-#endif
);
extern Opaque uRecalloc(
-#if NeedFunctionPrototypes
Opaque /* old */,
unsigned /* nOld */,
unsigned /* nNew */,
unsigned /* newSize */
-#endif
);
extern void uFree(
-#if NeedFunctionPrototypes
Opaque /* ptr */
-#endif
);
#define uTypedAlloc(t) ((t *)uAlloc((unsigned)sizeof(t)))
@@ -129,137 +118,126 @@ extern void uFree(
/***====================================================================***/
extern Boolean uSetErrorFile(
-#if NeedFunctionPrototypes
char * /* name */
-#endif
);
-#define INFO6(s,a,b,c,d,e,f) uInformation((s),(Opaque)(a),(Opaque)(b),\
- (Opaque)(c),(Opaque)(d),\
- (Opaque)(e),(Opaque)(f))
-#define INFO5(s,a,b,c,d,e) INFO6(s,a,b,c,d,e,NULL)
-#define INFO4(s,a,b,c,d) INFO5(s,a,b,c,d,NULL)
-#define INFO3(s,a,b,c) INFO4(s,a,b,c,NULL)
-#define INFO2(s,a,b) INFO3(s,a,b,NULL)
-#define INFO1(s,a) INFO2(s,a,NULL)
-#define INFO(s) INFO1(s,NULL)
+#define INFO6 uInformation
+#define INFO5 uInformation
+#define INFO4 uInformation
+#define INFO3 uInformation
+#define INFO2 uInformation
+#define INFO1 uInformation
+#define INFO uInformation
extern void uInformation(
-#if NeedFunctionPrototypes
- char * /* s */,
- Opaque /* a1 */,Opaque /* a2 */,Opaque /* a3 */,
- Opaque /* a4 */,Opaque /* a5 */,Opaque /* a6 */
-#endif
-);
+ char * /* s */, ...
+)
+#if defined(__GNUC__) && \
+ ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 6)))
+__attribute__((format(printf, 1, 2)))
+#endif
+;
+
+#define ACTION6 uAction
+#define ACTION5 uAction
+#define ACTION4 uAction
+#define ACTION3 uAction
+#define ACTION2 uAction
+#define ACTION1 uAction
+#define ACTION uAction
-#define ACTION6(s,a,b,c,d,e,f) uAction((s),(Opaque)(a),(Opaque)(b),\
- (Opaque)(c),(Opaque)(d),\
- (Opaque)(e),(Opaque)(f))
-#define ACTION5(s,a,b,c,d,e) ACTION6(s,a,b,c,d,e,NULL)
-#define ACTION4(s,a,b,c,d) ACTION5(s,a,b,c,d,NULL)
-#define ACTION3(s,a,b,c) ACTION4(s,a,b,c,NULL)
-#define ACTION2(s,a,b) ACTION3(s,a,b,NULL)
-#define ACTION1(s,a) ACTION2(s,a,NULL)
-#define ACTION(s) ACTION1(s,NULL)
extern void uAction(
-#if NeedFunctionPrototypes
- char * /* s */,
- Opaque /* a1 */,Opaque /* a2 */,Opaque /* a3 */,
- Opaque /* a4 */,Opaque /* a5 */,Opaque /* a6 */
-#endif
-);
+ char * /* s */, ...
+)
+#if defined(__GNUC__) && \
+ ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 6)))
+__attribute__((format(printf, 1, 2)))
+#endif
+;
+
+#define WARN6 uWarning
+#define WARN5 uWarning
+#define WARN4 uWarning
+#define WARN3 uWarning
+#define WARN2 uWarning
+#define WARN1 uWarning
+#define WARN uWarning
-#define WARN6(s,a,b,c,d,e,f) uWarning((s),(Opaque)(a),(Opaque)(b),\
- (Opaque)(c),(Opaque)(d),\
- (Opaque)(e),(Opaque)(f))
-#define WARN5(s,a,b,c,d,e) WARN6(s,a,b,c,d,e,NULL)
-#define WARN4(s,a,b,c,d) WARN5(s,a,b,c,d,NULL)
-#define WARN3(s,a,b,c) WARN4(s,a,b,c,NULL)
-#define WARN2(s,a,b) WARN3(s,a,b,NULL)
-#define WARN1(s,a) WARN2(s,a,NULL)
-#define WARN(s) WARN1(s,NULL)
extern void uWarning(
-#if NeedFunctionPrototypes
- char * /* s */,
- Opaque /* a1 */,Opaque /* a2 */,Opaque /* a3 */,
- Opaque /* a4 */,Opaque /* a5 */,Opaque /* a6 */
-#endif
-);
+ char * /* s */, ...
+)
+#if defined(__GNUC__) && \
+ ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 6)))
+__attribute__((format(printf, 1, 2)))
+#endif
+;
+
+#define ERROR6 uError
+#define ERROR5 uError
+#define ERROR4 uError
+#define ERROR3 uError
+#define ERROR2 uError
+#define ERROR1 uError
+#define ERROR uError
-#define ERROR6(s,a,b,c,d,e,f) uError((s),(Opaque)(a),(Opaque)(b),\
- (Opaque)(c),(Opaque)(d),\
- (Opaque)(e),(Opaque)(f))
-#define ERROR5(s,a,b,c,d,e) ERROR6(s,a,b,c,d,e,NULL)
-#define ERROR4(s,a,b,c,d) ERROR5(s,a,b,c,d,NULL)
-#define ERROR3(s,a,b,c) ERROR4(s,a,b,c,NULL)
-#define ERROR2(s,a,b) ERROR3(s,a,b,NULL)
-#define ERROR1(s,a) ERROR2(s,a,NULL)
-#define ERROR(s) ERROR1(s,NULL)
extern void uError(
-#if NeedFunctionPrototypes
- char * /* s */,
- Opaque /* a1 */,Opaque /* a2 */,Opaque /* a3 */,
- Opaque /* a4 */,Opaque /* a5 */,Opaque /* a6 */
-#endif
-);
+ char * /* s */, ...
+)
+#if defined(__GNUC__) && \
+ ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 6)))
+__attribute__((format(printf, 1, 2)))
+#endif
+;
+
+#define FATAL6 uFatalError
+#define FATAL5 uFatalError
+#define FATAL4 uFatalError
+#define FATAL3 uFatalError
+#define FATAL2 uFatalError
+#define FATAL1 uFatalError
+#define FATAL uFatalError
-#define FATAL6(s,a,b,c,d,e,f) uFatalError((s),(Opaque)(a),(Opaque)(b),\
- (Opaque)(c),(Opaque)(d),\
- (Opaque)(e),(Opaque)(f))
-#define FATAL5(s,a,b,c,d,e) FATAL6(s,a,b,c,d,e,NULL)
-#define FATAL4(s,a,b,c,d) FATAL5(s,a,b,c,d,NULL)
-#define FATAL3(s,a,b,c) FATAL4(s,a,b,c,NULL)
-#define FATAL2(s,a,b) FATAL3(s,a,b,NULL)
-#define FATAL1(s,a) FATAL2(s,a,NULL)
-#define FATAL(s) FATAL1(s,NULL)
extern void uFatalError(
-#if NeedFunctionPrototypes
- char * /* s */,
- Opaque /* a1 */,Opaque /* a2 */,Opaque /* a3 */,
- Opaque /* a4 */,Opaque /* a5 */,Opaque /* a6 */
-#endif
-);
+ char * /* s */, ...
+)
+#if defined(__GNUC__) && \
+ ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 6)))
+__attribute__((format(printf, 1, 2)))
+#endif
+;
+
+/* WSGO stands for "Weird Stuff Going On" */
+#define WSGO6 uInternalError
+#define WSGO5 uInternalError
+#define WSGO4 uInternalError
+#define WSGO3 uInternalError
+#define WSGO2 uInternalError
+#define WSGO1 uInternalError
+#define WSGO uInternalError
- /* WSGO stands for "Weird Stuff Going On" */
-#define WSGO6(s,a,b,c,d,e,f) uInternalError((s),(Opaque)(a),(Opaque)(b),\
- (Opaque)(c),(Opaque)(d),\
- (Opaque)(e),(Opaque)(f))
-#define WSGO5(s,a,b,c,d,e) WSGO6(s,a,b,c,d,e,NULL)
-#define WSGO4(s,a,b,c,d) WSGO5(s,a,b,c,d,NULL)
-#define WSGO3(s,a,b,c) WSGO4(s,a,b,c,NULL)
-#define WSGO2(s,a,b) WSGO3(s,a,b,NULL)
-#define WSGO1(s,a) WSGO2(s,a,NULL)
-#define WSGO(s) WSGO1(s,NULL)
extern void uInternalError(
-#if NeedFunctionPrototypes
- char * /* s */,
- Opaque /* a1 */,Opaque /* a2 */,Opaque /* a3 */,
- Opaque /* a4 */,Opaque /* a5 */,Opaque /* a6 */
+ char * /* s */, ...
+)
+#if defined(__GNUC__) && \
+ ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 6)))
+__attribute__((format(printf, 1, 2)))
#endif
-);
+;
extern void uSetPreErrorMessage(
-#if NeedFunctionPrototypes
char * /* msg */
-#endif
);
extern void uSetPostErrorMessage(
-#if NeedFunctionPrototypes
char * /* msg */
-#endif
);
extern void uSetErrorPrefix(
-#if NeedFunctionPrototypes
char * /* void */
-#endif
);
extern void uFinishUp(
-#if NeedFunctionPrototypes
void
-#endif
);
@@ -270,32 +248,27 @@ extern void uFinishUp(
#define uStringText(s) ((s)==NullString?"<NullString>":(s))
#define uStringEqual(s1,s2) (uStringCompare(s1,s2)==Equal)
#define uStringPrefix(p,s) (strncmp(p,s,strlen(p))==0)
-#define uStringCompare(s1,s2) (strcmp(s1,s2))
+#define uStringCompare(s1,s2) (((s1)==NullString||(s2)==NullString)?\
+ (s1)!=(s2):strcmp(s1,s2))
#define uStrCaseEqual(s1,s2) (uStrCaseCmp(s1,s2)==0)
#ifdef HAVE_STRCASECMP
#define uStrCaseCmp(s1,s2) (strcasecmp(s1,s2))
#define uStrCasePrefix(p,s) (strncasecmp(p,s,strlen(p))==0)
#else
extern int uStrCaseCmp(
-#if NeedFunctionPrototypes
char * /* s1 */,
char * /* s2 */
-#endif
);
extern int uStrCasePrefix(
-#if NeedFunctionPrototypes
char * /* p */,
char * /* str */
-#endif
);
#endif
#ifdef HAVE_STRDUP
#define uStringDup(s1) (strdup(s1))
#else
extern char *uStringDup(
-#if NeedFunctionPrototypes
char * /* s1 */
-#endif
);
#endif
@@ -320,25 +293,25 @@ extern
unsigned int DEBUG_VAR;
extern void uDebug(
-#if NeedFunctionPrototypes
- char * /* s */,
- Opaque /* a1 */,Opaque /* a2 */,Opaque /* a3 */,
- Opaque /* a4 */,Opaque /* a5 */,Opaque /* a6 */
+ char * /* s */, ...
+)
+#if defined(__GNUC__) && \
+ ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 6)))
+__attribute__((format(printf, 1, 2)))
#endif
-);
+;
extern void uDebugNOI( /* no indent */
-#if NeedFunctionPrototypes
- char * /* s */,
- Opaque /* a1 */,Opaque /* a2 */,Opaque /* a3 */,
- Opaque /* a4 */,Opaque /* a5 */,Opaque /* a6 */
+ char * /* s */, ...
+)
+#if defined(__GNUC__) && \
+ ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 6)))
+__attribute__((format(printf, 1, 2)))
#endif
-);
+;
extern Boolean uSetDebugFile(
-#if NeedFunctionPrototypes
char *name
-#endif
);
extern FILE *uDebugFile;
@@ -375,23 +348,20 @@ extern int uDebugIndentSize;
#endif
extern Boolean uSetEntryFile(
-#if NeedFunctionPrototypes
char *name
-#endif
);
extern void uEntry(
-#if NeedFunctionPrototypes
int /* l */,
- char * /* s */,
- Opaque /* a1 */,Opaque /* a2 */,Opaque /* a3 */,
- Opaque /* a4 */,Opaque /* a5 */,Opaque /* a6 */
+ char * /* s */, ...
+)
+#if defined(__GNUC__) && \
+ ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 6)))
+__attribute__((format(printf, 2, 3)))
#endif
-);
+;
extern void uExit(
-#if NeedFunctionPrototypes
int l,char *rtVal
-#endif
);
#ifdef ENTRY_TRACKING_ON
#define ENTRY_BIT 0x10
@@ -446,7 +416,6 @@ extern int uEntryLevel;
#define uFLAG_VOIDRETURN { return; }
#endif
-_XFUNCPROTOEND
#endif /* UTILS_H */
diff --git a/vmod.c b/vmod.c
index b67c34e..326fc21 100644
--- a/vmod.c
+++ b/vmod.c
@@ -24,6 +24,8 @@
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/xkbcomp/vmod.c,v 3.4 2002/06/05 00:00:37 dawes Exp $ */
+
#define DEBUG_VAR_NOT_LOCAL
#define DEBUG_VAR debugFlags
#include <stdio.h>
@@ -38,13 +40,7 @@
#include "vmod.h"
void
-#if NeedFunctionPrototypes
InitVModInfo(VModInfo *info,XkbDescPtr xkb)
-#else
-InitVModInfo(info,xkb)
- VModInfo * info;
- XkbDescPtr xkb;
-#endif
{
ClearVModInfo(info,xkb);
info->errorCount= 0;
@@ -52,13 +48,7 @@ InitVModInfo(info,xkb)
}
void
-#if NeedFunctionPrototypes
ClearVModInfo(VModInfo *info,XkbDescPtr xkb)
-#else
-ClearVModInfo(info,xkb)
- VModInfo * info;
- XkbDescPtr xkb;
-#endif
{
register int i;
@@ -81,14 +71,7 @@ register int i;
/***====================================================================***/
Bool
-#if NeedFunctionPrototypes
HandleVModDef(VModDef *stmt,unsigned mergeMode,VModInfo *info)
-#else
-HandleVModDef(stmt,mergeMode,info)
- VModDef * stmt;
- unsigned mergeMode;
- VModInfo * info;
-#endif
{
register int i,bit,nextFree;
ExprResult mod;
@@ -107,7 +90,7 @@ Atom stmtName;
if (stmt->value==NULL)
return True;
else {
- char *str1,*str2= "";
+ char *str1,*str2 = "";
if (!ExprResolveModMask(stmt->value,&mod,NULL,NULL)) {
str1= XkbAtomText(NULL,stmt->name,XkbMessage);
ACTION1("Declaration of %s ignored\n",str1);
@@ -155,20 +138,11 @@ Atom stmtName;
}
int
-#if NeedFunctionPrototypes
LookupVModIndex( XPointer priv,
Atom elem,
Atom field,
unsigned type,
ExprResult * val_rtrn)
-#else
-LookupVModIndex(priv,elem,field,type,val_rtrn)
- XPointer priv;
- Atom elem;
- Atom field;
- unsigned type;
- ExprResult * val_rtrn;
-#endif
{
register int i;
register char * fieldStr;
@@ -193,20 +167,11 @@ XkbDescPtr xkb;
}
int
-#if NeedFunctionPrototypes
LookupVModMask( XPointer priv,
Atom elem,
Atom field,
unsigned type,
ExprResult * val_rtrn)
-#else
-LookupVModMask(priv,elem,field,type,val_rtrn)
- XPointer priv;
- Atom elem;
- Atom field;
- unsigned type;
- ExprResult * val_rtrn;
-#endif
{
if (LookupVModIndex(priv,elem,field,type,val_rtrn)) {
register unsigned ndx= val_rtrn->uval;
@@ -217,12 +182,7 @@ LookupVModMask(priv,elem,field,type,val_rtrn)
}
int
-#if NeedFunctionPrototypes
FindKeypadVMod(XkbDescPtr xkb)
-#else
-FindKeypadVMod(xkb)
- XkbDescPtr xkb;
-#endif
{
Atom name;
ExprResult rtrn;
@@ -236,14 +196,7 @@ ExprResult rtrn;
}
Bool
-#if NeedFunctionPrototypes
ResolveVirtualModifier(ExprDef *def,ExprResult *val_rtrn,VModInfo *info)
-#else
-ResolveVirtualModifier(def,val_rtrn,info)
- ExprDef * def;
- ExprResult * val_rtrn;
- VModInfo * info;
-#endif
{
XkbNamesPtr names;
diff --git a/vmod.h b/vmod.h
index eddf312..b98183b 100644
--- a/vmod.h
+++ b/vmod.h
@@ -24,6 +24,8 @@
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/xkbcomp/vmod.h,v 1.3 2002/07/01 02:26:01 tsi Exp $ */
+
#ifndef VMOD_H
#define VMOD_H 1
@@ -36,66 +38,50 @@ typedef struct _VModInfo {
} VModInfo;
extern void InitVModInfo(
-#if NeedFunctionPrototypes
VModInfo * /* info */,
XkbDescPtr /* xkb */
-#endif
);
extern void ClearVModInfo(
-#if NeedFunctionPrototypes
VModInfo * /* info */,
XkbDescPtr /* xkb */
-#endif
);
extern Bool HandleVModDef(
-#if NeedFunctionPrototypes
VModDef * /* stmt */,
unsigned /* mergeMode */,
VModInfo * /* info */
-#endif
);
extern Bool ApplyVModDefs(
-#if NeedFunctionPrototypes
VModInfo * /* info */,
XkbDescPtr /* xkb */
-#endif
);
extern int LookupVModIndex(
-#if NeedFunctionPrototypes
XPointer /* priv */,
Atom /* elem */,
Atom /* field */,
unsigned /* type */,
ExprResult * /* val_rtrn */
-#endif
);
extern int LookupVModMask(
-#if NeedFunctionPrototypes
XPointer /* priv */,
Atom /* elem */,
Atom /* field */,
unsigned /* type */,
ExprResult * /* val_rtrn */
-#endif
);
extern int FindKeypadVMod(
-#if NeedFunctionPrototypes
XkbDescPtr /* xkb */
-#endif
);
extern Bool ResolveVirtualModifier(
-#if NeedFunctionPrototypes
ExprDef * /* def */,
ExprResult * /* value_rtrn */,
VModInfo * /* info */
-#endif
);
#endif /* VMOD_H */
diff --git a/xkbcomp.c b/xkbcomp.c
index 29df701..6b72d47 100644
--- a/xkbcomp.c
+++ b/xkbcomp.c
@@ -24,11 +24,18 @@
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/xkbcomp/xkbcomp.c,v 3.18 2002/11/15 03:14:12 dawes Exp $ */
#include <stdio.h>
#include <ctype.h>
#include <X11/keysym.h>
+/* for symlink attack security fix -- Branden Robinson */
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+/* end BR */
+
#if defined(sgi)
#include <malloc.h>
#endif
@@ -36,15 +43,17 @@
#define DEBUG_VAR_NOT_LOCAL
#define DEBUG_VAR debugFlags
#include "xkbcomp.h"
-#ifndef X_NOT_STDC_ENV
#include <stdlib.h>
-#endif
#include "xkbpath.h"
#include "parseutils.h"
#include "misc.h"
#include "tokens.h"
#include <X11/extensions/XKBgeom.h>
+#ifdef __UNIXOS2__
+#define chdir _chdir2
+#endif
+
#define lowbit(x) ((x) & (-(x)))
/***====================================================================***/
@@ -96,13 +105,7 @@ static char * errorPrefix= NULL;
#define M1(m,a) fprintf(stderr,(m),(a))
static void
-#if NeedFunctionPrototypes
Usage(int argc,char *argv[])
-#else
-Usage(argc,argv)
- int argc;
- char * argv[];
-#endif
{
if (!xkblist)
M1("Usage: %s [options] input-file [ output-file ]\n",argv[0]);
@@ -165,12 +168,7 @@ Usage(argc,argv)
/***====================================================================***/
static void
-#if NeedFunctionPrototypes
setVerboseFlags(char *str)
-#else
-setVerboseFlags(str)
- char * str;
-#endif
{
for (;*str;str++) {
switch (*str) {
@@ -191,13 +189,7 @@ setVerboseFlags(str)
}
static Bool
-#if NeedFunctionPrototypes
parseArgs(int argc,char *argv[])
-#else
-parseArgs(argc,argv)
- int argc;
- char * argv[];
-#endif
{
register int i,tmp;
@@ -300,7 +292,7 @@ register int i,tmp;
else if ((strncmp(argv[i],"-I",2)==0)&&(!xkblist)) {
if (!XkbAddDirectoryToPath(&argv[i][2])) {
ACTION("Exiting\n");
- exit(1);
+ exit(1);
}
}
else if ((strncmp(argv[i],"-l",2)==0)&&(!xkblist)) {
@@ -368,9 +360,9 @@ register int i,tmp;
}
}
else {
- char *tmp;
- for (tmp=argv[i];(*tmp!='\0');tmp++) {
- switch (*tmp) {
+ char *tmp2;
+ for (tmp2=argv[i];(*tmp2!='\0');tmp2++) {
+ switch (*tmp2) {
case 'c': case 'C':
optionalParts|= XkmCompatMapMask;
break;
@@ -391,7 +383,7 @@ register int i,tmp;
WARN1("Illegal component for %s option\n",
argv[i-1]);
ACTION1("Ignoring unknown specifier \"%c\"\n",
- (unsigned int)*tmp);
+ (unsigned int)*tmp2);
}
break;
}
@@ -625,13 +617,7 @@ register int i,tmp;
}
static Display *
-#if NeedFunctionPrototypes
GetDisplay(char *program,char *dpyName)
-#else
-GetDisplay(program,dpyName)
- char * program;
- char * dpyName;
-#endif
{
int mjr,mnr,error;
Display *dpy;
@@ -673,13 +659,7 @@ Display *dpy;
extern int yydebug;
int
-#if NeedFunctionPrototypes
main(int argc,char *argv[])
-#else
-main(argc,argv)
- int argc;
- char * argv[];
-#endif
{
FILE * file;
XkbFile * rtrn;
@@ -688,6 +668,12 @@ int ok;
XkbFileInfo result;
Status status;
+ yyin = stdin;
+ uSetEntryFile(NullString);
+ uSetDebugFile(NullString);
+ uSetErrorFile(NullString);
+
+ XkbInitIncludePath();
if (!parseArgs(argc,argv))
exit(1);
#ifdef DEBUG
@@ -702,7 +688,7 @@ Status status;
uSetPostErrorMessage(postErrorMsg);
file= NULL;
XkbInitAtoms(NULL);
- XkbInitIncludePath();
+ XkbAddDefaultDirectoriesToPath();
if (xkblist) {
Bool gotSome;
gotSome= GenerateListing(outputFile);
@@ -868,7 +854,7 @@ Status status;
ok= 0;
}
if (ok) {
- FILE *out= stdout;
+ FILE *out = stdout;
if ((inDpy!=outDpy)&&
(XkbChangeKbdDisplay(outDpy,&result)!=Success)) {
WSGO2("Error converting keyboard display from %s to %s\n",
@@ -879,12 +865,31 @@ Status status;
if (uStringEqual(outputFile,"-"))
outputFile= "stdout";
else {
- out= fopen(outputFile,"w");
+ /*
+ * fix to prevent symlink attack (e.g.,
+ * ln -s /etc/passwd /var/tmp/server-0.xkm)
+ */
+ /*
+ * this patch may have POSIX, Linux, or GNU libc bias
+ * -- Branden Robinson
+ */
+ int outputFileFd;
+ unlink(outputFile);
+ outputFileFd= open(outputFile, O_WRONLY|O_CREAT|O_EXCL,
+ S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH);
+ if (outputFileFd<0) {
+ ERROR1("Cannot open \"%s\" to write keyboard description\n",
+ outputFile);
+ ACTION("Exiting\n");
+ exit(1);
+ }
+ out= fdopen(outputFileFd, "w");
+ /* end BR */
if (out==NULL) {
ERROR1("Cannot open \"%s\" to write keyboard description\n",
outputFile);
- ACTION("Exiting\n");
- exit(1);
+ ACTION("Exiting\n");
+ exit(1);
}
}
}
diff --git a/xkbcomp.h b/xkbcomp.h
index 46fe4a4..0584846 100644
--- a/xkbcomp.h
+++ b/xkbcomp.h
@@ -24,6 +24,7 @@
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/xkbcomp/xkbcomp.h,v 3.9 2002/06/05 00:00:38 dawes Exp $ */
#ifndef XKBCOMP_H
#define XKBCOMP_H 1
@@ -119,6 +120,7 @@ typedef struct _IncludeStmt {
char *stmt;
char *file;
char *map;
+ char *modifier;
char *path;
struct _IncludeStmt *next;
} IncludeStmt;
@@ -227,13 +229,6 @@ typedef struct _InterpDef {
VarDef *def;
} InterpDef;
-typedef struct _IndicatorMapDef {
- ParseCommon common;
- unsigned merge;
- Atom name;
- VarDef * body;
-} IndicatorMapDef;
-
typedef struct _IndicatorNameDef {
ParseCommon common;
unsigned merge;
@@ -300,6 +295,11 @@ typedef struct _DoodadDef {
VarDef * body;
} DoodadDef;
+/* IndicatorMapDef doesn't use the type field, but the rest of the fields
+ need to be at the same offsets as in DoodadDef. Use #define to avoid
+ any strict aliasing problems. */
+#define IndicatorMapDef DoodadDef
+
typedef struct _XkbFile {
ParseCommon common;
int type;
@@ -311,61 +311,45 @@ typedef struct _XkbFile {
Bool compiled;
} XkbFile;
-_XFUNCPROTOBEGIN
-
extern Bool CompileKeymap(
-#if NeedFunctionPrototypes
XkbFile * /* file */,
XkbFileInfo * /* result */,
unsigned /* merge */
-#endif
);
extern Bool CompileKeycodes(
-#if NeedFunctionPrototypes
XkbFile * /* file */,
XkbFileInfo * /* result */,
unsigned /* merge */
-#endif
);
extern Bool CompileGeometry(
-#if NeedFunctionPrototypes
XkbFile * /* file */,
XkbFileInfo * /* result */,
unsigned /* merge */
-#endif
);
extern Bool CompileKeyTypes(
-#if NeedFunctionPrototypes
XkbFile * /* file */,
XkbFileInfo * /* result */,
unsigned /* merge */
-#endif
);
typedef struct _LEDInfo *LEDInfoPtr;
extern Bool CompileCompatMap(
-#if NeedFunctionPrototypes
XkbFile * /* file */,
XkbFileInfo * /* result */,
unsigned /* merge */,
LEDInfoPtr * /* unboundLEDs */
-#endif
);
extern Bool CompileSymbols(
-#if NeedFunctionPrototypes
XkbFile * /* file */,
XkbFileInfo * /* result */,
unsigned /* merge */
-#endif
);
-_XFUNCPROTOEND
-
#define WantLongListing (1<<0)
#define WantPartialMaps (1<<1)
#define WantHiddenMaps (1<<2)
@@ -376,33 +360,21 @@ extern char * rootDir;
extern unsigned verboseLevel;
extern unsigned dirsToStrip;
-_XFUNCPROTOBEGIN
-
extern Bool AddListing(
-#if NeedFunctionPrototypes
char * /* file */,
- char * /* map */
-#endif
+ char * /* map */
);
extern Bool AddMatchingFiles(
-#if NeedFunctionPrototypes
- char * /* head_in */
-#endif
+ char * /* head_in */
);
-extern int AddMapOnly(
-#if NeedFunctionPrototypes
+extern int AddMapOnly(
char * /* map */
-#endif
);
extern int GenerateListing(
-#if NeedFunctionPrototypes
char * /* filename */
-#endif
);
-_XFUNCPROTOEND
-
#endif /* XKBCOMP_H */
diff --git a/xkbcomp.man b/xkbcomp.man
index 32bb4ff..481d2a3 100644
--- a/xkbcomp.man
+++ b/xkbcomp.man
@@ -1,5 +1,11 @@
.\" $Xorg: xkbcomp.man,v 1.3 2000/08/17 19:54:33 cpqbld Exp $
-.TH XKBCOMP 1 "Release 6.4" "X Version 11"
+.\"
+.\"
+.\"
+.\"
+.\" $XFree86: xc/programs/xkbcomp/xkbcomp.man,v 1.10 2002/11/15 03:14:12 dawes Exp $
+.\"
+.TH XKBCOMP 1 __xorgversion__
.SH NAME
xkbcomp \- compile XKB keyboard description
.SH SYNOPSIS
@@ -38,7 +44,7 @@ name of the map to be used.
.SH OPTIONS
.TP 8
.B \-a
-Show all keyboard information, reporting implicit or dervied information
+Show all keyboard information, reporting implicit or derived information
as a comment. Only affects \fI.xkb\fP format output.
.TP 8
.B \-C
@@ -49,7 +55,13 @@ Compute defaults for any missing components, such as key names.
.TP 8
.B \-I\fIdir\fP
Specifies top-level directories to be searched for files included by the
-keymap description.
+keymap description. After all directories specified by \-I options
+have been searched, the current directory and finally, the default
+xkb directory (usually __projectroot__/lib/X11/xkb) will be searched.
+.sp
+To prevent the current and default directories from being searched,
+use the \-I option alone (i.e. without a directory), before any \-I
+options that specify the directories you do want searched.
.TP 8
.B \-l
List maps that specify the \fImap\fP pattern in any files listed on the
@@ -76,7 +88,7 @@ keycodes, symbols and types, respectively.
Specifies the root directory for relative path names.
.TP 8
.B -synch
-Force synchonization for X requests.
+Force synchronization for X requests.
.TP 8
.B \-w\ \fIlvl\fP
Controls the reporting of warnings during compilation. A warning level
@@ -88,10 +100,10 @@ Generate a source description of the keyboard as output (.xkb extension).
.B \-xkm
Generate a compiled keymap file as output (.xkm extension).
.SH "SEE ALSO"
-X(1)
+X(__miscmansuffix__)
.SH COPYRIGHT
Copyright 1994, Silicon Graphics Computer Systems and X Consortium, Inc.
.br
-See \fIX(1)\fP for a full statement of rights and permissions.
+See \fIX(__miscmansuffix__)\fP for a full statement of rights and permissions.
.SH AUTHOR
Erik Fortune, Silicon Graphics
diff --git a/xkbparse.y b/xkbparse.y
index 78589f4..c8036e4 100644
--- a/xkbparse.y
+++ b/xkbparse.y
@@ -24,6 +24,8 @@
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/xkbcomp/xkbparse.y,v 3.12 2002/10/16 21:33:04 tsi Exp $ */
+
%token
END_OF_FILE 0
ERROR_TOK 255
@@ -96,14 +98,9 @@
#include "parseutils.h"
#include <X11/keysym.h>
#include <X11/extensions/XKBgeom.h>
+#include <stdlib.h>
+
-_XFUNCPROTOBEGIN
-extern int yylex(
-#if NeedFunctionPrototypes
- void
-#endif
-);
-_XFUNCPROTOEND
%}
%right EQUALS
%left PLUS MINUS
@@ -405,6 +402,7 @@ SymbolsBody : SymbolsBody COMMA SymbolsVarDecl
{ $$= (VarDef *)AppendStmt(&$1->common,&$3->common); }
| SymbolsVarDecl
{ $$= $1; }
+ | { $$= NULL; }
;
SymbolsVarDecl : Lhs EQUALS Expr
@@ -445,7 +443,6 @@ IndicatorNameDecl: INDICATOR Integer EQUALS Expr SEMI
ShapeDecl : SHAPE String OBRACE OutlineList CBRACE SEMI
{ $$= ShapeDeclCreate($2,(OutlineDef *)&$4->common); }
- ;
| SHAPE String OBRACE CoordList CBRACE SEMI
{
OutlineDef *outlines;
@@ -508,7 +505,7 @@ OverlayKeyList : OverlayKeyList COMMA OverlayKey
{
$$= (OverlayKeyDef *)
AppendStmt(&$1->common,&$3->common);
- };
+ }
| OverlayKey
{ $$= $1; }
;
@@ -777,12 +774,7 @@ MapName : STRING { $$= scanStr; scanStr= NULL; }
;
%%
void
-#if NeedFunctionPrototypes
yyerror(char *s)
-#else
-yyerror(s)
-char *s;
-#endif
{
if (warningLevel>0) {
(void)fprintf(stderr,"%s: line %d of %s\n",s,lineNum,
@@ -795,11 +787,7 @@ char *s;
int
-#if NeedFunctionPrototypes
yywrap(void)
-#else
-yywrap()
-#endif
{
return 1;
}
diff --git a/xkbpath.c b/xkbpath.c
index 8e21a7b..4bfd7f2 100644
--- a/xkbpath.c
+++ b/xkbpath.c
@@ -24,6 +24,7 @@
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/xkbcomp/xkbpath.c,v 3.8 2002/11/15 03:14:12 dawes Exp $ */
#include <X11/Xlib.h>
#include <X11/XKBlib.h>
@@ -31,9 +32,7 @@
#define DEBUG_VAR_NOT_LOCAL
#define DEBUG_VAR debugFlags
#include "utils.h"
-#ifndef X_NOT_STDC_ENV
#include <stdlib.h>
-#endif
#include <X11/extensions/XKM.h>
#include "xkbpath.h"
@@ -47,22 +46,15 @@
#define PATH_CHUNK 8
+static Bool noDefaultPath = False;
static int longestPath;
static int szPath;
static int nPathEntries;
static char ** includePath;
Bool
-#if NeedFunctionPrototypes
XkbParseIncludeMap(char **str_inout,char **file_rtrn,char **map_rtrn,
- char *nextop_rtrn)
-#else
-XkbParseIncludeMap(str_inout,file_rtrn,map_rtrn,nextop_rtrn)
- char ** str_inout;
- char ** file_rtrn;
- char ** map_rtrn;
- char * nextop_rtrn;
-#endif
+ char *nextop_rtrn, char **extra_data)
{
char *tmp,*str,*next;
@@ -87,12 +79,21 @@ char *tmp,*str,*next;
*nextop_rtrn= '\0';
next= NULL;
}
+ tmp= strchr(str,':');
+ if (tmp != NULL) {
+ *tmp++ = '\0';
+ *extra_data = uStringDup(tmp);
+ }
+ else {
+ *extra_data = NULL;
+ }
tmp= strchr(str,'(');
if (tmp==NULL) {
*file_rtrn= uStringDup(str);
*map_rtrn= NULL;
}
else if (str[0]=='(') {
+ uFree(*extra_data);
return False;
}
else {
@@ -102,6 +103,7 @@ char *tmp,*str,*next;
tmp= strchr(str,')');
if ((tmp==NULL)||(tmp[1]!='\0')) {
uFree(*file_rtrn);
+ uFree(*extra_data);
return False;
}
*tmp++= '\0';
@@ -117,27 +119,26 @@ char *tmp,*str,*next;
}
Bool
-#if NeedFunctionPrototypes
XkbInitIncludePath(void)
-#else
-XkbInitIncludePath()
-#endif
{
szPath= PATH_CHUNK;
includePath= (char **)calloc(szPath,sizeof(char *));
if (includePath==NULL)
return False;
+ return True;
+}
+
+void
+XkbAddDefaultDirectoriesToPath(void)
+{
+ if (noDefaultPath)
+ return;
XkbAddDirectoryToPath(".");
XkbAddDirectoryToPath(DFLT_XKB_CONFIG_ROOT);
- return True;
}
void
-#if NeedFunctionPrototypes
XkbClearIncludePath(void)
-#else
-XkbClearIncludePath()
-#endif
{
register int i;
@@ -151,22 +152,21 @@ register int i;
nPathEntries= 0;
longestPath= 0;
}
+ noDefaultPath = True;
return;
}
Bool
-#if NeedFunctionPrototypes
XkbAddDirectoryToPath(char *dir)
-#else
-XkbAddDirectoryToPath(dir)
- char *dir;
-#endif
{
int len;
if ((dir==NULL)||(dir[0]=='\0')) {
XkbClearIncludePath();
return True;
}
+#ifdef __UNIXOS2__
+ dir = (char*)__XOS2RedirRoot(dir);
+#endif
len= strlen(dir);
if (len+2>=PATH_MAX) { /* allow for '/' and at least one character */
ERROR2("Path entry (%s) too long (maxiumum length is %d)\n",
@@ -195,12 +195,7 @@ int len;
/***====================================================================***/
char *
-#if NeedFunctionPrototypes
XkbDirectoryForInclude(unsigned type)
-#else
-XkbDirectoryForInclude(type)
- unsigned type;
-#endif
{
static char buf[32];
@@ -249,15 +244,7 @@ typedef struct _FileCacheEntry {
static FileCacheEntry *fileCache;
void *
-#if NeedFunctionPrototypes
XkbAddFileToCache(char *name,unsigned type,char *path,void *data)
-#else
-XkbAddFileToCache(name,type,path,data)
- char * name;
- unsigned type;
- char * path;
- void * data;
-#endif
{
FileCacheEntry *entry;
@@ -283,14 +270,7 @@ FileCacheEntry *entry;
}
void *
-#if NeedFunctionPrototypes
XkbFindFileInCache(char *name,unsigned type,char **pathRtrn)
-#else
-XkbFindFileInCache(name,type,pathRtrn)
- char * name;
- unsigned type;
- char ** pathRtrn;
-#endif
{
FileCacheEntry *entry;
@@ -306,14 +286,7 @@ FileCacheEntry *entry;
/***====================================================================***/
FILE *
-#if NeedFunctionPrototypes
XkbFindFileInPath(char *name,unsigned type,char **pathRtrn)
-#else
-XkbFindFileInPath(name,type,pathRtrn)
- char * name;
- unsigned type;
- char ** pathRtrn;
-#endif
{
register int i;
FILE *file= NULL;
diff --git a/xkbpath.h b/xkbpath.h
index c12a2ad..8b667ed 100644
--- a/xkbpath.h
+++ b/xkbpath.h
@@ -24,66 +24,56 @@
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/xkbcomp/xkbpath.h,v 1.4 2002/11/15 03:14:12 dawes Exp $ */
#ifndef _XKBPATH_H_
#define _XKBPATH_H_ 1
extern Bool XkbInitIncludePath(
-#if NeedFunctionPrototypes
void
-#endif
);
extern void XkbClearIncludePath(
-#if NeedFunctionPrototypes
void
-#endif
+);
+
+extern void XkbAddDefaultDirectoriesToPath(
+ void
);
extern Bool XkbAddDirectoryToPath(
-#if NeedFunctionPrototypes
char * /* dir */
-#endif
);
extern char * XkbDirectoryForInclude(
-#if NeedFunctionPrototypes
unsigned /* type */
-#endif
);
extern FILE *XkbFindFileInPath(
-#if NeedFunctionPrototypes
char * /* name */,
unsigned /* type */,
char ** /* pathRtrn */
-#endif
);
extern void * XkbAddFileToCache(
-#if NeedFunctionPrototypes
char * /* name */,
unsigned /* type */,
char * /* path */,
void * /* data */
-#endif
);
extern void * XkbFindFileInCache(
-#if NeedFunctionPrototypes
char * /* name */,
unsigned /* type */,
char ** /* pathRtrn */
-#endif
);
extern Bool XkbParseIncludeMap(
-#if NeedFunctionPrototypes
char ** /* str_inout */,
char ** /* file_rtrn */,
char ** /* map_rtrn */,
- char * /* nextop_rtrn */
-#endif
+ char * /* nextop_rtrn */,
+ char ** /* extra_data */
);
#endif /* _XKBPATH_H_ */
diff --git a/xkbscan.c b/xkbscan.c
index 9cda90d..45cbe0a 100644
--- a/xkbscan.c
+++ b/xkbscan.c
@@ -24,6 +24,7 @@
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/xkbcomp/xkbscan.c,v 3.11 2002/06/05 00:00:38 dawes Exp $ */
#include <stdio.h>
#include <ctype.h>
@@ -34,8 +35,9 @@
#include "tokens.h"
#define DEBUG_VAR scanDebug
#include "utils.h"
+#include "parseutils.h"
-FILE *yyin = stdin;
+FILE *yyin = NULL;
static char scanFileBuf[1024];
char * scanFile= scanFileBuf;
@@ -57,12 +59,7 @@ static char buf[BUFSIZE];
extern unsigned debugFlags;
static char *
-#if NeedFunctionPrototypes
tokText(int tok)
-#else
-tokText(tok)
- int tok;
-#endif
{
static char buf[32];
@@ -147,13 +144,7 @@ static char buf[32];
#endif
int
-#if NeedFunctionPrototypes
setScanState(char *file,int line)
-#else
-setScanState(file,line)
- char * file;
- int line;
-#endif
{
if (file!=NULL)
strncpy(scanFile,file,1024);
@@ -162,12 +153,8 @@ setScanState(file,line)
return 1;
}
-int
-#if NeedFunctionPrototypes
+static int
yyGetString(void)
-#else
-yyGetString()
-#endif
{
int ch;
@@ -228,12 +215,8 @@ int ch;
return ERROR_TOK;
}
-int
-#if NeedFunctionPrototypes
+static int
yyGetKeyName(void)
-#else
-yyGetKeyName()
-#endif
{
int ch;
@@ -346,16 +329,11 @@ struct _Keyword {
};
int numKeywords = sizeof(keywords)/sizeof(struct _Keyword);
-int
-#if NeedFunctionPrototypes
+static int
yyGetIdent(int first)
-#else
-yyGetIdent(first)
- int first;
-#endif
{
int ch,i,found;
-int rtrn= IDENT;
+int rtrn = IDENT;
buf[0] = first; nInBuf = 1;
while ( ((ch=getc(yyin))!=EOF) && (isalnum(ch)||(ch=='_')) ) {
@@ -387,13 +365,8 @@ int rtrn= IDENT;
return rtrn;
}
-int
-#if NeedFunctionPrototypes
+static int
yyGetNumber(int ch)
-#else
-yyGetNumber(ch)
- int ch;
-#endif
{
int isFloat= 0;
@@ -427,11 +400,7 @@ int isFloat= 0;
}
int
-#if NeedFunctionPrototypes
yylex(void)
-#else
-yylex()
-#endif
{
int ch;
int rtrn;