scripts/config: sync with linux upstream
Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 43873
This commit is contained in:
parent
3f26960a5c
commit
a9f6941436
25 changed files with 629 additions and 240 deletions
|
@ -7,6 +7,7 @@
|
||||||
mainmenu "OpenWrt Configuration"
|
mainmenu "OpenWrt Configuration"
|
||||||
|
|
||||||
config MODULES
|
config MODULES
|
||||||
|
option modules
|
||||||
bool
|
bool
|
||||||
default y
|
default y
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#include "lkc.h"
|
#include "lkc.h"
|
||||||
|
|
||||||
|
@ -514,14 +515,24 @@ int main(int ac, char **av)
|
||||||
{
|
{
|
||||||
struct timeval now;
|
struct timeval now;
|
||||||
unsigned int seed;
|
unsigned int seed;
|
||||||
|
char *seed_env;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Use microseconds derived seed,
|
* Use microseconds derived seed,
|
||||||
* compensate for systems where it may be zero
|
* compensate for systems where it may be zero
|
||||||
*/
|
*/
|
||||||
gettimeofday(&now, NULL);
|
gettimeofday(&now, NULL);
|
||||||
|
|
||||||
seed = (unsigned int)((now.tv_sec + 1) * (now.tv_usec + 1));
|
seed = (unsigned int)((now.tv_sec + 1) * (now.tv_usec + 1));
|
||||||
|
|
||||||
|
seed_env = getenv("KCONFIG_SEED");
|
||||||
|
if( seed_env && *seed_env ) {
|
||||||
|
char *endp;
|
||||||
|
int tmp = (int)strtol(seed_env, &endp, 0);
|
||||||
|
if (*endp == '\0') {
|
||||||
|
seed = tmp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fprintf( stderr, "KCONFIG_SEED=0x%X\n", seed );
|
||||||
srand(seed);
|
srand(seed);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -622,7 +633,8 @@ int main(int ac, char **av)
|
||||||
conf_set_all_new_symbols(def_default);
|
conf_set_all_new_symbols(def_default);
|
||||||
break;
|
break;
|
||||||
case randconfig:
|
case randconfig:
|
||||||
conf_set_all_new_symbols(def_random);
|
/* Really nothing to do in this loop */
|
||||||
|
while (conf_set_all_new_symbols(def_random)) ;
|
||||||
break;
|
break;
|
||||||
case defconfig:
|
case defconfig:
|
||||||
conf_set_all_new_symbols(def_default);
|
conf_set_all_new_symbols(def_default);
|
||||||
|
|
|
@ -140,7 +140,9 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p)
|
||||||
sym->flags |= def_flags;
|
sym->flags |= def_flags;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
conf_warning("symbol value '%s' invalid for %s", p, sym->name);
|
if (def != S_DEF_AUTO)
|
||||||
|
conf_warning("symbol value '%s' invalid for %s",
|
||||||
|
p, sym->name);
|
||||||
return 1;
|
return 1;
|
||||||
case S_OTHER:
|
case S_OTHER:
|
||||||
if (*p != '"') {
|
if (*p != '"') {
|
||||||
|
@ -161,6 +163,7 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p)
|
||||||
memmove(p2, p2 + 1, strlen(p2));
|
memmove(p2, p2 + 1, strlen(p2));
|
||||||
}
|
}
|
||||||
if (!p2) {
|
if (!p2) {
|
||||||
|
if (def != S_DEF_AUTO)
|
||||||
conf_warning("invalid string found");
|
conf_warning("invalid string found");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -172,7 +175,9 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p)
|
||||||
sym->def[def].val = strdup(p);
|
sym->def[def].val = strdup(p);
|
||||||
sym->flags |= def_flags;
|
sym->flags |= def_flags;
|
||||||
} else {
|
} else {
|
||||||
conf_warning("symbol value '%s' invalid for %s", p, sym->name);
|
if (def != S_DEF_AUTO)
|
||||||
|
conf_warning("symbol value '%s' invalid for %s",
|
||||||
|
p, sym->name);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1043,7 +1048,7 @@ void conf_set_changed_callback(void (*fn)(void))
|
||||||
conf_changed_callback = fn;
|
conf_changed_callback = fn;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void randomize_choice_values(struct symbol *csym)
|
static bool randomize_choice_values(struct symbol *csym)
|
||||||
{
|
{
|
||||||
struct property *prop;
|
struct property *prop;
|
||||||
struct symbol *sym;
|
struct symbol *sym;
|
||||||
|
@ -1056,7 +1061,7 @@ static void randomize_choice_values(struct symbol *csym)
|
||||||
* In both cases stop.
|
* In both cases stop.
|
||||||
*/
|
*/
|
||||||
if (csym->curr.tri != yes)
|
if (csym->curr.tri != yes)
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
prop = sym_get_choice_prop(csym);
|
prop = sym_get_choice_prop(csym);
|
||||||
|
|
||||||
|
@ -1080,13 +1085,18 @@ static void randomize_choice_values(struct symbol *csym)
|
||||||
else {
|
else {
|
||||||
sym->def[S_DEF_USER].tri = no;
|
sym->def[S_DEF_USER].tri = no;
|
||||||
}
|
}
|
||||||
|
sym->flags |= SYMBOL_DEF_USER;
|
||||||
|
/* clear VALID to get value calculated */
|
||||||
|
sym->flags &= ~SYMBOL_VALID;
|
||||||
}
|
}
|
||||||
csym->flags |= SYMBOL_DEF_USER;
|
csym->flags |= SYMBOL_DEF_USER;
|
||||||
/* clear VALID to get value calculated */
|
/* clear VALID to get value calculated */
|
||||||
csym->flags &= ~(SYMBOL_VALID);
|
csym->flags &= ~(SYMBOL_VALID);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_all_choice_values(struct symbol *csym)
|
void set_all_choice_values(struct symbol *csym)
|
||||||
{
|
{
|
||||||
struct property *prop;
|
struct property *prop;
|
||||||
struct symbol *sym;
|
struct symbol *sym;
|
||||||
|
@ -1103,20 +1113,66 @@ static void set_all_choice_values(struct symbol *csym)
|
||||||
}
|
}
|
||||||
csym->flags |= SYMBOL_DEF_USER;
|
csym->flags |= SYMBOL_DEF_USER;
|
||||||
/* clear VALID to get value calculated */
|
/* clear VALID to get value calculated */
|
||||||
csym->flags &= ~(SYMBOL_VALID);
|
csym->flags &= ~(SYMBOL_VALID | SYMBOL_NEED_SET_CHOICE_VALUES);
|
||||||
}
|
}
|
||||||
|
|
||||||
void conf_set_all_new_symbols(enum conf_def_mode mode)
|
bool conf_set_all_new_symbols(enum conf_def_mode mode)
|
||||||
{
|
{
|
||||||
struct symbol *sym, *csym;
|
struct symbol *sym, *csym;
|
||||||
int i, cnt;
|
int i, cnt, pby, pty, ptm; /* pby: probability of boolean = y
|
||||||
|
* pty: probability of tristate = y
|
||||||
|
* ptm: probability of tristate = m
|
||||||
|
*/
|
||||||
|
|
||||||
|
pby = 50; pty = ptm = 33; /* can't go as the default in switch-case
|
||||||
|
* below, otherwise gcc whines about
|
||||||
|
* -Wmaybe-uninitialized */
|
||||||
|
if (mode == def_random) {
|
||||||
|
int n, p[3];
|
||||||
|
char *env = getenv("KCONFIG_PROBABILITY");
|
||||||
|
n = 0;
|
||||||
|
while( env && *env ) {
|
||||||
|
char *endp;
|
||||||
|
int tmp = strtol( env, &endp, 10 );
|
||||||
|
if( tmp >= 0 && tmp <= 100 ) {
|
||||||
|
p[n++] = tmp;
|
||||||
|
} else {
|
||||||
|
errno = ERANGE;
|
||||||
|
perror( "KCONFIG_PROBABILITY" );
|
||||||
|
exit( 1 );
|
||||||
|
}
|
||||||
|
env = (*endp == ':') ? endp+1 : endp;
|
||||||
|
if( n >=3 ) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
switch( n ) {
|
||||||
|
case 1:
|
||||||
|
pby = p[0]; ptm = pby/2; pty = pby-ptm;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
pty = p[0]; ptm = p[1]; pby = pty + ptm;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
pby = p[0]; pty = p[1]; ptm = p[2];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( pty+ptm > 100 ) {
|
||||||
|
errno = ERANGE;
|
||||||
|
perror( "KCONFIG_PROBABILITY" );
|
||||||
|
exit( 1 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bool has_changed = false;
|
||||||
|
|
||||||
for_all_symbols(i, sym) {
|
for_all_symbols(i, sym) {
|
||||||
if (sym_has_value(sym))
|
if (sym_has_value(sym) || (sym->flags & SYMBOL_VALID))
|
||||||
continue;
|
continue;
|
||||||
switch (sym_get_type(sym)) {
|
switch (sym_get_type(sym)) {
|
||||||
case S_BOOLEAN:
|
case S_BOOLEAN:
|
||||||
case S_TRISTATE:
|
case S_TRISTATE:
|
||||||
|
has_changed = true;
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case def_yes:
|
case def_yes:
|
||||||
sym->def[S_DEF_USER].tri = yes;
|
sym->def[S_DEF_USER].tri = yes;
|
||||||
|
@ -1125,11 +1181,21 @@ void conf_set_all_new_symbols(enum conf_def_mode mode)
|
||||||
sym->def[S_DEF_USER].tri = mod;
|
sym->def[S_DEF_USER].tri = mod;
|
||||||
break;
|
break;
|
||||||
case def_no:
|
case def_no:
|
||||||
|
if (sym->flags & SYMBOL_ALLNOCONFIG_Y)
|
||||||
|
sym->def[S_DEF_USER].tri = yes;
|
||||||
|
else
|
||||||
sym->def[S_DEF_USER].tri = no;
|
sym->def[S_DEF_USER].tri = no;
|
||||||
break;
|
break;
|
||||||
case def_random:
|
case def_random:
|
||||||
cnt = sym_get_type(sym) == S_TRISTATE ? 3 : 2;
|
sym->def[S_DEF_USER].tri = no;
|
||||||
sym->def[S_DEF_USER].tri = (tristate)(rand() % cnt);
|
cnt = rand() % 100;
|
||||||
|
if (sym->type == S_TRISTATE) {
|
||||||
|
if (cnt < pty)
|
||||||
|
sym->def[S_DEF_USER].tri = yes;
|
||||||
|
else if (cnt < (pty+ptm))
|
||||||
|
sym->def[S_DEF_USER].tri = mod;
|
||||||
|
} else if (cnt < pby)
|
||||||
|
sym->def[S_DEF_USER].tri = yes;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
continue;
|
continue;
|
||||||
|
@ -1154,14 +1220,26 @@ void conf_set_all_new_symbols(enum conf_def_mode mode)
|
||||||
* selected in a choice block and we set it to yes,
|
* selected in a choice block and we set it to yes,
|
||||||
* and the rest to no.
|
* and the rest to no.
|
||||||
*/
|
*/
|
||||||
|
if (mode != def_random) {
|
||||||
|
for_all_symbols(i, csym) {
|
||||||
|
if ((sym_is_choice(csym) && !sym_has_value(csym)) ||
|
||||||
|
sym_is_choice_value(csym))
|
||||||
|
csym->flags |= SYMBOL_NEED_SET_CHOICE_VALUES;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for_all_symbols(i, csym) {
|
for_all_symbols(i, csym) {
|
||||||
if (sym_has_value(csym) || !sym_is_choice(csym))
|
if (sym_has_value(csym) || !sym_is_choice(csym))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
sym_calc_value(csym);
|
sym_calc_value(csym);
|
||||||
if (mode == def_random)
|
if (mode == def_random)
|
||||||
randomize_choice_values(csym);
|
has_changed = randomize_choice_values(csym);
|
||||||
else
|
else {
|
||||||
set_all_choice_values(csym);
|
set_all_choice_values(csym);
|
||||||
|
has_changed = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return has_changed;
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,7 +93,7 @@ struct symbol {
|
||||||
#define SYMBOL_CHOICEVAL 0x0020 /* used as a value in a choice block */
|
#define SYMBOL_CHOICEVAL 0x0020 /* used as a value in a choice block */
|
||||||
#define SYMBOL_VALID 0x0080 /* set when symbol.curr is calculated */
|
#define SYMBOL_VALID 0x0080 /* set when symbol.curr is calculated */
|
||||||
#define SYMBOL_OPTIONAL 0x0100 /* choice is optional - values can be 'n' */
|
#define SYMBOL_OPTIONAL 0x0100 /* choice is optional - values can be 'n' */
|
||||||
#define SYMBOL_WRITE 0x0200 /* ? */
|
#define SYMBOL_WRITE 0x0200 /* write symbol to file (KCONFIG_CONFIG) */
|
||||||
#define SYMBOL_CHANGED 0x0400 /* ? */
|
#define SYMBOL_CHANGED 0x0400 /* ? */
|
||||||
#define SYMBOL_AUTO 0x1000 /* value from environment variable */
|
#define SYMBOL_AUTO 0x1000 /* value from environment variable */
|
||||||
#define SYMBOL_CHECKED 0x2000 /* used during dependency checking */
|
#define SYMBOL_CHECKED 0x2000 /* used during dependency checking */
|
||||||
|
@ -106,6 +106,12 @@ struct symbol {
|
||||||
#define SYMBOL_DEF3 0x40000 /* symbol.def[S_DEF_3] is valid */
|
#define SYMBOL_DEF3 0x40000 /* symbol.def[S_DEF_3] is valid */
|
||||||
#define SYMBOL_DEF4 0x80000 /* symbol.def[S_DEF_4] is valid */
|
#define SYMBOL_DEF4 0x80000 /* symbol.def[S_DEF_4] is valid */
|
||||||
|
|
||||||
|
/* choice values need to be set before calculating this symbol value */
|
||||||
|
#define SYMBOL_NEED_SET_CHOICE_VALUES 0x100000
|
||||||
|
|
||||||
|
/* Set symbol to y if allnoconfig; used for symbols that hide others */
|
||||||
|
#define SYMBOL_ALLNOCONFIG_Y 0x200000
|
||||||
|
|
||||||
#define SYMBOL_MAXLENGTH 256
|
#define SYMBOL_MAXLENGTH 256
|
||||||
#define SYMBOL_HASHSIZE 9973
|
#define SYMBOL_HASHSIZE 9973
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ struct list_head {
|
||||||
* list_entry - get the struct for this entry
|
* list_entry - get the struct for this entry
|
||||||
* @ptr: the &struct list_head pointer.
|
* @ptr: the &struct list_head pointer.
|
||||||
* @type: the type of the struct this is embedded in.
|
* @type: the type of the struct this is embedded in.
|
||||||
* @member: the name of the list_struct within the struct.
|
* @member: the name of the list_head within the struct.
|
||||||
*/
|
*/
|
||||||
#define list_entry(ptr, type, member) \
|
#define list_entry(ptr, type, member) \
|
||||||
container_of(ptr, type, member)
|
container_of(ptr, type, member)
|
||||||
|
@ -43,13 +43,26 @@ struct list_head {
|
||||||
* list_for_each_entry - iterate over list of given type
|
* list_for_each_entry - iterate over list of given type
|
||||||
* @pos: the type * to use as a loop cursor.
|
* @pos: the type * to use as a loop cursor.
|
||||||
* @head: the head for your list.
|
* @head: the head for your list.
|
||||||
* @member: the name of the list_struct within the struct.
|
* @member: the name of the list_head within the struct.
|
||||||
*/
|
*/
|
||||||
#define list_for_each_entry(pos, head, member) \
|
#define list_for_each_entry(pos, head, member) \
|
||||||
for (pos = list_entry((head)->next, typeof(*pos), member); \
|
for (pos = list_entry((head)->next, typeof(*pos), member); \
|
||||||
&pos->member != (head); \
|
&pos->member != (head); \
|
||||||
pos = list_entry(pos->member.next, typeof(*pos), member))
|
pos = list_entry(pos->member.next, typeof(*pos), member))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
|
||||||
|
* @pos: the type * to use as a loop cursor.
|
||||||
|
* @n: another type * to use as temporary storage
|
||||||
|
* @head: the head for your list.
|
||||||
|
* @member: the name of the list_head within the struct.
|
||||||
|
*/
|
||||||
|
#define list_for_each_entry_safe(pos, n, head, member) \
|
||||||
|
for (pos = list_entry((head)->next, typeof(*pos), member), \
|
||||||
|
n = list_entry(pos->member.next, typeof(*pos), member); \
|
||||||
|
&pos->member != (head); \
|
||||||
|
pos = n, n = list_entry(n->member.next, typeof(*n), member))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* list_empty - tests whether a list is empty
|
* list_empty - tests whether a list is empty
|
||||||
* @head: the list to test.
|
* @head: the list to test.
|
||||||
|
@ -88,4 +101,31 @@ static inline void list_add_tail(struct list_head *_new, struct list_head *head)
|
||||||
__list_add(_new, head->prev, head);
|
__list_add(_new, head->prev, head);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Delete a list entry by making the prev/next entries
|
||||||
|
* point to each other.
|
||||||
|
*
|
||||||
|
* This is only for internal list manipulation where we know
|
||||||
|
* the prev/next entries already!
|
||||||
|
*/
|
||||||
|
static inline void __list_del(struct list_head *prev, struct list_head *next)
|
||||||
|
{
|
||||||
|
next->prev = prev;
|
||||||
|
prev->next = next;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define LIST_POISON1 ((void *) 0x00100100)
|
||||||
|
#define LIST_POISON2 ((void *) 0x00200200)
|
||||||
|
/**
|
||||||
|
* list_del - deletes entry from list.
|
||||||
|
* @entry: the element to delete from the list.
|
||||||
|
* Note: list_empty() on entry does not return true after this, the entry is
|
||||||
|
* in an undefined state.
|
||||||
|
*/
|
||||||
|
static inline void list_del(struct list_head *entry)
|
||||||
|
{
|
||||||
|
__list_del(entry->prev, entry->next);
|
||||||
|
entry->next = (struct list_head*)LIST_POISON1;
|
||||||
|
entry->prev = (struct list_head*)LIST_POISON2;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -61,6 +61,7 @@ enum conf_def_mode {
|
||||||
#define T_OPT_MODULES 1
|
#define T_OPT_MODULES 1
|
||||||
#define T_OPT_DEFCONFIG_LIST 2
|
#define T_OPT_DEFCONFIG_LIST 2
|
||||||
#define T_OPT_ENV 3
|
#define T_OPT_ENV 3
|
||||||
|
#define T_OPT_ALLNOCONFIG_Y 4
|
||||||
|
|
||||||
struct kconf_id {
|
struct kconf_id {
|
||||||
int name;
|
int name;
|
||||||
|
@ -86,7 +87,8 @@ const char *conf_get_autoconfig_name(void);
|
||||||
char *conf_get_default_confname(void);
|
char *conf_get_default_confname(void);
|
||||||
void sym_set_change_count(int count);
|
void sym_set_change_count(int count);
|
||||||
void sym_add_change_count(int count);
|
void sym_add_change_count(int count);
|
||||||
void conf_set_all_new_symbols(enum conf_def_mode mode);
|
bool conf_set_all_new_symbols(enum conf_def_mode mode);
|
||||||
|
void set_all_choice_values(struct symbol *csym);
|
||||||
|
|
||||||
struct conf_printer {
|
struct conf_printer {
|
||||||
void (*print_symbol)(FILE *, struct symbol *, const char *, void *);
|
void (*print_symbol)(FILE *, struct symbol *, const char *, void *);
|
||||||
|
|
|
@ -15,6 +15,7 @@ P(conf_set_message_callback, void,(void (*fn)(const char *fmt, va_list ap)));
|
||||||
/* menu.c */
|
/* menu.c */
|
||||||
P(rootmenu,struct menu,);
|
P(rootmenu,struct menu,);
|
||||||
|
|
||||||
|
P(menu_is_empty, bool, (struct menu *menu));
|
||||||
P(menu_is_visible, bool, (struct menu *menu));
|
P(menu_is_visible, bool, (struct menu *menu));
|
||||||
P(menu_has_prompt, bool, (struct menu *menu));
|
P(menu_has_prompt, bool, (struct menu *menu));
|
||||||
P(menu_get_prompt,const char *,(struct menu *menu));
|
P(menu_get_prompt,const char *,(struct menu *menu));
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
# What library to link
|
# What library to link
|
||||||
ldflags()
|
ldflags()
|
||||||
{
|
{
|
||||||
|
pkg-config --libs ncursesw 2>/dev/null && exit
|
||||||
|
pkg-config --libs ncurses 2>/dev/null && exit
|
||||||
for ext in so a dll.a dylib ; do
|
for ext in so a dll.a dylib ; do
|
||||||
for lib in ncursesw ncurses curses ; do
|
for lib in ncursesw ncurses curses ; do
|
||||||
$cc -print-file-name=lib${lib}.${ext} | grep -q /
|
$cc -print-file-name=lib${lib}.${ext} | grep -q /
|
||||||
|
@ -19,13 +21,17 @@ ldflags()
|
||||||
# Where is ncurses.h?
|
# Where is ncurses.h?
|
||||||
ccflags()
|
ccflags()
|
||||||
{
|
{
|
||||||
if [ -f /usr/include/ncursesw/curses.h ]; then
|
if pkg-config --cflags ncursesw 2>/dev/null; then
|
||||||
echo '-I/usr/include/ncursesw -DCURSES_LOC="<ncursesw/curses.h>"'
|
echo '-DCURSES_LOC="<ncurses.h>" -DNCURSES_WIDECHAR=1'
|
||||||
|
elif pkg-config --cflags ncurses 2>/dev/null; then
|
||||||
|
echo '-DCURSES_LOC="<ncurses.h>"'
|
||||||
|
elif [ -f /usr/include/ncursesw/curses.h ]; then
|
||||||
|
echo '-I/usr/include/ncursesw -DCURSES_LOC="<curses.h>"'
|
||||||
echo ' -DNCURSES_WIDECHAR=1'
|
echo ' -DNCURSES_WIDECHAR=1'
|
||||||
elif [ -f /usr/include/ncurses/ncurses.h ]; then
|
elif [ -f /usr/include/ncurses/ncurses.h ]; then
|
||||||
echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"'
|
echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"'
|
||||||
elif [ -f /usr/include/ncurses/curses.h ]; then
|
elif [ -f /usr/include/ncurses/curses.h ]; then
|
||||||
echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"'
|
echo '-I/usr/include/ncurses -DCURSES_LOC="<curses.h>"'
|
||||||
elif [ -f /usr/include/ncurses.h ]; then
|
elif [ -f /usr/include/ncurses.h ]; then
|
||||||
echo '-DCURSES_LOC="<ncurses.h>"'
|
echo '-DCURSES_LOC="<ncurses.h>"'
|
||||||
else
|
else
|
||||||
|
|
|
@ -132,16 +132,16 @@ int dialog_checklist(const char *title, const char *prompt, int height,
|
||||||
}
|
}
|
||||||
|
|
||||||
do_resize:
|
do_resize:
|
||||||
if (getmaxy(stdscr) < (height + 6))
|
if (getmaxy(stdscr) < (height + CHECKLIST_HEIGTH_MIN))
|
||||||
return -ERRDISPLAYTOOSMALL;
|
return -ERRDISPLAYTOOSMALL;
|
||||||
if (getmaxx(stdscr) < (width + 6))
|
if (getmaxx(stdscr) < (width + CHECKLIST_WIDTH_MIN))
|
||||||
return -ERRDISPLAYTOOSMALL;
|
return -ERRDISPLAYTOOSMALL;
|
||||||
|
|
||||||
max_choice = MIN(list_height, item_count());
|
max_choice = MIN(list_height, item_count());
|
||||||
|
|
||||||
/* center dialog box on screen */
|
/* center dialog box on screen */
|
||||||
x = (COLS - width) / 2;
|
x = (getmaxx(stdscr) - width) / 2;
|
||||||
y = (LINES - height) / 2;
|
y = (getmaxy(stdscr) - height) / 2;
|
||||||
|
|
||||||
draw_shadow(stdscr, y, x, height, width);
|
draw_shadow(stdscr, y, x, height, width);
|
||||||
|
|
||||||
|
|
|
@ -106,8 +106,14 @@ struct dialog_color {
|
||||||
int hl; /* highlight this item */
|
int hl; /* highlight this item */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct subtitle_list {
|
||||||
|
struct subtitle_list *next;
|
||||||
|
const char *text;
|
||||||
|
};
|
||||||
|
|
||||||
struct dialog_info {
|
struct dialog_info {
|
||||||
const char *backtitle;
|
const char *backtitle;
|
||||||
|
struct subtitle_list *subtitles;
|
||||||
struct dialog_color screen;
|
struct dialog_color screen;
|
||||||
struct dialog_color shadow;
|
struct dialog_color shadow;
|
||||||
struct dialog_color dialog;
|
struct dialog_color dialog;
|
||||||
|
@ -164,7 +170,7 @@ char item_tag(void);
|
||||||
/* item list manipulation for lxdialog use */
|
/* item list manipulation for lxdialog use */
|
||||||
#define MAXITEMSTR 200
|
#define MAXITEMSTR 200
|
||||||
struct dialog_item {
|
struct dialog_item {
|
||||||
char str[MAXITEMSTR]; /* promtp displayed */
|
char str[MAXITEMSTR]; /* prompt displayed */
|
||||||
char tag;
|
char tag;
|
||||||
void *data; /* pointer to menu item - used by menubox+checklist */
|
void *data; /* pointer to menu item - used by menubox+checklist */
|
||||||
int selected; /* Set to 1 by dialog_*() function if selected. */
|
int selected; /* Set to 1 by dialog_*() function if selected. */
|
||||||
|
@ -194,8 +200,23 @@ int item_is_tag(char tag);
|
||||||
int on_key_esc(WINDOW *win);
|
int on_key_esc(WINDOW *win);
|
||||||
int on_key_resize(void);
|
int on_key_resize(void);
|
||||||
|
|
||||||
|
/* minimum (re)size values */
|
||||||
|
#define CHECKLIST_HEIGTH_MIN 6 /* For dialog_checklist() */
|
||||||
|
#define CHECKLIST_WIDTH_MIN 6
|
||||||
|
#define INPUTBOX_HEIGTH_MIN 2 /* For dialog_inputbox() */
|
||||||
|
#define INPUTBOX_WIDTH_MIN 2
|
||||||
|
#define MENUBOX_HEIGTH_MIN 15 /* For dialog_menu() */
|
||||||
|
#define MENUBOX_WIDTH_MIN 65
|
||||||
|
#define TEXTBOX_HEIGTH_MIN 8 /* For dialog_textbox() */
|
||||||
|
#define TEXTBOX_WIDTH_MIN 8
|
||||||
|
#define YESNO_HEIGTH_MIN 4 /* For dialog_yesno() */
|
||||||
|
#define YESNO_WIDTH_MIN 4
|
||||||
|
#define WINDOW_HEIGTH_MIN 19 /* For init_dialog() */
|
||||||
|
#define WINDOW_WIDTH_MIN 80
|
||||||
|
|
||||||
int init_dialog(const char *backtitle);
|
int init_dialog(const char *backtitle);
|
||||||
void set_dialog_backtitle(const char *backtitle);
|
void set_dialog_backtitle(const char *backtitle);
|
||||||
|
void set_dialog_subtitles(struct subtitle_list *subtitles);
|
||||||
void end_dialog(int x, int y);
|
void end_dialog(int x, int y);
|
||||||
void attr_clear(WINDOW * win, int height, int width, chtype attr);
|
void attr_clear(WINDOW * win, int height, int width, chtype attr);
|
||||||
void dialog_clear(void);
|
void dialog_clear(void);
|
||||||
|
|
|
@ -56,14 +56,14 @@ int dialog_inputbox(const char *title, const char *prompt, int height, int width
|
||||||
strcpy(instr, init);
|
strcpy(instr, init);
|
||||||
|
|
||||||
do_resize:
|
do_resize:
|
||||||
if (getmaxy(stdscr) <= (height - 2))
|
if (getmaxy(stdscr) <= (height - INPUTBOX_HEIGTH_MIN))
|
||||||
return -ERRDISPLAYTOOSMALL;
|
return -ERRDISPLAYTOOSMALL;
|
||||||
if (getmaxx(stdscr) <= (width - 2))
|
if (getmaxx(stdscr) <= (width - INPUTBOX_WIDTH_MIN))
|
||||||
return -ERRDISPLAYTOOSMALL;
|
return -ERRDISPLAYTOOSMALL;
|
||||||
|
|
||||||
/* center dialog box on screen */
|
/* center dialog box on screen */
|
||||||
x = (COLS - width) / 2;
|
x = (getmaxx(stdscr) - width) / 2;
|
||||||
y = (LINES - height) / 2;
|
y = (getmaxy(stdscr) - height) / 2;
|
||||||
|
|
||||||
draw_shadow(stdscr, y, x, height, width);
|
draw_shadow(stdscr, y, x, height, width);
|
||||||
|
|
||||||
|
|
|
@ -193,7 +193,7 @@ int dialog_menu(const char *title, const char *prompt,
|
||||||
do_resize:
|
do_resize:
|
||||||
height = getmaxy(stdscr);
|
height = getmaxy(stdscr);
|
||||||
width = getmaxx(stdscr);
|
width = getmaxx(stdscr);
|
||||||
if (height < 15 || width < 65)
|
if (height < MENUBOX_HEIGTH_MIN || width < MENUBOX_WIDTH_MIN)
|
||||||
return -ERRDISPLAYTOOSMALL;
|
return -ERRDISPLAYTOOSMALL;
|
||||||
|
|
||||||
height -= 4;
|
height -= 4;
|
||||||
|
@ -203,8 +203,8 @@ do_resize:
|
||||||
max_choice = MIN(menu_height, item_count());
|
max_choice = MIN(menu_height, item_count());
|
||||||
|
|
||||||
/* center dialog box on screen */
|
/* center dialog box on screen */
|
||||||
x = (COLS - width) / 2;
|
x = (getmaxx(stdscr) - width) / 2;
|
||||||
y = (LINES - height) / 2;
|
y = (getmaxy(stdscr) - height) / 2;
|
||||||
|
|
||||||
draw_shadow(stdscr, y, x, height, width);
|
draw_shadow(stdscr, y, x, height, width);
|
||||||
|
|
||||||
|
@ -303,10 +303,11 @@ do_resize:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i < max_choice ||
|
if (item_count() != 0 &&
|
||||||
|
(i < max_choice ||
|
||||||
key == KEY_UP || key == KEY_DOWN ||
|
key == KEY_UP || key == KEY_DOWN ||
|
||||||
key == '-' || key == '+' ||
|
key == '-' || key == '+' ||
|
||||||
key == KEY_PPAGE || key == KEY_NPAGE) {
|
key == KEY_PPAGE || key == KEY_NPAGE)) {
|
||||||
/* Remove highligt of current item */
|
/* Remove highligt of current item */
|
||||||
print_item(scroll + choice, choice, FALSE);
|
print_item(scroll + choice, choice, FALSE);
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ int dialog_textbox(const char *title, char *tbuf, int initial_height,
|
||||||
|
|
||||||
do_resize:
|
do_resize:
|
||||||
getmaxyx(stdscr, height, width);
|
getmaxyx(stdscr, height, width);
|
||||||
if (height < 8 || width < 8)
|
if (height < TEXTBOX_HEIGTH_MIN || width < TEXTBOX_WIDTH_MIN)
|
||||||
return -ERRDISPLAYTOOSMALL;
|
return -ERRDISPLAYTOOSMALL;
|
||||||
if (initial_height != 0)
|
if (initial_height != 0)
|
||||||
height = initial_height;
|
height = initial_height;
|
||||||
|
@ -98,8 +98,8 @@ do_resize:
|
||||||
width = 0;
|
width = 0;
|
||||||
|
|
||||||
/* center dialog box on screen */
|
/* center dialog box on screen */
|
||||||
x = (COLS - width) / 2;
|
x = (getmaxx(stdscr) - width) / 2;
|
||||||
y = (LINES - height) / 2;
|
y = (getmaxy(stdscr) - height) / 2;
|
||||||
|
|
||||||
draw_shadow(stdscr, y, x, height, width);
|
draw_shadow(stdscr, y, x, height, width);
|
||||||
|
|
||||||
|
|
|
@ -254,15 +254,56 @@ void attr_clear(WINDOW * win, int height, int width, chtype attr)
|
||||||
|
|
||||||
void dialog_clear(void)
|
void dialog_clear(void)
|
||||||
{
|
{
|
||||||
attr_clear(stdscr, LINES, COLS, dlg.screen.atr);
|
int lines, columns;
|
||||||
|
|
||||||
|
lines = getmaxy(stdscr);
|
||||||
|
columns = getmaxx(stdscr);
|
||||||
|
|
||||||
|
attr_clear(stdscr, lines, columns, dlg.screen.atr);
|
||||||
/* Display background title if it exists ... - SLH */
|
/* Display background title if it exists ... - SLH */
|
||||||
if (dlg.backtitle != NULL) {
|
if (dlg.backtitle != NULL) {
|
||||||
int i;
|
int i, len = 0, skip = 0;
|
||||||
|
struct subtitle_list *pos;
|
||||||
|
|
||||||
wattrset(stdscr, dlg.screen.atr);
|
wattrset(stdscr, dlg.screen.atr);
|
||||||
mvwaddstr(stdscr, 0, 1, (char *)dlg.backtitle);
|
mvwaddstr(stdscr, 0, 1, (char *)dlg.backtitle);
|
||||||
|
|
||||||
|
for (pos = dlg.subtitles; pos != NULL; pos = pos->next) {
|
||||||
|
/* 3 is for the arrow and spaces */
|
||||||
|
len += strlen(pos->text) + 3;
|
||||||
|
}
|
||||||
|
|
||||||
wmove(stdscr, 1, 1);
|
wmove(stdscr, 1, 1);
|
||||||
for (i = 1; i < COLS - 1; i++)
|
if (len > columns - 2) {
|
||||||
|
const char *ellipsis = "[...] ";
|
||||||
|
waddstr(stdscr, ellipsis);
|
||||||
|
skip = len - (columns - 2 - strlen(ellipsis));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (pos = dlg.subtitles; pos != NULL; pos = pos->next) {
|
||||||
|
if (skip == 0)
|
||||||
|
waddch(stdscr, ACS_RARROW);
|
||||||
|
else
|
||||||
|
skip--;
|
||||||
|
|
||||||
|
if (skip == 0)
|
||||||
|
waddch(stdscr, ' ');
|
||||||
|
else
|
||||||
|
skip--;
|
||||||
|
|
||||||
|
if (skip < strlen(pos->text)) {
|
||||||
|
waddstr(stdscr, pos->text + skip);
|
||||||
|
skip = 0;
|
||||||
|
} else
|
||||||
|
skip -= strlen(pos->text);
|
||||||
|
|
||||||
|
if (skip == 0)
|
||||||
|
waddch(stdscr, ' ');
|
||||||
|
else
|
||||||
|
skip--;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = len + 1; i < columns - 1; i++)
|
||||||
waddch(stdscr, ACS_HLINE);
|
waddch(stdscr, ACS_HLINE);
|
||||||
}
|
}
|
||||||
wnoutrefresh(stdscr);
|
wnoutrefresh(stdscr);
|
||||||
|
@ -281,7 +322,7 @@ int init_dialog(const char *backtitle)
|
||||||
getyx(stdscr, saved_y, saved_x);
|
getyx(stdscr, saved_y, saved_x);
|
||||||
|
|
||||||
getmaxyx(stdscr, height, width);
|
getmaxyx(stdscr, height, width);
|
||||||
if (height < 19 || width < 80) {
|
if (height < WINDOW_HEIGTH_MIN || width < WINDOW_WIDTH_MIN) {
|
||||||
endwin();
|
endwin();
|
||||||
return -ERRDISPLAYTOOSMALL;
|
return -ERRDISPLAYTOOSMALL;
|
||||||
}
|
}
|
||||||
|
@ -302,6 +343,11 @@ void set_dialog_backtitle(const char *backtitle)
|
||||||
dlg.backtitle = backtitle;
|
dlg.backtitle = backtitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void set_dialog_subtitles(struct subtitle_list *subtitles)
|
||||||
|
{
|
||||||
|
dlg.subtitles = subtitles;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* End using dialog functions.
|
* End using dialog functions.
|
||||||
*/
|
*/
|
||||||
|
@ -330,27 +376,19 @@ void print_title(WINDOW *dialog, const char *title, int width)
|
||||||
/*
|
/*
|
||||||
* Print a string of text in a window, automatically wrap around to the
|
* Print a string of text in a window, automatically wrap around to the
|
||||||
* next line if the string is too long to fit on one line. Newline
|
* next line if the string is too long to fit on one line. Newline
|
||||||
* characters '\n' are replaced by spaces. We start on a new line
|
* characters '\n' are propperly processed. We start on a new line
|
||||||
* if there is no room for at least 4 nonblanks following a double-space.
|
* if there is no room for at least 4 nonblanks following a double-space.
|
||||||
*/
|
*/
|
||||||
void print_autowrap(WINDOW * win, const char *prompt, int width, int y, int x)
|
void print_autowrap(WINDOW * win, const char *prompt, int width, int y, int x)
|
||||||
{
|
{
|
||||||
int newl, cur_x, cur_y;
|
int newl, cur_x, cur_y;
|
||||||
int i, prompt_len, room, wlen;
|
int prompt_len, room, wlen;
|
||||||
char tempstr[MAX_LEN + 1], *word, *sp, *sp2;
|
char tempstr[MAX_LEN + 1], *word, *sp, *sp2, *newline_separator = 0;
|
||||||
|
|
||||||
strcpy(tempstr, prompt);
|
strcpy(tempstr, prompt);
|
||||||
|
|
||||||
prompt_len = strlen(tempstr);
|
prompt_len = strlen(tempstr);
|
||||||
|
|
||||||
/*
|
|
||||||
* Remove newlines
|
|
||||||
*/
|
|
||||||
for (i = 0; i < prompt_len; i++) {
|
|
||||||
if (tempstr[i] == '\n')
|
|
||||||
tempstr[i] = ' ';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (prompt_len <= width - x * 2) { /* If prompt is short */
|
if (prompt_len <= width - x * 2) { /* If prompt is short */
|
||||||
wmove(win, y, (width - prompt_len) / 2);
|
wmove(win, y, (width - prompt_len) / 2);
|
||||||
waddstr(win, tempstr);
|
waddstr(win, tempstr);
|
||||||
|
@ -360,7 +398,10 @@ void print_autowrap(WINDOW * win, const char *prompt, int width, int y, int x)
|
||||||
newl = 1;
|
newl = 1;
|
||||||
word = tempstr;
|
word = tempstr;
|
||||||
while (word && *word) {
|
while (word && *word) {
|
||||||
sp = strchr(word, ' ');
|
sp = strpbrk(word, "\n ");
|
||||||
|
if (sp && *sp == '\n')
|
||||||
|
newline_separator = sp;
|
||||||
|
|
||||||
if (sp)
|
if (sp)
|
||||||
*sp++ = 0;
|
*sp++ = 0;
|
||||||
|
|
||||||
|
@ -372,7 +413,7 @@ void print_autowrap(WINDOW * win, const char *prompt, int width, int y, int x)
|
||||||
if (wlen > room ||
|
if (wlen > room ||
|
||||||
(newl && wlen < 4 && sp
|
(newl && wlen < 4 && sp
|
||||||
&& wlen + 1 + strlen(sp) > room
|
&& wlen + 1 + strlen(sp) > room
|
||||||
&& (!(sp2 = strchr(sp, ' '))
|
&& (!(sp2 = strpbrk(sp, "\n "))
|
||||||
|| wlen + 1 + (sp2 - sp) > room))) {
|
|| wlen + 1 + (sp2 - sp) > room))) {
|
||||||
cur_y++;
|
cur_y++;
|
||||||
cur_x = x;
|
cur_x = x;
|
||||||
|
@ -380,7 +421,15 @@ void print_autowrap(WINDOW * win, const char *prompt, int width, int y, int x)
|
||||||
wmove(win, cur_y, cur_x);
|
wmove(win, cur_y, cur_x);
|
||||||
waddstr(win, word);
|
waddstr(win, word);
|
||||||
getyx(win, cur_y, cur_x);
|
getyx(win, cur_y, cur_x);
|
||||||
|
|
||||||
|
/* Move to the next line if the word separator was a newline */
|
||||||
|
if (newline_separator) {
|
||||||
|
cur_y++;
|
||||||
|
cur_x = x;
|
||||||
|
newline_separator = 0;
|
||||||
|
} else
|
||||||
cur_x++;
|
cur_x++;
|
||||||
|
|
||||||
if (sp && *sp == ' ') {
|
if (sp && *sp == ' ') {
|
||||||
cur_x++; /* double space */
|
cur_x++; /* double space */
|
||||||
while (*++sp == ' ') ;
|
while (*++sp == ' ') ;
|
||||||
|
|
|
@ -45,14 +45,14 @@ int dialog_yesno(const char *title, const char *prompt, int height, int width)
|
||||||
WINDOW *dialog;
|
WINDOW *dialog;
|
||||||
|
|
||||||
do_resize:
|
do_resize:
|
||||||
if (getmaxy(stdscr) < (height + 4))
|
if (getmaxy(stdscr) < (height + YESNO_HEIGTH_MIN))
|
||||||
return -ERRDISPLAYTOOSMALL;
|
return -ERRDISPLAYTOOSMALL;
|
||||||
if (getmaxx(stdscr) < (width + 4))
|
if (getmaxx(stdscr) < (width + YESNO_WIDTH_MIN))
|
||||||
return -ERRDISPLAYTOOSMALL;
|
return -ERRDISPLAYTOOSMALL;
|
||||||
|
|
||||||
/* center dialog box on screen */
|
/* center dialog box on screen */
|
||||||
x = (COLS - width) / 2;
|
x = (getmaxx(stdscr) - width) / 2;
|
||||||
y = (LINES - height) / 2;
|
y = (getmaxy(stdscr) - height) / 2;
|
||||||
|
|
||||||
draw_shadow(stdscr, y, x, height, width);
|
draw_shadow(stdscr, y, x, height, width);
|
||||||
|
|
||||||
|
|
|
@ -35,16 +35,16 @@ static const char mconf_readme[] = N_(
|
||||||
"\n"
|
"\n"
|
||||||
"To change any of these features, highlight it with the cursor\n"
|
"To change any of these features, highlight it with the cursor\n"
|
||||||
"keys and press <Y> to build it in, <M> to make it a module or\n"
|
"keys and press <Y> to build it in, <M> to make it a module or\n"
|
||||||
"<N> to removed it. You may also press the <Space Bar> to cycle\n"
|
"<N> to remove it. You may also press the <Space Bar> to cycle\n"
|
||||||
"through the available options (ie. Y->N->M->Y).\n"
|
"through the available options (i.e. Y->N->M->Y).\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Some additional keyboard hints:\n"
|
"Some additional keyboard hints:\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Menus\n"
|
"Menus\n"
|
||||||
"----------\n"
|
"----------\n"
|
||||||
"o Use the Up/Down arrow keys (cursor keys) to highlight the item\n"
|
"o Use the Up/Down arrow keys (cursor keys) to highlight the item you\n"
|
||||||
" you wish to change or submenu wish to select and press <Enter>.\n"
|
" wish to change or the submenu you wish to select and press <Enter>.\n"
|
||||||
" Submenus are designated by \"--->\".\n"
|
" Submenus are designated by \"--->\", empty ones by \"----\".\n"
|
||||||
"\n"
|
"\n"
|
||||||
" Shortcut: Press the option's highlighted letter (hotkey).\n"
|
" Shortcut: Press the option's highlighted letter (hotkey).\n"
|
||||||
" Pressing a hotkey more than once will sequence\n"
|
" Pressing a hotkey more than once will sequence\n"
|
||||||
|
@ -61,7 +61,7 @@ static const char mconf_readme[] = N_(
|
||||||
" there is a delayed response which you may find annoying.\n"
|
" there is a delayed response which you may find annoying.\n"
|
||||||
"\n"
|
"\n"
|
||||||
" Also, the <TAB> and cursor keys will cycle between <Select>,\n"
|
" Also, the <TAB> and cursor keys will cycle between <Select>,\n"
|
||||||
" <Exit> and <Help>.\n"
|
" <Exit>, <Help>, <Save>, and <Load>.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"o To get help with an item, use the cursor keys to highlight <Help>\n"
|
"o To get help with an item, use the cursor keys to highlight <Help>\n"
|
||||||
" and press <ENTER>.\n"
|
" and press <ENTER>.\n"
|
||||||
|
@ -101,7 +101,7 @@ static const char mconf_readme[] = N_(
|
||||||
"Text Box (Help Window)\n"
|
"Text Box (Help Window)\n"
|
||||||
"--------\n"
|
"--------\n"
|
||||||
"o Use the cursor keys to scroll up/down/left/right. The VI editor\n"
|
"o Use the cursor keys to scroll up/down/left/right. The VI editor\n"
|
||||||
" keys h,j,k,l function here as do <u>, <d>, <SPACE BAR> and <B> for \n"
|
" keys h,j,k,l function here as do <u>, <d>, <SPACE BAR> and <B> for\n"
|
||||||
" those who are familiar with less and lynx.\n"
|
" those who are familiar with less and lynx.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"o Press <E>, <X>, <q>, <Enter> or <Esc><Esc> to exit.\n"
|
"o Press <E>, <X>, <q>, <Enter> or <Esc><Esc> to exit.\n"
|
||||||
|
@ -113,23 +113,21 @@ static const char mconf_readme[] = N_(
|
||||||
"those who, for various reasons, find it necessary to switch\n"
|
"those who, for various reasons, find it necessary to switch\n"
|
||||||
"between different configurations.\n"
|
"between different configurations.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"At the end of the main menu you will find two options. One is\n"
|
"The <Save> button will let you save the current configuration to\n"
|
||||||
"for saving the current configuration to a file of your choosing.\n"
|
"a file of your choosing. Use the <Load> button to load a previously\n"
|
||||||
"The other option is for loading a previously saved alternate\n"
|
"saved alternate configuration.\n"
|
||||||
"configuration.\n"
|
|
||||||
"\n"
|
"\n"
|
||||||
"Even if you don't use alternate configuration files, but you\n"
|
"Even if you don't use alternate configuration files, but you find\n"
|
||||||
"find during a Menuconfig session that you have completely messed\n"
|
"during a Menuconfig session that you have completely messed up your\n"
|
||||||
"up your settings, you may use the \"Load Alternate...\" option to\n"
|
"settings, you may use the <Load> button to restore your previously\n"
|
||||||
"restore your previously saved settings from \".config\" without\n"
|
"saved settings from \".config\" without restarting Menuconfig.\n"
|
||||||
"restarting Menuconfig.\n"
|
|
||||||
"\n"
|
"\n"
|
||||||
"Other information\n"
|
"Other information\n"
|
||||||
"-----------------\n"
|
"-----------------\n"
|
||||||
"If you use Menuconfig in an XTERM window make sure you have your\n"
|
"If you use Menuconfig in an XTERM window, make sure you have your\n"
|
||||||
"$TERM variable set to point to a xterm definition which supports color.\n"
|
"$TERM variable set to point to an xterm definition which supports\n"
|
||||||
"Otherwise, Menuconfig will look rather bad. Menuconfig will not\n"
|
"color. Otherwise, Menuconfig will look rather bad. Menuconfig will\n"
|
||||||
"display correctly in a RXVT window because rxvt displays only one\n"
|
"not display correctly in an RXVT window because rxvt displays only one\n"
|
||||||
"intensity of color, bright.\n"
|
"intensity of color, bright.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Menuconfig will display larger menus on screens or xterms which are\n"
|
"Menuconfig will display larger menus on screens or xterms which are\n"
|
||||||
|
@ -144,8 +142,8 @@ static const char mconf_readme[] = N_(
|
||||||
"\n"
|
"\n"
|
||||||
"Optional personality available\n"
|
"Optional personality available\n"
|
||||||
"------------------------------\n"
|
"------------------------------\n"
|
||||||
"If you prefer to have all of the options listed in a single menu, rather\n"
|
"If you prefer to have all of the options listed in a single menu,\n"
|
||||||
"than the default multimenu hierarchy, run the menuconfig with\n"
|
"rather than the default multimenu hierarchy, run the menuconfig with\n"
|
||||||
"MENUCONFIG_MODE environment variable set to single_menu. Example:\n"
|
"MENUCONFIG_MODE environment variable set to single_menu. Example:\n"
|
||||||
"\n"
|
"\n"
|
||||||
"make MENUCONFIG_MODE=single_menu menuconfig\n"
|
"make MENUCONFIG_MODE=single_menu menuconfig\n"
|
||||||
|
@ -168,11 +166,11 @@ static const char mconf_readme[] = N_(
|
||||||
" mono => selects colors suitable for monochrome displays\n"
|
" mono => selects colors suitable for monochrome displays\n"
|
||||||
" blackbg => selects a color scheme with black background\n"
|
" blackbg => selects a color scheme with black background\n"
|
||||||
" classic => theme with blue background. The classic look\n"
|
" classic => theme with blue background. The classic look\n"
|
||||||
" bluetitle => a LCD friendly version of classic. (default)\n"
|
" bluetitle => an LCD friendly version of classic. (default)\n"
|
||||||
"\n"),
|
"\n"),
|
||||||
menu_instructions[] = N_(
|
menu_instructions[] = N_(
|
||||||
"Arrow keys navigate the menu. "
|
"Arrow keys navigate the menu. "
|
||||||
"<Enter> selects submenus --->. "
|
"<Enter> selects submenus ---> (or empty submenus ----). "
|
||||||
"Highlighted letters are hotkeys. "
|
"Highlighted letters are hotkeys. "
|
||||||
"Pressing <Y> includes, <N> excludes, <M> modularizes features. "
|
"Pressing <Y> includes, <N> excludes, <M> modularizes features. "
|
||||||
"Press <Esc><Esc> to exit, <?> for Help, </> for Search. "
|
"Press <Esc><Esc> to exit, <?> for Help, </> for Search. "
|
||||||
|
@ -234,24 +232,24 @@ search_help[] = N_(
|
||||||
"Symbol: FOO [=m]\n"
|
"Symbol: FOO [=m]\n"
|
||||||
"Type : tristate\n"
|
"Type : tristate\n"
|
||||||
"Prompt: Foo bus is used to drive the bar HW\n"
|
"Prompt: Foo bus is used to drive the bar HW\n"
|
||||||
" Defined at drivers/pci/Kconfig:47\n"
|
|
||||||
" Depends on: X86_LOCAL_APIC && X86_IO_APIC || IA64\n"
|
|
||||||
" Location:\n"
|
" Location:\n"
|
||||||
" -> Bus options (PCI, PCMCIA, EISA, ISA)\n"
|
" -> Bus options (PCI, PCMCIA, EISA, ISA)\n"
|
||||||
" -> PCI support (PCI [=y])\n"
|
" -> PCI support (PCI [=y])\n"
|
||||||
"(1) -> PCI access mode (<choice> [=y])\n"
|
"(1) -> PCI access mode (<choice> [=y])\n"
|
||||||
|
" Defined at drivers/pci/Kconfig:47\n"
|
||||||
|
" Depends on: X86_LOCAL_APIC && X86_IO_APIC || IA64\n"
|
||||||
" Selects: LIBCRC32\n"
|
" Selects: LIBCRC32\n"
|
||||||
" Selected by: BAR\n"
|
" Selected by: BAR [=n]\n"
|
||||||
"-----------------------------------------------------------------\n"
|
"-----------------------------------------------------------------\n"
|
||||||
"o The line 'Type:' shows the type of the configuration option for\n"
|
"o The line 'Type:' shows the type of the configuration option for\n"
|
||||||
" this symbol (boolean, tristate, string, ...)\n"
|
" this symbol (boolean, tristate, string, ...)\n"
|
||||||
"o The line 'Prompt:' shows the text used in the menu structure for\n"
|
"o The line 'Prompt:' shows the text used in the menu structure for\n"
|
||||||
" this symbol\n"
|
" this symbol\n"
|
||||||
"o The 'Defined at' line tell at what file / line number the symbol\n"
|
"o The 'Defined at' line tells at what file / line number the symbol\n"
|
||||||
" is defined\n"
|
" is defined\n"
|
||||||
"o The 'Depends on:' line tell what symbols needs to be defined for\n"
|
"o The 'Depends on:' line tells what symbols need to be defined for\n"
|
||||||
" this symbol to be visible in the menu (selectable)\n"
|
" this symbol to be visible in the menu (selectable)\n"
|
||||||
"o The 'Location:' lines tell where in the menu structure this symbol\n"
|
"o The 'Location:' lines tells where in the menu structure this symbol\n"
|
||||||
" is located\n"
|
" is located\n"
|
||||||
" A location followed by a [=y] indicates that this is a\n"
|
" A location followed by a [=y] indicates that this is a\n"
|
||||||
" selectable menu item - and the current value is displayed inside\n"
|
" selectable menu item - and the current value is displayed inside\n"
|
||||||
|
@ -259,9 +257,9 @@ search_help[] = N_(
|
||||||
" Press the key in the (#) prefix to jump directly to that\n"
|
" Press the key in the (#) prefix to jump directly to that\n"
|
||||||
" location. You will be returned to the current search results\n"
|
" location. You will be returned to the current search results\n"
|
||||||
" after exiting this new menu.\n"
|
" after exiting this new menu.\n"
|
||||||
"o The 'Selects:' line tell what symbol will be automatically\n"
|
"o The 'Selects:' line tells what symbols will be automatically\n"
|
||||||
" selected if this symbol is selected (y or m)\n"
|
" selected if this symbol is selected (y or m)\n"
|
||||||
"o The 'Selected by' line tell what symbol has selected this symbol\n"
|
"o The 'Selected by' line tells what symbol has selected this symbol\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Only relevant lines are shown.\n"
|
"Only relevant lines are shown.\n"
|
||||||
"\n\n"
|
"\n\n"
|
||||||
|
@ -307,6 +305,50 @@ static void set_config_filename(const char *config_filename)
|
||||||
filename[sizeof(filename)-1] = '\0';
|
filename[sizeof(filename)-1] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct subtitle_part {
|
||||||
|
struct list_head entries;
|
||||||
|
const char *text;
|
||||||
|
};
|
||||||
|
static LIST_HEAD(trail);
|
||||||
|
|
||||||
|
static struct subtitle_list *subtitles;
|
||||||
|
static void set_subtitle(void)
|
||||||
|
{
|
||||||
|
struct subtitle_part *sp;
|
||||||
|
struct subtitle_list *pos, *tmp;
|
||||||
|
|
||||||
|
for (pos = subtitles; pos != NULL; pos = tmp) {
|
||||||
|
tmp = pos->next;
|
||||||
|
free(pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
subtitles = NULL;
|
||||||
|
list_for_each_entry(sp, &trail, entries) {
|
||||||
|
if (sp->text) {
|
||||||
|
if (pos) {
|
||||||
|
pos->next = xcalloc(1, sizeof(*pos));
|
||||||
|
pos = pos->next;
|
||||||
|
} else {
|
||||||
|
subtitles = pos = xcalloc(1, sizeof(*pos));
|
||||||
|
}
|
||||||
|
pos->text = sp->text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
set_dialog_subtitles(subtitles);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void reset_subtitle(void)
|
||||||
|
{
|
||||||
|
struct subtitle_list *pos, *tmp;
|
||||||
|
|
||||||
|
for (pos = subtitles; pos != NULL; pos = tmp) {
|
||||||
|
tmp = pos->next;
|
||||||
|
free(pos);
|
||||||
|
}
|
||||||
|
subtitles = NULL;
|
||||||
|
set_dialog_subtitles(subtitles);
|
||||||
|
}
|
||||||
|
|
||||||
struct search_data {
|
struct search_data {
|
||||||
struct list_head *head;
|
struct list_head *head;
|
||||||
|
@ -349,10 +391,12 @@ static void search_conf(void)
|
||||||
char *dialog_input;
|
char *dialog_input;
|
||||||
int dres, vscroll = 0, hscroll = 0;
|
int dres, vscroll = 0, hscroll = 0;
|
||||||
bool again;
|
bool again;
|
||||||
|
struct gstr sttext;
|
||||||
|
struct subtitle_part stpart;
|
||||||
|
|
||||||
title = str_new();
|
title = str_new();
|
||||||
str_printf( &title, _("Enter %s (sub)string to search for "
|
str_printf( &title, _("Enter (sub)string or regexp to search for "
|
||||||
"(with or without \"%s\")"), CONFIG_, CONFIG_);
|
"(with or without \"%s\")"), CONFIG_);
|
||||||
|
|
||||||
again:
|
again:
|
||||||
dialog_clear();
|
dialog_clear();
|
||||||
|
@ -375,6 +419,11 @@ again:
|
||||||
if (strncasecmp(dialog_input_result, CONFIG_, strlen(CONFIG_)) == 0)
|
if (strncasecmp(dialog_input_result, CONFIG_, strlen(CONFIG_)) == 0)
|
||||||
dialog_input += strlen(CONFIG_);
|
dialog_input += strlen(CONFIG_);
|
||||||
|
|
||||||
|
sttext = str_new();
|
||||||
|
str_printf(&sttext, "Search (%s)", dialog_input_result);
|
||||||
|
stpart.text = str_get(&sttext);
|
||||||
|
list_add_tail(&stpart.entries, &trail);
|
||||||
|
|
||||||
sym_arr = sym_re_search(dialog_input);
|
sym_arr = sym_re_search(dialog_input);
|
||||||
do {
|
do {
|
||||||
LIST_HEAD(head);
|
LIST_HEAD(head);
|
||||||
|
@ -385,8 +434,10 @@ again:
|
||||||
.targets = targets,
|
.targets = targets,
|
||||||
.keys = keys,
|
.keys = keys,
|
||||||
};
|
};
|
||||||
|
struct jump_key *pos, *tmp;
|
||||||
|
|
||||||
res = get_relations_str(sym_arr, &head);
|
res = get_relations_str(sym_arr, &head);
|
||||||
|
set_subtitle();
|
||||||
dres = show_textbox_ext(_("Search Results"), (char *)
|
dres = show_textbox_ext(_("Search Results"), (char *)
|
||||||
str_get(&res), 0, 0, keys, &vscroll,
|
str_get(&res), 0, 0, keys, &vscroll,
|
||||||
&hscroll, &update_text, (void *)
|
&hscroll, &update_text, (void *)
|
||||||
|
@ -398,9 +449,13 @@ again:
|
||||||
again = true;
|
again = true;
|
||||||
}
|
}
|
||||||
str_free(&res);
|
str_free(&res);
|
||||||
|
list_for_each_entry_safe(pos, tmp, &head, entries)
|
||||||
|
free(pos);
|
||||||
} while (again);
|
} while (again);
|
||||||
free(sym_arr);
|
free(sym_arr);
|
||||||
str_free(&title);
|
str_free(&title);
|
||||||
|
list_del(trail.prev);
|
||||||
|
str_free(&sttext);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void build_conf(struct menu *menu)
|
static void build_conf(struct menu *menu)
|
||||||
|
@ -437,8 +492,9 @@ static void build_conf(struct menu *menu)
|
||||||
menu->data ? "-->" : "++>",
|
menu->data ? "-->" : "++>",
|
||||||
indent + 1, ' ', prompt);
|
indent + 1, ' ', prompt);
|
||||||
} else
|
} else
|
||||||
item_make(" %*c%s --->", indent + 1, ' ', prompt);
|
item_make(" %*c%s %s",
|
||||||
|
indent + 1, ' ', prompt,
|
||||||
|
menu_is_empty(menu) ? "----" : "--->");
|
||||||
item_set_tag('m');
|
item_set_tag('m');
|
||||||
item_set_data(menu);
|
item_set_data(menu);
|
||||||
if (single_menu_mode && menu->data)
|
if (single_menu_mode && menu->data)
|
||||||
|
@ -569,7 +625,7 @@ static void build_conf(struct menu *menu)
|
||||||
(sym_has_value(sym) || !sym_is_changable(sym)) ?
|
(sym_has_value(sym) || !sym_is_changable(sym)) ?
|
||||||
"" : _(" (NEW)"));
|
"" : _(" (NEW)"));
|
||||||
if (menu->prompt->type == P_MENU) {
|
if (menu->prompt->type == P_MENU) {
|
||||||
item_add_str(" --->");
|
item_add_str(" %s", menu_is_empty(menu) ? "----" : "--->");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -585,27 +641,36 @@ static void conf(struct menu *menu, struct menu *active_menu)
|
||||||
{
|
{
|
||||||
struct menu *submenu;
|
struct menu *submenu;
|
||||||
const char *prompt = menu_get_prompt(menu);
|
const char *prompt = menu_get_prompt(menu);
|
||||||
|
struct subtitle_part stpart;
|
||||||
struct symbol *sym;
|
struct symbol *sym;
|
||||||
int res;
|
int res;
|
||||||
int s_scroll = 0;
|
int s_scroll = 0;
|
||||||
|
|
||||||
|
if (menu != &rootmenu)
|
||||||
|
stpart.text = menu_get_prompt(menu);
|
||||||
|
else
|
||||||
|
stpart.text = NULL;
|
||||||
|
list_add_tail(&stpart.entries, &trail);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
item_reset();
|
item_reset();
|
||||||
current_menu = menu;
|
current_menu = menu;
|
||||||
build_conf(menu);
|
build_conf(menu);
|
||||||
if (!child_count)
|
if (!child_count)
|
||||||
break;
|
break;
|
||||||
|
set_subtitle();
|
||||||
dialog_clear();
|
dialog_clear();
|
||||||
res = dialog_menu(prompt ? _(prompt) : _("Main Menu"),
|
res = dialog_menu(prompt ? _(prompt) : _("Main Menu"),
|
||||||
_(menu_instructions),
|
_(menu_instructions),
|
||||||
active_menu, &s_scroll);
|
active_menu, &s_scroll);
|
||||||
if (res == 1 || res == KEY_ESC || res == -ERRDISPLAYTOOSMALL)
|
if (res == 1 || res == KEY_ESC || res == -ERRDISPLAYTOOSMALL)
|
||||||
break;
|
break;
|
||||||
|
if (item_count() != 0) {
|
||||||
if (!item_activate_selected())
|
if (!item_activate_selected())
|
||||||
continue;
|
continue;
|
||||||
if (!item_tag())
|
if (!item_tag())
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
submenu = item_data();
|
submenu = item_data();
|
||||||
active_menu = item_data();
|
active_menu = item_data();
|
||||||
if (submenu)
|
if (submenu)
|
||||||
|
@ -636,13 +701,17 @@ static void conf(struct menu *menu, struct menu *active_menu)
|
||||||
case 2:
|
case 2:
|
||||||
if (sym)
|
if (sym)
|
||||||
show_help(submenu);
|
show_help(submenu);
|
||||||
else
|
else {
|
||||||
|
reset_subtitle();
|
||||||
show_helptext(_("README"), _(mconf_readme));
|
show_helptext(_("README"), _(mconf_readme));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
|
reset_subtitle();
|
||||||
conf_save();
|
conf_save();
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
|
reset_subtitle();
|
||||||
conf_load();
|
conf_load();
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
|
@ -675,6 +744,8 @@ static void conf(struct menu *menu, struct menu *active_menu)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
list_del(trail.prev);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int show_textbox_ext(const char *title, char *text, int r, int c, int
|
static int show_textbox_ext(const char *title, char *text, int r, int c, int
|
||||||
|
@ -751,7 +822,9 @@ static void conf_choice(struct menu *menu)
|
||||||
dialog_clear();
|
dialog_clear();
|
||||||
res = dialog_checklist(prompt ? _(prompt) : _("Main Menu"),
|
res = dialog_checklist(prompt ? _(prompt) : _("Main Menu"),
|
||||||
_(radiolist_instructions),
|
_(radiolist_instructions),
|
||||||
15, 70, 6);
|
MENUBOX_HEIGTH_MIN,
|
||||||
|
MENUBOX_WIDTH_MIN,
|
||||||
|
CHECKLIST_HEIGTH_MIN);
|
||||||
selected = item_activate_selected();
|
selected = item_activate_selected();
|
||||||
switch (res) {
|
switch (res) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -887,11 +960,12 @@ static int handle_exit(void)
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
save_and_exit = 1;
|
save_and_exit = 1;
|
||||||
|
reset_subtitle();
|
||||||
dialog_clear();
|
dialog_clear();
|
||||||
if (conf_get_changed())
|
if (conf_get_changed())
|
||||||
res = dialog_yesno(NULL,
|
res = dialog_yesno(NULL,
|
||||||
_("Do you wish to save your new configuration ?\n"
|
_("Do you wish to save your new configuration?\n"
|
||||||
"<ESC><ESC> to continue."),
|
"(Press <ESC><ESC> to continue kernel configuration.)"),
|
||||||
6, 60);
|
6, 60);
|
||||||
else
|
else
|
||||||
res = -1;
|
res = -1;
|
||||||
|
@ -966,4 +1040,3 @@ int main(int ac, char **av)
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -119,7 +119,8 @@ void menu_set_type(int type)
|
||||||
sym->type = type;
|
sym->type = type;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
menu_warn(current_entry, "type of '%s' redefined from '%s' to '%s'",
|
menu_warn(current_entry,
|
||||||
|
"ignoring type redefinition of '%s' from '%s' to '%s'",
|
||||||
sym->name ? sym->name : "<choice>",
|
sym->name ? sym->name : "<choice>",
|
||||||
sym_type_name(sym->type), sym_type_name(type));
|
sym_type_name(sym->type), sym_type_name(type));
|
||||||
}
|
}
|
||||||
|
@ -146,11 +147,24 @@ struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *e
|
||||||
struct menu *menu = current_entry;
|
struct menu *menu = current_entry;
|
||||||
|
|
||||||
while ((menu = menu->parent) != NULL) {
|
while ((menu = menu->parent) != NULL) {
|
||||||
|
struct expr *dup_expr;
|
||||||
|
|
||||||
if (!menu->visibility)
|
if (!menu->visibility)
|
||||||
continue;
|
continue;
|
||||||
|
/*
|
||||||
|
* Do not add a reference to the
|
||||||
|
* menu's visibility expression but
|
||||||
|
* use a copy of it. Otherwise the
|
||||||
|
* expression reduction functions
|
||||||
|
* will modify expressions that have
|
||||||
|
* multiple references which can
|
||||||
|
* cause unwanted side effects.
|
||||||
|
*/
|
||||||
|
dup_expr = expr_copy(menu->visibility);
|
||||||
|
|
||||||
prop->visible.expr
|
prop->visible.expr
|
||||||
= expr_alloc_and(prop->visible.expr,
|
= expr_alloc_and(prop->visible.expr,
|
||||||
menu->visibility);
|
dup_expr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,12 +198,15 @@ void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep)
|
||||||
|
|
||||||
void menu_add_option(int token, char *arg)
|
void menu_add_option(int token, char *arg)
|
||||||
{
|
{
|
||||||
struct property *prop;
|
|
||||||
|
|
||||||
switch (token) {
|
switch (token) {
|
||||||
case T_OPT_MODULES:
|
case T_OPT_MODULES:
|
||||||
prop = prop_alloc(P_DEFAULT, modules_sym);
|
if (modules_sym)
|
||||||
prop->expr = expr_alloc_symbol(current_entry->sym);
|
zconf_error("symbol '%s' redefines option 'modules'"
|
||||||
|
" already defined by symbol '%s'",
|
||||||
|
current_entry->sym->name,
|
||||||
|
modules_sym->name
|
||||||
|
);
|
||||||
|
modules_sym = current_entry->sym;
|
||||||
break;
|
break;
|
||||||
case T_OPT_DEFCONFIG_LIST:
|
case T_OPT_DEFCONFIG_LIST:
|
||||||
if (!sym_defconfig_list)
|
if (!sym_defconfig_list)
|
||||||
|
@ -200,6 +217,9 @@ void menu_add_option(int token, char *arg)
|
||||||
case T_OPT_ENV:
|
case T_OPT_ENV:
|
||||||
prop_add_env(arg);
|
prop_add_env(arg);
|
||||||
break;
|
break;
|
||||||
|
case T_OPT_ALLNOCONFIG_Y:
|
||||||
|
current_entry->sym->flags |= SYMBOL_ALLNOCONFIG_Y;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -430,6 +450,22 @@ bool menu_has_prompt(struct menu *menu)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Determine if a menu is empty.
|
||||||
|
* A menu is considered empty if it contains no or only
|
||||||
|
* invisible entries.
|
||||||
|
*/
|
||||||
|
bool menu_is_empty(struct menu *menu)
|
||||||
|
{
|
||||||
|
struct menu *child;
|
||||||
|
|
||||||
|
for (child = menu->list; child; child = child->next) {
|
||||||
|
if (menu_is_visible(child))
|
||||||
|
return(false);
|
||||||
|
}
|
||||||
|
return(true);
|
||||||
|
}
|
||||||
|
|
||||||
bool menu_is_visible(struct menu *menu)
|
bool menu_is_visible(struct menu *menu)
|
||||||
{
|
{
|
||||||
struct menu *child;
|
struct menu *child;
|
||||||
|
@ -512,16 +548,9 @@ static void get_prompt_str(struct gstr *r, struct property *prop,
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
struct menu *submenu[8], *menu, *location = NULL;
|
struct menu *submenu[8], *menu, *location = NULL;
|
||||||
struct jump_key *jump;
|
struct jump_key *jump = NULL;
|
||||||
|
|
||||||
str_printf(r, _("Prompt: %s\n"), _(prop->text));
|
str_printf(r, _("Prompt: %s\n"), _(prop->text));
|
||||||
str_printf(r, _(" Defined at %s:%d\n"), prop->menu->file->name,
|
|
||||||
prop->menu->lineno);
|
|
||||||
if (!expr_is_yes(prop->visible.expr)) {
|
|
||||||
str_append(r, _(" Depends on: "));
|
|
||||||
expr_gstr_print(prop->visible.expr, r);
|
|
||||||
str_append(r, "\n");
|
|
||||||
}
|
|
||||||
menu = prop->menu->parent;
|
menu = prop->menu->parent;
|
||||||
for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent) {
|
for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent) {
|
||||||
bool accessible = menu_is_visible(menu);
|
bool accessible = menu_is_visible(menu);
|
||||||
|
@ -557,8 +586,8 @@ static void get_prompt_str(struct gstr *r, struct property *prop,
|
||||||
str_printf(r, _(" Location:\n"));
|
str_printf(r, _(" Location:\n"));
|
||||||
for (j = 4; --i >= 0; j += 2) {
|
for (j = 4; --i >= 0; j += 2) {
|
||||||
menu = submenu[i];
|
menu = submenu[i];
|
||||||
if (head && location && menu == location)
|
if (jump && menu == location)
|
||||||
jump->offset = r->len - 1;
|
jump->offset = strlen(r->s);
|
||||||
str_printf(r, "%*c-> %s", j, ' ',
|
str_printf(r, "%*c-> %s", j, ' ',
|
||||||
_(menu_get_prompt(menu)));
|
_(menu_get_prompt(menu)));
|
||||||
if (menu->sym) {
|
if (menu->sym) {
|
||||||
|
@ -571,6 +600,18 @@ static void get_prompt_str(struct gstr *r, struct property *prop,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* get property of type P_SYMBOL
|
||||||
|
*/
|
||||||
|
static struct property *get_symbol_prop(struct symbol *sym)
|
||||||
|
{
|
||||||
|
struct property *prop = NULL;
|
||||||
|
|
||||||
|
for_all_properties(sym, prop, P_SYMBOL)
|
||||||
|
break;
|
||||||
|
return prop;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* head is optional and may be NULL
|
* head is optional and may be NULL
|
||||||
*/
|
*/
|
||||||
|
@ -595,6 +636,18 @@ void get_symbol_str(struct gstr *r, struct symbol *sym,
|
||||||
}
|
}
|
||||||
for_all_prompts(sym, prop)
|
for_all_prompts(sym, prop)
|
||||||
get_prompt_str(r, prop, head);
|
get_prompt_str(r, prop, head);
|
||||||
|
|
||||||
|
prop = get_symbol_prop(sym);
|
||||||
|
if (prop) {
|
||||||
|
str_printf(r, _(" Defined at %s:%d\n"), prop->menu->file->name,
|
||||||
|
prop->menu->lineno);
|
||||||
|
if (!expr_is_yes(prop->visible.expr)) {
|
||||||
|
str_append(r, _(" Depends on: "));
|
||||||
|
expr_gstr_print(prop->visible.expr, r);
|
||||||
|
str_append(r, "\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
hit = false;
|
hit = false;
|
||||||
for_all_properties(sym, prop, P_SELECT) {
|
for_all_properties(sym, prop, P_SELECT) {
|
||||||
if (!hit) {
|
if (!hit) {
|
||||||
|
|
|
@ -136,7 +136,7 @@ static struct property *sym_get_range_prop(struct symbol *sym)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sym_get_range_val(struct symbol *sym, int base)
|
static long long sym_get_range_val(struct symbol *sym, int base)
|
||||||
{
|
{
|
||||||
sym_calc_value(sym);
|
sym_calc_value(sym);
|
||||||
switch (sym->type) {
|
switch (sym->type) {
|
||||||
|
@ -149,13 +149,14 @@ static int sym_get_range_val(struct symbol *sym, int base)
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return strtol(sym->curr.val, NULL, base);
|
return strtoll(sym->curr.val, NULL, base);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sym_validate_range(struct symbol *sym)
|
static void sym_validate_range(struct symbol *sym)
|
||||||
{
|
{
|
||||||
struct property *prop;
|
struct property *prop;
|
||||||
int base, val, val2;
|
int base;
|
||||||
|
long long val, val2;
|
||||||
char str[64];
|
char str[64];
|
||||||
|
|
||||||
switch (sym->type) {
|
switch (sym->type) {
|
||||||
|
@ -171,7 +172,7 @@ static void sym_validate_range(struct symbol *sym)
|
||||||
prop = sym_get_range_prop(sym);
|
prop = sym_get_range_prop(sym);
|
||||||
if (!prop)
|
if (!prop)
|
||||||
return;
|
return;
|
||||||
val = strtol(sym->curr.val, NULL, base);
|
val = strtoll(sym->curr.val, NULL, base);
|
||||||
val2 = sym_get_range_val(prop->expr->left.sym, base);
|
val2 = sym_get_range_val(prop->expr->left.sym, base);
|
||||||
if (val >= val2) {
|
if (val >= val2) {
|
||||||
val2 = sym_get_range_val(prop->expr->right.sym, base);
|
val2 = sym_get_range_val(prop->expr->right.sym, base);
|
||||||
|
@ -179,9 +180,9 @@ static void sym_validate_range(struct symbol *sym)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (sym->type == S_INT)
|
if (sym->type == S_INT)
|
||||||
sprintf(str, "%d", val2);
|
sprintf(str, "%lld", val2);
|
||||||
else
|
else
|
||||||
sprintf(str, "0x%x", val2);
|
sprintf(str, "0x%llx", val2);
|
||||||
sym->curr.val = strdup(str);
|
sym->curr.val = strdup(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -300,6 +301,14 @@ void sym_calc_value(struct symbol *sym)
|
||||||
|
|
||||||
if (sym->flags & SYMBOL_VALID)
|
if (sym->flags & SYMBOL_VALID)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (sym_is_choice_value(sym) &&
|
||||||
|
sym->flags & SYMBOL_NEED_SET_CHOICE_VALUES) {
|
||||||
|
sym->flags &= ~SYMBOL_NEED_SET_CHOICE_VALUES;
|
||||||
|
prop = sym_get_choice_prop(sym);
|
||||||
|
sym_calc_value(prop_get_symbol(prop));
|
||||||
|
}
|
||||||
|
|
||||||
sym->flags |= SYMBOL_VALID;
|
sym->flags |= SYMBOL_VALID;
|
||||||
|
|
||||||
oldval = sym->curr;
|
oldval = sym->curr;
|
||||||
|
@ -425,6 +434,9 @@ void sym_calc_value(struct symbol *sym)
|
||||||
|
|
||||||
if (sym->flags & SYMBOL_AUTO)
|
if (sym->flags & SYMBOL_AUTO)
|
||||||
sym->flags &= ~SYMBOL_WRITE;
|
sym->flags &= ~SYMBOL_WRITE;
|
||||||
|
|
||||||
|
if (sym->flags & SYMBOL_NEED_SET_CHOICE_VALUES)
|
||||||
|
set_all_choice_values(sym);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sym_clear_all_valid(void)
|
void sym_clear_all_valid(void)
|
||||||
|
@ -583,7 +595,7 @@ bool sym_string_valid(struct symbol *sym, const char *str)
|
||||||
bool sym_string_within_range(struct symbol *sym, const char *str)
|
bool sym_string_within_range(struct symbol *sym, const char *str)
|
||||||
{
|
{
|
||||||
struct property *prop;
|
struct property *prop;
|
||||||
int val;
|
long long val;
|
||||||
|
|
||||||
switch (sym->type) {
|
switch (sym->type) {
|
||||||
case S_STRING:
|
case S_STRING:
|
||||||
|
@ -594,7 +606,7 @@ bool sym_string_within_range(struct symbol *sym, const char *str)
|
||||||
prop = sym_get_range_prop(sym);
|
prop = sym_get_range_prop(sym);
|
||||||
if (!prop)
|
if (!prop)
|
||||||
return true;
|
return true;
|
||||||
val = strtol(str, NULL, 10);
|
val = strtoll(str, NULL, 10);
|
||||||
return val >= sym_get_range_val(prop->expr->left.sym, 10) &&
|
return val >= sym_get_range_val(prop->expr->left.sym, 10) &&
|
||||||
val <= sym_get_range_val(prop->expr->right.sym, 10);
|
val <= sym_get_range_val(prop->expr->right.sym, 10);
|
||||||
case S_HEX:
|
case S_HEX:
|
||||||
|
@ -603,7 +615,7 @@ bool sym_string_within_range(struct symbol *sym, const char *str)
|
||||||
prop = sym_get_range_prop(sym);
|
prop = sym_get_range_prop(sym);
|
||||||
if (!prop)
|
if (!prop)
|
||||||
return true;
|
return true;
|
||||||
val = strtol(str, NULL, 16);
|
val = strtoll(str, NULL, 16);
|
||||||
return val >= sym_get_range_val(prop->expr->left.sym, 16) &&
|
return val >= sym_get_range_val(prop->expr->left.sym, 16) &&
|
||||||
val <= sym_get_range_val(prop->expr->right.sym, 16);
|
val <= sym_get_range_val(prop->expr->right.sym, 16);
|
||||||
case S_BOOLEAN:
|
case S_BOOLEAN:
|
||||||
|
@ -943,38 +955,89 @@ const char *sym_escape_string_value(const char *in)
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct sym_match {
|
||||||
|
struct symbol *sym;
|
||||||
|
off_t so, eo;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Compare matched symbols as thus:
|
||||||
|
* - first, symbols that match exactly
|
||||||
|
* - then, alphabetical sort
|
||||||
|
*/
|
||||||
|
static int sym_rel_comp(const void *sym1, const void *sym2)
|
||||||
|
{
|
||||||
|
const struct sym_match *s1 = sym1;
|
||||||
|
const struct sym_match *s2 = sym2;
|
||||||
|
int exact1, exact2;
|
||||||
|
|
||||||
|
/* Exact match:
|
||||||
|
* - if matched length on symbol s1 is the length of that symbol,
|
||||||
|
* then this symbol should come first;
|
||||||
|
* - if matched length on symbol s2 is the length of that symbol,
|
||||||
|
* then this symbol should come first.
|
||||||
|
* Note: since the search can be a regexp, both symbols may match
|
||||||
|
* exactly; if this is the case, we can't decide which comes first,
|
||||||
|
* and we fallback to sorting alphabetically.
|
||||||
|
*/
|
||||||
|
exact1 = (s1->eo - s1->so) == strlen(s1->sym->name);
|
||||||
|
exact2 = (s2->eo - s2->so) == strlen(s2->sym->name);
|
||||||
|
if (exact1 && !exact2)
|
||||||
|
return -1;
|
||||||
|
if (!exact1 && exact2)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
/* As a fallback, sort symbols alphabetically */
|
||||||
|
return strcmp(s1->sym->name, s2->sym->name);
|
||||||
|
}
|
||||||
|
|
||||||
struct symbol **sym_re_search(const char *pattern)
|
struct symbol **sym_re_search(const char *pattern)
|
||||||
{
|
{
|
||||||
struct symbol *sym, **sym_arr = NULL;
|
struct symbol *sym, **sym_arr = NULL;
|
||||||
|
struct sym_match *sym_match_arr = NULL;
|
||||||
int i, cnt, size;
|
int i, cnt, size;
|
||||||
regex_t re;
|
regex_t re;
|
||||||
|
regmatch_t match[1];
|
||||||
|
|
||||||
cnt = size = 0;
|
cnt = size = 0;
|
||||||
/* Skip if empty */
|
/* Skip if empty */
|
||||||
if (strlen(pattern) == 0)
|
if (strlen(pattern) == 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (regcomp(&re, pattern, REG_EXTENDED|REG_NOSUB|REG_ICASE))
|
if (regcomp(&re, pattern, REG_EXTENDED|REG_ICASE))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
for_all_symbols(i, sym) {
|
for_all_symbols(i, sym) {
|
||||||
if (sym->flags & SYMBOL_CONST || !sym->name)
|
if (sym->flags & SYMBOL_CONST || !sym->name)
|
||||||
continue;
|
continue;
|
||||||
if (regexec(&re, sym->name, 0, NULL, 0))
|
if (regexec(&re, sym->name, 1, match, 0))
|
||||||
continue;
|
continue;
|
||||||
if (cnt + 1 >= size) {
|
if (cnt >= size) {
|
||||||
void *tmp = sym_arr;
|
void *tmp;
|
||||||
size += 16;
|
size += 16;
|
||||||
sym_arr = realloc(sym_arr, size * sizeof(struct symbol *));
|
tmp = realloc(sym_match_arr, size * sizeof(struct sym_match));
|
||||||
if (!sym_arr) {
|
if (!tmp)
|
||||||
free(tmp);
|
goto sym_re_search_free;
|
||||||
return NULL;
|
sym_match_arr = tmp;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
sym_calc_value(sym);
|
sym_calc_value(sym);
|
||||||
sym_arr[cnt++] = sym;
|
/* As regexec returned 0, we know we have a match, so
|
||||||
|
* we can use match[0].rm_[se]o without further checks
|
||||||
|
*/
|
||||||
|
sym_match_arr[cnt].so = match[0].rm_so;
|
||||||
|
sym_match_arr[cnt].eo = match[0].rm_eo;
|
||||||
|
sym_match_arr[cnt++].sym = sym;
|
||||||
}
|
}
|
||||||
if (sym_arr)
|
if (sym_match_arr) {
|
||||||
|
qsort(sym_match_arr, cnt, sizeof(struct sym_match), sym_rel_comp);
|
||||||
|
sym_arr = malloc((cnt+1) * sizeof(struct symbol));
|
||||||
|
if (!sym_arr)
|
||||||
|
goto sym_re_search_free;
|
||||||
|
for (i = 0; i < cnt; i++)
|
||||||
|
sym_arr[i] = sym_match_arr[i].sym;
|
||||||
sym_arr[cnt] = NULL;
|
sym_arr[cnt] = NULL;
|
||||||
|
}
|
||||||
|
sym_re_search_free:
|
||||||
|
/* sym_match_arr can be NULL if no match, but free(NULL) is OK */
|
||||||
|
free(sym_match_arr);
|
||||||
regfree(&re);
|
regfree(&re);
|
||||||
|
|
||||||
return sym_arr;
|
return sym_arr;
|
||||||
|
@ -984,7 +1047,7 @@ struct symbol **sym_re_search(const char *pattern)
|
||||||
* When we check for recursive dependencies we use a stack to save
|
* When we check for recursive dependencies we use a stack to save
|
||||||
* current state so we can print out relevant info to user.
|
* current state so we can print out relevant info to user.
|
||||||
* The entries are located on the call stack so no need to free memory.
|
* The entries are located on the call stack so no need to free memory.
|
||||||
* Note inser() remove() must always match to properly clear the stack.
|
* Note insert() remove() must always match to properly clear the stack.
|
||||||
*/
|
*/
|
||||||
static struct dep_stack {
|
static struct dep_stack {
|
||||||
struct dep_stack *prev, *next;
|
struct dep_stack *prev, *next;
|
||||||
|
|
|
@ -155,5 +155,3 @@ void *xcalloc(size_t nmemb, size_t size)
|
||||||
fprintf(stderr, "Out of memory.\n");
|
fprintf(stderr, "Out of memory.\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -43,5 +43,6 @@ on, T_ON, TF_PARAM
|
||||||
modules, T_OPT_MODULES, TF_OPTION
|
modules, T_OPT_MODULES, TF_OPTION
|
||||||
defconfig_list, T_OPT_DEFCONFIG_LIST,TF_OPTION
|
defconfig_list, T_OPT_DEFCONFIG_LIST,TF_OPTION
|
||||||
env, T_OPT_ENV, TF_OPTION
|
env, T_OPT_ENV, TF_OPTION
|
||||||
|
allnoconfig_y, T_OPT_ALLNOCONFIG_Y,TF_OPTION
|
||||||
reset, T_RESET, TF_COMMAND
|
reset, T_RESET, TF_COMMAND
|
||||||
%%
|
%%
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* ANSI-C code produced by gperf version 3.0.4 */
|
/* ANSI-C code produced by gperf version 3.0.3 */
|
||||||
/* Command-line: gperf */
|
/* Command-line: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/gperf */
|
||||||
/* Computed positions: -k'1,3' */
|
/* Computed positions: -k'1,3' */
|
||||||
|
|
||||||
#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
|
#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
|
||||||
|
@ -32,10 +32,12 @@
|
||||||
struct kconf_id;
|
struct kconf_id;
|
||||||
/* maximum key range = 47, duplicates = 0 */
|
/* maximum key range = 47, duplicates = 0 */
|
||||||
|
|
||||||
#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__cplusplus) || defined(__GNUC_STDC_INLINE__)
|
#ifdef __GNUC__
|
||||||
inline
|
|
||||||
#elif defined(__GNUC__)
|
|
||||||
__inline
|
__inline
|
||||||
|
#else
|
||||||
|
#ifdef __cplusplus
|
||||||
|
inline
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
static unsigned int
|
static unsigned int
|
||||||
kconf_id_hash (register const char *str, register unsigned int len)
|
kconf_id_hash (register const char *str, register unsigned int len)
|
||||||
|
@ -51,7 +53,7 @@ kconf_id_hash (register const char *str, register unsigned int len)
|
||||||
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, 40, 5,
|
49, 49, 49, 49, 49, 49, 49, 20, 40, 5,
|
||||||
0, 0, 5, 49, 5, 20, 49, 49, 5, 20,
|
0, 0, 5, 49, 5, 20, 49, 49, 5, 20,
|
||||||
5, 0, 35, 49, 0, 15, 0, 10, 15, 49,
|
5, 0, 35, 49, 0, 15, 0, 10, 15, 49,
|
||||||
25, 49, 49, 49, 49, 49, 49, 49, 49, 49,
|
25, 49, 49, 49, 49, 49, 49, 49, 49, 49,
|
||||||
|
@ -69,7 +71,7 @@ kconf_id_hash (register const char *str, register unsigned int len)
|
||||||
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
|
||||||
};
|
};
|
||||||
register int hval = len;
|
register unsigned int hval = len;
|
||||||
|
|
||||||
switch (hval)
|
switch (hval)
|
||||||
{
|
{
|
||||||
|
@ -114,6 +116,7 @@ struct kconf_id_strings_t
|
||||||
char kconf_id_strings_str33[sizeof("hex")];
|
char kconf_id_strings_str33[sizeof("hex")];
|
||||||
char kconf_id_strings_str35[sizeof("menuconfig")];
|
char kconf_id_strings_str35[sizeof("menuconfig")];
|
||||||
char kconf_id_strings_str37[sizeof("visible")];
|
char kconf_id_strings_str37[sizeof("visible")];
|
||||||
|
char kconf_id_strings_str38[sizeof("allnoconfig_y")];
|
||||||
char kconf_id_strings_str41[sizeof("prompt")];
|
char kconf_id_strings_str41[sizeof("prompt")];
|
||||||
char kconf_id_strings_str42[sizeof("depends")];
|
char kconf_id_strings_str42[sizeof("depends")];
|
||||||
char kconf_id_strings_str44[sizeof("bool")];
|
char kconf_id_strings_str44[sizeof("bool")];
|
||||||
|
@ -150,6 +153,7 @@ static struct kconf_id_strings_t kconf_id_strings_contents =
|
||||||
"hex",
|
"hex",
|
||||||
"menuconfig",
|
"menuconfig",
|
||||||
"visible",
|
"visible",
|
||||||
|
"allnoconfig_y",
|
||||||
"prompt",
|
"prompt",
|
||||||
"depends",
|
"depends",
|
||||||
"bool",
|
"bool",
|
||||||
|
@ -157,18 +161,12 @@ static struct kconf_id_strings_t kconf_id_strings_contents =
|
||||||
"mainmenu"
|
"mainmenu"
|
||||||
};
|
};
|
||||||
#define kconf_id_strings ((const char *) &kconf_id_strings_contents)
|
#define kconf_id_strings ((const char *) &kconf_id_strings_contents)
|
||||||
#ifdef __GNUC__
|
|
||||||
__inline
|
|
||||||
#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
|
|
||||||
__attribute__ ((__gnu_inline__))
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
struct kconf_id *
|
struct kconf_id *
|
||||||
kconf_id_lookup (register const char *str, register unsigned int len)
|
kconf_id_lookup (register const char *str, register unsigned int len)
|
||||||
{
|
{
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
TOTAL_KEYWORDS = 33,
|
TOTAL_KEYWORDS = 34,
|
||||||
MIN_WORD_LENGTH = 2,
|
MIN_WORD_LENGTH = 2,
|
||||||
MAX_WORD_LENGTH = 14,
|
MAX_WORD_LENGTH = 14,
|
||||||
MIN_HASH_VALUE = 2,
|
MIN_HASH_VALUE = 2,
|
||||||
|
@ -178,55 +176,56 @@ kconf_id_lookup (register const char *str, register unsigned int len)
|
||||||
static struct kconf_id wordlist[] =
|
static struct kconf_id wordlist[] =
|
||||||
{
|
{
|
||||||
{-1}, {-1},
|
{-1}, {-1},
|
||||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str2, T_ON, TF_PARAM},
|
{offsetof(struct kconf_id_strings_t, kconf_id_strings_str2), T_ON, TF_PARAM},
|
||||||
{-1}, {-1},
|
{-1}, {-1},
|
||||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str5, T_ENDIF, TF_COMMAND},
|
{offsetof(struct kconf_id_strings_t, kconf_id_strings_str5), T_ENDIF, TF_COMMAND},
|
||||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str6, T_OPTION, TF_COMMAND},
|
{offsetof(struct kconf_id_strings_t, kconf_id_strings_str6), T_OPTION, TF_COMMAND},
|
||||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str7, T_ENDMENU, TF_COMMAND},
|
{offsetof(struct kconf_id_strings_t, kconf_id_strings_str7), T_ENDMENU, TF_COMMAND},
|
||||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str8, T_OPTIONAL, TF_COMMAND},
|
{offsetof(struct kconf_id_strings_t, kconf_id_strings_str8), T_OPTIONAL, TF_COMMAND},
|
||||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str9, T_ENDCHOICE, TF_COMMAND},
|
{offsetof(struct kconf_id_strings_t, kconf_id_strings_str9), T_ENDCHOICE, TF_COMMAND},
|
||||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str10, T_RANGE, TF_COMMAND},
|
{offsetof(struct kconf_id_strings_t, kconf_id_strings_str10), T_RANGE, TF_COMMAND},
|
||||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str11, T_CHOICE, TF_COMMAND},
|
{offsetof(struct kconf_id_strings_t, kconf_id_strings_str11), T_CHOICE, TF_COMMAND},
|
||||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str12, T_DEFAULT, TF_COMMAND, S_UNKNOWN},
|
{offsetof(struct kconf_id_strings_t, 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},
|
{offsetof(struct kconf_id_strings_t, 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},
|
{offsetof(struct kconf_id_strings_t, kconf_id_strings_str14), T_HELP, TF_COMMAND},
|
||||||
{-1},
|
{-1},
|
||||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str16, T_CONFIG, TF_COMMAND},
|
{offsetof(struct kconf_id_strings_t, 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},
|
{offsetof(struct kconf_id_strings_t, kconf_id_strings_str17), T_DEFAULT, TF_COMMAND, S_TRISTATE},
|
||||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str18, T_OPT_ENV, TF_OPTION},
|
{offsetof(struct kconf_id_strings_t, kconf_id_strings_str18), T_OPT_ENV, TF_OPTION},
|
||||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str19, T_OPT_DEFCONFIG_LIST,TF_OPTION},
|
{offsetof(struct kconf_id_strings_t, kconf_id_strings_str19), T_OPT_DEFCONFIG_LIST,TF_OPTION},
|
||||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str20, T_RESET, TF_COMMAND},
|
{offsetof(struct kconf_id_strings_t, kconf_id_strings_str20), T_RESET, TF_COMMAND},
|
||||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str21, T_TYPE, TF_COMMAND, S_STRING},
|
{offsetof(struct kconf_id_strings_t, kconf_id_strings_str21), T_TYPE, TF_COMMAND, S_STRING},
|
||||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str22, T_IF, TF_COMMAND|TF_PARAM},
|
{offsetof(struct kconf_id_strings_t, 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},
|
{offsetof(struct kconf_id_strings_t, kconf_id_strings_str23), T_TYPE, TF_COMMAND, S_INT},
|
||||||
{-1}, {-1},
|
{-1}, {-1},
|
||||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str26, T_SELECT, TF_COMMAND},
|
{offsetof(struct kconf_id_strings_t, kconf_id_strings_str26), T_SELECT, TF_COMMAND},
|
||||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str27, T_OPT_MODULES, TF_OPTION},
|
{offsetof(struct kconf_id_strings_t, 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},
|
{offsetof(struct kconf_id_strings_t, 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},
|
{offsetof(struct kconf_id_strings_t, kconf_id_strings_str29), T_MENU, TF_COMMAND},
|
||||||
{-1},
|
{-1},
|
||||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str31, T_SOURCE, TF_COMMAND},
|
{offsetof(struct kconf_id_strings_t, kconf_id_strings_str31), T_SOURCE, TF_COMMAND},
|
||||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str32, T_COMMENT, TF_COMMAND},
|
{offsetof(struct kconf_id_strings_t, 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},
|
{offsetof(struct kconf_id_strings_t, kconf_id_strings_str33), T_TYPE, TF_COMMAND, S_HEX},
|
||||||
{-1},
|
{-1},
|
||||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str35, T_MENUCONFIG, TF_COMMAND},
|
{offsetof(struct kconf_id_strings_t, kconf_id_strings_str35), T_MENUCONFIG, TF_COMMAND},
|
||||||
{-1},
|
{-1},
|
||||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str37, T_VISIBLE, TF_COMMAND},
|
{offsetof(struct kconf_id_strings_t, kconf_id_strings_str37), T_VISIBLE, TF_COMMAND},
|
||||||
{-1}, {-1}, {-1},
|
{offsetof(struct kconf_id_strings_t, kconf_id_strings_str38), T_OPT_ALLNOCONFIG_Y,TF_OPTION},
|
||||||
{(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_str44, T_TYPE, TF_COMMAND, S_BOOLEAN},
|
|
||||||
{-1}, {-1},
|
{-1}, {-1},
|
||||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str47, T_TYPE, TF_COMMAND, S_BOOLEAN},
|
{offsetof(struct kconf_id_strings_t, kconf_id_strings_str41), T_PROMPT, TF_COMMAND},
|
||||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str48, T_MAINMENU, TF_COMMAND}
|
{offsetof(struct kconf_id_strings_t, kconf_id_strings_str42), T_DEPENDS, TF_COMMAND},
|
||||||
|
{-1},
|
||||||
|
{offsetof(struct kconf_id_strings_t, kconf_id_strings_str44), T_TYPE, TF_COMMAND, S_BOOLEAN},
|
||||||
|
{-1}, {-1},
|
||||||
|
{offsetof(struct kconf_id_strings_t, kconf_id_strings_str47), T_TYPE, TF_COMMAND, S_BOOLEAN},
|
||||||
|
{offsetof(struct kconf_id_strings_t, kconf_id_strings_str48), T_MAINMENU, TF_COMMAND}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
|
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
|
||||||
{
|
{
|
||||||
register int key = kconf_id_hash (str, len);
|
unsigned int key = kconf_id_hash (str, len);
|
||||||
|
|
||||||
if (key <= MAX_HASH_VALUE && key >= 0)
|
if (key <= MAX_HASH_VALUE)
|
||||||
{
|
{
|
||||||
register int o = wordlist[key].name;
|
register int o = wordlist[key].name;
|
||||||
if (o >= 0)
|
if (o >= 0)
|
||||||
|
|
|
@ -70,7 +70,6 @@ static void alloc_string(const char *str, int size)
|
||||||
}
|
}
|
||||||
%}
|
%}
|
||||||
|
|
||||||
ws [ \n\t]
|
|
||||||
n [A-Za-z0-9_]
|
n [A-Za-z0-9_]
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
|
|
@ -2311,9 +2311,6 @@ void conf_parse(const char *name)
|
||||||
|
|
||||||
sym_init();
|
sym_init();
|
||||||
_menu_init();
|
_menu_init();
|
||||||
modules_sym = sym_lookup(NULL, 0);
|
|
||||||
modules_sym->type = S_BOOLEAN;
|
|
||||||
modules_sym->flags |= SYMBOL_AUTO;
|
|
||||||
rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL);
|
rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL);
|
||||||
|
|
||||||
#if YYDEBUG
|
#if YYDEBUG
|
||||||
|
@ -2323,12 +2320,8 @@ void conf_parse(const char *name)
|
||||||
zconfparse();
|
zconfparse();
|
||||||
if (zconfnerrs)
|
if (zconfnerrs)
|
||||||
exit(1);
|
exit(1);
|
||||||
if (!modules_sym->prop) {
|
if (!modules_sym)
|
||||||
struct property *prop;
|
modules_sym = sym_find( "n" );
|
||||||
|
|
||||||
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 = _(rootmenu.prompt->text);
|
||||||
rootmenu.prompt->text = sym_expand_string_value(rootmenu.prompt->text);
|
rootmenu.prompt->text = sym_expand_string_value(rootmenu.prompt->text);
|
||||||
|
|
|
@ -503,9 +503,6 @@ void conf_parse(const char *name)
|
||||||
|
|
||||||
sym_init();
|
sym_init();
|
||||||
_menu_init();
|
_menu_init();
|
||||||
modules_sym = sym_lookup(NULL, 0);
|
|
||||||
modules_sym->type = S_BOOLEAN;
|
|
||||||
modules_sym->flags |= SYMBOL_AUTO;
|
|
||||||
rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL);
|
rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL);
|
||||||
|
|
||||||
#if YYDEBUG
|
#if YYDEBUG
|
||||||
|
@ -515,12 +512,8 @@ void conf_parse(const char *name)
|
||||||
zconfparse();
|
zconfparse();
|
||||||
if (zconfnerrs)
|
if (zconfnerrs)
|
||||||
exit(1);
|
exit(1);
|
||||||
if (!modules_sym->prop) {
|
if (!modules_sym)
|
||||||
struct property *prop;
|
modules_sym = sym_find( "n" );
|
||||||
|
|
||||||
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 = _(rootmenu.prompt->text);
|
||||||
rootmenu.prompt->text = sym_expand_string_value(rootmenu.prompt->text);
|
rootmenu.prompt->text = sym_expand_string_value(rootmenu.prompt->text);
|
||||||
|
|
Loading…
Reference in a new issue