struct expr *menu_check_dep(struct expr *e) { if (!e) { return e; } switch (e->type) { case E_NOT: e->left.expr = menu_check_dep(e->left.expr); break; case E_OR: case E_AND: e->left.expr = menu_check_dep(e->left.expr); e->right.expr = menu_check_dep(e->right.expr); break; case E_SYMBOL: /* change 'm' into 'm' && MODULES */ if (e->left.sym == &symbol_mod) { return expr_alloc_and(e, expr_alloc_symbol(modules_sym)); } break; default: break; } return e; }
static struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *expr, struct expr *dep) { struct property *prop = prop_alloc(type, current_entry->sym); prop->menu = current_entry; prop->expr = expr; prop->visible.expr = menu_check_dep(dep); if (prompt) { /* For crostool-NG, a leading pipe followed with spaces * means that pipe shall be removed, and the spaces should * not be trimmed. */ if (*prompt == '|') prompt++; else if (isspace(*prompt)) { prop_warn(prop, "leading whitespace ignored"); while (isspace(*prompt)) prompt++; } if (current_entry->prompt && current_entry != &rootmenu) prop_warn(prop, "prompt redefined"); /* Apply all upper menus' visibilities to actual prompts. */ if(type == P_PROMPT) { struct menu *menu = current_entry; while ((menu = menu->parent) != NULL) { struct expr *dup_expr; if (!menu->visibility) 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 = expr_alloc_and(prop->visible.expr, dup_expr); } } current_entry->prompt = prop; } prop->text = prompt; return prop; }
static struct expr *menu_check_dep(struct expr *e) { if (!e) return e; switch (e->type) { case E_NOT: e->left.expr = menu_check_dep(e->left.expr); break; case E_OR: case E_AND: e->left.expr = menu_check_dep(e->left.expr); e->right.expr = menu_check_dep(e->right.expr); break; case E_SYMBOL: if (e->left.sym == &symbol_mod) return expr_alloc_and(e, expr_alloc_symbol(modules_sym)); break; default: break; } return e; }
struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *expr, struct expr *dep) { struct property *prop = prop_alloc(type, current_entry->sym); prop->menu = current_entry; prop->text = prompt; prop->expr = expr; prop->visible.expr = menu_check_dep(dep); if (prompt) { if (current_entry->prompt) menu_warn(current_entry, "prompt redefined\n"); current_entry->prompt = prop; } return prop; }
struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *expr, struct expr *dep) { struct property *prop = prop_alloc(type, current_entry->sym); prop->menu = current_entry; prop->expr = expr; prop->visible.expr = menu_check_dep(dep); if (prompt) { /* For crostool-NG, a leading pipe followed with spaces * means that pipe shall be removed, and the spaces should * not be trimmed. */ if (*prompt == '|') prompt++; else if (isspace(*prompt)) { prop_warn(prop, "leading whitespace ignored"); while (isspace(*prompt)) prompt++; } if (current_entry->prompt && current_entry != &rootmenu) prop_warn(prop, "prompt redefined"); /* Apply all upper menus' visibilities to actual prompts. */ if(type == P_PROMPT) { struct menu *menu = current_entry; while ((menu = menu->parent) != NULL) { if (!menu->visibility) continue; prop->visible.expr = expr_alloc_and(prop->visible.expr, menu->visibility); } } current_entry->prompt = prop; } prop->text = prompt; return prop; }
struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *expr, struct expr *dep) { struct property *prop = prop_alloc(type, current_entry->sym); prop->menu = current_entry; prop->expr = expr; prop->visible.expr = menu_check_dep(dep); if (prompt) { if (isspace(*prompt)) { prop_warn(prop, "leading whitespace ignored"); while (isspace(*prompt)) prompt++; } if (current_entry->prompt) prop_warn(prop, "prompt redefined"); current_entry->prompt = prop; } prop->text = prompt; return prop; }
struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *expr, struct expr *dep) { struct property *prop = prop_alloc(type, current_entry->sym); prop->menu = current_entry; prop->expr = expr; prop->visible.expr = menu_check_dep(dep); if (prompt) { if (isspace(*prompt)) { prop_warn(prop, "leading whitespace ignored"); while (isspace(*prompt)) prompt++; } if (current_entry->prompt && current_entry != &rootmenu) prop_warn(prop, "prompt redefined"); /* Apply all upper menus' visibilities to actual prompts. */ if(type == P_PROMPT) { struct menu *menu = current_entry; while ((menu = menu->parent) != NULL) { if (!menu->visibility) continue; prop->visible.expr = expr_alloc_and(prop->visible.expr, menu->visibility); } } current_entry->prompt = prop; } prop->text = prompt; return prop; }
void menu_add_dep(struct expr *dep) { current_entry->dep = expr_alloc_and(current_entry->dep, menu_check_dep(dep)); }