Commit 386ebbf2 authored by Roman Zippel's avatar Roman Zippel Committed by Ben Collins

[PATCH] expression support

"default" accepts now not only a single symbol but also an expression
which can be assigned to boolean and tristate symbols.
parent d4f8a453
......@@ -198,21 +198,21 @@ int conf_read(const char *name)
;
}
if (sym_is_choice_value(sym)) {
prop = sym_get_choice_prop(sym);
struct symbol *cs = prop_get_symbol(sym_get_choice_prop(sym));
switch (sym->user.tri) {
case mod:
if (prop->def->user.tri == yes)
if (cs->user.tri == yes)
/* warn? */;
break;
case yes:
if (prop->def->user.tri != no)
if (cs->user.tri != no)
/* warn? */;
prop->def->user.val = sym;
cs->user.val = sym;
break;
case no:
break;
}
prop->def->user.tri = sym->user.tri;
cs->user.tri = sym->user.tri;
}
break;
case '\n':
......
......@@ -105,7 +105,6 @@ struct property {
struct symbol *sym;
enum prop_type type;
const char *text;
struct symbol *def;
struct expr_value visible;
struct expr *expr;
struct menu *menu;
......
......@@ -49,9 +49,11 @@ void menu_add_menu(void);
void menu_end_menu(void);
void menu_add_entry(struct symbol *sym);
void menu_end_entry(void);
struct property *create_prop(enum prop_type type);
void menu_add_dep(struct expr *dep);
struct property *menu_add_prop(enum prop_type type, char *prompt, struct symbol *def, struct expr *dep);
struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *expr, struct expr *dep);
void menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep);
void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep);
void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep);
void menu_finalize(struct menu *parent);
void menu_set_type(int type);
struct file *file_lookup(const char *name);
......@@ -64,6 +66,9 @@ extern struct menu *current_menu;
void sym_init(void);
void sym_clear_all_valid(void);
void sym_set_changed(struct symbol *sym);
struct symbol *sym_check_deps(struct symbol *sym);
struct property *prop_alloc(enum prop_type type, struct symbol *sym);
struct symbol *prop_get_symbol(struct property *prop);
static inline tristate sym_get_tristate_value(struct symbol *sym)
{
......
......@@ -99,38 +99,20 @@ void menu_set_type(int type)
sym->name ? sym->name : "<choice>", sym_type_name(sym->type), sym_type_name(type));
}
struct property *create_prop(enum prop_type type)
struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *expr, struct expr *dep)
{
struct property *prop;
prop = malloc(sizeof(*prop));
memset(prop, 0, sizeof(*prop));
prop->type = type;
prop->file = current_file;
prop->lineno = zconf_lineno();
return prop;
}
struct property *prop = prop_alloc(type, current_entry->sym);
struct property *menu_add_prop(enum prop_type type, char *prompt, struct symbol *def, struct expr *dep)
{
struct property *prop = create_prop(type);
struct property **propp;
prop->sym = current_entry->sym;
prop->menu = current_entry;
prop->text = prompt;
prop->def = def;
prop->expr = expr;
prop->visible.expr = menu_check_dep(dep);
if (prompt)
if (prompt) {
if (current_entry->prompt)
fprintf(stderr, "%s:%d: prompt redefined\n",
current_entry->file->name, current_entry->lineno);
current_entry->prompt = prop;
/* append property to the prop list of symbol */
if (prop->sym) {
for (propp = &prop->sym->prop; *propp; propp = &(*propp)->next)
;
*propp = prop;
}
return prop;
......@@ -138,12 +120,17 @@ struct property *menu_add_prop(enum prop_type type, char *prompt, struct symbol
void menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep)
{
current_entry->prompt = menu_add_prop(type, prompt, NULL, dep);
menu_add_prop(type, prompt, NULL, dep);
}
void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep)
{
menu_add_prop(type, NULL, expr, dep);
}
void menu_add_default(enum prop_type type, struct symbol *def, struct expr *dep)
void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep)
{
current_entry->prompt = menu_add_prop(type, NULL, def, dep);
menu_add_prop(type, NULL, expr_alloc_symbol(sym), dep);
}
void menu_finalize(struct menu *parent)
......@@ -231,8 +218,8 @@ void menu_finalize(struct menu *parent)
menu->sym->flags |= SYMBOL_CHOICEVAL;
current_entry = menu;
menu_set_type(sym->type);
menu_add_prop(P_CHOICE, NULL, parent->sym, NULL);
prop = sym_get_choice_prop(parent->sym);
menu_add_symbol(P_CHOICE, sym, NULL);
prop = sym_get_choice_prop(sym);
prop->expr = expr_alloc_one(E_CHOICE, prop->expr);
prop->expr->right.sym = menu->sym;
}
......
......@@ -34,18 +34,9 @@ struct symbol *modules_sym;
void sym_add_default(struct symbol *sym, const char *def)
{
struct property *prop = create_prop(P_DEFAULT);
struct property **propp;
prop->sym = sym;
prop->def = sym_lookup(def, 1);
struct property *prop = prop_alloc(P_DEFAULT, sym);
/* append property to the prop list of symbol */
if (prop->sym) {
for (propp = &prop->sym->prop; *propp; propp = &(*propp)->next)
;
*propp = prop;
}
prop->expr = expr_alloc_symbol(sym_lookup(def, 1));
}
void sym_init(void)
......@@ -139,7 +130,7 @@ struct property *sym_get_default_prop(struct symbol *sym)
return NULL;
}
void sym_calc_visibility(struct symbol *sym)
static void sym_calc_visibility(struct symbol *sym)
{
struct property *prop;
tristate visible, oldvisible;
......@@ -157,11 +148,46 @@ void sym_calc_visibility(struct symbol *sym)
}
}
static struct symbol *sym_calc_choice(struct symbol *sym)
{
struct symbol *def_sym;
struct property *prop;
struct expr *e;
/* is the user choice visible? */
def_sym = sym->user.val;
if (def_sym) {
sym_calc_visibility(def_sym);
if (def_sym->visible != no)
return def_sym;
}
/* any of the defaults visible? */
for_all_defaults(sym, prop) {
prop->visible.tri = expr_calc_value(prop->visible.expr);
if (prop->visible.tri == no)
continue;
def_sym = prop_get_symbol(prop);
sym_calc_visibility(def_sym);
if (def_sym->visible != no)
return def_sym;
}
/* just get the first visible value */
prop = sym_get_choice_prop(sym);
for (e = prop->expr; e; e = e->left.expr) {
def_sym = e->right.sym;
sym_calc_visibility(def_sym);
if (def_sym->visible != no)
return def_sym;
}
return NULL;
}
void sym_calc_value(struct symbol *sym)
{
struct symbol_value newval, oldval;
struct property *prop, *def_prop;
struct symbol *def_sym;
struct property *prop;
struct expr *e;
if (!sym)
......@@ -196,36 +222,56 @@ void sym_calc_value(struct symbol *sym)
/* set default if recursively called */
sym->curr = newval;
if (sym->visible != no) {
sym->flags |= SYMBOL_WRITE;
if (!sym_has_value(sym)) {
if (!sym_is_choice(sym)) {
prop = sym_get_default_prop(sym);
if (prop) {
sym_calc_value(prop->def);
newval = prop->def->curr;
}
} else
newval.tri = sym->user.tri;
} else
newval = sym->user;
newval.tri = E_AND(newval.tri, sym->visible);
/* if the symbol is visible and not optionial,
* possibly ignore old user choice. */
if (!sym_is_optional(sym) && newval.tri == no)
newval.tri = sym->visible;
switch (sym_get_type(sym)) {
case S_BOOLEAN:
case S_TRISTATE:
if (sym_is_choice_value(sym) && sym->visible == yes) {
prop = sym_get_choice_prop(sym);
newval.tri = (prop->def->curr.val == sym) ? yes : no;
newval.tri = (prop_get_symbol(prop)->curr.val == sym) ? yes : no;
} else if (sym->visible != no) {
sym->flags |= SYMBOL_WRITE;
if (sym_has_value(sym))
newval.tri = sym->user.tri;
else if (!sym_is_choice(sym)) {
prop = sym_get_default_prop(sym);
if (prop)
newval.tri = expr_calc_value(prop->expr);
}
newval.tri = E_AND(newval.tri, sym->visible);
/* if the symbol is visible and not optionial,
* possibly ignore old user choice. */
if (!sym_is_optional(sym) && newval.tri == no)
newval.tri = sym->visible;
} else if (!sym_is_choice(sym)) {
prop = sym_get_default_prop(sym);
if (prop) {
sym->flags |= SYMBOL_WRITE;
newval.tri = expr_calc_value(prop->expr);
}
}
break;
case S_STRING:
case S_HEX:
case S_INT:
if (sym->visible != no) {
sym->flags |= SYMBOL_WRITE;
if (sym_has_value(sym)) {
newval.val = sym->user.val;
break;
}
}
} else {
prop = sym_get_default_prop(sym);
if (prop) {
sym->flags |= SYMBOL_WRITE;
sym_calc_value(prop->def);
newval = prop->def->curr;
struct symbol *ds = prop_get_symbol(prop);
if (ds) {
sym->flags |= SYMBOL_WRITE;
sym_calc_value(ds);
newval.val = ds->curr.val;
}
}
break;
default:
;
}
switch (sym_get_type(sym)) {
......@@ -246,44 +292,11 @@ void sym_calc_value(struct symbol *sym)
out:
sym->curr = newval;
if (sym_is_choice(sym) && newval.tri == yes)
sym->curr.val = sym_calc_choice(sym);
if (sym_is_choice(sym) && newval.tri == yes) {
def_sym = sym->user.val;
if (def_sym) {
sym_calc_visibility(def_sym);
if (def_sym->visible == no)
def_sym = NULL;
}
if (!def_sym) {
for_all_defaults(sym, def_prop) {
def_prop->visible.tri = expr_calc_value(def_prop->visible.expr);
if (def_prop->visible.tri == no)
continue;
sym_calc_visibility(def_prop->def);
if (def_prop->def->visible != no) {
def_sym = def_prop->def;
break;
}
}
}
if (!def_sym) {
prop = sym_get_choice_prop(sym);
for (e = prop->expr; e; e = e->left.expr) {
sym_calc_visibility(e->right.sym);
if (e->right.sym->visible != no) {
def_sym = e->right.sym;
break;
}
}
}
newval.val = def_sym;
}
if (memcmp(&oldval, &newval, sizeof(newval)))
if (memcmp(&oldval, &sym->curr, sizeof(oldval)))
sym_set_changed(sym);
sym->curr = newval;
if (sym_is_choice(sym)) {
int flags = sym->flags & (SYMBOL_CHANGED | SYMBOL_WRITE);
......@@ -363,10 +376,10 @@ bool sym_set_tristate_value(struct symbol *sym, tristate val)
sym_set_changed(sym);
}
if (sym_is_choice_value(sym) && val == yes) {
struct property *prop = sym_get_choice_prop(sym);
struct symbol *cs = prop_get_symbol(sym_get_choice_prop(sym));
prop->def->user.val = sym;
prop->def->flags &= ~SYMBOL_NEW;
cs->user.val = sym;
cs->flags &= ~SYMBOL_NEW;
}
sym->user.tri = val;
......@@ -607,6 +620,36 @@ struct symbol *sym_find(const char *name)
return symbol;
}
struct property *prop_alloc(enum prop_type type, struct symbol *sym)
{
struct property *prop;
struct property **propp;
prop = malloc(sizeof(*prop));
memset(prop, 0, sizeof(*prop));
prop->type = type;
prop->sym = sym;
prop->file = current_file;
prop->lineno = zconf_lineno();
/* append property to the prop list of symbol */
if (sym) {
for (propp = &sym->prop; *propp; propp = &(*propp)->next)
;
*propp = prop;
}
return prop;
}
struct symbol *prop_get_symbol(struct property *prop)
{
if (prop->expr && (prop->expr->type == E_SYMBOL ||
prop->expr->type == E_CHOICE))
return prop->expr->left.sym;
return NULL;
}
const char *prop_get_type_name(enum prop_type type)
{
switch (type) {
......
......@@ -400,7 +400,7 @@ static const yysigned_char yyrhs[] =
81, 80, 32, -1, 23, 76, 32, -1, 24, 81,
80, 32, -1, 26, 76, 32, -1, 27, 76, 32,
-1, 25, 76, 32, -1, 19, 77, 80, 32, -1,
20, 82, 80, 32, -1, 36, 28, 80, 32, -1,
20, 81, 80, 32, -1, 36, 28, 80, 32, -1,
37, 82, 82, 80, 32, -1, 7, 32, -1, 52,
56, -1, 78, -1, 53, 58, 54, -1, 53, 58,
-1, -1, 56, 57, -1, 56, 75, -1, 56, 73,
......@@ -429,15 +429,15 @@ static const unsigned short yyrline[] =
{
0, 94, 94, 95, 98, 99, 100, 101, 102, 103,
104, 105, 109, 110, 111, 112, 113, 114, 120, 128,
134, 142, 152, 154, 155, 156, 157, 160, 166, 171,
177, 182, 188, 194, 200, 206, 212, 217, 224, 233,
239, 248, 249, 255, 257, 258, 259, 260, 263, 269,
275, 281, 287, 293, 295, 300, 309, 318, 319, 325,
327, 328, 329, 334, 341, 347, 356, 357, 363, 365,
366, 367, 368, 371, 377, 384, 391, 398, 404, 411,
412, 413, 416, 421, 426, 434, 436, 441, 442, 445,
446, 447, 451, 451, 453, 454, 457, 458, 459, 460,
461, 462, 463, 466, 467
134, 142, 152, 154, 155, 156, 157, 160, 166, 173,
179, 186, 192, 198, 204, 210, 216, 222, 230, 239,
245, 254, 255, 261, 263, 264, 265, 266, 269, 275,
281, 287, 293, 299, 301, 306, 315, 324, 325, 331,
333, 334, 335, 340, 347, 353, 362, 363, 369, 371,
372, 373, 374, 377, 383, 390, 397, 404, 410, 417,
418, 419, 422, 427, 432, 440, 442, 447, 448, 451,
452, 453, 457, 457, 459, 460, 463, 464, 465, 466,
467, 468, 469, 472, 473
};
#endif
......@@ -551,20 +551,20 @@ static const short yydefgoto[] =
#define YYPACT_NINF -99
static const short yypact[] =
{
-99, 48, -99, -12, 46, 46, -99, 46, -29, -99,
-99, 48, -99, 38, 46, 46, -99, 46, -29, -99,
46, -17, -3, -11, -99, -99, -99, -99, -99, -99,
-99, -99, -99, -99, -99, -99, -99, -99, -99, -99,
-99, -99, -99, -99, -99, -99, -99, -99, -99, -12,
-99, -99, -99, -99, -99, -99, -99, -99, -99, 38,
12, 15, -99, 18, 51, 62, -99, -99, -11, -11,
4, -24, 138, 138, 160, 121, 110, -4, 81, -4,
-99, -99, -99, -99, -99, -99, 31, -99, -99, -11,
-11, 70, 70, 73, 32, -11, 46, 70, 46, -11,
46, -11, 46, 46, 46, -99, 80, 70, -99, 16,
-99, -99, -99, -99, -99, -99, -19, -99, -99, -11,
-11, 70, 70, 73, 32, -11, 46, -11, 46, -11,
46, -11, 46, 46, 46, -99, 36, 70, -99, 95,
-99, -99, 96, 46, 106, 46, 46, -99, -99, -99,
-99, -12, -12, -12, -99, -99, -99, -99, -99, -99,
-99, 38, 38, 38, -99, -99, -99, -99, -99, -99,
-99, -99, -99, -99, 112, -99, -99, -99, -99, -99,
-99, 117, -99, -99, -99, -99, -11, 33, 65, 131,
131, 119, 131, 1, 136, 1, 153, 154, 155, 131,
1, 119, 131, 1, 136, 1, 153, 154, 155, 131,
70, -99, -99, 131, 131, 156, 157, -99, -99, -99,
-99, 101, -99, -99, -11, 158, 159, -99, -99, 161,
-99, 162, -99, -99, -99, 163, 131, 164, 165, -99,
......@@ -590,16 +590,16 @@ static const short yypgoto[] =
static const short yytable[] =
{
66, 67, 36, 42, 39, 40, 71, 41, 123, 124,
43, 44, 74, 75, 130, 154, 72, 46, 47, 15,
16, 121, 122, 48, 140, 45, 127, 128, 112, 141,
43, 44, 74, 75, 120, 154, 72, 46, 47, 69,
70, 121, 122, 48, 140, 45, 127, 128, 112, 130,
49, 133, 156, 135, 158, 159, 68, 161, 60, 69,
70, 165, 69, 70, 61, 167, 168, 62, 2, 3,
63, 4, 5, 6, 7, 8, 9, 10, 11, 12,
46, 47, 13, 14, 120, 152, 48, 126, 178, 69,
70, 69, 70, 49, 37, 38, 129, 166, 151, 15,
46, 47, 13, 14, 139, 152, 48, 126, 178, 15,
16, 69, 70, 49, 37, 38, 129, 166, 151, 15,
16, -67, 114, 64, -67, 5, 101, 7, 8, 102,
10, 11, 12, 143, 65, 13, 103, 153, 46, 47,
147, 148, 149, 69, 70, 125, 172, 134, 139, 136,
147, 148, 149, 69, 70, 125, 172, 134, 141, 136,
137, 138, 15, 16, 5, 101, 7, 8, 102, 10,
11, 12, 145, 146, 13, 103, 101, 7, 142, 102,
10, 11, 12, 171, 144, 13, 103, 69, 70, 69,
......@@ -615,16 +615,16 @@ static const short yytable[] =
static const unsigned char yycheck[] =
{
48, 49, 3, 32, 4, 5, 30, 7, 71, 72,
10, 28, 16, 17, 77, 14, 40, 28, 29, 31,
32, 69, 70, 34, 87, 28, 74, 75, 32, 13,
10, 28, 16, 17, 33, 14, 40, 28, 29, 38,
39, 69, 70, 34, 87, 28, 74, 75, 32, 77,
41, 79, 130, 81, 132, 133, 32, 135, 39, 38,
39, 139, 38, 39, 32, 143, 144, 32, 0, 1,
32, 3, 4, 5, 6, 7, 8, 9, 10, 11,
28, 29, 14, 15, 33, 32, 34, 35, 166, 38,
39, 38, 39, 41, 28, 29, 76, 140, 126, 31,
28, 29, 14, 15, 28, 32, 34, 35, 166, 31,
32, 38, 39, 41, 28, 29, 76, 140, 126, 31,
32, 0, 1, 32, 3, 4, 5, 6, 7, 8,
9, 10, 11, 93, 32, 14, 15, 32, 28, 29,
101, 102, 103, 38, 39, 32, 154, 80, 28, 82,
101, 102, 103, 38, 39, 32, 154, 80, 13, 82,
83, 84, 31, 32, 4, 5, 6, 7, 8, 9,
10, 11, 95, 96, 14, 15, 5, 6, 32, 8,
9, 10, 11, 32, 28, 14, 15, 38, 39, 38,
......@@ -654,7 +654,7 @@ static const unsigned char yystos[] =
75, 5, 8, 15, 45, 54, 78, 45, 55, 60,
66, 78, 32, 75, 1, 45, 55, 65, 66, 78,
33, 81, 81, 82, 82, 32, 35, 81, 81, 77,
82, 76, 77, 81, 76, 81, 76, 76, 76, 28,
81, 76, 77, 81, 76, 81, 76, 76, 76, 28,
82, 13, 32, 77, 28, 76, 76, 79, 79, 79,
32, 81, 32, 32, 14, 80, 80, 32, 80, 80,
32, 80, 32, 32, 32, 80, 82, 80, 80, 32,
......@@ -1340,6 +1340,8 @@ yyreduce:
case 28:
{
menu_add_expr(P_DEFAULT, yyvsp[-2].expr, yyvsp[-1].expr);
menu_set_type(S_TRISTATE);
printd(DEBUG_PARSE, "%s:%d:def_boolean\n", zconf_curname(), zconf_lineno());
;}
break;
......@@ -1355,6 +1357,8 @@ yyreduce:
case 30:
{
menu_add_expr(P_DEFAULT, yyvsp[-2].expr, yyvsp[-1].expr);
menu_set_type(S_BOOLEAN);
printd(DEBUG_PARSE, "%s:%d:def_boolean\n", zconf_curname(), zconf_lineno());
;}
break;
......@@ -1386,7 +1390,7 @@ yyreduce:
case 34:
{
menu_add_prop(P_PROMPT, yyvsp[-2].string, NULL, yyvsp[-1].expr);
menu_add_prompt(P_PROMPT, yyvsp[-2].string, yyvsp[-1].expr);
printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
;}
break;
......@@ -1394,7 +1398,7 @@ yyreduce:
case 35:
{
menu_add_prop(P_DEFAULT, NULL, yyvsp[-2].symbol, yyvsp[-1].expr);
menu_add_expr(P_DEFAULT, yyvsp[-2].expr, yyvsp[-1].expr);
printd(DEBUG_PARSE, "%s:%d:default\n", zconf_curname(), zconf_lineno());
;}
break;
......@@ -1419,7 +1423,7 @@ yyreduce:
struct symbol *sym = sym_lookup(NULL, 0);
sym->flags |= SYMBOL_CHOICE;
menu_add_entry(sym);
menu_add_prop(P_CHOICE, NULL, NULL, NULL);
menu_add_expr(P_CHOICE, NULL, NULL);
printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno());
;}
break;
......@@ -1453,7 +1457,7 @@ yyreduce:
case 48:
{
menu_add_prop(P_PROMPT, yyvsp[-2].string, NULL, yyvsp[-1].expr);
menu_add_prompt(P_PROMPT, yyvsp[-2].string, yyvsp[-1].expr);
printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
;}
break;
......@@ -1485,7 +1489,7 @@ yyreduce:
case 52:
{
menu_add_prop(P_DEFAULT, NULL, sym_lookup(yyvsp[-2].string, 0), yyvsp[-1].expr);
menu_add_symbol(P_DEFAULT, sym_lookup(yyvsp[-2].string, 0), yyvsp[-1].expr);
printd(DEBUG_PARSE, "%s:%d:default\n", zconf_curname(), zconf_lineno());
;}
break;
......@@ -2031,7 +2035,7 @@ void print_symbol(FILE *out, struct menu *menu)
break;
case P_DEFAULT:
fputs( " default ", out);
print_quoted_string(out, prop->def->name);
expr_fprint(prop->expr, out);
if (!expr_is_yes(prop->visible.expr)) {
fputs(" if ", out);
expr_fprint(prop->visible.expr, out);
......
......@@ -165,6 +165,8 @@ config_option: T_TRISTATE prompt_stmt_opt T_EOL
config_option: T_DEF_TRISTATE expr if_expr T_EOL
{
menu_add_expr(P_DEFAULT, $2, $3);
menu_set_type(S_TRISTATE);
printd(DEBUG_PARSE, "%s:%d:def_boolean\n", zconf_curname(), zconf_lineno());
};
......@@ -176,6 +178,8 @@ config_option: T_BOOLEAN prompt_stmt_opt T_EOL
config_option: T_DEF_BOOLEAN expr if_expr T_EOL
{
menu_add_expr(P_DEFAULT, $2, $3);
menu_set_type(S_BOOLEAN);
printd(DEBUG_PARSE, "%s:%d:def_boolean\n", zconf_curname(), zconf_lineno());
};
......@@ -199,13 +203,13 @@ config_option: T_STRING prompt_stmt_opt T_EOL
config_option: T_PROMPT prompt if_expr T_EOL
{
menu_add_prop(P_PROMPT, $2, NULL, $3);
menu_add_prompt(P_PROMPT, $2, $3);
printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
};
config_option: T_DEFAULT symbol if_expr T_EOL
config_option: T_DEFAULT expr if_expr T_EOL
{
menu_add_prop(P_DEFAULT, NULL, $2, $3);
menu_add_expr(P_DEFAULT, $2, $3);
printd(DEBUG_PARSE, "%s:%d:default\n", zconf_curname(), zconf_lineno());
};
......@@ -226,7 +230,7 @@ choice: T_CHOICE T_EOL
struct symbol *sym = sym_lookup(NULL, 0);
sym->flags |= SYMBOL_CHOICE;
menu_add_entry(sym);
menu_add_prop(P_CHOICE, NULL, NULL, NULL);
menu_add_expr(P_CHOICE, NULL, NULL);
printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno());
};
......@@ -262,7 +266,7 @@ choice_option_list:
choice_option: T_PROMPT prompt if_expr T_EOL
{
menu_add_prop(P_PROMPT, $2, NULL, $3);
menu_add_prompt(P_PROMPT, $2, $3);
printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
};
......@@ -286,7 +290,7 @@ choice_option: T_OPTIONAL T_EOL
choice_option: T_DEFAULT T_WORD if_expr T_EOL
{
menu_add_prop(P_DEFAULT, NULL, sym_lookup($2, 0), $3);
menu_add_symbol(P_DEFAULT, sym_lookup($2, 0), $3);
printd(DEBUG_PARSE, "%s:%d:default\n", zconf_curname(), zconf_lineno());
};
......@@ -593,7 +597,7 @@ void print_symbol(FILE *out, struct menu *menu)
break;
case P_DEFAULT:
fputs( " default ", out);
print_quoted_string(out, prop->def->name);
expr_fprint(prop->expr, out);
if (!expr_is_yes(prop->visible.expr)) {
fputs(" if ", out);
expr_fprint(prop->visible.expr, out);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment