Not really needed and inconsistent.
Signed-off-by: Ran Benita <ran234@gmail.com>
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++) {
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;
continue;
write_buf(keymap, buf, size, offset, "\t\tkey %6s {",
- XkbcKeyNameText(key->name));
+ KeyNameText(key->name));
if (key->explicit & XkbExplicitKeyTypesMask) {
bool multi_type = false;
write_buf(keymap, buf, size, offset,
"\t\tmodifier_map %s { %s };\n",
get_mod_index_text(mod),
- XkbcKeyNameText(key->name));
+ KeyNameText(key->name));
}
}
#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;
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;
return "none";
if (modMask != 0)
- mm = XkbcModMaskText(modMask, false);
+ mm = ModMaskText(modMask, false);
str = buf;
buf[0] = '\0';
len = snprintf(str, rem, "%s%s",
(str != buf) ? "+" : "",
- XkbcVModIndexText(keymap, i));
+ VModIndexText(keymap, i));
rem -= len;
str += len;
}
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 : ""),
};
const char *
-XkbcModIndexText(xkb_mod_index_t ndx)
+ModIndexText(xkb_mod_index_t ndx)
{
char *buf;
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;
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) {
}
const char *
-XkbcFileTypeText(enum xkb_file_type type)
+FileTypeText(enum xkb_file_type type)
{
switch (type) {
case FILE_TYPE_KEYMAP:
};
const char *
-XkbcActionTypeText(unsigned type)
+ActionTypeText(unsigned type)
{
if (type <= XkbSA_LastAction)
return actionTypeNames[type];
}
const char *
-XkbcKeysymText(xkb_keysym_t sym)
+KeysymText(xkb_keysym_t sym)
{
static char buffer[64];
}
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';
};
const char *
-XkbcSIMatchText(unsigned type)
+SIMatchText(unsigned type)
{
char *buf;
case XkbSI_Exactly:
return siMatchText[4];
default:
- buf = tbGetBuffer(40);
+ buf = GetBuffer(40);
snprintf(buf, 40, "0x%x", type & XkbSI_OpMask);
return buf;
}
#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 */
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
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);
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;
}
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;
}
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 *
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
"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;
"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;
}
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;
}
}
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) */
char buf[4];
LongToKeyName(val, buf);
- return XkbcKeyNameText(buf);
+ return KeyNameText(buf);
}
typedef struct _KeyInfo {
"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;
}
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;
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;
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;
}
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;
}
"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;
}
}
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;
}
}
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,
*/
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;
}
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;
}
default:
log_err(ctx, "Cannot define %s in a keymap file\n",
- XkbcFileTypeText(file->type));
+ FileTypeText(file->type));
continue;
}
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;
}
}