kconfig: print symbol type in help text
PATCH v2 1/8 kconfig: print symbol type in help text
Randy suggested to print out the symbol type in gconfig.
Note this change does more than Randy's suggestion, that it also affects menuconfig and "make config".
│ Symbol: BLOCK [=y] │ Type : boolean │ Prompt: Enable the block layer │ Defined at block/Kconfig:4 │ Depends on: EMBEDDED [=n]
--- scripts/kconfig/menu.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
scripts/kconfig/menu.c +3 -1
@@ -501,9 +501,11 @@ void get_symbol_str(struct gstr *r, struct symbol *sym)bool hit;struct property *prop; -if (sym && sym->name) +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)); + } for_all_prompts(sym, prop)get_prompt_str (r, prop); hit = false;
Signature · 1 line
1.6.3
PATCH v2 2/8 kconfig: print the range of integer/hex symbol in help text
Without this patch, one has to refer to the Kconfig file to find out the range of an integer/hex symbol.
│ Symbol: NR_CPUS [=4] │ Type : integer │ Range : [2 8] │ Prompt: Maximum number of CPUs │ Defined at arch/x86/Kconfig:761 │ Depends on: SMP [=y] && !MAXSMP [=n] │ Location: │ -> Processor type and features
--- scripts/kconfig/expr.c | 2 +- scripts/kconfig/menu.c | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletions(-)
scripts/kconfig/expr.c +1 -1
@@ -1098,7 +1098,7 @@ void expr_fprint(struct expr *e, FILE *out)static void expr_print_gstr_helper (void *data,struct symbol *sym,const char *str) {str_append ((struct gstr *)data, str); -if (sym) +if (sym && sym->type !=S_UNKNOWN )str_printf ((struct gstr *)data," [=%s]" ,sym_get_string_value (sym)); }
scripts/kconfig/menu.c +8 -0
@@ -505,6 +505,14 @@ void get_symbol_str(struct gstr *r, struct symbol *sym)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);
Signature · 1 line
1.6.3
PATCH v2 3/8 kconfig: fix to tag NEW symbols correctly
In reply to Li ZefanThose configs are not new:
$ cat .config ... CONFIG_NAMESPACES=y ... CONFIG_BLOCK=y ...
But are tagged as NEW:
$ yes "" | make config > myconf $ cat myconf | grep '(NEW)' Namespaces support (NAMESPACES) [Y/?] (NEW) y ... Enable the block layer (BLOCK) [Y/?] (NEW) y ...
You can also notice this bug when using gconfig/xconfig.
It's because the SYMBOL_DEF_USER bit of an invisible symbol is cleared when the config file is read:
int conf_read(const char *name)
{
...
for_all_symbols(i, sym) {
if (sym_has_value(sym) && !sym_is_choice_value(sym)) {
/* Reset values of generates values, so they'll appear
* as new, if they should become visible, but that
* doesn't quite work if the Kconfig and the saved
* configuration disagree.
*/
if (sym->visible == no && !conf_unsaved)
sym->flags &= ~SYMBOL_DEF_USER;
...
}But a menu item which represents an invisible symbol is still visible, if it's sub-menu is visible, so its SYMBOL_DEF_USER bit should be set to indicate it's not NEW.
--- scripts/kconfig/menu.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-)
scripts/kconfig/menu.c +6 -2
@@ -419,9 +419,13 @@ bool menu_is_visible(struct menu *menu)if (!sym ||sym_get_tristate_value (menu->sym) == no)return false; -for (child = menu->list; child; child = child->next) -if (menu_is_visible (child)) +for (child = menu->list; child; child = child->next) { +if (menu_is_visible (child)) { +if (sym) + sym->flags |=SYMBOL_DEF_USER ;return true; + } + }return false; }
Signature · 1 line
1.6.3
PATCH v2 4/8 menuconfig: improive help text a bit
In reply to Li Zefan--- scripts/kconfig/mconf.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
scripts/kconfig/mconf.c +1 -1
@@ -74,7 +74,7 @@ static const char mconf_readme[] = N_("\n" " Shortcut: Press <H> or <?>.\n" "\n" -"o To show hidden options, press <Z>.\n" +"o To toggle the display of hidden options, press <Z>.\n" "\n" "\n" "Radiolists (Choice lists)\n"
Signature · 1 line
1.6.3
PATCH v2 5/8 gconfig: fix to tag NEW symbols correctly
In reply to Li ZefanThe logic should be reversed.
--- scripts/kconfig/gconf.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
scripts/kconfig/gconf.c +1 -1
@@ -1114,7 +1114,7 @@ static gchar **fill_row(struct menu *menu) row[COL_OPTION ] =g_strdup_printf ("%s %s" ,_ (menu_get_prompt (menu)), - sym &&sym_has_value (sym) ?"(NEW)" :"" ); + sym && !sym_has_value (sym) ?"(NEW)" :"" );if (opt_mode ==OPT_ALL && !menu_is_visible (menu)) row[COL_COLOR ] =g_strdup ("DarkGray" );
Signature · 1 line
1.6.3
PATCH v2 6/8 gconfig: fix null pointer warning
In reply to Li ZefanIn gconfig if you enable "Show all options", you'll see some "(null)" config options, and clicking those options triggers a warning:
(gconf:9368): Gtk-CRITICAL **: gtk_text_buffer_insert_with_tags: assertion `text != NULL' failed
--- scripts/kconfig/gconf.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
scripts/kconfig/gconf.c +3 -2
@@ -1343,7 +1343,8 @@ static void update_tree(struct menu *src, GtkTreeIter * dst)#endif if ((opt_mode ==OPT_NORMAL && !menu_is_visible (child1)) || - (opt_mode ==OPT_PROMPT && !menu_has_prompt (child1))) { + (opt_mode ==OPT_PROMPT && !menu_has_prompt (child1)) || + (opt_mode ==OPT_ALL && !menu_get_prompt (child1))) {/* remove node */ if (gtktree_iter_find_node (dst, menu1) !=NULL ) {
@@ -1425,7 +1426,7 @@ static void display_tree(struct menu *menu)if ((opt_mode ==OPT_NORMAL &&menu_is_visible (child)) || (opt_mode ==OPT_PROMPT &&menu_has_prompt (child)) || - (opt_mode ==OPT_ALL )) + (opt_mode ==OPT_ALL &&menu_get_prompt (child)))place_node (child,fill_row (child));#ifdef DEBUG printf ("%*c%s: " , indent,' ' ,menu_get_prompt (child));
Signature · 1 line
1.6.3
PATCH v2 7/8 xconfig: clean up
In reply to Li Zefan@ok is a pointer to a bool var, so we should check the value of *ok. But actually we don't need to check it, so just remove the if statement.
--- scripts/kconfig/qconf.cc | 9 ++++----- 1 files changed, 4 insertions(+), 5 deletions(-)
scripts/kconfig/qconf.cc +4 -5
@@ -58,11 +58,10 @@ QValueList<int> ConfigSettings::readSizes(const QString& key, bool *ok) { QValueList<int> result; QStringList entryList = readListEntry(key, ok); - if (ok) { - QStringList::Iterator it; - for (it = entryList.begin(); it != entryList.end(); ++it) - result.push_back((*it).toInt()); - } + QStringList::Iterator it; + + for (it = entryList.begin(); it != entryList.end(); ++it) + result.push_back((*it).toInt()); return result; }
Signature · 1 line
1.6.3
PATCH v2 8/8 xconfig: remove unused function
In reply to Li ZefanRemove ConfigInfoView::setSource().
--- scripts/kconfig/qconf.cc | 28 ---------------------------- scripts/kconfig/qconf.h | 1 - 2 files changed, 0 insertions(+), 29 deletions(-)
scripts/kconfig/qconf.cc +0 -28
@@ -963,34 +963,6 @@ void ConfigInfoView::setInfo(struct menu *m) menuInfo(); } -void ConfigInfoView::setSource(const QString& name) -{ - const char *p = name.latin1(); - - menu = NULL; - sym = NULL; - - switch (p[0]) { - case 'm': - struct menu *m; - - if (sscanf(p, "m%p", &m) == 1 && menu != m) { - menu = m; - menuInfo(); - emit menuSelected(menu); - } - break; - case 's': - struct symbol *s; - - if (sscanf(p, "s%p", &s) == 1 && sym != s) { - sym = s; - symbolInfo(); - } - break; - } -} - void ConfigInfoView::symbolInfo(void) { QString str;
scripts/kconfig/qconf.h +0 -1
@@ -254,7 +254,6 @@ public: public slots:void setInfo (struct menu *menu);void saveSettings (void ); - void setSource(const QString& name);void setShowDebug (bool ); signals:
Signature · 1 line
1.6.3
[PATCH v2 9/8] xconfig: add support to show hidden options which have prompts
In reply to Li ZefanThis feature has been supported in menuconfig and gconfig, so here add it to xconfig.
---
(This patch is based on the previous patchset I sent several days ago.)
Randy, I've fixed the bug you reported. The bug was seen only in split view.
--- scripts/kconfig/qconf.cc | 69 +++++++++++++++++++++++++++++++++------------ scripts/kconfig/qconf.h | 16 ++++++++-- 2 files changed, 62 insertions(+), 23 deletions(-)
scripts/kconfig/qconf.cc +50 -19
@@ -148,7 +148,7 @@ void ConfigItem::updateMenu(void) case S_TRISTATE: char ch; - if (!sym_is_changable(sym) && !list->showAll) { + if (!sym_is_changable(sym) && list->optMode == normalOpt) { setPixmap(promptColIdx, 0); setText(noColIdx, QString::null); setText(modColIdx, QString::null);
@@ -319,7 +319,7 @@ ConfigList::ConfigList(ConfigView* p, const char *name) symbolYesPix(xpm_symbol_yes), symbolModPix(xpm_symbol_mod), symbolNoPix(xpm_symbol_no), choiceYesPix(xpm_choice_yes), choiceNoPix(xpm_choice_no), menuPix(xpm_menu), menuInvPix(xpm_menu_inv), menuBackPix(xpm_menuback), voidPix(xpm_void), - showAll(false), showName(false), showRange(false), showData(false), + showName(false), showRange(false), showData(false), optMode(normalOpt), rootEntry(0), headerPopup(0) { int i;
@@ -336,10 +336,10 @@ ConfigList::ConfigList(ConfigView* p, const char *name) if (name) { configSettings->beginGroup(name); - showAll = configSettings->readBoolEntry("/showAll", false); showName = configSettings->readBoolEntry("/showName", false); showRange = configSettings->readBoolEntry("/showRange", false); showData = configSettings->readBoolEntry("/showData", false); + optMode = (enum optionMode)configSettings->readNumEntry("/optionMode", false); configSettings->endGroup(); connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings())); }
@@ -351,6 +351,17 @@ ConfigList::ConfigList(ConfigView* p, const char *name) reinit(); } +bool ConfigList::menuSkip(struct menu *menu) +{ + if (optMode == normalOpt && menu_is_visible(menu)) + return false; + if (optMode == promptOpt && menu_has_prompt(menu)) + return false; + if (optMode == allOpt) + return false; + return true; +} + void ConfigList::reinit(void) { removeColumn(dataColIdx);
@@ -379,7 +390,7 @@ void ConfigList::saveSettings(void) configSettings->writeEntry("/showName", showName); configSettings->writeEntry("/showRange", showRange); configSettings->writeEntry("/showData", showData); - configSettings->writeEntry("/showAll", showAll); + configSettings->writeEntry("/optionMode", (int)optMode); configSettings->endGroup(); } }
@@ -605,7 +616,7 @@ void ConfigList::updateMenuList(P* parent, struct menu* menu) } visible = menu_is_visible(child); - if (showAll || visible) { + if (!menuSkip(child)) { if (!child->sym && !child->list && !child->prompt) continue; if (!item || item->menu != child)
@@ -834,7 +845,10 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e) e->ignore(); } -ConfigView* ConfigView::viewList; +ConfigView*ConfigView::viewList; +QAction *ConfigView::showNormalAction; +QAction *ConfigView::showAllAction; +QAction *ConfigView::showPromptAction; ConfigView::ConfigView(QWidget* parent, const char *name) : Parent(parent, name)
@@ -859,13 +873,16 @@ ConfigView::~ConfigView(void) } } -void ConfigView::setShowAll(bool b) +void ConfigView::setOptionMode(QAction *act) { - if (list->showAll != b) { - list->showAll = b; - list->updateListAll(); - emit showAllChanged(b); - } + if (act == showNormalAction) + list->optMode = normalOpt; + else if (act == showAllAction) + list->optMode = allOpt; + else + list->optMode = promptOpt; + + list->updateListAll(); } void ConfigView::setShowName(bool b)
@@ -1348,11 +1365,24 @@ ConfigMainWindow::ConfigMainWindow(void) connect(showDataAction, SIGNAL(toggled(bool)), configView, SLOT(setShowData(bool))); connect(configView, SIGNAL(showDataChanged(bool)), showDataAction, SLOT(setOn(bool))); showDataAction->setOn(configList->showData); - QAction *showAllAction = new QAction(NULL, _("Show All Options"), 0, this); - showAllAction->setToggleAction(TRUE); - connect(showAllAction, SIGNAL(toggled(bool)), configView, SLOT(setShowAll(bool))); - connect(showAllAction, SIGNAL(toggled(bool)), menuView, SLOT(setShowAll(bool))); - showAllAction->setOn(configList->showAll); + + QActionGroup *optGroup = new QActionGroup(this); + optGroup->setExclusive(TRUE); + connect(optGroup, SIGNAL(selected(QAction *)), configView, + SLOT(setOptionMode(QAction *))); + connect(optGroup, SIGNAL(selected(QAction *)), menuView, + SLOT(setOptionMode(QAction *))); + + configView->showNormalAction = new QAction(NULL, _("Show Normal Options"), 0, optGroup); + configView->showAllAction = new QAction(NULL, _("Show All Options"), 0, optGroup); + configView->showPromptAction = new QAction(NULL, _("Show Prompt Options"), 0, optGroup); + configView->showNormalAction->setToggleAction(TRUE); + configView->showNormalAction->setOn(configList->optMode == normalOpt); + configView->showAllAction->setToggleAction(TRUE); + configView->showAllAction->setOn(configList->optMode == allOpt); + configView->showPromptAction->setToggleAction(TRUE); + configView->showPromptAction->setOn(configList->optMode == promptOpt); + QAction *showDebugAction = new QAction(NULL, _("Show Debug Info"), 0, this); showDebugAction->setToggleAction(TRUE); connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool)));
@@ -1395,7 +1425,8 @@ ConfigMainWindow::ConfigMainWindow(void) showRangeAction->addTo(optionMenu); showDataAction->addTo(optionMenu); optionMenu->insertSeparator(); - showAllAction->addTo(optionMenu); + optGroup->addTo(optionMenu); + optionMenu->insertSeparator(); showDebugAction->addTo(optionMenu); // create help menu
@@ -1490,7 +1521,7 @@ void ConfigMainWindow::setMenuLink(struct menu *menu) ConfigList* list = NULL; ConfigItem* item; - if (!menu_is_visible(menu) && !configView->showAll()) + if (configList->menuSkip(menu)) return; switch (configList->mode) {
scripts/kconfig/qconf.h +12 -4
@@ -44,6 +44,9 @@ enum colIdx {enum listMode { singleMode, menuMode, symbolMode, fullMode, listMode }; +enum optionMode { + normalOpt =0 , allOpt, promptOpt +}; class ConfigList : public QListView {Q_OBJECT
@@ -115,6 +118,8 @@ public:void setAllOpen (bool open);void setParentMenu (void ); +bool menuSkip (struct menu *); + template <class P> void updateMenuList(P*, struct menu*);
@@ -124,8 +129,9 @@ public:QPixmap choiceYesPix, choiceNoPix;QPixmap menuPix, menuInvPix, menuBackPix, voidPix; -bool showAll, showName, showRange, showData; +bool showName, showRange, showData;enum listMode mode; +enum optionMode optMode;struct menu *rootEntry;QColorGroup disabledColorGroup;QColorGroup inactivedColorGroup;
@@ -222,17 +228,15 @@ public:static void updateList (ConfigItem * item);static void updateListAll (void ); -bool showAll (void ) const {return list->showAll; }bool showName (void ) const {return list->showName; }bool showRange (void ) const {return list->showRange; }bool showData (void ) const {return list->showData; } public slots: -void setShowAll (bool );void setShowName (bool );void setShowRange (bool );void setShowData (bool ); +void setOptionMode (QAction *); signals: -void showAllChanged (bool );void showNameChanged (bool );void showRangeChanged (bool );void showDataChanged (bool );
@@ -242,6 +246,10 @@ public:static ConfigView * viewList;ConfigView * nextView; + +static QAction *showNormalAction; +static QAction *showAllAction; +static QAction *showPromptAction; }; class ConfigInfoView : public QTextBrowser {
Signature · 1 line
1.6.3
Hi Michal, what do you think about those patches? Seems Randy has had no further comments on them.
Quoted 13 lines · Li Zefan
Randy suggested to print out the symbol type in gconfig.
Note this change does more than Randy's suggestion, that it also affects menuconfig and "make config".
│ Symbol: BLOCK [=y] │ Type : boolean │ Prompt: Enable the block layer │ Defined at block/Kconfig:4 │ Depends on: EMBEDDED [=n]Signed-off-by Li Zefan <[email protected]>Acked-by Randy Dunlap <[email protected]>
Quoted 2 lines · Li Zefan
Hi Michal, what do you think about those patches? Seems Randy has had no further comments on them.
Sorry, I've been quite busy this week due to a new arrival in our family. The patches are ok, thank you for your work and Randy for his review! I'll apply them.
Michal
Quoted 15 lines
Quoted 13 lines · Li Zefan
Randy suggested to print out the symbol type in gconfig.
Note this change does more than Randy's suggestion, that it also affects menuconfig and "make config".
│ Symbol: BLOCK [=y] │ Type : boolean │ Prompt: Enable the block layer │ Defined at block/Kconfig:4 │ Depends on: EMBEDDED [=n]Signed-off-by Li Zefan <[email protected]>Acked-by Randy Dunlap <[email protected]>
Quoted 4 lines
Quoted 2 lines
Hi Michal, what do you think about those patches? Seems Randy has had no further comments on them.
Sorry, I've been quite busy this week due to a new arrival in our
Congratulation!
Quoted 2 lines
family. The patches are ok, thank you for your work and Randy for his review! I'll apply them.
Thanks! And take your time. :)
Quoted 7 lines · Michal Marek
Quoted 2 lines · Li Zefan
Hi Michal, what do you think about those patches? Seems Randy has had no further comments on them.
Sorry, I've been quite busy this week due to a new arrival in our family. The patches are ok, thank you for your work and Randy for his review! I'll apply them.
Applied now.
Michal