1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-05 22:20:24 -08:00

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.
This commit is contained in:
Stefan Kangas 2025-01-17 18:17:35 +01:00
parent efd4fb51ec
commit 91b2b3654f
2 changed files with 36 additions and 28 deletions

View file

@ -8713,10 +8713,10 @@ parse_menu_item (Lisp_Object item, int inmenubar)
/* Create item_properties vector if necessary. */ /* Create item_properties vector if necessary. */
if (NILP (item_properties)) if (NILP (item_properties))
item_properties = make_nil_vector (ITEM_PROPERTY_ENABLE + 1); item_properties = make_nil_vector (ITEM_PROPERTY_MAX + 1);
/* Initialize optional entries. */ /* Initialize optional entries. */
for (i = ITEM_PROPERTY_DEF; i < ITEM_PROPERTY_ENABLE; i++) for (i = ITEM_PROPERTY_DEF; i < ITEM_PROPERTY_MAX; i++)
ASET (item_properties, i, Qnil); ASET (item_properties, i, Qnil);
ASET (item_properties, ITEM_PROPERTY_ENABLE, Qt); ASET (item_properties, ITEM_PROPERTY_ENABLE, Qt);

View file

@ -294,26 +294,31 @@ extern Lisp_Object item_properties;
/* This describes the elements of item_properties. /* This describes the elements of item_properties.
The first element is not a property, it is a pointer to the item properties The first element is not a property, it is a pointer to the item properties
that is saved for GC protection. */ that is saved for GC protection. */
#define ITEM_PROPERTY_ITEM 0 enum item_property_idx
/* The item string. */ {
#define ITEM_PROPERTY_NAME 1 ITEM_PROPERTY_ITEM,
/* Start of initialize to nil */ /* The item string. */
/* The binding: nil, a command or a keymap. */ ITEM_PROPERTY_NAME,
#define ITEM_PROPERTY_DEF 2 /* Start of initialize to nil */
/* The keymap if the binding is a keymap, otherwise nil. */ /* The binding: nil, a command or a keymap. */
#define ITEM_PROPERTY_MAP 3 ITEM_PROPERTY_DEF,
/* Nil, :radio or :toggle. */ /* The keymap if the binding is a keymap, otherwise nil. */
#define ITEM_PROPERTY_TYPE 4 ITEM_PROPERTY_MAP,
/* Nil or a string describing an equivalent key binding. */ /* Nil, :radio or :toggle. */
#define ITEM_PROPERTY_KEYEQ 5 ITEM_PROPERTY_TYPE,
/* Not nil if a selected toggle box or radio button, otherwise nil. */ /* Nil or a string describing an equivalent key binding. */
#define ITEM_PROPERTY_SELECTED 6 ITEM_PROPERTY_KEYEQ,
/* Place for a help string. Not yet used. */ /* Not nil if a selected toggle box or radio button, otherwise nil. */
#define ITEM_PROPERTY_HELP 7 ITEM_PROPERTY_SELECTED,
/* Start of initialize to t */ /* Place for a help string. Not yet used. */
/* Last property. */ ITEM_PROPERTY_HELP,
/* Not nil if item is enabled. */ /* Start of initialize to t */
#define ITEM_PROPERTY_ENABLE 8 /* Last property. */
/* Not nil if item is enabled. */
ITEM_PROPERTY_ENABLE,
/* Keep this equal to the highest member. */
ITEM_PROPERTY_MAX = ITEM_PROPERTY_ENABLE
};
/* This holds a Lisp vector that holds the results of decoding /* This holds a Lisp vector that holds the results of decoding
the keymaps or alist-of-alists that specify a menu. the keymaps or alist-of-alists that specify a menu.
@ -352,9 +357,12 @@ extern int menu_items_used;
excluding those within submenus. */ excluding those within submenus. */
extern int menu_items_n_panes; extern int menu_items_n_panes;
#define MENU_ITEMS_PANE_NAME 1 enum menu_item_pane_idx
#define MENU_ITEMS_PANE_PREFIX 2 {
#define MENU_ITEMS_PANE_LENGTH 3 MENU_ITEMS_PANE_NAME = 1,
MENU_ITEMS_PANE_PREFIX = 2,
MENU_ITEMS_PANE_LENGTH = 3,
};
enum menu_item_idx enum menu_item_idx
{ {
@ -370,9 +378,9 @@ enum menu_item_idx
}; };
enum enum
{ {
KBD_BUFFER_SIZE = 4096 KBD_BUFFER_SIZE = 4096
}; };
extern void unuse_menu_items (void); extern void unuse_menu_items (void);