expr: constify function arguments We need this for later. Signed-off-by: Ran Benita <ran234@gmail.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464
diff --git a/src/xkbcomp/action.c b/src/xkbcomp/action.c
index 602f833..6aaf5d7 100644
--- a/src/xkbcomp/action.c
+++ b/src/xkbcomp/action.c
@@ -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;
diff --git a/src/xkbcomp/expr.c b/src/xkbcomp/expr.c
index 3f2ee89..ffb02e1 100644
--- a/src/xkbcomp/expr.c
+++ b/src/xkbcomp/expr.c
@@ -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;
diff --git a/src/xkbcomp/expr.h b/src/xkbcomp/expr.h
index 75bcb82..1432838 100644
--- a/src/xkbcomp/expr.h
+++ b/src/xkbcomp/expr.h
@@ -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 */