diff --git a/include/X11/extensions/XKBcommon.h b/include/X11/extensions/XKBcommon.h index 16e0a7b..7eafa77 100644 --- a/include/X11/extensions/XKBcommon.h +++ b/include/X11/extensions/XKBcommon.h @@ -159,10 +159,28 @@ extern Atom XkbcInternAtom(char *name, Bool onlyIfExists); extern char * -XkbConfigText(unsigned config); +XkbcAtomText(Atom atm); extern char * -XkbActionTypeText(unsigned type); +XkbcModMaskText(unsigned mask, Bool cFormat); + +extern char * +XkbcConfigText(unsigned config); + +extern char * +XkbcGeomFPText(int val); + +extern char * +XkbcActionTypeText(unsigned type); + +extern char * +XkbcKeysymText(KeySym sym); + +extern char * +XkbcKeyNameText(char *name); + +extern char * +XkbcSIMatchText(unsigned type); _XFUNCPROTOEND diff --git a/src/text.c b/src/text.c index 139bdc7..0180747 100644 --- a/src/text.c +++ b/src/text.c @@ -28,9 +28,177 @@ #include #endif #include "X11/extensions/XKBcommon.h" +#include "XKBcommonint.h" +#include +#include +#include +#include + +#define BUFFER_SIZE 512 +static char textBuffer[BUFFER_SIZE]; +static int tbNext = 0; + +static char * +tbGetBuffer(unsigned size) +{ + char *rtrn; + + if (size >= BUFFER_SIZE) + return NULL; + + if ((BUFFER_SIZE - tbNext) <= size) + tbNext = 0; + + rtrn = &textBuffer[tbNext]; + tbNext += size; + + return rtrn; +} + +static char * +XkbStringText(char *str) +{ + char *buf, *in, *out; + int len; + Bool ok; + + if (!str) { + buf = tbGetBuffer(2); + buf[0] = '\0'; + return buf; + } + + /* Find if there are any non-printable characters */ + for (ok = True, len = 0, in = str; *in != '\0'; in++, len++) { + if (isprint(*in)) + continue; + + ok = False; + switch (*in) { + case '\n': case '\t': case '\v': + case '\b': case '\r': case '\f': + len++; + break; + default: + /* octal: \0ooo */ + len += 4; + break; + } + } + + if (ok) + return str; + + /* Cleanup non-printable characters */ + buf = tbGetBuffer(len + 1); + for (in = str, out = buf; *in != '\0'; in++) { + if (isprint(*in)) { + *out++ = *in; + continue; + } + + *out++ = '\\'; + switch (*in) { + case '\n': + *out++ = 'n'; + break; + case '\t': + *out++ = 't'; + break; + case '\v': + *out++ = 'v'; + break; + case '\b': + *out++ = 'b'; + break; + case '\r': + *out++ = 'r'; + break; + case '\f': + *out++ = 'f'; + break; + default: + *out++ = '0'; + snprintf(out, 3, "%o", *in); + while (*out != '\0') + out++; + } + } + + *out++ = '\0'; + return buf; +} char * -XkbConfigText(unsigned config) +XkbcAtomText(Atom atm) +{ + char *tmp, *rtrn; + int len; + + tmp = XkbcAtomGetString(atm); + + if (!tmp) + return ""; + + len = strlen(tmp) + 1; + if (len >= BUFFER_SIZE) + len = BUFFER_SIZE - 2; + + rtrn = tbGetBuffer(len); + strncpy(rtrn, tmp, len); + rtrn[len] = '\0'; + + _XkbFree(tmp); + + return XkbStringText(rtrn); +} + +static char *modNames[XkbNumModifiers] = { + "Shift", + "Lock", + "Control", + "Mod1", + "Mod2", + "Mod3", + "Mod4", + "Mod5" +}; + +char * +XkbcModMaskText(unsigned mask, Bool cFormat) +{ + int i, rem, bit; + char *str, *buf; + + if ((mask & 0xff) == 0xff) + return (cFormat ? "0xff" : "all"); + + if ((mask & 0xff) == 0) + return (cFormat ? "0" : "none"); + + rem = 64; + buf = tbGetBuffer(rem); + str = buf; + buf[0] = '\0'; + for (i = 0, bit = 1; i < XkbNumModifiers && rem > 1; i++, bit <<= 1) { + int len; + + if (!(mask & bit)) + continue; + + len = snprintf(str, rem, "%s%s%s", + (str != buf) ? (cFormat ? "|" : "+") : "", + modNames[i], + cFormat ? "Mask" : ""); + rem -= len; + str += len; + } + + return buf; +} + +char * +XkbcConfigText(unsigned config) { switch (config) { case XkmSemanticsFile: @@ -59,6 +227,24 @@ XkbConfigText(unsigned config) } } +char * +XkbcGeomFPText(int val) +{ + char *buf; + int whole, frac; + + buf = tbGetBuffer(12); + whole = val / XkbGeomPtsPerMM; + frac = val % XkbGeomPtsPerMM; + + if (frac != 0) + snprintf(buf, 12, "%d.%d", whole, frac); + else + snprintf(buf, 12, "%d", whole); + + return buf; +} + static char *actionTypeNames[XkbSA_NumActions]= { "NoAction", /* XkbSA_NoAction */ "SetMods", /* XkbSA_SetMods */ @@ -84,9 +270,73 @@ static char *actionTypeNames[XkbSA_NumActions]= { }; char * -XkbActionTypeText(unsigned type) +XkbcActionTypeText(unsigned type) { if (type <= XkbSA_LastAction) return actionTypeNames[type]; return "Private"; } + +char * +XkbcKeysymText(KeySym sym) +{ + char *buf; + + if (sym == NoSymbol) + return "NoSymbol"; + + if ((buf = XkbcKeysymToString(sym))) + return buf; + + buf = tbGetBuffer(32); + snprintf(buf, 32, "0x%lx", (long)sym); + return buf; +} + +char * +XkbcKeyNameText(char *name) +{ + char *buf; + int len; + + buf = tbGetBuffer(7); + buf[0] = '<'; + strncpy(&buf[1], name, 4); + buf[5] = '\0'; + len = strlen(buf); + buf[len++] = '>'; + buf[len] = '\0'; + + return buf; +} + +static char *siMatchText[5] = { + "NoneOf", /* XkbSI_NoneOf */ + "AnyOfOrNone", /* XkbSI_AnyOfOrNone */ + "AnyOf", /* XkbSI_AnyOf */ + "AllOf", /* XkbSI_AllOf */ + "Exactly" /* XkbSI_Exactly */ +}; + +char * +XkbcSIMatchText(unsigned type) +{ + char *buf; + + switch (type & XkbSI_OpMask) { + case XkbSI_NoneOf: + return siMatchText[0]; + case XkbSI_AnyOfOrNone: + return siMatchText[1]; + case XkbSI_AnyOf: + return siMatchText[2]; + case XkbSI_AllOf: + return siMatchText[3]; + case XkbSI_Exactly: + return siMatchText[4]; + default: + buf = tbGetBuffer(40); + snprintf(buf, 40, "0x%x", type & XkbSI_OpMask); + return buf; + } +} diff --git a/src/xkbcomp/action.c b/src/xkbcomp/action.c index 0f70fce..b18b08c 100644 --- a/src/xkbcomp/action.c +++ b/src/xkbcomp/action.c @@ -300,7 +300,7 @@ static Bool ReportMismatch(unsigned action, unsigned field, const char *type) { ERROR2("Value of %s field must be of type %s\n", fieldText(field), type); - ACTION1("Action %s definition ignored\n", XkbActionTypeText(action)); + ACTION1("Action %s definition ignored\n", XkbcActionTypeText(action)); return False; } @@ -308,7 +308,7 @@ static Bool ReportIllegal(unsigned action, unsigned field) { ERROR2("Field %s is not defined for an action of type %s\n", - fieldText(field), XkbActionTypeText(action)); + fieldText(field), XkbcActionTypeText(action)); ACTION("Action definition ignored\n"); return False; } @@ -317,7 +317,7 @@ static Bool ReportActionNotArray(unsigned action, unsigned field) { ERROR2("The %s field in the %s action is not an array\n", - fieldText(field), XkbActionTypeText(action)); + fieldText(field), XkbcActionTypeText(action)); ACTION("Action definition ignored\n"); return False; } @@ -327,7 +327,7 @@ ReportNotFound(unsigned action, unsigned field, const char *what, char *bad) { ERROR2("%s named %s not found\n", what, bad); ACTION2("Ignoring the %s field of an %s action\n", fieldText(field), - XkbActionTypeText(action)); + XkbcActionTypeText(action)); return False; } @@ -499,7 +499,7 @@ CheckGroupField(unsigned action, { ERROR2("Illegal group %d (must be in the range 1..%d)\n", rtrn.ival, XkbNumKbdGroups); - ACTION1("Action %s definition ignored\n", XkbActionTypeText(action)); + ACTION1("Action %s definition ignored\n", XkbcActionTypeText(action)); return False; } if (value->op == OpNegate) @@ -1055,8 +1055,7 @@ HandleRedirectKey(XkbcDescPtr xkb, if (!FindNamedKey(xkb, tmp, &t1, True, CreateKeyNames(xkb), 0)) { return ReportNotFound(action->type, field, "Key", - XkbKeyNameText(rtrn.keyName.name, - XkbMessage)); + XkbcKeyNameText(rtrn.keyName.name)); } act->new_key = t1; return True; diff --git a/src/xkbcomp/alias.c b/src/xkbcomp/alias.c index 2635c68..9fba41f 100644 --- a/src/xkbcomp/alias.c +++ b/src/xkbcomp/alias.c @@ -40,8 +40,7 @@ HandleCollision(AliasInfo * old, AliasInfo * new) (warningLevel > 9)) { WARN2("Alias of %s for %s declared more than once\n", - XkbKeyNameText(new->alias, XkbMessage), - XkbKeyNameText(new->real, XkbMessage)); + XkbcKeyNameText(new->alias), XkbcKeyNameText(new->real)); ACTION("First definition ignored\n"); } } @@ -62,10 +61,9 @@ HandleCollision(AliasInfo * old, AliasInfo * new) (warningLevel > 9)) { WARN1("Multiple definitions for alias %s\n", - XkbKeyNameText(old->alias, XkbMessage)); + XkbcKeyNameText(old->alias)); ACTION2("Using %s, ignoring %s\n", - XkbKeyNameText(use, XkbMessage), - XkbKeyNameText(ignore, XkbMessage)); + XkbcKeyNameText(use), XkbcKeyNameText(ignore)); } if (use != old->real) memcpy(old->real, use, XkbKeyNameLength); @@ -188,8 +186,7 @@ ApplyAliases(XkbcDescPtr xkb, Bool toGeom, AliasInfo ** info_in) if (warningLevel > 4) { WARN2("Attempt to alias %s to non-existent key %s\n", - XkbKeyNameText(info->alias, XkbMessage), - XkbKeyNameText(info->real, XkbMessage)); + XkbcKeyNameText(info->alias), XkbcKeyNameText(info->real)); ACTION("Ignored\n"); } info->alias[0] = '\0'; @@ -202,8 +199,8 @@ ApplyAliases(XkbcDescPtr xkb, Bool toGeom, AliasInfo ** info_in) { WARN("Attempt to create alias with the name of a real key\n"); ACTION2("Alias \"%s = %s\" ignored\n", - XkbKeyNameText(info->alias, XkbMessage), - XkbKeyNameText(info->real, XkbMessage)); + XkbcKeyNameText(info->alias), + XkbcKeyNameText(info->real)); } info->alias[0] = '\0'; continue; diff --git a/src/xkbcomp/compat.c b/src/xkbcomp/compat.c index de6a1f2..1e9f249 100644 --- a/src/xkbcomp/compat.c +++ b/src/xkbcomp/compat.c @@ -90,10 +90,10 @@ siText(SymInterpInfo * si, CompatInfo * info) } else { - snprintf(buf, sizeof(buf), "%s+%s(%s)", - XkbKeysymText(si->interp.sym, XkbMessage), - XkbSIMatchText(si->interp.match, XkbMessage), - XkbModMaskText(si->interp.mods, XkbMessage)); + snprintf(buf, sizeof(buf), "%s+%s(%s)", + XkbcKeysymText(si->interp.sym), + XkbcSIMatchText(si->interp.match), + XkbcModMaskText(si->interp.mods, False)); } return buf; } @@ -304,8 +304,7 @@ ResolveStateAndPredicate(ExprDef * expr, *pred_rtrn = XkbSI_Exactly; if (expr->op == ExprActionDecl) { - char *pred_txt = - XkbAtomText(NULL, expr->value.action.name, XkbMessage); + char *pred_txt = XkbcAtomText(expr->value.action.name); if (uStrCaseCmp(pred_txt, "noneof") == 0) *pred_rtrn = XkbSI_NoneOf; else if (uStrCaseCmp(pred_txt, "anyofornone") == 0) @@ -326,7 +325,7 @@ ResolveStateAndPredicate(ExprDef * expr, } else if (expr->op == ExprIdent) { - char *pred_txt = XkbAtomText(NULL, expr->value.str, XkbMessage); + char *pred_txt = XkbcAtomText(expr->value.str); if ((pred_txt) && (uStrCaseCmp(pred_txt, "any") == 0)) { *pred_rtrn = XkbSI_AnyOf; diff --git a/src/xkbcomp/expr.c b/src/xkbcomp/expr.c index 5631cfe..c71399a 100644 --- a/src/xkbcomp/expr.c +++ b/src/xkbcomp/expr.c @@ -326,7 +326,7 @@ ExprResolveModIndex(ExprDef * expr, } if (!ok) ERROR1("Cannot determine modifier index for \"%s\"\n", - XkbAtomText(NULL, expr->value.str, XkbMessage)); + XkbcAtomText(expr->value.str)); break; case ExprFieldRef: bogus = "field reference"; @@ -422,7 +422,7 @@ ExprResolveBoolean(ExprDef * expr, } if (!ok) ERROR1("Identifier \"%s\" of type int is unknown\n", - XkbAtomText(NULL, expr->value.str, XkbMessage)); + XkbcAtomText(expr->value.str)); return ok; case ExprFieldRef: if (lookup) @@ -433,8 +433,8 @@ ExprResolveBoolean(ExprDef * expr, } if (!ok) ERROR2("Default \"%s.%s\" of type boolean is unknown\n", - XkbAtomText(NULL, expr->value.field.element, XkbMessage), - XkbAtomText(NULL, expr->value.field.field, XkbMessage)); + XkbcAtomText(expr->value.field.element), + XkbcAtomText(expr->value.field.field)); return ok; case OpInvert: case OpNot: @@ -512,7 +512,7 @@ ExprResolveFloat(ExprDef * expr, } if (!ok) ERROR1("Numeric identifier \"%s\" unknown\n", - XkbAtomText(NULL, expr->value.str, XkbMessage)); + XkbcAtomText(expr->value.str)); return ok; case ExprFieldRef: if (lookup) @@ -523,8 +523,8 @@ ExprResolveFloat(ExprDef * expr, } if (!ok) ERROR2("Numeric default \"%s.%s\" unknown\n", - XkbAtomText(NULL, expr->value.field.element, XkbMessage), - XkbAtomText(NULL, expr->value.field.field, XkbMessage)); + XkbcAtomText(expr->value.field.element), + XkbcAtomText(expr->value.field.field)); return ok; case OpAdd: case OpSubtract: @@ -633,7 +633,7 @@ ExprResolveInteger(ExprDef * expr, } if (!ok) ERROR1("Identifier \"%s\" of type int is unknown\n", - XkbAtomText(NULL, expr->value.str, XkbMessage)); + XkbcAtomText(expr->value.str)); return ok; case ExprFieldRef: if (lookup) @@ -644,8 +644,8 @@ ExprResolveInteger(ExprDef * expr, } if (!ok) ERROR2("Default \"%s.%s\" of type int is unknown\n", - XkbAtomText(NULL, expr->value.field.element, XkbMessage), - XkbAtomText(NULL, expr->value.field.field, XkbMessage)); + XkbcAtomText(expr->value.field.element), + XkbcAtomText(expr->value.field.field)); return ok; case OpAdd: case OpSubtract: @@ -741,7 +741,7 @@ ExprResolveString(ExprDef * expr, } if (!ok) ERROR1("Identifier \"%s\" of type string not found\n", - XkbAtomText(NULL, expr->value.str, XkbMessage)); + XkbcAtomText(expr->value.str)); return ok; case ExprFieldRef: if (lookup) @@ -752,8 +752,8 @@ ExprResolveString(ExprDef * expr, } if (!ok) ERROR2("Default \"%s.%s\" of type string not found\n", - XkbAtomText(NULL, expr->value.field.element, XkbMessage), - XkbAtomText(NULL, expr->value.field.field, XkbMessage)); + XkbcAtomText(expr->value.field.element), + XkbcAtomText(expr->value.field.field)); return ok; case OpAdd: left = expr->value.binary.left; @@ -843,7 +843,7 @@ ExprResolveKeyName(ExprDef * expr, } if (!ok) ERROR1("Identifier \"%s\" of type string not found\n", - XkbAtomText(NULL, expr->value.str, XkbMessage)); + XkbcAtomText(expr->value.str)); return ok; case ExprFieldRef: if (lookup) @@ -854,8 +854,8 @@ ExprResolveKeyName(ExprDef * expr, } if (!ok) ERROR2("Default \"%s.%s\" of type key name not found\n", - XkbAtomText(NULL, expr->value.field.element, XkbMessage), - XkbAtomText(NULL, expr->value.field.field, XkbMessage)); + XkbcAtomText(expr->value.field.element), + XkbcAtomText(expr->value.field.field)); return ok; case OpAdd: if (bogus == NULL) @@ -917,7 +917,7 @@ ExprResolveEnum(ExprDef * expr, ExprResult * val_rtrn, LookupEntry * values) { int nOut = 0; ERROR1("Illegal identifier %s (expected one of: ", - XkbAtomText(NULL, expr->value.str, XkbMessage)); + XkbcAtomText(expr->value.str)); while (values && values->name) { if (nOut != 0) @@ -963,7 +963,7 @@ ExprResolveMask(ExprDef * expr, } if (!ok) ERROR1("Identifier \"%s\" of type int is unknown\n", - XkbAtomText(NULL, expr->value.str, XkbMessage)); + XkbcAtomText(expr->value.str)); return ok; case ExprFieldRef: if (lookup) @@ -974,8 +974,8 @@ ExprResolveMask(ExprDef * expr, } if (!ok) ERROR2("Default \"%s.%s\" of type int is unknown\n", - XkbAtomText(NULL, expr->value.field.element, XkbMessage), - XkbAtomText(NULL, expr->value.field.field, XkbMessage)); + XkbcAtomText(expr->value.field.element), + XkbcAtomText(expr->value.field.field)); return ok; case ExprArrayRef: bogus = "array reference"; diff --git a/src/xkbcomp/geometry.c b/src/xkbcomp/geometry.c index e7eac3b..3baafe6 100644 --- a/src/xkbcomp/geometry.c +++ b/src/xkbcomp/geometry.c @@ -67,8 +67,8 @@ typedef struct _ShapeInfo int dfltCornerRadius; } ShapeInfo; -#define shText(d,s) \ - ((s)?XkbAtomText((d),(s)->name,XkbMessage):"default shape") +#define shText(d, s) \ + ((s) ? XkbcAtomText((s)->name) : "default shape") #define _GD_Priority (1<<0) #define _GD_Top (1<<1) @@ -158,8 +158,8 @@ typedef struct _RowInfo KeyInfo dfltKey; struct _SectionInfo *section; } RowInfo; -#define rowText(d,r) \ - ((r)?XkbAtomText((d),(r)->section->name,XkbMessage):"default") +#define rowText(d, r) \ + ((r) ? XkbcAtomText((r)->section->name) : "default") #define _GOK_UnknownRow -1 typedef struct _OverlayKeyInfo @@ -179,7 +179,8 @@ typedef struct _OverlayInfo unsigned short nKeys; OverlayKeyInfo *keys; } OverlayInfo; -#define oiText(d,o) ((o)?XkbAtomText((d),(o)->name,XkbMessage):"default") +#define oiText(d, o) \ + ((o) ? XkbcAtomText((o)->name) : "default") #define _GS_Default (1<<0) @@ -211,7 +212,8 @@ typedef struct _SectionInfo OverlayInfo *overlays; struct _GeometryInfo *geometry; } SectionInfo; -#define scText(d,s) ((s)?XkbAtomText((d),(s)->name,XkbMessage):"default") +#define scText(d, s) \ + ((s) ? XkbcAtomText((s)->name) : "default") typedef struct _GeometryInfo { @@ -260,11 +262,10 @@ ddText(Display * dpy, DoodadInfo * di) if (di->section) { sprintf(buf, "%s in section %s", - XkbAtomText(dpy, di->name, XkbMessage), scText(dpy, - di->section)); + XkbcAtomText(di->name), scText(dpy, di->section)); return buf; } - return XkbAtomText(dpy, di->name, XkbMessage); + return XkbcAtomText(di->name); } /***====================================================================***/ @@ -806,7 +807,7 @@ FindShape(GeometryInfo * info, Atom name, const char *type, const char *which) { old = info->shapes; WARN3("Unknown shape \"%s\" for %s %s\n", - XkbAtomText(info->dpy, name, XkbMessage), type, which); + XkbcAtomText(name), type, which); if (old) { ACTION1("Using default shape %s instead\n", @@ -942,7 +943,7 @@ AddDoodad(SectionInfo * si, GeometryInfo * info, DoodadInfo * new) && (warningLevel > 0)) || (warningLevel > 9)) { WARN1("Multiple doodads named \"%s\"\n", - XkbAtomText(info->dpy, old->name, XkbMessage)); + XkbcAtomText(old->name)); ACTION("Using last definition\n"); } ReplaceDoodad(old, new); @@ -953,7 +954,7 @@ AddDoodad(SectionInfo * si, GeometryInfo * info, DoodadInfo * new) || (warningLevel > 9)) { WARN1("Multiple doodads named \"%s\"\n", - XkbAtomText(info->dpy, old->name, XkbMessage)); + XkbcAtomText(old->name)); ACTION("Using first definition\n"); } return True; @@ -1026,8 +1027,7 @@ AddOverlay(SectionInfo * si, GeometryInfo * info, OverlayInfo * new) { WARN2 ("Multiple overlays named \"%s\" for section \"%s\"\n", - XkbAtomText(info->dpy, old->name, XkbMessage), - XkbAtomText(info->dpy, si->name, XkbMessage)); + XkbcAtomText(old->name), XkbcAtomText(si->name)); ACTION("Using last definition\n"); } ClearOverlayInfo(old); @@ -1041,8 +1041,7 @@ AddOverlay(SectionInfo * si, GeometryInfo * info, OverlayInfo * new) || (warningLevel > 9)) { WARN2("Multiple doodads named \"%s\" in section \"%s\"\n", - XkbAtomText(info->dpy, old->name, XkbMessage), - XkbAtomText(info->dpy, si->name, XkbMessage)); + XkbcAtomText(old->name), XkbcAtomText(si->name)); ACTION("Using first definition\n"); } return True; @@ -1056,8 +1055,7 @@ AddOverlay(SectionInfo * si, GeometryInfo * info, OverlayInfo * new) WSGO("Couldn't allocate a new OverlayInfo\n"); ACTION2 ("Overlay \"%s\" in section \"%s\" will be incomplete\n", - XkbAtomText(info->dpy, old->name, XkbMessage), - XkbAtomText(info->dpy, si->name, XkbMessage)); + XkbcAtomText(old->name), XkbcAtomText(si->name)); } return False; } @@ -2242,16 +2240,14 @@ HandleGeometryVar(VarDef * stmt, XkbcDescPtr xkb, GeometryInfo * info) { WARN("Keyboard width must be positive\n"); ACTION1("Ignoring illegal keyboard width %s\n", - XkbGeomFPText(tmp.ival, XkbMessage)); + XkbcGeomFPText(tmp.ival)); return True; } if (info->widthMM != 0) { WARN("Keyboard width multiply defined\n"); - ACTION1("Using last definition (%s),", - XkbGeomFPText(tmp.ival, XkbMessage)); - INFO1(" ignoring first (%s)\n", - XkbGeomFPText(info->widthMM, XkbMessage)); + ACTION1("Using last definition (%s),", XkbcGeomFPText(tmp.ival)); + INFO1(" ignoring first (%s)\n", XkbcGeomFPText(info->widthMM)); } info->widthMM = tmp.ival; return True; @@ -2273,16 +2269,14 @@ HandleGeometryVar(VarDef * stmt, XkbcDescPtr xkb, GeometryInfo * info) { WARN("Keyboard height must be positive\n"); ACTION1("Ignoring illegal keyboard height %s\n", - XkbGeomFPText(tmp.ival, XkbMessage)); + XkbcGeomFPText(tmp.ival)); return True; } if (info->heightMM != 0) { WARN("Keyboard height multiply defined\n"); - ACTION1("Using last definition (%s),", - XkbGeomFPText(tmp.ival, XkbMessage)); - INFO1(" ignoring first (%s)\n", - XkbGeomFPText(info->heightMM, XkbMessage)); + ACTION1("Using last definition (%s),", XkbcGeomFPText(tmp.ival)); + INFO1(" ignoring first (%s)\n", XkbcGeomFPText(info->heightMM)); } info->heightMM = tmp.ival; return True; @@ -2446,7 +2440,7 @@ HandleShapeBody(ShapeDef * def, ShapeInfo * si, unsigned merge, } if (ol->field != None) { - char *str = XkbAtomText(NULL, ol->field, XkbMessage); + char *str = XkbcAtomText(ol->field); if ((uStrCaseCmp(str, "approximation") == 0) || (uStrCaseCmp(str, "approx") == 0)) { @@ -2559,8 +2553,7 @@ HandleOverlayDef(OverlayDef * def, if ((def->nKeys < 1) && (warningLevel > 3)) { WARN2("Overlay \"%s\" in section \"%s\" has no keys\n", - XkbAtomText(NULL, def->name, XkbMessage), scText(info->dpy, - si)); + XkbcAtomText(def->name), scText(info->dpy, si)); ACTION("Overlay ignored\n"); return True; } @@ -3118,8 +3111,7 @@ VerifyDoodadInfo(DoodadInfo * di, GeometryInfo * info) { WARN1("No font size for text doodad %s\n", ddText(info->dpy, di)); - ACTION1("Using %s point text\n", - XkbGeomFPText(DFLT_SIZE, XkbMessage)); + ACTION1("Using %s point text\n", XkbcGeomFPText(DFLT_SIZE)); } di->fontSize = DFLT_SIZE; } @@ -3141,7 +3133,7 @@ VerifyDoodadInfo(DoodadInfo * di, GeometryInfo * info) WARN1("No height for text doodad %s\n", ddText(info->dpy, di)); ACTION1("Using calculated height %s millimeters\n", - XkbGeomFPText(size, XkbMessage)); + XkbcGeomFPText(size)); } di->height = size; } @@ -3168,7 +3160,7 @@ VerifyDoodadInfo(DoodadInfo * di, GeometryInfo * info) { WARN1("No width for text doodad %s\n", ddText(info->dpy, di)); ACTION1("Using calculated width %s millimeters\n", - XkbGeomFPText(width, XkbMessage)); + XkbcGeomFPText(width)); } di->width = width; } @@ -3426,11 +3418,9 @@ VerifyOverlayInfo(XkbGeometryPtr geom, { WARN3 ("Key %s in section \"%s\" and overlay \"%s\"\n", - XkbKeyNameText(key->name.name, - XkbMessage), - XkbAtomText(info->dpy, section->name, - XkbMessage), - XkbAtomText(info->dpy, oi->name, XkbMessage)); + XkbcKeyNameText(key->name.name), + XkbcAtomText(section->name), + XkbcAtomText(oi->name)); ACTION("Overlay definition ignored\n"); } oKey = 0; @@ -3446,9 +3436,9 @@ VerifyOverlayInfo(XkbGeometryPtr geom, { WARN3 ("Key %s not in \"%s\", but has an overlay key in \"%s\"\n", - XkbKeyNameText(ki->under, XkbMessage), - XkbAtomText(info->dpy, section->name, XkbMessage), - XkbAtomText(info->dpy, oi->name, XkbMessage)); + XkbcKeyNameText(ki->under), + XkbcAtomText(section->name), + XkbcAtomText(oi->name)); ACTION("Definition ignored\n"); } } @@ -3474,8 +3464,7 @@ VerifyOverlayInfo(XkbGeometryPtr geom, if (oi->nKeys < 1) { ERROR2("Overlay \"%s\" for section \"%s\" has no legal keys\n", - XkbAtomText(info->dpy, oi->name, XkbMessage), - XkbAtomText(info->dpy, section->name, XkbMessage)); + XkbcAtomText(oi->name), XkbcAtomText(section->name)); ACTION("Overlay definition ignored\n"); return False; } @@ -3515,8 +3504,7 @@ CopyOverlayDef(XkbGeometryPtr geom, if (!ol) { WSGO2("Couldn't add overlay \"%s\" to section \"%s\"\n", - XkbAtomText(info->dpy, name, XkbMessage), - XkbAtomText(info->dpy, section->name, XkbMessage)); + XkbcAtomText(name), XkbcAtomText(section->name)); return False; } for (i = 0; i < oi->nRows; i++) @@ -3532,8 +3520,7 @@ CopyOverlayDef(XkbGeometryPtr geom, { WSGO3 ("Can't add row %d to overlay \"%s\" of section \"%s\"\n", - i, XkbAtomText(info->dpy, name, XkbMessage), - XkbAtomText(info->dpy, section->name, XkbMessage)); + i, XkbcAtomText(name), XkbcAtomText(section->name)); return False; } } diff --git a/src/xkbcomp/indicators.c b/src/xkbcomp/indicators.c index 6841894..b2ad92a 100644 --- a/src/xkbcomp/indicators.c +++ b/src/xkbcomp/indicators.c @@ -35,12 +35,10 @@ /***====================================================================***/ -#define ReportIndicatorBadType(d,l,f,w) \ - ReportBadType("indicator map",(f),\ - XkbAtomText((d),(l)->name,XkbMessage),(w)) -#define ReportIndicatorNotArray(d,l,f) \ - ReportNotArray("indicator map",(f),\ - XkbAtomText((d),(l)->name,XkbMessage)) +#define ReportIndicatorBadType(d,l,f,w) \ + ReportBadType("indicator map", (f), XkbcAtomText((l)->name), (w)) +#define ReportIndicatorNotArray(d,l,f) \ + ReportNotArray("indicator map", (f), XkbcAtomText((l)->name)) /***====================================================================***/ @@ -84,7 +82,7 @@ AddIndicatorMap(LEDInfo * oldLEDs, LEDInfo * new) && (warningLevel > 0)) || (warningLevel > 9)) { WARN1("Map for indicator %s redefined\n", - XkbAtomText(NULL, old->name, XkbMessage)); + XkbcAtomText(old->name)); ACTION("Earlier definition ignored\n"); } *old = *new; @@ -136,7 +134,7 @@ AddIndicatorMap(LEDInfo * oldLEDs, LEDInfo * new) if (collide) { WARN1("Map for indicator %s redefined\n", - XkbAtomText(NULL, old->name, XkbMessage)); + XkbcAtomText(old->name)); ACTION1("Using %s definition for duplicate fields\n", (new->defs.merge == MergeAugment ? "first" : "last")); } @@ -151,7 +149,7 @@ AddIndicatorMap(LEDInfo * oldLEDs, LEDInfo * new) { WSGO("Couldn't allocate indicator map\n"); ACTION1("Map for indicator %s not compiled\n", - XkbAtomText(NULL, new->name, XkbMessage)); + XkbcAtomText(new->name)); return NULL; } *old = *new; @@ -306,7 +304,7 @@ SetIndicatorMapField(LEDInfo * led, ERROR2("Illegal indicator index %d (range 1..%d)\n", rtrn.uval, XkbNumIndicators); ACTION1("Index definition for %s indicator ignored\n", - XkbAtomText(NULL, led->name, XkbMessage)); + XkbcAtomText(led->name)); return False; } led->indicator = rtrn.uval; @@ -315,7 +313,7 @@ SetIndicatorMapField(LEDInfo * led, else { ERROR2("Unknown field %s in map for %s indicator\n", field, - XkbAtomText(NULL, led->name, XkbMessage)); + XkbcAtomText(led->name)); ACTION("Definition ignored\n"); ok = False; } diff --git a/src/xkbcomp/keycodes.c b/src/xkbcomp/keycodes.c index 2c9eb58..5b92447 100644 --- a/src/xkbcomp/keycodes.c +++ b/src/xkbcomp/keycodes.c @@ -37,7 +37,7 @@ longText(unsigned long val, unsigned format) char buf[4]; LongToKeyName(val, buf); - return XkbKeyNameText(buf, format); + return XkbcKeyNameText(buf); } /***====================================================================***/ @@ -168,8 +168,7 @@ AddIndicatorName(KeyNamesInfo * info, IndicatorNameInfo * new) if (((old->defs.fileID == new->defs.fileID) && (warningLevel > 0)) || (warningLevel > 9)) { - WARN1("Multiple indicators named %s\n", - XkbAtomText(NULL, new->name, XkbMessage)); + WARN1("Multiple indicators named %s\n", XkbcAtomText(new->name)); if (old->ndx == new->ndx) { if (old->virtual != new->virtual) @@ -248,8 +247,8 @@ AddIndicatorName(KeyNamesInfo * info, IndicatorNameInfo * new) ignoring = new->name; } ACTION4("Using %s %s, ignoring %s %s\n", - oldType, XkbAtomText(NULL, using, XkbMessage), - newType, XkbAtomText(NULL, ignoring, XkbMessage)); + oldType, XkbcAtomText(using), + newType, XkbcAtomText(ignoring)); } } if (replace) @@ -852,7 +851,7 @@ CompileKeycodes(XkbFile *file, XkbcDescPtr xkb, unsigned merge) { LongToKeyName(info.names[i], xkb->names->keys[i].name); uDEBUG2(2, "key %d = %s\n", i, - XkbKeyNameText(xkb->names->keys[i].name, XkbMessage)); + XkbcKeyNameText(xkb->names->keys[i].name)); } } else diff --git a/src/xkbcomp/keymap.c b/src/xkbcomp/keymap.c index 7253d4e..927dd95 100644 --- a/src/xkbcomp/keymap.c +++ b/src/xkbcomp/keymap.c @@ -75,7 +75,7 @@ CompileKeymap(XkbFile *file, XkbcDescPtr xkb, unsigned merge) break; default: ERROR1("Cannot compile %s alone into an XKM file\n", - XkbConfigText(mainType)); + XkbcConfigText(mainType)); return False; } have = 0; @@ -88,14 +88,14 @@ CompileKeymap(XkbFile *file, XkbcDescPtr xkb, unsigned merge) if ((have & (1 << file->type)) != 0) { ERROR2("More than one %s section in a %s file\n", - XkbConfigText(file->type), XkbConfigText(mainType)); + XkbcConfigText(file->type), XkbcConfigText(mainType)); ACTION("All sections after the first ignored\n"); ok = False; } else if ((1 << file->type) & (~legal)) { ERROR2("Cannot define %s in a %s file\n", - XkbConfigText(file->type), XkbConfigText(mainType)); + XkbcConfigText(file->type), XkbcConfigText(mainType)); ok = False; } else @@ -105,7 +105,7 @@ CompileKeymap(XkbFile *file, XkbcDescPtr xkb, unsigned merge) case XkmLayoutFile: case XkmKeymapFile: WSGO2("Illegal %s configuration in a %s file\n", - XkbConfigText(file->type), XkbConfigText(mainType)); + XkbcConfigText(file->type), XkbcConfigText(mainType)); ACTION("Ignored\n"); ok = False; break; @@ -128,7 +128,7 @@ CompileKeymap(XkbFile *file, XkbcDescPtr xkb, unsigned merge) case XkmVirtualModsIndex: case XkmIndicatorsIndex: WSGO1("Found an isolated %s section\n", - XkbConfigText(file->type)); + XkbcConfigText(file->type)); break; default: WSGO1("Unknown file type %d\n", file->type); @@ -166,12 +166,12 @@ CompileKeymap(XkbFile *file, XkbcDescPtr xkb, unsigned merge) if (missing & bit) { ERROR2("Missing %s section in a %s file\n", - XkbConfigText(i), XkbConfigText(mainType)); + XkbcConfigText(i), XkbcConfigText(mainType)); missing &= ~bit; } } ACTION1("Description of %s not compiled\n", - XkbConfigText(mainType)); + XkbcConfigText(mainType)); ok = False; } ok = BindIndicators(xkb, True, unbound, NULL); diff --git a/src/xkbcomp/keytypes.c b/src/xkbcomp/keytypes.c index fc8ffa1..eb5aa9d 100644 --- a/src/xkbcomp/keytypes.c +++ b/src/xkbcomp/keytypes.c @@ -119,7 +119,7 @@ extern Bool AddLevelName(KeyTypeInfo * /* type */ , XkbVModMaskText((t)->dpy,(x),(p)->indexMods,(p)->indexVMods,XkbMessage) #define PreserveTxt(t,x,p) \ XkbVModMaskText((t)->dpy,(x),(p)->preMods,(p)->preVMods,XkbMessage) -#define TypeTxt(t) XkbAtomText((t)->dpy,(t)->name,XkbMessage) +#define TypeTxt(t) XkbcAtomText((t)->name) #define TypeMaskTxt(t,x) \ XkbVModMaskText((t)->dpy,(x),(t)->mask,(t)->vmask,XkbMessage) @@ -819,8 +819,8 @@ AddLevelName(KeyTypeInfo * type, if (warningLevel > 0) { char *old, *new; - old = XkbAtomText(type->dpy, type->lvlNames[level], XkbMessage); - new = XkbAtomText(type->dpy, name, XkbMessage); + old = XkbcAtomText(type->lvlNames[level]); + new = XkbcAtomText(name); WARN2("Multiple names for level %d of key type %s\n", level + 1, TypeTxt(type)); if (clobber) @@ -852,7 +852,7 @@ SetLevelName(KeyTypeInfo * type, ExprDef * arrayNdx, ExprDef * value) ERROR3("Level name %d out of range (1..%d) in key type %s\n", rtrn.ival, XkbMaxShiftLevel + 1, - XkbAtomText(type->dpy, type->name, XkbMessage)); + XkbcAtomText(type->name)); ACTION("Ignoring illegal level name definition\n"); return False; } @@ -860,7 +860,7 @@ SetLevelName(KeyTypeInfo * type, ExprDef * arrayNdx, ExprDef * value) if (!ExprResolveString(value, &rtrn, NULL, NULL)) { ERROR2("Non-string name for level %d in key type %s\n", level + 1, - XkbAtomText(type->dpy, type->name, XkbMessage)); + XkbcAtomText(type->name)); ACTION("Ignoring illegal level name definition\n"); return False; } @@ -904,7 +904,7 @@ SetKeyTypeField(KeyTypeInfo * type, if (type->defs.defined & _KT_Mask) { WARN1("Multiple modifier mask definitions for key type %s\n", - XkbAtomText(type->dpy, type->name, XkbMessage)); + XkbcAtomText(type->name)); ACTION1("Using %s, ", TypeMaskTxt(type, xkb)); INFO1("ignoring %s\n", XkbVModMaskText(type->dpy, xkb, mods, vmods, XkbMessage)); @@ -1167,7 +1167,7 @@ CopyDefToKeyType(XkbcDescPtr xkb, XkbKeyTypePtr type, KeyTypeInfo * def) { WARN("Couldn't allocate preserve array in CopyDefToKeyType\n"); ACTION1("Preserve setting for type %s lost\n", - XkbAtomText(def->dpy, def->name, XkbMessage)); + XkbcAtomText(def->name)); } else { diff --git a/src/xkbcomp/misc.c b/src/xkbcomp/misc.c index de0f667..800d3ce 100644 --- a/src/xkbcomp/misc.c +++ b/src/xkbcomp/misc.c @@ -99,7 +99,7 @@ ProcessIncludeFile(IncludeStmt * stmt, if (!mapToUse) { ERROR3("No %s named \"%s\" in the include file \"%s\"\n", - XkbConfigText(file_type), stmt->map, stmt->file); + XkbcConfigText(file_type), stmt->map, stmt->file); ACTION("Exiting\n"); return False; } @@ -114,7 +114,7 @@ ProcessIncludeFile(IncludeStmt * stmt, if (mapToUse->type != file_type) { ERROR2("Include file wrong type (expected %s, got %s)\n", - XkbConfigText(file_type), XkbConfigText(mapToUse->type)); + XkbcConfigText(file_type), XkbcConfigText(mapToUse->type)); ACTION1("Include file \"%s\" ignored\n", stmt->file); return False; } @@ -424,7 +424,7 @@ ComputeKbdDefaults(XkbcDescPtr xkb) { WARN1 ("Several keys match pattern for %s\n", - XkbKeyNameText(name->name, XkbMessage)); + XkbcKeyNameText(name->name)); ACTION2("Using for key %d\n", nUnknown, i); } diff --git a/src/xkbcomp/symbols.c b/src/xkbcomp/symbols.c index 912abb9..236d451 100644 --- a/src/xkbcomp/symbols.c +++ b/src/xkbcomp/symbols.c @@ -410,8 +410,7 @@ MergeKeyGroups(SymbolsInfo * info, ("Multiple symbols for level %d/group %d on key %s\n", i + 1, group + 1, longText(into->name, XkbMessage)); ACTION2("Using %s, ignoring %s\n", - XkbKeysymText(use, XkbMessage), - XkbKeysymText(ignore, XkbMessage)); + XkbcKeysymText(use), XkbcKeysymText(ignore)); } resultSyms[i] = use; } @@ -449,8 +448,8 @@ MergeKeyGroups(SymbolsInfo * info, ("Multiple actions for level %d/group %d on key %s\n", i + 1, group + 1, longText(into->name, XkbMessage)); ACTION2("Using %s, ignoring %s\n", - XkbActionTypeText(use->type), - XkbActionTypeText(ignore->type)); + XkbcActionTypeText(use->type), + XkbcActionTypeText(ignore->type)); } resultActs[i] = *use; } @@ -554,8 +553,8 @@ MergeKeys(SymbolsInfo * info, KeyInfo * into, KeyInfo * from) ("Multiple definitions for group %d type of key %s\n", i, longText(into->name, XkbMessage)); ACTION2("Using %s, ignoring %s\n", - XkbAtomText(NULL, use, XkbMessage), - XkbAtomText(NULL, ignore, XkbMessage)); + XkbcAtomText(use), + XkbcAtomText(ignore)); } if ((from->defs.merge != MergeAugment) || (into->types[i] == None)) @@ -661,7 +660,7 @@ AddModMapEntry(SymbolsInfo * info, ModMapEntry * new) } ERROR1 ("%s added to symbol map for multiple modifiers\n", - XkbKeysymText(new->u.keySym, XkbMessage)); + XkbcKeysymText(new->u.keySym)); ACTION2("Using %s, ignoring %s.\n", XkbModIndexText(use, XkbMessage), XkbModIndexText(ignore, XkbMessage)); @@ -1603,7 +1602,7 @@ HandleModMapDef(ModMapDef * def, { ERROR("Illegal modifier map definition\n"); ACTION1("Ignoring map for non-modifier \"%s\"\n", - XkbAtomText(NULL, def->modifier, XkbMessage)); + XkbcAtomText(def->modifier)); return False; } ok = True; @@ -1968,7 +1967,7 @@ CopySymbolsDef(XkbcDescPtr xkb, KeyInfo *key, int start_from) { WARN2("Key %s not found in %s keycodes\n", longText(key->name, XkbMessage), - XkbAtomText(NULL, xkb->names->keycodes, XkbMessage)); + XkbcAtomText(xkb->names->keycodes)); ACTION("Symbols ignored\n"); } return False; @@ -2000,8 +1999,7 @@ CopySymbolsDef(XkbcDescPtr xkb, KeyInfo *key, int start_from) WARN1("No automatic type for %d symbols\n", (unsigned int) key->numLevels[i]); ACTION3("Using %s for the %s key (keycode %d)\n", - XkbAtomText(NULL, key->types[i], - XkbMessage), + XkbcAtomText(key->types[i]), longText(key->name, XkbMessage), kc); } } @@ -2016,7 +2014,7 @@ CopySymbolsDef(XkbcDescPtr xkb, KeyInfo *key, int start_from) if (warningLevel >= 3) { WARN1("Type \"%s\" is not defined\n", - XkbAtomText(NULL, key->types[i], XkbMessage)); + XkbcAtomText(key->types[i])); ACTION2("Using TWO_LEVEL for the %s key (keycode %d)\n", longText(key->name, XkbMessage), kc); } @@ -2030,7 +2028,7 @@ CopySymbolsDef(XkbcDescPtr xkb, KeyInfo *key, int start_from) { WARN4 ("Type \"%s\" has %d levels, but %s has %d symbols\n", - XkbAtomText(NULL, type->name, XkbMessage), + XkbcAtomText(type->name), (unsigned int) type->num_levels, longText(key->name, XkbMessage), (unsigned int) key->numLevels[i]); @@ -2121,7 +2119,7 @@ CopySymbolsDef(XkbcDescPtr xkb, KeyInfo *key, int start_from) { WARN2("Key %s not found in %s keycodes\n", longText(key->nameForOverlayKey, XkbMessage), - XkbAtomText(NULL, xkb->names->keycodes, XkbMessage)); + XkbcAtomText(xkb->names->keycodes)); ACTION1("Not treating %s as an overlay key \n", longText(key->name, XkbMessage)); } @@ -2166,7 +2164,7 @@ CopyModMapDef(XkbcDescPtr xkb, ModMapEntry *entry) { WARN2("Key %s not found in %s keycodes\n", longText(entry->u.keyName, XkbMessage), - XkbAtomText(NULL, xkb->names->keycodes, XkbMessage)); + XkbcAtomText(xkb->names->keycodes)); ACTION1("Modifier map entry for %s not updated\n", XkbModIndexText(entry->modifier, XkbMessage)); } @@ -2178,8 +2176,8 @@ CopyModMapDef(XkbcDescPtr xkb, ModMapEntry *entry) if (warningLevel > 5) { WARN2("Key \"%s\" not found in %s symbol map\n", - XkbKeysymText(entry->u.keySym, XkbMessage), - XkbAtomText(NULL, xkb->names->symbols, XkbMessage)); + XkbcKeysymText(entry->u.keySym), + XkbcAtomText(xkb->names->symbols)); ACTION1("Modifier map entry for %s not updated\n", XkbModIndexText(entry->modifier, XkbMessage)); } diff --git a/src/xkbcomp/vmod.c b/src/xkbcomp/vmod.c index 8b9d378..d7e586e 100644 --- a/src/xkbcomp/vmod.c +++ b/src/xkbcomp/vmod.c @@ -104,20 +104,20 @@ HandleVModDef(VModDef * stmt, unsigned mergeMode, VModInfo * info) const char *str2 = ""; if (!ExprResolveModMask(stmt->value, &mod, NULL, NULL)) { - str1 = XkbAtomText(NULL, stmt->name, XkbMessage); + str1 = XkbcAtomText(stmt->name); ACTION1("Declaration of %s ignored\n", str1); return False; } if (mod.uval == srv->vmods[i]) return True; - str1 = XkbAtomText(NULL, stmt->name, XkbMessage); + str1 = XkbcAtomText(stmt->name); WARN1("Virtual modifier %s multiply defined\n", str1); - str1 = XkbModMaskText(srv->vmods[i], XkbCFile); + str1 = XkbcModMaskText(srv->vmods[i], True); if (mergeMode == MergeOverride) { str2 = str1; - str1 = XkbModMaskText(mod.uval, XkbCFile); + str1 = XkbcModMaskText(mod.uval, True); } ACTION2("Using %s, ignoring %s\n", str1, str2); if (mergeMode == MergeOverride) @@ -148,7 +148,7 @@ HandleVModDef(VModDef * stmt, unsigned mergeMode, VModInfo * info) return True; } ACTION1("Declaration of %s ignored\n", - XkbAtomText(NULL, stmt->name, XkbMessage)); + XkbcAtomText(stmt->name)); return False; }