Re: [PATCH] Menuconfig search changes - pt. 3

From: Yuval Turgeman
Date: Tue Sep 14 2004 - 17:38:50 EST


On Tue, 14 Sep 2004 19:53:26 +0200 (CEST), Roman Zippel
<zippel@xxxxxxxxxxxxxx> wrote:
> Hi,
>
> On Tue, 14 Sep 2004, Yuval Turgeman wrote:
>
> > +static int regex_match(const char *string, regex_t *re)
> > +{
> > + int rc;
> > +
> > + rc = regexec(re, string, (size_t) 0, NULL, 0);
> > + if (rc)
> > + return 0;
> > + return 1;
> > +}
>
> I guess, this doesn't has to be a separate function anymore.

Ok.

> > +static void show_expr(struct menu *menu, FILE *fp)
> > +{
> > + bool hit = false;
> > + fprintf(fp, "Depends:\n ");
> > + if (menu->prompt->visible.expr) {
> > + if (!hit)
> > + hit = true;
> > + expr_fprint(menu->prompt->visible.expr, fp);
> > + }
> > + if (!hit)
> > + fprintf(fp, "None");
> > + if (menu->sym) {
> > + struct property *prop;
> > + hit = false;
> > + fprintf(fp, "\nSelects:\n ");
> > + for_all_properties(menu->sym, prop, P_SELECT) {
> > + if (!hit)
> > + hit = true;
> > + expr_fprint(prop->expr, fp);
> > + }
> > + if (!hit)
> > + fprintf(fp, "None");
> > + hit = false;
> > + fprintf(fp, "\nSelected by:\n ");
> > + if (menu->sym->rev_dep.expr) {
> > + hit = true;
> > + expr_fprint(menu->sym->rev_dep.expr, fp);
> > + }
> > + if (!hit)
> > + fprintf(fp, "None");
> > + }
> > +}
>
> This still prints duplicate information, look at how
> ConfigMainWindow::setHelp() in qconf.cc does it. Your function should have
> pretty much the same structure, e.g.

I don't understand - duplicate information of what ?
Can you perhaps give me an example (it seems to me that i am actually
doing what qconf is doing... printing all the P_SELECT of the all the
properties, printing the dependencies and the reverse dependencies) ?

> > + for_all_symbols(i, sym) {
> > + if (!sym->name)
> > + continue;
> > + if (!regex_match(sym->name, &re))
> > + continue;
> > + for_all_prompts(sym, prop) {
>
> here you should iterate over all properties and print the info about it.

The search prints out plenty of info already - what info do you think
is missing ?

>
> > + if (!hit)
> > + fprintf(fp, "No matches found.");
>
> You could print the number of found symbols here.

Ok.

>
> > stat = exec_conf();
> > + if (stat == 26) {
>
> Move this into the switch part a few lines below and simply use the next
> available number. For this you need to print the currently selected
> symbol and the search string from lxdialog, this way you also return to
> the same previously selected symbol after exiting the search.

Ok (although if I remember correctly it does return to selected symbol)

Thanks,
Yuval.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/