From ab45d190fd4acf0b0e5d307294ce24a90a69cc23 Mon Sep 17 00:00:00 2001 From: Roman Zippel Date: Thu, 8 Jun 2006 22:12:47 -0700 Subject: kconfig: create links in info window Extend the expression print helper function to allow customization of the symbol output and use it to add links to the info window. Signed-off-by: Roman Zippel Signed-off-by: Andrew Morton Signed-off-by: Sam Ravnborg --- scripts/kconfig/expr.c | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) (limited to 'scripts/kconfig/expr.c') diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c index 87238afb21b7..6f98dbfe70cf 100644 --- a/scripts/kconfig/expr.c +++ b/scripts/kconfig/expr.c @@ -1013,73 +1013,73 @@ int expr_compare_type(enum expr_type t1, enum expr_type t2) #endif } -void expr_print(struct expr *e, void (*fn)(void *, const char *), void *data, int prevtoken) +void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char *), void *data, int prevtoken) { if (!e) { - fn(data, "y"); + fn(data, NULL, "y"); return; } if (expr_compare_type(prevtoken, e->type) > 0) - fn(data, "("); + fn(data, NULL, "("); switch (e->type) { case E_SYMBOL: if (e->left.sym->name) - fn(data, e->left.sym->name); + fn(data, e->left.sym, e->left.sym->name); else - fn(data, ""); + fn(data, NULL, ""); break; case E_NOT: - fn(data, "!"); + fn(data, NULL, "!"); expr_print(e->left.expr, fn, data, E_NOT); break; case E_EQUAL: - fn(data, e->left.sym->name); - fn(data, "="); - fn(data, e->right.sym->name); + fn(data, e->left.sym, e->left.sym->name); + fn(data, NULL, "="); + fn(data, e->right.sym, e->right.sym->name); break; case E_UNEQUAL: - fn(data, e->left.sym->name); - fn(data, "!="); - fn(data, e->right.sym->name); + fn(data, e->left.sym, e->left.sym->name); + fn(data, NULL, "!="); + fn(data, e->right.sym, e->right.sym->name); break; case E_OR: expr_print(e->left.expr, fn, data, E_OR); - fn(data, " || "); + fn(data, NULL, " || "); expr_print(e->right.expr, fn, data, E_OR); break; case E_AND: expr_print(e->left.expr, fn, data, E_AND); - fn(data, " && "); + fn(data, NULL, " && "); expr_print(e->right.expr, fn, data, E_AND); break; case E_CHOICE: - fn(data, e->right.sym->name); + fn(data, e->right.sym, e->right.sym->name); if (e->left.expr) { - fn(data, " ^ "); + fn(data, NULL, " ^ "); expr_print(e->left.expr, fn, data, E_CHOICE); } break; case E_RANGE: - fn(data, "["); - fn(data, e->left.sym->name); - fn(data, " "); - fn(data, e->right.sym->name); - fn(data, "]"); + fn(data, NULL, "["); + fn(data, e->left.sym, e->left.sym->name); + fn(data, NULL, " "); + fn(data, e->right.sym, e->right.sym->name); + fn(data, NULL, "]"); break; default: { char buf[32]; sprintf(buf, "", e->type); - fn(data, buf); + fn(data, NULL, buf); break; } } if (expr_compare_type(prevtoken, e->type) > 0) - fn(data, ")"); + fn(data, NULL, ")"); } -static void expr_print_file_helper(void *data, const char *str) +static void expr_print_file_helper(void *data, struct symbol *sym, const char *str) { fwrite(str, strlen(str), 1, data); } @@ -1089,7 +1089,7 @@ void expr_fprint(struct expr *e, FILE *out) expr_print(e, expr_print_file_helper, out, E_NONE); } -static void expr_print_gstr_helper(void *data, const char *str) +static void expr_print_gstr_helper(void *data, struct symbol *sym, const char *str) { str_append((struct gstr*)data, str); } -- cgit v1.2.2