expr: constify function arguments
We need this for later. Signed-off-by: Ran Benita <ran234@gmail.com>master
parent
f2ecd6650a
commit
6f08a2cfa0
|
@ -210,7 +210,7 @@ ReportNotFound(struct xkb_keymap *keymap, unsigned action, unsigned field,
|
|||
|
||||
static bool
|
||||
HandleNoAction(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
||||
unsigned field, ExprDef *array_ndx, ExprDef *value)
|
||||
unsigned field, const ExprDef *array_ndx, const ExprDef *value)
|
||||
|
||||
{
|
||||
return ReportIllegal(keymap, action->type, field);
|
||||
|
@ -218,7 +218,8 @@ HandleNoAction(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
|
||||
static bool
|
||||
CheckLatchLockFlags(struct xkb_keymap *keymap, unsigned action,
|
||||
unsigned field, ExprDef * value, unsigned *flags_inout)
|
||||
unsigned field, const ExprDef * value,
|
||||
unsigned *flags_inout)
|
||||
{
|
||||
unsigned tmp;
|
||||
bool result;
|
||||
|
@ -242,8 +243,9 @@ CheckLatchLockFlags(struct xkb_keymap *keymap, unsigned action,
|
|||
}
|
||||
|
||||
static bool
|
||||
CheckModifierField(struct xkb_keymap *keymap, unsigned action, ExprDef *value,
|
||||
unsigned *flags_inout, xkb_mod_mask_t *mods_rtrn)
|
||||
CheckModifierField(struct xkb_keymap *keymap, unsigned action,
|
||||
const ExprDef *value, unsigned *flags_inout,
|
||||
xkb_mod_mask_t *mods_rtrn)
|
||||
{
|
||||
if (value->op == EXPR_IDENT) {
|
||||
const char *valStr;
|
||||
|
@ -266,7 +268,8 @@ CheckModifierField(struct xkb_keymap *keymap, unsigned action, ExprDef *value,
|
|||
|
||||
static bool
|
||||
HandleSetLatchMods(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
||||
unsigned field, ExprDef *array_ndx, ExprDef *value)
|
||||
unsigned field, const ExprDef *array_ndx,
|
||||
const ExprDef *value)
|
||||
{
|
||||
struct xkb_mod_action *act;
|
||||
unsigned rtrn;
|
||||
|
@ -307,7 +310,7 @@ HandleSetLatchMods(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
|
||||
static bool
|
||||
HandleLockMods(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
||||
unsigned field, ExprDef *array_ndx, ExprDef *value)
|
||||
unsigned field, const ExprDef *array_ndx, const ExprDef *value)
|
||||
{
|
||||
struct xkb_mod_action *act;
|
||||
unsigned t1;
|
||||
|
@ -332,10 +335,10 @@ HandleLockMods(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
|
||||
static bool
|
||||
CheckGroupField(struct xkb_keymap *keymap, unsigned action,
|
||||
ExprDef * value, unsigned *flags_inout,
|
||||
const ExprDef *value, unsigned *flags_inout,
|
||||
xkb_group_index_t *grp_rtrn)
|
||||
{
|
||||
ExprDef *spec;
|
||||
const ExprDef *spec;
|
||||
|
||||
if (value->op == EXPR_NEGATE || value->op == EXPR_UNARY_PLUS) {
|
||||
*flags_inout &= ~XkbSA_GroupAbsolute;
|
||||
|
@ -360,7 +363,8 @@ CheckGroupField(struct xkb_keymap *keymap, unsigned action,
|
|||
|
||||
static bool
|
||||
HandleSetLatchGroup(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
||||
unsigned field, ExprDef *array_ndx, ExprDef *value)
|
||||
unsigned field, const ExprDef *array_ndx,
|
||||
const ExprDef *value)
|
||||
{
|
||||
struct xkb_group_action *act;
|
||||
unsigned rtrn;
|
||||
|
@ -400,7 +404,8 @@ HandleSetLatchGroup(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
|
||||
static bool
|
||||
HandleLockGroup(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
||||
unsigned field, ExprDef *array_ndx, ExprDef *value)
|
||||
unsigned field, const ExprDef *array_ndx,
|
||||
const ExprDef *value)
|
||||
{
|
||||
struct xkb_group_action *act;
|
||||
unsigned t1;
|
||||
|
@ -423,7 +428,7 @@ HandleLockGroup(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
|
||||
static bool
|
||||
HandleMovePtr(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
||||
unsigned field, ExprDef *array_ndx, ExprDef *value)
|
||||
unsigned field, const ExprDef *array_ndx, const ExprDef *value)
|
||||
{
|
||||
struct xkb_pointer_action *act;
|
||||
bool absolute;
|
||||
|
@ -481,7 +486,7 @@ static const LookupEntry lockWhich[] = {
|
|||
|
||||
static bool
|
||||
HandlePtrBtn(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
||||
unsigned field, ExprDef *array_ndx, ExprDef *value)
|
||||
unsigned field, const ExprDef *array_ndx, const ExprDef *value)
|
||||
{
|
||||
struct xkb_pointer_button_action *act;
|
||||
|
||||
|
@ -552,7 +557,8 @@ static const LookupEntry ptrDflts[] = {
|
|||
|
||||
static bool
|
||||
HandleSetPtrDflt(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
||||
unsigned field, ExprDef *array_ndx, ExprDef *value)
|
||||
unsigned field, const ExprDef *array_ndx,
|
||||
const ExprDef *value)
|
||||
{
|
||||
struct xkb_pointer_default_action *act;
|
||||
|
||||
|
@ -570,7 +576,7 @@ HandleSetPtrDflt(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
return true;
|
||||
}
|
||||
else if ((field == F_Button) || (field == F_Value)) {
|
||||
ExprDef *button;
|
||||
const ExprDef *button;
|
||||
int btn;
|
||||
|
||||
if (array_ndx)
|
||||
|
@ -625,7 +631,7 @@ static const LookupEntry isoNames[] = {
|
|||
|
||||
static bool
|
||||
HandleISOLock(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
||||
unsigned field, ExprDef *array_ndx, ExprDef *value)
|
||||
unsigned field, const ExprDef *array_ndx, const ExprDef *value)
|
||||
{
|
||||
struct xkb_iso_action *act;
|
||||
|
||||
|
@ -679,13 +685,14 @@ HandleISOLock(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
|
||||
static bool
|
||||
HandleSwitchScreen(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
||||
unsigned field, ExprDef *array_ndx, ExprDef *value)
|
||||
unsigned field, const ExprDef *array_ndx,
|
||||
const ExprDef *value)
|
||||
{
|
||||
struct xkb_switch_screen_action *act;
|
||||
|
||||
act = (struct xkb_switch_screen_action *) action;
|
||||
if (field == F_Screen) {
|
||||
ExprDef *scrn;
|
||||
const ExprDef *scrn;
|
||||
int val;
|
||||
|
||||
if (array_ndx)
|
||||
|
@ -758,8 +765,8 @@ const LookupEntry ctrlNames[] = {
|
|||
static bool
|
||||
HandleSetLockControls(struct xkb_keymap *keymap,
|
||||
struct xkb_any_action *action,
|
||||
unsigned field, ExprDef *array_ndx,
|
||||
ExprDef *value)
|
||||
unsigned field, const ExprDef *array_ndx,
|
||||
const ExprDef *value)
|
||||
{
|
||||
struct xkb_controls_action *act;
|
||||
|
||||
|
@ -793,7 +800,8 @@ static const LookupEntry evNames[] = {
|
|||
|
||||
static bool
|
||||
HandleActionMessage(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
||||
unsigned field, ExprDef *array_ndx, ExprDef *value)
|
||||
unsigned field, const ExprDef *array_ndx,
|
||||
const ExprDef *value)
|
||||
{
|
||||
struct xkb_message_action *act;
|
||||
|
||||
|
@ -882,7 +890,8 @@ HandleActionMessage(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
|
||||
static bool
|
||||
HandleRedirectKey(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
||||
unsigned field, ExprDef *array_ndx, ExprDef *value)
|
||||
unsigned field, const ExprDef *array_ndx,
|
||||
const ExprDef *value)
|
||||
{
|
||||
struct xkb_key *key;
|
||||
struct xkb_redirect_key_action *act;
|
||||
|
@ -933,7 +942,8 @@ HandleRedirectKey(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
|
||||
static bool
|
||||
HandleDeviceBtn(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
||||
unsigned field, ExprDef *array_ndx, ExprDef *value)
|
||||
unsigned field, const ExprDef *array_ndx,
|
||||
const ExprDef *value)
|
||||
{
|
||||
struct xkb_device_button_action *act;
|
||||
|
||||
|
@ -1018,7 +1028,8 @@ HandleDeviceBtn(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
|
||||
static bool
|
||||
HandleDeviceValuator(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
||||
unsigned field, ExprDef *array_ndx, ExprDef *value)
|
||||
unsigned field, const ExprDef *array_ndx,
|
||||
const ExprDef *value)
|
||||
{
|
||||
#if 0
|
||||
ExprResult rtrn;
|
||||
|
@ -1032,7 +1043,7 @@ HandleDeviceValuator(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
|
||||
static bool
|
||||
HandlePrivate(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
||||
unsigned field, ExprDef *array_ndx, ExprDef *value)
|
||||
unsigned field, const ExprDef *array_ndx, const ExprDef *value)
|
||||
{
|
||||
if (field == F_Type) {
|
||||
int type;
|
||||
|
@ -1107,7 +1118,7 @@ HandlePrivate(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
|||
|
||||
typedef bool (*actionHandler)(struct xkb_keymap *keymap,
|
||||
struct xkb_any_action *action, unsigned field,
|
||||
ExprDef *array_ndx, ExprDef *value);
|
||||
const ExprDef *array_ndx, const ExprDef *value);
|
||||
|
||||
static const actionHandler handleAction[XkbSA_NumActions + 1] = {
|
||||
[XkbSA_NoAction] = HandleNoAction,
|
||||
|
@ -1197,7 +1208,8 @@ HandleActionDef(ExprDef * def,
|
|||
}
|
||||
for (arg = def->value.action.args; arg != NULL;
|
||||
arg = (ExprDef *) arg->common.next) {
|
||||
ExprDef *field, *value, *arrayRtrn;
|
||||
const ExprDef *value;
|
||||
ExprDef *field, *arrayRtrn;
|
||||
const char *elemRtrn, *fieldRtrn;
|
||||
unsigned fieldNdx;
|
||||
|
||||
|
|
|
@ -123,8 +123,9 @@ exprValueTypeText(enum expr_value_type type)
|
|||
}
|
||||
|
||||
bool
|
||||
ExprResolveLhs(struct xkb_context *ctx, ExprDef *expr, const char **elem_rtrn,
|
||||
const char **field_rtrn, ExprDef **index_rtrn)
|
||||
ExprResolveLhs(struct xkb_context *ctx, const ExprDef *expr,
|
||||
const char **elem_rtrn, const char **field_rtrn,
|
||||
ExprDef **index_rtrn)
|
||||
{
|
||||
switch (expr->op) {
|
||||
case EXPR_IDENT:
|
||||
|
@ -210,7 +211,8 @@ LookupModMask(struct xkb_context *ctx, const void *priv, xkb_atom_t field,
|
|||
}
|
||||
|
||||
bool
|
||||
ExprResolveBoolean(struct xkb_context *ctx, ExprDef *expr, bool *set_rtrn)
|
||||
ExprResolveBoolean(struct xkb_context *ctx, const ExprDef *expr,
|
||||
bool *set_rtrn)
|
||||
{
|
||||
bool ok = false;
|
||||
const char *ident;
|
||||
|
@ -278,7 +280,8 @@ ExprResolveBoolean(struct xkb_context *ctx, ExprDef *expr, bool *set_rtrn)
|
|||
}
|
||||
|
||||
bool
|
||||
ExprResolveKeyCode(struct xkb_context *ctx, ExprDef *expr, xkb_keycode_t *kc)
|
||||
ExprResolveKeyCode(struct xkb_context *ctx, const ExprDef *expr,
|
||||
xkb_keycode_t *kc)
|
||||
{
|
||||
xkb_keycode_t leftRtrn, rightRtrn;
|
||||
ExprDef *left, *right;
|
||||
|
@ -362,7 +365,7 @@ ExprResolveKeyCode(struct xkb_context *ctx, ExprDef *expr, xkb_keycode_t *kc)
|
|||
* Cool.
|
||||
*/
|
||||
static bool
|
||||
ExprResolveIntegerLookup(struct xkb_context *ctx, ExprDef *expr,
|
||||
ExprResolveIntegerLookup(struct xkb_context *ctx, const ExprDef *expr,
|
||||
int *val_rtrn, IdentLookupFunc lookup,
|
||||
const void *lookupPriv)
|
||||
{
|
||||
|
@ -465,13 +468,14 @@ ExprResolveIntegerLookup(struct xkb_context *ctx, ExprDef *expr,
|
|||
}
|
||||
|
||||
bool
|
||||
ExprResolveInteger(struct xkb_context *ctx, ExprDef *expr, int *val_rtrn)
|
||||
ExprResolveInteger(struct xkb_context *ctx, const ExprDef *expr,
|
||||
int *val_rtrn)
|
||||
{
|
||||
return ExprResolveIntegerLookup(ctx, expr, val_rtrn, NULL, NULL);
|
||||
}
|
||||
|
||||
bool
|
||||
ExprResolveGroup(struct xkb_context *ctx, ExprDef *expr,
|
||||
ExprResolveGroup(struct xkb_context *ctx, const ExprDef *expr,
|
||||
xkb_group_index_t *group_rtrn)
|
||||
{
|
||||
bool ok;
|
||||
|
@ -504,7 +508,7 @@ ExprResolveGroup(struct xkb_context *ctx, ExprDef *expr,
|
|||
}
|
||||
|
||||
bool
|
||||
ExprResolveLevel(struct xkb_context *ctx, ExprDef *expr,
|
||||
ExprResolveLevel(struct xkb_context *ctx, const ExprDef *expr,
|
||||
unsigned int *level_rtrn)
|
||||
{
|
||||
bool ok;
|
||||
|
@ -537,7 +541,7 @@ ExprResolveLevel(struct xkb_context *ctx, ExprDef *expr,
|
|||
}
|
||||
|
||||
bool
|
||||
ExprResolveButton(struct xkb_context *ctx, ExprDef *expr, int *btn_rtrn)
|
||||
ExprResolveButton(struct xkb_context *ctx, const ExprDef *expr, int *btn_rtrn)
|
||||
{
|
||||
int result;
|
||||
static const LookupEntry button_names[] = {
|
||||
|
@ -559,7 +563,7 @@ ExprResolveButton(struct xkb_context *ctx, ExprDef *expr, int *btn_rtrn)
|
|||
}
|
||||
|
||||
bool
|
||||
ExprResolveString(struct xkb_context *ctx, ExprDef *expr,
|
||||
ExprResolveString(struct xkb_context *ctx, const ExprDef *expr,
|
||||
const char **val_rtrn)
|
||||
{
|
||||
switch (expr->op) {
|
||||
|
@ -604,7 +608,7 @@ ExprResolveString(struct xkb_context *ctx, ExprDef *expr,
|
|||
}
|
||||
|
||||
bool
|
||||
ExprResolveKeyName(struct xkb_context *ctx, ExprDef *expr,
|
||||
ExprResolveKeyName(struct xkb_context *ctx, const ExprDef *expr,
|
||||
char name[XkbKeyNameLength])
|
||||
{
|
||||
switch (expr->op) {
|
||||
|
@ -649,7 +653,7 @@ ExprResolveKeyName(struct xkb_context *ctx, ExprDef *expr,
|
|||
}
|
||||
|
||||
bool
|
||||
ExprResolveEnum(struct xkb_context *ctx, ExprDef *expr,
|
||||
ExprResolveEnum(struct xkb_context *ctx, const ExprDef *expr,
|
||||
unsigned int *val_rtrn, const LookupEntry *values)
|
||||
{
|
||||
if (expr->op != EXPR_IDENT) {
|
||||
|
@ -674,7 +678,7 @@ ExprResolveEnum(struct xkb_context *ctx, ExprDef *expr,
|
|||
}
|
||||
|
||||
static bool
|
||||
ExprResolveMaskLookup(struct xkb_context *ctx, ExprDef *expr,
|
||||
ExprResolveMaskLookup(struct xkb_context *ctx, const ExprDef *expr,
|
||||
unsigned int *val_rtrn, IdentLookupFunc lookup,
|
||||
const void *lookupPriv)
|
||||
{
|
||||
|
@ -778,21 +782,21 @@ ExprResolveMaskLookup(struct xkb_context *ctx, ExprDef *expr,
|
|||
}
|
||||
|
||||
bool
|
||||
ExprResolveMask(struct xkb_context *ctx, ExprDef *expr,
|
||||
ExprResolveMask(struct xkb_context *ctx, const ExprDef *expr,
|
||||
unsigned int *mask_rtrn, const LookupEntry *values)
|
||||
{
|
||||
return ExprResolveMaskLookup(ctx, expr, mask_rtrn, SimpleLookup, values);
|
||||
}
|
||||
|
||||
bool
|
||||
ExprResolveModMask(struct xkb_context *ctx, ExprDef *expr,
|
||||
ExprResolveModMask(struct xkb_context *ctx, const ExprDef *expr,
|
||||
xkb_mod_mask_t *mask_rtrn)
|
||||
{
|
||||
return ExprResolveMaskLookup(ctx, expr, mask_rtrn, LookupModMask, NULL);
|
||||
}
|
||||
|
||||
bool
|
||||
ExprResolveVModMask(struct xkb_keymap *keymap, ExprDef *expr,
|
||||
ExprResolveVModMask(struct xkb_keymap *keymap, const ExprDef *expr,
|
||||
xkb_mod_mask_t *mask_rtrn)
|
||||
{
|
||||
return ExprResolveMaskLookup(keymap->ctx, expr, mask_rtrn, LookupVModMask,
|
||||
|
@ -800,7 +804,7 @@ ExprResolveVModMask(struct xkb_keymap *keymap, ExprDef *expr,
|
|||
}
|
||||
|
||||
bool
|
||||
ExprResolveKeySym(struct xkb_context *ctx, ExprDef *expr,
|
||||
ExprResolveKeySym(struct xkb_context *ctx, const ExprDef *expr,
|
||||
xkb_keysym_t *sym_rtrn)
|
||||
{
|
||||
int val;
|
||||
|
|
|
@ -38,8 +38,9 @@ extern const char *
|
|||
exprOpText(enum expr_op_type op);
|
||||
|
||||
bool
|
||||
ExprResolveLhs(struct xkb_context *ctx, ExprDef *expr, const char **elem_rtrn,
|
||||
const char **field_rtrn, ExprDef **index_rtrn);
|
||||
ExprResolveLhs(struct xkb_context *ctx, const ExprDef *expr,
|
||||
const char **elem_rtrn, const char **field_rtrn,
|
||||
ExprDef **index_rtrn);
|
||||
|
||||
bool
|
||||
LookupModMask(struct xkb_context *ctx, const void *priv, xkb_atom_t field,
|
||||
|
@ -54,51 +55,55 @@ LookupModIndex(struct xkb_context *ctx, const void *priv, xkb_atom_t field,
|
|||
enum expr_value_type type, xkb_mod_index_t *val_rtrn);
|
||||
|
||||
bool
|
||||
ExprResolveModMask(struct xkb_context *ctx, ExprDef *expr,
|
||||
ExprResolveModMask(struct xkb_context *ctx, const ExprDef *expr,
|
||||
xkb_mod_mask_t *mask_rtrn);
|
||||
|
||||
bool
|
||||
ExprResolveVModMask(struct xkb_keymap *keymap, ExprDef *expr,
|
||||
ExprResolveVModMask(struct xkb_keymap *keymap, const ExprDef *expr,
|
||||
xkb_mod_mask_t *mask_rtrn);
|
||||
|
||||
bool
|
||||
ExprResolveBoolean(struct xkb_context *ctx, ExprDef *expr, bool *set_rtrn);
|
||||
ExprResolveBoolean(struct xkb_context *ctx, const ExprDef *expr,
|
||||
bool *set_rtrn);
|
||||
|
||||
bool
|
||||
ExprResolveKeyCode(struct xkb_context *ctx, ExprDef *expr, xkb_keycode_t *kc);
|
||||
ExprResolveKeyCode(struct xkb_context *ctx, const ExprDef *expr,
|
||||
xkb_keycode_t *kc);
|
||||
|
||||
bool
|
||||
ExprResolveInteger(struct xkb_context *ctx, ExprDef *expr, int *val_rtrn);
|
||||
ExprResolveInteger(struct xkb_context *ctx, const ExprDef *expr,
|
||||
int *val_rtrn);
|
||||
|
||||
bool
|
||||
ExprResolveLevel(struct xkb_context *ctx, ExprDef *expr,
|
||||
ExprResolveLevel(struct xkb_context *ctx, const ExprDef *expr,
|
||||
unsigned int *level_rtrn);
|
||||
|
||||
bool
|
||||
ExprResolveGroup(struct xkb_context *ctx, ExprDef *expr,
|
||||
ExprResolveGroup(struct xkb_context *ctx, const ExprDef *expr,
|
||||
xkb_group_index_t *group_rtrn);
|
||||
|
||||
bool
|
||||
ExprResolveButton(struct xkb_context *ctx, ExprDef *expr, int *btn_rtrn);
|
||||
ExprResolveButton(struct xkb_context *ctx, const ExprDef *expr,
|
||||
int *btn_rtrn);
|
||||
|
||||
bool
|
||||
ExprResolveString(struct xkb_context *ctx, ExprDef *expr,
|
||||
ExprResolveString(struct xkb_context *ctx, const ExprDef *expr,
|
||||
const char **val_rtrn);
|
||||
|
||||
bool
|
||||
ExprResolveKeyName(struct xkb_context *ctx, ExprDef *expr,
|
||||
ExprResolveKeyName(struct xkb_context *ctx, const ExprDef *expr,
|
||||
char name[XkbKeyNameLength]);
|
||||
|
||||
bool
|
||||
ExprResolveEnum(struct xkb_context *ctx, ExprDef *expr,
|
||||
ExprResolveEnum(struct xkb_context *ctx, const ExprDef *expr,
|
||||
unsigned int *val_rtrn, const LookupEntry *values);
|
||||
|
||||
bool
|
||||
ExprResolveMask(struct xkb_context *ctx, ExprDef *expr,
|
||||
ExprResolveMask(struct xkb_context *ctx, const ExprDef *expr,
|
||||
unsigned int *mask_rtrn, const LookupEntry *values);
|
||||
|
||||
bool
|
||||
ExprResolveKeySym(struct xkb_context *ctx, ExprDef *expr,
|
||||
ExprResolveKeySym(struct xkb_context *ctx, const ExprDef *expr,
|
||||
xkb_keysym_t *sym_rtrn);
|
||||
|
||||
#endif /* EXPR_H */
|
||||
|
|
Loading…
Reference in New Issue