Commit a900d0f6 authored by Roman Zippel's avatar Roman Zippel Committed by Ben Collins

[PATCH] Remove old code and macros

Remove old code and debugging macros which were used by the cml1->kconfig
converter.
parent 9683c74d
......@@ -35,25 +35,6 @@ static struct menu *rootEntry;
static char nohelp_text[] = "Sorry, no help available for this option yet.\n";
#if 0
static void printc(int ch)
{
static int sep = 0;
if (!sep) {
putchar('[');
sep = 1;
} else if (ch)
putchar('/');
if (!ch) {
putchar(']');
putchar(' ');
sep = 0;
} else
putchar(ch);
}
#endif
static void printo(const char *o)
{
static int sep = 0;
......@@ -314,8 +295,8 @@ static int conf_choice(struct menu *menu)
break;
}
} else {
sym->def = sym->curr;
if (S_TRI(sym->curr) == mod) {
sym->user = sym->curr;
if (sym->curr.tri == mod) {
printf("%*s%s\n", indent - 1, "", menu_get_prompt(menu));
return 0;
}
......@@ -422,7 +403,7 @@ static void conf(struct menu *menu)
if (sym_is_choice(sym)) {
conf_choice(menu);
if (S_TRI(sym->curr) != mod)
if (sym->curr.tri != mod)
return;
goto conf_childs;
}
......
......@@ -105,11 +105,11 @@ int conf_read(const char *name)
case S_INT:
case S_HEX:
case S_STRING:
if (S_VAL(sym->def))
free(S_VAL(sym->def));
if (sym->user.val)
free(sym->user.val);
default:
S_VAL(sym->def) = NULL;
S_TRI(sym->def) = no;
sym->user.val = NULL;
sym->user.tri = no;
}
}
......@@ -129,7 +129,7 @@ int conf_read(const char *name)
switch (sym->type) {
case S_BOOLEAN:
case S_TRISTATE:
sym->def = symbol_no.curr;
sym->user = symbol_no.curr;
sym->flags &= ~SYMBOL_NEW;
break;
default:
......@@ -154,18 +154,18 @@ int conf_read(const char *name)
switch (sym->type) {
case S_TRISTATE:
if (p[0] == 'm') {
S_TRI(sym->def) = mod;
sym->user.tri = mod;
sym->flags &= ~SYMBOL_NEW;
break;
}
case S_BOOLEAN:
if (p[0] == 'y') {
S_TRI(sym->def) = yes;
sym->user.tri = yes;
sym->flags &= ~SYMBOL_NEW;
break;
}
if (p[0] == 'n') {
S_TRI(sym->def) = no;
sym->user.tri = no;
sym->flags &= ~SYMBOL_NEW;
break;
}
......@@ -187,7 +187,7 @@ int conf_read(const char *name)
case S_INT:
case S_HEX:
if (sym_string_valid(sym, p)) {
S_VAL(sym->def) = strdup(p);
sym->user.val = strdup(p);
sym->flags &= ~SYMBOL_NEW;
} else {
fprintf(stderr, "%s:%d: symbol value '%s' invalid for %s\n", name, lineno, p, sym->name);
......@@ -199,20 +199,20 @@ int conf_read(const char *name)
}
if (sym_is_choice_value(sym)) {
prop = sym_get_choice_prop(sym);
switch (S_TRI(sym->def)) {
switch (sym->user.tri) {
case mod:
if (S_TRI(prop->def->def) == yes)
if (prop->def->user.tri == yes)
/* warn? */;
break;
case yes:
if (S_TRI(prop->def->def) != no)
if (prop->def->user.tri != no)
/* warn? */;
S_VAL(prop->def->def) = sym;
prop->def->user.val = sym;
break;
case no:
break;
}
S_TRI(prop->def->def) = S_TRI(sym->def);
prop->def->user.tri = sym->user.tri;
}
break;
case '\n':
......@@ -228,7 +228,7 @@ int conf_read(const char *name)
continue;
prop = sym_get_choice_prop(sym);
sym->flags &= ~SYMBOL_NEW;
for (e = prop->dep; e; e = e->left.expr)
for (e = prop->expr; e; e = e->left.expr)
sym->flags |= e->right.sym->flags & SYMBOL_NEW;
}
......@@ -286,7 +286,7 @@ int conf_write(const char *name)
type = sym->type;
if (type == S_TRISTATE) {
sym_calc_value(modules_sym);
if (S_TRI(modules_sym->curr) == no)
if (modules_sym->curr.tri == no)
type = S_BOOLEAN;
}
switch (type) {
......
......@@ -914,7 +914,7 @@ tristate expr_calc_value(struct expr *e)
switch (e->type) {
case E_SYMBOL:
sym_calc_value(e->left.sym);
return S_TRI(e->left.sym->curr);
return e->left.sym->curr.tri;
case E_AND:
val1 = expr_calc_value(e->left.expr);
val2 = expr_calc_value(e->right.expr);
......
......@@ -18,10 +18,6 @@ extern "C" {
struct file {
struct file *next;
struct file *parent;
#ifdef CML1
struct statement *stmt;
struct statement *last_stmt;
#endif
char *name;
int lineno;
int flags;
......@@ -45,18 +41,10 @@ union expr_data {
};
struct expr {
#ifdef CML1
int token;
#else
enum expr_type type;
#endif
union expr_data left, right;
};
#define E_TRI(ev) ((ev).tri)
#define E_EXPR(ev) ((ev).expr)
#define E_CALC(ev) (E_TRI(ev) = expr_calc_value(E_EXPR(ev)))
#define E_OR(dep1, dep2) (((dep1)>(dep2))?(dep1):(dep2))
#define E_AND(dep1, dep2) (((dep1)<(dep2))?(dep1):(dep2))
#define E_NOT(dep) (2-(dep))
......@@ -66,12 +54,8 @@ struct expr_value {
tristate tri;
};
#define S_VAL(sv) ((sv).value)
#define S_TRI(sv) ((sv).tri)
#define S_EQ(sv1, sv2) (S_VAL(sv1) == S_VAL(sv2) || !strcmp(S_VAL(sv1), S_VAL(sv2)))
struct symbol_value {
void *value;
void *val;
tristate tri;
};
......@@ -83,31 +67,16 @@ struct symbol {
struct symbol *next;
char *name;
char *help;
#ifdef CML1
int type;
#else
enum symbol_type type;
#endif
struct symbol_value curr, def;
struct symbol_value curr, user;
tristate visible;
int flags;
struct property *prop;
struct expr *dep, *dep2;
struct menu *menu;
};
#define for_all_symbols(i, sym) for (i = 0; i < 257; i++) for (sym = symbol_hash[i]; sym; sym = sym->next) if (sym->type != S_OTHER)
#ifdef CML1
#define SYMBOL_UNKNOWN S_UNKNOWN
#define SYMBOL_BOOLEAN S_BOOLEAN
#define SYMBOL_TRISTATE S_TRISTATE
#define SYMBOL_INT S_INT
#define SYMBOL_HEX S_HEX
#define SYMBOL_STRING S_STRING
#define SYMBOL_OTHER S_OTHER
#endif
#define SYMBOL_YES 0x0001
#define SYMBOL_MOD 0x0002
#define SYMBOL_NO 0x0004
......@@ -134,22 +103,14 @@ enum prop_type {
struct property {
struct property *next;
struct symbol *sym;
#ifdef CML1
int token;
#else
enum prop_type type;
#endif
const char *text;
struct symbol *def;
struct expr_value visible;
struct expr *dep;
struct expr *dep2;
struct expr *expr;
struct menu *menu;
struct file *file;
int lineno;
#ifdef CML1
struct property *next_pos;
#endif
};
#define for_all_properties(sym, st, tok) \
......@@ -186,17 +147,10 @@ struct file *lookup_file(const char *name);
extern struct symbol symbol_yes, symbol_no, symbol_mod;
extern struct symbol *modules_sym;
extern int cdebug;
extern int print_type;
struct expr *expr_alloc_symbol(struct symbol *sym);
#ifdef CML1
struct expr *expr_alloc_one(int token, struct expr *ce);
struct expr *expr_alloc_two(int token, struct expr *e1, struct expr *e2);
struct expr *expr_alloc_comp(int token, struct symbol *s1, struct symbol *s2);
#else
struct expr *expr_alloc_one(enum expr_type type, struct expr *ce);
struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e2);
struct expr *expr_alloc_comp(enum expr_type type, struct symbol *s1, struct symbol *s2);
#endif
struct expr *expr_alloc_and(struct expr *e1, struct expr *e2);
struct expr *expr_copy(struct expr *org);
void expr_free(struct expr *e);
......@@ -217,17 +171,6 @@ struct expr *expr_trans_compare(struct expr *e, enum expr_type type, struct symb
void expr_fprint(struct expr *e, FILE *out);
void print_expr(int mask, struct expr *e, int prevtoken);
#ifdef CML1
static inline int expr_is_yes(struct expr *e)
{
return !e || (e->token == WORD && e->left.sym == &symbol_yes);
}
static inline int expr_is_no(struct expr *e)
{
return e && (e->token == WORD && e->left.sym == &symbol_no);
}
#else
static inline int expr_is_yes(struct expr *e)
{
return !e || (e->type == E_SYMBOL && e->left.sym == &symbol_yes);
......@@ -238,7 +181,6 @@ static inline int expr_is_no(struct expr *e)
return e && (e->type == E_SYMBOL && e->left.sym == &symbol_no);
}
#endif
#endif
#ifdef __cplusplus
}
......
......@@ -51,7 +51,7 @@ 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(int token, char *prompt, struct symbol *def, struct expr *dep);
struct property *menu_add_prop(enum prop_type type, char *prompt, struct symbol *def, struct expr *dep);
void menu_finalize(struct menu *parent);
void menu_set_type(int type);
struct file *file_lookup(const char *name);
......@@ -67,13 +67,13 @@ void sym_set_changed(struct symbol *sym);
static inline tristate sym_get_tristate_value(struct symbol *sym)
{
return S_TRI(sym->curr);
return sym->curr.tri;
}
static inline struct symbol *sym_get_choice_value(struct symbol *sym)
{
return (struct symbol *)S_VAL(sym->curr);
return (struct symbol *)sym->curr.val;
}
static inline bool sym_set_choice_value(struct symbol *ch, struct symbol *chval)
......@@ -98,7 +98,6 @@ static inline bool sym_is_optional(struct symbol *sym)
static inline bool sym_has_value(struct symbol *sym)
{
//return S_VAL(sym->def) != NULL;
return sym->flags & SYMBOL_NEW ? false : true;
}
......
......@@ -18,9 +18,9 @@ P(sym_change_count,int,);
P(sym_lookup,struct symbol *,(const char *name, int isconst));
P(sym_find,struct symbol *,(const char *name));
P(sym_type_name,const char *,(int type));
P(sym_type_name,const char *,(enum symbol_type type));
P(sym_calc_value,void,(struct symbol *sym));
P(sym_get_type,int,(struct symbol *sym));
P(sym_get_type,enum symbol_type,(struct symbol *sym));
P(sym_tristate_within_range,bool,(struct symbol *sym,tristate tri));
P(sym_set_tristate_value,bool,(struct symbol *sym,tristate tri));
P(sym_toggle_tristate_value,tristate,(struct symbol *sym));
......
......@@ -112,16 +112,16 @@ struct property *create_prop(enum prop_type type)
return prop;
}
struct property *menu_add_prop(int token, char *prompt, struct symbol *def, struct expr *dep)
struct property *menu_add_prop(enum prop_type type, char *prompt, struct symbol *def, struct expr *dep)
{
struct property *prop = create_prop(token);
struct property *prop = create_prop(type);
struct property **propp;
prop->sym = current_entry->sym;
prop->menu = current_entry;
prop->text = prompt;
prop->def = def;
E_EXPR(prop->visible) = menu_check_dep(dep);
prop->visible.expr = menu_check_dep(dep);
if (prompt)
current_entry->prompt = prop;
......@@ -136,14 +136,14 @@ struct property *menu_add_prop(int token, char *prompt, struct symbol *def, stru
return prop;
}
void menu_add_prompt(int token, char *prompt, struct expr *dep)
void menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep)
{
current_entry->prompt = menu_add_prop(token, prompt, NULL, dep);
current_entry->prompt = menu_add_prop(type, prompt, NULL, dep);
}
void menu_add_default(int token, struct symbol *def, struct expr *dep)
void menu_add_default(enum prop_type type, struct symbol *def, struct expr *dep)
{
current_entry->prompt = menu_add_prop(token, NULL, def, dep);
current_entry->prompt = menu_add_prop(type, NULL, def, dep);
}
void menu_finalize(struct menu *parent)
......@@ -168,7 +168,7 @@ void menu_finalize(struct menu *parent)
}
parentdep = expr_alloc_symbol(sym);
} else if (parent->prompt)
parentdep = E_EXPR(parent->prompt->visible);
parentdep = parent->prompt->visible.expr;
else
parentdep = parent->dep;
......@@ -184,23 +184,23 @@ void menu_finalize(struct menu *parent)
for (; prop; prop = prop->next) {
if (prop->menu != menu)
continue;
dep = expr_transform(E_EXPR(prop->visible));
dep = expr_transform(prop->visible.expr);
dep = expr_alloc_and(expr_copy(basedep), dep);
dep = expr_eliminate_dups(dep);
if (menu->sym && menu->sym->type != S_TRISTATE)
dep = expr_trans_bool(dep);
E_EXPR(prop->visible) = dep;
prop->visible.expr = dep;
}
}
for (menu = parent->list; menu; menu = menu->next)
menu_finalize(menu);
} else if (sym) {
basedep = parent->prompt ? E_EXPR(parent->prompt->visible) : NULL;
basedep = parent->prompt ? parent->prompt->visible.expr : NULL;
basedep = expr_trans_compare(basedep, E_UNEQUAL, &symbol_no);
basedep = expr_eliminate_dups(expr_transform(basedep));
last_menu = NULL;
for (menu = parent->next; menu; menu = menu->next) {
dep = menu->prompt ? E_EXPR(menu->prompt->visible) : menu->dep;
dep = menu->prompt ? menu->prompt->visible.expr : menu->dep;
if (!expr_contains_symbol(dep, sym))
break;
if (expr_depends_symbol(dep, sym))
......@@ -233,10 +233,8 @@ void menu_finalize(struct menu *parent)
menu_set_type(sym->type);
menu_add_prop(P_CHOICE, NULL, parent->sym, NULL);
prop = sym_get_choice_prop(parent->sym);
//dep = expr_alloc_one(E_CHOICE, dep);
//dep->right.sym = menu->sym;
prop->dep = expr_alloc_one(E_CHOICE, prop->dep);
prop->dep->right.sym = menu->sym;
prop->expr = expr_alloc_one(E_CHOICE, prop->expr);
prop->expr->right.sym = menu->sym;
}
if (menu->list && (!menu->prompt || !menu->prompt->text)) {
for (last_menu = menu->list; ; last_menu = last_menu->next) {
......@@ -259,9 +257,9 @@ bool menu_is_visible(struct menu *menu)
return false;
if (menu->sym) {
sym_calc_value(menu->sym);
visible = E_TRI(menu->prompt->visible);
visible = menu->prompt->visible.tri;
} else
visible = E_CALC(menu->prompt->visible);
visible = menu->prompt->visible.tri = expr_calc_value(menu->prompt->visible.expr);
return visible != no;
}
......
......@@ -81,22 +81,23 @@ void sym_init(void)
sym_add_default(sym, uts.release);
}
int sym_get_type(struct symbol *sym)
enum symbol_type sym_get_type(struct symbol *sym)
{
int type = sym->type;
enum symbol_type type = sym->type;
if (type == S_TRISTATE) {
if (sym_is_choice_value(sym) && sym->visible == yes)
type = S_BOOLEAN;
else {
sym_calc_value(modules_sym);
if (S_TRI(modules_sym->curr) == no)
if (modules_sym->curr.tri == no)
type = S_BOOLEAN;
}
}
return type;
}
const char *sym_type_name(int type)
const char *sym_type_name(enum symbol_type type)
{
switch (type) {
case S_BOOLEAN:
......@@ -111,6 +112,8 @@ const char *sym_type_name(int type)
return "string";
case S_UNKNOWN:
return "unknown";
case S_OTHER:
break;
}
return "???";
}
......@@ -127,11 +130,10 @@ struct property *sym_get_choice_prop(struct symbol *sym)
struct property *sym_get_default_prop(struct symbol *sym)
{
struct property *prop;
tristate visible;
for_all_defaults(sym, prop) {
visible = E_CALC(prop->visible);
if (visible != no)
prop->visible.tri = expr_calc_value(prop->visible.expr);
if (prop->visible.tri != no)
return prop;
}
return NULL;
......@@ -145,8 +147,10 @@ void sym_calc_visibility(struct symbol *sym)
/* any prompt visible? */
oldvisible = sym->visible;
visible = no;
for_all_prompts(sym, prop)
visible = E_OR(visible, E_CALC(prop->visible));
for_all_prompts(sym, prop) {
prop->visible.tri = expr_calc_value(prop->visible.expr);
visible = E_OR(visible, prop->visible.tri);
}
if (oldvisible != visible) {
sym->visible = visible;
sym_set_changed(sym);
......@@ -179,14 +183,8 @@ void sym_calc_value(struct symbol *sym)
newval = symbol_no.curr;
break;
default:
S_VAL(newval) = sym->name;
S_TRI(newval) = no;
if (sym->flags & SYMBOL_CONST) {
goto out;
}
//newval = symbol_empty.curr;
// generate warning somewhere here later
//S_TRI(newval) = yes;
newval.val = sym->name;
newval.tri = no;
goto out;
}
sym->flags |= SYMBOL_VALID;
......@@ -208,18 +206,18 @@ void sym_calc_value(struct symbol *sym)
newval = prop->def->curr;
}
} else
S_TRI(newval) = S_TRI(sym->def);
newval.tri = sym->user.tri;
} else
newval = sym->def;
newval = sym->user;
S_TRI(newval) = E_AND(S_TRI(newval), sym->visible);
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) && S_TRI(newval) == no)
S_TRI(newval) = sym->visible;
if (!sym_is_optional(sym) && newval.tri == no)
newval.tri = sym->visible;
if (sym_is_choice_value(sym) && sym->visible == yes) {
prop = sym_get_choice_prop(sym);
S_TRI(newval) = (S_VAL(prop->def->curr) == sym) ? yes : no;
newval.tri = (prop->def->curr.val == sym) ? yes : no;
}
} else {
prop = sym_get_default_prop(sym);
......@@ -232,22 +230,25 @@ void sym_calc_value(struct symbol *sym)
switch (sym_get_type(sym)) {
case S_TRISTATE:
if (S_TRI(newval) != mod)
if (newval.tri != mod)
break;
sym_calc_value(modules_sym);
if (S_TRI(modules_sym->curr) == no)
S_TRI(newval) = yes;
if (modules_sym->curr.tri == no)
newval.tri = yes;
break;
case S_BOOLEAN:
if (S_TRI(newval) == mod)
S_TRI(newval) = yes;
if (newval.tri == mod)
newval.tri = yes;
break;
default:
break;
}
out:
sym->curr = newval;
if (sym_is_choice(sym) && S_TRI(newval) == yes) {
def_sym = S_VAL(sym->def);
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)
......@@ -255,7 +256,8 @@ void sym_calc_value(struct symbol *sym)
}
if (!def_sym) {
for_all_defaults(sym, def_prop) {
if (E_CALC(def_prop->visible) == no)
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) {
......@@ -267,7 +269,7 @@ void sym_calc_value(struct symbol *sym)
if (!def_sym) {
prop = sym_get_choice_prop(sym);
for (e = prop->dep; e; e = e->left.expr) {
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;
......@@ -276,7 +278,7 @@ void sym_calc_value(struct symbol *sym)
}
}
S_VAL(newval) = def_sym;
newval.val = def_sym;
}
if (memcmp(&oldval, &newval, sizeof(newval)))
......@@ -286,7 +288,7 @@ void sym_calc_value(struct symbol *sym)
if (sym_is_choice(sym)) {
int flags = sym->flags & (SYMBOL_CHANGED | SYMBOL_WRITE);
prop = sym_get_choice_prop(sym);
for (e = prop->dep; e; e = e->left.expr) {
for (e = prop->expr; e; e = e->left.expr) {
e->right.sym->flags |= flags;
if (flags & SYMBOL_CHANGED)
sym_set_changed(e->right.sym);
......@@ -363,11 +365,11 @@ bool sym_set_tristate_value(struct symbol *sym, tristate val)
if (sym_is_choice_value(sym) && val == yes) {
struct property *prop = sym_get_choice_prop(sym);
S_VAL(prop->def->def) = sym;
prop->def->user.val = sym;
prop->def->flags &= ~SYMBOL_NEW;
}
S_TRI(sym->def) = val;
sym->user.tri = val;
if (oldval != val) {
sym_clear_all_valid();
if (sym == modules_sym)
......@@ -432,14 +434,11 @@ bool sym_string_valid(struct symbol *sym, const char *str)
case S_BOOLEAN:
case S_TRISTATE:
switch (str[0]) {
case 'y':
case 'Y':
case 'y': case 'Y':
return sym_tristate_within_range(sym, yes);
case 'm':
case 'M':
case 'm': case 'M':
return sym_tristate_within_range(sym, mod);
case 'n':
case 'N':
case 'n': case 'N':
return sym_tristate_within_range(sym, no);
}
return false;
......@@ -458,14 +457,11 @@ bool sym_set_string_value(struct symbol *sym, const char *newval)
case S_BOOLEAN:
case S_TRISTATE:
switch (newval[0]) {
case 'y':
case 'Y':
case 'y': case 'Y':
return sym_set_tristate_value(sym, yes);
case 'm':
case 'M':
case 'm': case 'M':
return sym_set_tristate_value(sym, mod);
case 'n':
case 'N':
case 'n': case 'N':
return sym_set_tristate_value(sym, no);
}
return false;
......@@ -481,15 +477,15 @@ bool sym_set_string_value(struct symbol *sym, const char *newval)
sym_set_changed(sym);
}
oldval = S_VAL(sym->def);
oldval = sym->user.val;
size = strlen(newval) + 1;
if (sym->type == S_HEX && (newval[0] != '0' || (newval[1] != 'x' && newval[1] != 'X'))) {
size += 2;
S_VAL(sym->def) = val = malloc(size);
sym->user.val = val = malloc(size);
*val++ = '0';
*val++ = 'x';
} else if (!oldval || strcmp(oldval, newval))
S_VAL(sym->def) = val = malloc(size);
sym->user.val = val = malloc(size);
else
return true;
......@@ -520,7 +516,7 @@ const char *sym_get_string_value(struct symbol *sym)
default:
;
}
return (const char *)S_VAL(sym->curr);
return (const char *)sym->curr.val;
}
bool sym_is_changable(struct symbol *sym)
......
......@@ -1931,8 +1931,6 @@ void print_symbol(FILE *out, struct menu *menu)
struct symbol *sym = menu->sym;
struct property *prop;
//sym->flags |= SYMBOL_PRINTED;
if (sym_is_choice(sym))
fprintf(out, "choice\n");
else
......@@ -1957,13 +1955,6 @@ void print_symbol(FILE *out, struct menu *menu)
fputs(" ???\n", out);
break;
}
#if 0
if (!expr_is_yes(sym->dep)) {
fputs(" depends ", out);
expr_fprint(sym->dep, out);
fputc('\n', out);
}
#endif
for (prop = sym->prop; prop; prop = prop->next) {
if (prop->menu != menu)
continue;
......@@ -1971,25 +1962,18 @@ void print_symbol(FILE *out, struct menu *menu)
case P_PROMPT:
fputs(" prompt ", out);
print_quoted_string(out, prop->text);
if (prop->def) {
fputc(' ', out);
if (prop->def->flags & SYMBOL_CONST)
print_quoted_string(out, prop->def->name);
else
fputs(prop->def->name, out);
}
if (!expr_is_yes(E_EXPR(prop->visible))) {
if (!expr_is_yes(prop->visible.expr)) {
fputs(" if ", out);
expr_fprint(E_EXPR(prop->visible), out);
expr_fprint(prop->visible.expr, out);
}
fputc('\n', out);
break;
case P_DEFAULT:
fputs( " default ", out);
print_quoted_string(out, prop->def->name);
if (!expr_is_yes(E_EXPR(prop->visible))) {
if (!expr_is_yes(prop->visible.expr)) {
fputs(" if ", out);
expr_fprint(E_EXPR(prop->visible), out);
expr_fprint(prop->visible.expr, out);
}
fputc('\n', out);
break;
......@@ -2012,7 +1996,6 @@ void print_symbol(FILE *out, struct menu *menu)
void zconfdump(FILE *out)
{
//struct file *file;
struct property *prop;
struct symbol *sym;
struct menu *menu;
......@@ -2023,11 +2006,6 @@ void zconfdump(FILE *out)
print_symbol(out, menu);
else if ((prop = menu->prompt)) {
switch (prop->type) {
//case T_MAINMENU:
// fputs("\nmainmenu ", out);
// print_quoted_string(out, prop->text);
// fputs("\n", out);
// break;
case P_COMMENT:
fputs("\ncomment ", out);
print_quoted_string(out, prop->text);
......@@ -2038,19 +2016,12 @@ void zconfdump(FILE *out)
print_quoted_string(out, prop->text);
fputs("\n", out);
break;
//case T_SOURCE:
// fputs("\nsource ", out);
// print_quoted_string(out, prop->text);
// fputs("\n", out);
// break;
//case T_IF:
// fputs("\nif\n", out);
default:
;
}
if (!expr_is_yes(E_EXPR(prop->visible))) {
if (!expr_is_yes(prop->visible.expr)) {
fputs(" depends ", out);
expr_fprint(E_EXPR(prop->visible), out);
expr_fprint(prop->visible.expr, out);
fputc('\n', out);
}
fputs("\n", out);
......
......@@ -522,8 +522,6 @@ void print_symbol(FILE *out, struct menu *menu)
struct symbol *sym = menu->sym;
struct property *prop;
//sym->flags |= SYMBOL_PRINTED;
if (sym_is_choice(sym))
fprintf(out, "choice\n");
else
......@@ -548,13 +546,6 @@ void print_symbol(FILE *out, struct menu *menu)
fputs(" ???\n", out);
break;
}
#if 0
if (!expr_is_yes(sym->dep)) {
fputs(" depends ", out);
expr_fprint(sym->dep, out);
fputc('\n', out);
}
#endif
for (prop = sym->prop; prop; prop = prop->next) {
if (prop->menu != menu)
continue;
......@@ -562,25 +553,18 @@ void print_symbol(FILE *out, struct menu *menu)
case P_PROMPT:
fputs(" prompt ", out);
print_quoted_string(out, prop->text);
if (prop->def) {
fputc(' ', out);
if (prop->def->flags & SYMBOL_CONST)
print_quoted_string(out, prop->def->name);
else
fputs(prop->def->name, out);
}
if (!expr_is_yes(E_EXPR(prop->visible))) {
if (!expr_is_yes(prop->visible.expr)) {
fputs(" if ", out);
expr_fprint(E_EXPR(prop->visible), out);
expr_fprint(prop->visible.expr, out);
}
fputc('\n', out);
break;
case P_DEFAULT:
fputs( " default ", out);
print_quoted_string(out, prop->def->name);
if (!expr_is_yes(E_EXPR(prop->visible))) {
if (!expr_is_yes(prop->visible.expr)) {
fputs(" if ", out);
expr_fprint(E_EXPR(prop->visible), out);
expr_fprint(prop->visible.expr, out);
}
fputc('\n', out);
break;
......@@ -603,7 +587,6 @@ void print_symbol(FILE *out, struct menu *menu)
void zconfdump(FILE *out)
{
//struct file *file;
struct property *prop;
struct symbol *sym;
struct menu *menu;
......@@ -614,11 +597,6 @@ void zconfdump(FILE *out)
print_symbol(out, menu);
else if ((prop = menu->prompt)) {
switch (prop->type) {
//case T_MAINMENU:
// fputs("\nmainmenu ", out);
// print_quoted_string(out, prop->text);
// fputs("\n", out);
// break;
case P_COMMENT:
fputs("\ncomment ", out);
print_quoted_string(out, prop->text);
......@@ -629,19 +607,12 @@ void zconfdump(FILE *out)
print_quoted_string(out, prop->text);
fputs("\n", out);
break;
//case T_SOURCE:
// fputs("\nsource ", out);
// print_quoted_string(out, prop->text);
// fputs("\n", out);
// break;
//case T_IF:
// fputs("\nif\n", out);
default:
;
}
if (!expr_is_yes(E_EXPR(prop->visible))) {
if (!expr_is_yes(prop->visible.expr)) {
fputs(" depends ", out);
expr_fprint(E_EXPR(prop->visible), out);
expr_fprint(prop->visible.expr, out);
fputc('\n', out);
}
fputs("\n", 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