Commit cead852713aee71c573f8970511fb3eb2c28b3a2

Ran Benita 2012-08-01T22:12:13

Replace more defines with enums Mostly the ones used to track the fields of types/keys/leds which were already defined. 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
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
diff --git a/src/xkbcomp/compat.c b/src/xkbcomp/compat.c
index be58175..c2a91ab 100644
--- a/src/xkbcomp/compat.c
+++ b/src/xkbcomp/compat.c
@@ -29,8 +29,16 @@
 #include "action.h"
 #include "vmod.h"
 
+enum si_field {
+    SI_FIELD_VIRTUAL_MOD    = (1 << 0),
+    SI_FIELD_ACTION         = (1 << 1),
+    SI_FIELD_AUTO_REPEAT    = (1 << 2),
+    SI_FIELD_LOCKING_KEY    = (1 << 3),
+    SI_FIELD_LEVEL_ONE_ONLY = (1 << 4),
+};
+
 typedef struct _SymInterpInfo {
-    unsigned short defined;
+    enum si_field defined;
     unsigned file_id;
     enum merge_mode merge;
     struct list entry;
@@ -38,14 +46,18 @@ typedef struct _SymInterpInfo {
     struct xkb_sym_interpret interp;
 } SymInterpInfo;
 
-#define _SI_VirtualMod   (1 << 0)
-#define _SI_Action       (1 << 1)
-#define _SI_AutoRepeat   (1 << 2)
-#define _SI_LockingKey   (1 << 3)
-#define _SI_LevelOneOnly (1 << 4)
+enum led_field {
+    LED_FIELD_INDEX      = (1 << 0),
+    LED_FIELD_MODS       = (1 << 1),
+    LED_FIELD_GROUPS     = (1 << 2),
+    LED_FIELD_CTRLS      = (1 << 3),
+    LED_FIELD_EXPLICIT   = (1 << 4),
+    LED_FIELD_AUTOMATIC  = (1 << 5),
+    LED_FIELD_DRIVES_KBD = (1 << 6),
+};
 
 typedef struct _LEDInfo {
-    unsigned short defined;
+    enum led_field defined;
     unsigned file_id;
     enum merge_mode merge;
     struct list entry;
@@ -61,14 +73,6 @@ typedef struct _LEDInfo {
     unsigned int ctrls;
 } LEDInfo;
 
-#define _LED_Index      (1 << 0)
-#define _LED_Mods       (1 << 1)
-#define _LED_Groups     (1 << 2)
-#define _LED_Ctrls      (1 << 3)
-#define _LED_Explicit   (1 << 4)
-#define _LED_Automatic  (1 << 5)
-#define _LED_DrivesKbd  (1 << 6)
-
 typedef struct _GroupCompatInfo {
     unsigned file_id;
     enum merge_mode merge;
@@ -247,8 +251,8 @@ FindMatchingInterp(CompatInfo * info, SymInterpInfo * new)
 }
 
 static bool
-UseNewInterpField(unsigned field, SymInterpInfo *old, SymInterpInfo *new,
-                  int verbosity, unsigned *collide)
+UseNewInterpField(enum si_field field, SymInterpInfo *old, SymInterpInfo *new,
+                  int verbosity, enum si_field *collide)
 {
     if (!(old->defined & field))
         return true;
@@ -267,7 +271,7 @@ UseNewInterpField(unsigned field, SymInterpInfo *old, SymInterpInfo *new,
 static bool
 AddInterp(CompatInfo * info, SymInterpInfo * new)
 {
-    unsigned collide;
+    enum si_field collide;
     SymInterpInfo *old;
     struct list entry;
     int verbosity = xkb_get_log_verbosity(info->keymap->ctx);
@@ -288,33 +292,33 @@ AddInterp(CompatInfo * info, SymInterpInfo * new)
             return true;
         }
 
-        if (UseNewInterpField(_SI_VirtualMod, old, new, verbosity,
+        if (UseNewInterpField(SI_FIELD_VIRTUAL_MOD, old, new, verbosity,
                               &collide)) {
             old->interp.virtual_mod = new->interp.virtual_mod;
-            old->defined |= _SI_VirtualMod;
+            old->defined |= SI_FIELD_VIRTUAL_MOD;
         }
-        if (UseNewInterpField(_SI_Action, old, new, verbosity,
+        if (UseNewInterpField(SI_FIELD_ACTION, old, new, verbosity,
                               &collide)) {
             old->interp.act = new->interp.act;
-            old->defined |= _SI_Action;
+            old->defined |= SI_FIELD_ACTION;
         }
-        if (UseNewInterpField(_SI_AutoRepeat, old, new, verbosity,
+        if (UseNewInterpField(SI_FIELD_AUTO_REPEAT, old, new, verbosity,
                               &collide)) {
             old->interp.flags &= ~XkbSI_AutoRepeat;
             old->interp.flags |= (new->interp.flags & XkbSI_AutoRepeat);
-            old->defined |= _SI_AutoRepeat;
+            old->defined |= SI_FIELD_AUTO_REPEAT;
         }
-        if (UseNewInterpField(_SI_LockingKey, old, new, verbosity,
+        if (UseNewInterpField(SI_FIELD_LOCKING_KEY, old, new, verbosity,
                               &collide)) {
             old->interp.flags &= ~XkbSI_LockingKey;
             old->interp.flags |= (new->interp.flags & XkbSI_LockingKey);
-            old->defined |= _SI_LockingKey;
+            old->defined |= SI_FIELD_LOCKING_KEY;
         }
-        if (UseNewInterpField(_SI_LevelOneOnly, old, new, verbosity,
+        if (UseNewInterpField(SI_FIELD_LEVEL_ONE_ONLY, old, new, verbosity,
                               &collide)) {
             old->interp.match &= ~XkbSI_LevelOneOnly;
             old->interp.match |= (new->interp.match & XkbSI_LevelOneOnly);
-            old->defined |= _SI_LevelOneOnly;
+            old->defined |= SI_FIELD_LEVEL_ONE_ONLY;
         }
 
         if (collide) {
@@ -409,8 +413,8 @@ ResolveStateAndPredicate(ExprDef * expr,
 /***====================================================================***/
 
 static bool
-UseNewLEDField(unsigned field, LEDInfo *old, LEDInfo *new,
-               int verbosity, unsigned *collide)
+UseNewLEDField(enum led_field field, LEDInfo *old, LEDInfo *new,
+               int verbosity, enum led_field *collide)
 {
     if (!(old->defined & field))
         return true;
@@ -430,7 +434,7 @@ static bool
 AddIndicatorMap(CompatInfo *info, LEDInfo *new)
 {
     LEDInfo *old;
-    unsigned collide;
+    enum led_field collide;
     struct xkb_context *ctx = info->keymap->ctx;
     int verbosity = xkb_get_log_verbosity(ctx);
 
@@ -460,46 +464,46 @@ AddIndicatorMap(CompatInfo *info, LEDInfo *new)
             }
 
             collide = 0;
-            if (UseNewLEDField(_LED_Index, old, new, verbosity,
+            if (UseNewLEDField(LED_FIELD_INDEX, old, new, verbosity,
                                &collide)) {
                 old->indicator = new->indicator;
-                old->defined |= _LED_Index;
+                old->defined |= LED_FIELD_INDEX;
             }
-            if (UseNewLEDField(_LED_Mods, old, new, verbosity,
+            if (UseNewLEDField(LED_FIELD_MODS, old, new, verbosity,
                                &collide)) {
                 old->which_mods = new->which_mods;
                 old->real_mods = new->real_mods;
                 old->vmods = new->vmods;
-                old->defined |= _LED_Mods;
+                old->defined |= LED_FIELD_MODS;
             }
-            if (UseNewLEDField(_LED_Groups, old, new, verbosity,
+            if (UseNewLEDField(LED_FIELD_GROUPS, old, new, verbosity,
                                &collide)) {
                 old->which_groups = new->which_groups;
                 old->groups = new->groups;
-                old->defined |= _LED_Groups;
+                old->defined |= LED_FIELD_GROUPS;
             }
-            if (UseNewLEDField(_LED_Ctrls, old, new, verbosity,
+            if (UseNewLEDField(LED_FIELD_CTRLS, old, new, verbosity,
                                &collide)) {
                 old->ctrls = new->ctrls;
-                old->defined |= _LED_Ctrls;
+                old->defined |= LED_FIELD_CTRLS;
             }
-            if (UseNewLEDField(_LED_Explicit, old, new, verbosity,
+            if (UseNewLEDField(LED_FIELD_EXPLICIT, old, new, verbosity,
                                &collide)) {
                 old->flags &= ~XkbIM_NoExplicit;
                 old->flags |= (new->flags & XkbIM_NoExplicit);
-                old->defined |= _LED_Explicit;
+                old->defined |= LED_FIELD_EXPLICIT;
             }
-            if (UseNewLEDField(_LED_Automatic, old, new, verbosity,
+            if (UseNewLEDField(LED_FIELD_AUTOMATIC, old, new, verbosity,
                                &collide)) {
                 old->flags &= ~XkbIM_NoAutomatic;
                 old->flags |= (new->flags & XkbIM_NoAutomatic);
-                old->defined |= _LED_Automatic;
+                old->defined |= LED_FIELD_AUTOMATIC;
             }
-            if (UseNewLEDField(_LED_DrivesKbd, old, new, verbosity,
+            if (UseNewLEDField(LED_FIELD_DRIVES_KBD, old, new, verbosity,
                                &collide)) {
                 old->flags &= ~XkbIM_LEDDrivesKB;
                 old->flags |= (new->flags & XkbIM_LEDDrivesKB);
-                old->defined |= _LED_DrivesKbd;
+                old->defined |= LED_FIELD_DRIVES_KBD;
             }
 
             if (collide) {
@@ -642,7 +646,7 @@ SetInterpField(CompatInfo *info, SymInterpInfo *si, const char *field,
         if (!HandleActionDef(value, keymap, &si->interp.act.any, info->act))
             return false;
 
-        si->defined |= _SI_Action;
+        si->defined |= SI_FIELD_ACTION;
     }
     else if (istreq(field, "virtualmodifier") ||
              istreq(field, "virtualmod")) {
@@ -653,7 +657,7 @@ SetInterpField(CompatInfo *info, SymInterpInfo *si, const char *field,
             return ReportSIBadType(info, si, field, "virtual modifier");
 
         si->interp.virtual_mod = ndx;
-        si->defined |= _SI_VirtualMod;
+        si->defined |= SI_FIELD_VIRTUAL_MOD;
     }
     else if (istreq(field, "repeat")) {
         bool set;
@@ -669,7 +673,7 @@ SetInterpField(CompatInfo *info, SymInterpInfo *si, const char *field,
         else
             si->interp.flags &= ~XkbSI_AutoRepeat;
 
-        si->defined |= _SI_AutoRepeat;
+        si->defined |= SI_FIELD_AUTO_REPEAT;
     }
     else if (istreq(field, "locking")) {
         bool set;
@@ -685,7 +689,7 @@ SetInterpField(CompatInfo *info, SymInterpInfo *si, const char *field,
         else
             si->interp.flags &= ~XkbSI_LockingKey;
 
-        si->defined |= _SI_LockingKey;
+        si->defined |= SI_FIELD_LOCKING_KEY;
     }
     else if (istreq(field, "usemodmap") ||
              istreq(field, "usemodmapmods")) {
@@ -702,7 +706,7 @@ SetInterpField(CompatInfo *info, SymInterpInfo *si, const char *field,
         else
             si->interp.match &= ~XkbSI_LevelOneOnly;
 
-        si->defined |= _SI_LevelOneOnly;
+        si->defined |= SI_FIELD_LEVEL_ONE_ONLY;
     }
     else {
         return ReportBadField(keymap, "symbol interpretation", field,
@@ -764,7 +768,7 @@ SetIndicatorMapField(CompatInfo *info, LEDInfo *led,
 
         led->real_mods = mask & 0xff;
         led->vmods = (mask >> 8) & 0xff;
-        led->defined |= _LED_Mods;
+        led->defined |= LED_FIELD_MODS;
     }
     else if (istreq(field, "groups")) {
         unsigned int mask;
@@ -776,7 +780,7 @@ SetIndicatorMapField(CompatInfo *info, LEDInfo *led,
             return ReportIndicatorBadType(info, led, field, "group mask");
 
         led->groups = mask;
-        led->defined |= _LED_Groups;
+        led->defined |= LED_FIELD_GROUPS;
     }
     else if (istreq(field, "controls") || istreq(field, "ctrls")) {
         unsigned int mask;
@@ -789,7 +793,7 @@ SetIndicatorMapField(CompatInfo *info, LEDInfo *led,
                                           "controls mask");
 
         led->ctrls = mask;
-        led->defined |= _LED_Ctrls;
+        led->defined |= LED_FIELD_CTRLS;
     }
     else if (istreq(field, "allowexplicit")) {
         bool set;
@@ -805,7 +809,7 @@ SetIndicatorMapField(CompatInfo *info, LEDInfo *led,
         else
             led->flags |= XkbIM_NoExplicit;
 
-        led->defined |= _LED_Explicit;
+        led->defined |= LED_FIELD_EXPLICIT;
     }
     else if (istreq(field, "whichmodstate") ||
              istreq(field, "whichmodifierstate")) {
@@ -851,7 +855,7 @@ SetIndicatorMapField(CompatInfo *info, LEDInfo *led,
         else
             led->flags &= ~XkbIM_LEDDrivesKB;
 
-        led->defined |= _LED_DrivesKbd;
+        led->defined |= LED_FIELD_DRIVES_KBD;
     }
     else if (istreq(field, "index")) {
         int ndx;
@@ -873,7 +877,7 @@ SetIndicatorMapField(CompatInfo *info, LEDInfo *led,
         }
 
         led->indicator = (xkb_led_index_t) ndx;
-        led->defined |= _LED_Index;
+        led->defined |= LED_FIELD_INDEX;
     }
     else {
         log_err(info->keymap->ctx,
diff --git a/src/xkbcomp/keytypes.c b/src/xkbcomp/keytypes.c
index fc5e578..781681a 100644
--- a/src/xkbcomp/keytypes.c
+++ b/src/xkbcomp/keytypes.c
@@ -37,14 +37,15 @@ typedef struct _PreserveInfo {
     unsigned short preVMods;
 } PreserveInfo;
 
-#define _KT_Name       (1 << 0)
-#define _KT_Mask       (1 << 1)
-#define _KT_Map        (1 << 2)
-#define _KT_Preserve   (1 << 3)
-#define _KT_LevelNames (1 << 4)
+enum type_field {
+    TYPE_FIELD_MASK       = (1 << 0),
+    TYPE_FIELD_MAP        = (1 << 1),
+    TYPE_FIELD_PRESERVE   = (1 << 2),
+    TYPE_FIELD_LEVEL_NAME = (1 << 3),
+};
 
 typedef struct _KeyTypeInfo {
-    unsigned short defined;
+    enum type_field defined;
     unsigned file_id;
     enum merge_mode merge;
     struct list entry;
@@ -723,7 +724,7 @@ SetKeyTypeField(KeyTypesInfo *info, KeyTypeInfo *type,
 
         mods = mask & 0xff; /* core mods */
         vmods = (mask >> 8) & 0xffff; /* xkb virtual mods */
-        if (type->defined & _KT_Mask) {
+        if (type->defined & TYPE_FIELD_MASK) {
             log_warn(info->keymap->ctx,
                      "Multiple modifier mask definitions for key type %s; "
                      "Using %s, ignoring %s\n",
@@ -734,19 +735,19 @@ SetKeyTypeField(KeyTypesInfo *info, KeyTypeInfo *type,
         }
         type->mask = mods;
         type->vmask = vmods;
-        type->defined |= _KT_Mask;
+        type->defined |= TYPE_FIELD_MASK;
         return true;
     }
     else if (istreq(field, "map")) {
-        type->defined |= _KT_Map;
+        type->defined |= TYPE_FIELD_MAP;
         return SetMapEntry(info, type, arrayNdx, value);
     }
     else if (istreq(field, "preserve")) {
-        type->defined |= _KT_Preserve;
+        type->defined |= TYPE_FIELD_PRESERVE;
         return SetPreserve(info, type, arrayNdx, value);
     }
     else if (istreq(field, "levelname") || istreq(field, "level_name")) {
-        type->defined |= _KT_LevelNames;
+        type->defined |= TYPE_FIELD_LEVEL_NAME;
         return SetLevelName(info, type, arrayNdx, value);
     }
 
diff --git a/src/xkbcomp/symbols.c b/src/xkbcomp/symbols.c
index 9c76aa4..8295371 100644
--- a/src/xkbcomp/symbols.c
+++ b/src/xkbcomp/symbols.c
@@ -37,18 +37,22 @@
 typedef darray(xkb_keysym_t) darray_xkb_keysym_t;
 typedef darray(union xkb_action) darray_xkb_action;
 
-#define RepeatYes       1
-#define RepeatNo        0
-#define RepeatUndefined ~((unsigned) 0)
-
-#define _Key_Syms       (1 << 0)
-#define _Key_Acts       (1 << 1)
-#define _Key_Repeat     (1 << 2)
-#define _Key_Behavior   (1 << 3)
-#define _Key_Type_Dflt  (1 << 4)
-#define _Key_Types      (1 << 5)
-#define _Key_GroupInfo  (1 << 6)
-#define _Key_VModMap    (1 << 7)
+enum key_repeat {
+    KEY_REPEAT_YES = 1,
+    KEY_REPEAT_NO = 0,
+    KEY_REPEAT_UNDEFINED = -1
+};
+
+enum key_field {
+    KEY_FIELD_SYMS      = (1 << 0),
+    KEY_FIELD_ACTS      = (1 << 1),
+    KEY_FIELD_REPEAT    = (1 << 2),
+    KEY_FIELD_BEHAVIOR  = (1 << 3),
+    KEY_FIELD_TYPE_DFLT = (1 << 4),
+    KEY_FIELD_TYPES     = (1 << 5),
+    KEY_FIELD_GROUPINFO = (1 << 6),
+    KEY_FIELD_VMODMAP   = (1 << 7),
+};
 
 static inline const char *
 longText(unsigned long val)
@@ -60,7 +64,7 @@ longText(unsigned long val)
 }
 
 typedef struct _KeyInfo {
-    unsigned short defined;
+    enum key_field defined;
     unsigned file_id;
     enum merge_mode merge;
 
@@ -88,7 +92,7 @@ typedef struct _KeyInfo {
     darray_xkb_action acts[XkbNumKbdGroups];
 
     xkb_atom_t types[XkbNumKbdGroups];
-    unsigned repeat;
+    enum key_repeat repeat;
     struct xkb_behavior behavior;
     unsigned short vmodmap;
     xkb_atom_t dfltType;
@@ -125,7 +129,7 @@ InitKeyInfo(KeyInfo *keyi, unsigned file_id)
     keyi->behavior.type = XkbKB_Default;
     keyi->behavior.data = 0;
     keyi->vmodmap = 0;
-    keyi->repeat = RepeatUndefined;
+    keyi->repeat = KEY_REPEAT_UNDEFINED;
     keyi->out_of_range_group_action = 0;
     keyi->out_of_range_group_number = 0;
 }
@@ -487,8 +491,8 @@ out:
 }
 
 static bool
-UseNewKeyField(unsigned field, KeyInfo *old, KeyInfo *new, int verbosity,
-               unsigned *collide)
+UseNewKeyField(enum key_field field, KeyInfo *old, KeyInfo *new,
+               int verbosity, enum key_field *collide)
 {
     if (!(old->defined & field))
         return true;
@@ -509,7 +513,7 @@ static bool
 MergeKeys(SymbolsInfo *info, KeyInfo *into, KeyInfo *from)
 {
     xkb_group_index_t i;
-    unsigned collide = 0;
+    enum key_field collide = 0;
     bool report;
     int verbosity = xkb_get_log_verbosity(info->keymap->ctx);
 
@@ -544,16 +548,16 @@ MergeKeys(SymbolsInfo *info, KeyInfo *into, KeyInfo *from)
                 from->numLevels[i] = 0;
                 from->symsDefined &= ~(1 << i);
                 if (!darray_empty(into->syms[i]))
-                    into->defined |= _Key_Syms;
+                    into->defined |= KEY_FIELD_SYMS;
                 if (!darray_empty(into->acts[i]))
-                    into->defined |= _Key_Acts;
+                    into->defined |= KEY_FIELD_ACTS;
             }
             else {
                 if (report) {
                     if (!darray_empty(into->syms[i]))
-                        collide |= _Key_Syms;
+                        collide |= KEY_FIELD_SYMS;
                     if (!darray_empty(into->acts[i]))
-                        collide |= _Key_Acts;
+                        collide |= KEY_FIELD_ACTS;
                 }
                 MergeKeyGroups(info, into, from, (unsigned) i);
             }
@@ -562,7 +566,7 @@ MergeKeys(SymbolsInfo *info, KeyInfo *into, KeyInfo *from)
             if ((into->types[i] != XKB_ATOM_NONE) && report &&
                 (into->types[i] != from->types[i])) {
                 xkb_atom_t use, ignore;
-                collide |= _Key_Types;
+                collide |= KEY_FIELD_TYPES;
                 if (from->merge != MERGE_AUGMENT) {
                     use = from->types[i];
                     ignore = into->types[i];
@@ -587,26 +591,26 @@ MergeKeys(SymbolsInfo *info, KeyInfo *into, KeyInfo *from)
         }
     }
 
-    if (UseNewKeyField(_Key_Behavior, into, from, verbosity, &collide)) {
+    if (UseNewKeyField(KEY_FIELD_BEHAVIOR, into, from, verbosity, &collide)) {
         into->behavior = from->behavior;
-        into->defined |= _Key_Behavior;
+        into->defined |= KEY_FIELD_BEHAVIOR;
     }
-    if (UseNewKeyField(_Key_VModMap, into, from, verbosity, &collide)) {
+    if (UseNewKeyField(KEY_FIELD_VMODMAP, into, from, verbosity, &collide)) {
         into->vmodmap = from->vmodmap;
-        into->defined |= _Key_VModMap;
+        into->defined |= KEY_FIELD_VMODMAP;
     }
-    if (UseNewKeyField(_Key_Repeat, into, from, verbosity, &collide)) {
+    if (UseNewKeyField(KEY_FIELD_REPEAT, into, from, verbosity, &collide)) {
         into->repeat = from->repeat;
-        into->defined |= _Key_Repeat;
+        into->defined |= KEY_FIELD_REPEAT;
     }
-    if (UseNewKeyField(_Key_Type_Dflt, into, from, verbosity, &collide)) {
+    if (UseNewKeyField(KEY_FIELD_TYPE_DFLT, into, from, verbosity, &collide)) {
         into->dfltType = from->dfltType;
-        into->defined |= _Key_Type_Dflt;
+        into->defined |= KEY_FIELD_TYPE_DFLT;
     }
-    if (UseNewKeyField(_Key_GroupInfo, into, from, verbosity, &collide)) {
+    if (UseNewKeyField(KEY_FIELD_GROUPINFO, into, from, verbosity, &collide)) {
         into->out_of_range_group_action = from->out_of_range_group_action;
         into->out_of_range_group_number = from->out_of_range_group_number;
-        into->defined |= _Key_GroupInfo;
+        into->defined |= KEY_FIELD_GROUPINFO;
     }
 
     if (collide)
@@ -1010,13 +1014,13 @@ static const LookupEntry lockingEntries[] = {
 };
 
 static const LookupEntry repeatEntries[] = {
-    { "true", RepeatYes },
-    { "yes", RepeatYes },
-    { "on", RepeatYes },
-    { "false", RepeatNo },
-    { "no", RepeatNo },
-    { "off", RepeatNo },
-    { "default", RepeatUndefined },
+    { "true", KEY_REPEAT_YES },
+    { "yes", KEY_REPEAT_YES },
+    { "on", KEY_REPEAT_YES },
+    { "false", KEY_REPEAT_NO },
+    { "no", KEY_REPEAT_NO },
+    { "off", KEY_REPEAT_NO },
+    { "default", KEY_REPEAT_UNDEFINED },
     { NULL, 0 }
 };
 
@@ -1038,7 +1042,7 @@ SetSymbolsField(SymbolsInfo *info, KeyInfo *keyi, const char *field,
 
         if (arrayNdx == NULL) {
             keyi->dfltType = xkb_atom_intern(ctx, str);
-            keyi->defined |= _Key_Type_Dflt;
+            keyi->defined |= KEY_FIELD_TYPE_DFLT;
         }
         else if (!ExprResolveGroup(ctx, arrayNdx, &ndx)) {
             log_err(info->keymap->ctx,
@@ -1065,7 +1069,7 @@ SetSymbolsField(SymbolsInfo *info, KeyInfo *keyi, const char *field,
         ok = ExprResolveVModMask(info->keymap, value, &mask);
         if (ok) {
             keyi->vmodmap = (mask >> 8);
-            keyi->defined |= _Key_VModMap;
+            keyi->defined |= KEY_FIELD_VMODMAP;
         }
         else {
             log_err(info->keymap->ctx,
@@ -1082,7 +1086,7 @@ SetSymbolsField(SymbolsInfo *info, KeyInfo *keyi, const char *field,
         ok = ExprResolveEnum(ctx, value, &val, lockingEntries);
         if (ok)
             keyi->behavior.type = val;
-        keyi->defined |= _Key_Behavior;
+        keyi->defined |= KEY_FIELD_BEHAVIOR;
     }
     else if (istreq(field, "radiogroup") ||
              istreq(field, "permanentradiogroup") ||
@@ -1114,7 +1118,7 @@ SetSymbolsField(SymbolsInfo *info, KeyInfo *keyi, const char *field,
             return false;
         }
         keyi->repeat = val;
-        keyi->defined |= _Key_Repeat;
+        keyi->defined |= KEY_FIELD_REPEAT;
     }
     else if (istreq(field, "groupswrap") ||
              istreq(field, "wrapgroups")) {
@@ -1133,7 +1137,7 @@ SetSymbolsField(SymbolsInfo *info, KeyInfo *keyi, const char *field,
         else
             keyi->out_of_range_group_action = XkbClampIntoRange;
 
-        keyi->defined |= _Key_GroupInfo;
+        keyi->defined |= KEY_FIELD_GROUPINFO;
     }
     else if (istreq(field, "groupsclamp") ||
              istreq(field, "clampgroups")) {
@@ -1152,7 +1156,7 @@ SetSymbolsField(SymbolsInfo *info, KeyInfo *keyi, const char *field,
         else
             keyi->out_of_range_group_action = XkbWrapIntoRange;
 
-        keyi->defined |= _Key_GroupInfo;
+        keyi->defined |= KEY_FIELD_GROUPINFO;
     }
     else if (istreq(field, "groupsredirect") ||
              istreq(field, "redirectgroups")) {
@@ -1168,7 +1172,7 @@ SetSymbolsField(SymbolsInfo *info, KeyInfo *keyi, const char *field,
 
         keyi->out_of_range_group_action = XkbRedirectIntoRange;
         keyi->out_of_range_group_number = grp - 1;
-        keyi->defined |= _Key_GroupInfo;
+        keyi->defined |= KEY_FIELD_GROUPINFO;
     }
     else {
         log_err(info->keymap->ctx,
@@ -1810,7 +1814,7 @@ CopySymbolsDef(SymbolsInfo *info, KeyInfo *keyi,
         outActs = NULL;
 
     key->num_groups = nGroups;
-    if (keyi->defined & _Key_GroupInfo) {
+    if (keyi->defined & KEY_FIELD_GROUPINFO) {
         key->out_of_range_group_number = keyi->out_of_range_group_number;
         key->out_of_range_group_action = keyi->out_of_range_group_action;
     }
@@ -1865,12 +1869,12 @@ CopySymbolsDef(SymbolsInfo *info, KeyInfo *keyi,
         key->explicit |= XkbExplicitBehaviorMask;
         break;
     }
-    if (keyi->defined & _Key_VModMap) {
+    if (keyi->defined & KEY_FIELD_VMODMAP) {
         key->vmodmap = keyi->vmodmap;
         key->explicit |= XkbExplicitVModMapMask;
     }
-    if (keyi->repeat != RepeatUndefined) {
-        key->repeats = keyi->repeat == RepeatYes;
+    if (keyi->repeat != KEY_REPEAT_UNDEFINED) {
+        key->repeats = (keyi->repeat == KEY_REPEAT_YES);
         key->explicit |= XkbExplicitAutoRepeatMask;
     }