menu.c (754451342fc5954061ede74b0a8485ec4a4c6eaa) menu.c (694c49a7c01cc87194be40cb26404b58b68c291c)
1/*
2 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
3 * Released under the terms of the GNU GPL v2.0.
4 */
5
6#include <ctype.h>
7#include <stdarg.h>
8#include <stdlib.h>

--- 697 unchanged lines hidden (view full) ---

706
707static void get_prompt_str(struct gstr *r, struct property *prop,
708 struct list_head *head)
709{
710 int i, j;
711 struct menu *submenu[8], *menu, *location = NULL;
712 struct jump_key *jump = NULL;
713
1/*
2 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
3 * Released under the terms of the GNU GPL v2.0.
4 */
5
6#include <ctype.h>
7#include <stdarg.h>
8#include <stdlib.h>

--- 697 unchanged lines hidden (view full) ---

706
707static void get_prompt_str(struct gstr *r, struct property *prop,
708 struct list_head *head)
709{
710 int i, j;
711 struct menu *submenu[8], *menu, *location = NULL;
712 struct jump_key *jump = NULL;
713
714 str_printf(r, _("Prompt: %s\n"), _(prop->text));
714 str_printf(r, "Prompt: %s\n", prop->text);
715 menu = prop->menu->parent;
716 for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent) {
717 bool accessible = menu_is_visible(menu);
718
719 submenu[i++] = menu;
720 if (location == NULL && accessible)
721 location = menu;
722 }

--- 16 unchanged lines hidden (view full) ---

739 else
740 jump->index = list_entry(head->prev, struct jump_key,
741 entries)->index + 1;
742
743 list_add_tail(&jump->entries, head);
744 }
745
746 if (i > 0) {
715 menu = prop->menu->parent;
716 for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent) {
717 bool accessible = menu_is_visible(menu);
718
719 submenu[i++] = menu;
720 if (location == NULL && accessible)
721 location = menu;
722 }

--- 16 unchanged lines hidden (view full) ---

739 else
740 jump->index = list_entry(head->prev, struct jump_key,
741 entries)->index + 1;
742
743 list_add_tail(&jump->entries, head);
744 }
745
746 if (i > 0) {
747 str_printf(r, _(" Location:\n"));
747 str_printf(r, " Location:\n");
748 for (j = 4; --i >= 0; j += 2) {
749 menu = submenu[i];
750 if (jump && menu == location)
751 jump->offset = strlen(r->s);
752 str_printf(r, "%*c-> %s", j, ' ',
748 for (j = 4; --i >= 0; j += 2) {
749 menu = submenu[i];
750 if (jump && menu == location)
751 jump->offset = strlen(r->s);
752 str_printf(r, "%*c-> %s", j, ' ',
753 _(menu_get_prompt(menu)));
753 menu_get_prompt(menu));
754 if (menu->sym) {
755 str_printf(r, " (%s [=%s])", menu->sym->name ?
754 if (menu->sym) {
755 str_printf(r, " (%s [=%s])", menu->sym->name ?
756 menu->sym->name : _("<choice>"),
756 menu->sym->name : "<choice>",
757 sym_get_string_value(menu->sym));
758 }
759 str_append(r, "\n");
760 }
761 }
762}
763
764/*

--- 47 unchanged lines hidden (view full) ---

812 }
813 }
814 }
815 for_all_prompts(sym, prop)
816 get_prompt_str(r, prop, head);
817
818 prop = get_symbol_prop(sym);
819 if (prop) {
757 sym_get_string_value(menu->sym));
758 }
759 str_append(r, "\n");
760 }
761 }
762}
763
764/*

--- 47 unchanged lines hidden (view full) ---

812 }
813 }
814 }
815 for_all_prompts(sym, prop)
816 get_prompt_str(r, prop, head);
817
818 prop = get_symbol_prop(sym);
819 if (prop) {
820 str_printf(r, _(" Defined at %s:%d\n"), prop->menu->file->name,
820 str_printf(r, " Defined at %s:%d\n", prop->menu->file->name,
821 prop->menu->lineno);
822 if (!expr_is_yes(prop->visible.expr)) {
821 prop->menu->lineno);
822 if (!expr_is_yes(prop->visible.expr)) {
823 str_append(r, _(" Depends on: "));
823 str_append(r, " Depends on: ");
824 expr_gstr_print(prop->visible.expr, r);
825 str_append(r, "\n");
826 }
827 }
828
824 expr_gstr_print(prop->visible.expr, r);
825 str_append(r, "\n");
826 }
827 }
828
829 get_symbol_props_str(r, sym, P_SELECT, _(" Selects: "));
829 get_symbol_props_str(r, sym, P_SELECT, " Selects: ");
830 if (sym->rev_dep.expr) {
831 expr_gstr_print_revdep(sym->rev_dep.expr, r, yes, " Selected by [y]:\n");
832 expr_gstr_print_revdep(sym->rev_dep.expr, r, mod, " Selected by [m]:\n");
833 expr_gstr_print_revdep(sym->rev_dep.expr, r, no, " Selected by [n]:\n");
834 }
835
830 if (sym->rev_dep.expr) {
831 expr_gstr_print_revdep(sym->rev_dep.expr, r, yes, " Selected by [y]:\n");
832 expr_gstr_print_revdep(sym->rev_dep.expr, r, mod, " Selected by [m]:\n");
833 expr_gstr_print_revdep(sym->rev_dep.expr, r, no, " Selected by [n]:\n");
834 }
835
836 get_symbol_props_str(r, sym, P_IMPLY, _(" Implies: "));
836 get_symbol_props_str(r, sym, P_IMPLY, " Implies: ");
837 if (sym->implied.expr) {
838 expr_gstr_print_revdep(sym->implied.expr, r, yes, " Implied by [y]:\n");
839 expr_gstr_print_revdep(sym->implied.expr, r, mod, " Implied by [m]:\n");
840 expr_gstr_print_revdep(sym->implied.expr, r, no, " Implied by [n]:\n");
841 }
842
843 str_append(r, "\n\n");
844}
845
846struct gstr get_relations_str(struct symbol **sym_arr, struct list_head *head)
847{
848 struct symbol *sym;
849 struct gstr res = str_new();
850 int i;
851
852 for (i = 0; sym_arr && (sym = sym_arr[i]); i++)
853 get_symbol_str(&res, sym, head);
854 if (!i)
837 if (sym->implied.expr) {
838 expr_gstr_print_revdep(sym->implied.expr, r, yes, " Implied by [y]:\n");
839 expr_gstr_print_revdep(sym->implied.expr, r, mod, " Implied by [m]:\n");
840 expr_gstr_print_revdep(sym->implied.expr, r, no, " Implied by [n]:\n");
841 }
842
843 str_append(r, "\n\n");
844}
845
846struct gstr get_relations_str(struct symbol **sym_arr, struct list_head *head)
847{
848 struct symbol *sym;
849 struct gstr res = str_new();
850 int i;
851
852 for (i = 0; sym_arr && (sym = sym_arr[i]); i++)
853 get_symbol_str(&res, sym, head);
854 if (!i)
855 str_append(&res, _("No matches found.\n"));
855 str_append(&res, "No matches found.\n");
856 return res;
857}
858
859
860void menu_get_ext_help(struct menu *menu, struct gstr *help)
861{
862 struct symbol *sym = menu->sym;
863 const char *help_text = nohelp_text;
864
865 if (menu_has_help(menu)) {
866 if (sym->name)
867 str_printf(help, "%s%s:\n\n", CONFIG_, sym->name);
868 help_text = menu_get_help(menu);
869 }
856 return res;
857}
858
859
860void menu_get_ext_help(struct menu *menu, struct gstr *help)
861{
862 struct symbol *sym = menu->sym;
863 const char *help_text = nohelp_text;
864
865 if (menu_has_help(menu)) {
866 if (sym->name)
867 str_printf(help, "%s%s:\n\n", CONFIG_, sym->name);
868 help_text = menu_get_help(menu);
869 }
870 str_printf(help, "%s\n", _(help_text));
870 str_printf(help, "%s\n", help_text);
871 if (sym)
872 get_symbol_str(help, sym, NULL);
873}
871 if (sym)
872 get_symbol_str(help, sym, NULL);
873}