From 4ba37b5833de99db9e9afe8928b31c864182405c Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 4 Dec 2019 21:57:43 +0100 Subject: patch 8.1.2388: using old C style comments Problem: Using old C style comments. Solution: Use // comments where appropriate. --- src/menu.c | 320 ++++++++++++++++++++++++++++++------------------------------- 1 file changed, 160 insertions(+), 160 deletions(-) (limited to 'src/menu.c') diff --git a/src/menu.c b/src/menu.c index 26327941c..d82f04d8f 100644 --- a/src/menu.c +++ b/src/menu.c @@ -16,7 +16,7 @@ #if defined(FEAT_MENU) || defined(PROTO) -#define MENUDEPTH 10 /* maximum depth of menus */ +#define MENUDEPTH 10 // maximum depth of menus #ifdef FEAT_GUI_MSWIN static int add_menu_path(char_u *, vimmenu_T *, int *, char_u *, int); @@ -56,7 +56,7 @@ static void menu_unescape_name(char_u *p); static char_u *menu_translate_tab_and_shift(char_u *arg_start); -/* The character for each menu mode */ +// The character for each menu mode static char *menu_mode_chars[] = {"n", "v", "s", "o", "i", "c", "tl", "t"}; static char_u e_notsubmenu[] = N_("E327: Part of menu-item path is not sub-menu"); @@ -106,7 +106,7 @@ get_root_menu(char_u *name) */ void ex_menu( - exarg_T *eap) /* Ex command arguments */ + exarg_T *eap) // Ex command arguments { char_u *menu_path; int modes; @@ -126,8 +126,8 @@ ex_menu( # endif #endif int pri_tab[MENUDEPTH + 1]; - int enable = MAYBE; /* TRUE for "menu enable", FALSE for "menu - * disable */ + int enable = MAYBE; // TRUE for "menu enable", FALSE for "menu + // disable #ifdef FEAT_TOOLBAR char_u *icon = NULL; #endif @@ -161,7 +161,7 @@ ex_menu( } - /* Locate an optional "icon=filename" argument. */ + // Locate an optional "icon=filename" argument. if (STRNCMP(arg, "icon=", 5) == 0) { arg += 5; @@ -208,7 +208,7 @@ ex_menu( i = 0; while (i < MENUDEPTH) pri_tab[i++] = 500; - pri_tab[MENUDEPTH] = -1; /* mark end of the table */ + pri_tab[MENUDEPTH] = -1; // mark end of the table /* * Check for "disable" or "enable" argument. @@ -301,7 +301,7 @@ ex_menu( root_menu_ptr = get_root_menu(menu_path); if (root_menu_ptr == &curwin->w_winbar) - /* Assume the window toolbar menu will change. */ + // Assume the window toolbar menu will change. redraw_later(NOT_VALID); if (enable != MAYBE) @@ -311,7 +311,7 @@ ex_menu( * For the PopUp menu, remove a menu for each mode separately. * Careful: menu_nable_recurse() changes menu_path. */ - if (STRCMP(menu_path, "*") == 0) /* meaning: do all menus */ + if (STRCMP(menu_path, "*") == 0) // meaning: do all menus menu_path = (char_u *)""; if (menu_is_popup(menu_path)) @@ -335,7 +335,7 @@ ex_menu( /* * Delete menu(s). */ - if (STRCMP(menu_path, "*") == 0) /* meaning: remove all menus */ + if (STRCMP(menu_path, "*") == 0) // meaning: remove all menus menu_path = (char_u *)""; /* @@ -355,7 +355,7 @@ ex_menu( } } - /* Careful: remove_menu() changes menu_path */ + // Careful: remove_menu() changes menu_path remove_menu(root_menu_ptr, menu_path, modes, FALSE); } else @@ -364,13 +364,13 @@ ex_menu( * Add menu(s). * Replace special key codes. */ - if (STRICMP(map_to, "") == 0) /* "" means nothing */ + if (STRICMP(map_to, "") == 0) // "" means nothing { map_to = (char_u *)""; map_buf = NULL; } else if (modes & MENU_TIP_MODE) - map_buf = NULL; /* Menu tips are plain text. */ + map_buf = NULL; // Menu tips are plain text. else map_to = replace_termcodes(map_to, &map_buf, REPTERM_DO_LT | (special ? REPTERM_SPECIAL : 0), NULL); @@ -397,7 +397,7 @@ ex_menu( p = popup_mode_name(menu_path, i); if (p != NULL) { - /* Include all modes, to make ":amenu" work */ + // Include all modes, to make ":amenu" work menuarg.modes = modes; #ifdef FEAT_TOOLBAR menuarg.iconfile = NULL; @@ -418,7 +418,7 @@ ex_menu( } #if defined(FEAT_GUI) && !(defined(FEAT_GUI_GTK)) - /* If the menubar height changed, resize the window */ + // If the menubar height changed, resize the window if (gui.in_use && (gui.menu_height != old_menu_height # if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_MSWIN) @@ -451,12 +451,12 @@ theend: static int add_menu_path( char_u *menu_path, - vimmenu_T *menuarg, /* passes modes, iconfile, iconidx, - icon_builtin, silent[0], noremap[0] */ + vimmenu_T *menuarg, // passes modes, iconfile, iconidx, + // icon_builtin, silent[0], noremap[0] int *pri_tab, char_u *call_data #ifdef FEAT_GUI_MSWIN - , int addtearoff /* may add tearoff item */ + , int addtearoff // may add tearoff item #endif ) { @@ -486,7 +486,7 @@ add_menu_path( #endif vimmenu_T **root_menu_ptr; - /* Make a copy so we can stuff around with it, since it could be const */ + // Make a copy so we can stuff around with it, since it could be const path_name = vim_strsave(menu_path); if (path_name == NULL) return FAIL; @@ -496,8 +496,8 @@ add_menu_path( name = path_name; while (*name) { - /* Get name of this element in the menu hierarchy, and the simplified - * name (without mnemonic and accelerator text). */ + // Get name of this element in the menu hierarchy, and the simplified + // name (without mnemonic and accelerator text). next_name = menu_name_skip(name); #ifdef FEAT_MULTI_LANG map_to = menutrans_lookup(name, (int)STRLEN(name)); @@ -514,12 +514,12 @@ add_menu_path( goto erret; if (*dname == NUL) { - /* Only a mnemonic or accelerator is not valid. */ + // Only a mnemonic or accelerator is not valid. emsg(_("E792: Empty menu name")); goto erret; } - /* See if it's already there */ + // See if it's already there lower_pri = menup; #ifdef FEAT_GUI idx = 0; @@ -550,8 +550,8 @@ add_menu_path( } menup = &menu->next; - /* Count menus, to find where this one needs to be inserted. - * Ignore menus that are not in the menubar (PopUp and Toolbar) */ + // Count menus, to find where this one needs to be inserted. + // Ignore menus that are not in the menubar (PopUp and Toolbar) if (parent != NULL || menu_is_menubar(menu->name)) { #ifdef FEAT_GUI @@ -582,7 +582,7 @@ add_menu_path( goto erret; } - /* Not already there, so lets add it */ + // Not already there, so lets add it menu = ALLOC_CLEAR_ONE(vimmenu_T); if (menu == NULL) goto erret; @@ -590,7 +590,7 @@ add_menu_path( menu->modes = modes; menu->enabled = MENU_ALL_MODES; menu->name = vim_strsave(name); - /* separate mnemonic and accelerator text from actual menu name */ + // separate mnemonic and accelerator text from actual menu name menu->dname = menu_text(name, &menu->mnemonic, &menu->actext); #ifdef FEAT_MULTI_LANG if (en_name != NULL) @@ -607,13 +607,13 @@ add_menu_path( menu->priority = pri_tab[pri_idx]; menu->parent = parent; #ifdef FEAT_GUI_MOTIF - menu->sensitive = TRUE; /* the default */ + menu->sensitive = TRUE; // the default #endif #ifdef FEAT_BEVAL_TIP menu->tip = NULL; #endif #ifdef FEAT_GUI_ATHENA - menu->image = None; /* X-Windows definition for NULL*/ + menu->image = None; // X-Windows definition for NULL #endif /* @@ -631,7 +631,7 @@ add_menu_path( menu->iconfile = vim_strsave(menuarg->iconfile); #endif #if defined(FEAT_GUI_MSWIN) && defined(FEAT_TEAROFF) - /* the tearoff item must be present in the modes of each item. */ + // the tearoff item must be present in the modes of each item. if (parent != NULL && menu_is_tearoff(parent->children->dname)) parent->children->modes |= modes; #endif @@ -646,7 +646,7 @@ add_menu_path( * Also enable a menu when it's created or changed. */ #ifdef FEAT_GUI_MSWIN - /* If adding a tearbar (addtearoff == FALSE) don't update modes */ + // If adding a tearbar (addtearoff == FALSE) don't update modes if (addtearoff) #endif { @@ -663,25 +663,25 @@ add_menu_path( if ((old_modes & MENU_ALL_MODES) == 0 && (menu->modes & MENU_ALL_MODES) != 0) { - if (gui.in_use) /* Otherwise it will be added when GUI starts */ + if (gui.in_use) // Otherwise it will be added when GUI starts { if (*next_name == NUL) { - /* Real menu item, not sub-menu */ + // Real menu item, not sub-menu gui_mch_add_menu_item(menu, new_idx); - /* Want to update menus now even if mode not changed */ + // Want to update menus now even if mode not changed force_menu_update = TRUE; } else { - /* Sub-menu (not at end of path yet) */ + // Sub-menu (not at end of path yet) gui_mch_add_menu(menu, new_idx); } } # if defined(FEAT_GUI_MSWIN) & defined(FEAT_TEAROFF) - /* When adding a new submenu, may add a tearoff item */ + // When adding a new submenu, may add a tearoff item if ( addtearoff && *next_name && vim_strchr(p_go, GO_TEAROFF) != NULL @@ -721,7 +721,7 @@ add_menu_path( } # endif } -#endif /* FEAT_GUI */ +#endif // FEAT_GUI menup = &menu->children; parent = menu; @@ -748,17 +748,17 @@ add_menu_path( #endif p = (call_data == NULL) ? NULL : vim_strsave(call_data); - /* loop over all modes, may add more than one */ + // loop over all modes, may add more than one for (i = 0; i < MENU_MODES; ++i) { if (modes & (1 << i)) { - /* free any old menu */ + // free any old menu free_menu_string(menu, i); - /* For "amenu", may insert an extra character. - * Don't do this if adding a tearbar (addtearoff == FALSE). - * Don't do this for "". */ + // For "amenu", may insert an extra character. + // Don't do this if adding a tearbar (addtearoff == FALSE). + // Don't do this for "". c = 0; d = 0; if (amenu && call_data != NULL && *call_data != NUL @@ -799,7 +799,7 @@ add_menu_path( { int len = (int)STRLEN(menu->strings[i]); - /* Append CTRL-\ CTRL-G to obey 'insertmode'. */ + // Append CTRL-\ CTRL-G to obey 'insertmode'. menu->strings[i][len] = Ctrl_BSL; menu->strings[i][len + 1] = Ctrl_G; menu->strings[i][len + 2] = NUL; @@ -814,7 +814,7 @@ add_menu_path( } #if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_MSWIN) \ && (defined(FEAT_BEVAL_GUI) || defined(FEAT_GUI_GTK)) - /* Need to update the menu tip. */ + // Need to update the menu tip. if (modes & MENU_TIP_MODE) gui_mch_menu_set_tip(menu); #endif @@ -825,8 +825,8 @@ erret: vim_free(path_name); vim_free(dname); - /* Delete any empty submenu we added before discovering the error. Repeat - * for higher levels. */ + // Delete any empty submenu we added before discovering the error. Repeat + // for higher levels. while (parent != NULL && parent->children == NULL) { if (parent->parent == NULL) @@ -835,7 +835,7 @@ erret: menup = &parent->parent->children; for ( ; *menup != NULL && *menup != parent; menup = &((*menup)->next)) ; - if (*menup == NULL) /* safety check */ + if (*menup == NULL) // safety check break; parent = parent->parent; free_menu(menup); @@ -857,12 +857,12 @@ menu_nable_recurse( char_u *p; if (menu == NULL) - return OK; /* Got to bottom of hierarchy */ + return OK; // Got to bottom of hierarchy - /* Get name of this element in the menu hierarchy */ + // Get name of this element in the menu hierarchy p = menu_name_skip(name); - /* Find the menu */ + // Find the menu while (menu != NULL) { if (*name == NUL || *name == '*' || menu_name_equal(name, menu)) @@ -901,7 +901,7 @@ menu_nable_recurse( } #ifdef FEAT_GUI - /* Want to update menus now even if mode not changed */ + // Want to update menus now even if mode not changed force_menu_update = TRUE; #endif @@ -917,19 +917,19 @@ remove_menu( vimmenu_T **menup, char_u *name, int modes, - int silent) /* don't give error messages */ + int silent) // don't give error messages { vimmenu_T *menu; vimmenu_T *child; char_u *p; if (*menup == NULL) - return OK; /* Got to bottom of hierarchy */ + return OK; // Got to bottom of hierarchy - /* Get name of this element in the menu hierarchy */ + // Get name of this element in the menu hierarchy p = menu_name_skip(name); - /* Find the menu */ + // Find the menu while ((menu = *menup) != NULL) { if (*name == NUL || menu_name_equal(name, menu)) @@ -971,8 +971,8 @@ remove_menu( if (*name != NUL) break; - /* Remove the menu item for the given mode[s]. If the menu item - * is no longer valid in ANY mode, delete it */ + // Remove the menu item for the given mode[s]. If the menu item + // is no longer valid in ANY mode, delete it menu->modes &= ~modes; if (modes & MENU_TIP_MODE) free_menu_string(menu, MENU_INDEX_TIP); @@ -994,11 +994,11 @@ remove_menu( } - /* Recalculate modes for menu based on the new updated children */ + // Recalculate modes for menu based on the new updated children menu->modes &= ~modes; #if defined(FEAT_GUI_MSWIN) & defined(FEAT_TEAROFF) - if ((s_tearoffs) && (menu->children != NULL)) /* there's a tear bar.. */ - child = menu->children->next; /* don't count tearoff bar */ + if ((s_tearoffs) && (menu->children != NULL)) // there's a tear bar.. + child = menu->children->next; // don't count tearoff bar else #endif child = menu->children; @@ -1009,16 +1009,16 @@ remove_menu( free_menu_string(menu, MENU_INDEX_TIP); #if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_MSWIN) \ && (defined(FEAT_BEVAL_GUI) || defined(FEAT_GUI_GTK)) - /* Need to update the menu tip. */ + // Need to update the menu tip. if (gui.in_use) gui_mch_menu_set_tip(menu); #endif } if ((menu->modes & MENU_ALL_MODES) == 0) { - /* The menu item is no longer valid in ANY mode, so delete it */ + // The menu item is no longer valid in ANY mode, so delete it #if defined(FEAT_GUI_MSWIN) & defined(FEAT_TEAROFF) - if (s_tearoffs && menu->children != NULL) /* there's a tear bar.. */ + if (s_tearoffs && menu->children != NULL) // there's a tear bar.. free_menu(&menu->children); #endif *menup = menu; @@ -1051,14 +1051,14 @@ free_menu(vimmenu_T **menup) menu = *menup; #ifdef FEAT_GUI - /* Free machine specific menu structures (only when already created) */ - /* Also may rebuild a tearoff'ed menu */ + // Free machine specific menu structures (only when already created) + // Also may rebuild a tearoff'ed menu if (gui.in_use) gui_mch_destroy_menu(menu); #endif - /* Don't change *menup until after calling gui_mch_destroy_menu(). The - * MacOS code needs the original structure to properly delete the menu. */ + // Don't change *menup until after calling gui_mch_destroy_menu(). The + // MacOS code needs the original structure to properly delete the menu. *menup = menu->next; vim_free(menu->name); vim_free(menu->dname); @@ -1078,7 +1078,7 @@ free_menu(vimmenu_T **menup) vim_free(menu); #ifdef FEAT_GUI - /* Want to update menus now even if mode not changed */ + // Want to update menus now even if mode not changed force_menu_update = TRUE; #endif } @@ -1116,7 +1116,7 @@ show_menus(char_u *path_name, int modes) return FAIL; menu = *get_root_menu(path_name); - /* First, find the (sub)menu with the given name */ + // First, find the (sub)menu with the given name while (*name) { p = menu_name_skip(name); @@ -1124,7 +1124,7 @@ show_menus(char_u *path_name, int modes) { if (menu_name_equal(name, menu)) { - /* Found menu */ + // Found menu if (*p != NUL && menu->children == NULL) { emsg(_(e_notsubmenu)); @@ -1153,8 +1153,8 @@ show_menus(char_u *path_name, int modes) } vim_free(path_name); - /* Now we have found the matching menu, and we list the mappings */ - /* Highlight title */ + // Now we have found the matching menu, and we list the mappings + // Highlight title msg_puts_title(_("\n--- Menus ---")); show_menus_recursive(parent, modes, 0); @@ -1176,7 +1176,7 @@ show_menus_recursive(vimmenu_T *menu, int modes, int depth) if (menu != NULL) { msg_putchar('\n'); - if (got_int) /* "q" hit for "--more--" */ + if (got_int) // "q" hit for "--more--" return; for (i = 0; i < depth; i++) msg_puts(" "); @@ -1185,7 +1185,7 @@ show_menus_recursive(vimmenu_T *menu, int modes, int depth) msg_outnum((long)menu->priority); msg_puts(" "); } - /* Same highlighting as for directories!? */ + // Same highlighting as for directories!? msg_outtrans_attr(menu->name, HL_ATTR(HLF_D)); } @@ -1195,7 +1195,7 @@ show_menus_recursive(vimmenu_T *menu, int modes, int depth) if ((menu->modes & modes & (1 << bit)) != 0) { msg_putchar('\n'); - if (got_int) /* "q" hit for "--more--" */ + if (got_int) // "q" hit for "--more--" return; for (i = 0; i < depth + 2; i++) msg_puts(" "); @@ -1231,7 +1231,7 @@ show_menus_recursive(vimmenu_T *menu, int modes, int depth) else menu = menu->children; - /* recursively show all children. Skip PopUp[nvoci]. */ + // recursively show all children. Skip PopUp[nvoci]. for (; menu != NULL && !got_int; menu = menu->next) if (!menu_is_hidden(menu->dname)) show_menus_recursive(menu, modes, depth + 1); @@ -1244,7 +1244,7 @@ show_menus_recursive(vimmenu_T *menu, int modes, int depth) static vimmenu_T *expand_menu = NULL; static vimmenu_T *expand_menu_alt = NULL; static int expand_modes = 0x0; -static int expand_emenu; /* TRUE for ":emenu" command */ +static int expand_emenu; // TRUE for ":emenu" command /* * Work out what to complete when doing command line completion of menu names. @@ -1267,7 +1267,7 @@ set_context_in_menu_cmd( xp->xp_context = EXPAND_UNSUCCESSFUL; - /* Check for priority numbers, enable and disable */ + // Check for priority numbers, enable and disable for (p = arg; *p; ++p) if (!VIM_ISDIGIT(*p) && *p != '.') break; @@ -1297,12 +1297,12 @@ set_context_in_menu_cmd( after_dot = p + 1; } - /* ":tearoff" and ":popup" only use menus, not entries */ + // ":tearoff" and ":popup" only use menus, not entries expand_menus = !((*cmd == 't' && cmd[1] == 'e') || *cmd == 'p'); expand_emenu = (*cmd == 'e'); if (expand_menus && VIM_ISWHITE(*p)) - return NULL; /* TODO: check for next command? */ - if (*p == NUL) /* Complete the menu name */ + return NULL; // TODO: check for next command? + if (*p == NUL) // Complete the menu name { int try_alt_menu = TRUE; @@ -1331,7 +1331,7 @@ set_context_in_menu_cmd( { if (menu_name_equal(name, menu)) { - /* Found menu */ + // Found menu if ((*p != NUL && menu->children == NULL) || ((menu->modes & expand_modes) == 0x0)) { @@ -1353,7 +1353,7 @@ set_context_in_menu_cmd( } if (menu == NULL) { - /* No menu found with the name we were looking for */ + // No menu found with the name we were looking for vim_free(path_name); return NULL; } @@ -1371,7 +1371,7 @@ set_context_in_menu_cmd( else expand_menu_alt = NULL; } - else /* We're in the mapping part */ + else // We're in the mapping part xp->xp_context = EXPAND_NOTHING; return NULL; } @@ -1390,7 +1390,7 @@ get_menu_name(expand_T *xp UNUSED, int idx) static int should_advance = FALSE; #endif - if (idx == 0) /* first call: start at first item */ + if (idx == 0) // first call: start at first item { menu = expand_menu; did_alt_menu = FALSE; @@ -1399,7 +1399,7 @@ get_menu_name(expand_T *xp UNUSED, int idx) #endif } - /* Skip PopUp[nvoci]. */ + // Skip PopUp[nvoci]. while (menu != NULL && (menu_is_hidden(menu->dname) || menu_is_separator(menu->dname) || menu_is_tearoff(menu->dname) @@ -1413,7 +1413,7 @@ get_menu_name(expand_T *xp UNUSED, int idx) } } - if (menu == NULL) /* at end of linked list */ + if (menu == NULL) // at end of linked list return NULL; if (menu->modes & expand_modes) @@ -1436,7 +1436,7 @@ get_menu_name(expand_T *xp UNUSED, int idx) if (should_advance) #endif { - /* Advance to next menu entry. */ + // Advance to next menu entry. menu = menu->next; if (menu == NULL && !did_alt_menu) { @@ -1462,13 +1462,13 @@ get_menu_names(expand_T *xp UNUSED, int idx) static vimmenu_T *menu = NULL; static int did_alt_menu = FALSE; #define TBUFFER_LEN 256 - static char_u tbuffer[TBUFFER_LEN]; /*hack*/ + static char_u tbuffer[TBUFFER_LEN]; //hack char_u *str; #ifdef FEAT_MULTI_LANG static int should_advance = FALSE; #endif - if (idx == 0) /* first call: start at first item */ + if (idx == 0) // first call: start at first item { menu = expand_menu; did_alt_menu = FALSE; @@ -1477,7 +1477,7 @@ get_menu_names(expand_T *xp UNUSED, int idx) #endif } - /* Skip Browse-style entries, popup menus and separators. */ + // Skip Browse-style entries, popup menus and separators. while (menu != NULL && ( menu_is_hidden(menu->dname) || (expand_emenu && menu_is_separator(menu->dname)) @@ -1495,7 +1495,7 @@ get_menu_names(expand_T *xp UNUSED, int idx) } } - if (menu == NULL) /* at end of linked list */ + if (menu == NULL) // at end of linked list return NULL; if (menu->modes & expand_modes) @@ -1514,8 +1514,8 @@ get_menu_names(expand_T *xp UNUSED, int idx) should_advance = TRUE; } #endif - /* hack on menu separators: use a 'magic' char for the separator - * so that '.' in names gets escaped properly */ + // hack on menu separators: use a 'magic' char for the separator + // so that '.' in names gets escaped properly STRCAT(tbuffer, "\001"); str = tbuffer; } @@ -1542,7 +1542,7 @@ get_menu_names(expand_T *xp UNUSED, int idx) if (should_advance) #endif { - /* Advance to next menu entry. */ + // Advance to next menu entry. menu = menu->next; if (menu == NULL && !did_alt_menu) { @@ -1621,7 +1621,7 @@ menu_namecmp(char_u *name, char_u *mname) static int get_menu_cmd_modes( char_u *cmd, - int forceit, /* Was there a "!" after the command? */ + int forceit, // Was there a "!" after the command? int *noremap, int *unmenu) { @@ -1629,50 +1629,50 @@ get_menu_cmd_modes( switch (*cmd++) { - case 'v': /* vmenu, vunmenu, vnoremenu */ + case 'v': // vmenu, vunmenu, vnoremenu modes = MENU_VISUAL_MODE | MENU_SELECT_MODE; break; - case 'x': /* xmenu, xunmenu, xnoremenu */ + case 'x': // xmenu, xunmenu, xnoremenu modes = MENU_VISUAL_MODE; break; - case 's': /* smenu, sunmenu, snoremenu */ + case 's': // smenu, sunmenu, snoremenu modes = MENU_SELECT_MODE; break; - case 'o': /* omenu */ + case 'o': // omenu modes = MENU_OP_PENDING_MODE; break; - case 'i': /* imenu */ + case 'i': // imenu modes = MENU_INSERT_MODE; break; case 't': - if (*cmd == 'l') /* tlmenu, tlunmenu, tlnoremenu */ + if (*cmd == 'l') // tlmenu, tlunmenu, tlnoremenu { modes = MENU_TERMINAL_MODE; ++cmd; break; } - modes = MENU_TIP_MODE; /* tmenu */ + modes = MENU_TIP_MODE; // tmenu break; - case 'c': /* cmenu */ + case 'c': // cmenu modes = MENU_CMDLINE_MODE; break; - case 'a': /* amenu */ + case 'a': // amenu modes = MENU_INSERT_MODE | MENU_CMDLINE_MODE | MENU_NORMAL_MODE | MENU_VISUAL_MODE | MENU_SELECT_MODE | MENU_OP_PENDING_MODE; break; case 'n': - if (*cmd != 'o') /* nmenu, not noremenu */ + if (*cmd != 'o') // nmenu, not noremenu { modes = MENU_NORMAL_MODE; break; } - /* FALLTHROUGH */ + // FALLTHROUGH default: --cmd; - if (forceit) /* menu!! */ + if (forceit) // menu!! modes = MENU_INSERT_MODE | MENU_CMDLINE_MODE; - else /* menu */ + else // menu modes = MENU_NORMAL_MODE | MENU_VISUAL_MODE | MENU_SELECT_MODE | MENU_OP_PENDING_MODE; } @@ -1761,7 +1761,7 @@ menu_text(char_u *str, int *mnemonic, char_u **actext) char_u *p; char_u *text; - /* Locate accelerator text, after the first TAB */ + // Locate accelerator text, after the first TAB p = vim_strchr(str, TAB); if (p != NULL) { @@ -1772,13 +1772,13 @@ menu_text(char_u *str, int *mnemonic, char_u **actext) else text = vim_strsave(str); - /* Find mnemonic characters "&a" and reduce "&&" to "&". */ + // Find mnemonic characters "&a" and reduce "&&" to "&". for (p = text; p != NULL; ) { p = vim_strchr(p, '&'); if (p != NULL) { - if (p[1] == NUL) /* trailing "&" */ + if (p[1] == NUL) // trailing "&" break; if (mnemonic != NULL && p[1] != '&') #if !defined(__MVS__) || defined(MOTIF390_MNEMONIC_FIXED) @@ -1901,7 +1901,7 @@ get_menu_mode(void) return MENU_INDEX_OP_PENDING; if (State & NORMAL) return MENU_INDEX_NORMAL; - if (State & LANGMAP) /* must be a "r" command, like Insert mode */ + if (State & LANGMAP) // must be a "r" command, like Insert mode return MENU_INDEX_INSERT; return MENU_INDEX_INVALID; } @@ -1941,14 +1941,14 @@ show_popupmenu(void) if (STRNCMP("PopUp", menu->name, 5) == 0 && STRNCMP(menu->name + 5, mode, mode_len) == 0) break; - /* Only show a popup when it is defined and has entries */ + // Only show a popup when it is defined and has entries if (menu != NULL && menu->children != NULL) { # if defined(FEAT_GUI) if (gui.in_use) { - /* Update the menus now, in case the MenuPopup autocommand did - * anything. */ + // Update the menus now, in case the MenuPopup autocommand did + // anything. gui_update_menus(0); gui_mch_show_popupmenu(menu); } @@ -1998,7 +1998,7 @@ gui_create_initial_menus(vimmenu_T *menu) while (menu != NULL) { - /* Don't add a menu when only a tip was defined. */ + // Don't add a menu when only a tip was defined. if (menu->modes & MENU_ALL_MODES) { if (menu->children != NULL) @@ -2033,11 +2033,11 @@ gui_update_menus_recurse(vimmenu_T *menu, int mode) else grey = TRUE; # ifdef FEAT_GUI_ATHENA - /* Hiding menus doesn't work for Athena, it can cause a crash. */ + // Hiding menus doesn't work for Athena, it can cause a crash. gui_mch_menu_grey(menu, grey); # else - /* Never hide a toplevel menu, it may make the menubar resize or - * disappear. Same problem for ToolBar items. */ + // Never hide a toplevel menu, it may make the menubar resize or + // disappear. Same problem for ToolBar items. if (vim_strchr(p_go, GO_GREY) != NULL || menu->parent == NULL # ifdef FEAT_TOOLBAR || menu_is_toolbar(menu->parent->name) @@ -2097,7 +2097,7 @@ gui_is_menu_shortcut(int key) return FALSE; } # endif -#endif /* FEAT_GUI */ +#endif // FEAT_GUI #if (defined(FEAT_GUI_MSWIN) && defined(FEAT_TEAROFF)) || defined(PROTO) @@ -2145,8 +2145,8 @@ gui_create_tearoffs_recurse( { if (menu->children != NULL && menu_is_menubar(menu->name)) { - /* Add the menu name to the menu path. Insert a backslash before - * dots (it's used to separate menu names). */ + // Add the menu name to the menu path. Insert a backslash before + // dots (it's used to separate menu names). len = (int)STRLEN(pname) + (int)STRLEN(menu->name); for (s = menu->name; *s; ++s) if (*s == '.' || *s == '\\') @@ -2164,11 +2164,11 @@ gui_create_tearoffs_recurse( } *d = NUL; - /* check if tearoff already exists */ + // check if tearoff already exists if (STRCMP(menu->children->name, TEAR_STRING) != 0) { gui_add_tearoff(newpname, pri_tab, pri_idx - 1); - *d = NUL; /* remove TEAR_STRING */ + *d = NUL; // remove TEAR_STRING } STRCAT(newpname, "."); @@ -2204,7 +2204,7 @@ gui_add_tearoff(char_u *tearpath, int *pri_tab, int pri_idx) STRCAT(tearpath, "."); STRCAT(tearpath, TEAR_STRING); - /* Priority of tear-off is always 1 */ + // Priority of tear-off is always 1 t = pri_tab[pri_idx + 1]; pri_tab[pri_idx + 1] = 1; @@ -2238,20 +2238,20 @@ gui_destroy_tearoffs_recurse(vimmenu_T *menu) { if (menu->children) { - /* check if tearoff exists */ + // check if tearoff exists if (STRCMP(menu->children->name, TEAR_STRING) == 0) { - /* Disconnect the item and free the memory */ + // Disconnect the item and free the memory free_menu(&menu->children); } - if (menu->children != NULL) /* if not the last one */ + if (menu->children != NULL) // if not the last one gui_destroy_tearoffs_recurse(menu->children); } menu = menu->next; } } -#endif /* FEAT_GUI_MSWIN && FEAT_TEAROFF */ +#endif // FEAT_GUI_MSWIN && FEAT_TEAROFF /* * Execute "menu". Use by ":emenu" and the window toolbar. @@ -2266,7 +2266,7 @@ execute_menu(exarg_T *eap, vimmenu_T *menu, int mode_idx) if (idx < 0) { - /* Use the Insert mode entry when returning to Insert mode. */ + // Use the Insert mode entry when returning to Insert mode. if (restart_edit #ifdef FEAT_EVAL && !current_sctx.sc_sid @@ -2291,14 +2291,14 @@ execute_menu(exarg_T *eap, vimmenu_T *menu, int mode_idx) idx = MENU_INDEX_VISUAL; - /* GEDDES: This is not perfect - but it is a - * quick way of detecting whether we are doing this from a - * selection - see if the range matches up with the visual - * select start and end. */ + // GEDDES: This is not perfect - but it is a + // quick way of detecting whether we are doing this from a + // selection - see if the range matches up with the visual + // select start and end. if ((curbuf->b_visual.vi_start.lnum == eap->line1) && (curbuf->b_visual.vi_end.lnum) == eap->line2) { - /* Set it up for visual mode - equivalent to gv. */ + // Set it up for visual mode - equivalent to gv. VIsual_mode = curbuf->b_visual.vi_mode; tpos = curbuf->b_visual.vi_end; curwin->w_cursor = curbuf->b_visual.vi_start; @@ -2306,7 +2306,7 @@ execute_menu(exarg_T *eap, vimmenu_T *menu, int mode_idx) } else { - /* Set it up for line-wise visual mode */ + // Set it up for line-wise visual mode VIsual_mode = 'V'; curwin->w_cursor.lnum = eap->line1; curwin->w_cursor.col = 1; @@ -2315,7 +2315,7 @@ execute_menu(exarg_T *eap, vimmenu_T *menu, int mode_idx) tpos.coladd = 0; } - /* Activate visual mode */ + // Activate visual mode VIsual_active = TRUE; VIsual_reselect = TRUE; check_cursor(); @@ -2324,23 +2324,23 @@ execute_menu(exarg_T *eap, vimmenu_T *menu, int mode_idx) check_cursor(); - /* Adjust the cursor to make sure it is in the correct pos - * for exclusive mode */ + // Adjust the cursor to make sure it is in the correct pos + // for exclusive mode if (*p_sel == 'e' && gchar_cursor() != NUL) ++curwin->w_cursor.col; } } - /* For the WinBar menu always use the Normal mode menu. */ + // For the WinBar menu always use the Normal mode menu. if (idx == -1 || eap == NULL) idx = MENU_INDEX_NORMAL; if (idx != MENU_INDEX_INVALID && menu->strings[idx] != NULL && (menu->modes & (1 << idx))) { - /* When executing a script or function execute the commands right now. - * Also for the window toolbar. - * Otherwise put them in the typeahead buffer. */ + // When executing a script or function execute the commands right now. + // Also for the window toolbar. + // Otherwise put them in the typeahead buffer. if (eap == NULL #ifdef FEAT_EVAL || current_sctx.sc_sid != 0 @@ -2432,7 +2432,7 @@ ex_emenu(exarg_T *eap) name = saved_name; while (*name) { - /* Find in the menu hierarchy */ + // Find in the menu hierarchy p = menu_name_skip(name); while (menu != NULL) @@ -2496,8 +2496,8 @@ winbar_click(win_T *wp, int col) if (wp != curwin) { - /* Clicking in the window toolbar of a not-current window. - * Make that window the current one and save Visual mode. */ + // Clicking in the window toolbar of a not-current window. + // Make that window the current one and save Visual mode. save_curwin = curwin; VIsual_active = FALSE; curwin = wp; @@ -2547,7 +2547,7 @@ gui_find_menu(char_u *path_name) name = saved_name; while (*name) { - /* find the end of one dot-separated name and put a NUL at the dot */ + // find the end of one dot-separated name and put a NUL at the dot p = menu_name_skip(name); while (menu != NULL) @@ -2556,7 +2556,7 @@ gui_find_menu(char_u *path_name) { if (menu->children == NULL) { - /* found a menu item instead of a sub-menu */ + // found a menu item instead of a sub-menu if (*p == NUL) emsg(_("E336: Menu path must lead to a sub-menu")); else @@ -2564,16 +2564,16 @@ gui_find_menu(char_u *path_name) menu = NULL; goto theend; } - if (*p == NUL) /* found a full match */ + if (*p == NUL) // found a full match goto theend; break; } menu = menu->next; } - if (menu == NULL) /* didn't find it */ + if (menu == NULL) // didn't find it break; - /* Found a match, search the sub-menu. */ + // Found a match, search the sub-menu. menu = menu->children; name = p; } @@ -2593,9 +2593,9 @@ theend: typedef struct { - char_u *from; /* English name */ - char_u *from_noamp; /* same, without '&' */ - char_u *to; /* translated name */ + char_u *from; // English name + char_u *from_noamp; // same, without '&' + char_u *to; // translated name } menutrans_T; static garray_T menutrans_ga = {0, 0, 0, 0, NULL}; @@ -2632,13 +2632,13 @@ ex_menutranslate(exarg_T *eap UNUSED) } ga_clear(&menutrans_ga); # ifdef FEAT_EVAL - /* Delete all "menutrans_" global variables. */ + // Delete all "menutrans_" global variables. del_menutrans_vars(); # endif } else { - /* ":menutrans from to": add translation */ + // ":menutrans from to": add translation from = arg; arg = menu_skip_part(arg); to = skipwhite(arg); @@ -2713,7 +2713,7 @@ menutrans_lookup(char_u *name, int len) if (STRNICMP(name, tp[i].from, len) == 0 && tp[i].from[len] == NUL) return tp[i].to; - /* Now try again while ignoring '&' characters. */ + // Now try again while ignoring '&' characters. i = name[len]; name[len] = NUL; dname = menu_text(name, NULL, NULL); @@ -2744,7 +2744,7 @@ menu_unescape_name(char_u *name) if (*p == '\\') STRMOVE(p, p + 1); } -#endif /* FEAT_MULTI_LANG */ +#endif // FEAT_MULTI_LANG /* * Isolate the menu name. @@ -2773,4 +2773,4 @@ menu_translate_tab_and_shift(char_u *arg_start) return arg; } -#endif /* FEAT_MENU */ +#endif // FEAT_MENU -- cgit v1.2.1