diff options
| author | Stefan Kangas | 2025-01-17 18:17:35 +0100 |
|---|---|---|
| committer | Stefan Kangas | 2025-01-17 18:17:35 +0100 |
| commit | 91b2b3654f2dcf79c15a11cfe1130df6638b4a4e (patch) | |
| tree | 82db2ff1dd169f42b2a9b858088e0151bfe656f3 /src | |
| parent | efd4fb51ec96b8ce8956fff2406de7a498ee6278 (diff) | |
| download | emacs-91b2b3654f2dcf79c15a11cfe1130df6638b4a4e.tar.gz emacs-91b2b3654f2dcf79c15a11cfe1130df6638b4a4e.zip | |
Turn macros into enums in keyboard.h
* src/keyboard.h (item_property_idx, menu_item_pane_idx): Turn macros
into enums.
(ITEM_PROPERTY_MAX): New constant.
* src/keyboard.c (parse_menu_item): Use above new constant.
Diffstat (limited to 'src')
| -rw-r--r-- | src/keyboard.c | 4 | ||||
| -rw-r--r-- | src/keyboard.h | 60 |
2 files changed, 36 insertions, 28 deletions
diff --git a/src/keyboard.c b/src/keyboard.c index f36243dd442..c17210db8b8 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -8713,10 +8713,10 @@ parse_menu_item (Lisp_Object item, int inmenubar) | |||
| 8713 | 8713 | ||
| 8714 | /* Create item_properties vector if necessary. */ | 8714 | /* Create item_properties vector if necessary. */ |
| 8715 | if (NILP (item_properties)) | 8715 | if (NILP (item_properties)) |
| 8716 | item_properties = make_nil_vector (ITEM_PROPERTY_ENABLE + 1); | 8716 | item_properties = make_nil_vector (ITEM_PROPERTY_MAX + 1); |
| 8717 | 8717 | ||
| 8718 | /* Initialize optional entries. */ | 8718 | /* Initialize optional entries. */ |
| 8719 | for (i = ITEM_PROPERTY_DEF; i < ITEM_PROPERTY_ENABLE; i++) | 8719 | for (i = ITEM_PROPERTY_DEF; i < ITEM_PROPERTY_MAX; i++) |
| 8720 | ASET (item_properties, i, Qnil); | 8720 | ASET (item_properties, i, Qnil); |
| 8721 | ASET (item_properties, ITEM_PROPERTY_ENABLE, Qt); | 8721 | ASET (item_properties, ITEM_PROPERTY_ENABLE, Qt); |
| 8722 | 8722 | ||
diff --git a/src/keyboard.h b/src/keyboard.h index c1bb966d485..5e04b54eb74 100644 --- a/src/keyboard.h +++ b/src/keyboard.h | |||
| @@ -294,26 +294,31 @@ extern Lisp_Object item_properties; | |||
| 294 | /* This describes the elements of item_properties. | 294 | /* This describes the elements of item_properties. |
| 295 | The first element is not a property, it is a pointer to the item properties | 295 | The first element is not a property, it is a pointer to the item properties |
| 296 | that is saved for GC protection. */ | 296 | that is saved for GC protection. */ |
| 297 | #define ITEM_PROPERTY_ITEM 0 | 297 | enum item_property_idx |
| 298 | /* The item string. */ | 298 | { |
| 299 | #define ITEM_PROPERTY_NAME 1 | 299 | ITEM_PROPERTY_ITEM, |
| 300 | /* Start of initialize to nil */ | 300 | /* The item string. */ |
| 301 | /* The binding: nil, a command or a keymap. */ | 301 | ITEM_PROPERTY_NAME, |
| 302 | #define ITEM_PROPERTY_DEF 2 | 302 | /* Start of initialize to nil */ |
| 303 | /* The keymap if the binding is a keymap, otherwise nil. */ | 303 | /* The binding: nil, a command or a keymap. */ |
| 304 | #define ITEM_PROPERTY_MAP 3 | 304 | ITEM_PROPERTY_DEF, |
| 305 | /* Nil, :radio or :toggle. */ | 305 | /* The keymap if the binding is a keymap, otherwise nil. */ |
| 306 | #define ITEM_PROPERTY_TYPE 4 | 306 | ITEM_PROPERTY_MAP, |
| 307 | /* Nil or a string describing an equivalent key binding. */ | 307 | /* Nil, :radio or :toggle. */ |
| 308 | #define ITEM_PROPERTY_KEYEQ 5 | 308 | ITEM_PROPERTY_TYPE, |
| 309 | /* Not nil if a selected toggle box or radio button, otherwise nil. */ | 309 | /* Nil or a string describing an equivalent key binding. */ |
| 310 | #define ITEM_PROPERTY_SELECTED 6 | 310 | ITEM_PROPERTY_KEYEQ, |
| 311 | /* Place for a help string. Not yet used. */ | 311 | /* Not nil if a selected toggle box or radio button, otherwise nil. */ |
| 312 | #define ITEM_PROPERTY_HELP 7 | 312 | ITEM_PROPERTY_SELECTED, |
| 313 | /* Start of initialize to t */ | 313 | /* Place for a help string. Not yet used. */ |
| 314 | /* Last property. */ | 314 | ITEM_PROPERTY_HELP, |
| 315 | /* Not nil if item is enabled. */ | 315 | /* Start of initialize to t */ |
| 316 | #define ITEM_PROPERTY_ENABLE 8 | 316 | /* Last property. */ |
| 317 | /* Not nil if item is enabled. */ | ||
| 318 | ITEM_PROPERTY_ENABLE, | ||
| 319 | /* Keep this equal to the highest member. */ | ||
| 320 | ITEM_PROPERTY_MAX = ITEM_PROPERTY_ENABLE | ||
| 321 | }; | ||
| 317 | 322 | ||
| 318 | /* This holds a Lisp vector that holds the results of decoding | 323 | /* This holds a Lisp vector that holds the results of decoding |
| 319 | the keymaps or alist-of-alists that specify a menu. | 324 | the keymaps or alist-of-alists that specify a menu. |
| @@ -352,9 +357,12 @@ extern int menu_items_used; | |||
| 352 | excluding those within submenus. */ | 357 | excluding those within submenus. */ |
| 353 | extern int menu_items_n_panes; | 358 | extern int menu_items_n_panes; |
| 354 | 359 | ||
| 355 | #define MENU_ITEMS_PANE_NAME 1 | 360 | enum menu_item_pane_idx |
| 356 | #define MENU_ITEMS_PANE_PREFIX 2 | 361 | { |
| 357 | #define MENU_ITEMS_PANE_LENGTH 3 | 362 | MENU_ITEMS_PANE_NAME = 1, |
| 363 | MENU_ITEMS_PANE_PREFIX = 2, | ||
| 364 | MENU_ITEMS_PANE_LENGTH = 3, | ||
| 365 | }; | ||
| 358 | 366 | ||
| 359 | enum menu_item_idx | 367 | enum menu_item_idx |
| 360 | { | 368 | { |
| @@ -370,9 +378,9 @@ enum menu_item_idx | |||
| 370 | }; | 378 | }; |
| 371 | 379 | ||
| 372 | enum | 380 | enum |
| 373 | { | 381 | { |
| 374 | KBD_BUFFER_SIZE = 4096 | 382 | KBD_BUFFER_SIZE = 4096 |
| 375 | }; | 383 | }; |
| 376 | 384 | ||
| 377 | extern void unuse_menu_items (void); | 385 | extern void unuse_menu_items (void); |
| 378 | 386 | ||