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. */
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. */
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, ITEM_PROPERTY_ENABLE, Qt);

View file

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