diff options
-rw-r--r-- | action.c | 115 | ||||
-rw-r--r-- | action.h | 4 | ||||
-rw-r--r-- | alias.c | 8 | ||||
-rw-r--r-- | alias.h | 2 | ||||
-rw-r--r-- | compat.c | 47 | ||||
-rw-r--r-- | expr.c | 54 | ||||
-rw-r--r-- | expr.h | 32 | ||||
-rw-r--r-- | geometry.c | 77 | ||||
-rw-r--r-- | indicators.c | 12 | ||||
-rw-r--r-- | indicators.h | 8 | ||||
-rw-r--r-- | keycodes.c | 15 | ||||
-rw-r--r-- | keytypes.c | 33 | ||||
-rw-r--r-- | listing.c | 8 | ||||
-rw-r--r-- | misc.c | 8 | ||||
-rw-r--r-- | misc.h | 4 | ||||
-rw-r--r-- | parseutils.c | 4 | ||||
-rw-r--r-- | parseutils.h | 6 | ||||
-rw-r--r-- | symbols.c | 37 | ||||
-rw-r--r-- | utils.c | 20 | ||||
-rw-r--r-- | utils.h | 12 | ||||
-rw-r--r-- | vmod.c | 5 | ||||
-rw-r--r-- | vmod.h | 6 | ||||
-rw-r--r-- | xkbcomp.c | 29 | ||||
-rw-r--r-- | xkbcomp.h | 4 | ||||
-rw-r--r-- | xkbpath.c | 11 | ||||
-rw-r--r-- | xkbpath.h | 6 |
26 files changed, 261 insertions, 306 deletions
@@ -335,16 +335,15 @@ ReportNotFound(unsigned action, unsigned field, const char *what, char *bad) } static Bool -HandleNoAction(XkbDescPtr xkb, - XkbAnyAction * action, - unsigned field, ExprDef * array_ndx, ExprDef * value) +HandleNoAction(XkbDescPtr xkb, XkbAnyAction *action, unsigned field, + const ExprDef *array_ndx, const ExprDef *value) { return ReportIllegal(action->type, field); } static Bool -CheckLatchLockFlags(unsigned action, - unsigned field, ExprDef * value, unsigned *flags_inout) +CheckLatchLockFlags(unsigned action, unsigned field, + const ExprDef *value, unsigned *flags_inout) { unsigned tmp; ExprResult result; @@ -365,9 +364,7 @@ CheckLatchLockFlags(unsigned action, } static Bool -CheckModifierField(XkbDescPtr xkb, - unsigned action, - ExprDef * value, +CheckModifierField(XkbDescPtr xkb, unsigned action, const ExprDef *value, unsigned *flags_inout, unsigned *mods_rtrn) { ExprResult rtrn; @@ -393,9 +390,8 @@ CheckModifierField(XkbDescPtr xkb, } static Bool -HandleSetLatchMods(XkbDescPtr xkb, - XkbAnyAction * action, - unsigned field, ExprDef * array_ndx, ExprDef * value) +HandleSetLatchMods(XkbDescPtr xkb, XkbAnyAction *action, unsigned field, + const ExprDef *array_ndx, const ExprDef *value) { XkbModAction *act; @@ -449,9 +445,8 @@ static LookupEntry lockWhich[] = { }; static Bool -HandleLockMods(XkbDescPtr xkb, - XkbAnyAction * action, - unsigned field, ExprDef * array_ndx, ExprDef * value) +HandleLockMods(XkbDescPtr xkb, XkbAnyAction *action, unsigned field, + const ExprDef *array_ndx, const ExprDef *value) { XkbModAction *act; @@ -499,10 +494,10 @@ static LookupEntry groupNames[] = { }; static Bool -CheckGroupField(unsigned action, - ExprDef * value, unsigned *flags_inout, int *grp_rtrn) +CheckGroupField(unsigned action, const ExprDef *value, + unsigned *flags_inout, int *grp_rtrn) { - ExprDef *spec; + const ExprDef *spec; ExprResult rtrn; if ((value->op == OpNegate) || (value->op == OpUnaryPlus)) @@ -536,9 +531,8 @@ CheckGroupField(unsigned action, } static Bool -HandleSetLatchGroup(XkbDescPtr xkb, - XkbAnyAction * action, - unsigned field, ExprDef * array_ndx, ExprDef * value) +HandleSetLatchGroup(XkbDescPtr xkb, XkbAnyAction *action, unsigned field, + const ExprDef *array_ndx, const ExprDef *value) { XkbGroupAction *act; @@ -583,9 +577,8 @@ HandleSetLatchGroup(XkbDescPtr xkb, } static Bool -HandleLockGroup(XkbDescPtr xkb, - XkbAnyAction * action, - unsigned field, ExprDef * array_ndx, ExprDef * value) +HandleLockGroup(XkbDescPtr xkb, XkbAnyAction *action, unsigned field, + const ExprDef * array_ndx, const ExprDef *value) { XkbGroupAction *act; @@ -608,9 +601,8 @@ HandleLockGroup(XkbDescPtr xkb, } static Bool -HandleMovePtr(XkbDescPtr xkb, - XkbAnyAction * action, - unsigned field, ExprDef * array_ndx, ExprDef * value) +HandleMovePtr(XkbDescPtr xkb, XkbAnyAction *action, unsigned field, + const ExprDef *array_ndx, const ExprDef *value) { ExprResult rtrn; XkbPtrAction *act; @@ -667,9 +659,8 @@ static LookupEntry btnNames[] = { }; static Bool -HandlePtrBtn(XkbDescPtr xkb, - XkbAnyAction * action, - unsigned field, ExprDef * array_ndx, ExprDef * value) +HandlePtrBtn(XkbDescPtr xkb, XkbAnyAction *action, unsigned field, + const ExprDef *array_ndx, const ExprDef *value) { ExprResult rtrn; XkbPtrBtnAction *act; @@ -729,9 +720,8 @@ static LookupEntry ptrDflts[] = { }; static Bool -HandleSetPtrDflt(XkbDescPtr xkb, - XkbAnyAction * action, - unsigned field, ExprDef * array_ndx, ExprDef * value) +HandleSetPtrDflt(XkbDescPtr xkb, XkbAnyAction *action, unsigned field, + const ExprDef *array_ndx, const ExprDef *value) { ExprResult rtrn; XkbPtrDfltAction *act; @@ -748,7 +738,7 @@ HandleSetPtrDflt(XkbDescPtr xkb, } else if ((field == F_Button) || (field == F_Value)) { - ExprDef *btn; + const ExprDef *btn; if (array_ndx != NULL) return ReportActionNotArray(action->type, field); if ((value->op == OpNegate) || (value->op == OpUnaryPlus)) @@ -806,9 +796,8 @@ static LookupEntry isoNames[] = { }; static Bool -HandleISOLock(XkbDescPtr xkb, - XkbAnyAction * action, - unsigned field, ExprDef * array_ndx, ExprDef * value) +HandleISOLock(XkbDescPtr xkb, XkbAnyAction *action, unsigned field, + const ExprDef *array_ndx, const ExprDef *value) { ExprResult rtrn; XkbISOAction *act; @@ -861,9 +850,8 @@ HandleISOLock(XkbDescPtr xkb, } static Bool -HandleSwitchScreen(XkbDescPtr xkb, - XkbAnyAction * action, - unsigned field, ExprDef * array_ndx, ExprDef * value) +HandleSwitchScreen(XkbDescPtr xkb, XkbAnyAction *action, unsigned field, + const ExprDef *array_ndx, const ExprDef *value) { ExprResult rtrn; XkbSwitchScreenAction *act; @@ -871,7 +859,7 @@ HandleSwitchScreen(XkbDescPtr xkb, act = (XkbSwitchScreenAction *) action; if (field == F_Screen) { - ExprDef *scrn; + const ExprDef *scrn; if (array_ndx != NULL) return ReportActionNotArray(action->type, field); if ((value->op == OpNegate) || (value->op == OpUnaryPlus)) @@ -953,9 +941,8 @@ LookupEntry ctrlNames[] = { }; static Bool -HandleSetLockControls(XkbDescPtr xkb, - XkbAnyAction * action, - unsigned field, ExprDef * array_ndx, ExprDef * value) +HandleSetLockControls(XkbDescPtr xkb, XkbAnyAction *action, unsigned field, + const ExprDef *array_ndx, const ExprDef *value) { ExprResult rtrn; XkbCtrlsAction *act; @@ -994,9 +981,8 @@ static LookupEntry evNames[] = { }; static Bool -HandleActionMessage(XkbDescPtr xkb, - XkbAnyAction * action, - unsigned field, ExprDef * array_ndx, ExprDef * value) +HandleActionMessage(XkbDescPtr xkb, XkbAnyAction *action, unsigned field, + const ExprDef *array_ndx, const ExprDef *value) { ExprResult rtrn; XkbMessageAction *act; @@ -1072,9 +1058,8 @@ HandleActionMessage(XkbDescPtr xkb, } static Bool -HandleRedirectKey(XkbDescPtr xkb, - XkbAnyAction * action, - unsigned field, ExprDef * array_ndx, ExprDef * value) +HandleRedirectKey(XkbDescPtr xkb, XkbAnyAction *action, unsigned field, + const ExprDef *array_ndx, const ExprDef *value) { ExprResult rtrn; XkbRedirectKeyAction *act; @@ -1136,9 +1121,8 @@ HandleRedirectKey(XkbDescPtr xkb, } static Bool -HandleDeviceBtn(XkbDescPtr xkb, - XkbAnyAction * action, - unsigned field, ExprDef * array_ndx, ExprDef * value) +HandleDeviceBtn(XkbDescPtr xkb, XkbAnyAction *action, unsigned field, + const ExprDef *array_ndx, const ExprDef *value) { ExprResult rtrn; XkbDeviceBtnAction *act; @@ -1206,9 +1190,8 @@ HandleDeviceBtn(XkbDescPtr xkb, } static Bool -HandleDeviceValuator(XkbDescPtr xkb, - XkbAnyAction * action, - unsigned field, ExprDef * array_ndx, ExprDef * value) +HandleDeviceValuator(XkbDescPtr xkb, XkbAnyAction *action, unsigned field, + const ExprDef *array_ndx, const ExprDef *value) { #if 0 ExprResult rtrn; @@ -1221,9 +1204,8 @@ HandleDeviceValuator(XkbDescPtr xkb, } static Bool -HandlePrivate(XkbDescPtr xkb, - XkbAnyAction * action, - unsigned field, ExprDef * array_ndx, ExprDef * value) +HandlePrivate(XkbDescPtr xkb, XkbAnyAction *action, unsigned field, + const ExprDef *array_ndx, const ExprDef *value) { ExprResult rtrn; @@ -1292,8 +1274,8 @@ HandlePrivate(XkbDescPtr xkb, typedef Bool(*actionHandler) (XkbDescPtr /* xkb */ , XkbAnyAction * /* action */ , unsigned /* field */ , - ExprDef * /* array_ndx */ , - ExprDef * /* value */ + const ExprDef * /* array_ndx */ , + const ExprDef * /* value */ ); static actionHandler handleAction[XkbSA_NumActions + 1] = { @@ -1341,12 +1323,11 @@ ApplyActionFactoryDefaults(XkbAction * action) int -HandleActionDef(ExprDef * def, - XkbDescPtr xkb, - XkbAnyAction * action, unsigned mergeMode, ActionInfo * info) +HandleActionDef(const ExprDef *def, XkbDescPtr xkb, XkbAnyAction *action, + unsigned mergeMode, const ActionInfo *info) { ExprDef *arg; - char *str; + const char *str; unsigned tmp, hndlrType; if (!actionsInitialized) @@ -1441,10 +1422,8 @@ HandleActionDef(ExprDef * def, /***====================================================================***/ int -SetActionField(XkbDescPtr xkb, - const char *elem, - const char *field, - ExprDef * array_ndx, ExprDef * value, ActionInfo ** info_rtrn) +SetActionField(XkbDescPtr xkb, const char *elem, const char *field, + ExprDef *array_ndx, ExprDef *value, ActionInfo **info_rtrn) { ActionInfo *new, *old; @@ -64,11 +64,11 @@ typedef struct _ActionInfo struct _ActionInfo *next; } ActionInfo; -extern int HandleActionDef(ExprDef * /* def */ , +extern int HandleActionDef(const ExprDef * /* def */ , XkbDescPtr /* xkb */ , XkbAnyAction * /* action */ , unsigned /* mergeMode */ , - ActionInfo * /* info */ + const ActionInfo * /* info */ ); extern int SetActionField(XkbDescPtr /* xkb */ , @@ -76,8 +76,8 @@ HandleCollision(AliasInfo * old, AliasInfo * new) } static void -InitAliasInfo(AliasInfo * info, - unsigned merge, unsigned file_id, char *alias, char *real) +InitAliasInfo(AliasInfo *info, unsigned merge, unsigned file_id, + const char *alias, const char *real) { bzero(info, sizeof(AliasInfo)); info->def.merge = merge; @@ -88,8 +88,8 @@ InitAliasInfo(AliasInfo * info, } int -HandleAliasDef(KeyAliasDef * def, - unsigned merge, unsigned file_id, AliasInfo ** info_in) +HandleAliasDef(const KeyAliasDef *def, + unsigned merge, unsigned file_id, AliasInfo **info_in) { AliasInfo *info; @@ -34,7 +34,7 @@ typedef struct _AliasInfo char real[XkbKeyNameLength + 1]; } AliasInfo; -extern int HandleAliasDef(KeyAliasDef * /* def */ , +extern int HandleAliasDef(const KeyAliasDef * /* def */ , unsigned /* merge */ , unsigned /* file_id */ , AliasInfo ** /* info */ @@ -81,7 +81,7 @@ typedef struct _CompatInfo /***====================================================================***/ static char * -siText(SymInterpInfo * si, CompatInfo * info) +siText(const SymInterpInfo *si, const CompatInfo *info) { static char buf[128]; @@ -170,7 +170,7 @@ NextInterp(CompatInfo * info) } static SymInterpInfo * -FindMatchingInterp(CompatInfo * info, SymInterpInfo * new) +FindMatchingInterp(CompatInfo *info, const SymInterpInfo *new) { SymInterpInfo *old; @@ -255,7 +255,7 @@ AddInterp(CompatInfo * info, SymInterpInfo * new) } static Bool -AddGroupCompat(CompatInfo * info, unsigned group, GroupCompatInfo * newGC) +AddGroupCompat(CompatInfo *info, unsigned group, const GroupCompatInfo *newGC) { GroupCompatInfo *gc; unsigned merge; @@ -281,9 +281,9 @@ AddGroupCompat(CompatInfo * info, unsigned group, GroupCompatInfo * newGC) /***====================================================================***/ static Bool -ResolveStateAndPredicate(ExprDef * expr, - unsigned *pred_rtrn, - unsigned *mods_rtrn, CompatInfo * info) +ResolveStateAndPredicate(const ExprDef *expr, + unsigned *pred_rtrn, unsigned *mods_rtrn, + const CompatInfo *info) { ExprResult result; @@ -386,14 +386,14 @@ MergeIncludedCompatMaps(CompatInfo * into, CompatInfo * from, unsigned merge) return; } -typedef void (*FileHandler) (XkbFile * /* rtrn */ , +typedef void (*FileHandler) (const XkbFile * /* rtrn */ , XkbDescPtr /* xkb */ , unsigned /* merge */ , CompatInfo * /* info */ ); static Bool -HandleIncludeCompatMap(IncludeStmt * stmt, +HandleIncludeCompatMap(IncludeStmt *stmt, XkbDescPtr xkb, CompatInfo * info, FileHandler hndlr) { unsigned newMerge; @@ -485,10 +485,9 @@ static LookupEntry useModMapValues[] = { }; static int -SetInterpField(SymInterpInfo * si, - XkbDescPtr xkb, - const char *field, - ExprDef * arrayNdx, ExprDef * value, CompatInfo * info) +SetInterpField(SymInterpInfo *si, XkbDescPtr xkb, const char *field, + const ExprDef *arrayNdx, const ExprDef *value, + const CompatInfo *info) { int ok = 1; ExprResult tmp; @@ -597,7 +596,7 @@ LookupEntry groupNames[] = { }; static int -HandleInterpVar(VarDef * stmt, XkbDescPtr xkb, CompatInfo * info) +HandleInterpVar(const VarDef *stmt, XkbDescPtr xkb, CompatInfo *info) { ExprResult elem, field; ExprDef *ndx; @@ -617,8 +616,8 @@ HandleInterpVar(VarDef * stmt, XkbDescPtr xkb, CompatInfo * info) } static int -HandleInterpBody(VarDef * def, XkbDescPtr xkb, SymInterpInfo * si, - CompatInfo * info) +HandleInterpBody(const VarDef *def, XkbDescPtr xkb, SymInterpInfo *si, + CompatInfo *info) { int ok = 1; ExprResult tmp, field; @@ -640,8 +639,8 @@ HandleInterpBody(VarDef * def, XkbDescPtr xkb, SymInterpInfo * si, } static int -HandleInterpDef(InterpDef * def, XkbDescPtr xkb, unsigned merge, - CompatInfo * info) +HandleInterpDef(const InterpDef *def, XkbDescPtr xkb, unsigned merge, + CompatInfo *info) { unsigned pred, mods; SymInterpInfo si; @@ -682,8 +681,8 @@ HandleInterpDef(InterpDef * def, XkbDescPtr xkb, unsigned merge, } static int -HandleGroupCompatDef(GroupCompatDef * def, - XkbDescPtr xkb, unsigned merge, CompatInfo * info) +HandleGroupCompatDef(const GroupCompatDef *def, + XkbDescPtr xkb, unsigned merge, CompatInfo *info) { ExprResult val; GroupCompatInfo tmp; @@ -714,8 +713,8 @@ HandleGroupCompatDef(GroupCompatDef * def, } static void -HandleCompatMapFile(XkbFile * file, - XkbDescPtr xkb, unsigned merge, CompatInfo * info) +HandleCompatMapFile(const XkbFile *file, + XkbDescPtr xkb, unsigned merge, CompatInfo *info) { ParseCommon *stmt; @@ -784,7 +783,7 @@ HandleCompatMapFile(XkbFile * file, } static void -CopyInterps(CompatInfo * info, +CopyInterps(const CompatInfo *info, XkbCompatMapPtr compat, Bool needSymbol, unsigned pred) { for (SymInterpInfo *si = info->interps; si; @@ -806,8 +805,8 @@ CopyInterps(CompatInfo * info, } Bool -CompileCompatMap(XkbFile * file, - XkbFileInfo * result, unsigned merge, LEDInfo ** unboundLEDs) +CompileCompatMap(const XkbFile *file, + XkbFileInfo *result, unsigned merge, LEDInfo **unboundLEDs) { CompatInfo info; XkbDescPtr xkb; @@ -127,9 +127,8 @@ exprTypeText(unsigned type) } int -ExprResolveLhs(ExprDef * expr, - ExprResult * elem_rtrn, - ExprResult * field_rtrn, ExprDef ** index_rtrn) +ExprResolveLhs(const ExprDef *expr, ExprResult *elem_rtrn, + ExprResult *field_rtrn, ExprDef **index_rtrn) { switch (expr->op) { @@ -154,8 +153,8 @@ ExprResolveLhs(ExprDef * expr, } Bool -SimpleLookup(XPointer priv, - Atom elem, Atom field, unsigned type, ExprResult * val_rtrn) +SimpleLookup(const XPointer priv, + Atom elem, Atom field, unsigned type, ExprResult *val_rtrn) { char *str; @@ -166,7 +165,7 @@ SimpleLookup(XPointer priv, return False; } str = XkbAtomGetString(NULL, field); - for (LookupEntry *entry = (LookupEntry *) priv; + for (const LookupEntry *entry = (const LookupEntry *) priv; (entry != NULL) && (entry->name != NULL); entry++) { if (uStrCaseCmp(str, entry->name) == 0) @@ -181,8 +180,8 @@ SimpleLookup(XPointer priv, } Bool -RadioLookup(XPointer priv, - Atom elem, Atom field, unsigned type, ExprResult * val_rtrn) +RadioLookup(const XPointer priv, + Atom elem, Atom field, unsigned type, ExprResult *val_rtrn) { char *str; int rg; @@ -249,9 +248,9 @@ static LookupEntry modIndexNames[] = { {NULL, 0} }; -int -LookupModIndex(XPointer priv, - Atom elem, Atom field, unsigned type, ExprResult * val_rtrn) +Bool +LookupModIndex(const XPointer priv, + Atom elem, Atom field, unsigned type, ExprResult *val_rtrn) { return SimpleLookup((XPointer) modIndexNames, elem, field, type, val_rtrn); @@ -289,7 +288,7 @@ LookupModMask(XPointer priv, #if 0 int -ExprResolveModIndex(ExprDef * expr, +ExprResolveModIndex(const ExprDef *expr, ExprResult * val_rtrn, IdentLookupFunc lookup, XPointer lookupPriv) { @@ -367,8 +366,7 @@ ExprResolveModIndex(ExprDef * expr, #endif int -ExprResolveModMask(ExprDef * expr, - ExprResult * val_rtrn, +ExprResolveModMask(const ExprDef *expr, ExprResult *val_rtrn, IdentLookupFunc lookup, XPointer lookupPriv) { LookupPriv priv = { @@ -381,8 +379,7 @@ ExprResolveModMask(ExprDef * expr, } int -ExprResolveBoolean(ExprDef * expr, - ExprResult * val_rtrn, +ExprResolveBoolean(const ExprDef *expr, ExprResult *val_rtrn, IdentLookupFunc lookup, XPointer lookupPriv) { int ok = 0; @@ -478,8 +475,7 @@ ExprResolveBoolean(ExprDef * expr, } int -ExprResolveFloat(ExprDef * expr, - ExprResult * val_rtrn, +ExprResolveFloat(const ExprDef *expr, ExprResult *val_rtrn, IdentLookupFunc lookup, XPointer lookupPriv) { int ok = 0; @@ -591,8 +587,7 @@ ExprResolveFloat(ExprDef * expr, } int -ExprResolveInteger(ExprDef * expr, - ExprResult * val_rtrn, +ExprResolveInteger(const ExprDef *expr, ExprResult *val_rtrn, IdentLookupFunc lookup, XPointer lookupPriv) { int ok = 0; @@ -712,8 +707,7 @@ ExprResolveInteger(ExprDef * expr, } int -ExprResolveString(ExprDef * expr, - ExprResult * val_rtrn, +ExprResolveString(const ExprDef *expr, ExprResult *val_rtrn, IdentLookupFunc lookup, XPointer lookupPriv) { int ok = 0; @@ -828,8 +822,7 @@ ExprResolveString(ExprDef * expr, } int -ExprResolveKeyName(ExprDef * expr, - ExprResult * val_rtrn, +ExprResolveKeyName(const ExprDef *expr, ExprResult *val_rtrn, IdentLookupFunc lookup, XPointer lookupPriv) { int ok = 0; @@ -918,7 +911,8 @@ ExprResolveKeyName(ExprDef * expr, /***====================================================================***/ int -ExprResolveEnum(ExprDef * expr, ExprResult * val_rtrn, LookupEntry * values) +ExprResolveEnum(const ExprDef *expr, ExprResult *val_rtrn, + const LookupEntry *values) { if (expr->op != ExprIdent) { @@ -948,13 +942,12 @@ ExprResolveEnum(ExprDef * expr, ExprResult * val_rtrn, LookupEntry * values) } int -ExprResolveMask(ExprDef * expr, - ExprResult * val_rtrn, +ExprResolveMask(const ExprDef *expr, ExprResult *val_rtrn, IdentLookupFunc lookup, XPointer lookupPriv) { int ok = 0; ExprResult leftRtrn, rightRtrn; - ExprDef *left, *right; + const ExprDef *left, *right; const char *bogus = NULL; switch (expr->op) @@ -1057,15 +1050,14 @@ ExprResolveMask(ExprDef * expr, } int -ExprResolveKeySym(ExprDef * expr, - ExprResult * val_rtrn, +ExprResolveKeySym(const ExprDef *expr, ExprResult *val_rtrn, IdentLookupFunc lookup, XPointer lookupPriv) { int ok = 0; if (expr->op == ExprIdent) { - char *str; + const char *str; KeySym sym; str = XkbAtomGetString(NULL, expr->value.str); @@ -35,14 +35,14 @@ typedef union _ExprResult XkbKeyNameRec keyName; } ExprResult; -typedef Bool(*IdentLookupFunc) (XPointer /* priv */ , +typedef Bool(*IdentLookupFunc) (const XPointer /* priv */ , Atom /* elem */ , Atom /* field */ , unsigned /* type */ , ExprResult * /* val_rtrn */ ); -extern int ExprResolveLhs(ExprDef * /* expr */ , +extern int ExprResolveLhs(const ExprDef * /* expr */ , ExprResult * /* elem_rtrn */ , ExprResult * /* field_rtrn */ , ExprDef ** /* index_rtrn */ @@ -72,81 +72,81 @@ typedef struct _LookupTable extern char *exprOpText(unsigned /* type */ ); -extern int RadioLookup(XPointer /* priv */ , +extern Bool RadioLookup(const XPointer /* priv */ , Atom /* elem */ , Atom /* field */ , unsigned /* type */ , ExprResult * /* val_rtrn */ ); -extern int SimpleLookup(XPointer /* priv */ , +extern Bool SimpleLookup(const XPointer /* priv */ , Atom /* elem */ , Atom /* field */ , unsigned /* type */ , ExprResult * /* val_rtrn */ ); -extern int LookupModIndex(XPointer /* priv */ , +extern Bool LookupModIndex(const XPointer /* priv */ , Atom /* elem */ , Atom /* field */ , unsigned /* type */ , ExprResult * /* val_rtrn */ ); -extern int ExprResolveModIndex(ExprDef * /* expr */ , +extern int ExprResolveModIndex(const ExprDef * /* expr */ , ExprResult * /* val_rtrn */ , IdentLookupFunc /* lookup */ , XPointer /* lookupPriv */ ); -extern int ExprResolveModMask(ExprDef * /* expr */ , +extern int ExprResolveModMask(const ExprDef * /* expr */ , ExprResult * /* val_rtrn */ , IdentLookupFunc /* lookup */ , XPointer /* priv */ ); -extern int ExprResolveBoolean(ExprDef * /* expr */ , +extern int ExprResolveBoolean(const ExprDef * /* expr */ , ExprResult * /* val_rtrn */ , IdentLookupFunc /* lookup */ , XPointer /* lookupPriv */ ); -extern int ExprResolveInteger(ExprDef * /* expr */ , +extern int ExprResolveInteger(const ExprDef * /* expr */ , ExprResult * /* val_rtrn */ , IdentLookupFunc /* lookup */ , XPointer /* lookupPriv */ ); -extern int ExprResolveFloat(ExprDef * /* expr */ , +extern int ExprResolveFloat(const ExprDef * /* expr */ , ExprResult * /* val_rtrn */ , IdentLookupFunc /* lookup */ , XPointer /* lookupPriv */ ); -extern int ExprResolveString(ExprDef * /* expr */ , +extern int ExprResolveString(const ExprDef * /* expr */ , ExprResult * /* val_rtrn */ , IdentLookupFunc /* lookup */ , XPointer /* lookupPriv */ ); -extern int ExprResolveKeyName(ExprDef * /* expr */ , +extern int ExprResolveKeyName(const ExprDef * /* expr */ , ExprResult * /* val_rtrn */ , IdentLookupFunc /* lookup */ , XPointer /* lookupPriv */ ); -extern int ExprResolveEnum(ExprDef * /* expr */ , +extern int ExprResolveEnum(const ExprDef * /* expr */ , ExprResult * /* val_rtrn */ , - LookupEntry * /* values */ + const LookupEntry * /* values */ ); -extern int ExprResolveMask(ExprDef * /* expr */ , +extern int ExprResolveMask(const ExprDef * /* expr */ , ExprResult * /* val_rtrn */ , IdentLookupFunc /* lookup */ , XPointer /* lookupPriv */ ); -extern int ExprResolveKeySym(ExprDef * /* expr */ , +extern int ExprResolveKeySym(const ExprDef * /* expr */ , ExprResult * /* val_rtrn */ , IdentLookupFunc /* lookup */ , XPointer /* lookupPriv */ @@ -247,7 +247,7 @@ typedef struct _GeometryInfo } GeometryInfo; static char * -ddText(Display * dpy, DoodadInfo * di) +ddText(Display *dpy, const DoodadInfo *di) { static char buf[64]; @@ -269,7 +269,7 @@ ddText(Display * dpy, DoodadInfo * di) /***====================================================================***/ static void -InitPropertyInfo(PropertyInfo * pi, GeometryInfo * info) +InitPropertyInfo(PropertyInfo *pi, const GeometryInfo *info) { pi->defs.defined = 0; pi->defs.fileID = info->fileID; @@ -301,7 +301,7 @@ FreeProperties(PropertyInfo * pi, GeometryInfo * info) } static void -InitKeyInfo(KeyInfo * key, RowInfo * row, GeometryInfo * info) +InitKeyInfo(KeyInfo *key, RowInfo *row, const GeometryInfo *info) { if (key != &row->dfltKey) @@ -337,7 +337,7 @@ ClearKeyInfo(KeyInfo * key) } static void -FreeKeys(KeyInfo * key, RowInfo * row, GeometryInfo * info) +FreeKeys(KeyInfo *key, RowInfo *row, const GeometryInfo *info) { KeyInfo *tmp; KeyInfo *next; @@ -357,7 +357,7 @@ FreeKeys(KeyInfo * key, RowInfo * row, GeometryInfo * info) } static void -InitRowInfo(RowInfo * row, SectionInfo * section, GeometryInfo * info) +InitRowInfo(RowInfo *row, SectionInfo *section, const GeometryInfo *info) { if (row != §ion->dfltRow) { @@ -380,7 +380,7 @@ InitRowInfo(RowInfo * row, SectionInfo * section, GeometryInfo * info) } static void -ClearRowInfo(RowInfo * row, GeometryInfo * info) +ClearRowInfo(RowInfo *row, const GeometryInfo *info) { row->defs.defined &= ~_GR_Default; row->top = row->left = 0; @@ -394,7 +394,7 @@ ClearRowInfo(RowInfo * row, GeometryInfo * info) } static void -FreeRows(RowInfo * row, SectionInfo * section, GeometryInfo * info) +FreeRows(RowInfo *row, SectionInfo *section, const GeometryInfo *info) { RowInfo *next; @@ -557,7 +557,8 @@ InitSectionInfo(SectionInfo * si, GeometryInfo * info) } static void -DupSectionInfo(SectionInfo * into, SectionInfo * from, GeometryInfo * info) +DupSectionInfo(SectionInfo *into, const SectionInfo *from, + const GeometryInfo *info) { CommonInfo defs; @@ -710,7 +711,7 @@ NextProperty(GeometryInfo * info) } static PropertyInfo * -FindProperty(GeometryInfo * info, char *name) +FindProperty(const GeometryInfo *info, const char *name) { PropertyInfo *old; @@ -1088,7 +1089,7 @@ NextSection(GeometryInfo * info) } static SectionInfo * -FindMatchingSection(GeometryInfo * info, SectionInfo * new) +FindMatchingSection(GeometryInfo *info, const SectionInfo *new) { for (SectionInfo *old = info->sections; old != NULL; old = (SectionInfo *) old->defs.next) @@ -1399,9 +1400,8 @@ HandleIncludeGeometry(IncludeStmt * stmt, XkbDescPtr xkb, GeometryInfo * info, } static int -SetShapeField(ShapeInfo * si, - const char *field, - ExprDef * arrayNdx, ExprDef * value, GeometryInfo * info) +SetShapeField(ShapeInfo *si, const char *field, + const ExprDef *arrayNdx, const ExprDef *value, GeometryInfo *info) { ExprResult tmp; @@ -1431,10 +1431,8 @@ SetShapeField(ShapeInfo * si, } static int -SetShapeDoodadField(DoodadInfo * di, - const char *field, - ExprDef * arrayNdx, - ExprDef * value, SectionInfo * si, GeometryInfo * info) +SetShapeDoodadField(DoodadInfo *di, const char *field, const ExprDef *arrayNdx, + const ExprDef *value, SectionInfo *si, GeometryInfo *info) { ExprResult tmp; const char *typeName; @@ -1501,10 +1499,8 @@ SetShapeDoodadField(DoodadInfo * di, #define FIELD_USHORT 2 static int -SetTextDoodadField(DoodadInfo * di, - const char *field, - ExprDef * arrayNdx, - ExprDef * value, SectionInfo * si, GeometryInfo * info) +SetTextDoodadField(DoodadInfo *di, const char *field, const ExprDef *arrayNdx, + const ExprDef *value, SectionInfo *si, GeometryInfo *info) { ExprResult tmp; unsigned def; @@ -1651,11 +1647,9 @@ SetTextDoodadField(DoodadInfo * di, } static int -SetIndicatorDoodadField(DoodadInfo * di, - const char *field, - ExprDef * arrayNdx, - ExprDef * value, - SectionInfo * si, GeometryInfo * info) +SetIndicatorDoodadField(DoodadInfo * di, const char *field, + const ExprDef *arrayNdx, const ExprDef *value, + SectionInfo *si, GeometryInfo *info) { ExprResult tmp; @@ -1696,10 +1690,8 @@ SetIndicatorDoodadField(DoodadInfo * di, } static int -SetLogoDoodadField(DoodadInfo * di, - const char *field, - ExprDef * arrayNdx, - ExprDef * value, SectionInfo * si, GeometryInfo * info) +SetLogoDoodadField(DoodadInfo *di, const char *field, const ExprDef *arrayNdx, + const ExprDef *value, SectionInfo *si, GeometryInfo *info) { ExprResult tmp; const char *typeName = "logo doodad"; @@ -1777,10 +1769,9 @@ SetLogoDoodadField(DoodadInfo * di, } static int -SetDoodadField(DoodadInfo * di, - const char *field, - ExprDef * arrayNdx, - ExprDef * value, SectionInfo * si, GeometryInfo * info) +SetDoodadField(DoodadInfo *di, const char *field, + const ExprDef *arrayNdx, const ExprDef *value, + SectionInfo *si, GeometryInfo *info) { ExprResult tmp; @@ -1880,9 +1871,9 @@ SetDoodadField(DoodadInfo * di, } static int -SetSectionField(SectionInfo * si, - const char *field, - ExprDef * arrayNdx, ExprDef * value, GeometryInfo * info) +SetSectionField(SectionInfo *si, const char *field, + const ExprDef *arrayNdx, const ExprDef *value, + GeometryInfo *info) { unsigned short *pField; unsigned def; @@ -1968,9 +1959,8 @@ SetSectionField(SectionInfo * si, } static int -SetRowField(RowInfo * row, - const char *field, - ExprDef * arrayNdx, ExprDef * value, GeometryInfo * info) +SetRowField(RowInfo *row, const char *field, + const ExprDef *arrayNdx, const ExprDef *value, GeometryInfo *info) { ExprResult tmp; @@ -2034,9 +2024,8 @@ SetRowField(RowInfo * row, } static int -SetKeyField(KeyInfo * key, - const char *field, - ExprDef * arrayNdx, ExprDef * value, GeometryInfo * info) +SetKeyField(KeyInfo *key, const char *field, + const ExprDef *arrayNdx, const ExprDef *value, GeometryInfo *info) { ExprResult tmp; @@ -2112,7 +2101,7 @@ SetKeyField(KeyInfo * key, } static int -SetGeometryProperty(GeometryInfo * info, char *property, ExprDef * value) +SetGeometryProperty(GeometryInfo *info, char *property, const ExprDef *value) { PropertyInfo pi; ExprResult result; diff --git a/indicators.c b/indicators.c index 995788b..470091e 100644 --- a/indicators.c +++ b/indicators.c @@ -57,7 +57,7 @@ ClearIndicatorMapInfo(Display * dpy, LEDInfo * info) } LEDInfo * -AddIndicatorMap(LEDInfo * oldLEDs, LEDInfo * new) +AddIndicatorMap(LEDInfo *oldLEDs, const LEDInfo *new) { LEDInfo *old, *last; @@ -199,9 +199,8 @@ static LookupEntry groupComponentNames[] = { }; int -SetIndicatorMapField(LEDInfo * led, - XkbDescPtr xkb, - const char *field, ExprDef *arrayNdx, ExprDef *value) +SetIndicatorMapField(LEDInfo *led, XkbDescPtr xkb, const char *field, + const ExprDef *arrayNdx, const ExprDef *value) { ExprResult rtrn; Bool ok; @@ -324,9 +323,8 @@ SetIndicatorMapField(LEDInfo * led, } LEDInfo * -HandleIndicatorMapDef(IndicatorMapDef * def, - XkbDescPtr xkb, - LEDInfo * dflt, LEDInfo * oldLEDs, unsigned merge) +HandleIndicatorMapDef(IndicatorMapDef *def, XkbDescPtr xkb, + const LEDInfo *dflt, LEDInfo *oldLEDs, unsigned merge) { LEDInfo led; Bool ok; diff --git a/indicators.h b/indicators.h index 6bf6111..befee60 100644 --- a/indicators.h +++ b/indicators.h @@ -57,19 +57,19 @@ extern void ClearIndicatorMapInfo(Display * /* dpy */ , extern LEDInfo *AddIndicatorMap(LEDInfo * /* oldLEDs */ , - LEDInfo * /* newLED */ + const LEDInfo * /* newLED */ ); extern int SetIndicatorMapField(LEDInfo * /* led */ , XkbDescPtr /* xkb */ , const char * /* field */ , - ExprDef * /* arrayNdx */ , - ExprDef * /* value */ + const ExprDef * /* arrayNdx */ , + const ExprDef * /* value */ ); extern LEDInfo *HandleIndicatorMapDef(IndicatorMapDef * /* stmt */ , XkbDescPtr /* xkb */ , - LEDInfo * /* dflt */ , + const LEDInfo * /* dflt */ , LEDInfo * /* oldLEDs */ , unsigned /* mergeMode */ ); @@ -89,7 +89,7 @@ static void HandleKeycodesFile(XkbFile * file, KeyNamesInfo * info); static void -InitIndicatorNameInfo(IndicatorNameInfo * ii, KeyNamesInfo * info) +InitIndicatorNameInfo(IndicatorNameInfo *ii, const KeyNamesInfo *info) { ii->defs.defined = 0; ii->defs.merge = info->merge; @@ -298,7 +298,7 @@ InitKeyNamesInfo(KeyNamesInfo * info) } static int -FindKeyByLong(KeyNamesInfo * info, unsigned long name) +FindKeyByLong(const KeyNamesInfo *info, unsigned long name) { for (int i = info->effectiveMin; i <= info->effectiveMax; i++) { @@ -314,9 +314,8 @@ FindKeyByLong(KeyNamesInfo * info, unsigned long name) * Note that the key's name is stored as a long, the keycode is the index. */ static Bool -AddKeyName(KeyNamesInfo * info, - int kc, - char *name, unsigned merge, unsigned fileID, Bool reportCollisions) +AddKeyName(KeyNamesInfo *info, int kc, const char *name, + unsigned merge, unsigned fileID, Bool reportCollisions) { int old; unsigned long lval; @@ -569,7 +568,7 @@ HandleIncludeKeycodes(IncludeStmt * stmt, XkbDescPtr xkb, KeyNamesInfo * info) * e.g. <ESC> = 9 */ static int -HandleKeycodeDef(KeycodeDef * stmt, unsigned merge, KeyNamesInfo * info) +HandleKeycodeDef(const KeycodeDef *stmt, unsigned merge, KeyNamesInfo *info) { int code; ExprResult result; @@ -610,7 +609,7 @@ HandleKeycodeDef(KeycodeDef * stmt, unsigned merge, KeyNamesInfo * info) * @return 1 on success, 0 otherwise. */ static int -HandleKeyNameVar(VarDef * stmt, KeyNamesInfo * info) +HandleKeyNameVar(const VarDef *stmt, KeyNamesInfo *info) { ExprResult tmp, field; ExprDef *arrayNdx; @@ -708,7 +707,7 @@ HandleKeyNameVar(VarDef * stmt, KeyNamesInfo * info) } static int -HandleIndicatorNameDef(IndicatorNameDef * def, +HandleIndicatorNameDef(const IndicatorNameDef *def, unsigned merge, KeyNamesInfo * info) { IndicatorNameInfo ii; @@ -105,7 +105,7 @@ Atom tok_KEYPAD; /***====================================================================***/ static void -InitKeyTypesInfo(KeyTypesInfo * info, XkbDescPtr xkb, KeyTypesInfo * from) +InitKeyTypesInfo(KeyTypesInfo *info, XkbDescPtr xkb, const KeyTypesInfo *from) { tok_ONE_LEVEL = XkbInternAtom(NULL, "ONE_LEVEL", False); tok_TWO_LEVEL = XkbInternAtom(NULL, "TWO_LEVEL", False); @@ -232,7 +232,7 @@ NextKeyType(KeyTypesInfo * info) } static KeyTypeInfo * -FindMatchingKeyType(KeyTypesInfo * info, KeyTypeInfo * new) +FindMatchingKeyType(KeyTypesInfo *info, const KeyTypeInfo *new) { for (KeyTypeInfo *old = info->types; old; old = (KeyTypeInfo *) old->defs.next) @@ -445,7 +445,7 @@ HandleIncludeKeyTypes(IncludeStmt * stmt, /***====================================================================***/ static XkbKTMapEntryPtr -FindMatchingMapEntry(KeyTypeInfo * type, unsigned mask, unsigned vmask) +FindMatchingMapEntry(const KeyTypeInfo *type, unsigned mask, unsigned vmask) { int i; XkbKTMapEntryPtr entry; @@ -648,8 +648,8 @@ static LookupEntry lnames[] = { }; static Bool -SetMapEntry(KeyTypeInfo * type, - XkbDescPtr xkb, ExprDef * arrayNdx, ExprDef * value) +SetMapEntry(KeyTypeInfo *type, XkbDescPtr xkb, + const ExprDef *arrayNdx, const ExprDef *value) { ExprResult rtrn; XkbKTMapEntryRec entry; @@ -695,8 +695,8 @@ SetMapEntry(KeyTypeInfo * type, } static Bool -SetPreserve(KeyTypeInfo * type, - XkbDescPtr xkb, ExprDef * arrayNdx, ExprDef * value) +SetPreserve(KeyTypeInfo *type, XkbDescPtr xkb, + const ExprDef *arrayNdx, const ExprDef *value) { ExprResult rtrn; PreserveInfo new; @@ -805,7 +805,7 @@ AddLevelName(KeyTypeInfo * type, } static Bool -SetLevelName(KeyTypeInfo * type, ExprDef * arrayNdx, ExprDef * value) +SetLevelName(KeyTypeInfo *type, const ExprDef *arrayNdx, const ExprDef *value) { ExprResult rtrn; unsigned level; @@ -844,10 +844,9 @@ SetLevelName(KeyTypeInfo * type, ExprDef * arrayNdx, ExprDef * value) * @param field The field to parse (e.g. modifiers, map, level_name) */ static Bool -SetKeyTypeField(KeyTypeInfo * type, - XkbDescPtr xkb, - const char *field, - ExprDef * arrayNdx, ExprDef * value, KeyTypesInfo * info) +SetKeyTypeField(KeyTypeInfo * type, XkbDescPtr xkb, const char *field, + const ExprDef *arrayNdx, const ExprDef *value, + KeyTypesInfo *info) { if (uStrCaseCmp(field, "modifiers") == 0) { @@ -904,7 +903,7 @@ SetKeyTypeField(KeyTypeInfo * type, } static Bool -HandleKeyTypeVar(VarDef * stmt, XkbDescPtr xkb, KeyTypesInfo * info) +HandleKeyTypeVar(const VarDef *stmt, XkbDescPtr xkb, KeyTypesInfo *info) { ExprResult elem, field; ExprDef *arrayNdx; @@ -929,8 +928,8 @@ HandleKeyTypeVar(VarDef * stmt, XkbDescPtr xkb, KeyTypesInfo * info) } static int -HandleKeyTypeBody(VarDef * def, - XkbDescPtr xkb, KeyTypeInfo * type, KeyTypesInfo * info) +HandleKeyTypeBody(const VarDef *def, XkbDescPtr xkb, + KeyTypeInfo *type, KeyTypesInfo *info) { int ok = 1; ExprResult tmp, field; @@ -956,8 +955,8 @@ HandleKeyTypeBody(VarDef * def, * */ static int -HandleKeyTypeDef(KeyTypeDef * def, - XkbDescPtr xkb, unsigned merge, KeyTypesInfo * info) +HandleKeyTypeDef(const KeyTypeDef *def, + XkbDescPtr xkb, unsigned merge, KeyTypesInfo *info) { KeyTypeInfo type = { .defs.defined = 0, @@ -194,10 +194,10 @@ AddListing(char *file, char *map) /***====================================================================***/ static void -ListFile(FILE * outFile, char *fileName, XkbFile * map) +ListFile(FILE *outFile, const char *fileName, XkbFile *map) { unsigned flags; - char *mapName; + const char *mapName; flags = map->flags; if ((flags & XkbLC_Hidden) && (!(verboseLevel & WantHiddenMaps))) @@ -227,7 +227,7 @@ ListFile(FILE * outFile, char *fileName, XkbFile * map) mapName = NULL; if (dirsToStrip > 0) { - char *tmp, *last; + const char *tmp, *last; int i; for (i = 0, tmp = last = fileName; (i < dirsToStrip) && tmp; i++) { @@ -417,7 +417,7 @@ MapMatches(char *mapToConsider, char *ptrn) } int -GenerateListing(char *out_name) +GenerateListing(const char *out_name) { FILE *outFile; XkbFile *rtrn; @@ -208,8 +208,8 @@ ReportMultipleDefs(char *type, char *field, char *name) /***====================================================================***/ Bool -UseNewField(unsigned field, - CommonInfo * oldDefs, CommonInfo * newDefs, unsigned *pCollide) +UseNewField(unsigned field, const CommonInfo *oldDefs, + const CommonInfo *newDefs, unsigned *pCollide) { Bool useNew; @@ -234,8 +234,8 @@ UseNewField(unsigned field, #if 0 static Bool -MergeNewField(unsigned field, - CommonInfo * oldDefs, CommonInfo * newDefs, unsigned *pCollide) +MergeNewField(unsigned field, const CommonInfo *oldDefs, + const CommonInfo *newDefs, unsigned *pCollide) { if ((oldDefs->defined & field) && (newDefs->defined & field)) { @@ -36,8 +36,8 @@ typedef struct _CommonInfo } CommonInfo; extern Bool UseNewField(unsigned /* field */ , - CommonInfo * /* oldDefs */ , - CommonInfo * /* newDefs */ , + const CommonInfo * /* oldDefs */ , + const CommonInfo * /* newDefs */ , unsigned * /* pCollide */ ); diff --git a/parseutils.c b/parseutils.c index fc0838b..917a240 100644 --- a/parseutils.c +++ b/parseutils.c @@ -128,7 +128,7 @@ ExprCreateBinary(unsigned op, ExprDef * left, ExprDef * right) } KeycodeDef * -KeycodeCreate(char *name, ExprDef * value) +KeycodeCreate(const char *name, ExprDef *value) { KeycodeDef *def; @@ -152,7 +152,7 @@ KeycodeCreate(char *name, ExprDef * value) } KeyAliasDef * -KeyAliasCreate(char *alias, char *real) +KeyAliasCreate(const char *alias, const char *real) { KeyAliasDef *def; diff --git a/parseutils.h b/parseutils.h index 5cc9391..41333e4 100644 --- a/parseutils.h +++ b/parseutils.h @@ -68,12 +68,12 @@ extern ExprDef *ExprCreateBinary(unsigned /* op */ , ExprDef * /* right */ ); -extern KeycodeDef *KeycodeCreate(char * /* name */ , +extern KeycodeDef *KeycodeCreate(const char * /* name */ , ExprDef * /* value */ ); -extern KeyAliasDef *KeyAliasCreate(char * /* alias */ , - char * /* real */ +extern KeyAliasDef *KeyAliasCreate(const char * /* alias */ , + const char * /* real */ ); extern VModDef *VModCreate(Atom /* name */ , @@ -855,8 +855,8 @@ static LookupEntry groupNames[] = { #define ACTIONS 2 static Bool -GetGroupIndex(KeyInfo * key, - ExprDef * arrayNdx, unsigned what, unsigned *ndx_rtrn) +GetGroupIndex(KeyInfo *key, const ExprDef *arrayNdx, + unsigned what, unsigned *ndx_rtrn) { const char *name; ExprResult tmp; @@ -907,10 +907,9 @@ GetGroupIndex(KeyInfo * key, } static Bool -AddSymbolsToKey(KeyInfo * key, - XkbDescPtr xkb, - const char *field, - ExprDef * arrayNdx, ExprDef * value, SymbolsInfo * info) +AddSymbolsToKey(KeyInfo *key, XkbDescPtr xkb, const char *field, + const ExprDef *arrayNdx, const ExprDef *value, + SymbolsInfo *info) { unsigned ndx, nSyms; @@ -964,10 +963,9 @@ AddSymbolsToKey(KeyInfo * key, } static Bool -AddActionsToKey(KeyInfo * key, - XkbDescPtr xkb, - const char *field, - ExprDef * arrayNdx, ExprDef * value, SymbolsInfo * info) +AddActionsToKey(KeyInfo *key, XkbDescPtr xkb, const char *field, + const ExprDef *arrayNdx, const ExprDef *value, + SymbolsInfo *info) { unsigned ndx, nActs; ExprDef *act; @@ -1029,7 +1027,7 @@ AddActionsToKey(KeyInfo * key, } static int -SetAllowNone(KeyInfo * key, ExprDef * arrayNdx, ExprDef * value) +SetAllowNone(KeyInfo *key, const ExprDef *arrayNdx, const ExprDef *value) { ExprResult tmp; unsigned radio_groups = 0; @@ -1099,10 +1097,9 @@ static LookupEntry rgEntries[] = { }; static Bool -SetSymbolsField(KeyInfo * key, - XkbDescPtr xkb, - const char *field, - ExprDef * arrayNdx, ExprDef * value, SymbolsInfo * info) +SetSymbolsField(KeyInfo *key, XkbDescPtr xkb, const char *field, + const ExprDef *arrayNdx, const ExprDef *value, + SymbolsInfo *info) { Bool ok = True; ExprResult tmp; @@ -1348,7 +1345,7 @@ SetSymbolsField(KeyInfo * key, } static int -SetGroupName(SymbolsInfo * info, ExprDef * arrayNdx, ExprDef * value) +SetGroupName(SymbolsInfo *info, const ExprDef *arrayNdx,const ExprDef *value) { ExprResult tmp, name; @@ -1716,7 +1713,7 @@ FindKeyForSymbol(XkbDescPtr xkb, KeySym sym, unsigned int *kc_rtrn) * @return True if found, False otherwise. */ static Bool -FindNamedType(XkbDescPtr xkb, Atom name, unsigned *type_rtrn) +FindNamedType(const XkbDescPtr xkb, Atom name, unsigned *type_rtrn) { if (xkb && xkb->map && xkb->map->types) { @@ -1764,15 +1761,15 @@ KSIsUpper(KeySym ks) * - TWO_LEVEL for other 2 shift level keys. * and the same for four level keys. * - * @param width Number of sysms in syms. + * @param width Number of syms in syms. * @param syms The keysyms for the given key (must be size width). * @param typeNameRtrn Set to the Atom of the type name. * * @returns True if a type could be found, False otherwise. */ static Bool -FindAutomaticType(int width, KeySym * syms, Atom * typeNameRtrn, - Bool * autoType) +FindAutomaticType(int width, const KeySym *syms, + Atom *typeNameRtrn, Bool *autoType) { *autoType = False; if ((width == 1) || (width == 0)) @@ -64,7 +64,7 @@ int uDebugIndentLevel = 0; static const int uDebugIndentSize = 4; Boolean -uSetDebugFile(char *name) +uSetDebugFile(const char *name) { if ((uDebugFile != NULL) && (uDebugFile != stderr)) { @@ -84,7 +84,7 @@ uSetDebugFile(char *name) } void -uDebug(char *s, ...) +uDebug(const char *s, ...) { va_list args; @@ -103,12 +103,12 @@ uDebug(char *s, ...) static FILE *errorFile = NULL; static int outCount = 0; -static char *preMsg = NULL; -static char *postMsg = NULL; -static char *prefix = NULL; +static const char *preMsg = NULL; +static const char *postMsg = NULL; +static const char *prefix = NULL; Boolean -uSetErrorFile(char *name) +uSetErrorFile(const char *name) { if ((errorFile != NULL) && (errorFile != stderr)) { @@ -234,7 +234,7 @@ uInternalError(const char *s, ...) } void -uSetPreErrorMessage(char *msg) +uSetPreErrorMessage(const char *msg) { outCount = 0; preMsg = msg; @@ -242,14 +242,14 @@ uSetPreErrorMessage(char *msg) } void -uSetPostErrorMessage(char *msg) +uSetPostErrorMessage(const char *msg) { postMsg = msg; return; } void -uSetErrorPrefix(char *pre) +uSetErrorPrefix(const char *pre) { prefix = pre; return; @@ -309,7 +309,7 @@ uStrCaseCmp(const char *str1, const char *str2) } int -uStrCasePrefix(const char *my_prefix, char *str) +uStrCasePrefix(const char *my_prefix, const char *str) { char c1; char c2; @@ -85,7 +85,7 @@ extern void *uRecalloc(void * /* old */ , /***====================================================================***/ -extern Boolean uSetErrorFile(char * /* name */ +extern Boolean uSetErrorFile(const char * /* name */ ); #define INFO uInformation @@ -120,13 +120,13 @@ uInformation(const char * /* s */ , ... extern void uInternalError(const char * /* s */ , ... ) _X_ATTRIBUTE_PRINTF(1, 2); - extern void uSetPreErrorMessage(char * /* msg */ + extern void uSetPreErrorMessage(const char * /* msg */ ); - extern void uSetPostErrorMessage(char * /* msg */ + extern void uSetPostErrorMessage(const char * /* msg */ ); - extern void uSetErrorPrefix(char * /* void */ + extern void uSetErrorPrefix(const char * /* void */ ); extern void uFinishUp(void); @@ -171,9 +171,9 @@ uInformation(const char * /* s */ , ... extern unsigned int DEBUG_VAR; -extern void uDebug(char *, ...) _X_ATTRIBUTE_PRINTF(1, 2); +extern void uDebug(const char *, ...) _X_ATTRIBUTE_PRINTF(1, 2); -extern Boolean uSetDebugFile(char *name); +extern Boolean uSetDebugFile(const char *name); extern int uDebugIndentLevel; @@ -77,7 +77,7 @@ ClearVModInfo(VModInfo * info, XkbDescPtr xkb) * @param mergeMode Merge strategy (e.g. MergeOverride) */ Bool -HandleVModDef(VModDef * stmt, unsigned mergeMode, VModInfo * info) +HandleVModDef(const VModDef *stmt, unsigned mergeMode, VModInfo *info) { int i, bit, nextFree; ExprResult mod; @@ -239,7 +239,8 @@ FindKeypadVMod(XkbDescPtr xkb) } Bool -ResolveVirtualModifier(ExprDef * def, ExprResult * val_rtrn, VModInfo * info) +ResolveVirtualModifier(const ExprDef *def, ExprResult *val_rtrn, + const VModInfo *info) { XkbNamesPtr names; @@ -44,7 +44,7 @@ extern void ClearVModInfo(VModInfo * /* info */ , XkbDescPtr /* xkb */ ); -extern Bool HandleVModDef(VModDef * /* stmt */ , +extern Bool HandleVModDef(const VModDef * /* stmt */ , unsigned /* mergeMode */ , VModInfo * /* info */ ); @@ -63,9 +63,9 @@ extern int LookupVModMask(XPointer /* priv */ , extern int FindKeypadVMod(XkbDescPtr /* xkb */ ); -extern Bool ResolveVirtualModifier(ExprDef * /* def */ , +extern Bool ResolveVirtualModifier(const ExprDef * /* def */ , ExprResult * /* value_rtrn */ , - VModInfo * /* info */ + const VModInfo * /* info */ ); #endif /* VMOD_H */ @@ -80,12 +80,12 @@ static const char *fileTypeExt[] = { }; static unsigned inputFormat, outputFormat; -static char *rootDir; +static const char *rootDir; static char *inputFile; -static char *inputMap; +static const char *inputMap; static char *outputFile; -static char *inDpyName; -static char *outDpyName; +static const char *inDpyName; +static const char *outDpyName; static Display *inDpy; static Display *outDpy; static Bool showImplicit = False; @@ -96,9 +96,9 @@ unsigned warningLevel = 5; unsigned verboseLevel = 0; unsigned dirsToStrip = 0; static unsigned optionalParts = 0; -static char *preErrorMsg = NULL; -static char *postErrorMsg = NULL; -static char *errorPrefix = NULL; +static const char *preErrorMsg = NULL; +static const char *postErrorMsg = NULL; +static const char *errorPrefix = NULL; static unsigned int device_id = XkbUseCoreKbd; /***====================================================================***/ @@ -177,7 +177,7 @@ Usage(int argc, char *argv[]) /***====================================================================***/ static void -setVerboseFlags(char *str) +setVerboseFlags(const char *str) { for (; *str; str++) { @@ -464,7 +464,7 @@ parseArgs(int argc, char *argv[]) } else { - for (char *tmp2 = argv[i]; (*tmp2 != '\0'); tmp2++) + for (const char *tmp2 = argv[i]; (*tmp2 != '\0'); tmp2++) { switch (*tmp2) { @@ -565,7 +565,7 @@ parseArgs(int argc, char *argv[]) } else if (strncmp(argv[i], "-v", 2) == 0) { - char *str; + const char *str; if (argv[i][2] != '\0') str = &argv[i][2]; else if ((i < (argc - 1)) && (argv[i + 1][0] != '-')) @@ -776,7 +776,7 @@ parseArgs(int argc, char *argv[]) else if ((outputFile == NULL) && (inputFile != NULL)) { int len; - char *base, *ext; + const char *base, *ext; if (inputMap == NULL) { @@ -809,9 +809,10 @@ parseArgs(int argc, char *argv[]) else if (outputFile == NULL) { int len; - char *ch, *name, buf[128]; + char *ch, buf[128]; + const char *name = buf; if (inDpyName[0] == ':') - snprintf(name = buf, sizeof(buf), "server%s", inDpyName); + snprintf(buf, sizeof(buf), "server%s", inDpyName); else name = inDpyName; @@ -851,7 +852,7 @@ parseArgs(int argc, char *argv[]) } static Display * -GetDisplay(char *program, char *dpyName) +GetDisplay(const char *program, const char *dpyName) { int mjr, mnr, error; Display *dpy; @@ -359,7 +359,7 @@ extern Bool CompileKeyTypes(XkbFile * /* file */ , typedef struct _LEDInfo *LEDInfoPtr; -extern Bool CompileCompatMap(XkbFile * /* file */ , +extern Bool CompileCompatMap(const XkbFile * /* file */ , XkbFileInfo * /* result */ , unsigned /* merge */ , LEDInfoPtr * /* unboundLEDs */ @@ -385,7 +385,7 @@ extern Bool AddMatchingFiles(char * /* head_in */ extern int AddMapOnly(char * /* map */ ); -extern int GenerateListing(char * /* filename */ +extern int GenerateListing(const char * /* filename */ ); #endif /* XKBCOMP_H */ @@ -284,7 +284,7 @@ XkbDirectoryForInclude(unsigned type) typedef struct _FileCacheEntry { - char *name; + const char *name; unsigned type; char *path; void *data; @@ -306,7 +306,7 @@ static FileCacheEntry *fileCache; * @return The data from the overwritten file or NULL. */ void * -XkbAddFileToCache(char *name, unsigned type, char *path, void *data) +XkbAddFileToCache(const char *name, unsigned type, char *path, void *data) { FileCacheEntry *entry; @@ -346,7 +346,7 @@ XkbAddFileToCache(char *name, unsigned type, char *path, void *data) * @return the data from the cache entry or NULL if no matching entry was found. */ void * -XkbFindFileInCache(char *name, unsigned type, char **pathRtrn) +XkbFindFileInCache(const char *name, unsigned type, char **pathRtrn) { FileCacheEntry *entry; @@ -374,11 +374,12 @@ XkbFindFileInCache(char *name, unsigned type, char **pathRtrn) * pathRtrn is undefined. */ FILE * -XkbFindFileInPath(char *name, unsigned type, char **pathRtrn) +XkbFindFileInPath(const char *name, unsigned type, char **pathRtrn) { FILE *file = NULL; int nameLen, typeLen; - char buf[PATH_MAX], *typeDir; + char buf[PATH_MAX]; + const char *typeDir; typeDir = XkbDirectoryForInclude(type); nameLen = strlen(name); @@ -37,18 +37,18 @@ extern Bool XkbAddDirectoryToPath(const char * /* dir */ extern char *XkbDirectoryForInclude(unsigned /* type */ ); -extern FILE *XkbFindFileInPath(char * /* name */ , +extern FILE *XkbFindFileInPath(const char * /* name */ , unsigned /* type */ , char ** /* pathRtrn */ ); -extern void *XkbAddFileToCache(char * /* name */ , +extern void *XkbAddFileToCache(const char * /* name */ , unsigned /* type */ , char * /* path */ , void * /* data */ ); -extern void *XkbFindFileInCache(char * /* name */ , +extern void *XkbFindFileInCache(const char * /* name */ , unsigned /* type */ , char ** /* pathRtrn */ ); |