コード例 #1
0
ファイル: mconf.c プロジェクト: 16rd/rt-n56u
static void get_symbol_str(struct gstr *r, struct symbol *sym)
{
	bool hit;
	struct property *prop;

	if (sym && sym->name)
		str_printf(r, "Symbol: %s [=%s]\n", sym->name,
		                                    sym_get_string_value(sym));
	for_all_prompts(sym, prop)
		get_prompt_str(r, prop);
	hit = false;
	for_all_properties(sym, prop, P_SELECT) {
		if (!hit) {
			str_append(r, "  Selects: ");
			hit = true;
		} else
			str_printf(r, " && ");
		expr_gstr_print(prop->expr, r);
	}
	if (hit)
		str_append(r, "\n");
	if (sym->rev_dep.expr) {
		str_append(r, _("  Selected by: "));
		expr_gstr_print(sym->rev_dep.expr, r);
		str_append(r, "\n");
	}
	str_append(r, "\n\n");
}
コード例 #2
0
static void get_prompt_str(struct gstr *r, struct property *prop)
{
	int i, j;
	struct menu *submenu[8], *menu;

	str_printf(r, _("Prompt: %s\n"), _(prop->text));
	str_printf(r, _("  Defined at %s:%d\n"), prop->menu->file->name,
		prop->menu->lineno);
	if (!expr_is_yes(prop->visible.expr)) {
		str_append(r, _("  Depends on: "));
		expr_gstr_print(prop->visible.expr, r);
		str_append(r, "\n");
	}
	menu = prop->menu->parent;
	for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent)
		submenu[i++] = menu;
	if (i > 0) {
		str_printf(r, _("  Location:\n"));
		for (j = 4; --i >= 0; j += 2) {
			menu = submenu[i];
			str_printf(r, "%*c-> %s", j, ' ', _(menu_get_prompt(menu)));
			if (menu->sym) {
				str_printf(r, " (%s [=%s])", menu->sym->name ?
					menu->sym->name : _("<choice>"),
					sym_get_string_value(menu->sym));
			}
			str_append(r, "\n");
		}
	}
}
コード例 #3
0
void get_symbol_str(struct gstr *r, struct symbol *sym)
{
	bool hit;
	struct property *prop;

	if (sym && sym->name) {
		str_printf(r, "Symbol: %s [=%s]\n", sym->name,
			   sym_get_string_value(sym));
		str_printf(r, "Type  : %s\n", sym_type_name(sym->type));
		if (sym->type == S_INT || sym->type == S_HEX) {
			prop = sym_get_range_prop(sym);
			if (prop) {
				str_printf(r, "Range : ");
				expr_gstr_print(prop->expr, r);
				str_append(r, "\n");
			}
		}
	}
	for_all_prompts(sym, prop)
		get_prompt_str(r, prop);
	hit = false;
	for_all_properties(sym, prop, P_SELECT) {
		if (!hit) {
			str_append(r, "  Selects: ");
			hit = true;
		} else
			str_printf(r, " && ");
		expr_gstr_print(prop->expr, r);
	}
	if (hit)
		str_append(r, "\n");
	if (sym->rev_dep.expr) {
		str_append(r, _("  Selected by: "));
		expr_gstr_print(sym->rev_dep.expr, r);
		str_append(r, "\n");
	}
	str_append(r, "\n\n");
}
コード例 #4
0
static void get_prompt_str(struct gstr *r, struct property *prop,
                           struct jk_head *head)
{
    int i, j;
    struct menu *submenu[8], *menu, *location = NULL;
    struct jump_key *jump;

    str_printf(r, _("Prompt: %s\n"), _(prop->text));
    str_printf(r, _("  Defined at %s:%d\n"), prop->menu->file->name,
               prop->menu->lineno);
    if (!expr_is_yes(prop->visible.expr)) {
        str_append(r, _("  Depends on: "));
        expr_gstr_print(prop->visible.expr, r);
        str_append(r, "\n");
    }
    menu = prop->menu->parent;
    for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent) {
        bool accessible = menu_is_visible(menu);

        submenu[i++] = menu;
        if (location == NULL && accessible)
            location = menu;
    }
    if (head && location) {
        jump = malloc(sizeof(struct jump_key));

        if (menu_is_visible(prop->menu)) {
            /*
             * There is not enough room to put the hint at the
             * beginning of the "Prompt" line. Put the hint on the
             * last "Location" line even when it would belong on
             * the former.
             */
            jump->target = prop->menu;
        } else
            jump->target = location;

        if (CIRCLEQ_EMPTY(head))
            jump->index = 0;
        else
            jump->index = CIRCLEQ_LAST(head)->index + 1;

        CIRCLEQ_INSERT_TAIL(head, jump, entries);
    }

    if (i > 0) {
        str_printf(r, _("  Location:\n"));
        for (j = 4; --i >= 0; j += 2) {
            menu = submenu[i];
            if (head && location && menu == location)
                jump->offset = r->len - 1;
            str_printf(r, "%*c-> %s", j, ' ',
                       _(menu_get_prompt(menu)));
            if (menu->sym) {
                str_printf(r, " (%s [=%s])", menu->sym->name ?
                           menu->sym->name : _("<choice>"),
                           sym_get_string_value(menu->sym));
            }
            str_append(r, "\n");
        }
    }
}