action: convert a few missed unsigned -> enum xkb_action_type
[platform/upstream/libxkbcommon.git] / src / xkbcomp / action.c
index 44bc73f..d2baa5f 100644 (file)
@@ -103,7 +103,7 @@ enum action_field {
 ActionsInfo *
 NewActionsInfo(void)
 {
-    unsigned type;
+    enum xkb_action_type type;
     ActionsInfo *info;
 
     info = calloc(1, sizeof(*info));
@@ -118,6 +118,8 @@ NewActionsInfo(void)
     /* Increment default button. */
     info->actions[ACTION_TYPE_PTR_DEFAULT].dflt.flags = 0;
     info->actions[ACTION_TYPE_PTR_DEFAULT].dflt.value = 1;
+    info->actions[ACTION_TYPE_PTR_MOVE].ptr.flags = ACTION_ACCEL;
+    info->actions[ACTION_TYPE_SWITCH_VT].screen.flags = ACTION_SAME_SCREEN;
 
     return info;
 }
@@ -166,7 +168,7 @@ static const LookupEntry fieldStrings[] = {
 };
 
 static bool
-stringToAction(const char *str, unsigned *type_rtrn)
+stringToAction(const char *str, enum xkb_action_type *type_rtrn)
 {
     return LookupString(actionTypeNames, str, type_rtrn);
 }
@@ -186,10 +188,10 @@ fieldText(enum action_field field)
 /***====================================================================***/
 
 static inline bool
-ReportMismatch(struct xkb_keymap *keymap, enum xkb_action_type action,
+ReportMismatch(struct xkb_context *ctx, enum xkb_action_type action,
                enum action_field field, const char *type)
 {
-    log_err(keymap->ctx,
+    log_err(ctx,
             "Value of %s field must be of type %s; "
             "Action %s definition ignored\n",
             fieldText(field), type, ActionTypeText(action));
@@ -197,10 +199,10 @@ ReportMismatch(struct xkb_keymap *keymap, enum xkb_action_type action,
 }
 
 static inline bool
-ReportIllegal(struct xkb_keymap *keymap, enum xkb_action_type action,
+ReportIllegal(struct xkb_context *ctx, enum xkb_action_type action,
               enum action_field field)
 {
-    log_err(keymap->ctx,
+    log_err(ctx,
             "Field %s is not defined for an action of type %s; "
             "Action definition ignored\n",
             fieldText(field), ActionTypeText(action));
@@ -208,10 +210,10 @@ ReportIllegal(struct xkb_keymap *keymap, enum xkb_action_type action,
 }
 
 static inline bool
-ReportActionNotArray(struct xkb_keymap *keymap, enum xkb_action_type action,
+ReportActionNotArray(struct xkb_context *ctx, enum xkb_action_type action,
                      enum action_field field)
 {
-    log_err(keymap->ctx,
+    log_err(ctx,
             "The %s field in the %s action is not an array; "
             "Action definition ignored\n",
             fieldText(field), ActionTypeText(action));
@@ -228,42 +230,40 @@ HandleNoAction(struct xkb_keymap *keymap, union xkb_action *action,
 }
 
 static bool
-CheckLatchLockFlags(struct xkb_keymap *keymap, enum xkb_action_type action,
-                    enum action_field field, const ExprDef *value,
-                    enum xkb_action_flags *flags_inout)
+CheckBooleanFlag(struct xkb_context *ctx, enum xkb_action_type action,
+                 enum action_field field, enum xkb_action_flags flag,
+                 const ExprDef *array_ndx, const ExprDef *value,
+                 enum xkb_action_flags *flags_inout)
 {
-    enum xkb_action_flags tmp;
-    bool result;
+    bool set;
 
-    if (field == ACTION_FIELD_CLEAR_LOCKS)
-        tmp = ACTION_LOCK_CLEAR;
-    else if (field == ACTION_FIELD_LATCH_TO_LOCK)
-        tmp = ACTION_LATCH_TO_LOCK;
-    else
-        return false;           /* WSGO! */
+    if (array_ndx)
+        return ReportActionNotArray(ctx, action, field);
 
-    if (!ExprResolveBoolean(keymap->ctx, value, &result))
-        return ReportMismatch(keymap, action, field, "boolean");
+    if (!ExprResolveBoolean(ctx, value, &set))
+        return ReportMismatch(ctx, action, field, "boolean");
 
-    if (result)
-        *flags_inout |= tmp;
+    if (set)
+        *flags_inout |= flag;
     else
-        *flags_inout &= ~tmp;
+        *flags_inout &= ~flag;
 
     return true;
 }
 
 static bool
 CheckModifierField(struct xkb_keymap *keymap, enum xkb_action_type action,
-                   const ExprDef *value, enum xkb_action_flags *flags_inout,
-                   xkb_mod_mask_t *mods_rtrn)
+                   const ExprDef *array_ndx, const ExprDef *value,
+                   enum xkb_action_flags *flags_inout, xkb_mod_mask_t *mods_rtrn)
 {
+    if (array_ndx)
+        return ReportActionNotArray(keymap->ctx, action, ACTION_FIELD_MODIFIERS);
+
     if (value->expr.op == EXPR_IDENT) {
         const char *valStr;
         valStr = xkb_atom_text(keymap->ctx, value->ident.ident);
         if (valStr && (istreq(valStr, "usemodmapmods") ||
                        istreq(valStr, "modmapmods"))) {
-
             *mods_rtrn = 0;
             *flags_inout |= ACTION_MODS_LOOKUP_MODMAP;
             return true;
@@ -271,76 +271,81 @@ CheckModifierField(struct xkb_keymap *keymap, enum xkb_action_type action,
     }
 
     if (!ExprResolveModMask(keymap, value, MOD_BOTH, mods_rtrn))
-        return ReportMismatch(keymap, action,
+        return ReportMismatch(keymap->ctx, action,
                               ACTION_FIELD_MODIFIERS, "modifier mask");
 
     *flags_inout &= ~ACTION_MODS_LOOKUP_MODMAP;
     return true;
 }
 
+static const LookupEntry lockWhich[] = {
+    { "both", 0 },
+    { "lock", ACTION_LOCK_NO_UNLOCK },
+    { "neither", (ACTION_LOCK_NO_LOCK | ACTION_LOCK_NO_UNLOCK) },
+    { "unlock", ACTION_LOCK_NO_LOCK },
+    { NULL, 0 }
+};
+
 static bool
-HandleSetLatchMods(struct xkb_keymap *keymap, union xkb_action *action,
-                   enum action_field field, const ExprDef *array_ndx,
-                   const ExprDef *value)
+CheckAffectField(struct xkb_context *ctx, enum xkb_action_type action,
+                 const ExprDef *array_ndx, const ExprDef *value,
+                 enum xkb_action_flags *flags_inout)
 {
-    struct xkb_mod_action *act = &action->mods;
+    enum xkb_action_flags flags;
 
-    if (array_ndx) {
-        switch (field) {
-        case ACTION_FIELD_CLEAR_LOCKS:
-        case ACTION_FIELD_LATCH_TO_LOCK:
-        case ACTION_FIELD_MODIFIERS:
-            return ReportActionNotArray(keymap, action->type, field);
-        default:
-            break;
-        }
-    }
+    if (array_ndx)
+        return ReportActionNotArray(ctx, action, ACTION_FIELD_AFFECT);
 
-    switch (field) {
-    case ACTION_FIELD_CLEAR_LOCKS:
-    case ACTION_FIELD_LATCH_TO_LOCK:
-        return CheckLatchLockFlags(keymap, action->type, field, value,
-                                   &act->flags);
-    case ACTION_FIELD_MODIFIERS:
-        return CheckModifierField(keymap, action->type, value,
-                               &act->flags, &act->mods.mods);
-    default:
-        break;
-    }
+    if (!ExprResolveEnum(ctx, value, &flags, lockWhich))
+        return ReportMismatch(ctx, action, ACTION_FIELD_AFFECT,
+                              "lock, unlock, both, neither");
 
-    return ReportIllegal(keymap, action->type, field);
+    *flags_inout &= ~(ACTION_LOCK_NO_LOCK | ACTION_LOCK_NO_UNLOCK);
+    *flags_inout |= flags;
+    return true;
 }
 
 static bool
-HandleLockMods(struct xkb_keymap *keymap, union xkb_action *action,
-               enum action_field field, const ExprDef *array_ndx,
-               const ExprDef *value)
+HandleSetLatchLockMods(struct xkb_keymap *keymap, union xkb_action *action,
+                       enum action_field field, const ExprDef *array_ndx,
+                       const ExprDef *value)
 {
     struct xkb_mod_action *act = &action->mods;
+    const enum xkb_action_type type = action->type;
 
-    if (array_ndx && field == ACTION_FIELD_MODIFIERS)
-        return ReportActionNotArray(keymap, action->type, field);
-
-    switch (field) {
-    case ACTION_FIELD_MODIFIERS:
-        return CheckModifierField(keymap, action->type, value,
+    if (field == ACTION_FIELD_MODIFIERS)
+        return CheckModifierField(keymap, action->type, array_ndx, value,
                                   &act->flags, &act->mods.mods);
-    default:
-        break;
-    }
-
-    return ReportIllegal(keymap, action->type, field);
+    if ((type == ACTION_TYPE_MOD_SET || type == ACTION_TYPE_MOD_LATCH) &&
+        field == ACTION_FIELD_CLEAR_LOCKS)
+        return CheckBooleanFlag(keymap->ctx, action->type, field,
+                                ACTION_LOCK_CLEAR, array_ndx, value,
+                                &act->flags);
+    if (type == ACTION_TYPE_MOD_LATCH &&
+        field == ACTION_FIELD_LATCH_TO_LOCK)
+        return CheckBooleanFlag(keymap->ctx, action->type, field,
+                                ACTION_LATCH_TO_LOCK, array_ndx, value,
+                                &act->flags);
+    if (type == ACTION_TYPE_MOD_LOCK &&
+        field == ACTION_FIELD_AFFECT)
+        return CheckAffectField(keymap->ctx, action->type, array_ndx, value,
+                                &act->flags);
+
+    return ReportIllegal(keymap->ctx, action->type, field);
 }
 
 static bool
-CheckGroupField(struct xkb_keymap *keymap, unsigned action,
-                const ExprDef *value, enum xkb_action_flags *flags_inout,
-                int32_t *group_rtrn)
+CheckGroupField(struct xkb_context *ctx, enum xkb_action_type action,
+                const ExprDef *array_ndx, const ExprDef *value,
+                enum xkb_action_flags *flags_inout, int32_t *group_rtrn)
 {
     const ExprDef *spec;
     xkb_layout_index_t idx;
     enum xkb_action_flags flags = *flags_inout;
 
+    if (array_ndx)
+        return ReportActionNotArray(ctx, action, ACTION_FIELD_GROUP);
+
     if (value->expr.op == EXPR_NEGATE || value->expr.op == EXPR_UNARY_PLUS) {
         flags &= ~ACTION_ABSOLUTE_SWITCH;
         spec = value->unary.child;
@@ -350,8 +355,8 @@ CheckGroupField(struct xkb_keymap *keymap, unsigned action,
         spec = value;
     }
 
-    if (!ExprResolveGroup(keymap->ctx, spec, &idx))
-        return ReportMismatch(keymap, action, ACTION_FIELD_GROUP,
+    if (!ExprResolveGroup(ctx, spec, &idx))
+        return ReportMismatch(ctx, action, ACTION_FIELD_GROUP,
                               "integer (range 1..8)");
 
     /* +n, -n are relative, n is absolute. */
@@ -368,53 +373,28 @@ CheckGroupField(struct xkb_keymap *keymap, unsigned action,
 }
 
 static bool
-HandleSetLatchGroup(struct xkb_keymap *keymap, union xkb_action *action,
-                    enum action_field field, const ExprDef *array_ndx,
-                    const ExprDef *value)
+HandleSetLatchLockGroup(struct xkb_keymap *keymap, union xkb_action *action,
+                        enum action_field field, const ExprDef *array_ndx,
+                        const ExprDef *value)
 {
     struct xkb_group_action *act = &action->group;
-
-    if (array_ndx) {
-        switch (field) {
-        case ACTION_FIELD_CLEAR_LOCKS:
-        case ACTION_FIELD_LATCH_TO_LOCK:
-        case ACTION_FIELD_GROUP:
-            return ReportActionNotArray(keymap, action->type, field);
-        default:
-            break;
-        }
-    }
-
-    switch (field) {
-    case ACTION_FIELD_CLEAR_LOCKS:
-    case ACTION_FIELD_LATCH_TO_LOCK:
-        return CheckLatchLockFlags(keymap, action->type, field, value,
-                                   &act->flags);
-    case ACTION_FIELD_GROUP:
-        return CheckGroupField(keymap, action->type, value,
-                               &act->flags, &act->group);
-    default:
-        break;
-    }
-
-    return ReportIllegal(keymap, action->type, field);
-}
-
-static bool
-HandleLockGroup(struct xkb_keymap *keymap, union xkb_action *action,
-                enum action_field field, const ExprDef *array_ndx,
-                const ExprDef *value)
-{
-    struct xkb_group_action *act = &action->group;
-
-    if (array_ndx && field == ACTION_FIELD_GROUP)
-        return ReportActionNotArray(keymap, action->type, field);
+    const enum xkb_action_type type = action->type;
 
     if (field == ACTION_FIELD_GROUP)
-        return CheckGroupField(keymap, action->type, value,
+        return CheckGroupField(keymap->ctx, action->type, array_ndx, value,
                                &act->flags, &act->group);
-
-    return ReportIllegal(keymap, action->type, field);
+    if ((type == ACTION_TYPE_GROUP_SET || type == ACTION_TYPE_GROUP_LATCH) &&
+        field == ACTION_FIELD_CLEAR_LOCKS)
+        return CheckBooleanFlag(keymap->ctx, action->type, field,
+                                ACTION_LOCK_CLEAR, array_ndx, value,
+                                &act->flags);
+    if (type == ACTION_TYPE_GROUP_LATCH &&
+        field == ACTION_FIELD_LATCH_TO_LOCK)
+        return CheckBooleanFlag(keymap->ctx, action->type, field,
+                                ACTION_LATCH_TO_LOCK, array_ndx, value,
+                                &act->flags);
+
+    return ReportIllegal(keymap->ctx, action->type, field);
 }
 
 static bool
@@ -424,16 +404,16 @@ HandleMovePtr(struct xkb_keymap *keymap, union xkb_action *action,
 {
     struct xkb_pointer_action *act = &action->ptr;
 
-    if (array_ndx && (field == ACTION_FIELD_X || field == ACTION_FIELD_Y))
-        return ReportActionNotArray(keymap, action->type, field);
-
     if (field == ACTION_FIELD_X || field == ACTION_FIELD_Y) {
         int val;
         const bool absolute = (value->expr.op != EXPR_NEGATE &&
                                value->expr.op != EXPR_UNARY_PLUS);
 
+        if (array_ndx)
+            return ReportActionNotArray(keymap->ctx, action->type, field);
+
         if (!ExprResolveInteger(keymap->ctx, value, &val))
-            return ReportMismatch(keymap, action->type, field, "integer");
+            return ReportMismatch(keymap->ctx, action->type, field, "integer");
 
         if (val < INT16_MIN || val > INT16_MAX) {
             log_err(keymap->ctx,
@@ -458,28 +438,13 @@ HandleMovePtr(struct xkb_keymap *keymap, union xkb_action *action,
         return true;
     }
     else if (field == ACTION_FIELD_ACCEL) {
-        bool set;
-
-        if (!ExprResolveBoolean(keymap->ctx, value, &set))
-            return ReportMismatch(keymap, action->type, field, "boolean");
-
-        if (set)
-            act->flags &= ~ACTION_NO_ACCEL;
-        else
-            act->flags |= ACTION_NO_ACCEL;
+        return CheckBooleanFlag(keymap->ctx, action->type, field,
+                                ACTION_ACCEL, array_ndx, value, &act->flags);
     }
 
-    return ReportIllegal(keymap, action->type, field);
+    return ReportIllegal(keymap->ctx, action->type, field);
 }
 
-static const LookupEntry lockWhich[] = {
-    { "both", 0 },
-    { "lock", ACTION_LOCK_NO_UNLOCK },
-    { "neither", (ACTION_LOCK_NO_LOCK | ACTION_LOCK_NO_UNLOCK) },
-    { "unlock", ACTION_LOCK_NO_LOCK },
-    { NULL, 0 }
-};
-
 static bool
 HandlePtrBtn(struct xkb_keymap *keymap, union xkb_action *action,
              enum action_field field, const ExprDef *array_ndx,
@@ -491,10 +456,10 @@ HandlePtrBtn(struct xkb_keymap *keymap, union xkb_action *action,
         int btn;
 
         if (array_ndx)
-            return ReportActionNotArray(keymap, action->type, field);
+            return ReportActionNotArray(keymap->ctx, action->type, field);
 
         if (!ExprResolveButton(keymap->ctx, value, &btn))
-            return ReportMismatch(keymap, action->type, field,
+            return ReportMismatch(keymap->ctx, action->type, field,
                                   "integer (range 1..5)");
 
         if (btn < 0 || btn > 5) {
@@ -509,27 +474,17 @@ HandlePtrBtn(struct xkb_keymap *keymap, union xkb_action *action,
     }
     else if (action->type == ACTION_TYPE_PTR_LOCK &&
              field == ACTION_FIELD_AFFECT) {
-        enum xkb_action_flags val;
-
-        if (array_ndx)
-            return ReportActionNotArray(keymap, action->type, field);
-
-        if (!ExprResolveEnum(keymap->ctx, value, &val, lockWhich))
-            return ReportMismatch(keymap, action->type, field,
-                                  "lock or unlock");
-
-        act->flags &= ~(ACTION_LOCK_NO_LOCK | ACTION_LOCK_NO_UNLOCK);
-        act->flags |= val;
-        return true;
+        return CheckAffectField(keymap->ctx, action->type, array_ndx, value,
+                                &act->flags);
     }
     else if (field == ACTION_FIELD_COUNT) {
         int val;
 
         if (array_ndx)
-            return ReportActionNotArray(keymap, action->type, field);
+            return ReportActionNotArray(keymap->ctx, action->type, field);
 
         if (!ExprResolveInteger(keymap->ctx, value, &val))
-            return ReportMismatch(keymap, action->type, field, "integer");
+            return ReportMismatch(keymap->ctx, action->type, field, "integer");
 
         if (val < 0 || val > 255) {
             log_err(keymap->ctx,
@@ -541,7 +496,8 @@ HandlePtrBtn(struct xkb_keymap *keymap, union xkb_action *action,
         act->count = (uint8_t) val;
         return true;
     }
-    return ReportIllegal(keymap, action->type, field);
+
+    return ReportIllegal(keymap->ctx, action->type, field);
 }
 
 static const LookupEntry ptrDflts[] = {
@@ -562,10 +518,10 @@ HandleSetPtrDflt(struct xkb_keymap *keymap, union xkb_action *action,
         unsigned int val;
 
         if (array_ndx)
-            return ReportActionNotArray(keymap, action->type, field);
+            return ReportActionNotArray(keymap->ctx, action->type, field);
 
         if (!ExprResolveEnum(keymap->ctx, value, &val, ptrDflts))
-            return ReportMismatch(keymap, action->type, field,
+            return ReportMismatch(keymap->ctx, action->type, field,
                                   "pointer component");
         return true;
     }
@@ -574,7 +530,7 @@ HandleSetPtrDflt(struct xkb_keymap *keymap, union xkb_action *action,
         int btn;
 
         if (array_ndx)
-            return ReportActionNotArray(keymap, action->type, field);
+            return ReportActionNotArray(keymap->ctx, action->type, field);
 
         if (value->expr.op == EXPR_NEGATE ||
             value->expr.op == EXPR_UNARY_PLUS) {
@@ -587,7 +543,7 @@ HandleSetPtrDflt(struct xkb_keymap *keymap, union xkb_action *action,
         }
 
         if (!ExprResolveButton(keymap->ctx, button, &btn))
-            return ReportMismatch(keymap, action->type, field,
+            return ReportMismatch(keymap->ctx, action->type, field,
                                   "integer (range 1..5)");
 
         if (btn < 0 || btn > 5) {
@@ -607,7 +563,7 @@ HandleSetPtrDflt(struct xkb_keymap *keymap, union xkb_action *action,
         return true;
     }
 
-    return ReportIllegal(keymap, action->type, field);
+    return ReportIllegal(keymap->ctx, action->type, field);
 }
 
 static bool
@@ -622,7 +578,7 @@ HandleSwitchScreen(struct xkb_keymap *keymap, union xkb_action *action,
         int val;
 
         if (array_ndx)
-            return ReportActionNotArray(keymap, action->type, field);
+            return ReportActionNotArray(keymap->ctx, action->type, field);
 
         if (value->expr.op == EXPR_NEGATE ||
             value->expr.op == EXPR_UNARY_PLUS) {
@@ -635,7 +591,7 @@ HandleSwitchScreen(struct xkb_keymap *keymap, union xkb_action *action,
         }
 
         if (!ExprResolveInteger(keymap->ctx, scrn, &val))
-            return ReportMismatch(keymap, action->type, field,
+            return ReportMismatch(keymap->ctx, action->type, field,
                                   "integer (0..255)");
 
         if (val < 0 || val > 255) {
@@ -649,23 +605,12 @@ HandleSwitchScreen(struct xkb_keymap *keymap, union xkb_action *action,
         return true;
     }
     else if (field == ACTION_FIELD_SAME) {
-        bool set;
-
-        if (array_ndx)
-            return ReportActionNotArray(keymap, action->type, field);
-
-        if (!ExprResolveBoolean(keymap->ctx, value, &set))
-            return ReportMismatch(keymap, action->type, field, "boolean");
-
-        if (set)
-            act->flags &= ~ACTION_SAME_SCREEN;
-        else
-            act->flags |= ACTION_SAME_SCREEN;
-
-        return true;
+        return CheckBooleanFlag(keymap->ctx, action->type, field,
+                                ACTION_SAME_SCREEN, array_ndx, value,
+                                &act->flags);
     }
 
-    return ReportIllegal(keymap, action->type, field);
+    return ReportIllegal(keymap->ctx, action->type, field);
 }
 
 static bool
@@ -676,20 +621,24 @@ HandleSetLockControls(struct xkb_keymap *keymap, union xkb_action *action,
     struct xkb_controls_action *act = &action->ctrls;
 
     if (field == ACTION_FIELD_CONTROLS) {
-        unsigned int mask;
+        enum xkb_action_controls mask;
 
         if (array_ndx)
-            return ReportActionNotArray(keymap, action->type, field);
+            return ReportActionNotArray(keymap->ctx, action->type, field);
 
         if (!ExprResolveMask(keymap->ctx, value, &mask, ctrlMaskNames))
-            return ReportMismatch(keymap, action->type, field,
+            return ReportMismatch(keymap->ctx, action->type, field,
                                   "controls mask");
 
         act->ctrls = mask;
         return true;
     }
+    else if (field == ACTION_FIELD_AFFECT) {
+        return CheckAffectField(keymap->ctx, action->type, array_ndx, value,
+                                &act->flags);
+    }
 
-    return ReportIllegal(keymap, action->type, field);
+    return ReportIllegal(keymap->ctx, action->type, field);
 }
 
 static bool
@@ -702,8 +651,11 @@ HandlePrivate(struct xkb_keymap *keymap, union xkb_action *action,
     if (field == ACTION_FIELD_TYPE) {
         int type;
 
+        if (array_ndx)
+            return ReportActionNotArray(keymap->ctx, action->type, field);
+
         if (!ExprResolveInteger(keymap->ctx, value, &type))
-            return ReportMismatch(keymap, ACTION_TYPE_PRIVATE, field, "integer");
+            return ReportMismatch(keymap->ctx, ACTION_TYPE_PRIVATE, field, "integer");
 
         if (type < 0 || type > 255) {
             log_err(keymap->ctx,
@@ -741,7 +693,7 @@ HandlePrivate(struct xkb_keymap *keymap, union xkb_action *action,
             size_t len;
 
             if (!ExprResolveString(keymap->ctx, value, &val))
-                return ReportMismatch(keymap, action->type, field, "string");
+                return ReportMismatch(keymap->ctx, action->type, field, "string");
 
             str = xkb_atom_text(keymap->ctx, val);
             len = strlen(str);
@@ -774,7 +726,7 @@ HandlePrivate(struct xkb_keymap *keymap, union xkb_action *action,
             }
 
             if (!ExprResolveInteger(keymap->ctx, value, &datum))
-                return ReportMismatch(keymap, act->type, field, "integer");
+                return ReportMismatch(keymap->ctx, act->type, field, "integer");
 
             if (datum < 0 || datum > 255) {
                 log_err(keymap->ctx,
@@ -788,7 +740,7 @@ HandlePrivate(struct xkb_keymap *keymap, union xkb_action *action,
         }
     }
 
-    return ReportIllegal(keymap, ACTION_TYPE_NONE, field);
+    return ReportIllegal(keymap->ctx, ACTION_TYPE_NONE, field);
 }
 
 typedef bool (*actionHandler)(struct xkb_keymap *keymap,
@@ -799,12 +751,12 @@ typedef bool (*actionHandler)(struct xkb_keymap *keymap,
 
 static const actionHandler handleAction[_ACTION_TYPE_NUM_ENTRIES] = {
     [ACTION_TYPE_NONE] = HandleNoAction,
-    [ACTION_TYPE_MOD_SET] = HandleSetLatchMods,
-    [ACTION_TYPE_MOD_LATCH] = HandleSetLatchMods,
-    [ACTION_TYPE_MOD_LOCK] = HandleLockMods,
-    [ACTION_TYPE_GROUP_SET] = HandleSetLatchGroup,
-    [ACTION_TYPE_GROUP_LATCH] = HandleSetLatchGroup,
-    [ACTION_TYPE_GROUP_LOCK] = HandleLockGroup,
+    [ACTION_TYPE_MOD_SET] = HandleSetLatchLockMods,
+    [ACTION_TYPE_MOD_LATCH] = HandleSetLatchLockMods,
+    [ACTION_TYPE_MOD_LOCK] = HandleSetLatchLockMods,
+    [ACTION_TYPE_GROUP_SET] = HandleSetLatchLockGroup,
+    [ACTION_TYPE_GROUP_LATCH] = HandleSetLatchLockGroup,
+    [ACTION_TYPE_GROUP_LOCK] = HandleSetLatchLockGroup,
     [ACTION_TYPE_PTR_MOVE] = HandleMovePtr,
     [ACTION_TYPE_PTR_BUTTON] = HandlePtrBtn,
     [ACTION_TYPE_PTR_LOCK] = HandlePtrBtn,
@@ -895,12 +847,11 @@ HandleActionDef(ExprDef *def, struct xkb_keymap *keymap,
     return true;
 }
 
-
 bool
 SetActionField(struct xkb_keymap *keymap, const char *elem, const char *field,
                ExprDef *array_ndx, ExprDef *value, ActionsInfo *info)
 {
-    unsigned action;
+    enum xkb_action_type action;
     enum action_field action_field;
 
     if (!stringToAction(elem, &action))