src/xkbcomp/indicators.c \
src/xkbcomp/indicators.h \
src/xkbcomp/keycodes.c \
- src/xkbcomp/keycodes.h \
src/xkbcomp/keytypes.c \
src/xkbcomp/misc.c \
src/xkbcomp/parser.y \
********************************************************/
#include "action.h"
-#include "keycodes.h"
static bool actionsInitialized;
static ExprDef constTrue;
/***====================================================================***/
-static bool
+static inline bool
ReportMismatch(unsigned action, unsigned field, const char *type)
{
ERROR("Value of %s field must be of type %s\n", fieldText(field), type);
return false;
}
-static bool
+static inline bool
ReportIllegal(unsigned action, unsigned field)
{
ERROR("Field %s is not defined for an action of type %s\n",
return false;
}
-static bool
+static inline bool
ReportActionNotArray(unsigned action, unsigned field)
{
ERROR("The %s field in the %s action is not an array\n",
return false;
}
-static bool
+static inline bool
ReportNotFound(unsigned action, unsigned field, const char *what,
const char *bad)
{
struct xkb_keymap *keymap;
} CompatInfo;
-/***====================================================================***/
-
-#define ReportSINotArray(si, f, i) \
- ReportNotArray("symbol interpretation", (f), siText((si), (i)))
-#define ReportSIBadType(si, f, w, i) \
- ReportBadType("symbol interpretation", (f), siText((si), (i)), (w))
-
-/***====================================================================***/
-
static const char *
siText(SymInterpInfo * si, CompatInfo * info)
{
return buf;
}
+static inline bool
+ReportSINotArray(SymInterpInfo *si, const char *field, CompatInfo *info)
+{
+ return ReportNotArray("symbol interpretation", field, siText(si, info));
+}
+
+static inline bool
+ReportSIBadType(SymInterpInfo *si, const char *field, const char *wanted,
+ CompatInfo *info)
+{
+ return ReportBadType("symbol interpretation", field, siText(si, info),
+ wanted);
+}
+
static void
InitCompatInfo(CompatInfo *info, struct xkb_keymap *keymap, unsigned file_id)
{
/***====================================================================***/
-#define ReportIndicatorBadType(keymap, l, f, w) \
- ReportBadType("indicator map", (f), \
- xkb_atom_text((keymap)->ctx, (l)->name), (w))
-#define ReportIndicatorNotArray(keymap, l, f) \
- ReportNotArray("indicator map", (f), \
- xkb_atom_text((keymap)->ctx, (l)->name))
+static inline bool
+ReportIndicatorBadType(struct xkb_keymap *keymap, LEDInfo *led,
+ const char *field, const char *wanted)
+{
+ return ReportBadType("indicator map", field,
+ xkb_atom_text(keymap->ctx, led->name), wanted);
+}
+
+static inline bool
+ReportIndicatorNotArray(struct xkb_keymap *keymap, LEDInfo *led,
+ const char *field)
+{
+ return ReportNotArray("indicator map", field,
+ xkb_atom_text(keymap->ctx, led->name));
+}
/***====================================================================***/
*
********************************************************/
-#include "keycodes.h"
+#include "xkbcomp-priv.h"
#include "expr.h"
#include "parseutils.h"
-const char *
-longText(unsigned long val)
-{
- char buf[4];
-
- LongToKeyName(val, buf);
- return XkbcKeyNameText(buf);
-}
-
-/***====================================================================***/
-
-void
-LongToKeyName(unsigned long val, char *name)
-{
- name[0] = ((val >> 24) & 0xff);
- name[1] = ((val >> 16) & 0xff);
- name[2] = ((val >> 8) & 0xff);
- name[3] = (val & 0xff);
-}
-
-/***====================================================================***/
-
typedef struct _AliasInfo {
enum merge_mode merge;
unsigned file_id;
/***====================================================================***/
-#define ReportTypeShouldBeArray(keymap, t, f) \
- ReportShouldBeArray("key type", (f), TypeTxt((keymap), (t)))
-#define ReportTypeBadType(keymap, t, f, w) \
- ReportBadType("key type", (f), TypeTxt((keymap), (t)), (w))
+static inline const char *
+MapEntryTxt(struct xkb_keymap *keymap, struct xkb_kt_map_entry *entry)
+{
+ return XkbcVModMaskText(keymap, entry->mods.real_mods, entry->mods.vmods);
+}
-/***====================================================================***/
+static inline const char *
+PreserveIndexTxt(struct xkb_keymap *keymap, PreserveInfo *pi)
+{
+ return XkbcVModMaskText(keymap, pi->indexMods, pi->indexVMods);
+}
-#define MapEntryTxt(x, e) \
- XkbcVModMaskText((x), (e)->mods.real_mods, (e)->mods.vmods)
-#define PreserveIndexTxt(x, p) \
- XkbcVModMaskText((x), (p)->indexMods, (p)->indexVMods)
-#define PreserveTxt(x, p) \
- XkbcVModMaskText((x), (p)->preMods, (p)->preVMods)
-#define TypeTxt(keymap, t) \
- xkb_atom_text((keymap)->ctx, (t)->name)
-#define TypeMaskTxt(t, x) \
- XkbcVModMaskText((x), (t)->mask, (t)->vmask)
+static inline const char *
+PreserveTxt(struct xkb_keymap *keymap, PreserveInfo *pi)
+{
+ return XkbcVModMaskText(keymap, pi->preMods, pi->preVMods);
+}
+
+static inline const char *
+TypeTxt(struct xkb_keymap *keymap, KeyTypeInfo *type)
+{
+ return xkb_atom_text(keymap->ctx, type->name);
+}
+
+static inline const char *
+TypeMaskTxt(struct xkb_keymap *keymap, KeyTypeInfo *type)
+{
+ return XkbcVModMaskText(keymap, type->mask, type->vmask);
+}
+
+static inline bool
+ReportTypeShouldBeArray(struct xkb_keymap *keymap, KeyTypeInfo *type,
+ const char *field)
+{
+ return ReportShouldBeArray("key type", field, TypeTxt(keymap, type));
+}
+
+static inline bool
+ReportTypeBadType(struct xkb_keymap *keymap, KeyTypeInfo *type,
+ const char *field, const char *wanted)
+{
+ return ReportBadType("key type", field, TypeTxt(keymap, type), wanted);
+}
/***====================================================================***/
if (type->defs.defined & _KT_Mask) {
WARN("Multiple modifier mask definitions for key type %s\n",
xkb_atom_text(keymap->ctx, type->name));
- ACTION("Using %s, ", TypeMaskTxt(type, keymap));
+ ACTION("Using %s, ", TypeMaskTxt(keymap, type));
INFO("ignoring %s\n", XkbcVModMaskText(keymap, mods, vmods));
return false;
}
#include "xkbcomp-priv.h"
#include "path.h"
#include "parseutils.h"
-#include "keycodes.h"
/***====================================================================***/
return true;
}
-/***====================================================================***/
-
-int
-ReportNotArray(const char *type, const char *field, const char *name)
-{
- ERROR("The %s %s field is not an array\n", type, field);
- ACTION("Ignoring illegal assignment in %s\n", name);
- return false;
-}
-
-int
-ReportShouldBeArray(const char *type, const char *field, const char *name)
-{
- ERROR("Missing subscript for %s %s\n", type, field);
- ACTION("Ignoring illegal assignment in %s\n", name);
- return false;
-}
-
-int
-ReportBadType(const char *type, const char *field,
- const char *name, const char *wanted)
-{
- ERROR("The %s %s field must be a %s\n", type, field, wanted);
- ACTION("Ignoring illegal assignment in %s\n", name);
- return false;
-}
-
-int
-ReportBadField(const char *type, const char *field, const char *name)
-{
- ERROR("Unknown %s field %s in %s\n", type, field, name);
- ACTION("Ignoring assignment to unknown field in %s\n", name);
- return false;
-}
-
-/***====================================================================***/
-
bool
UseNewField(unsigned field,
CommonInfo * oldDefs, CommonInfo * newDefs, unsigned *pCollide)
#include "xkbcomp-priv.h"
#include "parseutils.h"
#include "action.h"
-#include "keycodes.h"
#include "vmod.h"
/***====================================================================***/
/* Needed to work with the typechecker. */
-typedef darray (xkb_keysym_t) darray_xkb_keysym_t;
-typedef darray (union xkb_action) darray_xkb_action;
+typedef darray(xkb_keysym_t) darray_xkb_keysym_t;
+typedef darray(union xkb_action) darray_xkb_action;
#define RepeatYes 1
#define RepeatNo 0
#define _Key_GroupInfo (1 << 6)
#define _Key_VModMap (1 << 7)
+static inline const char *
+longText(unsigned long val)
+{
+ char buf[4];
+
+ LongToKeyName(val, buf);
+ return XkbcKeyNameText(buf);
+}
+
typedef struct _KeyInfo {
unsigned short defined;
unsigned file_id;
extern void *
AddCommonInfo(CommonInfo * old, CommonInfo * new);
-extern int
-ReportNotArray(const char *type, const char *field, const char *name);
-
-extern int
-ReportShouldBeArray(const char *type, const char *field, const char *name);
-
-extern int
-ReportBadType(const char *type, const char *field, const char *name,
- const char *wanted);
-
-extern int
-ReportBadField(const char *type, const char *field, const char *name);
-
extern bool
ProcessIncludeFile(struct xkb_context *ctx, IncludeStmt *stmt,
enum xkb_file_type file_type, XkbFile **file_rtrn,
uint32_t
VModsToReal(struct xkb_keymap *keymap, uint32_t vmodmask);
+static inline unsigned long
+KeyNameToLong(const char *name)
+{
+ return
+ (((unsigned long)name[0]) << 24) |
+ (((unsigned long)name[1]) << 16) |
+ (((unsigned long)name[2]) << 8) |
+ (((unsigned long)name[3]) << 0);
+}
+
+static inline void
+LongToKeyName(unsigned long val, char *name)
+{
+ name[0] = ((val >> 24) & 0xff);
+ name[1] = ((val >> 16) & 0xff);
+ name[2] = ((val >> 8) & 0xff);
+ name[3] = ((val >> 0) & 0xff);
+}
+
+static inline bool
+ReportNotArray(const char *type, const char *field, const char *name)
+{
+ ERROR("The %s %s field is not an array\n", type, field);
+ ACTION("Ignoring illegal assignment in %s\n", name);
+ return false;
+}
+
+static inline bool
+ReportShouldBeArray(const char *type, const char *field, const char *name)
+{
+ ERROR("Missing subscript for %s %s\n", type, field);
+ ACTION("Ignoring illegal assignment in %s\n", name);
+ return false;
+}
+
+static inline bool
+ReportBadType(const char *type, const char *field,
+ const char *name, const char *wanted)
+{
+ ERROR("The %s %s field must be a %s\n", type, field, wanted);
+ ACTION("Ignoring illegal assignment in %s\n", name);
+ return false;
+}
+
+static inline bool
+ReportBadField(const char *type, const char *field, const char *name)
+{
+ ERROR("Unknown %s field %s in %s\n", type, field, name);
+ ACTION("Ignoring assignment to unknown field in %s\n", name);
+ return false;
+}
+
#endif /* XKBCOMP_PRIV_H */