Re: [PATCH 2.6.23-rc4] qconf ("make xconfig") Search Dialog Enhancement (rev8)

2007-09-20 Thread Shlomi Fish
Hi!

Sorry for the late response.

On Sunday 16 September 2007, Roman Zippel wrote:
> Hi,
>
> On Thu, 13 Sep 2007, Shlomi Fish wrote:
> > This patch adds an option to use either substring match, regular
> > expression match, or keywords search in the "make xconfig" Edit->Find
> > dialog.
> >
> > It also allows searching on the "help" field of the menus as well as
> > the "name" of the symbol.
> >
> > This change involved adding the sym_generic_search function to the LKC,
> > and implementing sym_re_search using it.
>
> I like the direction, but first of all please fix the coding style.

Which specific problems do you see with the coding style of the patch? Can you 
comment on it?

> I would also prefer to move more of the search functionality into the
> generic code, so it can be used by other front ends as well, otherwise a
> lot of this had to be duplicated.

That would be a good idea, but I cannot use Qt there, which makes my job 
harder.

> I think a filter function makes it maybe a bit to flexible, if a front
> end wants to do some weird filtering, it can still access the symbol
> data base directly. 

A filter function would still be convenient in this context, as the symbol 
data base API may change, and the filter function has a little logic in it.

> So what I have in mind is something like this: 
>
> struct symbol **sym_generic_search(const char *pattern, unsigned int
> flags);
>
> This means the back end provides a basic search facility for the most
> common search operations. The flags would specify what to search (e.g.
> symbol name, help text, prompts) and how to do it.

I suggest we don't call it sym_generic_search, as generic implies it is a 
generic filter. We can call it "sym_string_search" or whatever. Then, I 
suggest we have separate arguments for every parameter (i.e: search type, 
case sensitivity, what to search, etc.).



>
> > @@ -1199,6 +1199,23 @@
> > layout2->addWidget(searchButton);
> > layout1->addLayout(layout2);
> >
> > +   // Initialize the "Search Type" button group.
> > +   searchType = new QVButtonGroup("Search Type", this, "searchType");
> > +
> > +   substringSearch = new QRadioButton(
> > +   "Substring Match", searchType, "Substring Match"
> > +   );
> > +
> > +   keywordsSearch = new QRadioButton("Keywords", searchType, "Keywords");
> > +
> > +   regexSearch = new QRadioButton(
> > +   "Regular Expression", searchType, "Regular Expression"
> > +   );
> > +
> > +   substringSearch->setChecked(TRUE);
> > +   layout1->addWidget(searchType);
> > +
> > +   // Initialize the ConfigView and ConfigInfoView
> > split = new QSplitter(this);
> > split->setOrientation(QSplitter::Vertical);
> > list = new ConfigView(split, name);
> > @@ -1245,6 +1262,20 @@
> > }
> >  }
> >
> > +SEARCH_TYPE ConfigSearchWindow::getSearchType()
> > +{
> > +   return  substringSearch->isChecked() ? SUBSTRING :
> > +   regexSearch->isChecked() ? REGEX :
> > +   KEYWORDS;
> > +}
>
> If you use QButtonGroup::insert() you can assign id's to the indivual
> buttons and then use selectedId to make this part simpler.
>

Ah, OK.

Regards,

Shlomi Fish

-
Shlomi Fish  [EMAIL PROTECTED]
Homepage:http://www.shlomifish.org/

If it's not in my E-mail it doesn't happen. And if my E-mail is saying
one thing, and everything else says something else - E-mail will conquer.
-- An Israeli Linuxer
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2.6.23-rc4] qconf (make xconfig) Search Dialog Enhancement (rev8)

2007-09-20 Thread Shlomi Fish
Hi!

Sorry for the late response.

On Sunday 16 September 2007, Roman Zippel wrote:
 Hi,

 On Thu, 13 Sep 2007, Shlomi Fish wrote:
  This patch adds an option to use either substring match, regular
  expression match, or keywords search in the make xconfig Edit-Find
  dialog.
 
  It also allows searching on the help field of the menus as well as
  the name of the symbol.
 
  This change involved adding the sym_generic_search function to the LKC,
  and implementing sym_re_search using it.

 I like the direction, but first of all please fix the coding style.

Which specific problems do you see with the coding style of the patch? Can you 
comment on it?

 I would also prefer to move more of the search functionality into the
 generic code, so it can be used by other front ends as well, otherwise a
 lot of this had to be duplicated.

That would be a good idea, but I cannot use Qt there, which makes my job 
harder.

 I think a filter function makes it maybe a bit to flexible, if a front
 end wants to do some weird filtering, it can still access the symbol
 data base directly. 

A filter function would still be convenient in this context, as the symbol 
data base API may change, and the filter function has a little logic in it.

 So what I have in mind is something like this: 

 struct symbol **sym_generic_search(const char *pattern, unsigned int
 flags);

 This means the back end provides a basic search facility for the most
 common search operations. The flags would specify what to search (e.g.
 symbol name, help text, prompts) and how to do it.

I suggest we don't call it sym_generic_search, as generic implies it is a 
generic filter. We can call it sym_string_search or whatever. Then, I 
suggest we have separate arguments for every parameter (i.e: search type, 
case sensitivity, what to search, etc.).




  @@ -1199,6 +1199,23 @@
  layout2-addWidget(searchButton);
  layout1-addLayout(layout2);
 
  +   // Initialize the Search Type button group.
  +   searchType = new QVButtonGroup(Search Type, this, searchType);
  +
  +   substringSearch = new QRadioButton(
  +   Substring Match, searchType, Substring Match
  +   );
  +
  +   keywordsSearch = new QRadioButton(Keywords, searchType, Keywords);
  +
  +   regexSearch = new QRadioButton(
  +   Regular Expression, searchType, Regular Expression
  +   );
  +
  +   substringSearch-setChecked(TRUE);
  +   layout1-addWidget(searchType);
  +
  +   // Initialize the ConfigView and ConfigInfoView
  split = new QSplitter(this);
  split-setOrientation(QSplitter::Vertical);
  list = new ConfigView(split, name);
  @@ -1245,6 +1262,20 @@
  }
   }
 
  +SEARCH_TYPE ConfigSearchWindow::getSearchType()
  +{
  +   return  substringSearch-isChecked() ? SUBSTRING :
  +   regexSearch-isChecked() ? REGEX :
  +   KEYWORDS;
  +}

 If you use QButtonGroup::insert() you can assign id's to the indivual
 buttons and then use selectedId to make this part simpler.


Ah, OK.

Regards,

Shlomi Fish

-
Shlomi Fish  [EMAIL PROTECTED]
Homepage:http://www.shlomifish.org/

If it's not in my E-mail it doesn't happen. And if my E-mail is saying
one thing, and everything else says something else - E-mail will conquer.
-- An Israeli Linuxer
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2.6.23-rc4] qconf ("make xconfig") Search Dialog Enhancement (rev8)

2007-09-14 Thread Shlomi Fish
Hi all!

[ I'm not subscribed to this list so please CC me on your replies. ]

This patch adds an option to use either substring match, regular expression 
match, or keywords search in the "make xconfig" Edit->Find dialog.

It also allows searching on the "help" field of the menus as well as 
the "name" of the symbol.

This change involved adding the sym_generic_search function to the LKC, and 
implementing sym_re_search using it.

Regards,

Shlomi Fish

--- linux-2.6.23-rc4/scripts/kconfig/qconf.cc.orig  2007-09-01 
21:15:39.017466409 +0300
+++ linux-2.6.23-rc4/scripts/kconfig/qconf.cc   2007-09-08 11:29:31.357869409 
+0300
@@ -1199,6 +1199,23 @@
layout2->addWidget(searchButton);
layout1->addLayout(layout2);
 
+   // Initialize the "Search Type" button group.
+   searchType = new QVButtonGroup("Search Type", this, "searchType");
+
+   substringSearch = new QRadioButton(
+   "Substring Match", searchType, "Substring Match"
+   );
+
+   keywordsSearch = new QRadioButton("Keywords", searchType, "Keywords");
+
+   regexSearch = new QRadioButton(
+   "Regular Expression", searchType, "Regular Expression"
+   );
+
+   substringSearch->setChecked(TRUE);
+   layout1->addWidget(searchType);
+
+   // Initialize the ConfigView and ConfigInfoView
split = new QSplitter(this);
split->setOrientation(QSplitter::Vertical);
list = new ConfigView(split, name);
@@ -1245,6 +1262,20 @@
}
 }
 
+SEARCH_TYPE ConfigSearchWindow::getSearchType()
+{
+   return  substringSearch->isChecked() ? SUBSTRING :
+   regexSearch->isChecked() ? REGEX :
+   KEYWORDS;
+}
+
+
+static int search_filter(struct symbol *sym, void *context)
+{
+   FindQuery *query = (FindQuery *)context;
+   return query->sym_matches(sym);
+}
+
 void ConfigSearchWindow::search(void)
 {
struct symbol **p;
@@ -1255,7 +1286,9 @@
list->list->clear();
info->clear();
 
-   result = sym_re_search(editField->text().latin1());
+   FindQuery query(editField->text(), getSearchType());
+
+   result = sym_generic_search(search_filter, (void *));
if (!result)
return;
for (p = result; *p; p++) {
@@ -1265,6 +1298,114 @@
}
 }
 
+FindQuery::FindQuery(QString q, SEARCH_TYPE t, bool a_case) :
+   query(q), search_type(t), case_sensitive(a_case)
+{
+   compiled_regex = NULL;
+   if (search_type == REGEX)
+   {
+   compiled_regex = new QRegExp(query, case_sensitive);
+   }
+   else if (search_type == KEYWORDS)
+   {
+   compile_keywords();
+   }
+}
+
+void FindQuery::compile_keywords()
+{
+   QRegExp split_words("\\s+");
+   QStringList bare_words = QStringList::split(split_words, query);
+
+   QStringList::iterator it;
+   for ( it = bare_words.begin(); it != bare_words.end(); ++it )
+   {
+   QString escaped = QRegExp::escape(*it);
+   
+   keywords.append(QRegExp(QString("\\b") + escaped + "\\b"));
+   }
+}
+
+FindQuery::~FindQuery()
+{
+   if (compiled_regex)
+   {
+   delete compiled_regex;
+   compiled_regex = NULL;
+   }
+}
+
+bool FindQuery::string_matches_regex(QRegExp & re, const char *string)
+{
+   QString qs(string);
+
+   return (re.search(qs) >= 0);
+}
+
+bool FindQuery::string_matches(const char *string)
+{
+   QString qs(string);
+
+   if (search_type == SUBSTRING)
+   {
+   return qs.contains(query, case_sensitive);
+   }
+   else if (search_type == REGEX)
+   {
+   return string_matches_regex(*compiled_regex, string);
+   }
+   else
+   {
+   return false;
+   }
+}
+
+bool FindQuery::sym_matches(struct symbol *sym)
+{
+   if (!sym)
+   {
+   return false;
+   }
+
+   if (search_type == KEYWORDS)
+   {
+   return sym_matches_keywords(sym);
+   }
+   else
+   {
+   return sym_matches_atom(sym);
+   }
+
+}
+
+bool FindQuery::sym_matches_atom(struct symbol *sym)
+{
+   return (string_matches(sym->name) ||
+   (sym->prop &&
+sym->prop->menu &&
+string_matches(sym->prop->menu->help)
+   ));
+}
+
+bool FindQuery::sym_matches_keywords(struct symbol *sym)
+{
+   QValueList::iterator it;
+
+   for ( it = keywords.begin(); it != keywords.end(); ++it )
+   {
+   if (!(string_matches_regex(*it, sym->name)
+   ||
+   (sym->prop &&
+sy

[PATCH 2.6.23-rc4] qconf (make xconfig) Search Dialog Enhancement (rev8)

2007-09-14 Thread Shlomi Fish
Hi all!

[ I'm not subscribed to this list so please CC me on your replies. ]

This patch adds an option to use either substring match, regular expression 
match, or keywords search in the make xconfig Edit-Find dialog.

It also allows searching on the help field of the menus as well as 
the name of the symbol.

This change involved adding the sym_generic_search function to the LKC, and 
implementing sym_re_search using it.

Regards,

Shlomi Fish

--- linux-2.6.23-rc4/scripts/kconfig/qconf.cc.orig  2007-09-01 
21:15:39.017466409 +0300
+++ linux-2.6.23-rc4/scripts/kconfig/qconf.cc   2007-09-08 11:29:31.357869409 
+0300
@@ -1199,6 +1199,23 @@
layout2-addWidget(searchButton);
layout1-addLayout(layout2);
 
+   // Initialize the Search Type button group.
+   searchType = new QVButtonGroup(Search Type, this, searchType);
+
+   substringSearch = new QRadioButton(
+   Substring Match, searchType, Substring Match
+   );
+
+   keywordsSearch = new QRadioButton(Keywords, searchType, Keywords);
+
+   regexSearch = new QRadioButton(
+   Regular Expression, searchType, Regular Expression
+   );
+
+   substringSearch-setChecked(TRUE);
+   layout1-addWidget(searchType);
+
+   // Initialize the ConfigView and ConfigInfoView
split = new QSplitter(this);
split-setOrientation(QSplitter::Vertical);
list = new ConfigView(split, name);
@@ -1245,6 +1262,20 @@
}
 }
 
+SEARCH_TYPE ConfigSearchWindow::getSearchType()
+{
+   return  substringSearch-isChecked() ? SUBSTRING :
+   regexSearch-isChecked() ? REGEX :
+   KEYWORDS;
+}
+
+
+static int search_filter(struct symbol *sym, void *context)
+{
+   FindQuery *query = (FindQuery *)context;
+   return query-sym_matches(sym);
+}
+
 void ConfigSearchWindow::search(void)
 {
struct symbol **p;
@@ -1255,7 +1286,9 @@
list-list-clear();
info-clear();
 
-   result = sym_re_search(editField-text().latin1());
+   FindQuery query(editField-text(), getSearchType());
+
+   result = sym_generic_search(search_filter, (void *)query);
if (!result)
return;
for (p = result; *p; p++) {
@@ -1265,6 +1298,114 @@
}
 }
 
+FindQuery::FindQuery(QString q, SEARCH_TYPE t, bool a_case) :
+   query(q), search_type(t), case_sensitive(a_case)
+{
+   compiled_regex = NULL;
+   if (search_type == REGEX)
+   {
+   compiled_regex = new QRegExp(query, case_sensitive);
+   }
+   else if (search_type == KEYWORDS)
+   {
+   compile_keywords();
+   }
+}
+
+void FindQuery::compile_keywords()
+{
+   QRegExp split_words(\\s+);
+   QStringList bare_words = QStringList::split(split_words, query);
+
+   QStringList::iterator it;
+   for ( it = bare_words.begin(); it != bare_words.end(); ++it )
+   {
+   QString escaped = QRegExp::escape(*it);
+   
+   keywords.append(QRegExp(QString(\\b) + escaped + \\b));
+   }
+}
+
+FindQuery::~FindQuery()
+{
+   if (compiled_regex)
+   {
+   delete compiled_regex;
+   compiled_regex = NULL;
+   }
+}
+
+bool FindQuery::string_matches_regex(QRegExp  re, const char *string)
+{
+   QString qs(string);
+
+   return (re.search(qs) = 0);
+}
+
+bool FindQuery::string_matches(const char *string)
+{
+   QString qs(string);
+
+   if (search_type == SUBSTRING)
+   {
+   return qs.contains(query, case_sensitive);
+   }
+   else if (search_type == REGEX)
+   {
+   return string_matches_regex(*compiled_regex, string);
+   }
+   else
+   {
+   return false;
+   }
+}
+
+bool FindQuery::sym_matches(struct symbol *sym)
+{
+   if (!sym)
+   {
+   return false;
+   }
+
+   if (search_type == KEYWORDS)
+   {
+   return sym_matches_keywords(sym);
+   }
+   else
+   {
+   return sym_matches_atom(sym);
+   }
+
+}
+
+bool FindQuery::sym_matches_atom(struct symbol *sym)
+{
+   return (string_matches(sym-name) ||
+   (sym-prop 
+sym-prop-menu 
+string_matches(sym-prop-menu-help)
+   ));
+}
+
+bool FindQuery::sym_matches_keywords(struct symbol *sym)
+{
+   QValueListQRegExp::iterator it;
+
+   for ( it = keywords.begin(); it != keywords.end(); ++it )
+   {
+   if (!(string_matches_regex(*it, sym-name)
+   ||
+   (sym-prop 
+sym-prop-menu 
+string_matches_regex(*it, sym-prop-menu-help
+   {
+   return false;
+   }
+   }
+
+   return true;
+}
+
 /*
  * Construct the complete config widget
  */
--- linux-2.6.23-rc4/scripts/kconfig/qconf.h.orig

[PATCH 2.6.23-rc4] qconf ("make xconfig") Search Dialog Enhancement

2007-09-01 Thread Shlomi Fish
Hi all!

[ I'm not subscribed to this list so please CC me on your replies. ]

This patch is against kernel-2.6.23-rc4, and aims to enhance the "make 
xconfig" search dialog. At the moment what it does is allow searching on 
the "help" field of the menus as well as the "name" of the symbol. Try 
searching for "you will get a watchdog" before and after the patch to see 
what I mean.

I'm next planning to add a radio button for choosing between regex match and 
substring match, as well as implement keywords search.

This change involved adding the sym_generic_search function to the LKC, and 
implementing sym_re_search using it.

Regards,

Shlomi Fish

-----
Shlomi Fish  [EMAIL PROTECTED]
Homepage:http://www.shlomifish.org/

If it's not in my E-mail it doesn't happen. And if my E-mail is saying
one thing, and everything else says something else - E-mail will conquer.
-- An Israeli Linuxer
-- 

-----
Shlomi Fish  [EMAIL PROTECTED]
Homepage:http://www.shlomifish.org/

If it's not in my E-mail it doesn't happen. And if my E-mail is saying
one thing, and everything else says something else - E-mail will conquer.
-- An Israeli Linuxer
--- linux-2.6.23-rc4/scripts/kconfig/qconf.cc.orig	2007-09-01 21:15:39.017466409 +0300
+++ linux-2.6.23-rc4/scripts/kconfig/qconf.cc	2007-09-01 22:54:14.099825858 +0300
@@ -1245,6 +1245,12 @@
 	}
 }
 
+static int search_filter(struct symbol *sym, void *context)
+{
+	FindQuery *query = (FindQuery *)context;
+	return query->sym_matches(sym);
+}
+
 void ConfigSearchWindow::search(void)
 {
 	struct symbol **p;
@@ -1255,7 +1261,9 @@
 	list->list->clear();
 	info->clear();
 
-	result = sym_re_search(editField->text().latin1());
+	FindQuery query(editField->text(), REGEX);
+
+	result = sym_generic_search(search_filter, (void *));
 	if (!result)
 		return;
 	for (p = result; *p; p++) {
@@ -1265,6 +1273,57 @@
 	}
 }
 
+FindQuery::FindQuery(QString q, SEARCH_TYPE t, bool a_case) :
+	query(q), search_type(t), case_sensitive(a_case)
+{
+	compiled_regex = NULL;
+	if (search_type == REGEX)
+	{
+		compiled_regex = new QRegExp(query, case_sensitive);
+	}
+}
+
+FindQuery::~FindQuery()
+{
+	if (compiled_regex)
+	{
+		delete compiled_regex;
+		compiled_regex = NULL;
+	}
+}
+
+bool FindQuery::string_matches(const char *string)
+{
+	QString qs(string);
+
+	if (search_type == SUBSTRING)
+	{
+		return qs.contains(query, case_sensitive);
+	}
+	else if (search_type == REGEX)
+	{
+		return (compiled_regex->search(qs) >= 0);
+	}
+	else
+	{
+		return false;
+	}
+}
+
+bool FindQuery::sym_matches(struct symbol *sym)
+{
+	if (!sym)
+	{
+		return false;
+	}
+
+	return (string_matches(sym->name) ||
+		(sym->prop &&
+		 sym->prop->menu &&
+		 string_matches(sym->prop->menu->help)
+		));
+}
+
 /*
  * Construct the complete config widget
  */
--- linux-2.6.23-rc4/scripts/kconfig/qconf.h.orig	2007-09-01 21:15:33.537030610 +0300
+++ linux-2.6.23-rc4/scripts/kconfig/qconf.h	2007-09-01 21:51:07.786743297 +0300
@@ -332,3 +332,21 @@
 	QSplitter* split1;
 	QSplitter* split2;
 };
+
+enum SEARCH_TYPE { SUBSTRING, KEYWORDS, REGEX };
+class FindQuery
+{
+	public:
+	bool case_sensitive;
+	SEARCH_TYPE search_type;
+	QString query;
+	QRegExp * compiled_regex;
+
+	public:
+	FindQuery() : query("") { case_sensitive = false; search_type = SUBSTRING; }
+	FindQuery(QString q, SEARCH_TYPE t, bool a_case = false);
+	~FindQuery();
+	bool string_matches(const char *);
+	bool sym_matches(struct symbol *sym);
+};
+
--- linux-2.6.23-rc4/scripts/kconfig/lkc.h.orig	2007-09-01 19:56:36.528350007 +0300
+++ linux-2.6.23-rc4/scripts/kconfig/lkc.h	2007-09-01 19:57:57.758809341 +0300
@@ -111,6 +111,9 @@
 struct property *prop_alloc(enum prop_type type, struct symbol *sym);
 struct symbol *prop_get_symbol(struct property *prop);
 
+typedef int (*sym_search_filter_t)(struct symbol *sym, void *context);
+struct symbol **sym_generic_search(sym_search_filter_t filter, void *context);
+
 static inline tristate sym_get_tristate_value(struct symbol *sym)
 {
 	return sym->curr.tri;
--- linux-2.6.23-rc4/scripts/kconfig/symbol.c.orig	2007-09-01 21:24:07.885930947 +0300
+++ linux-2.6.23-rc4/scripts/kconfig/symbol.c	2007-09-01 20:41:58.420791258 +0300
@@ -717,23 +717,39 @@
 	return symbol;
 }
 
+static int re_search_filter(struct symbol *sym, void *re_void)
+{
+	return (regexec((regex_t*)re_void, sym->name, 0, NULL, 0) == 0);
+}
+
 struct symbol **sym_re_search(const char *pattern)
 {
-	struct symbol *sym, **sym_arr = NULL;
-	int i, cnt, size;
 	regex_t re;
+	struct symbol **results;
 
-	cnt = size = 0;
-	/* Skip if empty */
 	if (strlen(pattern) == 0)
 		return NULL;
 	if (regcomp(, pattern, REG_EXTENDED|REG_NOSUB|REG_ICASE))
 		return NULL;
 
+	results = sym_generic_search(re_sear

[PATCH 2.6.23-rc4] qconf (make xconfig) Search Dialog Enhancement

2007-09-01 Thread Shlomi Fish
Hi all!

[ I'm not subscribed to this list so please CC me on your replies. ]

This patch is against kernel-2.6.23-rc4, and aims to enhance the make 
xconfig search dialog. At the moment what it does is allow searching on 
the help field of the menus as well as the name of the symbol. Try 
searching for you will get a watchdog before and after the patch to see 
what I mean.

I'm next planning to add a radio button for choosing between regex match and 
substring match, as well as implement keywords search.

This change involved adding the sym_generic_search function to the LKC, and 
implementing sym_re_search using it.

Regards,

Shlomi Fish

-
Shlomi Fish  [EMAIL PROTECTED]
Homepage:http://www.shlomifish.org/

If it's not in my E-mail it doesn't happen. And if my E-mail is saying
one thing, and everything else says something else - E-mail will conquer.
-- An Israeli Linuxer
-- 

-
Shlomi Fish  [EMAIL PROTECTED]
Homepage:http://www.shlomifish.org/

If it's not in my E-mail it doesn't happen. And if my E-mail is saying
one thing, and everything else says something else - E-mail will conquer.
-- An Israeli Linuxer
--- linux-2.6.23-rc4/scripts/kconfig/qconf.cc.orig	2007-09-01 21:15:39.017466409 +0300
+++ linux-2.6.23-rc4/scripts/kconfig/qconf.cc	2007-09-01 22:54:14.099825858 +0300
@@ -1245,6 +1245,12 @@
 	}
 }
 
+static int search_filter(struct symbol *sym, void *context)
+{
+	FindQuery *query = (FindQuery *)context;
+	return query-sym_matches(sym);
+}
+
 void ConfigSearchWindow::search(void)
 {
 	struct symbol **p;
@@ -1255,7 +1261,9 @@
 	list-list-clear();
 	info-clear();
 
-	result = sym_re_search(editField-text().latin1());
+	FindQuery query(editField-text(), REGEX);
+
+	result = sym_generic_search(search_filter, (void *)query);
 	if (!result)
 		return;
 	for (p = result; *p; p++) {
@@ -1265,6 +1273,57 @@
 	}
 }
 
+FindQuery::FindQuery(QString q, SEARCH_TYPE t, bool a_case) :
+	query(q), search_type(t), case_sensitive(a_case)
+{
+	compiled_regex = NULL;
+	if (search_type == REGEX)
+	{
+		compiled_regex = new QRegExp(query, case_sensitive);
+	}
+}
+
+FindQuery::~FindQuery()
+{
+	if (compiled_regex)
+	{
+		delete compiled_regex;
+		compiled_regex = NULL;
+	}
+}
+
+bool FindQuery::string_matches(const char *string)
+{
+	QString qs(string);
+
+	if (search_type == SUBSTRING)
+	{
+		return qs.contains(query, case_sensitive);
+	}
+	else if (search_type == REGEX)
+	{
+		return (compiled_regex-search(qs) = 0);
+	}
+	else
+	{
+		return false;
+	}
+}
+
+bool FindQuery::sym_matches(struct symbol *sym)
+{
+	if (!sym)
+	{
+		return false;
+	}
+
+	return (string_matches(sym-name) ||
+		(sym-prop 
+		 sym-prop-menu 
+		 string_matches(sym-prop-menu-help)
+		));
+}
+
 /*
  * Construct the complete config widget
  */
--- linux-2.6.23-rc4/scripts/kconfig/qconf.h.orig	2007-09-01 21:15:33.537030610 +0300
+++ linux-2.6.23-rc4/scripts/kconfig/qconf.h	2007-09-01 21:51:07.786743297 +0300
@@ -332,3 +332,21 @@
 	QSplitter* split1;
 	QSplitter* split2;
 };
+
+enum SEARCH_TYPE { SUBSTRING, KEYWORDS, REGEX };
+class FindQuery
+{
+	public:
+	bool case_sensitive;
+	SEARCH_TYPE search_type;
+	QString query;
+	QRegExp * compiled_regex;
+
+	public:
+	FindQuery() : query() { case_sensitive = false; search_type = SUBSTRING; }
+	FindQuery(QString q, SEARCH_TYPE t, bool a_case = false);
+	~FindQuery();
+	bool string_matches(const char *);
+	bool sym_matches(struct symbol *sym);
+};
+
--- linux-2.6.23-rc4/scripts/kconfig/lkc.h.orig	2007-09-01 19:56:36.528350007 +0300
+++ linux-2.6.23-rc4/scripts/kconfig/lkc.h	2007-09-01 19:57:57.758809341 +0300
@@ -111,6 +111,9 @@
 struct property *prop_alloc(enum prop_type type, struct symbol *sym);
 struct symbol *prop_get_symbol(struct property *prop);
 
+typedef int (*sym_search_filter_t)(struct symbol *sym, void *context);
+struct symbol **sym_generic_search(sym_search_filter_t filter, void *context);
+
 static inline tristate sym_get_tristate_value(struct symbol *sym)
 {
 	return sym-curr.tri;
--- linux-2.6.23-rc4/scripts/kconfig/symbol.c.orig	2007-09-01 21:24:07.885930947 +0300
+++ linux-2.6.23-rc4/scripts/kconfig/symbol.c	2007-09-01 20:41:58.420791258 +0300
@@ -717,23 +717,39 @@
 	return symbol;
 }
 
+static int re_search_filter(struct symbol *sym, void *re_void)
+{
+	return (regexec((regex_t*)re_void, sym-name, 0, NULL, 0) == 0);
+}
+
 struct symbol **sym_re_search(const char *pattern)
 {
-	struct symbol *sym, **sym_arr = NULL;
-	int i, cnt, size;
 	regex_t re;
+	struct symbol **results;
 
-	cnt = size = 0;
-	/* Skip if empty */
 	if (strlen(pattern) == 0)
 		return NULL;
 	if (regcomp(re, pattern, REG_EXTENDED|REG_NOSUB|REG_ICASE))
 		return NULL;
 
+	results = sym_generic_search(re_search_filter, (void *)re);
+
+	regfree(re);
+
+	return results;
+}
+
+struct symbol **sym_generic_search(sym_search_filter_t filter, void *context

[Meta] The Linus Bus Factor

2007-03-28 Thread Shlomi Fish
, the scape goat, the
ultimate authority, and lots of other roles that he defaults to play. This is
unhealthy for the project.

It is known that Solon ( http://en.wikipedia.org/wiki/Solon ) said he was
leaving Athens for a trip around the world, in the midst of his reform for
several years. But he in fact moved to a nearby Island where he observed
by proxy how they managed without him. Without being an insider of the Linux
kernel mailing list, I believe Linus voluntarily leaving will have a positive
effect.

At the moment everyone default to Linus, but if he "hit himself with a bus",
they'll have to manage without him. This will eventually lead to a better
internal organisation, and a much more robust solution. There might be a
different benevolent dictator. There might be a central git repository with
many committers. There might be something. But it will be better than it is
today.

I hate the term "benevolent dictator *for life*", because it assumes the person
cannot be overthrown or that there cannot be a mutiny (my term for coup)
against him. A benevolent dictator in the free software world must not be for
life because he may not be the best solution for ever.

Now that I think of it, I find it said that people think of the Linux kernel
project as "Linus Torvalds' baby". Compare it to KDE which is a large amorphous
meta-project, with no-one known in particular, to Subversion, which while
having many prominent contributors has no poster child. And then there's Perl,
which while Larry Wall is its undoubted demi-god, has many other prominent
figures.

Of course, like I said, you can do a mutiny without asking Linus, by starting
out a central repository for the kernel with many commiters. If this works,
then this repository may eventually become the de-facto kernel (and Linus
would no longer be the benevolent dictator). If it won't work, then we're not
better off, but very little time was wasted.

Linus *can* resign willingly, which may be even more desirable. However, the
Linux kernel is a FOSS project after all, and if you don't like something, you
can always fork it, or at least create your own branch, patchset, etc. in the
version control repository.

Let the flames begin!

Regards,

   Shlomi Fish

[1] - http://www.shlomifish.org/philosophy/computers/perl/perl6-critique/


--
Shlomi Fish http://www.shlomifish.org/

Electrical Engineering studies. In the Technion. Been there. Done
that. Forgot a lot. Remember too much.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[Meta] The Linus Bus Factor

2007-03-28 Thread Shlomi Fish
, and lots of other roles that he defaults to play. This is
unhealthy for the project.

It is known that Solon ( http://en.wikipedia.org/wiki/Solon ) said he was
leaving Athens for a trip around the world, in the midst of his reform for
several years. But he in fact moved to a nearby Island where he observed
by proxy how they managed without him. Without being an insider of the Linux
kernel mailing list, I believe Linus voluntarily leaving will have a positive
effect.

At the moment everyone default to Linus, but if he hit himself with a bus,
they'll have to manage without him. This will eventually lead to a better
internal organisation, and a much more robust solution. There might be a
different benevolent dictator. There might be a central git repository with
many committers. There might be something. But it will be better than it is
today.

I hate the term benevolent dictator *for life*, because it assumes the person
cannot be overthrown or that there cannot be a mutiny (my term for coup)
against him. A benevolent dictator in the free software world must not be for
life because he may not be the best solution for ever.

Now that I think of it, I find it said that people think of the Linux kernel
project as Linus Torvalds' baby. Compare it to KDE which is a large amorphous
meta-project, with no-one known in particular, to Subversion, which while
having many prominent contributors has no poster child. And then there's Perl,
which while Larry Wall is its undoubted demi-god, has many other prominent
figures.

Of course, like I said, you can do a mutiny without asking Linus, by starting
out a central repository for the kernel with many commiters. If this works,
then this repository may eventually become the de-facto kernel (and Linus
would no longer be the benevolent dictator). If it won't work, then we're not
better off, but very little time was wasted.

Linus *can* resign willingly, which may be even more desirable. However, the
Linux kernel is a FOSS project after all, and if you don't like something, you
can always fork it, or at least create your own branch, patchset, etc. in the
version control repository.

Let the flames begin!

Regards,

   Shlomi Fish

[1] - http://www.shlomifish.org/philosophy/computers/perl/perl6-critique/


--
Shlomi Fish http://www.shlomifish.org/

Electrical Engineering studies. In the Technion. Been there. Done
that. Forgot a lot. Remember too much.
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2.6.20-rc4] qconf Reloate Search Command

2007-01-11 Thread Shlomi Fish
Hi all!

[ I'm not subscribed to this list so please CC me on your replies. ]

This is a patch that relocates the qconf search command to the "Edit"->"Find" 
menu option.

This is per the discussion on my qconf search dialog patch.

The patch was tested against kernel 2.6.20-rc4.

Enjoy!

Regards,

Shlomi Fish

---------
Shlomi Fish  [EMAIL PROTECTED]
Homepage:http://www.shlomifish.org/

Chuck Norris wrote a complete Perl 6 implementation in a day but then
destroyed all evidence with his bare hands, so no one will know his secrets.
--- linux-2.6.20-rc4/scripts/kconfig/qconf.cc.orig	2007-01-11 15:51:29.232975750 +0200
+++ linux-2.6.20-rc4/scripts/kconfig/qconf.cc	2007-01-11 16:01:02.897667032 +0200
@@ -1323,7 +1323,7 @@
 	conf_changed();
 	QAction *saveAsAction = new QAction("Save As...", "Save ", 0, this);
 	  connect(saveAsAction, SIGNAL(activated()), SLOT(saveConfigAs()));
-	QAction *searchAction = new QAction("Search", "", CTRL+Key_F, this);
+	QAction *searchAction = new QAction("Find", "", CTRL+Key_F, this);
 	  connect(searchAction, SIGNAL(activated()), SLOT(searchConfig()));
 	QAction *singleViewAction = new QAction("Single View", QPixmap(xpm_single_view), "Split View", 0, this);
 	  connect(singleViewAction, SIGNAL(activated()), SLOT(showSingleView()));
@@ -1380,10 +1380,13 @@
 	saveAction->addTo(config);
 	saveAsAction->addTo(config);
 	config->insertSeparator();
-	searchAction->addTo(config);
-	config->insertSeparator();
 	quitAction->addTo(config);
 
+	// create edit menu
+	QPopupMenu* editMenu = new QPopupMenu(this);
+	menu->insertItem("", editMenu);
+	searchAction->addTo(editMenu);
+
 	// create options menu
 	QPopupMenu* optionMenu = new QPopupMenu(this);
 	menu->insertItem("", optionMenu);


[PATCH 2.6.20-rc4] qconf Reloate Search Command

2007-01-11 Thread Shlomi Fish
Hi all!

[ I'm not subscribed to this list so please CC me on your replies. ]

This is a patch that relocates the qconf search command to the Edit-Find 
menu option.

This is per the discussion on my qconf search dialog patch.

The patch was tested against kernel 2.6.20-rc4.

Enjoy!

Regards,

Shlomi Fish

-
Shlomi Fish  [EMAIL PROTECTED]
Homepage:http://www.shlomifish.org/

Chuck Norris wrote a complete Perl 6 implementation in a day but then
destroyed all evidence with his bare hands, so no one will know his secrets.
--- linux-2.6.20-rc4/scripts/kconfig/qconf.cc.orig	2007-01-11 15:51:29.232975750 +0200
+++ linux-2.6.20-rc4/scripts/kconfig/qconf.cc	2007-01-11 16:01:02.897667032 +0200
@@ -1323,7 +1323,7 @@
 	conf_changed();
 	QAction *saveAsAction = new QAction(Save As..., Save As..., 0, this);
 	  connect(saveAsAction, SIGNAL(activated()), SLOT(saveConfigAs()));
-	QAction *searchAction = new QAction(Search, Search, CTRL+Key_F, this);
+	QAction *searchAction = new QAction(Find, Find, CTRL+Key_F, this);
 	  connect(searchAction, SIGNAL(activated()), SLOT(searchConfig()));
 	QAction *singleViewAction = new QAction(Single View, QPixmap(xpm_single_view), Split View, 0, this);
 	  connect(singleViewAction, SIGNAL(activated()), SLOT(showSingleView()));
@@ -1380,10 +1380,13 @@
 	saveAction-addTo(config);
 	saveAsAction-addTo(config);
 	config-insertSeparator();
-	searchAction-addTo(config);
-	config-insertSeparator();
 	quitAction-addTo(config);
 
+	// create edit menu
+	QPopupMenu* editMenu = new QPopupMenu(this);
+	menu-insertItem(Edit, editMenu);
+	searchAction-addTo(editMenu);
+
 	// create options menu
 	QPopupMenu* optionMenu = new QPopupMenu(this);
 	menu-insertItem(Option, optionMenu);


Re: [PATCH 2.6.20-rc3] qconf Search Dialog

2007-01-05 Thread Shlomi Fish
On Wednesday 03 January 2007 23:05, Sam Ravnborg wrote:
> On Wed, Jan 03, 2007 at 10:01:28PM +0200, Shlomi Fish wrote:
> > Interesting. I didn't notice this search dialog before because its menu
> > item was placed in the "File" menu, which is the wrong place for a find
> > command (Which should be in an "Edit" or "Search" menu). I believe others
> > have missed it as well. Also, it is possible it wasn't available when I
> > wrote the preliminary version of the patch back in March.
> >
> > Aside from that my search dialog has some advantages:
> >
> > 1. Full text search - if you search for "available" in File->Search you
> > won't find anything. Searching for it in Edit->Find will find many
> > things. I think File->Search only searches using the identifiers or at
> > most also the title.
> >
> > 2. Regular expression search.
> >
> > 3. Displaying the results in a tree, with their context.
> >
> > All that said, I don't mind merging my modifications into the existing
> > code, or replacing it entirely.
>
> Please merge the best of the existing and the new search dialog.
>

OK.

> I would prefer it as separate smaller steps.
> So one patch where you move the dialog and another where you improve
> the search dialog.
>

Move the dialog from where, to where, and in what respect?

Regards,

Shlomi Fish

-
Shlomi Fish  [EMAIL PROTECTED]
Homepage:http://www.shlomifish.org/

Chuck Norris wrote a complete Perl 6 implementation in a day but then
destroyed all evidence with his bare hands, so no one will know his secrets.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2.6.20-rc3] qconf Search Dialog

2007-01-05 Thread Shlomi Fish
On Wednesday 03 January 2007 23:05, Sam Ravnborg wrote:
 On Wed, Jan 03, 2007 at 10:01:28PM +0200, Shlomi Fish wrote:
  Interesting. I didn't notice this search dialog before because its menu
  item was placed in the File menu, which is the wrong place for a find
  command (Which should be in an Edit or Search menu). I believe others
  have missed it as well. Also, it is possible it wasn't available when I
  wrote the preliminary version of the patch back in March.
 
  Aside from that my search dialog has some advantages:
 
  1. Full text search - if you search for available in File-Search you
  won't find anything. Searching for it in Edit-Find will find many
  things. I think File-Search only searches using the identifiers or at
  most also the title.
 
  2. Regular expression search.
 
  3. Displaying the results in a tree, with their context.
 
  All that said, I don't mind merging my modifications into the existing
  code, or replacing it entirely.

 Please merge the best of the existing and the new search dialog.


OK.

 I would prefer it as separate smaller steps.
 So one patch where you move the dialog and another where you improve
 the search dialog.


Move the dialog from where, to where, and in what respect?

Regards,

Shlomi Fish

-
Shlomi Fish  [EMAIL PROTECTED]
Homepage:http://www.shlomifish.org/

Chuck Norris wrote a complete Perl 6 implementation in a day but then
destroyed all evidence with his bare hands, so no one will know his secrets.
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2.6.20-rc3] qconf Search Dialog

2007-01-03 Thread Shlomi Fish
On Wednesday 03 January 2007 19:54, Randy Dunlap wrote:
> On Wed, 3 Jan 2007 19:54:36 +0200 Shlomi Fish wrote:
> > Hi all!
> >
> > [ I'm not subscribed to this list so please CC me on your replies. ]
> >
> > This is a new version of the patch that adds a search dialog to the
> > kernel's "make xconfig" configuration applet.
>
> Would you just clarify one thing, please.
> xconfig already has a search dialog.  Does this one replace it
> or fix it or what?

Interesting. I didn't notice this search dialog before because its menu item 
was placed in the "File" menu, which is the wrong place for a find command 
(Which should be in an "Edit" or "Search" menu). I believe others have missed 
it as well. Also, it is possible it wasn't available when I wrote the 
preliminary version of the patch back in March.

Aside from that my search dialog has some advantages:

1. Full text search - if you search for "available" in File->Search you won't 
find anything. Searching for it in Edit->Find will find many things. I think 
File->Search only searches using the identifiers or at most also the title.

2. Regular expression search.

3. Displaying the results in a tree, with their context.

All that said, I don't mind merging my modifications into the existing code, 
or replacing it entirely.

Regards,

Shlomi Fish

>
> Thanks.
>
> > Changes in this release include:
> >
> > 1. Implemented regular expression querying. The GUI includes an option
> > for a keywords based query, which is not supported yet.
> >
> > 2. Fixed the fact that the top categories in the QListView do not have a
> > visible
> > [+] sign next to them to expand them. (Albeit they are expanded upon a
> > double click).
> >
> > 3. Now resizing the dialog to a larger default size.
> >
> > To do is:
> >
> > 1. Make sure double clicking an end-item opens and highlights it in the
> > main application.
> >
> > 2. Eliminate the weird black-outlined rectangle that appears in the
> > top-left corner of the dialog.
> >
> > 
> >
> > The patch was tested against kernel 2.6.20-rc3.

-
Shlomi Fish  [EMAIL PROTECTED]
Homepage:http://www.shlomifish.org/

Chuck Norris wrote a complete Perl 6 implementation in a day but then
destroyed all evidence with his bare hands, so no one will know his secrets.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2.6.20-rc3] qconf Search Dialog

2007-01-03 Thread Shlomi Fish
Hi all!

[ I'm not subscribed to this list so please CC me on your replies. ]

This is a new version of the patch that adds a search dialog to the 
kernel's "make xconfig" configuration applet.

Changes in this release include:

1. Implemented regular expression querying. The GUI includes an option for a 
keywords based query, which is not supported yet.

2. Fixed the fact that the top categories in the QListView do not have a 
visible 
[+] sign next to them to expand them. (Albeit they are expanded upon a double 
click).

3. Now resizing the dialog to a larger default size.

To do is:

1. Make sure double clicking an end-item opens and highlights it in the main 
application.

2. Eliminate the weird black-outlined rectangle that appears in the top-left 
corner of the dialog.



The patch was tested against kernel 2.6.20-rc3.

Enjoy!

Regards,

    Shlomi Fish

-----
Shlomi Fish  [EMAIL PROTECTED]
Homepage:http://www.shlomifish.org/

Chuck Norris wrote a complete Perl 6 implementation in a day but then
destroyed all evidence with his bare hands, so no one will know his secrets.
--- linux-2.6.20-rc3/scripts/kconfig/qconf.cc.orig	2007-01-01 22:06:27.995620083 +0200
+++ linux-2.6.20-rc3/scripts/kconfig/qconf.cc	2007-01-03 19:50:56.569683217 +0200
@@ -21,8 +21,13 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
+#include 
 
 #include 
+#include 
 
 #include "lkc.h"
 #include "qconf.h"
@@ -1323,6 +1328,8 @@
 	  connect(splitViewAction, SIGNAL(activated()), SLOT(showSplitView()));
 	QAction *fullViewAction = new QAction("Full View", QPixmap(xpm_tree_view), "Full View", 0, this);
 	  connect(fullViewAction, SIGNAL(activated()), SLOT(showFullView()));
+	QAction *findAction = new QAction("Find", QPixmap(xpm_save), "", CTRL+Key_F, this);
+	  connect(findAction, SIGNAL(activated()), SLOT(findEntries()));
 
 	QAction *showNameAction = new QAction(NULL, "Show Name", 0, this);
 	  showNameAction->setToggleAction(TRUE);
@@ -1376,6 +1383,11 @@
 	config->insertSeparator();
 	quitAction->addTo(config);
 
+	// create file menu
+	QPopupMenu* editMenu = new QPopupMenu(this);
+	menu->insertItem("", editMenu);
+	findAction->addTo(editMenu);
+
 	// create options menu
 	QPopupMenu* optionMenu = new QPopupMenu(this);
 	menu->insertItem("", optionMenu);
@@ -1447,6 +1459,300 @@
 		QMessageBox::information(this, "qconf", "Unable to save configuration!");
 }
 
+
+FindDialog::FindDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
+	: QDialog( parent, name, modal, fl )
+{
+	main_layout = new QVBoxLayout(this, 11, 6, "main_layout");
+	main_layout->addWidget(new QLabel("Query:", this, "label1"));
+	queryLineEdit = new QLineEdit(this, "queryLineEdit");
+	main_layout->addWidget(queryLineEdit);
+	findButton = new QPushButton("Find", this, "findButton");
+	main_layout->addWidget(findButton);
+	connect( findButton, SIGNAL( clicked() ), this, SLOT( performQuery() ) );
+	search_type = new QButtonGroup(this, "search_type");
+
+	substring = new QRadioButton("Substring Match", this, "Substring Match");
+	search_type->insert(substring);
+	main_layout->addWidget(substring);
+
+	keywords = new QRadioButton("Keywords", this, "Keywords");
+	search_type->insert(keywords);
+	main_layout->addWidget(keywords);
+
+	regex = new QRadioButton("Regular Expression", this, "Regular Expression");
+	search_type->insert(regex);
+	main_layout->addWidget(regex);
+
+	substring->setChecked(TRUE);
+
+	results = new QListView(this, "results");
+	results->setRootIsDecorated(TRUE);
+	results->addColumn("Item");
+	main_layout->addWidget(results);
+
+	resize(QSize(500,400));
+}
+
+FindDialog::~FindDialog()
+{
+}
+
+static QString * get_parent_disp(struct menu * menu)
+{
+	QString s;
+	if (menu->sym)
+	{
+		if (menu->prompt)
+		{
+			s += menu->prompt->text;
+			if (menu->sym->name)
+			{
+s += " (";
+s += menu->sym->name;
+s += ")";
+			}
+		}
+		else if (menu->sym->name)
+		{
+			s += menu->sym->name;
+		}
+	}
+	else if (menu->prompt)
+	{
+		s += menu->prompt->text;
+	}
+	return new QString(s);
+}
+
+QString * get_parent_string(struct menu * menu, int depth)
+{
+	QString * parent_disp = get_parent_disp(menu);
+	QString s;
+
+	/*
+	 * Append 'depth' tabs.
+	 * */
+	for(int i=0;ibegin(); it != parents->end() ; ++it, ++depth)
+	{
+		QString * parent_string = get_parent_string(*it, depth);
+		*item += *parent_string;
+		delete parent_string;
+	}
+#endif
+
+	QString * string = get_parent_string(mymenu, depth);
+	*item += *string;
+	delete string;
+
+	return 

[PATCH 2.6.20-rc3] qconf Search Dialog

2007-01-03 Thread Shlomi Fish
Hi all!

[ I'm not subscribed to this list so please CC me on your replies. ]

This is a new version of the patch that adds a search dialog to the 
kernel's make xconfig configuration applet.

Changes in this release include:

1. Implemented regular expression querying. The GUI includes an option for a 
keywords based query, which is not supported yet.

2. Fixed the fact that the top categories in the QListView do not have a 
visible 
[+] sign next to them to expand them. (Albeit they are expanded upon a double 
click).

3. Now resizing the dialog to a larger default size.

To do is:

1. Make sure double clicking an end-item opens and highlights it in the main 
application.

2. Eliminate the weird black-outlined rectangle that appears in the top-left 
corner of the dialog.



The patch was tested against kernel 2.6.20-rc3.

Enjoy!

Regards,

Shlomi Fish

-
Shlomi Fish  [EMAIL PROTECTED]
Homepage:http://www.shlomifish.org/

Chuck Norris wrote a complete Perl 6 implementation in a day but then
destroyed all evidence with his bare hands, so no one will know his secrets.
--- linux-2.6.20-rc3/scripts/kconfig/qconf.cc.orig	2007-01-01 22:06:27.995620083 +0200
+++ linux-2.6.20-rc3/scripts/kconfig/qconf.cc	2007-01-03 19:50:56.569683217 +0200
@@ -21,8 +21,13 @@
 #include qfiledialog.h
 #include qdragobject.h
 #include qregexp.h
+#include qdialog.h
+#include qlayout.h
+#include qlabel.h
+#include qpushbutton.h
 
 #include stdlib.h
+#include stdio.h
 
 #include lkc.h
 #include qconf.h
@@ -1323,6 +1328,8 @@
 	  connect(splitViewAction, SIGNAL(activated()), SLOT(showSplitView()));
 	QAction *fullViewAction = new QAction(Full View, QPixmap(xpm_tree_view), Full View, 0, this);
 	  connect(fullViewAction, SIGNAL(activated()), SLOT(showFullView()));
+	QAction *findAction = new QAction(Find, QPixmap(xpm_save), Find, CTRL+Key_F, this);
+	  connect(findAction, SIGNAL(activated()), SLOT(findEntries()));
 
 	QAction *showNameAction = new QAction(NULL, Show Name, 0, this);
 	  showNameAction-setToggleAction(TRUE);
@@ -1376,6 +1383,11 @@
 	config-insertSeparator();
 	quitAction-addTo(config);
 
+	// create file menu
+	QPopupMenu* editMenu = new QPopupMenu(this);
+	menu-insertItem(Edit, editMenu);
+	findAction-addTo(editMenu);
+
 	// create options menu
 	QPopupMenu* optionMenu = new QPopupMenu(this);
 	menu-insertItem(Option, optionMenu);
@@ -1447,6 +1459,300 @@
 		QMessageBox::information(this, qconf, Unable to save configuration!);
 }
 
+
+FindDialog::FindDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
+	: QDialog( parent, name, modal, fl )
+{
+	main_layout = new QVBoxLayout(this, 11, 6, main_layout);
+	main_layout-addWidget(new QLabel(Query:, this, label1));
+	queryLineEdit = new QLineEdit(this, queryLineEdit);
+	main_layout-addWidget(queryLineEdit);
+	findButton = new QPushButton(Find, this, findButton);
+	main_layout-addWidget(findButton);
+	connect( findButton, SIGNAL( clicked() ), this, SLOT( performQuery() ) );
+	search_type = new QButtonGroup(this, search_type);
+
+	substring = new QRadioButton(Substring Match, this, Substring Match);
+	search_type-insert(substring);
+	main_layout-addWidget(substring);
+
+	keywords = new QRadioButton(Keywords, this, Keywords);
+	search_type-insert(keywords);
+	main_layout-addWidget(keywords);
+
+	regex = new QRadioButton(Regular Expression, this, Regular Expression);
+	search_type-insert(regex);
+	main_layout-addWidget(regex);
+
+	substring-setChecked(TRUE);
+
+	results = new QListView(this, results);
+	results-setRootIsDecorated(TRUE);
+	results-addColumn(Item);
+	main_layout-addWidget(results);
+
+	resize(QSize(500,400));
+}
+
+FindDialog::~FindDialog()
+{
+}
+
+static QString * get_parent_disp(struct menu * menu)
+{
+	QString s;
+	if (menu-sym)
+	{
+		if (menu-prompt)
+		{
+			s += menu-prompt-text;
+			if (menu-sym-name)
+			{
+s +=  (;
+s += menu-sym-name;
+s += );
+			}
+		}
+		else if (menu-sym-name)
+		{
+			s += menu-sym-name;
+		}
+	}
+	else if (menu-prompt)
+	{
+		s += menu-prompt-text;
+	}
+	return new QString(s);
+}
+
+QString * get_parent_string(struct menu * menu, int depth)
+{
+	QString * parent_disp = get_parent_disp(menu);
+	QString s;
+
+	/*
+	 * Append 'depth' tabs.
+	 * */
+	for(int i=0;idepth;i++)
+	{
+		s += \t;
+	}
+	s += *parent_disp;
+	s += \n;
+
+	delete parent_disp;
+
+	return new QString(s);
+}
+
+static QString * get_item_display(MenuList * parents, struct menu * mymenu)
+{
+	MenuList::iterator it;
+	QString * item;
+#if 0
+	int depth;
+#else
+	int depth=0;
+#endif
+
+	item = new QString();
+
+#if 0
+	for (depth=0, it = parents-begin(); it != parents-end() ; ++it, ++depth)
+	{
+		QString * parent_string = get_parent_string(*it, depth);
+		*item += *parent_string;
+		delete parent_string;
+	}
+#endif
+
+	QString * string = get_parent_string(mymenu, depth);
+	*item += *string;
+	delete string;
+
+	return item;
+}
+
+QListViewItem

Re: [PATCH 2.6.20-rc3] qconf Search Dialog

2007-01-03 Thread Shlomi Fish
On Wednesday 03 January 2007 19:54, Randy Dunlap wrote:
 On Wed, 3 Jan 2007 19:54:36 +0200 Shlomi Fish wrote:
  Hi all!
 
  [ I'm not subscribed to this list so please CC me on your replies. ]
 
  This is a new version of the patch that adds a search dialog to the
  kernel's make xconfig configuration applet.

 Would you just clarify one thing, please.
 xconfig already has a search dialog.  Does this one replace it
 or fix it or what?

Interesting. I didn't notice this search dialog before because its menu item 
was placed in the File menu, which is the wrong place for a find command 
(Which should be in an Edit or Search menu). I believe others have missed 
it as well. Also, it is possible it wasn't available when I wrote the 
preliminary version of the patch back in March.

Aside from that my search dialog has some advantages:

1. Full text search - if you search for available in File-Search you won't 
find anything. Searching for it in Edit-Find will find many things. I think 
File-Search only searches using the identifiers or at most also the title.

2. Regular expression search.

3. Displaying the results in a tree, with their context.

All that said, I don't mind merging my modifications into the existing code, 
or replacing it entirely.

Regards,

Shlomi Fish


 Thanks.

  Changes in this release include:
 
  1. Implemented regular expression querying. The GUI includes an option
  for a keywords based query, which is not supported yet.
 
  2. Fixed the fact that the top categories in the QListView do not have a
  visible
  [+] sign next to them to expand them. (Albeit they are expanded upon a
  double click).
 
  3. Now resizing the dialog to a larger default size.
 
  To do is:
 
  1. Make sure double clicking an end-item opens and highlights it in the
  main application.
 
  2. Eliminate the weird black-outlined rectangle that appears in the
  top-left corner of the dialog.
 
  
 
  The patch was tested against kernel 2.6.20-rc3.

-
Shlomi Fish  [EMAIL PROTECTED]
Homepage:http://www.shlomifish.org/

Chuck Norris wrote a complete Perl 6 implementation in a day but then
destroyed all evidence with his bare hands, so no one will know his secrets.
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2.6.20-rc2] "make xconfig" Search Dialog

2006-12-31 Thread Shlomi Fish
Hi all!

[ I'm not subscribed to this list so please CC me on your replies. ]

This patch is a reworked version of:

http://www.ussg.iu.edu/hypermail/linux/kernel/0603.3/0990.html

It adds a search dialog to the kernel's "make xconfig" configuration applet.

Changes in this release include:

1. Fixed formatting.

2. The items are now displayed in a tree instead of in a flat list. (With all 
the necessary changes).

3. Updated to apply against the recent kernel version.



The To do is:

1. Implemented more sophisticated querying.

2. Fix the fact that the top categories in the QListView do not have a visible 
[+] sign next to them to expand them. (Albeit they are expanded upon a double 
click).

3. Make sure double clicking an end-item opens and highlights it in the main 
application.



The patch was tested against kernel 2.6.20-rc2.

Enjoy and Happy New Year!

Regards,

    Shlomi Fish

-----
Shlomi Fish  [EMAIL PROTECTED]
Homepage:http://www.shlomifish.org/

Chuck Norris wrote a complete Perl 6 implementation in a day but then
destroyed all evidence with his bare hands, so no one will know his secrets.
--- linux-2.6.20-rc2/scripts/kconfig/qconf.cc.orig	2006-12-28 01:12:27.384938513 +0200
+++ linux-2.6.20-rc2/scripts/kconfig/qconf.cc	2006-12-30 23:05:15.409325133 +0200
@@ -21,6 +21,10 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
+#include 
 
 #include 
 
@@ -1323,6 +1327,8 @@
 	  connect(splitViewAction, SIGNAL(activated()), SLOT(showSplitView()));
 	QAction *fullViewAction = new QAction("Full View", QPixmap(xpm_tree_view), "Full View", 0, this);
 	  connect(fullViewAction, SIGNAL(activated()), SLOT(showFullView()));
+	QAction *findAction = new QAction("Find", QPixmap(xpm_save), "", CTRL+Key_F, this);
+	  connect(findAction, SIGNAL(activated()), SLOT(findEntries()));
 
 	QAction *showNameAction = new QAction(NULL, "Show Name", 0, this);
 	  showNameAction->setToggleAction(TRUE);
@@ -1376,6 +1382,11 @@
 	config->insertSeparator();
 	quitAction->addTo(config);
 
+	// create file menu
+	QPopupMenu* editMenu = new QPopupMenu(this);
+	menu->insertItem("", editMenu);
+	findAction->addTo(editMenu);
+
 	// create options menu
 	QPopupMenu* optionMenu = new QPopupMenu(this);
 	menu->insertItem("", optionMenu);
@@ -1447,6 +1458,233 @@
 		QMessageBox::information(this, "qconf", "Unable to save configuration!");
 }
 
+
+FindDialog::FindDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
+	: QDialog( parent, name, modal, fl )
+{
+	main_layout = new QVBoxLayout(this, 11, 6, "main_layout");
+	main_layout->addWidget(new QLabel("Query:", this, "label1"));
+	queryLineEdit = new QLineEdit(this, "queryLineEdit");
+	main_layout->addWidget(queryLineEdit);
+	findButton = new QPushButton("Find", this, "findButton");
+	main_layout->addWidget(findButton);
+	connect( findButton, SIGNAL( clicked() ), this, SLOT( performQuery() ) );
+	results = new QListView(this, "results");
+	results->addColumn("Item");
+	main_layout->addWidget(results);
+}
+
+FindDialog::~FindDialog()
+{
+}
+
+static QString * get_parent_disp(struct menu * menu)
+{
+	QString s;
+	if (menu->sym)
+	{
+		if (menu->prompt)
+		{
+			s += menu->prompt->text;
+			if (menu->sym->name)
+			{
+s += " (";
+s += menu->sym->name;
+s += ")";
+			}
+		}
+		else if (menu->sym->name)
+		{
+			s += menu->sym->name;
+		}
+	}
+	else if (menu->prompt)
+	{
+		s += menu->prompt->text;
+	}
+	return new QString(s);
+}
+
+QString * get_parent_string(struct menu * menu, int depth)
+{
+	QString * parent_disp = get_parent_disp(menu);
+	QString s;
+
+	/*
+	 * Append 'depth' tabs.
+	 * */
+	for(int i=0;ibegin(); it != parents->end() ; ++it, ++depth)
+	{
+		QString * parent_string = get_parent_string(*it, depth);
+		*item += *parent_string;
+		delete parent_string;
+	}
+#endif
+
+	QString * string = get_parent_string(mymenu, depth);
+	*item += *string;
+	delete string;
+
+	return item;
+}
+
+QListViewItem * ListViewBranch::newItem(QString & s)
+{
+	if (which == ISNULL)
+	{
+		// Shouldn't happen.
+		throw "Hello";
+	}
+	else if (which == ITEM)
+	{
+		return new QListViewItem(item, s);
+	}
+	else
+	{
+		return new QListViewItem(view, s);
+	}
+
+}
+
+ListViewBranch ListViewBranch::insertItem(QString & s)
+{
+	return ListViewBranch(newItem(s));
+}
+
+bool FindDialog::matches(struct menu * mymenu, QString & query)
+{
+	struct symbol * sym = mymenu->sym;
+
+	if (!sym)
+	{
+		return false;
+	}
+
+	QString help(sym->help);
+	QString name(sym->name);
+
+	return (help.contains(query, FALSE) || name.contains(query, FALSE));
+}
+
+void FindDialog::han

[PATCH 2.6.20-rc2] make xconfig Search Dialog

2006-12-31 Thread Shlomi Fish
Hi all!

[ I'm not subscribed to this list so please CC me on your replies. ]

This patch is a reworked version of:

http://www.ussg.iu.edu/hypermail/linux/kernel/0603.3/0990.html

It adds a search dialog to the kernel's make xconfig configuration applet.

Changes in this release include:

1. Fixed formatting.

2. The items are now displayed in a tree instead of in a flat list. (With all 
the necessary changes).

3. Updated to apply against the recent kernel version.



The To do is:

1. Implemented more sophisticated querying.

2. Fix the fact that the top categories in the QListView do not have a visible 
[+] sign next to them to expand them. (Albeit they are expanded upon a double 
click).

3. Make sure double clicking an end-item opens and highlights it in the main 
application.



The patch was tested against kernel 2.6.20-rc2.

Enjoy and Happy New Year!

Regards,

Shlomi Fish

-
Shlomi Fish  [EMAIL PROTECTED]
Homepage:http://www.shlomifish.org/

Chuck Norris wrote a complete Perl 6 implementation in a day but then
destroyed all evidence with his bare hands, so no one will know his secrets.
--- linux-2.6.20-rc2/scripts/kconfig/qconf.cc.orig	2006-12-28 01:12:27.384938513 +0200
+++ linux-2.6.20-rc2/scripts/kconfig/qconf.cc	2006-12-30 23:05:15.409325133 +0200
@@ -21,6 +21,10 @@
 #include qfiledialog.h
 #include qdragobject.h
 #include qregexp.h
+#include qdialog.h
+#include qlayout.h
+#include qlabel.h
+#include qpushbutton.h
 
 #include stdlib.h
 
@@ -1323,6 +1327,8 @@
 	  connect(splitViewAction, SIGNAL(activated()), SLOT(showSplitView()));
 	QAction *fullViewAction = new QAction(Full View, QPixmap(xpm_tree_view), Full View, 0, this);
 	  connect(fullViewAction, SIGNAL(activated()), SLOT(showFullView()));
+	QAction *findAction = new QAction(Find, QPixmap(xpm_save), Find, CTRL+Key_F, this);
+	  connect(findAction, SIGNAL(activated()), SLOT(findEntries()));
 
 	QAction *showNameAction = new QAction(NULL, Show Name, 0, this);
 	  showNameAction-setToggleAction(TRUE);
@@ -1376,6 +1382,11 @@
 	config-insertSeparator();
 	quitAction-addTo(config);
 
+	// create file menu
+	QPopupMenu* editMenu = new QPopupMenu(this);
+	menu-insertItem(Edit, editMenu);
+	findAction-addTo(editMenu);
+
 	// create options menu
 	QPopupMenu* optionMenu = new QPopupMenu(this);
 	menu-insertItem(Option, optionMenu);
@@ -1447,6 +1458,233 @@
 		QMessageBox::information(this, qconf, Unable to save configuration!);
 }
 
+
+FindDialog::FindDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
+	: QDialog( parent, name, modal, fl )
+{
+	main_layout = new QVBoxLayout(this, 11, 6, main_layout);
+	main_layout-addWidget(new QLabel(Query:, this, label1));
+	queryLineEdit = new QLineEdit(this, queryLineEdit);
+	main_layout-addWidget(queryLineEdit);
+	findButton = new QPushButton(Find, this, findButton);
+	main_layout-addWidget(findButton);
+	connect( findButton, SIGNAL( clicked() ), this, SLOT( performQuery() ) );
+	results = new QListView(this, results);
+	results-addColumn(Item);
+	main_layout-addWidget(results);
+}
+
+FindDialog::~FindDialog()
+{
+}
+
+static QString * get_parent_disp(struct menu * menu)
+{
+	QString s;
+	if (menu-sym)
+	{
+		if (menu-prompt)
+		{
+			s += menu-prompt-text;
+			if (menu-sym-name)
+			{
+s +=  (;
+s += menu-sym-name;
+s += );
+			}
+		}
+		else if (menu-sym-name)
+		{
+			s += menu-sym-name;
+		}
+	}
+	else if (menu-prompt)
+	{
+		s += menu-prompt-text;
+	}
+	return new QString(s);
+}
+
+QString * get_parent_string(struct menu * menu, int depth)
+{
+	QString * parent_disp = get_parent_disp(menu);
+	QString s;
+
+	/*
+	 * Append 'depth' tabs.
+	 * */
+	for(int i=0;idepth;i++)
+	{
+		s += \t;
+	}
+	s += *parent_disp;
+	s += \n;
+
+	delete parent_disp;
+
+	return new QString(s);
+}
+
+static QString * get_item_display(MenuList * parents, struct menu * mymenu)
+{
+	MenuList::iterator it;
+	QString * item;
+#if 0
+	int depth;
+#else
+	int depth=0;
+#endif
+
+	item = new QString();
+
+#if 0
+	for (depth=0, it = parents-begin(); it != parents-end() ; ++it, ++depth)
+	{
+		QString * parent_string = get_parent_string(*it, depth);
+		*item += *parent_string;
+		delete parent_string;
+	}
+#endif
+
+	QString * string = get_parent_string(mymenu, depth);
+	*item += *string;
+	delete string;
+
+	return item;
+}
+
+QListViewItem * ListViewBranch::newItem(QString  s)
+{
+	if (which == ISNULL)
+	{
+		// Shouldn't happen.
+		throw Hello;
+	}
+	else if (which == ITEM)
+	{
+		return new QListViewItem(item, s);
+	}
+	else
+	{
+		return new QListViewItem(view, s);
+	}
+
+}
+
+ListViewBranch ListViewBranch::insertItem(QString  s)
+{
+	return ListViewBranch(newItem(s));
+}
+
+bool FindDialog::matches(struct menu * mymenu, QString  query)
+{
+	struct symbol * sym = mymenu-sym;
+
+	if (!sym)
+	{
+		return false;
+	}
+
+	QString help(sym-help);
+	QString name(sym-name);
+
+	return (help.contains(query