kconfig: syn with linux kernel v2.6.38-rc3
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
This commit is contained in:
parent
a3463cc128
commit
628a2d1b5b
|
@ -0,0 +1,11 @@
|
|||
#
|
||||
# For a description of the syntax of this configuration file,
|
||||
# see Documentation/kbuild/kconfig-language.txt.
|
||||
#
|
||||
mainmenu "Linux/$ARCH $KERNELVERSION Barebox Configuration"
|
||||
|
||||
config SRCARCH
|
||||
string
|
||||
option env="SRCARCH"
|
||||
|
||||
source "arch/$SRCARCH/Kconfig"
|
|
@ -8,7 +8,7 @@ PHONY += oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-c
|
|||
ifdef KBUILD_KCONFIG
|
||||
Kconfig := $(KBUILD_KCONFIG)
|
||||
else
|
||||
Kconfig := arch/$(SRCARCH)/Kconfig
|
||||
Kconfig := Kconfig
|
||||
endif
|
||||
|
||||
xconfig: $(obj)/qconf
|
||||
|
@ -145,11 +145,8 @@ check-lxdialog := $(srctree)/$(src)/lxdialog/check-lxdialog.sh
|
|||
|
||||
# Use recursively expanded variables so we do not call gcc unless
|
||||
# we really need to do so. (Do not call gcc as part of make mrproper)
|
||||
HOST_EXTRACFLAGS = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags)
|
||||
HOST_LOADLIBES = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))
|
||||
|
||||
HOST_EXTRACFLAGS += -DLOCALE
|
||||
|
||||
HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags) \
|
||||
-DLOCALE
|
||||
|
||||
# ===========================================================================
|
||||
# Shared Makefile for the various kconfig executables:
|
||||
|
@ -208,7 +205,7 @@ clean-files += config.pot linux.pot
|
|||
PHONY += $(obj)/dochecklxdialog
|
||||
$(addprefix $(obj)/,$(lxdialog)): $(obj)/dochecklxdialog
|
||||
$(obj)/dochecklxdialog:
|
||||
$(Q)$(CONFIG_SHELL) $(check-lxdialog) -check $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOST_LOADLIBES)
|
||||
$(Q)$(CONFIG_SHELL) $(check-lxdialog) -check $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTLOADLIBES_mconf)
|
||||
|
||||
always := dochecklxdialog
|
||||
|
||||
|
@ -226,6 +223,8 @@ HOSTLOADLIBES_gconf = `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0` -ldl
|
|||
HOSTCFLAGS_gconf.o = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \
|
||||
-D LKC_DIRECT_LINK
|
||||
|
||||
HOSTLOADLIBES_mconf = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))
|
||||
|
||||
HOSTLOADLIBES_nconf = -lmenu -lpanel -lncurses
|
||||
$(obj)/qconf.o: $(obj)/.tmp_qtcheck
|
||||
|
||||
|
@ -236,40 +235,48 @@ $(obj)/.tmp_qtcheck: $(src)/Makefile
|
|||
# QT needs some extra effort...
|
||||
$(obj)/.tmp_qtcheck:
|
||||
@set -e; echo " CHECK qt"; dir=""; pkg=""; \
|
||||
pkg-config --exists qt 2> /dev/null && pkg=qt; \
|
||||
pkg-config --exists qt-mt 2> /dev/null && pkg=qt-mt; \
|
||||
if [ -n "$$pkg" ]; then \
|
||||
cflags="\$$(shell pkg-config $$pkg --cflags)"; \
|
||||
libs="\$$(shell pkg-config $$pkg --libs)"; \
|
||||
moc="\$$(shell pkg-config $$pkg --variable=prefix)/bin/moc"; \
|
||||
dir="$$(pkg-config $$pkg --variable=prefix)"; \
|
||||
if ! pkg-config --exists QtCore 2> /dev/null; then \
|
||||
echo "* Unable to find the QT4 tool qmake. Trying to use QT3"; \
|
||||
pkg-config --exists qt 2> /dev/null && pkg=qt; \
|
||||
pkg-config --exists qt-mt 2> /dev/null && pkg=qt-mt; \
|
||||
if [ -n "$$pkg" ]; then \
|
||||
cflags="\$$(shell pkg-config $$pkg --cflags)"; \
|
||||
libs="\$$(shell pkg-config $$pkg --libs)"; \
|
||||
moc="\$$(shell pkg-config $$pkg --variable=prefix)/bin/moc"; \
|
||||
dir="$$(pkg-config $$pkg --variable=prefix)"; \
|
||||
else \
|
||||
for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \
|
||||
if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \
|
||||
done; \
|
||||
if [ -z "$$dir" ]; then \
|
||||
echo "*"; \
|
||||
echo "* Unable to find any QT installation. Please make sure that"; \
|
||||
echo "* the QT4 or QT3 development package is correctly installed and"; \
|
||||
echo "* either qmake can be found or install pkg-config or set"; \
|
||||
echo "* the QTDIR environment variable to the correct location."; \
|
||||
echo "*"; \
|
||||
false; \
|
||||
fi; \
|
||||
libpath=$$dir/lib; lib=qt; osdir=""; \
|
||||
$(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \
|
||||
osdir=x$$($(HOSTCXX) -print-multi-os-directory); \
|
||||
test -d $$libpath/$$osdir && libpath=$$libpath/$$osdir; \
|
||||
test -f $$libpath/libqt-mt.so && lib=qt-mt; \
|
||||
cflags="-I$$dir/include"; \
|
||||
libs="-L$$libpath -Wl,-rpath,$$libpath -l$$lib"; \
|
||||
moc="$$dir/bin/moc"; \
|
||||
fi; \
|
||||
if [ ! -x $$dir/bin/moc -a -x /usr/bin/moc ]; then \
|
||||
echo "*"; \
|
||||
echo "* Unable to find $$dir/bin/moc, using /usr/bin/moc instead."; \
|
||||
echo "*"; \
|
||||
moc="/usr/bin/moc"; \
|
||||
fi; \
|
||||
else \
|
||||
for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \
|
||||
if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \
|
||||
done; \
|
||||
if [ -z "$$dir" ]; then \
|
||||
echo "*"; \
|
||||
echo "* Unable to find the QT3 installation. Please make sure that"; \
|
||||
echo "* the QT3 development package is correctly installed and"; \
|
||||
echo "* either install pkg-config or set the QTDIR environment"; \
|
||||
echo "* variable to the correct location."; \
|
||||
echo "*"; \
|
||||
false; \
|
||||
fi; \
|
||||
libpath=$$dir/lib; lib=qt; osdir=""; \
|
||||
$(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \
|
||||
osdir=x$$($(HOSTCXX) -print-multi-os-directory); \
|
||||
test -d $$libpath/$$osdir && libpath=$$libpath/$$osdir; \
|
||||
test -f $$libpath/libqt-mt.so && lib=qt-mt; \
|
||||
cflags="-I$$dir/include"; \
|
||||
libs="-L$$libpath -Wl,-rpath,$$libpath -l$$lib"; \
|
||||
moc="$$dir/bin/moc"; \
|
||||
fi; \
|
||||
if [ ! -x $$dir/bin/moc -a -x /usr/bin/moc ]; then \
|
||||
echo "*"; \
|
||||
echo "* Unable to find $$dir/bin/moc, using /usr/bin/moc instead."; \
|
||||
echo "*"; \
|
||||
moc="/usr/bin/moc"; \
|
||||
cflags="\$$(shell pkg-config QtCore QtGui Qt3Support --cflags)"; \
|
||||
libs="\$$(shell pkg-config QtCore QtGui Qt3Support --libs)"; \
|
||||
binpath="\$$(shell pkg-config QtCore --variable=prefix)"; \
|
||||
moc="$$binpath/bin/moc"; \
|
||||
fi; \
|
||||
echo "KC_QT_CFLAGS=$$cflags" > $@; \
|
||||
echo "KC_QT_LIBS=$$libs" >> $@; \
|
||||
|
|
|
@ -425,9 +425,9 @@ static void check_conf(struct menu *menu)
|
|||
(sym_is_choice(sym) && sym_get_tristate_value(sym) == yes)) {
|
||||
if (input_mode == listnewconfig) {
|
||||
if (sym->name && !sym_is_choice_value(sym)) {
|
||||
printf("CONFIG_%s\n", sym->name);
|
||||
printf("%s%s\n", CONFIG_, sym->name);
|
||||
}
|
||||
} else {
|
||||
} else if (input_mode != oldnoconfig) {
|
||||
if (!conf_cnt++)
|
||||
printf(_("*\n* Restart config...\n*\n"));
|
||||
rootEntry = menu_get_parent_menu(menu);
|
||||
|
@ -466,7 +466,7 @@ int main(int ac, char **av)
|
|||
bindtextdomain(PACKAGE, LOCALEDIR);
|
||||
textdomain(PACKAGE);
|
||||
|
||||
while ((opt = getopt_long_only(ac, av, "", long_opts, NULL)) != -1) {
|
||||
while ((opt = getopt_long(ac, av, "", long_opts, NULL)) != -1) {
|
||||
input_mode = (enum input_mode)opt;
|
||||
switch (opt) {
|
||||
case silentoldconfig:
|
||||
|
@ -508,8 +508,7 @@ int main(int ac, char **av)
|
|||
name = conf_get_configname();
|
||||
if (stat(name, &tmpstat)) {
|
||||
fprintf(stderr, _("***\n"
|
||||
"*** You have not yet configured your barebox!\n"
|
||||
"*** (missing barebox config file \"%s\")\n"
|
||||
"*** Configuration file \"%s\" not found!\n"
|
||||
"***\n"
|
||||
"*** Please run some configurator (e.g. \"make oldconfig\" or\n"
|
||||
"*** \"make menuconfig\" or \"make xconfig\").\n"
|
||||
|
@ -530,8 +529,6 @@ int main(int ac, char **av)
|
|||
}
|
||||
break;
|
||||
case savedefconfig:
|
||||
conf_read(NULL);
|
||||
break;
|
||||
case silentoldconfig:
|
||||
case oldaskconfig:
|
||||
case oldconfig:
|
||||
|
@ -571,7 +568,7 @@ int main(int ac, char **av)
|
|||
name = getenv("KCONFIG_NOSILENTUPDATE");
|
||||
if (name && *name) {
|
||||
fprintf(stderr,
|
||||
_("\n*** Barebox configuration requires explicit update.\n\n"));
|
||||
_("\n*** The configuration requires explicit update.\n\n"));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -623,11 +620,11 @@ int main(int ac, char **av)
|
|||
* All other commands are only used to generate a config.
|
||||
*/
|
||||
if (conf_get_changed() && conf_write(NULL)) {
|
||||
fprintf(stderr, _("\n*** Error during writing of the barebox configuration.\n\n"));
|
||||
fprintf(stderr, _("\n*** Error during writing of the configuration.\n\n"));
|
||||
exit(1);
|
||||
}
|
||||
if (conf_write_autoconf()) {
|
||||
fprintf(stderr, _("\n*** Error during update of the barebox configuration.\n\n"));
|
||||
fprintf(stderr, _("\n*** Error during update of the configuration.\n\n"));
|
||||
return 1;
|
||||
}
|
||||
} else if (input_mode == savedefconfig) {
|
||||
|
@ -638,7 +635,7 @@ int main(int ac, char **av)
|
|||
}
|
||||
} else if (input_mode != listnewconfig) {
|
||||
if (conf_write(NULL)) {
|
||||
fprintf(stderr, _("\n*** Error during writing of the barebox configuration.\n\n"));
|
||||
fprintf(stderr, _("\n*** Error during writing of the configuration.\n\n"));
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include <sys/stat.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -18,6 +19,9 @@
|
|||
static void conf_warning(const char *fmt, ...)
|
||||
__attribute__ ((format (printf, 1, 2)));
|
||||
|
||||
static void conf_message(const char *fmt, ...)
|
||||
__attribute__ ((format (printf, 1, 2)));
|
||||
|
||||
static const char *conf_filename;
|
||||
static int conf_lineno, conf_warnings, conf_unsaved;
|
||||
|
||||
|
@ -34,6 +38,29 @@ static void conf_warning(const char *fmt, ...)
|
|||
conf_warnings++;
|
||||
}
|
||||
|
||||
static void conf_default_message_callback(const char *fmt, va_list ap)
|
||||
{
|
||||
printf("#\n# ");
|
||||
vprintf(fmt, ap);
|
||||
printf("\n#\n");
|
||||
}
|
||||
|
||||
static void (*conf_message_callback) (const char *fmt, va_list ap) =
|
||||
conf_default_message_callback;
|
||||
void conf_set_message_callback(void (*fn) (const char *fmt, va_list ap))
|
||||
{
|
||||
conf_message_callback = fn;
|
||||
}
|
||||
|
||||
static void conf_message(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
if (conf_message_callback)
|
||||
conf_message_callback(fmt, ap);
|
||||
}
|
||||
|
||||
const char *conf_get_configname(void)
|
||||
{
|
||||
char *name = getenv("KCONFIG_CONFIG");
|
||||
|
@ -183,9 +210,8 @@ int conf_read_simple(const char *name, int def)
|
|||
name = conf_expand_value(prop->expr->left.sym->name);
|
||||
in = zconf_fopen(name);
|
||||
if (in) {
|
||||
printf(_("#\n"
|
||||
"# using defaults found in %s\n"
|
||||
"#\n"), name);
|
||||
conf_message(_("using defaults found in %s"),
|
||||
name);
|
||||
goto load;
|
||||
}
|
||||
}
|
||||
|
@ -220,24 +246,23 @@ load:
|
|||
while (fgets(line, sizeof(line), in)) {
|
||||
conf_lineno++;
|
||||
sym = NULL;
|
||||
switch (line[0]) {
|
||||
case '#':
|
||||
if (memcmp(line + 2, "CONFIG_", 7))
|
||||
if (line[0] == '#') {
|
||||
if (memcmp(line + 2, CONFIG_, strlen(CONFIG_)))
|
||||
continue;
|
||||
p = strchr(line + 9, ' ');
|
||||
p = strchr(line + 2 + strlen(CONFIG_), ' ');
|
||||
if (!p)
|
||||
continue;
|
||||
*p++ = 0;
|
||||
if (strncmp(p, "is not set", 10))
|
||||
continue;
|
||||
if (def == S_DEF_USER) {
|
||||
sym = sym_find(line + 9);
|
||||
sym = sym_find(line + 2 + strlen(CONFIG_));
|
||||
if (!sym) {
|
||||
sym_add_change_count(1);
|
||||
break;
|
||||
goto setsym;
|
||||
}
|
||||
} else {
|
||||
sym = sym_lookup(line + 9, 0);
|
||||
sym = sym_lookup(line + 2 + strlen(CONFIG_), 0);
|
||||
if (sym->type == S_UNKNOWN)
|
||||
sym->type = S_BOOLEAN;
|
||||
}
|
||||
|
@ -253,13 +278,8 @@ load:
|
|||
default:
|
||||
;
|
||||
}
|
||||
break;
|
||||
case 'C':
|
||||
if (memcmp(line, "CONFIG_", 7)) {
|
||||
conf_warning("unexpected data");
|
||||
continue;
|
||||
}
|
||||
p = strchr(line + 7, '=');
|
||||
} else if (memcmp(line, CONFIG_, strlen(CONFIG_)) == 0) {
|
||||
p = strchr(line + strlen(CONFIG_), '=');
|
||||
if (!p)
|
||||
continue;
|
||||
*p++ = 0;
|
||||
|
@ -270,13 +290,13 @@ load:
|
|||
*p2 = 0;
|
||||
}
|
||||
if (def == S_DEF_USER) {
|
||||
sym = sym_find(line + 7);
|
||||
sym = sym_find(line + strlen(CONFIG_));
|
||||
if (!sym) {
|
||||
sym_add_change_count(1);
|
||||
break;
|
||||
goto setsym;
|
||||
}
|
||||
} else {
|
||||
sym = sym_lookup(line + 7, 0);
|
||||
sym = sym_lookup(line + strlen(CONFIG_), 0);
|
||||
if (sym->type == S_UNKNOWN)
|
||||
sym->type = S_OTHER;
|
||||
}
|
||||
|
@ -285,14 +305,12 @@ load:
|
|||
}
|
||||
if (conf_set_sym_val(sym, def, def_flags, p))
|
||||
continue;
|
||||
break;
|
||||
case '\r':
|
||||
case '\n':
|
||||
break;
|
||||
default:
|
||||
conf_warning("unexpected data");
|
||||
} else {
|
||||
if (line[0] != '\r' && line[0] != '\n')
|
||||
conf_warning("unexpected data");
|
||||
continue;
|
||||
}
|
||||
setsym:
|
||||
if (sym && sym_is_choice_value(sym)) {
|
||||
struct symbol *cs = prop_get_symbol(sym_get_choice_prop(sym));
|
||||
switch (sym->def[def].tri) {
|
||||
|
@ -405,9 +423,9 @@ static void conf_write_string(bool headerfile, const char *name,
|
|||
{
|
||||
int l;
|
||||
if (headerfile)
|
||||
fprintf(out, "#define CONFIG_%s \"", name);
|
||||
fprintf(out, "#define %s%s \"", CONFIG_, name);
|
||||
else
|
||||
fprintf(out, "CONFIG_%s=\"", name);
|
||||
fprintf(out, "%s%s=\"", CONFIG_, name);
|
||||
|
||||
while (1) {
|
||||
l = strcspn(str, "\"\\");
|
||||
|
@ -422,24 +440,24 @@ static void conf_write_string(bool headerfile, const char *name,
|
|||
fputs("\"\n", out);
|
||||
}
|
||||
|
||||
static void conf_write_symbol(struct symbol *sym, enum symbol_type type,
|
||||
FILE *out, bool write_no)
|
||||
static void conf_write_symbol(struct symbol *sym, FILE *out, bool write_no)
|
||||
{
|
||||
const char *str;
|
||||
|
||||
switch (type) {
|
||||
switch (sym->type) {
|
||||
case S_BOOLEAN:
|
||||
case S_TRISTATE:
|
||||
switch (sym_get_tristate_value(sym)) {
|
||||
case no:
|
||||
if (write_no)
|
||||
fprintf(out, "# CONFIG_%s is not set\n", sym->name);
|
||||
fprintf(out, "# %s%s is not set\n",
|
||||
CONFIG_, sym->name);
|
||||
break;
|
||||
case mod:
|
||||
fprintf(out, "CONFIG_%s=m\n", sym->name);
|
||||
fprintf(out, "%s%s=m\n", CONFIG_, sym->name);
|
||||
break;
|
||||
case yes:
|
||||
fprintf(out, "CONFIG_%s=y\n", sym->name);
|
||||
fprintf(out, "%s%s=y\n", CONFIG_, sym->name);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -449,7 +467,7 @@ static void conf_write_symbol(struct symbol *sym, enum symbol_type type,
|
|||
case S_HEX:
|
||||
case S_INT:
|
||||
str = sym_get_string_value(sym);
|
||||
fprintf(out, "CONFIG_%s=%s\n", sym->name, str);
|
||||
fprintf(out, "%s%s=%s\n", CONFIG_, sym->name, str);
|
||||
break;
|
||||
case S_OTHER:
|
||||
case S_UNKNOWN:
|
||||
|
@ -497,7 +515,9 @@ int conf_write_defconfig(const char *filename)
|
|||
/*
|
||||
* If symbol is a choice value and equals to the
|
||||
* default for a choice - skip.
|
||||
* But only if value is bool and equal to "y" .
|
||||
* But only if value is bool and equal to "y" and
|
||||
* choice is not "optional".
|
||||
* (If choice is "optional" then all values can be "n")
|
||||
*/
|
||||
if (sym_is_choice_value(sym)) {
|
||||
struct symbol *cs;
|
||||
|
@ -505,13 +525,13 @@ int conf_write_defconfig(const char *filename)
|
|||
|
||||
cs = prop_get_symbol(sym_get_choice_prop(sym));
|
||||
ds = sym_choice_default(cs);
|
||||
if (sym == ds) {
|
||||
if (!sym_is_optional(cs) && sym == ds) {
|
||||
if ((sym->type == S_BOOLEAN) &&
|
||||
sym_get_tristate_value(sym) == yes)
|
||||
goto next_menu;
|
||||
}
|
||||
}
|
||||
conf_write_symbol(sym, sym->type, out, true);
|
||||
conf_write_symbol(sym, out, true);
|
||||
}
|
||||
next_menu:
|
||||
if (menu->list != NULL) {
|
||||
|
@ -539,8 +559,7 @@ int conf_write(const char *name)
|
|||
struct menu *menu;
|
||||
const char *basename;
|
||||
const char *str;
|
||||
char dirname[128], tmpname[128], newname[128];
|
||||
enum symbol_type type;
|
||||
char dirname[PATH_MAX+1], tmpname[PATH_MAX+1], newname[PATH_MAX+1];
|
||||
time_t now;
|
||||
int use_timestamp = 1;
|
||||
char *env;
|
||||
|
@ -579,8 +598,6 @@ int conf_write(const char *name)
|
|||
if (!out)
|
||||
return 1;
|
||||
|
||||
sym = sym_lookup("KERNELVERSION", 0);
|
||||
sym_calc_value(sym);
|
||||
time(&now);
|
||||
env = getenv("KCONFIG_NOTIMESTAMP");
|
||||
if (env && *env)
|
||||
|
@ -588,10 +605,10 @@ int conf_write(const char *name)
|
|||
|
||||
fprintf(out, _("#\n"
|
||||
"# Automatically generated make config: don't edit\n"
|
||||
"# Linux barebox version: %s\n"
|
||||
"# %s\n"
|
||||
"%s%s"
|
||||
"#\n"),
|
||||
sym_get_string_value(sym),
|
||||
rootmenu.prompt->text,
|
||||
use_timestamp ? "# " : "",
|
||||
use_timestamp ? ctime(&now) : "");
|
||||
|
||||
|
@ -614,14 +631,8 @@ int conf_write(const char *name)
|
|||
if (!(sym->flags & SYMBOL_WRITE))
|
||||
goto next;
|
||||
sym->flags &= ~SYMBOL_WRITE;
|
||||
type = sym->type;
|
||||
if (type == S_TRISTATE) {
|
||||
sym_calc_value(modules_sym);
|
||||
if (modules_sym->curr.tri == no)
|
||||
type = S_BOOLEAN;
|
||||
}
|
||||
/* Write config symbol to file */
|
||||
conf_write_symbol(sym, type, out, true);
|
||||
conf_write_symbol(sym, out, true);
|
||||
}
|
||||
|
||||
next:
|
||||
|
@ -648,9 +659,7 @@ next:
|
|||
return 1;
|
||||
}
|
||||
|
||||
printf(_("#\n"
|
||||
"# configuration written to %s\n"
|
||||
"#\n"), newname);
|
||||
conf_message(_("configuration written to %s"), newname);
|
||||
|
||||
sym_set_change_count(0);
|
||||
|
||||
|
@ -660,7 +669,7 @@ next:
|
|||
static int conf_split_config(void)
|
||||
{
|
||||
const char *name;
|
||||
char path[128];
|
||||
char path[PATH_MAX+1];
|
||||
char *s, *d, c;
|
||||
struct symbol *sym;
|
||||
struct stat sb;
|
||||
|
@ -802,25 +811,22 @@ int conf_write_autoconf(void)
|
|||
return 1;
|
||||
}
|
||||
|
||||
sym = sym_lookup("KERNELVERSION", 0);
|
||||
sym_calc_value(sym);
|
||||
time(&now);
|
||||
fprintf(out, "#\n"
|
||||
"# Automatically generated make config: don't edit\n"
|
||||
"# Linux barebox version: %s\n"
|
||||
"# %s\n"
|
||||
"# %s"
|
||||
"#\n",
|
||||
sym_get_string_value(sym), ctime(&now));
|
||||
rootmenu.prompt->text, ctime(&now));
|
||||
fprintf(tristate, "#\n"
|
||||
"# Automatically generated - do not edit\n"
|
||||
"\n");
|
||||
fprintf(out_h, "/*\n"
|
||||
" * Automatically generated C config: don't edit\n"
|
||||
" * Linux barebox version: %s\n"
|
||||
" * %s\n"
|
||||
" * %s"
|
||||
" */\n"
|
||||
"#define AUTOCONF_INCLUDED\n",
|
||||
sym_get_string_value(sym), ctime(&now));
|
||||
" */\n",
|
||||
rootmenu.prompt->text, ctime(&now));
|
||||
|
||||
for_all_symbols(i, sym) {
|
||||
sym_calc_value(sym);
|
||||
|
@ -828,7 +834,7 @@ int conf_write_autoconf(void)
|
|||
continue;
|
||||
|
||||
/* write symbol to config file */
|
||||
conf_write_symbol(sym, sym->type, out, false);
|
||||
conf_write_symbol(sym, out, false);
|
||||
|
||||
/* update autoconf and tristate files */
|
||||
switch (sym->type) {
|
||||
|
@ -838,14 +844,17 @@ int conf_write_autoconf(void)
|
|||
case no:
|
||||
break;
|
||||
case mod:
|
||||
fprintf(tristate, "CONFIG_%s=M\n", sym->name);
|
||||
fprintf(out_h, "#define CONFIG_%s_MODULE 1\n", sym->name);
|
||||
fprintf(tristate, "%s%s=M\n",
|
||||
CONFIG_, sym->name);
|
||||
fprintf(out_h, "#define %s%s_MODULE 1\n",
|
||||
CONFIG_, sym->name);
|
||||
break;
|
||||
case yes:
|
||||
if (sym->type == S_TRISTATE)
|
||||
fprintf(tristate, "CONFIG_%s=Y\n",
|
||||
sym->name);
|
||||
fprintf(out_h, "#define CONFIG_%s 1\n", sym->name);
|
||||
fprintf(tristate,"%s%s=Y\n",
|
||||
CONFIG_, sym->name);
|
||||
fprintf(out_h, "#define %s%s 1\n",
|
||||
CONFIG_, sym->name);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -855,12 +864,14 @@ int conf_write_autoconf(void)
|
|||
case S_HEX:
|
||||
str = sym_get_string_value(sym);
|
||||
if (str[0] != '0' || (str[1] != 'x' && str[1] != 'X')) {
|
||||
fprintf(out_h, "#define CONFIG_%s 0x%s\n", sym->name, str);
|
||||
fprintf(out_h, "#define %s%s 0x%s\n",
|
||||
CONFIG_, sym->name, str);
|
||||
break;
|
||||
}
|
||||
case S_INT:
|
||||
str = sym_get_string_value(sym);
|
||||
fprintf(out_h, "#define CONFIG_%s %s\n", sym->name, str);
|
||||
fprintf(out_h, "#define %s%s %s\n",
|
||||
CONFIG_, sym->name, str);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -926,7 +937,7 @@ static void randomize_choice_values(struct symbol *csym)
|
|||
int cnt, def;
|
||||
|
||||
/*
|
||||
* If choice is mod then we may have more items slected
|
||||
* If choice is mod then we may have more items selected
|
||||
* and if no then no-one.
|
||||
* In both cases stop.
|
||||
*/
|
||||
|
@ -1022,10 +1033,10 @@ void conf_set_all_new_symbols(enum conf_def_mode mode)
|
|||
|
||||
/*
|
||||
* We have different type of choice blocks.
|
||||
* If curr.tri equal to mod then we can select several
|
||||
* If curr.tri equals to mod then we can select several
|
||||
* choice symbols in one block.
|
||||
* In this case we do nothing.
|
||||
* If curr.tri equal yes then only one symbol can be
|
||||
* If curr.tri equals yes then only one symbol can be
|
||||
* selected in a choice block and we set it to yes,
|
||||
* and the rest to no.
|
||||
*/
|
||||
|
|
|
@ -64,7 +64,7 @@ struct expr *expr_alloc_or(struct expr *e1, struct expr *e2)
|
|||
return e2 ? expr_alloc_two(E_OR, e1, e2) : e1;
|
||||
}
|
||||
|
||||
struct expr *expr_copy(struct expr *org)
|
||||
struct expr *expr_copy(const struct expr *org)
|
||||
{
|
||||
struct expr *e;
|
||||
|
||||
|
@ -1013,6 +1013,48 @@ int expr_compare_type(enum expr_type t1, enum expr_type t2)
|
|||
#endif
|
||||
}
|
||||
|
||||
static inline struct expr *
|
||||
expr_get_leftmost_symbol(const struct expr *e)
|
||||
{
|
||||
|
||||
if (e == NULL)
|
||||
return NULL;
|
||||
|
||||
while (e->type != E_SYMBOL)
|
||||
e = e->left.expr;
|
||||
|
||||
return expr_copy(e);
|
||||
}
|
||||
|
||||
/*
|
||||
* Given expression `e1' and `e2', returns the leaf of the longest
|
||||
* sub-expression of `e1' not containing 'e2.
|
||||
*/
|
||||
struct expr *expr_simplify_unmet_dep(struct expr *e1, struct expr *e2)
|
||||
{
|
||||
struct expr *ret;
|
||||
|
||||
switch (e1->type) {
|
||||
case E_OR:
|
||||
return expr_alloc_and(
|
||||
expr_simplify_unmet_dep(e1->left.expr, e2),
|
||||
expr_simplify_unmet_dep(e1->right.expr, e2));
|
||||
case E_AND: {
|
||||
struct expr *e;
|
||||
e = expr_alloc_and(expr_copy(e1), expr_copy(e2));
|
||||
e = expr_eliminate_dups(e);
|
||||
ret = (!expr_eq(e, e1)) ? e1 : NULL;
|
||||
expr_free(e);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
ret = e1;
|
||||
break;
|
||||
}
|
||||
|
||||
return expr_get_leftmost_symbol(ret);
|
||||
}
|
||||
|
||||
void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char *), void *data, int prevtoken)
|
||||
{
|
||||
if (!e) {
|
||||
|
|
|
@ -18,7 +18,7 @@ extern "C" {
|
|||
struct file {
|
||||
struct file *next;
|
||||
struct file *parent;
|
||||
char *name;
|
||||
const char *name;
|
||||
int lineno;
|
||||
int flags;
|
||||
};
|
||||
|
@ -164,8 +164,8 @@ struct menu {
|
|||
struct menu *list;
|
||||
struct symbol *sym;
|
||||
struct property *prompt;
|
||||
struct expr *visibility;
|
||||
struct expr *dep;
|
||||
struct expr *dir_dep;
|
||||
unsigned int flags;
|
||||
char *help;
|
||||
struct file *file;
|
||||
|
@ -192,7 +192,7 @@ struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e
|
|||
struct expr *expr_alloc_comp(enum expr_type type, struct symbol *s1, struct symbol *s2);
|
||||
struct expr *expr_alloc_and(struct expr *e1, struct expr *e2);
|
||||
struct expr *expr_alloc_or(struct expr *e1, struct expr *e2);
|
||||
struct expr *expr_copy(struct expr *org);
|
||||
struct expr *expr_copy(const struct expr *org);
|
||||
void expr_free(struct expr *e);
|
||||
int expr_eq(struct expr *e1, struct expr *e2);
|
||||
void expr_eliminate_eq(struct expr **ep1, struct expr **ep2);
|
||||
|
@ -207,6 +207,7 @@ struct expr *expr_extract_eq_and(struct expr **ep1, struct expr **ep2);
|
|||
struct expr *expr_extract_eq_or(struct expr **ep1, struct expr **ep2);
|
||||
void expr_extract_eq(enum expr_type type, struct expr **ep, struct expr **ep1, struct expr **ep2);
|
||||
struct expr *expr_trans_compare(struct expr *e, enum expr_type type, struct symbol *sym);
|
||||
struct expr *expr_simplify_unmet_dep(struct expr *e1, struct expr *e2);
|
||||
|
||||
void expr_fprint(struct expr *e, FILE *out);
|
||||
struct gstr; /* forward */
|
||||
|
|
|
@ -133,7 +133,6 @@ void init_main_window(const gchar * glade_file)
|
|||
GladeXML *xml;
|
||||
GtkWidget *widget;
|
||||
GtkTextBuffer *txtbuf;
|
||||
char title[256];
|
||||
GtkStyle *style;
|
||||
|
||||
xml = glade_xml_new(glade_file, "window1", NULL);
|
||||
|
@ -210,9 +209,7 @@ void init_main_window(const gchar * glade_file)
|
|||
/*"style", PANGO_STYLE_OBLIQUE, */
|
||||
NULL);
|
||||
|
||||
sprintf(title, _("Barebox v%s Configuration"),
|
||||
getenv("KERNELVERSION"));
|
||||
gtk_window_set_title(GTK_WINDOW(main_wnd), title);
|
||||
gtk_window_set_title(GTK_WINDOW(main_wnd), rootmenu.prompt->text);
|
||||
|
||||
gtk_widget_show(main_wnd);
|
||||
}
|
||||
|
@ -671,8 +668,7 @@ void on_introduction1_activate(GtkMenuItem * menuitem, gpointer user_data)
|
|||
{
|
||||
GtkWidget *dialog;
|
||||
const gchar *intro_text = _(
|
||||
"Welcome to gkc, the GTK+ graphical barebox configuration tool\n"
|
||||
"for Linux.\n"
|
||||
"Welcome to gkc, the GTK+ graphical configuration tool\n"
|
||||
"For each option, a blank box indicates the feature is disabled, a\n"
|
||||
"check indicates it is enabled, and a dot indicates that it is to\n"
|
||||
"be compiled as a module. Clicking on the box will cycle through the three states.\n"
|
||||
|
@ -1531,12 +1527,6 @@ int main(int ac, char *av[])
|
|||
else
|
||||
glade_file = g_strconcat(g_get_current_dir(), "/", av[0], ".glade", NULL);
|
||||
|
||||
/* Load the interface and connect signals */
|
||||
init_main_window(glade_file);
|
||||
init_tree_model();
|
||||
init_left_tree();
|
||||
init_right_tree();
|
||||
|
||||
/* Conf stuffs */
|
||||
if (ac > 1 && av[1][0] == '-') {
|
||||
switch (av[1][1]) {
|
||||
|
@ -1556,6 +1546,12 @@ int main(int ac, char *av[])
|
|||
fixup_rootmenu(&rootmenu);
|
||||
conf_read(NULL);
|
||||
|
||||
/* Load the interface and connect signals */
|
||||
init_main_window(glade_file);
|
||||
init_tree_model();
|
||||
init_left_tree();
|
||||
init_right_tree();
|
||||
|
||||
switch (view_mode) {
|
||||
case SINGLE_VIEW:
|
||||
display_tree_part();
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
|
||||
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
|
||||
|
||||
<glade-interface>
|
||||
|
||||
|
|
|
@ -63,11 +63,11 @@ next:
|
|||
|
||||
struct file_line {
|
||||
struct file_line *next;
|
||||
char* file;
|
||||
int lineno;
|
||||
const char *file;
|
||||
int lineno;
|
||||
};
|
||||
|
||||
static struct file_line *file_line__new(char *file, int lineno)
|
||||
static struct file_line *file_line__new(const char *file, int lineno)
|
||||
{
|
||||
struct file_line *self = malloc(sizeof(*self));
|
||||
|
||||
|
@ -90,7 +90,8 @@ struct message {
|
|||
|
||||
static struct message *message__list;
|
||||
|
||||
static struct message *message__new(const char *msg, char *option, char *file, int lineno)
|
||||
static struct message *message__new(const char *msg, char *option,
|
||||
const char *file, int lineno)
|
||||
{
|
||||
struct message *self = malloc(sizeof(*self));
|
||||
|
||||
|
@ -130,7 +131,8 @@ static struct message *mesage__find(const char *msg)
|
|||
return m;
|
||||
}
|
||||
|
||||
static int message__add_file_line(struct message *self, char *file, int lineno)
|
||||
static int message__add_file_line(struct message *self, const char *file,
|
||||
int lineno)
|
||||
{
|
||||
int rc = -1;
|
||||
struct file_line *fl = file_line__new(file, lineno);
|
||||
|
@ -145,7 +147,8 @@ out:
|
|||
return rc;
|
||||
}
|
||||
|
||||
static int message__add(const char *msg, char *option, char *file, int lineno)
|
||||
static int message__add(const char *msg, char *option, const char *file,
|
||||
int lineno)
|
||||
{
|
||||
int rc = 0;
|
||||
char bf[16384];
|
||||
|
|
|
@ -2373,9 +2373,10 @@ void zconf_nextfile(const char *name)
|
|||
memset(buf, 0, sizeof(*buf));
|
||||
|
||||
current_buf->state = YY_CURRENT_BUFFER;
|
||||
zconfin = zconf_fopen(name);
|
||||
zconfin = zconf_fopen(file->name);
|
||||
if (!zconfin) {
|
||||
printf("%s:%d: can't open file \"%s\"\n", zconf_curname(), zconf_lineno(), name);
|
||||
printf("%s:%d: can't open file \"%s\"\n",
|
||||
zconf_curname(), zconf_lineno(), file->name);
|
||||
exit(1);
|
||||
}
|
||||
zconf_switch_to_buffer(zconf_create_buffer(zconfin,YY_BUF_SIZE));
|
||||
|
@ -2422,7 +2423,7 @@ int zconf_lineno(void)
|
|||
return current_pos.lineno;
|
||||
}
|
||||
|
||||
char *zconf_curname(void)
|
||||
const char *zconf_curname(void)
|
||||
{
|
||||
return current_pos.file ? current_pos.file->name : "<none>";
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
static inline const char *gettext(const char *txt) { return txt; }
|
||||
static inline void textdomain(const char *domainname) {}
|
||||
static inline void bindtextdomain(const char *name, const char *dir) {}
|
||||
static inline char *bind_textdomain_codeset(const char *dn, char *c) { return c; }
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -31,12 +32,18 @@ extern "C" {
|
|||
|
||||
#define SRCTREE "srctree"
|
||||
|
||||
#ifndef PACKAGE
|
||||
#define PACKAGE "linux"
|
||||
#endif
|
||||
|
||||
#define LOCALEDIR "/usr/share/locale"
|
||||
|
||||
#define _(text) gettext(text)
|
||||
#define N_(text) (text)
|
||||
|
||||
#ifndef CONFIG_
|
||||
#define CONFIG_ "CONFIG_"
|
||||
#endif
|
||||
|
||||
#define TF_COMMAND 0x0001
|
||||
#define TF_PARAM 0x0002
|
||||
|
@ -61,16 +68,18 @@ struct kconf_id {
|
|||
enum symbol_type stype;
|
||||
};
|
||||
|
||||
#ifdef YYDEBUG
|
||||
extern int zconfdebug;
|
||||
#endif
|
||||
|
||||
int zconfparse(void);
|
||||
void zconfdump(FILE *out);
|
||||
|
||||
extern int zconfdebug;
|
||||
void zconf_starthelp(void);
|
||||
FILE *zconf_fopen(const char *name);
|
||||
void zconf_initscan(const char *name);
|
||||
void zconf_nextfile(const char *name);
|
||||
int zconf_lineno(void);
|
||||
char *zconf_curname(void);
|
||||
const char *zconf_curname(void);
|
||||
|
||||
/* conf.c */
|
||||
void xfgets(char *str, int size, FILE *in);
|
||||
|
@ -101,6 +110,7 @@ void menu_end_menu(void);
|
|||
void menu_add_entry(struct symbol *sym);
|
||||
void menu_end_entry(void);
|
||||
void menu_add_dep(struct expr *dep);
|
||||
void menu_add_visibility(struct expr *dep);
|
||||
struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *expr, struct expr *dep);
|
||||
struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep);
|
||||
void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep);
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#include <stdarg.h>
|
||||
|
||||
/* confdata.c */
|
||||
P(conf_parse,void,(const char *name));
|
||||
|
@ -8,6 +9,7 @@ P(conf_write,int,(const char *name));
|
|||
P(conf_write_autoconf,int,(void));
|
||||
P(conf_get_changed,bool,(void));
|
||||
P(conf_set_changed_callback, void,(void (*fn)(void)));
|
||||
P(conf_set_message_callback, void,(void (*fn)(const char *fmt, va_list ap)));
|
||||
|
||||
/* menu.c */
|
||||
P(rootmenu,struct menu,);
|
||||
|
@ -28,6 +30,7 @@ P(symbol_hash,struct symbol *,[SYMBOL_HASHSIZE]);
|
|||
|
||||
P(sym_lookup,struct symbol *,(const char *name, int flags));
|
||||
P(sym_find,struct symbol *,(const char *name));
|
||||
P(sym_expand_string_value,const char *,(const char *in));
|
||||
P(sym_re_search,struct symbol **,(const char *pattern));
|
||||
P(sym_type_name,const char *,(enum symbol_type type));
|
||||
P(sym_calc_value,void,(struct symbol *sym));
|
||||
|
|
|
@ -23,6 +23,8 @@ ccflags()
|
|||
echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"'
|
||||
elif [ -f /usr/include/ncurses/curses.h ]; then
|
||||
echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"'
|
||||
elif [ -f /usr/include/ncursesw/curses.h ]; then
|
||||
echo '-I/usr/include/ncursesw -DCURSES_LOC="<ncursesw/curses.h>"'
|
||||
elif [ -f /usr/include/ncurses.h ]; then
|
||||
echo '-DCURSES_LOC="<ncurses.h>"'
|
||||
else
|
||||
|
|
|
@ -25,11 +25,9 @@
|
|||
static const char mconf_readme[] = N_(
|
||||
"Overview\n"
|
||||
"--------\n"
|
||||
"Some barebox features may be built directly into the barebox.\n"
|
||||
"Some may be made into loadable runtime modules. Some features\n"
|
||||
"may be completely removed altogether. There are also certain\n"
|
||||
"barebox parameters which are not really features, but must be\n"
|
||||
"entered in as decimal or hexadecimal numbers or possibly text.\n"
|
||||
"This interface let you select features and parameters for the build.\n"
|
||||
"Features can either be built-in, modularized, or ignored. Parameters\n"
|
||||
"must be entered in as decimal or hexadecimal numbers or text.\n"
|
||||
"\n"
|
||||
"Menu items beginning with following braces represent features that\n"
|
||||
" [ ] can be built in or removed\n"
|
||||
|
@ -117,7 +115,7 @@ static const char mconf_readme[] = N_(
|
|||
"-----------------------------\n"
|
||||
"Menuconfig supports the use of alternate configuration files for\n"
|
||||
"those who, for various reasons, find it necessary to switch\n"
|
||||
"between different barebox configurations.\n"
|
||||
"between different configurations.\n"
|
||||
"\n"
|
||||
"At the end of the main menu you will find two options. One is\n"
|
||||
"for saving the current configuration to a file of your choosing.\n"
|
||||
|
@ -150,9 +148,9 @@ static const char mconf_readme[] = N_(
|
|||
"\n"
|
||||
"Optional personality available\n"
|
||||
"------------------------------\n"
|
||||
"If you prefer to have all of the barebox options listed in a single\n"
|
||||
"menu, rather than the default multimenu hierarchy, run the menuconfig\n"
|
||||
"with MENUCONFIG_MODE environment variable set to single_menu. Example:\n"
|
||||
"If you prefer to have all of the options listed in a single menu, rather\n"
|
||||
"than the default multimenu hierarchy, run the menuconfig with\n"
|
||||
"MENUCONFIG_MODE environment variable set to single_menu. Example:\n"
|
||||
"\n"
|
||||
"make MENUCONFIG_MODE=single_menu menuconfig\n"
|
||||
"\n"
|
||||
|
@ -207,12 +205,12 @@ load_config_text[] = N_(
|
|||
"last retrieved. Leave blank to abort."),
|
||||
load_config_help[] = N_(
|
||||
"\n"
|
||||
"For various reasons, one may wish to keep several different barebox\n"
|
||||
"For various reasons, one may wish to keep several different\n"
|
||||
"configurations available on a single machine.\n"
|
||||
"\n"
|
||||
"If you have saved a previous configuration in a file other than the\n"
|
||||
"barebox's default, entering the name of the file here will allow you\n"
|
||||
"to modify that configuration.\n"
|
||||
"default one, entering its name here will allow you to modify that\n"
|
||||
"configuration.\n"
|
||||
"\n"
|
||||
"If you are uncertain, then you have probably never used alternate\n"
|
||||
"configuration files. You should therefore leave this blank to abort.\n"),
|
||||
|
@ -221,8 +219,8 @@ save_config_text[] = N_(
|
|||
"as an alternate. Leave blank to abort."),
|
||||
save_config_help[] = N_(
|
||||
"\n"
|
||||
"For various reasons, one may wish to keep different barebox\n"
|
||||
"configurations available on a single machine.\n"
|
||||
"For various reasons, one may wish to keep different configurations\n"
|
||||
"available on a single machine.\n"
|
||||
"\n"
|
||||
"Entering a file name here will allow you to later retrieve, modify\n"
|
||||
"and use the current configuration as an alternate to whatever\n"
|
||||
|
@ -232,7 +230,7 @@ save_config_help[] = N_(
|
|||
"leave this blank.\n"),
|
||||
search_help[] = N_(
|
||||
"\n"
|
||||
"Search for CONFIG_ symbols and display their relations.\n"
|
||||
"Search for symbols and display their relations.\n"
|
||||
"Regular expressions are allowed.\n"
|
||||
"Example: search for \"^FOO\"\n"
|
||||
"Result:\n"
|
||||
|
@ -249,7 +247,7 @@ search_help[] = N_(
|
|||
"Selected by: BAR\n"
|
||||
"-----------------------------------------------------------------\n"
|
||||
"o The line 'Prompt:' shows the text used in the menu structure for\n"
|
||||
" this CONFIG_ symbol\n"
|
||||
" this symbol\n"
|
||||
"o The 'Defined at' line tell at what file / line number the symbol\n"
|
||||
" is defined\n"
|
||||
"o The 'Depends on:' line tell what symbols needs to be defined for\n"
|
||||
|
@ -265,9 +263,9 @@ search_help[] = N_(
|
|||
"Only relevant lines are shown.\n"
|
||||
"\n\n"
|
||||
"Search examples:\n"
|
||||
"Examples: USB => find all CONFIG_ symbols containing USB\n"
|
||||
" ^USB => find all CONFIG_ symbols starting with USB\n"
|
||||
" USB$ => find all CONFIG_ symbols ending with USB\n"
|
||||
"Examples: USB => find all symbols containing USB\n"
|
||||
" ^USB => find all symbols starting with USB\n"
|
||||
" USB$ => find all symbols ending with USB\n"
|
||||
"\n");
|
||||
|
||||
static int indent;
|
||||
|
@ -290,13 +288,9 @@ static void set_config_filename(const char *config_filename)
|
|||
{
|
||||
static char menu_backtitle[PATH_MAX+128];
|
||||
int size;
|
||||
struct symbol *sym;
|
||||
|
||||
sym = sym_lookup("KERNELVERSION", 0);
|
||||
sym_calc_value(sym);
|
||||
size = snprintf(menu_backtitle, sizeof(menu_backtitle),
|
||||
_("%s - Barebox v%s Configuration"),
|
||||
config_filename, sym_get_string_value(sym));
|
||||
"%s - %s", config_filename, rootmenu.prompt->text);
|
||||
if (size >= sizeof(menu_backtitle))
|
||||
menu_backtitle[sizeof(menu_backtitle)-1] = '\0';
|
||||
set_dialog_backtitle(menu_backtitle);
|
||||
|
@ -316,8 +310,8 @@ static void search_conf(void)
|
|||
again:
|
||||
dialog_clear();
|
||||
dres = dialog_inputbox(_("Search Configuration Parameter"),
|
||||
_("Enter CONFIG_ (sub)string to search for "
|
||||
"(with or without \"CONFIG\")"),
|
||||
_("Enter " CONFIG_ " (sub)string to search for "
|
||||
"(with or without \"" CONFIG_ "\")"),
|
||||
10, 75, "");
|
||||
switch (dres) {
|
||||
case 0:
|
||||
|
@ -329,10 +323,10 @@ again:
|
|||
return;
|
||||
}
|
||||
|
||||
/* strip CONFIG_ if necessary */
|
||||
/* strip the prefix if necessary */
|
||||
dialog_input = dialog_input_result;
|
||||
if (strncasecmp(dialog_input_result, "CONFIG_", 7) == 0)
|
||||
dialog_input += 7;
|
||||
if (strncasecmp(dialog_input_result, CONFIG_, strlen(CONFIG_)) == 0)
|
||||
dialog_input += strlen(CONFIG_);
|
||||
|
||||
sym_arr = sym_re_search(dialog_input);
|
||||
res = get_relations_str(sym_arr);
|
||||
|
@ -834,7 +828,7 @@ int main(int ac, char **av)
|
|||
if (conf_get_changed())
|
||||
res = dialog_yesno(NULL,
|
||||
_("Do you wish to save your "
|
||||
"new barebox configuration?\n"
|
||||
"new configuration?\n"
|
||||
"<ESC><ESC> to continue."),
|
||||
6, 60);
|
||||
else
|
||||
|
@ -846,20 +840,20 @@ int main(int ac, char **av)
|
|||
case 0:
|
||||
if (conf_write(filename)) {
|
||||
fprintf(stderr, _("\n\n"
|
||||
"Error during writing of the barebox configuration.\n"
|
||||
"Your barebox configuration changes were NOT saved."
|
||||
"Error while writing of the configuration.\n"
|
||||
"Your configuration changes were NOT saved."
|
||||
"\n\n"));
|
||||
return 1;
|
||||
}
|
||||
case -1:
|
||||
printf(_("\n\n"
|
||||
"*** End of Linux barebox configuration.\n"
|
||||
"*** Execute 'make' to build the barebox or try 'make help'."
|
||||
"*** End of the configuration.\n"
|
||||
"*** Execute 'make' to start the build or try 'make help'."
|
||||
"\n\n"));
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, _("\n\n"
|
||||
"Your barebox configuration changes were NOT saved."
|
||||
"Your configuration changes were NOT saved."
|
||||
"\n\n"));
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include "lkc.h"
|
||||
|
||||
static const char nohelp_text[] = N_(
|
||||
"There is no help available for this barebox option.\n");
|
||||
"There is no help available for this option.\n");
|
||||
|
||||
struct menu rootmenu;
|
||||
static struct menu **last_entry_ptr;
|
||||
|
@ -107,7 +107,6 @@ static struct expr *menu_check_dep(struct expr *e)
|
|||
void menu_add_dep(struct expr *dep)
|
||||
{
|
||||
current_entry->dep = expr_alloc_and(current_entry->dep, menu_check_dep(dep));
|
||||
current_entry->dir_dep = current_entry->dep;
|
||||
}
|
||||
|
||||
void menu_set_type(int type)
|
||||
|
@ -139,8 +138,22 @@ struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *e
|
|||
while (isspace(*prompt))
|
||||
prompt++;
|
||||
}
|
||||
if (current_entry->prompt)
|
||||
if (current_entry->prompt && current_entry != &rootmenu)
|
||||
prop_warn(prop, "prompt redefined");
|
||||
|
||||
/* Apply all upper menus' visibilities to actual prompts. */
|
||||
if(type == P_PROMPT) {
|
||||
struct menu *menu = current_entry;
|
||||
|
||||
while ((menu = menu->parent) != NULL) {
|
||||
if (!menu->visibility)
|
||||
continue;
|
||||
prop->visible.expr
|
||||
= expr_alloc_and(prop->visible.expr,
|
||||
menu->visibility);
|
||||
}
|
||||
}
|
||||
|
||||
current_entry->prompt = prop;
|
||||
}
|
||||
prop->text = prompt;
|
||||
|
@ -153,6 +166,12 @@ struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr
|
|||
return menu_add_prop(type, prompt, NULL, dep);
|
||||
}
|
||||
|
||||
void menu_add_visibility(struct expr *expr)
|
||||
{
|
||||
current_entry->visibility = expr_alloc_and(current_entry->visibility,
|
||||
expr);
|
||||
}
|
||||
|
||||
void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep)
|
||||
{
|
||||
menu_add_prop(type, NULL, expr, dep);
|
||||
|
@ -184,7 +203,7 @@ void menu_add_option(int token, char *arg)
|
|||
}
|
||||
}
|
||||
|
||||
static int menu_range_valid_sym(struct symbol *sym, struct symbol *sym2)
|
||||
static int menu_validate_number(struct symbol *sym, struct symbol *sym2)
|
||||
{
|
||||
return sym2->type == S_INT || sym2->type == S_HEX ||
|
||||
(sym2->type == S_UNKNOWN && sym_string_valid(sym, sym2->name));
|
||||
|
@ -202,6 +221,15 @@ static void sym_check_prop(struct symbol *sym)
|
|||
prop_warn(prop,
|
||||
"default for config symbol '%s'"
|
||||
" must be a single symbol", sym->name);
|
||||
if (prop->expr->type != E_SYMBOL)
|
||||
break;
|
||||
sym2 = prop_get_symbol(prop);
|
||||
if (sym->type == S_HEX || sym->type == S_INT) {
|
||||
if (!menu_validate_number(sym, sym2))
|
||||
prop_warn(prop,
|
||||
"'%s': number is invalid",
|
||||
sym->name);
|
||||
}
|
||||
break;
|
||||
case P_SELECT:
|
||||
sym2 = prop_get_symbol(prop);
|
||||
|
@ -221,8 +249,8 @@ static void sym_check_prop(struct symbol *sym)
|
|||
if (sym->type != S_INT && sym->type != S_HEX)
|
||||
prop_warn(prop, "range is only allowed "
|
||||
"for int or hex symbols");
|
||||
if (!menu_range_valid_sym(sym, prop->expr->left.sym) ||
|
||||
!menu_range_valid_sym(sym, prop->expr->right.sym))
|
||||
if (!menu_validate_number(sym, prop->expr->left.sym) ||
|
||||
!menu_validate_number(sym, prop->expr->right.sym))
|
||||
prop_warn(prop, "range is invalid");
|
||||
break;
|
||||
default:
|
||||
|
@ -291,10 +319,6 @@ void menu_finalize(struct menu *parent)
|
|||
for (menu = parent->list; menu; menu = menu->next)
|
||||
menu_finalize(menu);
|
||||
} else if (sym) {
|
||||
/* ignore inherited dependencies for dir_dep */
|
||||
sym->dir_dep.expr = expr_transform(expr_copy(parent->dir_dep));
|
||||
sym->dir_dep.expr = expr_eliminate_dups(sym->dir_dep.expr);
|
||||
|
||||
basedep = parent->prompt ? parent->prompt->visible.expr : NULL;
|
||||
basedep = expr_trans_compare(basedep, E_UNEQUAL, &symbol_no);
|
||||
basedep = expr_eliminate_dups(expr_transform(basedep));
|
||||
|
@ -325,6 +349,8 @@ void menu_finalize(struct menu *parent)
|
|||
parent->next = last_menu->next;
|
||||
last_menu->next = NULL;
|
||||
}
|
||||
|
||||
sym->dir_dep.expr = parent->dep;
|
||||
}
|
||||
for (menu = parent->list; menu; menu = menu->next) {
|
||||
if (sym && sym_is_choice(sym) &&
|
||||
|
@ -413,6 +439,11 @@ bool menu_is_visible(struct menu *menu)
|
|||
if (!menu->prompt)
|
||||
return false;
|
||||
|
||||
if (menu->visibility) {
|
||||
if (expr_calc_value(menu->visibility) == no)
|
||||
return no;
|
||||
}
|
||||
|
||||
sym = menu->sym;
|
||||
if (sym) {
|
||||
sym_calc_value(sym);
|
||||
|
@ -566,7 +597,7 @@ void menu_get_ext_help(struct menu *menu, struct gstr *help)
|
|||
|
||||
if (menu_has_help(menu)) {
|
||||
if (sym->name) {
|
||||
str_printf(help, "CONFIG_%s:\n\n", sym->name);
|
||||
str_printf(help, "%s%s:\n\n", CONFIG_, sym->name);
|
||||
str_append(help, _(menu_get_help(menu)));
|
||||
str_append(help, "\n");
|
||||
}
|
||||
|
|
|
@ -5,25 +5,26 @@
|
|||
* Derived from menuconfig.
|
||||
*
|
||||
*/
|
||||
#define _GNU_SOURCE
|
||||
#include <string.h>
|
||||
#define LKC_DIRECT_LINK
|
||||
#include "lkc.h"
|
||||
#include "nconf.h"
|
||||
#include <ctype.h>
|
||||
|
||||
static const char nconf_readme[] = N_(
|
||||
"Overview\n"
|
||||
"--------\n"
|
||||
"Some barebox features may be built directly into the barebox.\n"
|
||||
"Some may be made into loadable runtime modules. Some features\n"
|
||||
"may be completely removed altogether. There are also certain\n"
|
||||
"barebox parameters which are not really features, but must be\n"
|
||||
"entered in as decimal or hexadecimal numbers or possibly text.\n"
|
||||
"This interface let you select features and parameters for the build.\n"
|
||||
"Features can either be built-in, modularized, or ignored. Parameters\n"
|
||||
"must be entered in as decimal or hexadecimal numbers or text.\n"
|
||||
"\n"
|
||||
"Menu items beginning with following braces represent features that\n"
|
||||
" [ ] can be built in or removed\n"
|
||||
" < > can be built in, modularized or removed\n"
|
||||
" { } can be built in or modularized (selected by other feature)\n"
|
||||
" - - are selected by other feature,\n"
|
||||
" XXX cannot be selected. use Symbol Info to find out why,\n"
|
||||
" XXX cannot be selected. Use Symbol Info to find out why,\n"
|
||||
"while *, M or whitespace inside braces means to build in, build as\n"
|
||||
"a module or to exclude the feature respectively.\n"
|
||||
"\n"
|
||||
|
@ -41,9 +42,13 @@ static const char nconf_readme[] = N_(
|
|||
" pressing <Enter> of <right-arrow>. Use <Esc> or <left-arrow> to go back.\n"
|
||||
" Submenus are designated by \"--->\".\n"
|
||||
"\n"
|
||||
" Shortcut: Press the option's highlighted letter (hotkey).\n"
|
||||
" Pressing a hotkey more than once will sequence\n"
|
||||
" through all visible items which use that hotkey.\n"
|
||||
" Searching: pressing '/' triggers interactive search mode.\n"
|
||||
" nconfig performs a case insensitive search for the string\n"
|
||||
" in the menu prompts (no regex support).\n"
|
||||
" Pressing the up/down keys highlights the previous/next\n"
|
||||
" matching item. Backspace removes one character from the\n"
|
||||
" match string. Pressing either '/' again or ESC exits\n"
|
||||
" search mode. All other keys behave normally.\n"
|
||||
"\n"
|
||||
" You may also use the <PAGE UP> and <PAGE DOWN> keys to scroll\n"
|
||||
" unseen options into view.\n"
|
||||
|
@ -88,7 +93,7 @@ static const char nconf_readme[] = N_(
|
|||
"-----------------------------\n"
|
||||
"nconfig supports the use of alternate configuration files for\n"
|
||||
"those who, for various reasons, find it necessary to switch\n"
|
||||
"between different barebox configurations.\n"
|
||||
"between different configurations.\n"
|
||||
"\n"
|
||||
"At the end of the main menu you will find two options. One is\n"
|
||||
"for saving the current configuration to a file of your choosing.\n"
|
||||
|
@ -121,9 +126,9 @@ static const char nconf_readme[] = N_(
|
|||
"\n"
|
||||
"Optional personality available\n"
|
||||
"------------------------------\n"
|
||||
"If you prefer to have all of the barebox options listed in a single\n"
|
||||
"menu, rather than the default multimenu hierarchy, run the nconfig\n"
|
||||
"with NCONFIG_MODE environment variable set to single_menu. Example:\n"
|
||||
"If you prefer to have all of the options listed in a single menu, rather\n"
|
||||
"than the default multimenu hierarchy, run the nconfig with NCONFIG_MODE\n"
|
||||
"environment variable set to single_menu. Example:\n"
|
||||
"\n"
|
||||
"make NCONFIG_MODE=single_menu nconfig\n"
|
||||
"\n"
|
||||
|
@ -141,21 +146,21 @@ menu_no_f_instructions[] = N_(
|
|||
" <Enter> or <right-arrow> selects submenus --->.\n"
|
||||
" Capital Letters are hotkeys.\n"
|
||||
" Pressing <Y> includes, <N> excludes, <M> modularizes features.\n"
|
||||
" Pressing SpaceBar toggles between the above options\n"
|
||||
" Press <Esc> or <left-arrow> to go back one menu, \n"
|
||||
" Pressing SpaceBar toggles between the above options.\n"
|
||||
" Press <Esc> or <left-arrow> to go back one menu,\n"
|
||||
" <?> or <h> for Help, </> for Search.\n"
|
||||
" <1> is interchangable with <F1>, <2> with <F2>, etc.\n"
|
||||
" <1> is interchangeable with <F1>, <2> with <F2>, etc.\n"
|
||||
" Legend: [*] built-in [ ] excluded <M> module < > module capable.\n"
|
||||
" <Esc> always leaves the current window\n"),
|
||||
" <Esc> always leaves the current window.\n"),
|
||||
menu_instructions[] = N_(
|
||||
" Arrow keys navigate the menu.\n"
|
||||
" <Enter> or <right-arrow> selects submenus --->.\n"
|
||||
" Capital Letters are hotkeys.\n"
|
||||
" Pressing <Y> includes, <N> excludes, <M> modularizes features.\n"
|
||||
" Pressing SpaceBar toggles between the above options\n"
|
||||
" Press <Esc>, <F3> or <left-arrow> to go back one menu, \n"
|
||||
" Press <Esc>, <F5> or <left-arrow> to go back one menu,\n"
|
||||
" <?>, <F1> or <h> for Help, </> for Search.\n"
|
||||
" <1> is interchangable with <F1>, <2> with <F2>, etc.\n"
|
||||
" <1> is interchangeable with <F1>, <2> with <F2>, etc.\n"
|
||||
" Legend: [*] built-in [ ] excluded <M> module < > module capable.\n"
|
||||
" <Esc> always leaves the current window\n"),
|
||||
radiolist_instructions[] = N_(
|
||||
|
@ -178,19 +183,19 @@ setmod_text[] = N_(
|
|||
"has been configured as a module.\n"
|
||||
"As a result, this feature will be built as a module."),
|
||||
nohelp_text[] = N_(
|
||||
"There is no help available for this barebox option.\n"),
|
||||
"There is no help available for this option.\n"),
|
||||
load_config_text[] = N_(
|
||||
"Enter the name of the configuration file you wish to load.\n"
|
||||
"Accept the name shown to restore the configuration you\n"
|
||||
"last retrieved. Leave blank to abort."),
|
||||
load_config_help[] = N_(
|
||||
"\n"
|
||||
"For various reasons, one may wish to keep several different barebox\n"
|
||||
"For various reasons, one may wish to keep several different\n"
|
||||
"configurations available on a single machine.\n"
|
||||
"\n"
|
||||
"If you have saved a previous configuration in a file other than the\n"
|
||||
"barebox's default, entering the name of the file here will allow you\n"
|
||||
"to modify that configuration.\n"
|
||||
"default one, entering its name here will allow you to modify that\n"
|
||||
"configuration.\n"
|
||||
"\n"
|
||||
"If you are uncertain, then you have probably never used alternate\n"
|
||||
"configuration files. You should therefor leave this blank to abort.\n"),
|
||||
|
@ -199,8 +204,8 @@ save_config_text[] = N_(
|
|||
"as an alternate. Leave blank to abort."),
|
||||
save_config_help[] = N_(
|
||||
"\n"
|
||||
"For various reasons, one may wish to keep different barebox\n"
|
||||
"configurations available on a single machine.\n"
|
||||
"For various reasons, one may wish to keep different configurations\n"
|
||||
"available on a single machine.\n"
|
||||
"\n"
|
||||
"Entering a file name here will allow you to later retrieve, modify\n"
|
||||
"and use the current configuration as an alternate to whatever\n"
|
||||
|
@ -210,8 +215,8 @@ save_config_help[] = N_(
|
|||
"leave this blank.\n"),
|
||||
search_help[] = N_(
|
||||
"\n"
|
||||
"Search for CONFIG_ symbols and display their relations.\n"
|
||||
"Regular expressions are allowed.\n"
|
||||
"Search for symbols and display their relations. Regular expressions\n"
|
||||
"are allowed.\n"
|
||||
"Example: search for \"^FOO\"\n"
|
||||
"Result:\n"
|
||||
"-----------------------------------------------------------------\n"
|
||||
|
@ -227,7 +232,7 @@ search_help[] = N_(
|
|||
"Selected by: BAR\n"
|
||||
"-----------------------------------------------------------------\n"
|
||||
"o The line 'Prompt:' shows the text used in the menu structure for\n"
|
||||
" this CONFIG_ symbol\n"
|
||||
" this symbol\n"
|
||||
"o The 'Defined at' line tell at what file / line number the symbol\n"
|
||||
" is defined\n"
|
||||
"o The 'Depends on:' line tell what symbols needs to be defined for\n"
|
||||
|
@ -243,16 +248,15 @@ search_help[] = N_(
|
|||
"Only relevant lines are shown.\n"
|
||||
"\n\n"
|
||||
"Search examples:\n"
|
||||
"Examples: USB = > find all CONFIG_ symbols containing USB\n"
|
||||
" ^USB => find all CONFIG_ symbols starting with USB\n"
|
||||
" USB$ => find all CONFIG_ symbols ending with USB\n"
|
||||
"Examples: USB => find all symbols containing USB\n"
|
||||
" ^USB => find all symbols starting with USB\n"
|
||||
" USB$ => find all symbols ending with USB\n"
|
||||
"\n");
|
||||
|
||||
struct mitem {
|
||||
char str[256];
|
||||
char tag;
|
||||
void *usrptr;
|
||||
int is_hot;
|
||||
int is_visible;
|
||||
};
|
||||
|
||||
|
@ -275,14 +279,6 @@ static int items_num;
|
|||
static int global_exit;
|
||||
/* the currently selected button */
|
||||
const char *current_instructions = menu_instructions;
|
||||
/* this array is used to implement hot keys. it is updated in item_make and
|
||||
* resetted in clean_items. It would be better to use a hash, but lets keep it
|
||||
* simple... */
|
||||
#define MAX_SAME_KEY MAX_MENU_ITEMS
|
||||
struct {
|
||||
int count;
|
||||
int ptrs[MAX_MENU_ITEMS];
|
||||
} hotkeys[1<<(sizeof(char)*8)];
|
||||
|
||||
static void conf(struct menu *menu);
|
||||
static void conf_choice(struct menu *menu);
|
||||
|
@ -292,6 +288,7 @@ static void conf_save(void);
|
|||
static void show_help(struct menu *menu);
|
||||
static int do_exit(void);
|
||||
static void setup_windows(void);
|
||||
static void search_conf(void);
|
||||
|
||||
typedef void (*function_key_handler_t)(int *key, struct menu *menu);
|
||||
static void handle_f1(int *key, struct menu *current_item);
|
||||
|
@ -302,6 +299,7 @@ static void handle_f5(int *key, struct menu *current_item);
|
|||
static void handle_f6(int *key, struct menu *current_item);
|
||||
static void handle_f7(int *key, struct menu *current_item);
|
||||
static void handle_f8(int *key, struct menu *current_item);
|
||||
static void handle_f9(int *key, struct menu *current_item);
|
||||
|
||||
struct function_keys {
|
||||
const char *key_str;
|
||||
|
@ -310,7 +308,7 @@ struct function_keys {
|
|||
function_key_handler_t handler;
|
||||
};
|
||||
|
||||
static const int function_keys_num = 8;
|
||||
static const int function_keys_num = 9;
|
||||
struct function_keys function_keys[] = {
|
||||
{
|
||||
.key_str = "F1",
|
||||
|
@ -320,13 +318,13 @@ struct function_keys function_keys[] = {
|
|||
},
|
||||
{
|
||||
.key_str = "F2",
|
||||
.func = "Symbol Info",
|
||||
.func = "Sym Info",
|
||||
.key = F_SYMBOL,
|
||||
.handler = handle_f2,
|
||||
},
|
||||
{
|
||||
.key_str = "F3",
|
||||
.func = "Instructions",
|
||||
.func = "Insts",
|
||||
.key = F_INSTS,
|
||||
.handler = handle_f3,
|
||||
},
|
||||
|
@ -356,9 +354,15 @@ struct function_keys function_keys[] = {
|
|||
},
|
||||
{
|
||||
.key_str = "F8",
|
||||
.func = "Sym Search",
|
||||
.key = F_SEARCH,
|
||||
.handler = handle_f8,
|
||||
},
|
||||
{
|
||||
.key_str = "F9",
|
||||
.func = "Exit",
|
||||
.key = F_EXIT,
|
||||
.handler = handle_f8,
|
||||
.handler = handle_f9,
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -444,8 +448,15 @@ static void handle_f7(int *key, struct menu *current_item)
|
|||
return;
|
||||
}
|
||||
|
||||
/* exit */
|
||||
/* search */
|
||||
static void handle_f8(int *key, struct menu *current_item)
|
||||
{
|
||||
search_conf();
|
||||
return;
|
||||
}
|
||||
|
||||
/* exit */
|
||||
static void handle_f9(int *key, struct menu *current_item)
|
||||
{
|
||||
do_exit();
|
||||
return;
|
||||
|
@ -479,110 +490,44 @@ static void clean_items(void)
|
|||
free_item(curses_menu_items[i]);
|
||||
bzero(curses_menu_items, sizeof(curses_menu_items));
|
||||
bzero(k_menu_items, sizeof(k_menu_items));
|
||||
bzero(hotkeys, sizeof(hotkeys));
|
||||
items_num = 0;
|
||||
}
|
||||
|
||||
/* return the index of the next hot item, or -1 if no such item exists */
|
||||
static int get_next_hot(int c)
|
||||
typedef enum {MATCH_TINKER_PATTERN_UP, MATCH_TINKER_PATTERN_DOWN,
|
||||
FIND_NEXT_MATCH_DOWN, FIND_NEXT_MATCH_UP} match_f;
|
||||
|
||||
/* return the index of the matched item, or -1 if no such item exists */
|
||||
static int get_mext_match(const char *match_str, match_f flag)
|
||||
{
|
||||
static int hot_index;
|
||||
static int hot_char;
|
||||
int match_start = item_index(current_item(curses_menu));
|
||||
int index;
|
||||
|
||||
if (c < 0 || c > 255 || hotkeys[c].count <= 0)
|
||||
return -1;
|
||||
if (flag == FIND_NEXT_MATCH_DOWN)
|
||||
++match_start;
|
||||
else if (flag == FIND_NEXT_MATCH_UP)
|
||||
--match_start;
|
||||
|
||||
if (hot_char == c) {
|
||||
hot_index = (hot_index+1)%hotkeys[c].count;
|
||||
return hotkeys[c].ptrs[hot_index];
|
||||
} else {
|
||||
hot_char = c;
|
||||
hot_index = 0;
|
||||
return hotkeys[c].ptrs[0];
|
||||
index = match_start;
|
||||
index = (index + items_num) % items_num;
|
||||
while (true) {
|
||||
char *str = k_menu_items[index].str;
|
||||
if (strcasestr(str, match_str) != 0)
|
||||
return index;
|
||||
if (flag == FIND_NEXT_MATCH_UP ||
|
||||
flag == MATCH_TINKER_PATTERN_UP)
|
||||
--index;
|
||||
else
|
||||
++index;
|
||||
index = (index + items_num) % items_num;
|
||||
if (index == match_start)
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* can the char c be a hot key? no, if c is a common shortcut used elsewhere */
|
||||
static int canbhot(char c)
|
||||
{
|
||||
c = tolower(c);
|
||||
return isalnum(c) && c != 'y' && c != 'm' && c != 'h' &&
|
||||
c != 'n' && c != '?';
|
||||
}
|
||||
|
||||
/* check if str already contains a hot key. */
|
||||
static int is_hot(int index)
|
||||
{
|
||||
return k_menu_items[index].is_hot;
|
||||
}
|
||||
|
||||
/* find the first possible hot key, and mark it.
|
||||
* index is the index of the item in the menu
|
||||
* return 0 on success*/
|
||||
static int make_hot(char *dest, int len, const char *org, int index)
|
||||
{
|
||||
int position = -1;
|
||||
int i;
|
||||
int tmp;
|
||||
int c;
|
||||
int org_len = strlen(org);
|
||||
|
||||
if (org == NULL || is_hot(index))
|
||||
return 1;
|
||||
|
||||
/* make sure not to make hot keys out of markers.
|
||||
* find where to start looking for a hot key
|
||||
*/
|
||||
i = 0;
|
||||
/* skip white space */
|
||||
while (i < org_len && org[i] == ' ')
|
||||
i++;
|
||||
if (i == org_len)
|
||||
return -1;
|
||||
/* if encountering '(' or '<' or '[', find the match and look from there
|
||||
**/
|
||||
if (org[i] == '[' || org[i] == '<' || org[i] == '(') {
|
||||
i++;
|
||||
for (; i < org_len; i++)
|
||||
if (org[i] == ']' || org[i] == '>' || org[i] == ')')
|
||||
break;
|
||||
}
|
||||
if (i == org_len)
|
||||
return -1;
|
||||
for (; i < org_len; i++) {
|
||||
if (canbhot(org[i]) && org[i-1] != '<' && org[i-1] != '(') {
|
||||
position = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (position == -1)
|
||||
return 1;
|
||||
|
||||
/* ok, char at org[position] should be a hot key to this item */
|
||||
c = tolower(org[position]);
|
||||
tmp = hotkeys[c].count;
|
||||
hotkeys[c].ptrs[tmp] = index;
|
||||
hotkeys[c].count++;
|
||||
/*
|
||||
snprintf(dest, len, "%.*s(%c)%s", position, org, org[position],
|
||||
&org[position+1]);
|
||||
*/
|
||||
/* make org[position] uppercase, and all leading letter small case */
|
||||
strncpy(dest, org, len);
|
||||
for (i = 0; i < position; i++)
|
||||
dest[i] = tolower(dest[i]);
|
||||
dest[position] = toupper(dest[position]);
|
||||
k_menu_items[index].is_hot = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Make a new item. Add a hotkey mark in the first possible letter.
|
||||
* As ncurses does not allow any attributes inside menue item, we mark the
|
||||
* hot key as the first capitalized letter in the string */
|
||||
/* Make a new item. */
|
||||
static void item_make(struct menu *menu, char tag, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
char tmp_str[256];
|
||||
|
||||
if (items_num > MAX_MENU_ITEMS-1)
|
||||
return;
|
||||
|
@ -597,16 +542,13 @@ static void item_make(struct menu *menu, char tag, const char *fmt, ...)
|
|||
k_menu_items[items_num].is_visible = 1;
|
||||
|
||||
va_start(ap, fmt);
|
||||
vsnprintf(tmp_str, sizeof(tmp_str), fmt, ap);
|
||||
if (!k_menu_items[items_num].is_visible)
|
||||
memcpy(tmp_str, "XXX", 3);
|
||||
vsnprintf(k_menu_items[items_num].str,
|
||||
sizeof(k_menu_items[items_num].str),
|
||||
fmt, ap);
|
||||
va_end(ap);
|
||||
if (make_hot(
|
||||
k_menu_items[items_num].str,
|
||||
sizeof(k_menu_items[items_num].str), tmp_str, items_num) != 0)
|
||||
strncpy(k_menu_items[items_num].str,
|
||||
tmp_str,
|
||||
sizeof(k_menu_items[items_num].str));
|
||||
|
||||
if (!k_menu_items[items_num].is_visible)
|
||||
memcpy(k_menu_items[items_num].str, "XXX", 3);
|
||||
|
||||
curses_menu_items[items_num] = new_item(
|
||||
k_menu_items[items_num].str,
|
||||
|
@ -638,11 +580,9 @@ static void item_add_str(const char *fmt, ...)
|
|||
va_end(ap);
|
||||
snprintf(tmp_str, sizeof(tmp_str), "%s%s",
|
||||
k_menu_items[index].str, new_str);
|
||||
if (make_hot(k_menu_items[index].str,
|
||||
sizeof(k_menu_items[index].str), tmp_str, index) != 0)
|
||||
strncpy(k_menu_items[index].str,
|
||||
tmp_str,
|
||||
sizeof(k_menu_items[index].str));
|
||||
strncpy(k_menu_items[index].str,
|
||||
tmp_str,
|
||||
sizeof(k_menu_items[index].str));
|
||||
|
||||
free_item(curses_menu_items[index]);
|
||||
curses_menu_items[index] = new_item(
|
||||
|
@ -693,13 +633,9 @@ static char menu_backtitle[PATH_MAX+128];
|
|||
static const char *set_config_filename(const char *config_filename)
|
||||
{
|
||||
int size;
|
||||
struct symbol *sym;
|
||||
|
||||
sym = sym_lookup("KERNELVERSION", 0);
|
||||
sym_calc_value(sym);
|
||||
size = snprintf(menu_backtitle, sizeof(menu_backtitle),
|
||||
_("%s - Barebox v%s Configuration"),
|
||||
config_filename, sym_get_string_value(sym));
|
||||
"%s - %s", config_filename, rootmenu.prompt->text);
|
||||
if (size >= sizeof(menu_backtitle))
|
||||
menu_backtitle[sizeof(menu_backtitle)-1] = '\0';
|
||||
|
||||
|
@ -709,25 +645,6 @@ static const char *set_config_filename(const char *config_filename)
|
|||
return menu_backtitle;
|
||||
}
|
||||
|
||||
/* command = 0 is supress, 1 is restore */
|
||||
static void supress_stdout(int command)
|
||||
{
|
||||
static FILE *org_stdout;
|
||||
static FILE *org_stderr;
|
||||
|
||||
if (command == 0) {
|
||||
org_stdout = stdout;
|
||||
org_stderr = stderr;
|
||||
stdout = fopen("/dev/null", "a");
|
||||
stderr = fopen("/dev/null", "a");
|
||||
} else {
|
||||
fclose(stdout);
|
||||
fclose(stderr);
|
||||
stdout = org_stdout;
|
||||
stderr = org_stderr;
|
||||
}
|
||||
}
|
||||
|
||||
/* return = 0 means we are successful.
|
||||
* -1 means go on doing what you were doing
|
||||
*/
|
||||
|
@ -739,8 +656,7 @@ static int do_exit(void)
|
|||
return 0;
|
||||
}
|
||||
res = btn_dialog(main_window,
|
||||
_("Do you wish to save your "
|
||||
"new barebox configuration?\n"
|
||||
_("Do you wish to save your new configuration?\n"
|
||||
"<ESC> to cancel and resume nconfig."),
|
||||
2,
|
||||
" <save> ",
|
||||
|
@ -753,36 +669,19 @@ static int do_exit(void)
|
|||
/* if we got here, the user really wants to exit */
|
||||
switch (res) {
|
||||
case 0:
|
||||
supress_stdout(0);
|
||||
res = conf_write(filename);
|
||||
supress_stdout(1);
|
||||
if (res)
|
||||
btn_dialog(
|
||||
main_window,
|
||||
_("Error during writing of the barebox "
|
||||
"configuration.\n"
|
||||
"Your barebox configuration "
|
||||
"changes were NOT saved."),
|
||||
_("Error during writing of configuration.\n"
|
||||
"Your configuration changes were NOT saved."),
|
||||
1,
|
||||
"<OK>");
|
||||
else {
|
||||
char buf[1024];
|
||||
snprintf(buf, 1024,
|
||||
_("Configuration written to %s\n"
|
||||
"End of Linux barebox configuration.\n"
|
||||
"Execute 'make' to build the barebox or try"
|
||||
" 'make help'."), filename);
|
||||
btn_dialog(
|
||||
main_window,
|
||||
buf,
|
||||
1,
|
||||
"<OK>");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
btn_dialog(
|
||||
main_window,
|
||||
_("Your barebox configuration changes were NOT saved."),
|
||||
_("Your configuration changes were NOT saved."),
|
||||
1,
|
||||
"<OK>");
|
||||
break;
|
||||
|
@ -802,8 +701,8 @@ static void search_conf(void)
|
|||
again:
|
||||
dres = dialog_inputbox(main_window,
|
||||
_("Search Configuration Parameter"),
|
||||
_("Enter CONFIG_ (sub)string to search for "
|
||||
"(with or without \"CONFIG\")"),
|
||||
_("Enter " CONFIG_ " (sub)string to search for "
|
||||
"(with or without \"" CONFIG_ "\")"),
|
||||
"", dialog_input_result, 99);
|
||||
switch (dres) {
|
||||
case 0:
|
||||
|
@ -816,10 +715,10 @@ again:
|
|||
return;
|
||||
}
|
||||
|
||||
/* strip CONFIG_ if necessary */
|
||||
/* strip the prefix if necessary */
|
||||
dialog_input = dialog_input_result;
|
||||
if (strncasecmp(dialog_input_result, "CONFIG_", 7) == 0)
|
||||
dialog_input += 7;
|
||||
if (strncasecmp(dialog_input_result, CONFIG_, strlen(CONFIG_)) == 0)
|
||||
dialog_input += strlen(CONFIG_);
|
||||
|
||||
sym_arr = sym_re_search(dialog_input);
|
||||
res = get_relations_str(sym_arr);
|
||||
|
@ -1027,23 +926,18 @@ static void reset_menu(void)
|
|||
static void center_item(int selected_index, int *last_top_row)
|
||||
{
|
||||
int toprow;
|
||||
int maxy, maxx;
|
||||
|
||||
scale_menu(curses_menu, &maxy, &maxx);
|
||||
set_top_row(curses_menu, *last_top_row);
|
||||
toprow = top_row(curses_menu);
|
||||
if (selected_index >= toprow && selected_index < toprow+maxy) {
|
||||
/* we can only move the selected item. no need to scroll */
|
||||
set_current_item(curses_menu,
|
||||
curses_menu_items[selected_index]);
|
||||
} else {
|
||||
toprow = max(selected_index-maxy/2, 0);
|
||||
if (toprow >= item_count(curses_menu)-maxy)
|
||||
if (selected_index < toprow ||
|
||||
selected_index >= toprow+mwin_max_lines) {
|
||||
toprow = max(selected_index-mwin_max_lines/2, 0);
|
||||
if (toprow >= item_count(curses_menu)-mwin_max_lines)
|
||||
toprow = item_count(curses_menu)-mwin_max_lines;
|
||||
set_top_row(curses_menu, toprow);
|
||||
set_current_item(curses_menu,
|
||||
curses_menu_items[selected_index]);
|
||||
}
|
||||
set_current_item(curses_menu,
|
||||
curses_menu_items[selected_index]);
|
||||
*last_top_row = toprow;
|
||||
post_menu(curses_menu);
|
||||
refresh_all_windows(main_window);
|
||||
|
@ -1075,7 +969,7 @@ static void show_menu(const char *prompt, const char *instructions,
|
|||
/* position the menu at the middle of the screen */
|
||||
scale_menu(curses_menu, &maxy, &maxx);
|
||||
maxx = min(maxx, mwin_max_cols-2);
|
||||
maxy = mwin_max_lines-2;
|
||||
maxy = mwin_max_lines;
|
||||
menu_window = derwin(main_window,
|
||||
maxy,
|
||||
maxx,
|
||||
|
@ -1099,10 +993,77 @@ static void show_menu(const char *prompt, const char *instructions,
|
|||
refresh_all_windows(main_window);
|
||||
}
|
||||
|
||||
static void adj_match_dir(match_f *match_direction)
|
||||
{
|
||||
if (*match_direction == FIND_NEXT_MATCH_DOWN)
|
||||
*match_direction =
|
||||
MATCH_TINKER_PATTERN_DOWN;
|
||||
else if (*match_direction == FIND_NEXT_MATCH_UP)
|
||||
*match_direction =
|
||||
MATCH_TINKER_PATTERN_UP;
|
||||
/* else, do no change.. */
|
||||
}
|
||||
|
||||
struct match_state
|
||||
{
|
||||
int in_search;
|
||||
match_f match_direction;
|
||||
char pattern[256];
|
||||
};
|
||||
|
||||
/* Return 0 means I have handled the key. In such a case, ans should hold the
|
||||
* item to center, or -1 otherwise.
|
||||
* Else return -1 .
|
||||
*/
|
||||
static int do_match(int key, struct match_state *state, int *ans)
|
||||
{
|
||||
char c = (char) key;
|
||||
int terminate_search = 0;
|
||||
*ans = -1;
|
||||
if (key == '/' || (state->in_search && key == 27)) {
|
||||
move(0, 0);
|
||||
refresh();
|
||||
clrtoeol();
|
||||
state->in_search = 1-state->in_search;
|
||||
bzero(state->pattern, sizeof(state->pattern));
|
||||
state->match_direction = MATCH_TINKER_PATTERN_DOWN;
|
||||
return 0;
|
||||
} else if (!state->in_search)
|
||||
return 1;
|
||||
|
||||
if (isalnum(c) || isgraph(c) || c == ' ') {
|
||||
state->pattern[strlen(state->pattern)] = c;
|
||||
state->pattern[strlen(state->pattern)] = '\0';
|
||||
adj_match_dir(&state->match_direction);
|
||||
*ans = get_mext_match(state->pattern,
|
||||
state->match_direction);
|
||||
} else if (key == KEY_DOWN) {
|
||||
state->match_direction = FIND_NEXT_MATCH_DOWN;
|
||||
*ans = get_mext_match(state->pattern,
|
||||
state->match_direction);
|
||||
} else if (key == KEY_UP) {
|
||||
state->match_direction = FIND_NEXT_MATCH_UP;
|
||||
*ans = get_mext_match(state->pattern,
|
||||
state->match_direction);
|
||||
} else if (key == KEY_BACKSPACE || key == 127) {
|
||||
state->pattern[strlen(state->pattern)-1] = '\0';
|
||||
adj_match_dir(&state->match_direction);
|
||||
} else
|
||||
terminate_search = 1;
|
||||
|
||||
if (terminate_search) {
|
||||
state->in_search = 0;
|
||||
bzero(state->pattern, sizeof(state->pattern));
|
||||
move(0, 0);
|
||||
refresh();
|
||||
clrtoeol();
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void conf(struct menu *menu)
|
||||
{
|
||||
char pattern[256];
|
||||
struct menu *submenu = 0;
|
||||
const char *prompt = menu_get_prompt(menu);
|
||||
struct symbol *sym;
|
||||
|
@ -1110,8 +1071,11 @@ static void conf(struct menu *menu)
|
|||
int res;
|
||||
int current_index = 0;
|
||||
int last_top_row = 0;
|
||||
|
||||
bzero(pattern, sizeof(pattern));
|
||||
struct match_state match_state = {
|
||||
.in_search = 0,
|
||||
.match_direction = MATCH_TINKER_PATTERN_DOWN,
|
||||
.pattern = "",
|
||||
};
|
||||
|
||||
while (!global_exit) {
|
||||
reset_menu();
|
||||
|
@ -1124,7 +1088,22 @@ static void conf(struct menu *menu)
|
|||
_(menu_instructions),
|
||||
current_index, &last_top_row);
|
||||
keypad((menu_win(curses_menu)), TRUE);
|
||||
while (!global_exit && (res = wgetch(menu_win(curses_menu)))) {
|
||||
while (!global_exit) {
|
||||
if (match_state.in_search) {
|
||||
mvprintw(0, 0,
|
||||
"searching: %s", match_state.pattern);
|
||||
clrtoeol();
|
||||
}
|
||||
refresh_all_windows(main_window);
|
||||
res = wgetch(menu_win(curses_menu));
|
||||
if (!res)
|
||||
break;
|
||||
if (do_match(res, &match_state, ¤t_index) == 0) {
|
||||
if (current_index != -1)
|
||||
center_item(current_index,
|
||||
&last_top_row);
|
||||
continue;
|
||||
}
|
||||
if (process_special_keys(&res,
|
||||
(struct menu *) item_data()))
|
||||
break;
|
||||
|
@ -1155,19 +1134,13 @@ static void conf(struct menu *menu)
|
|||
if (res == 10 || res == 27 ||
|
||||
res == 32 || res == 'n' || res == 'y' ||
|
||||
res == KEY_LEFT || res == KEY_RIGHT ||
|
||||
res == 'm' || res == '/')
|
||||
res == 'm')
|
||||
break;
|
||||
else if (canbhot(res)) {
|
||||
/* check for hot keys: */
|
||||
int tmp = get_next_hot(res);
|
||||
if (tmp != -1)
|
||||
center_item(tmp, &last_top_row);
|
||||
}
|
||||
refresh_all_windows(main_window);
|
||||
}
|
||||
|
||||
refresh_all_windows(main_window);
|
||||
/* if ESC or left*/
|
||||
/* if ESC or left*/
|
||||
if (res == 27 || (menu != &rootmenu && res == KEY_LEFT))
|
||||
break;
|
||||
|
||||
|
@ -1235,23 +1208,30 @@ static void conf(struct menu *menu)
|
|||
if (item_is_tag('t'))
|
||||
sym_set_tristate_value(sym, mod);
|
||||
break;
|
||||
case '/':
|
||||
search_conf();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void conf_message_callback(const char *fmt, va_list ap)
|
||||
{
|
||||
char buf[1024];
|
||||
|
||||
vsnprintf(buf, sizeof(buf), fmt, ap);
|
||||
btn_dialog(main_window, buf, 1, "<OK>");
|
||||
}
|
||||
|
||||
static void show_help(struct menu *menu)
|
||||
{
|
||||
struct gstr help = str_new();
|
||||
|
||||
if (menu && menu->sym && menu_has_help(menu)) {
|
||||
if (menu->sym->name) {
|
||||
str_printf(&help, "CONFIG_%s:\n\n", menu->sym->name);
|
||||
str_printf(&help, "%s%s:\n\n", CONFIG_, menu->sym->name);
|
||||
str_append(&help, _(menu_get_help(menu)));
|
||||
str_append(&help, "\n");
|
||||
get_symbol_str(&help, menu->sym);
|
||||
} else {
|
||||
str_append(&help, _(menu_get_help(menu)));
|
||||
}
|
||||
} else {
|
||||
str_append(&help, nohelp_text);
|
||||
|
@ -1268,6 +1248,11 @@ static void conf_choice(struct menu *menu)
|
|||
int selected_index = 0;
|
||||
int last_top_row = 0;
|
||||
int res, i = 0;
|
||||
struct match_state match_state = {
|
||||
.in_search = 0,
|
||||
.match_direction = MATCH_TINKER_PATTERN_DOWN,
|
||||
.pattern = "",
|
||||
};
|
||||
|
||||
active = sym_get_choice_value(menu->sym);
|
||||
/* this is mostly duplicated from the conf() function. */
|
||||
|
@ -1281,9 +1266,13 @@ static void conf_choice(struct menu *menu)
|
|||
if (child->sym == sym_get_choice_value(menu->sym))
|
||||
item_make(child, ':', "<X> %s",
|
||||
_(menu_get_prompt(child)));
|
||||
else
|
||||
else if (child->sym)
|
||||
item_make(child, ':', " %s",
|
||||
_(menu_get_prompt(child)));
|
||||
else
|
||||
item_make(child, ':', "*** %s ***",
|
||||
_(menu_get_prompt(child)));
|
||||
|
||||
if (child->sym == active){
|
||||
last_top_row = top_row(curses_menu);
|
||||
selected_index = i;
|
||||
|
@ -1294,7 +1283,22 @@ static void conf_choice(struct menu *menu)
|
|||
_(radiolist_instructions),
|
||||
selected_index,
|
||||
&last_top_row);
|
||||
while (!global_exit && (res = wgetch(menu_win(curses_menu)))) {
|
||||
while (!global_exit) {
|
||||
if (match_state.in_search) {
|
||||
mvprintw(0, 0, "searching: %s",
|
||||
match_state.pattern);
|
||||
clrtoeol();
|
||||
}
|
||||
refresh_all_windows(main_window);
|
||||
res = wgetch(menu_win(curses_menu));
|
||||
if (!res)
|
||||
break;
|
||||
if (do_match(res, &match_state, &selected_index) == 0) {
|
||||
if (selected_index != -1)
|
||||
center_item(selected_index,
|
||||
&last_top_row);
|
||||
continue;
|
||||
}
|
||||
if (process_special_keys(
|
||||
&res,
|
||||
(struct menu *) item_data()))
|
||||
|
@ -1324,13 +1328,8 @@ static void conf_choice(struct menu *menu)
|
|||
break;
|
||||
}
|
||||
if (res == 10 || res == 27 || res == ' ' ||
|
||||
res == KEY_LEFT)
|
||||
res == KEY_LEFT){
|
||||
break;
|
||||
else if (canbhot(res)) {
|
||||
/* check for hot keys: */
|
||||
int tmp = get_next_hot(res);
|
||||
if (tmp != -1)
|
||||
center_item(tmp, &last_top_row);
|
||||
}
|
||||
refresh_all_windows(main_window);
|
||||
}
|
||||
|
@ -1339,7 +1338,7 @@ static void conf_choice(struct menu *menu)
|
|||
break;
|
||||
|
||||
child = item_data();
|
||||
if (!child || !menu_is_visible(child))
|
||||
if (!child || !menu_is_visible(child) || !child->sym)
|
||||
continue;
|
||||
switch (res) {
|
||||
case ' ':
|
||||
|
@ -1449,16 +1448,8 @@ static void conf_save(void)
|
|||
case 0:
|
||||
if (!dialog_input_result[0])
|
||||
return;
|
||||
supress_stdout(0);
|
||||
res = conf_write(dialog_input_result);
|
||||
supress_stdout(1);
|
||||
if (!res) {
|
||||
char buf[1024];
|
||||
sprintf(buf, "%s %s",
|
||||
_("configuration file saved to: "),
|
||||
dialog_input_result);
|
||||
btn_dialog(main_window,
|
||||
buf, 1, "<OK>");
|
||||
set_config_filename(dialog_input_result);
|
||||
return;
|
||||
}
|
||||
|
@ -1485,7 +1476,7 @@ void setup_windows(void)
|
|||
/* set up the menu and menu window */
|
||||
main_window = newwin(LINES-2, COLS-2, 2, 1);
|
||||
keypad(main_window, TRUE);
|
||||
mwin_max_lines = LINES-6;
|
||||
mwin_max_lines = LINES-7;
|
||||
mwin_max_cols = COLS-6;
|
||||
|
||||
/* panels order is from bottom to top */
|
||||
|
@ -1532,9 +1523,10 @@ int main(int ac, char **av)
|
|||
/* set btns menu */
|
||||
curses_menu = new_menu(curses_menu_items);
|
||||
menu_opts_off(curses_menu, O_SHOWDESC);
|
||||
menu_opts_off(curses_menu, O_SHOWMATCH);
|
||||
menu_opts_on(curses_menu, O_SHOWMATCH);
|
||||
menu_opts_on(curses_menu, O_ONEVALUE);
|
||||
menu_opts_on(curses_menu, O_NONCYCLIC);
|
||||
menu_opts_on(curses_menu, O_IGNORECASE);
|
||||
set_menu_mark(curses_menu, " ");
|
||||
set_menu_fore(curses_menu, attributes[MAIN_MENU_FORE]);
|
||||
set_menu_back(curses_menu, attributes[MAIN_MENU_BACK]);
|
||||
|
@ -1550,8 +1542,7 @@ int main(int ac, char **av)
|
|||
_(menu_no_f_instructions));
|
||||
}
|
||||
|
||||
|
||||
|
||||
conf_set_message_callback(conf_message_callback);
|
||||
/* do the work */
|
||||
while (!global_exit) {
|
||||
conf(&rootmenu);
|
||||
|
|
|
@ -137,7 +137,7 @@ void set_colors()
|
|||
if (has_colors()) {
|
||||
normal_color_theme();
|
||||
} else {
|
||||
/* give deafults */
|
||||
/* give defaults */
|
||||
no_colors_theme();
|
||||
}
|
||||
}
|
||||
|
@ -167,7 +167,7 @@ void print_in_middle(WINDOW *win,
|
|||
length = strlen(string);
|
||||
temp = (width - length) / 2;
|
||||
x = startx + (int)temp;
|
||||
wattrset(win, color);
|
||||
(void) wattrset(win, color);
|
||||
mvwprintw(win, y, x, "%s", string);
|
||||
refresh();
|
||||
}
|
||||
|
@ -297,11 +297,11 @@ int btn_dialog(WINDOW *main_window, const char *msg, int btn_num, ...)
|
|||
set_menu_fore(menu, attributes[DIALOG_MENU_FORE]);
|
||||
set_menu_back(menu, attributes[DIALOG_MENU_BACK]);
|
||||
|
||||
wattrset(win, attributes[DIALOG_BOX]);
|
||||
(void) wattrset(win, attributes[DIALOG_BOX]);
|
||||
box(win, 0, 0);
|
||||
|
||||
/* print message */
|
||||
wattrset(msg_win, attributes[DIALOG_TEXT]);
|
||||
(void) wattrset(msg_win, attributes[DIALOG_TEXT]);
|
||||
fill_window(msg_win, msg);
|
||||
|
||||
set_menu_win(menu, win);
|
||||
|
@ -392,16 +392,16 @@ int dialog_inputbox(WINDOW *main_window,
|
|||
form_win = derwin(win, 1, prompt_width, prompt_lines+3, 2);
|
||||
keypad(form_win, TRUE);
|
||||
|
||||
wattrset(form_win, attributes[INPUT_FIELD]);
|
||||
(void) wattrset(form_win, attributes[INPUT_FIELD]);
|
||||
|
||||
wattrset(win, attributes[INPUT_BOX]);
|
||||
(void) wattrset(win, attributes[INPUT_BOX]);
|
||||
box(win, 0, 0);
|
||||
wattrset(win, attributes[INPUT_HEADING]);
|
||||
(void) wattrset(win, attributes[INPUT_HEADING]);
|
||||
if (title)
|
||||
mvwprintw(win, 0, 3, "%s", title);
|
||||
|
||||
/* print message */
|
||||
wattrset(prompt_win, attributes[INPUT_TEXT]);
|
||||
(void) wattrset(prompt_win, attributes[INPUT_TEXT]);
|
||||
fill_window(prompt_win, prompt);
|
||||
|
||||
mvwprintw(form_win, 0, 0, "%*s", prompt_width, " ");
|
||||
|
@ -531,7 +531,7 @@ void show_scroll_win(WINDOW *main_window,
|
|||
|
||||
/* create the pad */
|
||||
pad = newpad(total_lines+10, total_cols+10);
|
||||
wattrset(pad, attributes[SCROLLWIN_TEXT]);
|
||||
(void) wattrset(pad, attributes[SCROLLWIN_TEXT]);
|
||||
fill_window(pad, text);
|
||||
|
||||
win_lines = min(total_lines+4, LINES-2);
|
||||
|
@ -546,9 +546,9 @@ void show_scroll_win(WINDOW *main_window,
|
|||
win = newwin(win_lines, win_cols, y, x);
|
||||
keypad(win, TRUE);
|
||||
/* show the help in the help window, and show the help panel */
|
||||
wattrset(win, attributes[SCROLLWIN_BOX]);
|
||||
(void) wattrset(win, attributes[SCROLLWIN_BOX]);
|
||||
box(win, 0, 0);
|
||||
wattrset(win, attributes[SCROLLWIN_HEADING]);
|
||||
(void) wattrset(win, attributes[SCROLLWIN_HEADING]);
|
||||
mvwprintw(win, 0, 3, " %s ", title);
|
||||
panel = new_panel(win);
|
||||
|
||||
|
|
|
@ -69,7 +69,8 @@ typedef enum {
|
|||
F_BACK = 5,
|
||||
F_SAVE = 6,
|
||||
F_LOAD = 7,
|
||||
F_EXIT = 8
|
||||
F_SEARCH = 8,
|
||||
F_EXIT = 9,
|
||||
} function_key;
|
||||
|
||||
void set_colors(void);
|
||||
|
|
|
@ -3,25 +3,42 @@
|
|||
* Released under the terms of the GNU GPL v2.0.
|
||||
*/
|
||||
|
||||
#include <qapplication.h>
|
||||
#include <qglobal.h>
|
||||
|
||||
#if QT_VERSION < 0x040000
|
||||
#include <qmainwindow.h>
|
||||
#include <qvbox.h>
|
||||
#include <qvaluelist.h>
|
||||
#include <qtextbrowser.h>
|
||||
#include <qaction.h>
|
||||
#include <qheader.h>
|
||||
#include <qfiledialog.h>
|
||||
#include <qdragobject.h>
|
||||
#include <qpopupmenu.h>
|
||||
#else
|
||||
#include <q3mainwindow.h>
|
||||
#include <q3vbox.h>
|
||||
#include <q3valuelist.h>
|
||||
#include <q3textbrowser.h>
|
||||
#include <q3action.h>
|
||||
#include <q3header.h>
|
||||
#include <q3filedialog.h>
|
||||
#include <q3dragobject.h>
|
||||
#include <q3popupmenu.h>
|
||||
#endif
|
||||
|
||||
#include <qapplication.h>
|
||||
#include <qdesktopwidget.h>
|
||||
#include <qtoolbar.h>
|
||||
#include <qlayout.h>
|
||||
#include <qvbox.h>
|
||||
#include <qsplitter.h>
|
||||
#include <qlistview.h>
|
||||
#include <qtextbrowser.h>
|
||||
#include <qlineedit.h>
|
||||
#include <qlabel.h>
|
||||
#include <qpushbutton.h>
|
||||
#include <qmenubar.h>
|
||||
#include <qmessagebox.h>
|
||||
#include <qaction.h>
|
||||
#include <qheader.h>
|
||||
#include <qfiledialog.h>
|
||||
#include <qdragobject.h>
|
||||
#include <qregexp.h>
|
||||
#include <qevent.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
|
@ -39,7 +56,7 @@
|
|||
static QApplication *configApp;
|
||||
static ConfigSettings *configSettings;
|
||||
|
||||
QAction *ConfigMainWindow::saveAction;
|
||||
Q3Action *ConfigMainWindow::saveAction;
|
||||
|
||||
static inline QString qgettext(const char* str)
|
||||
{
|
||||
|
@ -54,9 +71,9 @@ static inline QString qgettext(const QString& str)
|
|||
/**
|
||||
* Reads a list of integer values from the application settings.
|
||||
*/
|
||||
QValueList<int> ConfigSettings::readSizes(const QString& key, bool *ok)
|
||||
Q3ValueList<int> ConfigSettings::readSizes(const QString& key, bool *ok)
|
||||
{
|
||||
QValueList<int> result;
|
||||
Q3ValueList<int> result;
|
||||
QStringList entryList = readListEntry(key, ok);
|
||||
QStringList::Iterator it;
|
||||
|
||||
|
@ -69,10 +86,10 @@ QValueList<int> ConfigSettings::readSizes(const QString& key, bool *ok)
|
|||
/**
|
||||
* Writes a list of integer values to the application settings.
|
||||
*/
|
||||
bool ConfigSettings::writeSizes(const QString& key, const QValueList<int>& value)
|
||||
bool ConfigSettings::writeSizes(const QString& key, const Q3ValueList<int>& value)
|
||||
{
|
||||
QStringList stringList;
|
||||
QValueList<int>::ConstIterator it;
|
||||
Q3ValueList<int>::ConstIterator it;
|
||||
|
||||
for (it = value.begin(); it != value.end(); ++it)
|
||||
stringList.push_back(QString::number(*it));
|
||||
|
@ -80,7 +97,6 @@ bool ConfigSettings::writeSizes(const QString& key, const QValueList<int>& value
|
|||
}
|
||||
|
||||
|
||||
#if QT_VERSION >= 300
|
||||
/*
|
||||
* set the new data
|
||||
* TODO check the value
|
||||
|
@ -91,7 +107,6 @@ void ConfigItem::okRename(int col)
|
|||
sym_set_string_value(menu->sym, text(dataColIdx).latin1());
|
||||
listView()->updateList(this);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* update the displayed of a menu entry
|
||||
|
@ -195,11 +210,9 @@ void ConfigItem::updateMenu(void)
|
|||
|
||||
data = sym_get_string_value(sym);
|
||||
|
||||
#if QT_VERSION >= 300
|
||||
int i = list->mapIdx(dataColIdx);
|
||||
if (i >= 0)
|
||||
setRenameEnabled(i, TRUE);
|
||||
#endif
|
||||
setText(dataColIdx, data);
|
||||
if (type == S_STRING)
|
||||
prompt = QString("%1: %2").arg(prompt).arg(data);
|
||||
|
@ -432,7 +445,7 @@ void ConfigList::updateList(ConfigItem* item)
|
|||
if (!rootEntry) {
|
||||
if (mode != listMode)
|
||||
goto update;
|
||||
QListViewItemIterator it(this);
|
||||
Q3ListViewItemIterator it(this);
|
||||
ConfigItem* item;
|
||||
|
||||
for (; it.current(); ++it) {
|
||||
|
@ -527,11 +540,9 @@ void ConfigList::changeValue(ConfigItem* item)
|
|||
case S_INT:
|
||||
case S_HEX:
|
||||
case S_STRING:
|
||||
#if QT_VERSION >= 300
|
||||
if (colMap[dataColIdx] >= 0)
|
||||
item->startRename(colMap[dataColIdx]);
|
||||
else
|
||||
#endif
|
||||
parent()->lineEdit->show(item);
|
||||
break;
|
||||
}
|
||||
|
@ -563,7 +574,7 @@ void ConfigList::setParentMenu(void)
|
|||
return;
|
||||
setRootMenu(menu_get_parent_menu(rootEntry->parent));
|
||||
|
||||
QListViewItemIterator it(this);
|
||||
Q3ListViewItemIterator it(this);
|
||||
for (; (item = (ConfigItem*)it.current()); it++) {
|
||||
if (item->menu == oldroot) {
|
||||
setCurrentItem(item);
|
||||
|
@ -645,7 +656,7 @@ void ConfigList::updateMenuList(P* parent, struct menu* menu)
|
|||
|
||||
void ConfigList::keyPressEvent(QKeyEvent* ev)
|
||||
{
|
||||
QListViewItem* i = currentItem();
|
||||
Q3ListViewItem* i = currentItem();
|
||||
ConfigItem* item;
|
||||
struct menu *menu;
|
||||
enum prop_type type;
|
||||
|
@ -811,10 +822,10 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
|
|||
{
|
||||
if (e->y() <= header()->geometry().bottom()) {
|
||||
if (!headerPopup) {
|
||||
QAction *action;
|
||||
Q3Action *action;
|
||||
|
||||
headerPopup = new QPopupMenu(this);
|
||||
action = new QAction(NULL, _("Show Name"), 0, this);
|
||||
headerPopup = new Q3PopupMenu(this);
|
||||
action = new Q3Action(NULL, _("Show Name"), 0, this);
|
||||
action->setToggleAction(TRUE);
|
||||
connect(action, SIGNAL(toggled(bool)),
|
||||
parent(), SLOT(setShowName(bool)));
|
||||
|
@ -822,7 +833,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
|
|||
action, SLOT(setOn(bool)));
|
||||
action->setOn(showName);
|
||||
action->addTo(headerPopup);
|
||||
action = new QAction(NULL, _("Show Range"), 0, this);
|
||||
action = new Q3Action(NULL, _("Show Range"), 0, this);
|
||||
action->setToggleAction(TRUE);
|
||||
connect(action, SIGNAL(toggled(bool)),
|
||||
parent(), SLOT(setShowRange(bool)));
|
||||
|
@ -830,7 +841,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
|
|||
action, SLOT(setOn(bool)));
|
||||
action->setOn(showRange);
|
||||
action->addTo(headerPopup);
|
||||
action = new QAction(NULL, _("Show Data"), 0, this);
|
||||
action = new Q3Action(NULL, _("Show Data"), 0, this);
|
||||
action->setToggleAction(TRUE);
|
||||
connect(action, SIGNAL(toggled(bool)),
|
||||
parent(), SLOT(setShowData(bool)));
|
||||
|
@ -914,7 +925,7 @@ void ConfigView::setShowData(bool b)
|
|||
|
||||
void ConfigList::setAllOpen(bool open)
|
||||
{
|
||||
QListViewItemIterator it(this);
|
||||
Q3ListViewItemIterator it(this);
|
||||
|
||||
for (; it.current(); it++)
|
||||
it.current()->setOpen(open);
|
||||
|
@ -937,7 +948,7 @@ void ConfigView::updateListAll(void)
|
|||
}
|
||||
|
||||
ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name)
|
||||
: Parent(parent, name), sym(0), menu(0)
|
||||
: Parent(parent, name), sym(0), _menu(0)
|
||||
{
|
||||
if (name) {
|
||||
configSettings->beginGroup(name);
|
||||
|
@ -960,7 +971,7 @@ void ConfigInfoView::setShowDebug(bool b)
|
|||
{
|
||||
if (_showDebug != b) {
|
||||
_showDebug = b;
|
||||
if (menu)
|
||||
if (_menu)
|
||||
menuInfo();
|
||||
else if (sym)
|
||||
symbolInfo();
|
||||
|
@ -970,11 +981,11 @@ void ConfigInfoView::setShowDebug(bool b)
|
|||
|
||||
void ConfigInfoView::setInfo(struct menu *m)
|
||||
{
|
||||
if (menu == m)
|
||||
if (_menu == m)
|
||||
return;
|
||||
menu = m;
|
||||
_menu = m;
|
||||
sym = NULL;
|
||||
if (!menu)
|
||||
if (!_menu)
|
||||
clear();
|
||||
else
|
||||
menuInfo();
|
||||
|
@ -1001,11 +1012,11 @@ void ConfigInfoView::menuInfo(void)
|
|||
struct symbol* sym;
|
||||
QString head, debug, help;
|
||||
|
||||
sym = menu->sym;
|
||||
sym = _menu->sym;
|
||||
if (sym) {
|
||||
if (menu->prompt) {
|
||||
if (_menu->prompt) {
|
||||
head += "<big><b>";
|
||||
head += print_filter(_(menu->prompt->text));
|
||||
head += print_filter(_(_menu->prompt->text));
|
||||
head += "</b></big>";
|
||||
if (sym->name) {
|
||||
head += " (";
|
||||
|
@ -1031,23 +1042,23 @@ void ConfigInfoView::menuInfo(void)
|
|||
debug = debug_info(sym);
|
||||
|
||||
struct gstr help_gstr = str_new();
|
||||
menu_get_ext_help(menu, &help_gstr);
|
||||
menu_get_ext_help(_menu, &help_gstr);
|
||||
help = print_filter(str_get(&help_gstr));
|
||||
str_free(&help_gstr);
|
||||
} else if (menu->prompt) {
|
||||
} else if (_menu->prompt) {
|
||||
head += "<big><b>";
|
||||
head += print_filter(_(menu->prompt->text));
|
||||
head += print_filter(_(_menu->prompt->text));
|
||||
head += "</b></big><br><br>";
|
||||
if (showDebug()) {
|
||||
if (menu->prompt->visible.expr) {
|
||||
if (_menu->prompt->visible.expr) {
|
||||
debug += " dep: ";
|
||||
expr_print(menu->prompt->visible.expr, expr_print_help, &debug, E_NONE);
|
||||
expr_print(_menu->prompt->visible.expr, expr_print_help, &debug, E_NONE);
|
||||
debug += "<br><br>";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (showDebug())
|
||||
debug += QString().sprintf("defined at %s:%d<br><br>", menu->file->name, menu->lineno);
|
||||
debug += QString().sprintf("defined at %s:%d<br><br>", _menu->file->name, _menu->lineno);
|
||||
|
||||
setText(head + debug + help);
|
||||
}
|
||||
|
@ -1150,10 +1161,10 @@ void ConfigInfoView::expr_print_help(void *data, struct symbol *sym, const char
|
|||
*text += str2;
|
||||
}
|
||||
|
||||
QPopupMenu* ConfigInfoView::createPopupMenu(const QPoint& pos)
|
||||
Q3PopupMenu* ConfigInfoView::createPopupMenu(const QPoint& pos)
|
||||
{
|
||||
QPopupMenu* popup = Parent::createPopupMenu(pos);
|
||||
QAction* action = new QAction(NULL, _("Show Debug Info"), 0, popup);
|
||||
Q3PopupMenu* popup = Parent::createPopupMenu(pos);
|
||||
Q3Action* action = new Q3Action(NULL, _("Show Debug Info"), 0, popup);
|
||||
action->setToggleAction(TRUE);
|
||||
connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool)));
|
||||
connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool)));
|
||||
|
@ -1210,7 +1221,7 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *nam
|
|||
y = configSettings->readNumEntry("/window y", 0, &ok);
|
||||
if (ok)
|
||||
move(x, y);
|
||||
QValueList<int> sizes = configSettings->readSizes("/split", &ok);
|
||||
Q3ValueList<int> sizes = configSettings->readSizes("/split", &ok);
|
||||
if (ok)
|
||||
split->setSizes(sizes);
|
||||
configSettings->endGroup();
|
||||
|
@ -1263,8 +1274,14 @@ ConfigMainWindow::ConfigMainWindow(void)
|
|||
char title[256];
|
||||
|
||||
QDesktopWidget *d = configApp->desktop();
|
||||
snprintf(title, sizeof(title), _("Barebox v%s Configuration"),
|
||||
getenv("KERNELVERSION"));
|
||||
snprintf(title, sizeof(title), "%s%s",
|
||||
rootmenu.prompt->text,
|
||||
#if QT_VERSION < 0x040000
|
||||
" (Qt3)"
|
||||
#else
|
||||
""
|
||||
#endif
|
||||
);
|
||||
setCaption(title);
|
||||
|
||||
width = configSettings->readNumEntry("/window width", d->width() - 64);
|
||||
|
@ -1297,42 +1314,42 @@ ConfigMainWindow::ConfigMainWindow(void)
|
|||
configList->setFocus();
|
||||
|
||||
menu = menuBar();
|
||||
toolBar = new QToolBar("Tools", this);
|
||||
toolBar = new Q3ToolBar("Tools", this);
|
||||
|
||||
backAction = new QAction("Back", QPixmap(xpm_back), _("Back"), 0, this);
|
||||
backAction = new Q3Action("Back", QPixmap(xpm_back), _("Back"), 0, this);
|
||||
connect(backAction, SIGNAL(activated()), SLOT(goBack()));
|
||||
backAction->setEnabled(FALSE);
|
||||
QAction *quitAction = new QAction("Quit", _("&Quit"), Qt::CTRL + Qt::Key_Q, this);
|
||||
Q3Action *quitAction = new Q3Action("Quit", _("&Quit"), Qt::CTRL + Qt::Key_Q, this);
|
||||
connect(quitAction, SIGNAL(activated()), SLOT(close()));
|
||||
QAction *loadAction = new QAction("Load", QPixmap(xpm_load), _("&Load"), Qt::CTRL + Qt::Key_L, this);
|
||||
Q3Action *loadAction = new Q3Action("Load", QPixmap(xpm_load), _("&Load"), Qt::CTRL + Qt::Key_L, this);
|
||||
connect(loadAction, SIGNAL(activated()), SLOT(loadConfig()));
|
||||
saveAction = new QAction("Save", QPixmap(xpm_save), _("&Save"), Qt::CTRL + Qt::Key_S, this);
|
||||
saveAction = new Q3Action("Save", QPixmap(xpm_save), _("&Save"), Qt::CTRL + Qt::Key_S, this);
|
||||
connect(saveAction, SIGNAL(activated()), SLOT(saveConfig()));
|
||||
conf_set_changed_callback(conf_changed);
|
||||
// Set saveAction's initial state
|
||||
conf_changed();
|
||||
QAction *saveAsAction = new QAction("Save As...", _("Save &As..."), 0, this);
|
||||
Q3Action *saveAsAction = new Q3Action("Save As...", _("Save &As..."), 0, this);
|
||||
connect(saveAsAction, SIGNAL(activated()), SLOT(saveConfigAs()));
|
||||
QAction *searchAction = new QAction("Find", _("&Find"), Qt::CTRL + Qt::Key_F, this);
|
||||
Q3Action *searchAction = new Q3Action("Find", _("&Find"), Qt::CTRL + Qt::Key_F, this);
|
||||
connect(searchAction, SIGNAL(activated()), SLOT(searchConfig()));
|
||||
QAction *singleViewAction = new QAction("Single View", QPixmap(xpm_single_view), _("Single View"), 0, this);
|
||||
Q3Action *singleViewAction = new Q3Action("Single View", QPixmap(xpm_single_view), _("Single View"), 0, this);
|
||||
connect(singleViewAction, SIGNAL(activated()), SLOT(showSingleView()));
|
||||
QAction *splitViewAction = new QAction("Split View", QPixmap(xpm_split_view), _("Split View"), 0, this);
|
||||
Q3Action *splitViewAction = new Q3Action("Split View", QPixmap(xpm_split_view), _("Split View"), 0, this);
|
||||
connect(splitViewAction, SIGNAL(activated()), SLOT(showSplitView()));
|
||||
QAction *fullViewAction = new QAction("Full View", QPixmap(xpm_tree_view), _("Full View"), 0, this);
|
||||
Q3Action *fullViewAction = new Q3Action("Full View", QPixmap(xpm_tree_view), _("Full View"), 0, this);
|
||||
connect(fullViewAction, SIGNAL(activated()), SLOT(showFullView()));
|
||||
|
||||
QAction *showNameAction = new QAction(NULL, _("Show Name"), 0, this);
|
||||
Q3Action *showNameAction = new Q3Action(NULL, _("Show Name"), 0, this);
|
||||
showNameAction->setToggleAction(TRUE);
|
||||
connect(showNameAction, SIGNAL(toggled(bool)), configView, SLOT(setShowName(bool)));
|
||||
connect(configView, SIGNAL(showNameChanged(bool)), showNameAction, SLOT(setOn(bool)));
|
||||
showNameAction->setOn(configView->showName());
|
||||
QAction *showRangeAction = new QAction(NULL, _("Show Range"), 0, this);
|
||||
Q3Action *showRangeAction = new Q3Action(NULL, _("Show Range"), 0, this);
|
||||
showRangeAction->setToggleAction(TRUE);
|
||||
connect(showRangeAction, SIGNAL(toggled(bool)), configView, SLOT(setShowRange(bool)));
|
||||
connect(configView, SIGNAL(showRangeChanged(bool)), showRangeAction, SLOT(setOn(bool)));
|
||||
showRangeAction->setOn(configList->showRange);
|
||||
QAction *showDataAction = new QAction(NULL, _("Show Data"), 0, this);
|
||||
Q3Action *showDataAction = new Q3Action(NULL, _("Show Data"), 0, this);
|
||||
showDataAction->setToggleAction(TRUE);
|
||||
connect(showDataAction, SIGNAL(toggled(bool)), configView, SLOT(setShowData(bool)));
|
||||
connect(configView, SIGNAL(showDataChanged(bool)), showDataAction, SLOT(setOn(bool)));
|
||||
|
@ -1345,9 +1362,15 @@ ConfigMainWindow::ConfigMainWindow(void)
|
|||
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);
|
||||
#if QT_VERSION >= 0x040000
|
||||
configView->showNormalAction = new QAction(_("Show Normal Options"), optGroup);
|
||||
configView->showAllAction = new QAction(_("Show All Options"), optGroup);
|
||||
configView->showPromptAction = new QAction(_("Show Prompt Options"), optGroup);
|
||||
#else
|
||||
configView->showNormalAction = new QAction(_("Show Normal Options"), 0, optGroup);
|
||||
configView->showAllAction = new QAction(_("Show All Options"), 0, optGroup);
|
||||
configView->showPromptAction = new QAction(_("Show Prompt Options"), 0, optGroup);
|
||||
#endif
|
||||
configView->showNormalAction->setToggleAction(TRUE);
|
||||
configView->showNormalAction->setOn(configList->optMode == normalOpt);
|
||||
configView->showAllAction->setToggleAction(TRUE);
|
||||
|
@ -1355,15 +1378,15 @@ ConfigMainWindow::ConfigMainWindow(void)
|
|||
configView->showPromptAction->setToggleAction(TRUE);
|
||||
configView->showPromptAction->setOn(configList->optMode == promptOpt);
|
||||
|
||||
QAction *showDebugAction = new QAction(NULL, _("Show Debug Info"), 0, this);
|
||||
Q3Action *showDebugAction = new Q3Action(NULL, _("Show Debug Info"), 0, this);
|
||||
showDebugAction->setToggleAction(TRUE);
|
||||
connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool)));
|
||||
connect(helpText, SIGNAL(showDebugChanged(bool)), showDebugAction, SLOT(setOn(bool)));
|
||||
showDebugAction->setOn(helpText->showDebug());
|
||||
|
||||
QAction *showIntroAction = new QAction(NULL, _("Introduction"), 0, this);
|
||||
Q3Action *showIntroAction = new Q3Action(NULL, _("Introduction"), 0, this);
|
||||
connect(showIntroAction, SIGNAL(activated()), SLOT(showIntro()));
|
||||
QAction *showAboutAction = new QAction(NULL, _("About"), 0, this);
|
||||
Q3Action *showAboutAction = new Q3Action(NULL, _("About"), 0, this);
|
||||
connect(showAboutAction, SIGNAL(activated()), SLOT(showAbout()));
|
||||
|
||||
// init tool bar
|
||||
|
@ -1377,7 +1400,7 @@ ConfigMainWindow::ConfigMainWindow(void)
|
|||
fullViewAction->addTo(toolBar);
|
||||
|
||||
// create config menu
|
||||
QPopupMenu* config = new QPopupMenu(this);
|
||||
Q3PopupMenu* config = new Q3PopupMenu(this);
|
||||
menu->insertItem(_("&File"), config);
|
||||
loadAction->addTo(config);
|
||||
saveAction->addTo(config);
|
||||
|
@ -1386,12 +1409,12 @@ ConfigMainWindow::ConfigMainWindow(void)
|
|||
quitAction->addTo(config);
|
||||
|
||||
// create edit menu
|
||||
QPopupMenu* editMenu = new QPopupMenu(this);
|
||||
Q3PopupMenu* editMenu = new Q3PopupMenu(this);
|
||||
menu->insertItem(_("&Edit"), editMenu);
|
||||
searchAction->addTo(editMenu);
|
||||
|
||||
// create options menu
|
||||
QPopupMenu* optionMenu = new QPopupMenu(this);
|
||||
Q3PopupMenu* optionMenu = new Q3PopupMenu(this);
|
||||
menu->insertItem(_("&Option"), optionMenu);
|
||||
showNameAction->addTo(optionMenu);
|
||||
showRangeAction->addTo(optionMenu);
|
||||
|
@ -1399,10 +1422,9 @@ ConfigMainWindow::ConfigMainWindow(void)
|
|||
optionMenu->insertSeparator();
|
||||
optGroup->addTo(optionMenu);
|
||||
optionMenu->insertSeparator();
|
||||
showDebugAction->addTo(optionMenu);
|
||||
|
||||
// create help menu
|
||||
QPopupMenu* helpMenu = new QPopupMenu(this);
|
||||
Q3PopupMenu* helpMenu = new Q3PopupMenu(this);
|
||||
menu->insertSeparator();
|
||||
menu->insertItem(_("&Help"), helpMenu);
|
||||
showIntroAction->addTo(helpMenu);
|
||||
|
@ -1437,7 +1459,7 @@ ConfigMainWindow::ConfigMainWindow(void)
|
|||
showSplitView();
|
||||
|
||||
// UI setup done, restore splitter positions
|
||||
QValueList<int> sizes = configSettings->readSizes("/split1", &ok);
|
||||
Q3ValueList<int> sizes = configSettings->readSizes("/split1", &ok);
|
||||
if (ok)
|
||||
split1->setSizes(sizes);
|
||||
|
||||
|
@ -1448,7 +1470,7 @@ ConfigMainWindow::ConfigMainWindow(void)
|
|||
|
||||
void ConfigMainWindow::loadConfig(void)
|
||||
{
|
||||
QString s = QFileDialog::getOpenFileName(conf_get_configname(), NULL, this);
|
||||
QString s = Q3FileDialog::getOpenFileName(conf_get_configname(), NULL, this);
|
||||
if (s.isNull())
|
||||
return;
|
||||
if (conf_read(QFile::encodeName(s)))
|
||||
|
@ -1464,7 +1486,7 @@ void ConfigMainWindow::saveConfig(void)
|
|||
|
||||
void ConfigMainWindow::saveConfigAs(void)
|
||||
{
|
||||
QString s = QFileDialog::getSaveFileName(conf_get_configname(), NULL, this);
|
||||
QString s = Q3FileDialog::getSaveFileName(conf_get_configname(), NULL, this);
|
||||
if (s.isNull())
|
||||
return;
|
||||
if (conf_write(QFile::encodeName(s)))
|
||||
|
@ -1633,7 +1655,7 @@ void ConfigMainWindow::closeEvent(QCloseEvent* e)
|
|||
|
||||
void ConfigMainWindow::showIntro(void)
|
||||
{
|
||||
static const QString str = _("Welcome to the qconf graphical barebox configuration tool for Linux.\n\n"
|
||||
static const QString str = _("Welcome to the qconf graphical configuration tool.\n\n"
|
||||
"For each option, a blank box indicates the feature is disabled, a check\n"
|
||||
"indicates it is enabled, and a dot indicates that it is to be compiled\n"
|
||||
"as a module. Clicking on the box will cycle through the three states.\n\n"
|
||||
|
|
|
@ -3,26 +3,25 @@
|
|||
* Released under the terms of the GNU GPL v2.0.
|
||||
*/
|
||||
|
||||
#if QT_VERSION < 0x040000
|
||||
#include <qlistview.h>
|
||||
#if QT_VERSION >= 300
|
||||
#include <qsettings.h>
|
||||
#else
|
||||
class QSettings {
|
||||
public:
|
||||
void beginGroup(const QString& group) { }
|
||||
void endGroup(void) { }
|
||||
bool readBoolEntry(const QString& key, bool def = FALSE, bool* ok = 0) const
|
||||
{ if (ok) *ok = FALSE; return def; }
|
||||
int readNumEntry(const QString& key, int def = 0, bool* ok = 0) const
|
||||
{ if (ok) *ok = FALSE; return def; }
|
||||
QString readEntry(const QString& key, const QString& def = QString::null, bool* ok = 0) const
|
||||
{ if (ok) *ok = FALSE; return def; }
|
||||
QStringList readListEntry(const QString& key, bool* ok = 0) const
|
||||
{ if (ok) *ok = FALSE; return QStringList(); }
|
||||
template <class t>
|
||||
bool writeEntry(const QString& key, t value)
|
||||
{ return TRUE; }
|
||||
};
|
||||
#include <q3listview.h>
|
||||
#endif
|
||||
#include <qsettings.h>
|
||||
|
||||
#if QT_VERSION < 0x040000
|
||||
#define Q3ValueList QValueList
|
||||
#define Q3PopupMenu QPopupMenu
|
||||
#define Q3ListView QListView
|
||||
#define Q3ListViewItem QListViewItem
|
||||
#define Q3VBox QVBox
|
||||
#define Q3TextBrowser QTextBrowser
|
||||
#define Q3MainWindow QMainWindow
|
||||
#define Q3Action QAction
|
||||
#define Q3ToolBar QToolBar
|
||||
#define Q3ListViewItemIterator QListViewItemIterator
|
||||
#define Q3FileDialog QFileDialog
|
||||
#endif
|
||||
|
||||
class ConfigView;
|
||||
|
@ -31,11 +30,10 @@ class ConfigItem;
|
|||
class ConfigLineEdit;
|
||||
class ConfigMainWindow;
|
||||
|
||||
|
||||
class ConfigSettings : public QSettings {
|
||||
public:
|
||||
QValueList<int> readSizes(const QString& key, bool *ok);
|
||||
bool writeSizes(const QString& key, const QValueList<int>& value);
|
||||
Q3ValueList<int> readSizes(const QString& key, bool *ok);
|
||||
bool writeSizes(const QString& key, const Q3ValueList<int>& value);
|
||||
};
|
||||
|
||||
enum colIdx {
|
||||
|
@ -48,9 +46,9 @@ enum optionMode {
|
|||
normalOpt = 0, allOpt, promptOpt
|
||||
};
|
||||
|
||||
class ConfigList : public QListView {
|
||||
class ConfigList : public Q3ListView {
|
||||
Q_OBJECT
|
||||
typedef class QListView Parent;
|
||||
typedef class Q3ListView Parent;
|
||||
public:
|
||||
ConfigList(ConfigView* p, const char *name = 0);
|
||||
void reinit(void);
|
||||
|
@ -135,17 +133,17 @@ public:
|
|||
struct menu *rootEntry;
|
||||
QColorGroup disabledColorGroup;
|
||||
QColorGroup inactivedColorGroup;
|
||||
QPopupMenu* headerPopup;
|
||||
Q3PopupMenu* headerPopup;
|
||||
|
||||
private:
|
||||
int colMap[colNr];
|
||||
int colRevMap[colNr];
|
||||
};
|
||||
|
||||
class ConfigItem : public QListViewItem {
|
||||
typedef class QListViewItem Parent;
|
||||
class ConfigItem : public Q3ListViewItem {
|
||||
typedef class Q3ListViewItem Parent;
|
||||
public:
|
||||
ConfigItem(QListView *parent, ConfigItem *after, struct menu *m, bool v)
|
||||
ConfigItem(Q3ListView *parent, ConfigItem *after, struct menu *m, bool v)
|
||||
: Parent(parent, after), menu(m), visible(v), goParent(false)
|
||||
{
|
||||
init();
|
||||
|
@ -155,16 +153,14 @@ public:
|
|||
{
|
||||
init();
|
||||
}
|
||||
ConfigItem(QListView *parent, ConfigItem *after, bool v)
|
||||
ConfigItem(Q3ListView *parent, ConfigItem *after, bool v)
|
||||
: Parent(parent, after), menu(0), visible(v), goParent(true)
|
||||
{
|
||||
init();
|
||||
}
|
||||
~ConfigItem(void);
|
||||
void init(void);
|
||||
#if QT_VERSION >= 300
|
||||
void okRename(int col);
|
||||
#endif
|
||||
void updateMenu(void);
|
||||
void testUpdateMenu(bool v);
|
||||
ConfigList* listView() const
|
||||
|
@ -219,9 +215,9 @@ public:
|
|||
ConfigItem *item;
|
||||
};
|
||||
|
||||
class ConfigView : public QVBox {
|
||||
class ConfigView : public Q3VBox {
|
||||
Q_OBJECT
|
||||
typedef class QVBox Parent;
|
||||
typedef class Q3VBox Parent;
|
||||
public:
|
||||
ConfigView(QWidget* parent, const char *name = 0);
|
||||
~ConfigView(void);
|
||||
|
@ -252,9 +248,9 @@ public:
|
|||
static QAction *showPromptAction;
|
||||
};
|
||||
|
||||
class ConfigInfoView : public QTextBrowser {
|
||||
class ConfigInfoView : public Q3TextBrowser {
|
||||
Q_OBJECT
|
||||
typedef class QTextBrowser Parent;
|
||||
typedef class Q3TextBrowser Parent;
|
||||
public:
|
||||
ConfigInfoView(QWidget* parent, const char *name = 0);
|
||||
bool showDebug(void) const { return _showDebug; }
|
||||
|
@ -274,11 +270,11 @@ protected:
|
|||
QString debug_info(struct symbol *sym);
|
||||
static QString print_filter(const QString &str);
|
||||
static void expr_print_help(void *data, struct symbol *sym, const char *str);
|
||||
QPopupMenu* createPopupMenu(const QPoint& pos);
|
||||
Q3PopupMenu* createPopupMenu(const QPoint& pos);
|
||||
void contentsContextMenuEvent(QContextMenuEvent *e);
|
||||
|
||||
struct symbol *sym;
|
||||
struct menu *menu;
|
||||
struct menu *_menu;
|
||||
bool _showDebug;
|
||||
};
|
||||
|
||||
|
@ -302,10 +298,10 @@ protected:
|
|||
struct symbol **result;
|
||||
};
|
||||
|
||||
class ConfigMainWindow : public QMainWindow {
|
||||
class ConfigMainWindow : public Q3MainWindow {
|
||||
Q_OBJECT
|
||||
|
||||
static QAction *saveAction;
|
||||
static Q3Action *saveAction;
|
||||
static void conf_changed(void);
|
||||
public:
|
||||
ConfigMainWindow(void);
|
||||
|
@ -334,8 +330,8 @@ protected:
|
|||
ConfigView *configView;
|
||||
ConfigList *configList;
|
||||
ConfigInfoView *helpText;
|
||||
QToolBar *toolBar;
|
||||
QAction *backAction;
|
||||
Q3ToolBar *toolBar;
|
||||
Q3Action *backAction;
|
||||
QSplitter* split1;
|
||||
QSplitter* split2;
|
||||
};
|
||||
|
|
|
@ -42,6 +42,8 @@
|
|||
# mv config_strip .config
|
||||
# make oldconfig
|
||||
#
|
||||
use strict;
|
||||
|
||||
my $config = ".config";
|
||||
|
||||
my $uname = `uname -r`;
|
||||
|
@ -123,7 +125,6 @@ my %selects;
|
|||
my %prompts;
|
||||
my %objects;
|
||||
my $var;
|
||||
my $cont = 0;
|
||||
my $iflevel = 0;
|
||||
my @ifdeps;
|
||||
|
||||
|
@ -137,19 +138,45 @@ sub read_kconfig {
|
|||
my $config;
|
||||
my @kconfigs;
|
||||
|
||||
open(KIN, "$ksource/$kconfig") || die "Can't open $kconfig";
|
||||
my $cont = 0;
|
||||
my $line;
|
||||
|
||||
my $source = "$ksource/$kconfig";
|
||||
my $last_source = "";
|
||||
|
||||
# Check for any environment variables used
|
||||
while ($source =~ /\$(\w+)/ && $last_source ne $source) {
|
||||
my $env = $1;
|
||||
$last_source = $source;
|
||||
$source =~ s/\$$env/$ENV{$env}/;
|
||||
}
|
||||
|
||||
open(KIN, "$source") || die "Can't open $kconfig";
|
||||
while (<KIN>) {
|
||||
chomp;
|
||||
|
||||
# Make sure that lines ending with \ continue
|
||||
if ($cont) {
|
||||
$_ = $line . " " . $_;
|
||||
}
|
||||
|
||||
if (s/\\$//) {
|
||||
$cont = 1;
|
||||
$line = $_;
|
||||
next;
|
||||
}
|
||||
|
||||
$cont = 0;
|
||||
|
||||
# collect any Kconfig sources
|
||||
if (/^source\s*"(.*)"/) {
|
||||
$kconfigs[$#kconfigs+1] = $1;
|
||||
}
|
||||
|
||||
# configs found
|
||||
if (/^\s*config\s+(\S+)\s*$/) {
|
||||
if (/^\s*(menu)?config\s+(\S+)\s*$/) {
|
||||
$state = "NEW";
|
||||
$config = $1;
|
||||
$config = $2;
|
||||
|
||||
for (my $i = 0; $i < $iflevel; $i++) {
|
||||
if ($i) {
|
||||
|
@ -178,7 +205,7 @@ sub read_kconfig {
|
|||
# configs without prompts must be selected
|
||||
} elsif ($state ne "NONE" && /^\s*tristate\s\S/) {
|
||||
# note if the config has a prompt
|
||||
$prompt{$config} = 1;
|
||||
$prompts{$config} = 1;
|
||||
|
||||
# Check for if statements
|
||||
} elsif (/^if\s+(.*\S)\s*$/) {
|
||||
|
@ -218,6 +245,8 @@ if ($kconfig) {
|
|||
# Read all Makefiles to map the configs to the objects
|
||||
foreach my $makefile (@makefiles) {
|
||||
|
||||
my $cont = 0;
|
||||
|
||||
open(MIN,$makefile) || die "Can't open $makefile";
|
||||
while (<MIN>) {
|
||||
my $objs;
|
||||
|
@ -281,7 +310,7 @@ if (defined($lsmod_file)) {
|
|||
# see what modules are loaded on this system
|
||||
my $lsmod;
|
||||
|
||||
foreach $dir ( ("/sbin", "/bin", "/usr/sbin", "/usr/bin") ) {
|
||||
foreach my $dir ( ("/sbin", "/bin", "/usr/sbin", "/usr/bin") ) {
|
||||
if ( -x "$dir/lsmod" ) {
|
||||
$lsmod = "$dir/lsmod";
|
||||
last;
|
||||
|
@ -363,7 +392,7 @@ while ($repeat) {
|
|||
parse_config_dep_select $depends{$config};
|
||||
}
|
||||
|
||||
if (defined($prompt{$config}) || !defined($selects{$config})) {
|
||||
if (defined($prompts{$config}) || !defined($selects{$config})) {
|
||||
next;
|
||||
}
|
||||
|
||||
|
|
|
@ -351,12 +351,16 @@ void sym_calc_value(struct symbol *sym)
|
|||
}
|
||||
calc_newval:
|
||||
if (sym->dir_dep.tri == no && sym->rev_dep.tri != no) {
|
||||
struct expr *e;
|
||||
e = expr_simplify_unmet_dep(sym->rev_dep.expr,
|
||||
sym->dir_dep.expr);
|
||||
fprintf(stderr, "warning: (");
|
||||
expr_fprint(sym->rev_dep.expr, stderr);
|
||||
expr_fprint(e, stderr);
|
||||
fprintf(stderr, ") selects %s which has unmet direct dependencies (",
|
||||
sym->name);
|
||||
expr_fprint(sym->dir_dep.expr, stderr);
|
||||
fprintf(stderr, ")\n");
|
||||
expr_free(e);
|
||||
}
|
||||
newval.tri = EXPR_OR(newval.tri, sym->rev_dep.tri);
|
||||
}
|
||||
|
@ -686,7 +690,7 @@ const char *sym_get_string_default(struct symbol *sym)
|
|||
switch (sym->type) {
|
||||
case S_BOOLEAN:
|
||||
case S_TRISTATE:
|
||||
/* The visibility imay limit the value from yes => mod */
|
||||
/* The visibility may limit the value from yes => mod */
|
||||
val = EXPR_AND(expr_calc_value(prop->expr), prop->visible.tri);
|
||||
break;
|
||||
default:
|
||||
|
@ -840,6 +844,55 @@ struct symbol *sym_find(const char *name)
|
|||
return symbol;
|
||||
}
|
||||
|
||||
/*
|
||||
* Expand symbol's names embedded in the string given in argument. Symbols'
|
||||
* name to be expanded shall be prefixed by a '$'. Unknown symbol expands to
|
||||
* the empty string.
|
||||
*/
|
||||
const char *sym_expand_string_value(const char *in)
|
||||
{
|
||||
const char *src;
|
||||
char *res;
|
||||
size_t reslen;
|
||||
|
||||
reslen = strlen(in) + 1;
|
||||
res = malloc(reslen);
|
||||
res[0] = '\0';
|
||||
|
||||
while ((src = strchr(in, '$'))) {
|
||||
char *p, name[SYMBOL_MAXLENGTH];
|
||||
const char *symval = "";
|
||||
struct symbol *sym;
|
||||
size_t newlen;
|
||||
|
||||
strncat(res, in, src - in);
|
||||
src++;
|
||||
|
||||
p = name;
|
||||
while (isalnum(*src) || *src == '_')
|
||||
*p++ = *src++;
|
||||
*p = '\0';
|
||||
|
||||
sym = sym_find(name);
|
||||
if (sym != NULL) {
|
||||
sym_calc_value(sym);
|
||||
symval = sym_get_string_value(sym);
|
||||
}
|
||||
|
||||
newlen = strlen(res) + strlen(symval) + strlen(src) + 1;
|
||||
if (newlen > reslen) {
|
||||
reslen = newlen;
|
||||
res = realloc(res, reslen);
|
||||
}
|
||||
|
||||
strcat(res, symval);
|
||||
in = src;
|
||||
}
|
||||
strcat(res, in);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
struct symbol **sym_re_search(const char *pattern)
|
||||
{
|
||||
struct symbol *sym, **sym_arr = NULL;
|
||||
|
@ -937,6 +990,8 @@ static void sym_check_print_recursive(struct symbol *last_sym)
|
|||
sym = stack->sym;
|
||||
next_sym = stack->next ? stack->next->sym : last_sym;
|
||||
prop = stack->prop;
|
||||
if (prop == NULL)
|
||||
prop = stack->sym->prop;
|
||||
|
||||
/* for choice values find the menu entry (used below) */
|
||||
if (sym_is_choice(sym) || sym_is_choice_value(sym)) {
|
||||
|
|
|
@ -12,15 +12,18 @@
|
|||
struct file *file_lookup(const char *name)
|
||||
{
|
||||
struct file *file;
|
||||
const char *file_name = sym_expand_string_value(name);
|
||||
|
||||
for (file = file_list; file; file = file->next) {
|
||||
if (!strcmp(name, file->name))
|
||||
if (!strcmp(name, file->name)) {
|
||||
free((void *)file_name);
|
||||
return file;
|
||||
}
|
||||
}
|
||||
|
||||
file = malloc(sizeof(*file));
|
||||
memset(file, 0, sizeof(*file));
|
||||
file->name = strdup(name);
|
||||
file->name = file_name;
|
||||
file->next = file_list;
|
||||
file_list = file;
|
||||
return file;
|
||||
|
|
|
@ -38,6 +38,7 @@ hex, T_TYPE, TF_COMMAND, S_HEX
|
|||
string, T_TYPE, TF_COMMAND, S_STRING
|
||||
select, T_SELECT, TF_COMMAND
|
||||
range, T_RANGE, TF_COMMAND
|
||||
visible, T_VISIBLE, TF_COMMAND
|
||||
option, T_OPTION, TF_COMMAND
|
||||
on, T_ON, TF_PARAM
|
||||
modules, T_OPT_MODULES, TF_OPTION
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
struct kconf_id;
|
||||
|
||||
static struct kconf_id *kconf_id_lookup(register const char *str, register unsigned int len);
|
||||
/* maximum key range = 47, duplicates = 0 */
|
||||
/* maximum key range = 50, duplicates = 0 */
|
||||
|
||||
#ifdef __GNUC__
|
||||
__inline
|
||||
|
@ -46,32 +46,32 @@ kconf_id_hash (register const char *str, register unsigned int len)
|
|||
{
|
||||
static unsigned char asso_values[] =
|
||||
{
|
||||
49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
|
||||
49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
|
||||
49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
|
||||
49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
|
||||
49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
|
||||
49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
|
||||
49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
|
||||
49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
|
||||
49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
|
||||
49, 49, 49, 49, 49, 49, 49, 49, 11, 5,
|
||||
0, 0, 5, 49, 5, 20, 49, 49, 5, 20,
|
||||
5, 0, 30, 49, 0, 15, 0, 10, 0, 49,
|
||||
25, 49, 49, 49, 49, 49, 49, 49, 49, 49,
|
||||
49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
|
||||
49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
|
||||
49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
|
||||
49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
|
||||
49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
|
||||
49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
|
||||
49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
|
||||
49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
|
||||
49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
|
||||
49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
|
||||
49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
|
||||
49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
|
||||
49, 49, 49, 49, 49, 49
|
||||
52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
|
||||
52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
|
||||
52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
|
||||
52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
|
||||
52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
|
||||
52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
|
||||
52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
|
||||
52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
|
||||
52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
|
||||
52, 52, 52, 52, 52, 52, 52, 52, 40, 5,
|
||||
0, 0, 5, 52, 0, 20, 52, 52, 10, 20,
|
||||
5, 0, 35, 52, 0, 30, 0, 15, 0, 52,
|
||||
15, 52, 52, 52, 52, 52, 52, 52, 52, 52,
|
||||
52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
|
||||
52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
|
||||
52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
|
||||
52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
|
||||
52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
|
||||
52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
|
||||
52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
|
||||
52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
|
||||
52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
|
||||
52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
|
||||
52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
|
||||
52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
|
||||
52, 52, 52, 52, 52, 52
|
||||
};
|
||||
register int hval = len;
|
||||
|
||||
|
@ -102,25 +102,26 @@ struct kconf_id_strings_t
|
|||
char kconf_id_strings_str12[sizeof("default")];
|
||||
char kconf_id_strings_str13[sizeof("def_bool")];
|
||||
char kconf_id_strings_str14[sizeof("help")];
|
||||
char kconf_id_strings_str15[sizeof("bool")];
|
||||
char kconf_id_strings_str16[sizeof("config")];
|
||||
char kconf_id_strings_str17[sizeof("def_tristate")];
|
||||
char kconf_id_strings_str18[sizeof("boolean")];
|
||||
char kconf_id_strings_str18[sizeof("hex")];
|
||||
char kconf_id_strings_str19[sizeof("defconfig_list")];
|
||||
char kconf_id_strings_str21[sizeof("string")];
|
||||
char kconf_id_strings_str22[sizeof("if")];
|
||||
char kconf_id_strings_str23[sizeof("int")];
|
||||
char kconf_id_strings_str26[sizeof("select")];
|
||||
char kconf_id_strings_str27[sizeof("modules")];
|
||||
char kconf_id_strings_str28[sizeof("tristate")];
|
||||
char kconf_id_strings_str29[sizeof("menu")];
|
||||
char kconf_id_strings_str31[sizeof("source")];
|
||||
char kconf_id_strings_str32[sizeof("comment")];
|
||||
char kconf_id_strings_str33[sizeof("hex")];
|
||||
char kconf_id_strings_str35[sizeof("menuconfig")];
|
||||
char kconf_id_strings_str36[sizeof("prompt")];
|
||||
char kconf_id_strings_str37[sizeof("depends")];
|
||||
char kconf_id_strings_str36[sizeof("string")];
|
||||
char kconf_id_strings_str37[sizeof("visible")];
|
||||
char kconf_id_strings_str41[sizeof("prompt")];
|
||||
char kconf_id_strings_str42[sizeof("depends")];
|
||||
char kconf_id_strings_str44[sizeof("bool")];
|
||||
char kconf_id_strings_str46[sizeof("select")];
|
||||
char kconf_id_strings_str47[sizeof("boolean")];
|
||||
char kconf_id_strings_str48[sizeof("mainmenu")];
|
||||
char kconf_id_strings_str51[sizeof("source")];
|
||||
};
|
||||
static struct kconf_id_strings_t kconf_id_strings_contents =
|
||||
{
|
||||
|
@ -136,25 +137,26 @@ static struct kconf_id_strings_t kconf_id_strings_contents =
|
|||
"default",
|
||||
"def_bool",
|
||||
"help",
|
||||
"bool",
|
||||
"config",
|
||||
"def_tristate",
|
||||
"boolean",
|
||||
"hex",
|
||||
"defconfig_list",
|
||||
"string",
|
||||
"if",
|
||||
"int",
|
||||
"select",
|
||||
"modules",
|
||||
"tristate",
|
||||
"menu",
|
||||
"source",
|
||||
"comment",
|
||||
"hex",
|
||||
"menuconfig",
|
||||
"string",
|
||||
"visible",
|
||||
"prompt",
|
||||
"depends",
|
||||
"mainmenu"
|
||||
"bool",
|
||||
"select",
|
||||
"boolean",
|
||||
"mainmenu",
|
||||
"source"
|
||||
};
|
||||
#define kconf_id_strings ((const char *) &kconf_id_strings_contents)
|
||||
#ifdef __GNUC__
|
||||
|
@ -168,11 +170,11 @@ kconf_id_lookup (register const char *str, register unsigned int len)
|
|||
{
|
||||
enum
|
||||
{
|
||||
TOTAL_KEYWORDS = 31,
|
||||
TOTAL_KEYWORDS = 32,
|
||||
MIN_WORD_LENGTH = 2,
|
||||
MAX_WORD_LENGTH = 14,
|
||||
MIN_HASH_VALUE = 2,
|
||||
MAX_HASH_VALUE = 48
|
||||
MAX_HASH_VALUE = 51
|
||||
};
|
||||
|
||||
static struct kconf_id wordlist[] =
|
||||
|
@ -191,31 +193,35 @@ kconf_id_lookup (register const char *str, register unsigned int len)
|
|||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str12, T_DEFAULT, TF_COMMAND, S_UNKNOWN},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str13, T_DEFAULT, TF_COMMAND, S_BOOLEAN},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str14, T_HELP, TF_COMMAND},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str15, T_TYPE, TF_COMMAND, S_BOOLEAN},
|
||||
{-1},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str16, T_CONFIG, TF_COMMAND},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str17, T_DEFAULT, TF_COMMAND, S_TRISTATE},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str18, T_TYPE, TF_COMMAND, S_BOOLEAN},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str18, T_TYPE, TF_COMMAND, S_HEX},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str19, T_OPT_DEFCONFIG_LIST,TF_OPTION},
|
||||
{-1},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str21, T_TYPE, TF_COMMAND, S_STRING},
|
||||
{-1}, {-1},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str22, T_IF, TF_COMMAND|TF_PARAM},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str23, T_TYPE, TF_COMMAND, S_INT},
|
||||
{-1}, {-1},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str26, T_SELECT, TF_COMMAND},
|
||||
{-1}, {-1}, {-1},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str27, T_OPT_MODULES, TF_OPTION},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str28, T_TYPE, TF_COMMAND, S_TRISTATE},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str29, T_MENU, TF_COMMAND},
|
||||
{-1},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str31, T_SOURCE, TF_COMMAND},
|
||||
{-1}, {-1},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str32, T_COMMENT, TF_COMMAND},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str33, T_TYPE, TF_COMMAND, S_HEX},
|
||||
{-1},
|
||||
{-1}, {-1},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str35, T_MENUCONFIG, TF_COMMAND},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str36, T_PROMPT, TF_COMMAND},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str37, T_DEPENDS, TF_COMMAND},
|
||||
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str36, T_TYPE, TF_COMMAND, S_STRING},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str37, T_VISIBLE, TF_COMMAND},
|
||||
{-1}, {-1}, {-1},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str41, T_PROMPT, TF_COMMAND},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str42, T_DEPENDS, TF_COMMAND},
|
||||
{-1},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str48, T_MAINMENU, TF_COMMAND}
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str44, T_TYPE, TF_COMMAND, S_BOOLEAN},
|
||||
{-1},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str46, T_SELECT, TF_COMMAND},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str47, T_TYPE, TF_COMMAND, S_BOOLEAN},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str48, T_MAINMENU, TF_COMMAND},
|
||||
{-1}, {-1},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str51, T_SOURCE, TF_COMMAND}
|
||||
};
|
||||
|
||||
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
|
||||
|
|
|
@ -304,9 +304,10 @@ void zconf_nextfile(const char *name)
|
|||
memset(buf, 0, sizeof(*buf));
|
||||
|
||||
current_buf->state = YY_CURRENT_BUFFER;
|
||||
yyin = zconf_fopen(name);
|
||||
yyin = zconf_fopen(file->name);
|
||||
if (!yyin) {
|
||||
printf("%s:%d: can't open file \"%s\"\n", zconf_curname(), zconf_lineno(), name);
|
||||
printf("%s:%d: can't open file \"%s\"\n",
|
||||
zconf_curname(), zconf_lineno(), file->name);
|
||||
exit(1);
|
||||
}
|
||||
yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE));
|
||||
|
@ -353,7 +354,7 @@ int zconf_lineno(void)
|
|||
return current_pos.lineno;
|
||||
}
|
||||
|
||||
char *zconf_curname(void)
|
||||
const char *zconf_curname(void)
|
||||
{
|
||||
return current_pos.file ? current_pos.file->name : "<none>";
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -36,7 +36,7 @@ static struct menu *current_menu, *current_entry;
|
|||
#define YYERROR_VERBOSE
|
||||
#endif
|
||||
%}
|
||||
%expect 26
|
||||
%expect 30
|
||||
|
||||
%union
|
||||
{
|
||||
|
@ -68,6 +68,7 @@ static struct menu *current_menu, *current_entry;
|
|||
%token <id>T_DEFAULT
|
||||
%token <id>T_SELECT
|
||||
%token <id>T_RANGE
|
||||
%token <id>T_VISIBLE
|
||||
%token <id>T_OPTION
|
||||
%token <id>T_ON
|
||||
%token <string> T_WORD
|
||||
|
@ -104,14 +105,15 @@ static struct menu *current_menu, *current_entry;
|
|||
%}
|
||||
|
||||
%%
|
||||
input: stmt_list;
|
||||
input: nl start | start;
|
||||
|
||||
start: mainmenu_stmt stmt_list | stmt_list;
|
||||
|
||||
stmt_list:
|
||||
/* empty */
|
||||
| stmt_list common_stmt
|
||||
| stmt_list choice_stmt
|
||||
| stmt_list menu_stmt
|
||||
| stmt_list T_MAINMENU prompt nl
|
||||
| stmt_list end { zconf_error("unexpected end statement"); }
|
||||
| stmt_list T_WORD error T_EOL { zconf_error("unknown statement \"%s\"", $2); }
|
||||
| stmt_list option_name error T_EOL
|
||||
|
@ -122,7 +124,7 @@ stmt_list:
|
|||
;
|
||||
|
||||
option_name:
|
||||
T_DEPENDS | T_PROMPT | T_TYPE | T_SELECT | T_OPTIONAL | T_RANGE | T_DEFAULT
|
||||
T_DEPENDS | T_PROMPT | T_TYPE | T_SELECT | T_OPTIONAL | T_RANGE | T_DEFAULT | T_VISIBLE
|
||||
;
|
||||
|
||||
common_stmt:
|
||||
|
@ -342,6 +344,13 @@ if_block:
|
|||
| if_block choice_stmt
|
||||
;
|
||||
|
||||
/* mainmenu entry */
|
||||
|
||||
mainmenu_stmt: T_MAINMENU prompt nl
|
||||
{
|
||||
menu_add_prompt(P_MENU, $2, NULL);
|
||||
};
|
||||
|
||||
/* menu entry */
|
||||
|
||||
menu: T_MENU prompt T_EOL
|
||||
|
@ -351,7 +360,7 @@ menu: T_MENU prompt T_EOL
|
|||
printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno());
|
||||
};
|
||||
|
||||
menu_entry: menu depends_list
|
||||
menu_entry: menu visibility_list depends_list
|
||||
{
|
||||
$$ = menu_add_menu();
|
||||
};
|
||||
|
@ -422,6 +431,19 @@ depends: T_DEPENDS T_ON expr T_EOL
|
|||
printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno());
|
||||
};
|
||||
|
||||
/* visibility option */
|
||||
|
||||
visibility_list:
|
||||
/* empty */
|
||||
| visibility_list visible
|
||||
| visibility_list T_EOL
|
||||
;
|
||||
|
||||
visible: T_VISIBLE if_expr
|
||||
{
|
||||
menu_add_visibility($2);
|
||||
};
|
||||
|
||||
/* prompt statement */
|
||||
|
||||
prompt_stmt_opt:
|
||||
|
@ -494,6 +516,10 @@ void conf_parse(const char *name)
|
|||
prop = prop_alloc(P_DEFAULT, modules_sym);
|
||||
prop->expr = expr_alloc_symbol(sym_lookup("MODULES", 0));
|
||||
}
|
||||
|
||||
rootmenu.prompt->text = _(rootmenu.prompt->text);
|
||||
rootmenu.prompt->text = sym_expand_string_value(rootmenu.prompt->text);
|
||||
|
||||
menu_finalize(&rootmenu);
|
||||
for_all_symbols(i, sym) {
|
||||
if (sym_check_deps(sym))
|
||||
|
@ -514,6 +540,7 @@ static const char *zconf_tokenname(int token)
|
|||
case T_IF: return "if";
|
||||
case T_ENDIF: return "endif";
|
||||
case T_DEPENDS: return "depends";
|
||||
case T_VISIBLE: return "visible";
|
||||
}
|
||||
return "<token>";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue