forked from aniani/vim
patch 7.4.1210
Problem: Using old style function declarations. Solution: Change to new style function declarations. (script by Hirohito Higashi)
This commit is contained in:
191
src/menu.c
191
src/menu.c
@@ -86,8 +86,8 @@ static const char *toolbar_names[] =
|
||||
* Do the :menu command and relatives.
|
||||
*/
|
||||
void
|
||||
ex_menu(eap)
|
||||
exarg_T *eap; /* Ex command arguments */
|
||||
ex_menu(
|
||||
exarg_T *eap) /* Ex command arguments */
|
||||
{
|
||||
char_u *menu_path;
|
||||
int modes;
|
||||
@@ -410,19 +410,16 @@ theend:
|
||||
* Add the menu with the given name to the menu hierarchy
|
||||
*/
|
||||
static int
|
||||
add_menu_path(menu_path, menuarg, pri_tab, call_data
|
||||
#ifdef FEAT_GUI_W32
|
||||
, addtearoff
|
||||
#endif
|
||||
)
|
||||
char_u *menu_path;
|
||||
vimmenu_T *menuarg; /* passes modes, iconfile, iconidx,
|
||||
add_menu_path(
|
||||
char_u *menu_path,
|
||||
vimmenu_T *menuarg, /* passes modes, iconfile, iconidx,
|
||||
icon_builtin, silent[0], noremap[0] */
|
||||
int *pri_tab;
|
||||
char_u *call_data;
|
||||
int *pri_tab,
|
||||
char_u *call_data
|
||||
#ifdef FEAT_GUI_W32
|
||||
int addtearoff; /* may add tearoff item */
|
||||
, int addtearoff /* may add tearoff item */
|
||||
#endif
|
||||
)
|
||||
{
|
||||
char_u *path_name;
|
||||
int modes = menuarg->modes;
|
||||
@@ -807,11 +804,11 @@ erret:
|
||||
* Called recursively.
|
||||
*/
|
||||
static int
|
||||
menu_nable_recurse(menu, name, modes, enable)
|
||||
vimmenu_T *menu;
|
||||
char_u *name;
|
||||
int modes;
|
||||
int enable;
|
||||
menu_nable_recurse(
|
||||
vimmenu_T *menu,
|
||||
char_u *name,
|
||||
int modes,
|
||||
int enable)
|
||||
{
|
||||
char_u *p;
|
||||
|
||||
@@ -872,11 +869,11 @@ menu_nable_recurse(menu, name, modes, enable)
|
||||
* Called recursively.
|
||||
*/
|
||||
static int
|
||||
remove_menu(menup, name, modes, silent)
|
||||
vimmenu_T **menup;
|
||||
char_u *name;
|
||||
int modes;
|
||||
int silent; /* don't give error messages */
|
||||
remove_menu(
|
||||
vimmenu_T **menup,
|
||||
char_u *name,
|
||||
int modes,
|
||||
int silent) /* don't give error messages */
|
||||
{
|
||||
vimmenu_T *menu;
|
||||
vimmenu_T *child;
|
||||
@@ -992,8 +989,7 @@ remove_menu(menup, name, modes, silent)
|
||||
* Free the given menu structure and remove it from the linked list.
|
||||
*/
|
||||
static void
|
||||
free_menu(menup)
|
||||
vimmenu_T **menup;
|
||||
free_menu(vimmenu_T **menup)
|
||||
{
|
||||
int i;
|
||||
vimmenu_T *menu;
|
||||
@@ -1037,9 +1033,7 @@ free_menu(menup)
|
||||
* Free the menu->string with the given index.
|
||||
*/
|
||||
static void
|
||||
free_menu_string(menu, idx)
|
||||
vimmenu_T *menu;
|
||||
int idx;
|
||||
free_menu_string(vimmenu_T *menu, int idx)
|
||||
{
|
||||
int count = 0;
|
||||
int i;
|
||||
@@ -1056,9 +1050,7 @@ free_menu_string(menu, idx)
|
||||
* Show the mapping associated with a menu item or hierarchy in a sub-menu.
|
||||
*/
|
||||
static int
|
||||
show_menus(path_name, modes)
|
||||
char_u *path_name;
|
||||
int modes;
|
||||
show_menus(char_u *path_name, int modes)
|
||||
{
|
||||
char_u *p;
|
||||
char_u *name;
|
||||
@@ -1119,10 +1111,7 @@ show_menus(path_name, modes)
|
||||
* Recursively show the mappings associated with the menus under the given one
|
||||
*/
|
||||
static void
|
||||
show_menus_recursive(menu, modes, depth)
|
||||
vimmenu_T *menu;
|
||||
int modes;
|
||||
int depth;
|
||||
show_menus_recursive(vimmenu_T *menu, int modes, int depth)
|
||||
{
|
||||
int i;
|
||||
int bit;
|
||||
@@ -1208,11 +1197,11 @@ static int expand_emenu; /* TRUE for ":emenu" command */
|
||||
* Work out what to complete when doing command line completion of menu names.
|
||||
*/
|
||||
char_u *
|
||||
set_context_in_menu_cmd(xp, cmd, arg, forceit)
|
||||
expand_T *xp;
|
||||
char_u *cmd;
|
||||
char_u *arg;
|
||||
int forceit;
|
||||
set_context_in_menu_cmd(
|
||||
expand_T *xp,
|
||||
char_u *cmd,
|
||||
char_u *arg,
|
||||
int forceit)
|
||||
{
|
||||
char_u *after_dot;
|
||||
char_u *p;
|
||||
@@ -1327,9 +1316,7 @@ set_context_in_menu_cmd(xp, cmd, arg, forceit)
|
||||
* entries).
|
||||
*/
|
||||
char_u *
|
||||
get_menu_name(xp, idx)
|
||||
expand_T *xp UNUSED;
|
||||
int idx;
|
||||
get_menu_name(expand_T *xp UNUSED, int idx)
|
||||
{
|
||||
static vimmenu_T *menu = NULL;
|
||||
char_u *str;
|
||||
@@ -1389,9 +1376,7 @@ get_menu_name(xp, idx)
|
||||
* entries.
|
||||
*/
|
||||
char_u *
|
||||
get_menu_names(xp, idx)
|
||||
expand_T *xp UNUSED;
|
||||
int idx;
|
||||
get_menu_names(expand_T *xp UNUSED, int idx)
|
||||
{
|
||||
static vimmenu_T *menu = NULL;
|
||||
#define TBUFFER_LEN 256
|
||||
@@ -1483,8 +1468,7 @@ get_menu_names(xp, idx)
|
||||
* "name" may be modified.
|
||||
*/
|
||||
char_u *
|
||||
menu_name_skip(name)
|
||||
char_u *name;
|
||||
menu_name_skip(char_u *name)
|
||||
{
|
||||
char_u *p;
|
||||
|
||||
@@ -1507,9 +1491,7 @@ menu_name_skip(name)
|
||||
* two ways: raw menu name and menu name without '&'. ignore part after a TAB.
|
||||
*/
|
||||
static int
|
||||
menu_name_equal(name, menu)
|
||||
char_u *name;
|
||||
vimmenu_T *menu;
|
||||
menu_name_equal(char_u *name, vimmenu_T *menu)
|
||||
{
|
||||
#ifdef FEAT_MULTI_LANG
|
||||
if (menu->en_name != NULL
|
||||
@@ -1521,9 +1503,7 @@ menu_name_equal(name, menu)
|
||||
}
|
||||
|
||||
static int
|
||||
menu_namecmp(name, mname)
|
||||
char_u *name;
|
||||
char_u *mname;
|
||||
menu_namecmp(char_u *name, char_u *mname)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -1543,11 +1523,11 @@ menu_namecmp(name, mname)
|
||||
* whether the command is an "unmenu" command.
|
||||
*/
|
||||
static int
|
||||
get_menu_cmd_modes(cmd, forceit, noremap, unmenu)
|
||||
char_u *cmd;
|
||||
int forceit; /* Was there a "!" after the command? */
|
||||
int *noremap;
|
||||
int *unmenu;
|
||||
get_menu_cmd_modes(
|
||||
char_u *cmd,
|
||||
int forceit, /* Was there a "!" after the command? */
|
||||
int *noremap,
|
||||
int *unmenu)
|
||||
{
|
||||
int modes;
|
||||
|
||||
@@ -1607,9 +1587,7 @@ get_menu_cmd_modes(cmd, forceit, noremap, unmenu)
|
||||
* Returns the name in allocated memory (NULL for failure).
|
||||
*/
|
||||
static char_u *
|
||||
popup_mode_name(name, idx)
|
||||
char_u *name;
|
||||
int idx;
|
||||
popup_mode_name(char_u *name, int idx)
|
||||
{
|
||||
char_u *p;
|
||||
int len = (int)STRLEN(name);
|
||||
@@ -1630,9 +1608,7 @@ popup_mode_name(name, idx)
|
||||
* given menu in the current mode.
|
||||
*/
|
||||
int
|
||||
get_menu_index(menu, state)
|
||||
vimmenu_T *menu;
|
||||
int state;
|
||||
get_menu_index(vimmenu_T *menu, int state)
|
||||
{
|
||||
int idx;
|
||||
|
||||
@@ -1670,10 +1646,7 @@ get_menu_index(menu, state)
|
||||
* If actext != NULL, *actext is set to the text after the first TAB.
|
||||
*/
|
||||
static char_u *
|
||||
menu_text(str, mnemonic, actext)
|
||||
char_u *str;
|
||||
int *mnemonic;
|
||||
char_u **actext;
|
||||
menu_text(char_u *str, int *mnemonic, char_u **actext)
|
||||
{
|
||||
char_u *p;
|
||||
char_u *text;
|
||||
@@ -1724,8 +1697,7 @@ menu_text(str, mnemonic, actext)
|
||||
* Return TRUE if "name" can be a menu in the MenuBar.
|
||||
*/
|
||||
int
|
||||
menu_is_menubar(name)
|
||||
char_u *name;
|
||||
menu_is_menubar(char_u *name)
|
||||
{
|
||||
return (!menu_is_popup(name)
|
||||
&& !menu_is_toolbar(name)
|
||||
@@ -1736,8 +1708,7 @@ menu_is_menubar(name)
|
||||
* Return TRUE if "name" is a popup menu name.
|
||||
*/
|
||||
int
|
||||
menu_is_popup(name)
|
||||
char_u *name;
|
||||
menu_is_popup(char_u *name)
|
||||
{
|
||||
return (STRNCMP(name, "PopUp", 5) == 0);
|
||||
}
|
||||
@@ -1747,8 +1718,7 @@ menu_is_popup(name)
|
||||
* Return TRUE if "name" is part of a popup menu.
|
||||
*/
|
||||
int
|
||||
menu_is_child_of_popup(menu)
|
||||
vimmenu_T *menu;
|
||||
menu_is_child_of_popup(vimmenu_T *menu)
|
||||
{
|
||||
while (menu->parent != NULL)
|
||||
menu = menu->parent;
|
||||
@@ -1760,8 +1730,7 @@ menu_is_child_of_popup(menu)
|
||||
* Return TRUE if "name" is a toolbar menu name.
|
||||
*/
|
||||
int
|
||||
menu_is_toolbar(name)
|
||||
char_u *name;
|
||||
menu_is_toolbar(char_u *name)
|
||||
{
|
||||
return (STRNCMP(name, "ToolBar", 7) == 0);
|
||||
}
|
||||
@@ -1771,8 +1740,7 @@ menu_is_toolbar(name)
|
||||
* with '-'
|
||||
*/
|
||||
int
|
||||
menu_is_separator(name)
|
||||
char_u *name;
|
||||
menu_is_separator(char_u *name)
|
||||
{
|
||||
return (name[0] == '-' && name[STRLEN(name) - 1] == '-');
|
||||
}
|
||||
@@ -1781,8 +1749,7 @@ menu_is_separator(name)
|
||||
* Return TRUE if the menu is hidden: Starts with ']'
|
||||
*/
|
||||
static int
|
||||
menu_is_hidden(name)
|
||||
char_u *name;
|
||||
menu_is_hidden(char_u *name)
|
||||
{
|
||||
return (name[0] == ']') || (menu_is_popup(name) && name[5] != NUL);
|
||||
}
|
||||
@@ -1793,8 +1760,7 @@ menu_is_hidden(name)
|
||||
* Return TRUE if the menu is the tearoff menu.
|
||||
*/
|
||||
static int
|
||||
menu_is_tearoff(name)
|
||||
char_u *name UNUSED;
|
||||
menu_is_tearoff(char_u *name UNUSED)
|
||||
{
|
||||
#ifdef FEAT_GUI
|
||||
return (STRCMP(name, TEAR_STRING) == 0);
|
||||
@@ -1807,7 +1773,7 @@ menu_is_tearoff(name)
|
||||
#ifdef FEAT_GUI
|
||||
|
||||
static int
|
||||
get_menu_mode()
|
||||
get_menu_mode(void)
|
||||
{
|
||||
if (VIsual_active)
|
||||
{
|
||||
@@ -1835,9 +1801,7 @@ get_menu_mode()
|
||||
* Return OK or FAIL. Used recursively.
|
||||
*/
|
||||
int
|
||||
check_menu_pointer(root, menu_to_check)
|
||||
vimmenu_T *root;
|
||||
vimmenu_T *menu_to_check;
|
||||
check_menu_pointer(vimmenu_T *root, vimmenu_T *menu_to_check)
|
||||
{
|
||||
vimmenu_T *p;
|
||||
|
||||
@@ -1857,8 +1821,7 @@ check_menu_pointer(root, menu_to_check)
|
||||
* gui_create_initial_menus(root_menu, NULL);
|
||||
*/
|
||||
void
|
||||
gui_create_initial_menus(menu)
|
||||
vimmenu_T *menu;
|
||||
gui_create_initial_menus(vimmenu_T *menu)
|
||||
{
|
||||
int idx = 0;
|
||||
|
||||
@@ -1884,9 +1847,7 @@ gui_create_initial_menus(menu)
|
||||
* Used recursively by gui_update_menus (see below)
|
||||
*/
|
||||
static void
|
||||
gui_update_menus_recurse(menu, mode)
|
||||
vimmenu_T *menu;
|
||||
int mode;
|
||||
gui_update_menus_recurse(vimmenu_T *menu, int mode)
|
||||
{
|
||||
int grey;
|
||||
|
||||
@@ -1926,8 +1887,7 @@ gui_update_menus_recurse(menu, mode)
|
||||
* since last time. If "modes" is not 0, then we use these modes instead.
|
||||
*/
|
||||
void
|
||||
gui_update_menus(modes)
|
||||
int modes;
|
||||
gui_update_menus(int modes)
|
||||
{
|
||||
static int prev_mode = -1;
|
||||
int mode = 0;
|
||||
@@ -1964,8 +1924,7 @@ gui_update_menus(modes)
|
||||
* Case of the key is ignored.
|
||||
*/
|
||||
int
|
||||
gui_is_menu_shortcut(key)
|
||||
int key;
|
||||
gui_is_menu_shortcut(int key)
|
||||
{
|
||||
vimmenu_T *menu;
|
||||
|
||||
@@ -1985,7 +1944,7 @@ gui_is_menu_shortcut(key)
|
||||
* etc.
|
||||
*/
|
||||
void
|
||||
gui_show_popupmenu()
|
||||
gui_show_popupmenu(void)
|
||||
{
|
||||
vimmenu_T *menu;
|
||||
int mode;
|
||||
@@ -2044,11 +2003,11 @@ gui_mch_toggle_tearoffs(int enable)
|
||||
* Recursively add tearoff items
|
||||
*/
|
||||
static void
|
||||
gui_create_tearoffs_recurse(menu, pname, pri_tab, pri_idx)
|
||||
vimmenu_T *menu;
|
||||
const char_u *pname;
|
||||
int *pri_tab;
|
||||
int pri_idx;
|
||||
gui_create_tearoffs_recurse(
|
||||
vimmenu_T *menu,
|
||||
const char_u *pname,
|
||||
int *pri_tab,
|
||||
int pri_idx)
|
||||
{
|
||||
char_u *newpname = NULL;
|
||||
int len;
|
||||
@@ -2102,10 +2061,7 @@ gui_create_tearoffs_recurse(menu, pname, pri_tab, pri_idx)
|
||||
* "tearpath" is the menu path, and must have room to add TEAR_STRING.
|
||||
*/
|
||||
static void
|
||||
gui_add_tearoff(tearpath, pri_tab, pri_idx)
|
||||
char_u *tearpath;
|
||||
int *pri_tab;
|
||||
int pri_idx;
|
||||
gui_add_tearoff(char_u *tearpath, int *pri_tab, int pri_idx)
|
||||
{
|
||||
char_u *tbuf;
|
||||
int t;
|
||||
@@ -2151,8 +2107,7 @@ gui_add_tearoff(tearpath, pri_tab, pri_idx)
|
||||
* Recursively destroy tearoff items
|
||||
*/
|
||||
static void
|
||||
gui_destroy_tearoffs_recurse(menu)
|
||||
vimmenu_T *menu;
|
||||
gui_destroy_tearoffs_recurse(vimmenu_T *menu)
|
||||
{
|
||||
while (menu)
|
||||
{
|
||||
@@ -2178,8 +2133,7 @@ gui_destroy_tearoffs_recurse(menu)
|
||||
* execute it.
|
||||
*/
|
||||
void
|
||||
ex_emenu(eap)
|
||||
exarg_T *eap;
|
||||
ex_emenu(exarg_T *eap)
|
||||
{
|
||||
vimmenu_T *menu;
|
||||
char_u *name;
|
||||
@@ -2317,8 +2271,7 @@ ex_emenu(eap)
|
||||
* Given a menu descriptor, e.g. "File.New", find it in the menu hierarchy.
|
||||
*/
|
||||
vimmenu_T *
|
||||
gui_find_menu(path_name)
|
||||
char_u *path_name;
|
||||
gui_find_menu(char_u *path_name)
|
||||
{
|
||||
vimmenu_T *menu = NULL;
|
||||
char_u *name;
|
||||
@@ -2394,8 +2347,7 @@ static garray_T menutrans_ga = {0, 0, 0, 0, NULL};
|
||||
* case the commands are ignored.
|
||||
*/
|
||||
void
|
||||
ex_menutranslate(eap)
|
||||
exarg_T *eap UNUSED;
|
||||
ex_menutranslate(exarg_T *eap UNUSED)
|
||||
{
|
||||
#ifdef FEAT_MULTI_LANG
|
||||
char_u *arg = eap->arg;
|
||||
@@ -2473,8 +2425,7 @@ ex_menutranslate(eap)
|
||||
* Find the character just after one part of a menu name.
|
||||
*/
|
||||
static char_u *
|
||||
menu_skip_part(p)
|
||||
char_u *p;
|
||||
menu_skip_part(char_u *p)
|
||||
{
|
||||
while (*p != NUL && *p != '.' && !vim_iswhite(*p))
|
||||
{
|
||||
@@ -2492,9 +2443,7 @@ menu_skip_part(p)
|
||||
* Return a pointer to the translation or NULL if not found.
|
||||
*/
|
||||
static char_u *
|
||||
menutrans_lookup(name, len)
|
||||
char_u *name;
|
||||
int len;
|
||||
menutrans_lookup(char_u *name, int len)
|
||||
{
|
||||
menutrans_T *tp = (menutrans_T *)menutrans_ga.ga_data;
|
||||
int i;
|
||||
@@ -2527,8 +2476,7 @@ menutrans_lookup(name, len)
|
||||
* Unescape the name in the translate dictionary table.
|
||||
*/
|
||||
static void
|
||||
menu_unescape_name(name)
|
||||
char_u *name;
|
||||
menu_unescape_name(char_u *name)
|
||||
{
|
||||
char_u *p;
|
||||
|
||||
@@ -2543,8 +2491,7 @@ menu_unescape_name(name)
|
||||
* Skip the menu name, and translate <Tab> into a real TAB.
|
||||
*/
|
||||
static char_u *
|
||||
menu_translate_tab_and_shift(arg_start)
|
||||
char_u *arg_start;
|
||||
menu_translate_tab_and_shift(char_u *arg_start)
|
||||
{
|
||||
char_u *arg = arg_start;
|
||||
|
||||
|
Reference in New Issue
Block a user