From: Ran Benita Date: Tue, 24 Jul 2012 10:24:59 +0000 (+0300) Subject: Drop Xkbc prefix of text functions X-Git-Tag: xkbcommon-0.2.0~368 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4f843c817b213e4b69ee5f3df071ebe3c917088e;p=platform%2Fupstream%2Flibxkbcommon.git Drop Xkbc prefix of text functions Not really needed and inconsistent. Signed-off-by: Ran Benita --- diff --git a/src/keymap-dump.c b/src/keymap-dump.c index 263afad..a77fd23 100644 --- a/src/keymap-dump.c +++ b/src/keymap-dump.c @@ -329,7 +329,7 @@ write_keycodes(struct xkb_keymap *keymap, char **buf, size_t *size, continue; write_buf(keymap, buf, size, offset, "\t\t%6s = %d;\n", - XkbcKeyNameText(key->name), XkbKeyGetKeycode(keymap, key)); + KeyNameText(key->name), XkbKeyGetKeycode(keymap, key)); } for (i = 0; i < XkbNumIndicators; i++) { @@ -342,8 +342,8 @@ write_keycodes(struct xkb_keymap *keymap, char **buf, size_t *size, darray_foreach(alias, keymap->key_aliases) write_buf(keymap, buf, size, offset, "\t\talias %6s = %6s;\n", - XkbcKeyNameText(alias->alias), - XkbcKeyNameText(alias->real)); + KeyNameText(alias->alias), + KeyNameText(alias->real)); write_buf(keymap, buf, size, offset, "\t};\n\n"); return true; @@ -807,7 +807,7 @@ write_symbols(struct xkb_keymap *keymap, char **buf, size_t *size, continue; write_buf(keymap, buf, size, offset, "\t\tkey %6s {", - XkbcKeyNameText(key->name)); + KeyNameText(key->name)); if (key->explicit & XkbExplicitKeyTypesMask) { bool multi_type = false; @@ -926,7 +926,7 @@ write_symbols(struct xkb_keymap *keymap, char **buf, size_t *size, write_buf(keymap, buf, size, offset, "\t\tmodifier_map %s { %s };\n", get_mod_index_text(mod), - XkbcKeyNameText(key->name)); + KeyNameText(key->name)); } } diff --git a/src/text.c b/src/text.c index 6f1d0e6..ff19838 100644 --- a/src/text.c +++ b/src/text.c @@ -27,28 +27,28 @@ #include "text.h" #define BUFFER_SIZE 1024 -static char textBuffer[BUFFER_SIZE]; -static unsigned int tbNext = 0; static char * -tbGetBuffer(unsigned int size) +GetBuffer(size_t size) { + static char buffer[BUFFER_SIZE]; + static size_t next; char *rtrn; if (size >= BUFFER_SIZE) return NULL; - if ((BUFFER_SIZE - tbNext) <= size) - tbNext = 0; + if (BUFFER_SIZE - next <= size) + next = 0; - rtrn = &textBuffer[tbNext]; - tbNext += size; + rtrn = &buffer[next]; + next += size; return rtrn; } static const char * -XkbcVModIndexText(struct xkb_keymap *keymap, xkb_mod_index_t ndx) +VModIndexText(struct xkb_keymap *keymap, xkb_mod_index_t ndx) { int len; char *rtrn; @@ -69,15 +69,15 @@ XkbcVModIndexText(struct xkb_keymap *keymap, xkb_mod_index_t ndx) if (len >= BUFFER_SIZE) len = BUFFER_SIZE - 1; - rtrn = tbGetBuffer(len); + rtrn = GetBuffer(len); strncpy(rtrn, tmp, len); return rtrn; } const char * -XkbcVModMaskText(struct xkb_keymap *keymap, xkb_mod_mask_t modMask, - xkb_mod_mask_t mask) +VModMaskText(struct xkb_keymap *keymap, xkb_mod_mask_t modMask, + xkb_mod_mask_t mask) { xkb_mod_index_t i; xkb_mod_mask_t bit; @@ -90,7 +90,7 @@ XkbcVModMaskText(struct xkb_keymap *keymap, xkb_mod_mask_t modMask, return "none"; if (modMask != 0) - mm = XkbcModMaskText(modMask, false); + mm = ModMaskText(modMask, false); str = buf; buf[0] = '\0'; @@ -104,7 +104,7 @@ XkbcVModMaskText(struct xkb_keymap *keymap, xkb_mod_mask_t modMask, len = snprintf(str, rem, "%s%s", (str != buf) ? "+" : "", - XkbcVModIndexText(keymap, i)); + VModIndexText(keymap, i)); rem -= len; str += len; } @@ -119,7 +119,7 @@ XkbcVModMaskText(struct xkb_keymap *keymap, xkb_mod_mask_t modMask, if (len >= BUFFER_SIZE) len = BUFFER_SIZE - 1; - rtrn = tbGetBuffer(len + 1); + rtrn = GetBuffer(len + 1); rtrn[0] = '\0'; snprintf(rtrn, len + 1, "%s%s%s", (mm ? mm : ""), @@ -140,7 +140,7 @@ static const char *modNames[XkbNumModifiers] = { }; const char * -XkbcModIndexText(xkb_mod_index_t ndx) +ModIndexText(xkb_mod_index_t ndx) { char *buf; @@ -149,14 +149,14 @@ XkbcModIndexText(xkb_mod_index_t ndx) else if (ndx == XkbNoModifier) return "none"; - buf = tbGetBuffer(32); + buf = GetBuffer(32); snprintf(buf, 32, "ILLEGAL_%02x", ndx); return buf; } const char * -XkbcModMaskText(xkb_mod_mask_t mask, bool cFormat) +ModMaskText(xkb_mod_mask_t mask, bool cFormat) { int i, rem; xkb_mod_index_t bit; @@ -169,7 +169,7 @@ XkbcModMaskText(xkb_mod_mask_t mask, bool cFormat) return (cFormat ? "0" : "none"); rem = 64; - buf = tbGetBuffer(rem); + buf = GetBuffer(rem); str = buf; buf[0] = '\0'; for (i = 0, bit = 1; i < XkbNumModifiers && rem > 1; i++, bit <<= 1) { @@ -190,7 +190,7 @@ XkbcModMaskText(xkb_mod_mask_t mask, bool cFormat) } const char * -XkbcFileTypeText(enum xkb_file_type type) +FileTypeText(enum xkb_file_type type) { switch (type) { case FILE_TYPE_KEYMAP: @@ -235,7 +235,7 @@ static const char *actionTypeNames[XkbSA_NumActions] = { }; const char * -XkbcActionTypeText(unsigned type) +ActionTypeText(unsigned type) { if (type <= XkbSA_LastAction) return actionTypeNames[type]; @@ -243,7 +243,7 @@ XkbcActionTypeText(unsigned type) } const char * -XkbcKeysymText(xkb_keysym_t sym) +KeysymText(xkb_keysym_t sym) { static char buffer[64]; @@ -253,12 +253,12 @@ XkbcKeysymText(xkb_keysym_t sym) } const char * -XkbcKeyNameText(char *name) +KeyNameText(char *name) { char *buf; int len; - buf = tbGetBuffer(7); + buf = GetBuffer(7); buf[0] = '<'; strncpy(&buf[1], name, 4); buf[5] = '\0'; @@ -278,7 +278,7 @@ static const char *siMatchText[5] = { }; const char * -XkbcSIMatchText(unsigned type) +SIMatchText(unsigned type) { char *buf; @@ -294,7 +294,7 @@ XkbcSIMatchText(unsigned type) case XkbSI_Exactly: return siMatchText[4]; default: - buf = tbGetBuffer(40); + buf = GetBuffer(40); snprintf(buf, 40, "0x%x", type & XkbSI_OpMask); return buf; } diff --git a/src/text.h b/src/text.h index 43a212e..9cff03c 100644 --- a/src/text.h +++ b/src/text.h @@ -30,28 +30,28 @@ #include "xkb-priv.h" const char * -XkbcVModMaskText(struct xkb_keymap *keymap, xkb_mod_mask_t modMask, - xkb_mod_mask_t mask); +VModMaskText(struct xkb_keymap *keymap, xkb_mod_mask_t modMask, + xkb_mod_mask_t mask); const char * -XkbcModIndexText(xkb_mod_index_t ndx); +ModIndexText(xkb_mod_index_t ndx); const char * -XkbcModMaskText(xkb_mod_mask_t mask, bool cFormat); +ModMaskText(xkb_mod_mask_t mask, bool cFormat); -extern const char * -XkbcFileTypeText(enum xkb_file_type type); +const char * +FileTypeText(enum xkb_file_type type); -extern const char * -XkbcActionTypeText(unsigned type); +const char * +ActionTypeText(unsigned type); -extern const char * -XkbcKeysymText(xkb_keysym_t sym); +const char * +KeysymText(xkb_keysym_t sym); -extern const char * -XkbcKeyNameText(char *name); +const char * +KeyNameText(char *name); -extern const char * -XkbcSIMatchText(unsigned type); +const char * +SIMatchText(unsigned type); #endif /* TEXT_H */ diff --git a/src/xkbcomp/action.c b/src/xkbcomp/action.c index 4b4ac95..72b4ef8 100644 --- a/src/xkbcomp/action.c +++ b/src/xkbcomp/action.c @@ -172,7 +172,7 @@ ReportMismatch(struct xkb_keymap *keymap, unsigned action, unsigned field, log_err(keymap->ctx, "Value of %s field must be of type %s; " "Action %s definition ignored\n", - fieldText(field), type, XkbcActionTypeText(action)); + fieldText(field), type, ActionTypeText(action)); return false; } @@ -182,7 +182,7 @@ ReportIllegal(struct xkb_keymap *keymap, unsigned action, unsigned field) log_err(keymap->ctx, "Field %s is not defined for an action of type %s; " "Action definition ignored\n", - fieldText(field), XkbcActionTypeText(action)); + fieldText(field), ActionTypeText(action)); return false; } @@ -193,7 +193,7 @@ ReportActionNotArray(struct xkb_keymap *keymap, unsigned action, log_err(keymap->ctx, "The %s field in the %s action is not an array; " "Action definition ignored\n", - fieldText(field), XkbcActionTypeText(action)); + fieldText(field), ActionTypeText(action)); return false; } @@ -204,7 +204,7 @@ ReportNotFound(struct xkb_keymap *keymap, unsigned action, unsigned field, log_err(keymap->ctx, "%s named %s not found; " "Ignoring the %s field of an %s action\n", - what, bad, fieldText(field), XkbcActionTypeText(action)); + what, bad, fieldText(field), ActionTypeText(action)); return false; } @@ -847,7 +847,7 @@ HandleRedirectKey(struct xkb_keymap *keymap, struct xkb_any_action *action, key = FindNamedKey(keymap, tmp, true, CreateKeyNames(keymap), 0); if (!key) return ReportNotFound(keymap, action->type, field, "Key", - XkbcKeyNameText(rtrn.name)); + KeyNameText(rtrn.name)); act->new_kc = XkbKeyGetKeycode(keymap, key); return true; diff --git a/src/xkbcomp/compat.c b/src/xkbcomp/compat.c index ede08a6..26ea13c 100644 --- a/src/xkbcomp/compat.c +++ b/src/xkbcomp/compat.c @@ -104,9 +104,9 @@ siText(SymInterpInfo * si, CompatInfo * info) } else { snprintf(buf, sizeof(buf), "%s+%s(%s)", - XkbcKeysymText(si->interp.sym), - XkbcSIMatchText(si->interp.match), - XkbcModMaskText(si->interp.mods, false)); + KeysymText(si->interp.sym), + SIMatchText(si->interp.match), + ModMaskText(si->interp.mods, false)); } return buf; } diff --git a/src/xkbcomp/keycodes.c b/src/xkbcomp/keycodes.c index d771f32..b865cd4 100644 --- a/src/xkbcomp/keycodes.c +++ b/src/xkbcomp/keycodes.c @@ -537,7 +537,7 @@ HandleAliasCollision(KeyNamesInfo *info, AliasInfo *old, AliasInfo *new) log_warn(info->keymap->ctx, "Alias of %s for %s declared more than once; " "First definition ignored\n", - XkbcKeyNameText(new->alias), XkbcKeyNameText(new->real)); + KeyNameText(new->alias), KeyNameText(new->real)); } else { char *use, *ignore; @@ -555,8 +555,8 @@ HandleAliasCollision(KeyNamesInfo *info, AliasInfo *old, AliasInfo *new) log_warn(info->keymap->ctx, "Multiple definitions for alias %s; " "Using %s, ignoring %s\n", - XkbcKeyNameText(old->alias), XkbcKeyNameText(use), - XkbcKeyNameText(ignore)); + KeyNameText(old->alias), KeyNameText(use), + KeyNameText(ignore)); if (use != old->real) memcpy(old->real, use, XkbKeyNameLength); @@ -816,10 +816,8 @@ ApplyAliases(KeyNamesInfo *info) key = FindNamedKey(keymap, lname, false, CreateKeyNames(keymap), 0); if (!key) { log_lvl(info->keymap->ctx, 5, - "Attempt to alias %s to non-existent key %s; " - "Ignored\n", - XkbcKeyNameText(alias->alias), - XkbcKeyNameText(alias->real)); + "Attempt to alias %s to non-existent key %s; Ignored\n", + KeyNameText(alias->alias), KeyNameText(alias->real)); alias->alias[0] = '\0'; continue; } @@ -830,8 +828,7 @@ ApplyAliases(KeyNamesInfo *info) log_lvl(info->keymap->ctx, 5, "Attempt to create alias with the name of a real key; " "Alias \"%s = %s\" ignored\n", - XkbcKeyNameText(alias->alias), - XkbcKeyNameText(alias->real)); + KeyNameText(alias->alias), KeyNameText(alias->real)); alias->alias[0] = '\0'; continue; } diff --git a/src/xkbcomp/keytypes.c b/src/xkbcomp/keytypes.c index 0264b10..82e4f0d 100644 --- a/src/xkbcomp/keytypes.c +++ b/src/xkbcomp/keytypes.c @@ -80,20 +80,20 @@ typedef struct _KeyTypesInfo { static inline const char * MapEntryTxt(KeyTypesInfo *info, struct xkb_kt_map_entry *entry) { - return XkbcVModMaskText(info->keymap, entry->mods.real_mods, - entry->mods.vmods); + return VModMaskText(info->keymap, entry->mods.real_mods, + entry->mods.vmods); } static inline const char * PreserveIndexTxt(KeyTypesInfo *info, PreserveInfo *pi) { - return XkbcVModMaskText(info->keymap, pi->indexMods, pi->indexVMods); + return VModMaskText(info->keymap, pi->indexMods, pi->indexVMods); } static inline const char * PreserveTxt(KeyTypesInfo *info, PreserveInfo *pi) { - return XkbcVModMaskText(info->keymap, pi->preMods, pi->preVMods); + return VModMaskText(info->keymap, pi->preMods, pi->preVMods); } static inline const char * @@ -105,7 +105,7 @@ TypeTxt(KeyTypesInfo *info, KeyTypeInfo *type) static inline const char * TypeMaskTxt(KeyTypesInfo *info, KeyTypeInfo *type) { - return XkbcVModMaskText(info->keymap, type->mask, type->vmask); + return VModMaskText(info->keymap, type->mask, type->vmask); } static inline bool @@ -549,9 +549,9 @@ SetMapEntry(KeyTypesInfo *info, KeyTypeInfo *type, ExprDef *arrayNdx, "Map entry for unused modifiers in %s; " "Using %s instead of %s\n", TypeTxt(info, type), - XkbcVModMaskText(info->keymap, - entry.mods.real_mods & type->mask, - entry.mods.vmods & type->vmask), + VModMaskText(info->keymap, + entry.mods.real_mods & type->mask, + entry.mods.vmods & type->vmask), MapEntryTxt(info, &entry)); entry.mods.real_mods &= type->mask; entry.mods.vmods &= type->vmask; @@ -722,7 +722,7 @@ SetKeyTypeField(KeyTypesInfo *info, KeyTypeInfo *type, "Using %s, ignoring %s\n", xkb_atom_text(info->keymap->ctx, type->name), TypeMaskTxt(info, type), - XkbcVModMaskText(info->keymap, mods, vmods)); + VModMaskText(info->keymap, mods, vmods)); return false; } type->mask = mods; diff --git a/src/xkbcomp/misc.c b/src/xkbcomp/misc.c index d6f86c8..a33a0d8 100644 --- a/src/xkbcomp/misc.c +++ b/src/xkbcomp/misc.c @@ -82,7 +82,7 @@ ProcessIncludeFile(struct xkb_context *ctx, } if (!mapToUse) { log_err(ctx, "No %s named \"%s\" in the include file \"%s\"\n", - XkbcFileTypeText(file_type), stmt->map, stmt->file); + FileTypeText(file_type), stmt->map, stmt->file); return false; } } @@ -96,8 +96,8 @@ ProcessIncludeFile(struct xkb_context *ctx, log_err(ctx, "Include file wrong type (expected %s, got %s); " "Include file \"%s\" ignored\n", - XkbcFileTypeText(file_type), - XkbcFileTypeText(mapToUse->type), stmt->file); + FileTypeText(file_type), FileTypeText(mapToUse->type), + stmt->file); return false; } /* FIXME: we have to check recursive includes here (or somewhere) */ diff --git a/src/xkbcomp/symbols.c b/src/xkbcomp/symbols.c index 4021414..f639238 100644 --- a/src/xkbcomp/symbols.c +++ b/src/xkbcomp/symbols.c @@ -56,7 +56,7 @@ longText(unsigned long val) char buf[4]; LongToKeyName(val, buf); - return XkbcKeyNameText(buf); + return KeyNameText(buf); } typedef struct _KeyInfo { @@ -353,8 +353,8 @@ MergeKeyGroups(SymbolsInfo * info, "Multiple actions for level %d/group %u on key %s; " "Using %s, ignoring %s\n", i + 1, group + 1, longText(into->name), - XkbcActionTypeText(use->type), - XkbcActionTypeText(ignore->type)); + ActionTypeText(use->type), + ActionTypeText(ignore->type)); if (use) darray_item(resultActs, i) = *use; } @@ -662,9 +662,8 @@ AddModMapEntry(SymbolsInfo * info, ModMapEntry * new) log_err(info->keymap->ctx, "%s added to symbol map for multiple modifiers; " "Using %s, ignoring %s.\n", - XkbcKeysymText(new->u.keySym), - XkbcModIndexText(use), - XkbcModIndexText(ignore)); + KeysymText(new->u.keySym), ModIndexText(use), + ModIndexText(ignore)); mm->modifier = use; } return true; @@ -684,9 +683,8 @@ AddModMapEntry(SymbolsInfo * info, ModMapEntry * new) log_err(info->keymap->ctx, "Key %s added to map for multiple modifiers; " "Using %s, ignoring %s.\n", - longText(new->u.keyName), - XkbcModIndexText(use), - XkbcModIndexText(ignore)); + longText(new->u.keyName), ModIndexText(use), + ModIndexText(ignore)); mm->modifier = use; } return true; @@ -698,7 +696,7 @@ AddModMapEntry(SymbolsInfo * info, ModMapEntry * new) log_wsgo(info->keymap->ctx, "Could not allocate modifier map entry; " "Modifier map for %s will be incomplete\n", - XkbcModIndexText(new->modifier)); + ModIndexText(new->modifier)); return false; } @@ -1380,7 +1378,7 @@ HandleModMapDef(SymbolsInfo *info, ModMapDef *def) log_err(info->keymap->ctx, "Modmap entries may contain only key names or keysyms; " "Illegal definition for %s modifier ignored\n", - XkbcModIndexText(tmp.modifier)); + ModIndexText(tmp.modifier)); continue; } @@ -1888,7 +1886,7 @@ CopyModMapDef(SymbolsInfo *info, ModMapEntry *entry) "Key %s not found in keycodes; " "Modifier map entry for %s not updated\n", longText(entry->u.keyName), - XkbcModIndexText(entry->modifier)); + ModIndexText(entry->modifier)); return false; } } @@ -1898,8 +1896,8 @@ CopyModMapDef(SymbolsInfo *info, ModMapEntry *entry) log_lvl(info->keymap->ctx, 5, "Key \"%s\" not found in symbol map; " "Modifier map entry for %s not updated\n", - XkbcKeysymText(entry->u.keySym), - XkbcModIndexText(entry->modifier)); + KeysymText(entry->u.keySym), + ModIndexText(entry->modifier)); return false; } } diff --git a/src/xkbcomp/vmod.c b/src/xkbcomp/vmod.c index 70407f2..6ed4c47 100644 --- a/src/xkbcomp/vmod.c +++ b/src/xkbcomp/vmod.c @@ -102,10 +102,10 @@ HandleVModDef(VModDef *stmt, struct xkb_keymap *keymap, if (mod.uval == keymap->vmods[i]) return true; - str1 = XkbcModMaskText(keymap->vmods[i], true); + str1 = ModMaskText(keymap->vmods[i], true); if (mergeMode == MERGE_OVERRIDE) { str2 = str1; - str1 = XkbcModMaskText(mod.uval, true); + str1 = ModMaskText(mod.uval, true); } log_warn(keymap->ctx, diff --git a/src/xkbcomp/xkbcomp.c b/src/xkbcomp/xkbcomp.c index 1b4eb2e..7295a52 100644 --- a/src/xkbcomp/xkbcomp.c +++ b/src/xkbcomp/xkbcomp.c @@ -104,7 +104,7 @@ compile_keymap(struct xkb_context *ctx, XkbFile *file) */ if (file->type != FILE_TYPE_KEYMAP) { log_err(ctx, "Cannot compile a %s file alone into a keymap\n", - XkbcFileTypeText(file->type)); + FileTypeText(file->type)); goto err; } @@ -115,7 +115,7 @@ compile_keymap(struct xkb_context *ctx, XkbFile *file) log_err(ctx, "More than one %s section in a keymap file; " "All sections after the first ignored\n", - XkbcFileTypeText(file->type)); + FileTypeText(file->type)); continue; } @@ -138,7 +138,7 @@ compile_keymap(struct xkb_context *ctx, XkbFile *file) default: log_err(ctx, "Cannot define %s in a keymap file\n", - XkbcFileTypeText(file->type)); + FileTypeText(file->type)); continue; } @@ -159,7 +159,7 @@ compile_keymap(struct xkb_context *ctx, XkbFile *file) for (bit = 1; missing != 0; bit <<= 1) { if (missing & bit) { log_err(ctx, "Required section %s missing from keymap\n", - XkbcFileTypeText(bit)); + FileTypeText(bit)); missing &= ~bit; } }