mirror of
https://github.com/motioneye-project/motioneyeos.git
synced 2025-07-27 05:06:39 +00:00
support/kconfig: bump to kconfig from linux-3.12
With this, we can trash our probability patch, it's now upstream. Refresh a few other patches. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
This commit is contained in:
parent
147be50283
commit
b48e35a28a
@ -219,7 +219,9 @@ HOSTCFLAGS_gconf.o = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \
|
|||||||
|
|
||||||
HOSTLOADLIBES_mconf = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))
|
HOSTLOADLIBES_mconf = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))
|
||||||
|
|
||||||
HOSTLOADLIBES_nconf = -lmenu -lpanel -lncurses
|
HOSTLOADLIBES_nconf = $(shell \
|
||||||
|
pkg-config --libs menu panel ncurses 2>/dev/null \
|
||||||
|
|| echo "-lmenu -lpanel -lncurses" )
|
||||||
$(obj)/qconf.o: $(obj)/.tmp_qtcheck
|
$(obj)/qconf.o: $(obj)/.tmp_qtcheck
|
||||||
|
|
||||||
ifeq ($(qconf-target),1)
|
ifeq ($(qconf-target),1)
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
@ -642,7 +653,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);
|
||||||
|
@ -139,7 +139,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 != '"') {
|
||||||
@ -160,6 +162,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;
|
||||||
}
|
}
|
||||||
@ -171,7 +174,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;
|
||||||
@ -1073,7 +1078,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;
|
||||||
@ -1086,7 +1091,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);
|
||||||
|
|
||||||
@ -1110,13 +1115,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;
|
||||||
@ -1133,29 +1143,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, prob = 50;
|
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) {
|
if (mode == def_random) {
|
||||||
char *endp, *env = getenv("KCONFIG_PROBABILITY");
|
int n, p[3];
|
||||||
if (env && *env) {
|
char *env = getenv("KCONFIG_PROBABILITY");
|
||||||
int tmp = (int)strtol(env, &endp, 10);
|
n = 0;
|
||||||
if (*endp == '\0' && tmp >= 0 && tmp <= 100)
|
while( env && *env ) {
|
||||||
prob = tmp;
|
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;
|
||||||
@ -1167,14 +1214,14 @@ void conf_set_all_new_symbols(enum conf_def_mode mode)
|
|||||||
sym->def[S_DEF_USER].tri = no;
|
sym->def[S_DEF_USER].tri = no;
|
||||||
break;
|
break;
|
||||||
case def_random:
|
case def_random:
|
||||||
cnt = (rand() % 100) - (100 - prob);
|
|
||||||
if (cnt < 0)
|
|
||||||
sym->def[S_DEF_USER].tri = no;
|
sym->def[S_DEF_USER].tri = no;
|
||||||
else
|
cnt = rand() % 100;
|
||||||
if ((sym_get_type(sym) == S_TRISTATE)
|
if (sym->type == S_TRISTATE) {
|
||||||
&& (cnt > prob/2))
|
if (cnt < pty)
|
||||||
|
sym->def[S_DEF_USER].tri = yes;
|
||||||
|
else if (cnt < (pty+ptm))
|
||||||
sym->def[S_DEF_USER].tri = mod;
|
sym->def[S_DEF_USER].tri = mod;
|
||||||
else
|
} else if (cnt < pby)
|
||||||
sym->def[S_DEF_USER].tri = yes;
|
sym->def[S_DEF_USER].tri = yes;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -1200,14 +1247,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;
|
||||||
}
|
}
|
||||||
|
@ -106,6 +106,9 @@ 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
|
||||||
|
|
||||||
#define SYMBOL_MAXLENGTH 256
|
#define SYMBOL_MAXLENGTH 256
|
||||||
#define SYMBOL_HASHSIZE 9973
|
#define SYMBOL_HASHSIZE 9973
|
||||||
|
|
||||||
|
@ -50,6 +50,19 @@ struct list_head {
|
|||||||
&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_struct 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
|
||||||
|
@ -86,7 +86,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 *);
|
||||||
|
@ -14,6 +14,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 /
|
||||||
@ -20,12 +22,12 @@ ldflags()
|
|||||||
ccflags()
|
ccflags()
|
||||||
{
|
{
|
||||||
if [ -f /usr/include/ncursesw/curses.h ]; then
|
if [ -f /usr/include/ncursesw/curses.h ]; then
|
||||||
echo '-I/usr/include/ncursesw -DCURSES_LOC="<ncursesw/curses.h>"'
|
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;
|
||||||
@ -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);
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ static const char mconf_readme[] = 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\n"
|
||||||
" you wish to change or submenu wish to select and press <Enter>.\n"
|
" you wish to change or submenu 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"
|
||||||
@ -176,7 +176,7 @@ static const char mconf_readme[] = 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> selectes a feature, while <N> will exclude a feature. "
|
"Pressing <Y> selectes a feature, while <N> will exclude a feature. "
|
||||||
"Press <Esc><Esc> to exit, <?> for Help, </> for Search. "
|
"Press <Esc><Esc> to exit, <?> for Help, </> for Search. "
|
||||||
@ -311,6 +311,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(sizeof(*pos), 1);
|
||||||
|
pos = pos->next;
|
||||||
|
} else {
|
||||||
|
subtitles = pos = xcalloc(sizeof(*pos), 1);
|
||||||
|
}
|
||||||
|
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;
|
||||||
@ -353,10 +397,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();
|
||||||
@ -379,6 +425,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);
|
||||||
@ -389,8 +440,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 *)
|
||||||
@ -402,9 +455,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)
|
||||||
@ -441,8 +498,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)
|
||||||
@ -573,7 +631,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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -589,27 +647,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)
|
||||||
@ -640,13 +707,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:
|
||||||
@ -679,6 +750,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
|
||||||
@ -754,7 +827,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:
|
||||||
@ -881,11 +956,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;
|
||||||
|
@ -146,11 +146,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 +197,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)
|
||||||
@ -430,6 +446,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;
|
||||||
@ -515,13 +547,6 @@ static void get_prompt_str(struct gstr *r, struct property *prop,
|
|||||||
struct jump_key *jump;
|
struct jump_key *jump;
|
||||||
|
|
||||||
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);
|
||||||
@ -571,6 +596,18 @@ static void get_prompt_str(struct gstr *r, struct property *prop,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* get peoperty 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 +632,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) {
|
||||||
|
@ -120,10 +120,18 @@ if [ "$MAKE" = "false" ]; then
|
|||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# If we have an output dir, setup the O= argument, otherwise leave
|
||||||
|
# it blank, since O=. will create an unnecessary ./source softlink
|
||||||
|
OUTPUT_ARG=""
|
||||||
|
if [ "$OUTPUT" != "." ] ; then
|
||||||
|
OUTPUT_ARG="O=$OUTPUT"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Use the merged file as the starting point for:
|
# Use the merged file as the starting point for:
|
||||||
# alldefconfig: Fills in any missing symbols with Kconfig default
|
# alldefconfig: Fills in any missing symbols with Kconfig default
|
||||||
# allnoconfig: Fills in any missing symbols with # CONFIG_* is not set
|
# allnoconfig: Fills in any missing symbols with # CONFIG_* is not set
|
||||||
make KCONFIG_ALLCONFIG=$TMP_FILE O=$OUTPUT $ALLTARGET
|
make KCONFIG_ALLCONFIG=$TMP_FILE $OUTPUT_ARG $ALLTARGET
|
||||||
|
|
||||||
|
|
||||||
# Check all specified config values took (might have missed-dependency issues)
|
# Check all specified config values took (might have missed-dependency issues)
|
||||||
|
@ -45,8 +45,8 @@ static const char nconf_global_help[] = N_(
|
|||||||
"<n> to remove it. You may press the <Space> key to cycle through the\n"
|
"<n> to remove it. You may press the <Space> key to cycle through the\n"
|
||||||
"available options.\n"
|
"available options.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"A trailing \"--->\" designates a submenu.\n"
|
"A trailing \"--->\" designates a submenu, a trailing \"----\" an\n"
|
||||||
"\n"
|
"empty submenu.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Menu navigation keys\n"
|
"Menu navigation keys\n"
|
||||||
"----------------------------------------------------------------------\n"
|
"----------------------------------------------------------------------\n"
|
||||||
@ -131,7 +131,7 @@ static const char nconf_global_help[] = N_(
|
|||||||
"\n"),
|
"\n"),
|
||||||
menu_no_f_instructions[] = N_(
|
menu_no_f_instructions[] = N_(
|
||||||
"Legend: [*] built-in [ ] excluded <M> module < > module capable.\n"
|
"Legend: [*] built-in [ ] excluded <M> module < > module capable.\n"
|
||||||
"Submenus are designated by a trailing \"--->\".\n"
|
"Submenus are designated by a trailing \"--->\", empty ones by \"----\".\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Use the following keys to navigate the menus:\n"
|
"Use the following keys to navigate the menus:\n"
|
||||||
"Move up or down with <Up> and <Down>.\n"
|
"Move up or down with <Up> and <Down>.\n"
|
||||||
@ -148,7 +148,7 @@ menu_no_f_instructions[] = N_(
|
|||||||
"For help related to the current menu entry press <?> or <h>.\n"),
|
"For help related to the current menu entry press <?> or <h>.\n"),
|
||||||
menu_instructions[] = N_(
|
menu_instructions[] = N_(
|
||||||
"Legend: [*] built-in [ ] excluded <M> module < > module capable.\n"
|
"Legend: [*] built-in [ ] excluded <M> module < > module capable.\n"
|
||||||
"Submenus are designated by a trailing \"--->\".\n"
|
"Submenus are designated by a trailing \"--->\", empty ones by \"----\".\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Use the following keys to navigate the menus:\n"
|
"Use the following keys to navigate the menus:\n"
|
||||||
"Move up or down with <Up> or <Down>.\n"
|
"Move up or down with <Up> or <Down>.\n"
|
||||||
@ -365,15 +365,16 @@ static void print_function_line(void)
|
|||||||
int i;
|
int i;
|
||||||
int offset = 1;
|
int offset = 1;
|
||||||
const int skip = 1;
|
const int skip = 1;
|
||||||
|
int lines = getmaxy(stdscr);
|
||||||
|
|
||||||
for (i = 0; i < function_keys_num; i++) {
|
for (i = 0; i < function_keys_num; i++) {
|
||||||
(void) wattrset(main_window, attributes[FUNCTION_HIGHLIGHT]);
|
(void) wattrset(main_window, attributes[FUNCTION_HIGHLIGHT]);
|
||||||
mvwprintw(main_window, LINES-3, offset,
|
mvwprintw(main_window, lines-3, offset,
|
||||||
"%s",
|
"%s",
|
||||||
function_keys[i].key_str);
|
function_keys[i].key_str);
|
||||||
(void) wattrset(main_window, attributes[FUNCTION_TEXT]);
|
(void) wattrset(main_window, attributes[FUNCTION_TEXT]);
|
||||||
offset += strlen(function_keys[i].key_str);
|
offset += strlen(function_keys[i].key_str);
|
||||||
mvwprintw(main_window, LINES-3,
|
mvwprintw(main_window, lines-3,
|
||||||
offset, "%s",
|
offset, "%s",
|
||||||
function_keys[i].func);
|
function_keys[i].func);
|
||||||
offset += strlen(function_keys[i].func) + skip;
|
offset += strlen(function_keys[i].func) + skip;
|
||||||
@ -694,8 +695,8 @@ static void search_conf(void)
|
|||||||
int dres;
|
int dres;
|
||||||
|
|
||||||
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:
|
||||||
dres = dialog_inputbox(main_window,
|
dres = dialog_inputbox(main_window,
|
||||||
@ -759,9 +760,9 @@ static void build_conf(struct menu *menu)
|
|||||||
indent + 1, ' ', prompt);
|
indent + 1, ' ', prompt);
|
||||||
} else
|
} else
|
||||||
item_make(menu, 'm',
|
item_make(menu, 'm',
|
||||||
" %*c%s --->",
|
" %*c%s %s",
|
||||||
indent + 1,
|
indent + 1, ' ', prompt,
|
||||||
' ', prompt);
|
menu_is_empty(menu) ? "----" : "--->");
|
||||||
|
|
||||||
if (single_menu_mode && menu->data)
|
if (single_menu_mode && menu->data)
|
||||||
goto conf_childs;
|
goto conf_childs;
|
||||||
@ -903,7 +904,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 && menu->prompt->type == P_MENU) {
|
if (menu->prompt && menu->prompt->type == P_MENU) {
|
||||||
item_add_str(" --->");
|
item_add_str(" %s", menu_is_empty(menu) ? "----" : "--->");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -954,7 +955,7 @@ static void show_menu(const char *prompt, const char *instructions,
|
|||||||
|
|
||||||
clear();
|
clear();
|
||||||
(void) wattrset(main_window, attributes[NORMAL]);
|
(void) wattrset(main_window, attributes[NORMAL]);
|
||||||
print_in_middle(stdscr, 1, 0, COLS,
|
print_in_middle(stdscr, 1, 0, getmaxx(stdscr),
|
||||||
menu_backtitle,
|
menu_backtitle,
|
||||||
attributes[MAIN_HEADING]);
|
attributes[MAIN_HEADING]);
|
||||||
|
|
||||||
@ -1455,14 +1456,18 @@ static void conf_save(void)
|
|||||||
|
|
||||||
void setup_windows(void)
|
void setup_windows(void)
|
||||||
{
|
{
|
||||||
|
int lines, columns;
|
||||||
|
|
||||||
|
getmaxyx(stdscr, lines, columns);
|
||||||
|
|
||||||
if (main_window != NULL)
|
if (main_window != NULL)
|
||||||
delwin(main_window);
|
delwin(main_window);
|
||||||
|
|
||||||
/* set up the menu and menu window */
|
/* set up the menu and menu window */
|
||||||
main_window = newwin(LINES-2, COLS-2, 2, 1);
|
main_window = newwin(lines-2, columns-2, 2, 1);
|
||||||
keypad(main_window, TRUE);
|
keypad(main_window, TRUE);
|
||||||
mwin_max_lines = LINES-7;
|
mwin_max_lines = lines-7;
|
||||||
mwin_max_cols = COLS-6;
|
mwin_max_cols = columns-6;
|
||||||
|
|
||||||
/* panels order is from bottom to top */
|
/* panels order is from bottom to top */
|
||||||
new_panel(main_window);
|
new_panel(main_window);
|
||||||
@ -1470,6 +1475,7 @@ void setup_windows(void)
|
|||||||
|
|
||||||
int main(int ac, char **av)
|
int main(int ac, char **av)
|
||||||
{
|
{
|
||||||
|
int lines, columns;
|
||||||
char *mode;
|
char *mode;
|
||||||
|
|
||||||
setlocale(LC_ALL, "");
|
setlocale(LC_ALL, "");
|
||||||
@ -1495,7 +1501,8 @@ int main(int ac, char **av)
|
|||||||
keypad(stdscr, TRUE);
|
keypad(stdscr, TRUE);
|
||||||
curs_set(0);
|
curs_set(0);
|
||||||
|
|
||||||
if (COLS < 75 || LINES < 20) {
|
getmaxyx(stdscr, lines, columns);
|
||||||
|
if (columns < 75 || lines < 20) {
|
||||||
endwin();
|
endwin();
|
||||||
printf("Your terminal should have at "
|
printf("Your terminal should have at "
|
||||||
"least 20 lines and 75 columns\n");
|
"least 20 lines and 75 columns\n");
|
||||||
|
@ -276,8 +276,8 @@ int btn_dialog(WINDOW *main_window, const char *msg, int btn_num, ...)
|
|||||||
|
|
||||||
total_width = max(msg_width, btns_width);
|
total_width = max(msg_width, btns_width);
|
||||||
/* place dialog in middle of screen */
|
/* place dialog in middle of screen */
|
||||||
y = (LINES-(msg_lines+4))/2;
|
y = (getmaxy(stdscr)-(msg_lines+4))/2;
|
||||||
x = (COLS-(total_width+4))/2;
|
x = (getmaxx(stdscr)-(total_width+4))/2;
|
||||||
|
|
||||||
|
|
||||||
/* create the windows */
|
/* create the windows */
|
||||||
@ -387,8 +387,8 @@ int dialog_inputbox(WINDOW *main_window,
|
|||||||
prompt_width = max(prompt_width, strlen(title));
|
prompt_width = max(prompt_width, strlen(title));
|
||||||
|
|
||||||
/* place dialog in middle of screen */
|
/* place dialog in middle of screen */
|
||||||
y = (LINES-(prompt_lines+4))/2;
|
y = (getmaxy(stdscr)-(prompt_lines+4))/2;
|
||||||
x = (COLS-(prompt_width+4))/2;
|
x = (getmaxx(stdscr)-(prompt_width+4))/2;
|
||||||
|
|
||||||
strncpy(result, init, *result_len);
|
strncpy(result, init, *result_len);
|
||||||
|
|
||||||
@ -545,7 +545,7 @@ void show_scroll_win(WINDOW *main_window,
|
|||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
int total_lines = get_line_no(text);
|
int total_lines = get_line_no(text);
|
||||||
int x, y;
|
int x, y, lines, columns;
|
||||||
int start_x = 0, start_y = 0;
|
int start_x = 0, start_y = 0;
|
||||||
int text_lines = 0, text_cols = 0;
|
int text_lines = 0, text_cols = 0;
|
||||||
int total_cols = 0;
|
int total_cols = 0;
|
||||||
@ -556,6 +556,8 @@ void show_scroll_win(WINDOW *main_window,
|
|||||||
WINDOW *pad;
|
WINDOW *pad;
|
||||||
PANEL *panel;
|
PANEL *panel;
|
||||||
|
|
||||||
|
getmaxyx(stdscr, lines, columns);
|
||||||
|
|
||||||
/* find the widest line of msg: */
|
/* find the widest line of msg: */
|
||||||
total_lines = get_line_no(text);
|
total_lines = get_line_no(text);
|
||||||
for (i = 0; i < total_lines; i++) {
|
for (i = 0; i < total_lines; i++) {
|
||||||
@ -569,14 +571,14 @@ void show_scroll_win(WINDOW *main_window,
|
|||||||
(void) wattrset(pad, attributes[SCROLLWIN_TEXT]);
|
(void) wattrset(pad, attributes[SCROLLWIN_TEXT]);
|
||||||
fill_window(pad, text);
|
fill_window(pad, text);
|
||||||
|
|
||||||
win_lines = min(total_lines+4, LINES-2);
|
win_lines = min(total_lines+4, lines-2);
|
||||||
win_cols = min(total_cols+2, COLS-2);
|
win_cols = min(total_cols+2, columns-2);
|
||||||
text_lines = max(win_lines-4, 0);
|
text_lines = max(win_lines-4, 0);
|
||||||
text_cols = max(win_cols-2, 0);
|
text_cols = max(win_cols-2, 0);
|
||||||
|
|
||||||
/* place window in middle of screen */
|
/* place window in middle of screen */
|
||||||
y = (LINES-win_lines)/2;
|
y = (lines-win_lines)/2;
|
||||||
x = (COLS-win_cols)/2;
|
x = (columns-win_cols)/2;
|
||||||
|
|
||||||
win = newwin(win_lines, win_cols, y, x);
|
win = newwin(win_lines, win_cols, y, x);
|
||||||
keypad(win, TRUE);
|
keypad(win, TRUE);
|
||||||
|
@ -25,7 +25,7 @@ Index: b/mconf.c
|
|||||||
+++ b/mconf.c
|
+++ b/mconf.c
|
||||||
@@ -178,9 +178,9 @@
|
@@ -178,9 +178,9 @@
|
||||||
"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. "
|
||||||
+ "Pressing <Y> selectes a feature, while <N> will exclude a feature. "
|
+ "Pressing <Y> selectes a feature, while <N> will exclude a feature. "
|
||||||
@ -39,10 +39,10 @@ Index: b/zconf.tab.c_shipped
|
|||||||
===================================================================
|
===================================================================
|
||||||
--- a/zconf.tab.c_shipped
|
--- a/zconf.tab.c_shipped
|
||||||
+++ b/zconf.tab.c_shipped
|
+++ b/zconf.tab.c_shipped
|
||||||
@@ -2259,7 +2259,7 @@
|
@@ -2297,7 +2297,7 @@
|
||||||
modules_sym = sym_lookup(NULL, 0);
|
|
||||||
modules_sym->type = S_BOOLEAN;
|
sym_init();
|
||||||
modules_sym->flags |= SYMBOL_AUTO;
|
_menu_init();
|
||||||
- rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL);
|
- rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL);
|
||||||
+ rootmenu.prompt = menu_add_prompt(P_MENU, "Buildroot Configuration", NULL);
|
+ rootmenu.prompt = menu_add_prompt(P_MENU, "Buildroot Configuration", NULL);
|
||||||
|
|
||||||
@ -52,10 +52,10 @@ Index: b/zconf.y
|
|||||||
===================================================================
|
===================================================================
|
||||||
--- a/zconf.y
|
--- a/zconf.y
|
||||||
+++ b/zconf.y
|
+++ b/zconf.y
|
||||||
@@ -496,7 +496,7 @@
|
@@ -493,7 +493,7 @@
|
||||||
modules_sym = sym_lookup(NULL, 0);
|
|
||||||
modules_sym->type = S_BOOLEAN;
|
sym_init();
|
||||||
modules_sym->flags |= SYMBOL_AUTO;
|
_menu_init();
|
||||||
- rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL);
|
- rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL);
|
||||||
+ rootmenu.prompt = menu_add_prompt(P_MENU, "Buildroot Configuration", NULL);
|
+ rootmenu.prompt = menu_add_prompt(P_MENU, "Buildroot Configuration", NULL);
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ Index: b/confdata.c
|
|||||||
===================================================================
|
===================================================================
|
||||||
--- a/confdata.c
|
--- a/confdata.c
|
||||||
+++ b/confdata.c
|
+++ b/confdata.c
|
||||||
@@ -25,7 +26,7 @@
|
@@ -25,7 +25,7 @@
|
||||||
static const char *conf_filename;
|
static const char *conf_filename;
|
||||||
static int conf_lineno, conf_warnings, conf_unsaved;
|
static int conf_lineno, conf_warnings, conf_unsaved;
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ Index: b/confdata.c
|
|||||||
|
|
||||||
static void conf_warning(const char *fmt, ...)
|
static void conf_warning(const char *fmt, ...)
|
||||||
{
|
{
|
||||||
@@ -63,7 +64,7 @@
|
@@ -63,7 +63,7 @@
|
||||||
|
|
||||||
const char *conf_get_configname(void)
|
const char *conf_get_configname(void)
|
||||||
{
|
{
|
||||||
|
@ -1,44 +0,0 @@
|
|||||||
---
|
|
||||||
confdata.c | 22 +++++++++++++++++++---
|
|
||||||
1 file changed, 19 insertions(+), 3 deletions(-)
|
|
||||||
|
|
||||||
Index: b/confdata.c
|
|
||||||
===================================================================
|
|
||||||
--- a/confdata.c
|
|
||||||
+++ b/confdata.c
|
|
||||||
@@ -1106,7 +1106,16 @@
|
|
||||||
void conf_set_all_new_symbols(enum conf_def_mode mode)
|
|
||||||
{
|
|
||||||
struct symbol *sym, *csym;
|
|
||||||
- int i, cnt;
|
|
||||||
+ int i, cnt, prob = 50;
|
|
||||||
+
|
|
||||||
+ if (mode == def_random) {
|
|
||||||
+ char *endp, *env = getenv("KCONFIG_PROBABILITY");
|
|
||||||
+ if (env && *env) {
|
|
||||||
+ int tmp = (int)strtol(env, &endp, 10);
|
|
||||||
+ if (*endp == '\0' && tmp >= 0 && tmp <= 100)
|
|
||||||
+ prob = tmp;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
|
|
||||||
for_all_symbols(i, sym) {
|
|
||||||
if (sym_has_value(sym))
|
|
||||||
@@ -1125,8 +1134,15 @@
|
|
||||||
sym->def[S_DEF_USER].tri = no;
|
|
||||||
break;
|
|
||||||
case def_random:
|
|
||||||
- cnt = sym_get_type(sym) == S_TRISTATE ? 3 : 2;
|
|
||||||
- sym->def[S_DEF_USER].tri = (tristate)(rand() % cnt);
|
|
||||||
+ cnt = (rand() % 100) - (100 - prob);
|
|
||||||
+ if (cnt < 0)
|
|
||||||
+ sym->def[S_DEF_USER].tri = no;
|
|
||||||
+ else
|
|
||||||
+ if ((sym_get_type(sym) == S_TRISTATE)
|
|
||||||
+ && (cnt > prob/2))
|
|
||||||
+ sym->def[S_DEF_USER].tri = mod;
|
|
||||||
+ else
|
|
||||||
+ sym->def[S_DEF_USER].tri = yes;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
continue;
|
|
@ -6,7 +6,7 @@ Index: b/lxdialog/check-lxdialog.sh
|
|||||||
===================================================================
|
===================================================================
|
||||||
--- a/lxdialog/check-lxdialog.sh
|
--- a/lxdialog/check-lxdialog.sh
|
||||||
+++ b/lxdialog/check-lxdialog.sh
|
+++ b/lxdialog/check-lxdialog.sh
|
||||||
@@ -34,7 +34,7 @@
|
@@ -36,7 +36,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
# Temp file, try to clean up after us
|
# Temp file, try to clean up after us
|
||||||
|
@ -8,7 +8,7 @@ Index: b/conf.c
|
|||||||
===================================================================
|
===================================================================
|
||||||
--- a/conf.c
|
--- a/conf.c
|
||||||
+++ b/conf.c
|
+++ b/conf.c
|
||||||
@@ -547,7 +547,6 @@
|
@@ -558,7 +558,6 @@
|
||||||
}
|
}
|
||||||
name = av[optind];
|
name = av[optind];
|
||||||
conf_parse(name);
|
conf_parse(name);
|
||||||
@ -39,7 +39,7 @@ Index: b/confdata.c
|
|||||||
}
|
}
|
||||||
|
|
||||||
static char *conf_expand_value(const char *in)
|
static char *conf_expand_value(const char *in)
|
||||||
@@ -737,6 +736,9 @@
|
@@ -742,6 +741,9 @@
|
||||||
char dirname[PATH_MAX+1], tmpname[PATH_MAX+1], newname[PATH_MAX+1];
|
char dirname[PATH_MAX+1], tmpname[PATH_MAX+1], newname[PATH_MAX+1];
|
||||||
char *env;
|
char *env;
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ Index: b/confdata.c
|
|||||||
dirname[0] = 0;
|
dirname[0] = 0;
|
||||||
if (name && name[0]) {
|
if (name && name[0]) {
|
||||||
struct stat st;
|
struct stat st;
|
||||||
@@ -831,6 +833,7 @@
|
@@ -836,6 +838,7 @@
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
char path[PATH_MAX+1];
|
char path[PATH_MAX+1];
|
||||||
@ -57,7 +57,7 @@ Index: b/confdata.c
|
|||||||
char *s, *d, c;
|
char *s, *d, c;
|
||||||
struct symbol *sym;
|
struct symbol *sym;
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
@@ -839,8 +842,20 @@
|
@@ -844,8 +847,20 @@
|
||||||
name = conf_get_autoconfig_name();
|
name = conf_get_autoconfig_name();
|
||||||
conf_read_simple(name, S_DEF_AUTO);
|
conf_read_simple(name, S_DEF_AUTO);
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ Index: b/confdata.c
|
|||||||
|
|
||||||
res = 0;
|
res = 0;
|
||||||
for_all_symbols(i, sym) {
|
for_all_symbols(i, sym) {
|
||||||
@@ -933,9 +948,11 @@
|
@@ -938,9 +953,11 @@
|
||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
@ -95,7 +95,7 @@ Index: b/confdata.c
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -945,25 +962,38 @@
|
@@ -950,25 +967,38 @@
|
||||||
const char *name;
|
const char *name;
|
||||||
FILE *out, *tristate, *out_h;
|
FILE *out, *tristate, *out_h;
|
||||||
int i;
|
int i;
|
||||||
@ -138,7 +138,7 @@ Index: b/confdata.c
|
|||||||
if (!out_h) {
|
if (!out_h) {
|
||||||
fclose(out);
|
fclose(out);
|
||||||
fclose(tristate);
|
fclose(tristate);
|
||||||
@@ -995,19 +1025,22 @@
|
@@ -1000,19 +1030,22 @@
|
||||||
name = getenv("KCONFIG_AUTOHEADER");
|
name = getenv("KCONFIG_AUTOHEADER");
|
||||||
if (!name)
|
if (!name)
|
||||||
name = "include/generated/autoconf.h";
|
name = "include/generated/autoconf.h";
|
||||||
|
@ -9,7 +9,7 @@ Index: b/Makefile
|
|||||||
===================================================================
|
===================================================================
|
||||||
--- a/Makefile
|
--- a/Makefile
|
||||||
+++ b/Makefile
|
+++ b/Makefile
|
||||||
@@ -307,11 +307,8 @@
|
@@ -309,11 +309,8 @@
|
||||||
|
|
||||||
$(obj)/qconf.o: $(obj)/qconf.moc
|
$(obj)/qconf.o: $(obj)/qconf.moc
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
01-kconfig-kernel-to-buildroot.patch
|
01-kconfig-kernel-to-buildroot.patch
|
||||||
06-br-build-system-integration.patch
|
06-br-build-system-integration.patch
|
||||||
09-implement-kconfig-probability.patch
|
|
||||||
10-br-build-system.patch
|
10-br-build-system.patch
|
||||||
11-use-mktemp-for-lxdialog.patch
|
11-use-mktemp-for-lxdialog.patch
|
||||||
12-fix-glade-file-path.patch
|
12-fix-glade-file-path.patch
|
||||||
|
@ -156,7 +156,6 @@ sub read_kconfig {
|
|||||||
|
|
||||||
my $state = "NONE";
|
my $state = "NONE";
|
||||||
my $config;
|
my $config;
|
||||||
my @kconfigs;
|
|
||||||
|
|
||||||
my $cont = 0;
|
my $cont = 0;
|
||||||
my $line;
|
my $line;
|
||||||
@ -190,7 +189,13 @@ sub read_kconfig {
|
|||||||
|
|
||||||
# collect any Kconfig sources
|
# collect any Kconfig sources
|
||||||
if (/^source\s*"(.*)"/) {
|
if (/^source\s*"(.*)"/) {
|
||||||
$kconfigs[$#kconfigs+1] = $1;
|
my $kconfig = $1;
|
||||||
|
# prevent reading twice.
|
||||||
|
if (!defined($read_kconfigs{$kconfig})) {
|
||||||
|
$read_kconfigs{$kconfig} = 1;
|
||||||
|
read_kconfig($kconfig);
|
||||||
|
}
|
||||||
|
next;
|
||||||
}
|
}
|
||||||
|
|
||||||
# configs found
|
# configs found
|
||||||
@ -250,14 +255,6 @@ sub read_kconfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
close($kinfile);
|
close($kinfile);
|
||||||
|
|
||||||
# read in any configs that were found.
|
|
||||||
foreach my $kconfig (@kconfigs) {
|
|
||||||
if (!defined($read_kconfigs{$kconfig})) {
|
|
||||||
$read_kconfigs{$kconfig} = 1;
|
|
||||||
read_kconfig($kconfig);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($kconfig) {
|
if ($kconfig) {
|
||||||
@ -396,6 +393,15 @@ foreach my $module (keys(%modules)) {
|
|||||||
foreach my $conf (@arr) {
|
foreach my $conf (@arr) {
|
||||||
$configs{$conf} = $module;
|
$configs{$conf} = $module;
|
||||||
dprint "$conf added by direct ($module)\n";
|
dprint "$conf added by direct ($module)\n";
|
||||||
|
if ($debugprint) {
|
||||||
|
my $c=$conf;
|
||||||
|
$c =~ s/^CONFIG_//;
|
||||||
|
if (defined($depends{$c})) {
|
||||||
|
dprint " deps = $depends{$c}\n";
|
||||||
|
} else {
|
||||||
|
dprint " no deps\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
# Most likely, someone has a custom (binary?) module loaded.
|
# Most likely, someone has a custom (binary?) module loaded.
|
||||||
|
@ -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;
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
/* A Bison parser, made by GNU Bison 2.4.3. */
|
/* A Bison parser, made by GNU Bison 2.5. */
|
||||||
|
|
||||||
/* Skeleton implementation for Bison's Yacc-like parsers in C
|
/* Bison implementation for Yacc-like parsers in C
|
||||||
|
|
||||||
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
|
Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
|
||||||
2009, 2010 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@ -45,7 +44,7 @@
|
|||||||
#define YYBISON 1
|
#define YYBISON 1
|
||||||
|
|
||||||
/* Bison version. */
|
/* Bison version. */
|
||||||
#define YYBISON_VERSION "2.4.3"
|
#define YYBISON_VERSION "2.5"
|
||||||
|
|
||||||
/* Skeleton name. */
|
/* Skeleton name. */
|
||||||
#define YYSKELETON_NAME "yacc.c"
|
#define YYSKELETON_NAME "yacc.c"
|
||||||
@ -302,11 +301,11 @@ YYID (yyi)
|
|||||||
# define alloca _alloca
|
# define alloca _alloca
|
||||||
# else
|
# else
|
||||||
# define YYSTACK_ALLOC alloca
|
# define YYSTACK_ALLOC alloca
|
||||||
# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
|
# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
|
||||||
|| defined __cplusplus || defined _MSC_VER)
|
|| defined __cplusplus || defined _MSC_VER)
|
||||||
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
|
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
|
||||||
# ifndef _STDLIB_H
|
# ifndef EXIT_SUCCESS
|
||||||
# define _STDLIB_H 1
|
# define EXIT_SUCCESS 0
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
@ -329,24 +328,24 @@ YYID (yyi)
|
|||||||
# ifndef YYSTACK_ALLOC_MAXIMUM
|
# ifndef YYSTACK_ALLOC_MAXIMUM
|
||||||
# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
|
# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
|
||||||
# endif
|
# endif
|
||||||
# if (defined __cplusplus && ! defined _STDLIB_H \
|
# if (defined __cplusplus && ! defined EXIT_SUCCESS \
|
||||||
&& ! ((defined YYMALLOC || defined malloc) \
|
&& ! ((defined YYMALLOC || defined malloc) \
|
||||||
&& (defined YYFREE || defined free)))
|
&& (defined YYFREE || defined free)))
|
||||||
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
|
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
|
||||||
# ifndef _STDLIB_H
|
# ifndef EXIT_SUCCESS
|
||||||
# define _STDLIB_H 1
|
# define EXIT_SUCCESS 0
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
# ifndef YYMALLOC
|
# ifndef YYMALLOC
|
||||||
# define YYMALLOC malloc
|
# define YYMALLOC malloc
|
||||||
# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
|
# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
|
||||||
|| defined __cplusplus || defined _MSC_VER)
|
|| defined __cplusplus || defined _MSC_VER)
|
||||||
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
|
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
# ifndef YYFREE
|
# ifndef YYFREE
|
||||||
# define YYFREE free
|
# define YYFREE free
|
||||||
# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
|
# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
|
||||||
|| defined __cplusplus || defined _MSC_VER)
|
|| defined __cplusplus || defined _MSC_VER)
|
||||||
void free (void *); /* INFRINGES ON USER NAME SPACE */
|
void free (void *); /* INFRINGES ON USER NAME SPACE */
|
||||||
# endif
|
# endif
|
||||||
@ -375,23 +374,7 @@ union yyalloc
|
|||||||
((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
|
((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
|
||||||
+ YYSTACK_GAP_MAXIMUM)
|
+ YYSTACK_GAP_MAXIMUM)
|
||||||
|
|
||||||
/* Copy COUNT objects from FROM to TO. The source and destination do
|
# define YYCOPY_NEEDED 1
|
||||||
not overlap. */
|
|
||||||
# ifndef YYCOPY
|
|
||||||
# if defined __GNUC__ && 1 < __GNUC__
|
|
||||||
# define YYCOPY(To, From, Count) \
|
|
||||||
__builtin_memcpy (To, From, (Count) * sizeof (*(From)))
|
|
||||||
# else
|
|
||||||
# define YYCOPY(To, From, Count) \
|
|
||||||
do \
|
|
||||||
{ \
|
|
||||||
YYSIZE_T yyi; \
|
|
||||||
for (yyi = 0; yyi < (Count); yyi++) \
|
|
||||||
(To)[yyi] = (From)[yyi]; \
|
|
||||||
} \
|
|
||||||
while (YYID (0))
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
|
|
||||||
/* Relocate STACK from its old location to the new one. The
|
/* Relocate STACK from its old location to the new one. The
|
||||||
local variables YYSIZE and YYSTACKSIZE give the old and new number of
|
local variables YYSIZE and YYSTACKSIZE give the old and new number of
|
||||||
@ -411,6 +394,26 @@ union yyalloc
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
|
||||||
|
/* Copy COUNT objects from FROM to TO. The source and destination do
|
||||||
|
not overlap. */
|
||||||
|
# ifndef YYCOPY
|
||||||
|
# if defined __GNUC__ && 1 < __GNUC__
|
||||||
|
# define YYCOPY(To, From, Count) \
|
||||||
|
__builtin_memcpy (To, From, (Count) * sizeof (*(From)))
|
||||||
|
# else
|
||||||
|
# define YYCOPY(To, From, Count) \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
|
YYSIZE_T yyi; \
|
||||||
|
for (yyi = 0; yyi < (Count); yyi++) \
|
||||||
|
(To)[yyi] = (From)[yyi]; \
|
||||||
|
} \
|
||||||
|
while (YYID (0))
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
#endif /* !YYCOPY_NEEDED */
|
||||||
|
|
||||||
/* YYFINAL -- State number of the termination state. */
|
/* YYFINAL -- State number of the termination state. */
|
||||||
#define YYFINAL 11
|
#define YYFINAL 11
|
||||||
/* YYLAST -- Last index in YYTABLE. */
|
/* YYLAST -- Last index in YYTABLE. */
|
||||||
@ -529,18 +532,18 @@ static const yytype_int8 yyrhs[] =
|
|||||||
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
|
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
|
||||||
static const yytype_uint16 yyrline[] =
|
static const yytype_uint16 yyrline[] =
|
||||||
{
|
{
|
||||||
0, 104, 104, 104, 106, 106, 108, 110, 111, 112,
|
0, 103, 103, 103, 105, 105, 107, 109, 110, 111,
|
||||||
113, 114, 115, 119, 123, 123, 123, 123, 123, 123,
|
112, 113, 114, 118, 122, 122, 122, 122, 122, 122,
|
||||||
123, 123, 127, 128, 129, 130, 131, 132, 136, 137,
|
122, 122, 126, 127, 128, 129, 130, 131, 135, 136,
|
||||||
143, 151, 157, 165, 175, 177, 178, 179, 180, 181,
|
142, 150, 156, 164, 174, 176, 177, 178, 179, 180,
|
||||||
182, 185, 193, 199, 209, 215, 221, 224, 226, 237,
|
181, 184, 192, 198, 208, 214, 220, 223, 225, 236,
|
||||||
238, 243, 252, 257, 265, 268, 270, 271, 272, 273,
|
237, 242, 251, 256, 264, 267, 269, 270, 271, 272,
|
||||||
274, 277, 283, 294, 300, 310, 312, 317, 325, 333,
|
273, 276, 282, 293, 299, 309, 311, 316, 324, 332,
|
||||||
336, 338, 339, 340, 345, 352, 359, 364, 372, 375,
|
335, 337, 338, 339, 344, 351, 358, 363, 371, 374,
|
||||||
377, 378, 379, 382, 390, 397, 404, 410, 417, 419,
|
376, 377, 378, 381, 389, 396, 403, 409, 416, 418,
|
||||||
420, 421, 424, 432, 434, 435, 438, 445, 447, 452,
|
419, 420, 423, 431, 433, 434, 437, 444, 446, 451,
|
||||||
453, 456, 457, 458, 462, 463, 466, 467, 470, 471,
|
452, 455, 456, 457, 461, 462, 465, 466, 469, 470,
|
||||||
472, 473, 474, 475, 476, 479, 480, 483, 484
|
471, 472, 473, 474, 475, 478, 479, 482, 483
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -615,8 +618,8 @@ static const yytype_uint8 yyr2[] =
|
|||||||
3, 3, 2, 3, 3, 1, 1, 0, 1
|
3, 3, 2, 3, 3, 1, 1, 0, 1
|
||||||
};
|
};
|
||||||
|
|
||||||
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
|
/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
|
||||||
STATE-NUM when YYTABLE doesn't specify something else to do. Zero
|
Performed when YYTABLE doesn't specify something else to do. Zero
|
||||||
means the default is an error. */
|
means the default is an error. */
|
||||||
static const yytype_uint8 yydefact[] =
|
static const yytype_uint8 yydefact[] =
|
||||||
{
|
{
|
||||||
@ -691,8 +694,7 @@ static const yytype_int16 yypgoto[] =
|
|||||||
|
|
||||||
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
|
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
|
||||||
positive, shift that token. If negative, reduce the rule which
|
positive, shift that token. If negative, reduce the rule which
|
||||||
number is the opposite. If zero, do what YYDEFACT says.
|
number is the opposite. If YYTABLE_NINF, syntax error. */
|
||||||
If YYTABLE_NINF, syntax error. */
|
|
||||||
#define YYTABLE_NINF -86
|
#define YYTABLE_NINF -86
|
||||||
static const yytype_int16 yytable[] =
|
static const yytype_int16 yytable[] =
|
||||||
{
|
{
|
||||||
@ -728,6 +730,12 @@ static const yytype_int16 yytable[] =
|
|||||||
184
|
184
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define yypact_value_is_default(yystate) \
|
||||||
|
((yystate) == (-90))
|
||||||
|
|
||||||
|
#define yytable_value_is_error(yytable_value) \
|
||||||
|
YYID (0)
|
||||||
|
|
||||||
static const yytype_int16 yycheck[] =
|
static const yytype_int16 yycheck[] =
|
||||||
{
|
{
|
||||||
1, 67, 68, 10, 93, 94, 76, 3, 76, 14,
|
1, 67, 68, 10, 93, 94, 76, 3, 76, 14,
|
||||||
@ -821,7 +829,6 @@ do \
|
|||||||
{ \
|
{ \
|
||||||
yychar = (Token); \
|
yychar = (Token); \
|
||||||
yylval = (Value); \
|
yylval = (Value); \
|
||||||
yytoken = YYTRANSLATE (yychar); \
|
|
||||||
YYPOPSTACK (1); \
|
YYPOPSTACK (1); \
|
||||||
goto yybackup; \
|
goto yybackup; \
|
||||||
} \
|
} \
|
||||||
@ -863,19 +870,10 @@ while (YYID (0))
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* YY_LOCATION_PRINT -- Print the location on the stream.
|
/* This macro is provided for backward compatibility. */
|
||||||
This macro was not mandated originally: define only if we know
|
|
||||||
we won't break user code: when these are the locations we know. */
|
|
||||||
|
|
||||||
#ifndef YY_LOCATION_PRINT
|
#ifndef YY_LOCATION_PRINT
|
||||||
# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
|
|
||||||
# define YY_LOCATION_PRINT(File, Loc) \
|
|
||||||
fprintf (File, "%d.%d-%d.%d", \
|
|
||||||
(Loc).first_line, (Loc).first_column, \
|
|
||||||
(Loc).last_line, (Loc).last_column)
|
|
||||||
# else
|
|
||||||
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
|
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -1067,7 +1065,6 @@ int yydebug;
|
|||||||
# define YYMAXDEPTH 10000
|
# define YYMAXDEPTH 10000
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if YYERROR_VERBOSE
|
#if YYERROR_VERBOSE
|
||||||
|
|
||||||
@ -1170,115 +1167,142 @@ yytnamerr (char *yyres, const char *yystr)
|
|||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
/* Copy into YYRESULT an error message about the unexpected token
|
/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
|
||||||
YYCHAR while in state YYSTATE. Return the number of bytes copied,
|
about the unexpected token YYTOKEN for the state stack whose top is
|
||||||
including the terminating null byte. If YYRESULT is null, do not
|
YYSSP.
|
||||||
copy anything; just return the number of bytes that would be
|
|
||||||
copied. As a special case, return 0 if an ordinary "syntax error"
|
|
||||||
message will do. Return YYSIZE_MAXIMUM if overflow occurs during
|
|
||||||
size calculation. */
|
|
||||||
static YYSIZE_T
|
|
||||||
yysyntax_error (char *yyresult, int yystate, int yychar)
|
|
||||||
{
|
|
||||||
int yyn = yypact[yystate];
|
|
||||||
|
|
||||||
if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
|
Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
|
||||||
return 0;
|
not large enough to hold the message. In that case, also set
|
||||||
else
|
*YYMSG_ALLOC to the required number of bytes. Return 2 if the
|
||||||
{
|
required number of bytes is too large to store. */
|
||||||
int yytype = YYTRANSLATE (yychar);
|
static int
|
||||||
YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
|
yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
|
||||||
|
yytype_int16 *yyssp, int yytoken)
|
||||||
|
{
|
||||||
|
YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]);
|
||||||
YYSIZE_T yysize = yysize0;
|
YYSIZE_T yysize = yysize0;
|
||||||
YYSIZE_T yysize1;
|
YYSIZE_T yysize1;
|
||||||
int yysize_overflow = 0;
|
|
||||||
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
|
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
|
||||||
|
/* Internationalized format string. */
|
||||||
|
const char *yyformat = 0;
|
||||||
|
/* Arguments of yyformat. */
|
||||||
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
|
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
|
||||||
int yyx;
|
/* Number of reported tokens (one for the "unexpected", one per
|
||||||
|
"expected"). */
|
||||||
# if 0
|
int yycount = 0;
|
||||||
/* This is so xgettext sees the translatable formats that are
|
|
||||||
constructed on the fly. */
|
|
||||||
YY_("syntax error, unexpected %s");
|
|
||||||
YY_("syntax error, unexpected %s, expecting %s");
|
|
||||||
YY_("syntax error, unexpected %s, expecting %s or %s");
|
|
||||||
YY_("syntax error, unexpected %s, expecting %s or %s or %s");
|
|
||||||
YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
|
|
||||||
# endif
|
|
||||||
char *yyfmt;
|
|
||||||
char const *yyf;
|
|
||||||
static char const yyunexpected[] = "syntax error, unexpected %s";
|
|
||||||
static char const yyexpecting[] = ", expecting %s";
|
|
||||||
static char const yyor[] = " or %s";
|
|
||||||
char yyformat[sizeof yyunexpected
|
|
||||||
+ sizeof yyexpecting - 1
|
|
||||||
+ ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
|
|
||||||
* (sizeof yyor - 1))];
|
|
||||||
char const *yyprefix = yyexpecting;
|
|
||||||
|
|
||||||
|
/* There are many possibilities here to consider:
|
||||||
|
- Assume YYFAIL is not used. It's too flawed to consider. See
|
||||||
|
<http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
|
||||||
|
for details. YYERROR is fine as it does not invoke this
|
||||||
|
function.
|
||||||
|
- If this state is a consistent state with a default action, then
|
||||||
|
the only way this function was invoked is if the default action
|
||||||
|
is an error action. In that case, don't check for expected
|
||||||
|
tokens because there are none.
|
||||||
|
- The only way there can be no lookahead present (in yychar) is if
|
||||||
|
this state is a consistent state with a default action. Thus,
|
||||||
|
detecting the absence of a lookahead is sufficient to determine
|
||||||
|
that there is no unexpected or expected token to report. In that
|
||||||
|
case, just report a simple "syntax error".
|
||||||
|
- Don't assume there isn't a lookahead just because this state is a
|
||||||
|
consistent state with a default action. There might have been a
|
||||||
|
previous inconsistent state, consistent state with a non-default
|
||||||
|
action, or user semantic action that manipulated yychar.
|
||||||
|
- Of course, the expected token list depends on states to have
|
||||||
|
correct lookahead information, and it depends on the parser not
|
||||||
|
to perform extra reductions after fetching a lookahead from the
|
||||||
|
scanner and before detecting a syntax error. Thus, state merging
|
||||||
|
(from LALR or IELR) and default reductions corrupt the expected
|
||||||
|
token list. However, the list is correct for canonical LR with
|
||||||
|
one exception: it will still contain any token that will not be
|
||||||
|
accepted due to an error action in a later state.
|
||||||
|
*/
|
||||||
|
if (yytoken != YYEMPTY)
|
||||||
|
{
|
||||||
|
int yyn = yypact[*yyssp];
|
||||||
|
yyarg[yycount++] = yytname[yytoken];
|
||||||
|
if (!yypact_value_is_default (yyn))
|
||||||
|
{
|
||||||
/* Start YYX at -YYN if negative to avoid negative indexes in
|
/* Start YYX at -YYN if negative to avoid negative indexes in
|
||||||
YYCHECK. */
|
YYCHECK. In other words, skip the first -YYN actions for
|
||||||
|
this state because they are default actions. */
|
||||||
int yyxbegin = yyn < 0 ? -yyn : 0;
|
int yyxbegin = yyn < 0 ? -yyn : 0;
|
||||||
|
|
||||||
/* Stay within bounds of both yycheck and yytname. */
|
/* Stay within bounds of both yycheck and yytname. */
|
||||||
int yychecklim = YYLAST - yyn + 1;
|
int yychecklim = YYLAST - yyn + 1;
|
||||||
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
|
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
|
||||||
int yycount = 1;
|
int yyx;
|
||||||
|
|
||||||
yyarg[0] = yytname[yytype];
|
|
||||||
yyfmt = yystpcpy (yyformat, yyunexpected);
|
|
||||||
|
|
||||||
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
|
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
|
||||||
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
|
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
|
||||||
|
&& !yytable_value_is_error (yytable[yyx + yyn]))
|
||||||
{
|
{
|
||||||
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
|
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
|
||||||
{
|
{
|
||||||
yycount = 1;
|
yycount = 1;
|
||||||
yysize = yysize0;
|
yysize = yysize0;
|
||||||
yyformat[sizeof yyunexpected - 1] = '\0';
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
yyarg[yycount++] = yytname[yyx];
|
yyarg[yycount++] = yytname[yyx];
|
||||||
yysize1 = yysize + yytnamerr (0, yytname[yyx]);
|
yysize1 = yysize + yytnamerr (0, yytname[yyx]);
|
||||||
yysize_overflow |= (yysize1 < yysize);
|
if (! (yysize <= yysize1
|
||||||
|
&& yysize1 <= YYSTACK_ALLOC_MAXIMUM))
|
||||||
|
return 2;
|
||||||
yysize = yysize1;
|
yysize = yysize1;
|
||||||
yyfmt = yystpcpy (yyfmt, yyprefix);
|
}
|
||||||
yyprefix = yyor;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
yyf = YY_(yyformat);
|
switch (yycount)
|
||||||
yysize1 = yysize + yystrlen (yyf);
|
{
|
||||||
yysize_overflow |= (yysize1 < yysize);
|
# define YYCASE_(N, S) \
|
||||||
|
case N: \
|
||||||
|
yyformat = S; \
|
||||||
|
break
|
||||||
|
YYCASE_(0, YY_("syntax error"));
|
||||||
|
YYCASE_(1, YY_("syntax error, unexpected %s"));
|
||||||
|
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
|
||||||
|
YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
|
||||||
|
YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
|
||||||
|
YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
|
||||||
|
# undef YYCASE_
|
||||||
|
}
|
||||||
|
|
||||||
|
yysize1 = yysize + yystrlen (yyformat);
|
||||||
|
if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
|
||||||
|
return 2;
|
||||||
yysize = yysize1;
|
yysize = yysize1;
|
||||||
|
|
||||||
if (yysize_overflow)
|
if (*yymsg_alloc < yysize)
|
||||||
return YYSIZE_MAXIMUM;
|
|
||||||
|
|
||||||
if (yyresult)
|
|
||||||
{
|
{
|
||||||
|
*yymsg_alloc = 2 * yysize;
|
||||||
|
if (! (yysize <= *yymsg_alloc
|
||||||
|
&& *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
|
||||||
|
*yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Avoid sprintf, as that infringes on the user's name space.
|
/* Avoid sprintf, as that infringes on the user's name space.
|
||||||
Don't have undefined behavior even if the translation
|
Don't have undefined behavior even if the translation
|
||||||
produced a string with the wrong number of "%s"s. */
|
produced a string with the wrong number of "%s"s. */
|
||||||
char *yyp = yyresult;
|
|
||||||
int yyi = 0;
|
|
||||||
while ((*yyp = *yyf) != '\0')
|
|
||||||
{
|
{
|
||||||
if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
|
char *yyp = *yymsg;
|
||||||
|
int yyi = 0;
|
||||||
|
while ((*yyp = *yyformat) != '\0')
|
||||||
|
if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
|
||||||
{
|
{
|
||||||
yyp += yytnamerr (yyp, yyarg[yyi++]);
|
yyp += yytnamerr (yyp, yyarg[yyi++]);
|
||||||
yyf += 2;
|
yyformat += 2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
yyp++;
|
yyp++;
|
||||||
yyf++;
|
yyformat++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
return 0;
|
||||||
return yysize;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif /* YYERROR_VERBOSE */
|
#endif /* YYERROR_VERBOSE */
|
||||||
|
|
||||||
|
|
||||||
/*-----------------------------------------------.
|
/*-----------------------------------------------.
|
||||||
| Release the memory associated to this symbol. |
|
| Release the memory associated to this symbol. |
|
||||||
@ -1341,6 +1365,7 @@ yydestruct (yymsg, yytype, yyvaluep)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Prevent warnings from -Wmissing-prototypes. */
|
/* Prevent warnings from -Wmissing-prototypes. */
|
||||||
#ifdef YYPARSE_PARAM
|
#ifdef YYPARSE_PARAM
|
||||||
#if defined __STDC__ || defined __cplusplus
|
#if defined __STDC__ || defined __cplusplus
|
||||||
@ -1367,10 +1392,9 @@ YYSTYPE yylval;
|
|||||||
int yynerrs;
|
int yynerrs;
|
||||||
|
|
||||||
|
|
||||||
|
/*----------.
|
||||||
/*-------------------------.
|
| yyparse. |
|
||||||
| yyparse or yypush_parse. |
|
`----------*/
|
||||||
`-------------------------*/
|
|
||||||
|
|
||||||
#ifdef YYPARSE_PARAM
|
#ifdef YYPARSE_PARAM
|
||||||
#if (defined __STDC__ || defined __C99__FUNC__ \
|
#if (defined __STDC__ || defined __C99__FUNC__ \
|
||||||
@ -1394,8 +1418,6 @@ yyparse ()
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
int yystate;
|
int yystate;
|
||||||
/* Number of tokens to shift before error messages enabled. */
|
/* Number of tokens to shift before error messages enabled. */
|
||||||
int yyerrstatus;
|
int yyerrstatus;
|
||||||
@ -1550,7 +1572,7 @@ yybackup:
|
|||||||
|
|
||||||
/* First try to decide what to do without reference to lookahead token. */
|
/* First try to decide what to do without reference to lookahead token. */
|
||||||
yyn = yypact[yystate];
|
yyn = yypact[yystate];
|
||||||
if (yyn == YYPACT_NINF)
|
if (yypact_value_is_default (yyn))
|
||||||
goto yydefault;
|
goto yydefault;
|
||||||
|
|
||||||
/* Not known => get a lookahead token if don't already have one. */
|
/* Not known => get a lookahead token if don't already have one. */
|
||||||
@ -1581,7 +1603,7 @@ yybackup:
|
|||||||
yyn = yytable[yyn];
|
yyn = yytable[yyn];
|
||||||
if (yyn <= 0)
|
if (yyn <= 0)
|
||||||
{
|
{
|
||||||
if (yyn == 0 || yyn == YYTABLE_NINF)
|
if (yytable_value_is_error (yyn))
|
||||||
goto yyerrlab;
|
goto yyerrlab;
|
||||||
yyn = -yyn;
|
yyn = -yyn;
|
||||||
goto yyreduce;
|
goto yyreduce;
|
||||||
@ -1637,34 +1659,34 @@ yyreduce:
|
|||||||
{
|
{
|
||||||
case 10:
|
case 10:
|
||||||
|
|
||||||
{ zconf_error("unexpected end statement"); ;}
|
{ zconf_error("unexpected end statement"); }
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 11:
|
case 11:
|
||||||
|
|
||||||
{ zconf_error("unknown statement \"%s\"", (yyvsp[(2) - (4)].string)); ;}
|
{ zconf_error("unknown statement \"%s\"", (yyvsp[(2) - (4)].string)); }
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 12:
|
case 12:
|
||||||
|
|
||||||
{
|
{
|
||||||
zconf_error("unexpected option \"%s\"", kconf_id_strings + (yyvsp[(2) - (4)].id)->name);
|
zconf_error("unexpected option \"%s\"", kconf_id_strings + (yyvsp[(2) - (4)].id)->name);
|
||||||
;}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 13:
|
case 13:
|
||||||
|
|
||||||
{ zconf_error("invalid statement"); ;}
|
{ zconf_error("invalid statement"); }
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 28:
|
case 28:
|
||||||
|
|
||||||
{ zconf_error("unknown option \"%s\"", (yyvsp[(1) - (3)].string)); ;}
|
{ zconf_error("unknown option \"%s\"", (yyvsp[(1) - (3)].string)); }
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 29:
|
case 29:
|
||||||
|
|
||||||
{ zconf_error("invalid option"); ;}
|
{ zconf_error("invalid option"); }
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 30:
|
case 30:
|
||||||
@ -1674,7 +1696,7 @@ yyreduce:
|
|||||||
sym->flags |= SYMBOL_OPTIONAL;
|
sym->flags |= SYMBOL_OPTIONAL;
|
||||||
menu_add_entry(sym);
|
menu_add_entry(sym);
|
||||||
printd(DEBUG_PARSE, "%s:%d:config %s\n", zconf_curname(), zconf_lineno(), (yyvsp[(2) - (3)].string));
|
printd(DEBUG_PARSE, "%s:%d:config %s\n", zconf_curname(), zconf_lineno(), (yyvsp[(2) - (3)].string));
|
||||||
;}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 31:
|
case 31:
|
||||||
@ -1682,7 +1704,7 @@ yyreduce:
|
|||||||
{
|
{
|
||||||
menu_end_entry();
|
menu_end_entry();
|
||||||
printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
|
printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
|
||||||
;}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 32:
|
case 32:
|
||||||
@ -1692,7 +1714,7 @@ yyreduce:
|
|||||||
sym->flags |= SYMBOL_OPTIONAL;
|
sym->flags |= SYMBOL_OPTIONAL;
|
||||||
menu_add_entry(sym);
|
menu_add_entry(sym);
|
||||||
printd(DEBUG_PARSE, "%s:%d:menuconfig %s\n", zconf_curname(), zconf_lineno(), (yyvsp[(2) - (3)].string));
|
printd(DEBUG_PARSE, "%s:%d:menuconfig %s\n", zconf_curname(), zconf_lineno(), (yyvsp[(2) - (3)].string));
|
||||||
;}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 33:
|
case 33:
|
||||||
@ -1704,7 +1726,7 @@ yyreduce:
|
|||||||
zconfprint("warning: menuconfig statement without prompt");
|
zconfprint("warning: menuconfig statement without prompt");
|
||||||
menu_end_entry();
|
menu_end_entry();
|
||||||
printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
|
printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
|
||||||
;}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 41:
|
case 41:
|
||||||
@ -1714,7 +1736,7 @@ yyreduce:
|
|||||||
printd(DEBUG_PARSE, "%s:%d:type(%u)\n",
|
printd(DEBUG_PARSE, "%s:%d:type(%u)\n",
|
||||||
zconf_curname(), zconf_lineno(),
|
zconf_curname(), zconf_lineno(),
|
||||||
(yyvsp[(1) - (3)].id)->stype);
|
(yyvsp[(1) - (3)].id)->stype);
|
||||||
;}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 42:
|
case 42:
|
||||||
@ -1722,7 +1744,7 @@ yyreduce:
|
|||||||
{
|
{
|
||||||
menu_add_prompt(P_PROMPT, (yyvsp[(2) - (4)].string), (yyvsp[(3) - (4)].expr));
|
menu_add_prompt(P_PROMPT, (yyvsp[(2) - (4)].string), (yyvsp[(3) - (4)].expr));
|
||||||
printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
|
printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
|
||||||
;}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 43:
|
case 43:
|
||||||
@ -1734,7 +1756,7 @@ yyreduce:
|
|||||||
printd(DEBUG_PARSE, "%s:%d:default(%u)\n",
|
printd(DEBUG_PARSE, "%s:%d:default(%u)\n",
|
||||||
zconf_curname(), zconf_lineno(),
|
zconf_curname(), zconf_lineno(),
|
||||||
(yyvsp[(1) - (4)].id)->stype);
|
(yyvsp[(1) - (4)].id)->stype);
|
||||||
;}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 44:
|
case 44:
|
||||||
@ -1742,7 +1764,7 @@ yyreduce:
|
|||||||
{
|
{
|
||||||
menu_add_symbol(P_SELECT, sym_lookup((yyvsp[(2) - (4)].string), 0), (yyvsp[(3) - (4)].expr));
|
menu_add_symbol(P_SELECT, sym_lookup((yyvsp[(2) - (4)].string), 0), (yyvsp[(3) - (4)].expr));
|
||||||
printd(DEBUG_PARSE, "%s:%d:select\n", zconf_curname(), zconf_lineno());
|
printd(DEBUG_PARSE, "%s:%d:select\n", zconf_curname(), zconf_lineno());
|
||||||
;}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 45:
|
case 45:
|
||||||
@ -1750,7 +1772,7 @@ yyreduce:
|
|||||||
{
|
{
|
||||||
menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,(yyvsp[(2) - (5)].symbol), (yyvsp[(3) - (5)].symbol)), (yyvsp[(4) - (5)].expr));
|
menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,(yyvsp[(2) - (5)].symbol), (yyvsp[(3) - (5)].symbol)), (yyvsp[(4) - (5)].expr));
|
||||||
printd(DEBUG_PARSE, "%s:%d:range\n", zconf_curname(), zconf_lineno());
|
printd(DEBUG_PARSE, "%s:%d:range\n", zconf_curname(), zconf_lineno());
|
||||||
;}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 48:
|
case 48:
|
||||||
@ -1762,17 +1784,17 @@ yyreduce:
|
|||||||
else
|
else
|
||||||
zconfprint("warning: ignoring unknown option %s", (yyvsp[(2) - (3)].string));
|
zconfprint("warning: ignoring unknown option %s", (yyvsp[(2) - (3)].string));
|
||||||
free((yyvsp[(2) - (3)].string));
|
free((yyvsp[(2) - (3)].string));
|
||||||
;}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 49:
|
case 49:
|
||||||
|
|
||||||
{ (yyval.string) = NULL; ;}
|
{ (yyval.string) = NULL; }
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 50:
|
case 50:
|
||||||
|
|
||||||
{ (yyval.string) = (yyvsp[(2) - (2)].string); ;}
|
{ (yyval.string) = (yyvsp[(2) - (2)].string); }
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 51:
|
case 51:
|
||||||
@ -1783,14 +1805,14 @@ yyreduce:
|
|||||||
menu_add_entry(sym);
|
menu_add_entry(sym);
|
||||||
menu_add_expr(P_CHOICE, NULL, NULL);
|
menu_add_expr(P_CHOICE, NULL, NULL);
|
||||||
printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno());
|
printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno());
|
||||||
;}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 52:
|
case 52:
|
||||||
|
|
||||||
{
|
{
|
||||||
(yyval.menu) = menu_add_menu();
|
(yyval.menu) = menu_add_menu();
|
||||||
;}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 53:
|
case 53:
|
||||||
@ -1800,7 +1822,7 @@ yyreduce:
|
|||||||
menu_end_menu();
|
menu_end_menu();
|
||||||
printd(DEBUG_PARSE, "%s:%d:endchoice\n", zconf_curname(), zconf_lineno());
|
printd(DEBUG_PARSE, "%s:%d:endchoice\n", zconf_curname(), zconf_lineno());
|
||||||
}
|
}
|
||||||
;}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 61:
|
case 61:
|
||||||
@ -1808,7 +1830,7 @@ yyreduce:
|
|||||||
{
|
{
|
||||||
menu_add_prompt(P_PROMPT, (yyvsp[(2) - (4)].string), (yyvsp[(3) - (4)].expr));
|
menu_add_prompt(P_PROMPT, (yyvsp[(2) - (4)].string), (yyvsp[(3) - (4)].expr));
|
||||||
printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
|
printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
|
||||||
;}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 62:
|
case 62:
|
||||||
@ -1821,7 +1843,7 @@ yyreduce:
|
|||||||
(yyvsp[(1) - (3)].id)->stype);
|
(yyvsp[(1) - (3)].id)->stype);
|
||||||
} else
|
} else
|
||||||
YYERROR;
|
YYERROR;
|
||||||
;}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 63:
|
case 63:
|
||||||
@ -1829,7 +1851,7 @@ yyreduce:
|
|||||||
{
|
{
|
||||||
current_entry->sym->flags |= SYMBOL_OPTIONAL;
|
current_entry->sym->flags |= SYMBOL_OPTIONAL;
|
||||||
printd(DEBUG_PARSE, "%s:%d:optional\n", zconf_curname(), zconf_lineno());
|
printd(DEBUG_PARSE, "%s:%d:optional\n", zconf_curname(), zconf_lineno());
|
||||||
;}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 64:
|
case 64:
|
||||||
@ -1841,7 +1863,7 @@ yyreduce:
|
|||||||
zconf_curname(), zconf_lineno());
|
zconf_curname(), zconf_lineno());
|
||||||
} else
|
} else
|
||||||
YYERROR;
|
YYERROR;
|
||||||
;}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 67:
|
case 67:
|
||||||
@ -1851,7 +1873,7 @@ yyreduce:
|
|||||||
menu_add_entry(NULL);
|
menu_add_entry(NULL);
|
||||||
menu_add_dep((yyvsp[(2) - (3)].expr));
|
menu_add_dep((yyvsp[(2) - (3)].expr));
|
||||||
(yyval.menu) = menu_add_menu();
|
(yyval.menu) = menu_add_menu();
|
||||||
;}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 68:
|
case 68:
|
||||||
@ -1861,14 +1883,14 @@ yyreduce:
|
|||||||
menu_end_menu();
|
menu_end_menu();
|
||||||
printd(DEBUG_PARSE, "%s:%d:endif\n", zconf_curname(), zconf_lineno());
|
printd(DEBUG_PARSE, "%s:%d:endif\n", zconf_curname(), zconf_lineno());
|
||||||
}
|
}
|
||||||
;}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 74:
|
case 74:
|
||||||
|
|
||||||
{
|
{
|
||||||
menu_add_prompt(P_MENU, (yyvsp[(2) - (3)].string), NULL);
|
menu_add_prompt(P_MENU, (yyvsp[(2) - (3)].string), NULL);
|
||||||
;}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 75:
|
case 75:
|
||||||
@ -1877,14 +1899,14 @@ yyreduce:
|
|||||||
menu_add_entry(NULL);
|
menu_add_entry(NULL);
|
||||||
menu_add_prompt(P_MENU, (yyvsp[(2) - (3)].string), NULL);
|
menu_add_prompt(P_MENU, (yyvsp[(2) - (3)].string), NULL);
|
||||||
printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno());
|
printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno());
|
||||||
;}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 76:
|
case 76:
|
||||||
|
|
||||||
{
|
{
|
||||||
(yyval.menu) = menu_add_menu();
|
(yyval.menu) = menu_add_menu();
|
||||||
;}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 77:
|
case 77:
|
||||||
@ -1894,7 +1916,7 @@ yyreduce:
|
|||||||
menu_end_menu();
|
menu_end_menu();
|
||||||
printd(DEBUG_PARSE, "%s:%d:endmenu\n", zconf_curname(), zconf_lineno());
|
printd(DEBUG_PARSE, "%s:%d:endmenu\n", zconf_curname(), zconf_lineno());
|
||||||
}
|
}
|
||||||
;}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 83:
|
case 83:
|
||||||
@ -1902,7 +1924,7 @@ yyreduce:
|
|||||||
{
|
{
|
||||||
printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), (yyvsp[(2) - (3)].string));
|
printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), (yyvsp[(2) - (3)].string));
|
||||||
zconf_nextfile((yyvsp[(2) - (3)].string));
|
zconf_nextfile((yyvsp[(2) - (3)].string));
|
||||||
;}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 84:
|
case 84:
|
||||||
@ -1911,14 +1933,14 @@ yyreduce:
|
|||||||
menu_add_entry(NULL);
|
menu_add_entry(NULL);
|
||||||
menu_add_prompt(P_COMMENT, (yyvsp[(2) - (3)].string), NULL);
|
menu_add_prompt(P_COMMENT, (yyvsp[(2) - (3)].string), NULL);
|
||||||
printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno());
|
printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno());
|
||||||
;}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 85:
|
case 85:
|
||||||
|
|
||||||
{
|
{
|
||||||
menu_end_entry();
|
menu_end_entry();
|
||||||
;}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 86:
|
case 86:
|
||||||
@ -1926,14 +1948,14 @@ yyreduce:
|
|||||||
{
|
{
|
||||||
printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno());
|
printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno());
|
||||||
zconf_starthelp();
|
zconf_starthelp();
|
||||||
;}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 87:
|
case 87:
|
||||||
|
|
||||||
{
|
{
|
||||||
current_entry->help = (yyvsp[(2) - (2)].string);
|
current_entry->help = (yyvsp[(2) - (2)].string);
|
||||||
;}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 92:
|
case 92:
|
||||||
@ -1941,102 +1963,113 @@ yyreduce:
|
|||||||
{
|
{
|
||||||
menu_add_dep((yyvsp[(3) - (4)].expr));
|
menu_add_dep((yyvsp[(3) - (4)].expr));
|
||||||
printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno());
|
printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno());
|
||||||
;}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 96:
|
case 96:
|
||||||
|
|
||||||
{
|
{
|
||||||
menu_add_visibility((yyvsp[(2) - (2)].expr));
|
menu_add_visibility((yyvsp[(2) - (2)].expr));
|
||||||
;}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 98:
|
case 98:
|
||||||
|
|
||||||
{
|
{
|
||||||
menu_add_prompt(P_PROMPT, (yyvsp[(1) - (2)].string), (yyvsp[(2) - (2)].expr));
|
menu_add_prompt(P_PROMPT, (yyvsp[(1) - (2)].string), (yyvsp[(2) - (2)].expr));
|
||||||
;}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 101:
|
case 101:
|
||||||
|
|
||||||
{ (yyval.id) = (yyvsp[(1) - (2)].id); ;}
|
{ (yyval.id) = (yyvsp[(1) - (2)].id); }
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 102:
|
case 102:
|
||||||
|
|
||||||
{ (yyval.id) = (yyvsp[(1) - (2)].id); ;}
|
{ (yyval.id) = (yyvsp[(1) - (2)].id); }
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 103:
|
case 103:
|
||||||
|
|
||||||
{ (yyval.id) = (yyvsp[(1) - (2)].id); ;}
|
{ (yyval.id) = (yyvsp[(1) - (2)].id); }
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 106:
|
case 106:
|
||||||
|
|
||||||
{ (yyval.expr) = NULL; ;}
|
{ (yyval.expr) = NULL; }
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 107:
|
case 107:
|
||||||
|
|
||||||
{ (yyval.expr) = (yyvsp[(2) - (2)].expr); ;}
|
{ (yyval.expr) = (yyvsp[(2) - (2)].expr); }
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 108:
|
case 108:
|
||||||
|
|
||||||
{ (yyval.expr) = expr_alloc_symbol((yyvsp[(1) - (1)].symbol)); ;}
|
{ (yyval.expr) = expr_alloc_symbol((yyvsp[(1) - (1)].symbol)); }
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 109:
|
case 109:
|
||||||
|
|
||||||
{ (yyval.expr) = expr_alloc_comp(E_EQUAL, (yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol)); ;}
|
{ (yyval.expr) = expr_alloc_comp(E_EQUAL, (yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol)); }
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 110:
|
case 110:
|
||||||
|
|
||||||
{ (yyval.expr) = expr_alloc_comp(E_UNEQUAL, (yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol)); ;}
|
{ (yyval.expr) = expr_alloc_comp(E_UNEQUAL, (yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol)); }
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 111:
|
case 111:
|
||||||
|
|
||||||
{ (yyval.expr) = (yyvsp[(2) - (3)].expr); ;}
|
{ (yyval.expr) = (yyvsp[(2) - (3)].expr); }
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 112:
|
case 112:
|
||||||
|
|
||||||
{ (yyval.expr) = expr_alloc_one(E_NOT, (yyvsp[(2) - (2)].expr)); ;}
|
{ (yyval.expr) = expr_alloc_one(E_NOT, (yyvsp[(2) - (2)].expr)); }
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 113:
|
case 113:
|
||||||
|
|
||||||
{ (yyval.expr) = expr_alloc_two(E_OR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
|
{ (yyval.expr) = expr_alloc_two(E_OR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 114:
|
case 114:
|
||||||
|
|
||||||
{ (yyval.expr) = expr_alloc_two(E_AND, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
|
{ (yyval.expr) = expr_alloc_two(E_AND, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 115:
|
case 115:
|
||||||
|
|
||||||
{ (yyval.symbol) = sym_lookup((yyvsp[(1) - (1)].string), 0); free((yyvsp[(1) - (1)].string)); ;}
|
{ (yyval.symbol) = sym_lookup((yyvsp[(1) - (1)].string), 0); free((yyvsp[(1) - (1)].string)); }
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 116:
|
case 116:
|
||||||
|
|
||||||
{ (yyval.symbol) = sym_lookup((yyvsp[(1) - (1)].string), SYMBOL_CONST); free((yyvsp[(1) - (1)].string)); ;}
|
{ (yyval.symbol) = sym_lookup((yyvsp[(1) - (1)].string), SYMBOL_CONST); free((yyvsp[(1) - (1)].string)); }
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 117:
|
case 117:
|
||||||
|
|
||||||
{ (yyval.string) = NULL; ;}
|
{ (yyval.string) = NULL; }
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
/* User semantic actions sometimes alter yychar, and that requires
|
||||||
|
that yytoken be updated with the new translation. We take the
|
||||||
|
approach of translating immediately before every use of yytoken.
|
||||||
|
One alternative is translating here after every semantic action,
|
||||||
|
but that translation would be missed if the semantic action invokes
|
||||||
|
YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
|
||||||
|
if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
|
||||||
|
incorrect destructor might then be invoked immediately. In the
|
||||||
|
case of YYERROR or YYBACKUP, subsequent parser actions might lead
|
||||||
|
to an incorrect destructor call or verbose syntax error message
|
||||||
|
before the lookahead is translated. */
|
||||||
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
|
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
|
||||||
|
|
||||||
YYPOPSTACK (yylen);
|
YYPOPSTACK (yylen);
|
||||||
@ -2064,6 +2097,10 @@ yyreduce:
|
|||||||
| yyerrlab -- here on detecting error |
|
| yyerrlab -- here on detecting error |
|
||||||
`------------------------------------*/
|
`------------------------------------*/
|
||||||
yyerrlab:
|
yyerrlab:
|
||||||
|
/* Make sure we have latest lookahead translation. See comments at
|
||||||
|
user semantic actions for why this is necessary. */
|
||||||
|
yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
|
||||||
|
|
||||||
/* If not already recovering from an error, report this error. */
|
/* If not already recovering from an error, report this error. */
|
||||||
if (!yyerrstatus)
|
if (!yyerrstatus)
|
||||||
{
|
{
|
||||||
@ -2071,37 +2108,36 @@ yyerrlab:
|
|||||||
#if ! YYERROR_VERBOSE
|
#if ! YYERROR_VERBOSE
|
||||||
yyerror (YY_("syntax error"));
|
yyerror (YY_("syntax error"));
|
||||||
#else
|
#else
|
||||||
|
# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
|
||||||
|
yyssp, yytoken)
|
||||||
{
|
{
|
||||||
YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
|
char const *yymsgp = YY_("syntax error");
|
||||||
if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
|
int yysyntax_error_status;
|
||||||
|
yysyntax_error_status = YYSYNTAX_ERROR;
|
||||||
|
if (yysyntax_error_status == 0)
|
||||||
|
yymsgp = yymsg;
|
||||||
|
else if (yysyntax_error_status == 1)
|
||||||
{
|
{
|
||||||
YYSIZE_T yyalloc = 2 * yysize;
|
|
||||||
if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
|
|
||||||
yyalloc = YYSTACK_ALLOC_MAXIMUM;
|
|
||||||
if (yymsg != yymsgbuf)
|
if (yymsg != yymsgbuf)
|
||||||
YYSTACK_FREE (yymsg);
|
YYSTACK_FREE (yymsg);
|
||||||
yymsg = (char *) YYSTACK_ALLOC (yyalloc);
|
yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
|
||||||
if (yymsg)
|
if (!yymsg)
|
||||||
yymsg_alloc = yyalloc;
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
yymsg = yymsgbuf;
|
yymsg = yymsgbuf;
|
||||||
yymsg_alloc = sizeof yymsgbuf;
|
yymsg_alloc = sizeof yymsgbuf;
|
||||||
}
|
yysyntax_error_status = 2;
|
||||||
}
|
|
||||||
|
|
||||||
if (0 < yysize && yysize <= yymsg_alloc)
|
|
||||||
{
|
|
||||||
(void) yysyntax_error (yymsg, yystate, yychar);
|
|
||||||
yyerror (yymsg);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
yyerror (YY_("syntax error"));
|
yysyntax_error_status = YYSYNTAX_ERROR;
|
||||||
if (yysize != 0)
|
yymsgp = yymsg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
yyerror (yymsgp);
|
||||||
|
if (yysyntax_error_status == 2)
|
||||||
goto yyexhaustedlab;
|
goto yyexhaustedlab;
|
||||||
}
|
}
|
||||||
}
|
# undef YYSYNTAX_ERROR
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2160,7 +2196,7 @@ yyerrlab1:
|
|||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
yyn = yypact[yystate];
|
yyn = yypact[yystate];
|
||||||
if (yyn != YYPACT_NINF)
|
if (!yypact_value_is_default (yyn))
|
||||||
{
|
{
|
||||||
yyn += YYTERROR;
|
yyn += YYTERROR;
|
||||||
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
|
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
|
||||||
@ -2219,8 +2255,13 @@ yyexhaustedlab:
|
|||||||
|
|
||||||
yyreturn:
|
yyreturn:
|
||||||
if (yychar != YYEMPTY)
|
if (yychar != YYEMPTY)
|
||||||
|
{
|
||||||
|
/* Make sure we have latest lookahead translation. See comments at
|
||||||
|
user semantic actions for why this is necessary. */
|
||||||
|
yytoken = YYTRANSLATE (yychar);
|
||||||
yydestruct ("Cleanup: discarding lookahead",
|
yydestruct ("Cleanup: discarding lookahead",
|
||||||
yytoken, &yylval);
|
yytoken, &yylval);
|
||||||
|
}
|
||||||
/* Do not reclaim the symbols of the rule which action triggered
|
/* Do not reclaim the symbols of the rule which action triggered
|
||||||
this YYABORT or YYACCEPT. */
|
this YYABORT or YYACCEPT. */
|
||||||
YYPOPSTACK (yylen);
|
YYPOPSTACK (yylen);
|
||||||
@ -2256,9 +2297,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, "Buildroot Configuration", NULL);
|
rootmenu.prompt = menu_add_prompt(P_MENU, "Buildroot Configuration", NULL);
|
||||||
|
|
||||||
if (getenv("ZCONF_DEBUG"))
|
if (getenv("ZCONF_DEBUG"))
|
||||||
@ -2266,12 +2304,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);
|
||||||
|
@ -493,9 +493,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, "Buildroot Configuration", NULL);
|
rootmenu.prompt = menu_add_prompt(P_MENU, "Buildroot Configuration", NULL);
|
||||||
|
|
||||||
if (getenv("ZCONF_DEBUG"))
|
if (getenv("ZCONF_DEBUG"))
|
||||||
@ -503,12 +500,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…
x
Reference in New Issue
Block a user