Skip to contentSkip to conversation

nconfig V3

PATCH In review Nir Tzachar 2 participants 3 messages Nov 29, 2008 – Nov 30, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nconfig V3

Changes since last version:

1) Added cursor to input dialog boxes.
2) ? key is bound to help messages.
3) Removed the "()" logic of hot keys. Now, the first upper cased letter of an item is the hot key.
4) Source was split into two parts; for gui logic (nconf.gui.c) and kconfig interface (nconf.c).
5) Shared code with mconf.c has been moved to share.c .
6) General improvements (e.g., all text is centered, etc.)

Open issues:

1) The problem Willy reported with pressing the keypad too quickly. As I cannot reproduce this, I would appreciate a recheck.
2) The color scheme.

Regarding the color scheme, I think we should first agree that the patch is worth including before we procceed. Tweaking the colors will be the easy part ;)

---
 scripts/kconfig/Makefile            |   23 +-
 scripts/kconfig/conf.c              |  123 ++--
 scripts/kconfig/confdata.c          |   11 +-
 scripts/kconfig/lkc.h               |    2 +-
 scripts/kconfig/mconf.c             |   76 +--
 scripts/kconfig/menu.c              |    2 +-
 scripts/kconfig/nconf.c             | 1378 +++++++++++++++++++++++++++++++++++
 scripts/kconfig/nconf.gui.c         |  653 +++++++++++++++++
 scripts/kconfig/nconf.h             |   86 +++
 scripts/kconfig/shared.c            |   82 +++
 scripts/kconfig/shared.h            |   13 +
 scripts/kconfig/zconf.tab.c_shipped |    2 +-
 scripts/kconfig/zconf.y             |    2 +-
 13 files changed, 2306 insertions(+), 147 deletions(-)
 create mode 100644 scripts/kconfig/nconf.c
 create mode 100644 scripts/kconfig/nconf.gui.c
 create mode 100644 scripts/kconfig/nconf.h
 create mode 100644 scripts/kconfig/shared.c
 create mode 100644 scripts/kconfig/shared.h
scripts/kconfig/Makefile +17 -6
index fa8c2dd..58626b0 100644
@@ -4,11 +4,7 @@
 
 PHONY += oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config
 
-ifdef KBUILD_KCONFIG
-Kconfig := $(KBUILD_KCONFIG)
-else
 Kconfig := arch/$(SRCARCH)/Kconfig
-endif
 
 xconfig: $(obj)/qconf
 	$< $(Kconfig)
@@ -19,6 +15,9 @@ gconfig: $(obj)/gconf
 menuconfig: $(obj)/mconf
 	$< $(Kconfig)
 
+nconfig: $(obj)/nconf
+	$< $(Kconfig)
+
 config: $(obj)/conf
 	$< $(Kconfig)
 
@@ -79,6 +78,7 @@ endif
 # Help text used by make help
 help:
 	@echo  '  config	  - Update current config utilising a line-oriented program'
+	@echo  '  nconfig	  - Update current config utilising a ncurses menu based program'
 	@echo  '  menuconfig	  - Update current config utilising a menu based program'
 	@echo  '  xconfig	  - Update current config utilising a QT based front-end'
 	@echo  '  gconfig	  - Update current config utilising a GTK based front-end'
@@ -106,6 +106,8 @@ HOST_EXTRACFLAGS += -DLOCALE
 # conf:	  Used for defconfig, oldconfig and related targets
 # mconf:  Used for the mconfig target.
 #         Utilizes the lxdialog package
+# nconf:  Used for the nconfig target.
+#         Utilizes ncurses
 # qconf:  Used for the xconfig target
 #         Based on QT which needs to be installed to compile it
 # gconf:  Used for the gconfig target
@@ -116,7 +118,8 @@ lxdialog := lxdialog/checklist.o lxdialog/util.o lxdialog/inputbox.o
 lxdialog += lxdialog/textbox.o lxdialog/yesno.o lxdialog/menubox.o
 
 conf-objs	:= conf.o  zconf.tab.o
-mconf-objs	:= mconf.o zconf.tab.o $(lxdialog)
+mconf-objs	:= mconf.o zconf.tab.o shared.o $(lxdialog)
+nconf-objs	:= nconf.o zconf.tab.o shared.o nconf.gui.o 
 kxgettext-objs	:= kxgettext.o zconf.tab.o
 
 hostprogs-y := conf qconf gconf kxgettext
@@ -125,6 +128,10 @@ ifeq ($(MAKECMDGOALS),menuconfig)
 	hostprogs-y += mconf
 endif
 
+ifeq ($(MAKECMDGOALS),nconfig)
+	hostprogs-y += nconf
+endif
+
 ifeq ($(MAKECMDGOALS),xconfig)
 	qconf-target := 1
 endif
@@ -144,7 +151,7 @@ endif
 
 clean-files	:= lkc_defs.h qconf.moc .tmp_qtcheck \
 		   .tmp_gtkcheck zconf.tab.c lex.zconf.c zconf.hash.c gconf.glade.h
-clean-files     += mconf qconf gconf
+clean-files     += mconf qconf gconf nconf
 clean-files     += config.pot linux.pot
 
 # Check that we have the required ncurses stuff installed for lxdialog (menuconfig)
@@ -162,6 +169,10 @@ HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTCC)
 HOSTCFLAGS_lex.zconf.o	:= -I$(src)
 HOSTCFLAGS_zconf.tab.o	:= -I$(src)
 
+HOSTLOADLIBES_nconf	= -lmenu -lpanel -lncurses 
+HOSTCFLAGS_nconf.o	=
+LDFLAGS_nconf.o		=
+
 HOSTLOADLIBES_qconf	= $(KC_QT_LIBS) -ldl
 HOSTCXXFLAGS_qconf.o	= $(KC_QT_CFLAGS) -D LKC_DIRECT_LINK
 
scripts/kconfig/conf.c +66 -57

179 lines not on this page · raw message

scripts/kconfig/confdata.c +4 -7
index 830d9ea..df6a188 100644
@@ -222,10 +222,8 @@ load:
 				continue;
 			if (def == S_DEF_USER) {
 				sym = sym_find(line + 9);
-				if (!sym) {
-					sym_add_change_count(1);
+				if (!sym)
 					break;
-				}
 			} else {
 				sym = sym_lookup(line + 9, 0);
 				if (sym->type == S_UNKNOWN)
@@ -261,10 +259,8 @@ load:
 			}
 			if (def == S_DEF_USER) {
 				sym = sym_find(line + 7);
-				if (!sym) {
-					sym_add_change_count(1);
+				if (!sym)
 					break;
-				}
 			} else {
 				sym = sym_lookup(line + 7, 0);
 				if (sym->type == S_UNKNOWN)
@@ -852,7 +848,8 @@ void conf_set_all_new_symbols(enum conf_def_mode mode)
 
 	}
 
-	sym_clear_all_valid();
+	if (modules_sym)
+		sym_calc_value(modules_sym);
 
 	if (mode != def_random)
 		return;
scripts/kconfig/lkc.h +1 -1
index 4a9af6f..0e9c477 100644
@@ -83,7 +83,7 @@ void conf_set_all_new_symbols(enum conf_def_mode mode);
 void kconfig_load(void);
 
 /* menu.c */
-void menu_init(void);
+void _menu_init(void);
 void menu_warn(struct menu *menu, const char *fmt, ...);
 struct menu *menu_add_menu(void);
 void menu_end_menu(void);
scripts/kconfig/mconf.c +3 -73

100 lines not on this page · raw message

scripts/kconfig/menu.c +1 -1
index 07ff8d1..ade19a3 100644
@@ -35,7 +35,7 @@ static void prop_warn(struct property *prop, const char *fmt, ...)
 	va_end(ap);
 }
 
-void menu_init(void)
+void _menu_init(void)
 {
 	current_entry = current_menu = &rootmenu;
 	last_entry_ptr = &rootmenu.list;
scripts/kconfig/nconf.c new file +1378 -0

1,378 lines not on this page · raw message

scripts/kconfig/nconf.gui.c new file +653 -0

653 lines not on this page · raw message

scripts/kconfig/nconf.h new file +86 -0

86 lines not on this page · raw message

scripts/kconfig/shared.c new file +82 -0

82 lines not on this page · raw message

scripts/kconfig/shared.h new file +13 -0
new file mode 100644
index 0000000..935dcaa
@@ -0,0 +1,13 @@
+/*
+ * Copyright (C) 2008 Nir Tzachar <[email protected]?
+ * Released under the terms of the GNU GPL v2.0.
+ *
+ * Derived from menuconfig.
+ *
+ */
+#define LKC_DIRECT_LINK
+#include "lkc.h"
+
+void get_prompt_str(struct gstr *r, struct property *prop);
+void get_symbol_str(struct gstr *r, struct symbol *sym);
+struct gstr get_relations_str(struct symbol **sym_arr);
scripts/kconfig/zconf.tab.c_shipped +1 -1
index 95df833..ef5b369 100644
@@ -2255,7 +2255,7 @@ void conf_parse(const char *name)
 	zconf_initscan(name);
 
 	sym_init();
-	menu_init();
+	_menu_init();
 	modules_sym = sym_lookup(NULL, 0);
 	modules_sym->type = S_BOOLEAN;
 	modules_sym->flags |= SYMBOL_AUTO;
scripts/kconfig/zconf.y +1 -1
index 9710b82..cbb72fd 100644
@@ -472,7 +472,7 @@ void conf_parse(const char *name)
 	zconf_initscan(name);
 
 	sym_init();
-	menu_init();
+	_menu_init();
 	modules_sym = sym_lookup(NULL, 0);
 	modules_sym->type = S_BOOLEAN;
 	modules_sym->flags |= SYMBOL_AUTO;
Signature · 1 line
1.5.6.4
#1 lore raw
Quoted 2 lines · Nir Tzachar

[...]
+static ITEM *btns_items[BTN_MAX];

[...]

scripts/kconfig/nconf.c line 1311

Quoted 1 line
scripts/kconfig/nconf.c new file +1 -0
+	btns_items[BTN_MAX] = NULL;

gcc warns about this here

scripts/kconfig/nconf.c:1311: warning: array subscript is above array bounds

#2 lore raw

Hello.

Quoted 3 lines · Carlos R. Mafra
Quoted 2 lines · Nir Tzachar

[...]
+static ITEM *btns_items[BTN_MAX];

Thanks. This should be btns_items[BTN_MAX+1];

Quoted 8 lines

[...]

Quoted 1 line

+ btns_items[BTN_MAX] = NULL;

gcc warns about this here

scripts/kconfig/nconf.c:1311: warning: array subscript is above array bounds

Cheers.