这篇教程C++ sym_get_tristate_value函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中sym_get_tristate_value函数的典型用法代码示例。如果您正苦于以下问题:C++ sym_get_tristate_value函数的具体用法?C++ sym_get_tristate_value怎么用?C++ sym_get_tristate_value使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了sym_get_tristate_value函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: check_confstatic void check_conf(struct menu *menu){ struct symbol *sym; struct menu *child; if (!menu_is_visible(menu)) return; sym = menu->sym; if (sym && !sym_has_value(sym)) { if (sym_is_changable(sym) || (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes)) { if (input_mode == listnewconfig) { if (sym->name) { const char *str; if (sym->type == S_STRING) { str = sym_get_string_value(sym); str = sym_escape_string_value(str); printf("%s%s=%s/n", CONFIG_, sym->name, str); free((void *)str); } else { str = sym_get_string_value(sym); printf("%s%s=%s/n", CONFIG_, sym->name, str); } } } else { if (!conf_cnt++) printf("*/n* Restart config.../n*/n"); rootEntry = menu_get_parent_menu(menu); conf(rootEntry); } } } for (child = menu->list; child; child = child->next) check_conf(child);}
开发者ID:krzk,项目名称:linux,代码行数:38,
示例2: menu_is_visiblebool menu_is_visible(struct menu *menu){ struct menu *child; struct symbol *sym; tristate visible; if (!menu->prompt) return false; if (menu->visibility) { if (expr_calc_value(menu->visibility) == no) return no; } sym = menu->sym; if (sym) { sym_calc_value(sym); visible = menu->prompt->visible.tri; } else visible = menu->prompt->visible.tri = expr_calc_value(menu->prompt->visible.expr); if (visible != no) return true; if (!sym || sym_get_tristate_value(menu->sym) == no) return false; for (child = menu->list; child; child = child->next) { if (menu_is_visible(child)) { if (sym) sym->flags |= SYMBOL_DEF_USER; return true; } } return false;}
开发者ID:Christopher83,项目名称:linaro_crosstool-ng,代码行数:37,
示例3: conf_choicestatic int conf_choice(struct menu *menu){ struct symbol *sym, *def_sym; struct menu *child; bool is_new; sym = menu->sym; is_new = !sym_has_value(sym); if (sym_is_changable(sym)) { conf_sym(menu); sym_calc_value(sym); switch (sym_get_tristate_value(sym)) { case no: return 1; case mod: return 0; case yes: break; } } else { switch (sym_get_tristate_value(sym)) { case no: return 1; case mod: printf("%*s%s/n", indent - 1, "", _(menu_get_prompt(menu))); return 0; case yes: break; } } while (1) { int cnt, def; printf("%*s%s/n", indent - 1, "", _(menu_get_prompt(menu))); def_sym = sym_get_choice_value(sym); cnt = def = 0; line[0] = 0; for (child = menu->list; child; child = child->next) { if (!menu_is_visible(child)) continue; if (!child->sym) { printf("%*c %s/n", indent, '*', _(menu_get_prompt(child))); continue; } cnt++; if (child->sym == def_sym) { def = cnt; printf("%*c", indent, '>'); } else printf("%*c", indent, ' '); printf(" %d. %s", cnt, _(menu_get_prompt(child))); if (child->sym->name) printf(" (%s)", child->sym->name); if (!sym_has_value(child->sym)) printf(_(" (NEW)")); printf("/n"); } printf(_("%*schoice"), indent - 1, ""); if (cnt == 1) { printf("[1]: 1/n"); goto conf_childs; } printf("[1-%d", cnt); if (menu_has_help(menu)) printf("?"); printf("]: "); switch (input_mode) { case oldconfig: case silentoldconfig: if (!is_new) { cnt = def; printf("%d/n", cnt); break; } check_stdin(); /* fall through */ case oldaskconfig: fflush(stdout); xfgets(line, 128, stdin); strip(line); if (line[0] == '?') { print_help(menu); continue; } if (!line[0]) cnt = def; else if (isdigit(line[0])) cnt = atoi(line); else continue; break; default: break; } conf_childs: for (child = menu->list; child; child = child->next) { if (!child->sym || !menu_is_visible(child)) continue;//.........这里部分代码省略.........
开发者ID:LGaljo,项目名称:android_kernel_samsung_s3ve3g,代码行数:101,
示例4: conf_symstatic int conf_sym(struct menu *menu){ struct symbol *sym = menu->sym; tristate oldval, newval; while (1) { printf("%*s%s ", indent - 1, "", _(menu->prompt->text)); if (sym->name) printf("(%s) ", sym->name); putchar('['); oldval = sym_get_tristate_value(sym); switch (oldval) { case no: putchar('N'); break; case mod: putchar('M'); break; case yes: putchar('Y'); break; } if (oldval != no && sym_tristate_within_range(sym, no)) printf("/n"); if (oldval != mod && sym_tristate_within_range(sym, mod)) printf("/m"); if (oldval != yes && sym_tristate_within_range(sym, yes)) printf("/y"); if (menu_has_help(menu)) printf("/?"); printf("] "); if (!conf_askvalue(sym, sym_get_string_value(sym))) return 0; strip(line); switch (line[0]) { case 'n': case 'N': newval = no; if (!line[1] || !strcmp(&line[1], "o")) break; continue; case 'm': case 'M': newval = mod; if (!line[1]) break; continue; case 'y': case 'Y': newval = yes; if (!line[1] || !strcmp(&line[1], "es")) break; continue; case 0: newval = oldval; break; case '?': goto help; default: continue; } if (sym_set_tristate_value(sym, newval)) return 0;help: print_help(menu); }}
开发者ID:LGaljo,项目名称:android_kernel_samsung_s3ve3g,代码行数:68,
示例5: conf_choicestatic int conf_choice(struct menu *menu){ struct symbol *sym, *def_sym; struct menu *child; int type; bool is_new; sym = menu->sym; type = sym_get_type(sym); is_new = !sym_has_value(sym); if (sym_is_changable(sym)) { conf_sym(menu); sym_calc_value(sym); switch (sym_get_tristate_value(sym)) { case no: return 1; case mod: return 0; case yes: break; } } else { switch (sym_get_tristate_value(sym)) { case no: return 1; case mod: printf("%*s%s/n", indent - 1, "", menu_get_prompt(menu)); return 0; case yes: break; } } while (1) { int cnt, def; printf("%*s%s/n", indent - 1, "", menu_get_prompt(menu)); def_sym = sym_get_choice_value(sym); cnt = def = 0; line[0] = 0; for (child = menu->list; child; child = child->next) { if (!menu_is_visible(child)) continue; if (!child->sym) { printf("%*c %s/n", indent, '*', menu_get_prompt(child)); continue; } cnt++; if (child->sym == def_sym) { def = cnt; printf("%*c", indent, '>'); } else printf("%*c", indent, ' '); printf(" %d. %s", cnt, menu_get_prompt(child)); if (child->sym->name) printf(" (%s)", child->sym->name); if (!sym_has_value(child->sym)) printf(" (NEW)"); printf("/n"); } printf("%*schoice", indent - 1, ""); if (cnt == 1) { printf("[1]: 1/n"); goto conf_childs; } printf("[1-%d", cnt); if (sym->help) printf("?"); printf("]: "); switch (input_mode) { case ask_new: case ask_silent: if (!is_new) { cnt = def; printf("%d/n", cnt); break; } check_stdin(); case ask_all: fflush(stdout); fgets(line, 128, stdin); strip(line); if (line[0] == '?') { printf("/n%s/n", menu->sym->help ? menu->sym->help : nohelp_text); continue; } if (!line[0]) cnt = def; else if (isdigit(line[0])) cnt = atoi(line); else continue; break; case set_random: def = (random() % cnt) + 1; case set_default: case set_yes: case set_mod: case set_no://.........这里部分代码省略.........
开发者ID:0x6e3078,项目名称:toybox,代码行数:101,
示例6: confstatic void conf(struct menu *menu){ struct menu *submenu; const char *prompt = menu_get_prompt(menu); struct symbol *sym; struct menu *active_menu = NULL; int res; int s_scroll = 0; while (1) { item_reset(); current_menu = menu; build_conf(menu); if (!child_count) break; if (menu == &rootmenu) { item_make("--- "); item_set_tag(':'); item_make(_(" Load an Alternate Configuration File")); item_set_tag('L'); item_make(_(" Save an Alternate Configuration File")); item_set_tag('S'); } dialog_clear(); res = dialog_menu(prompt ? _(prompt) : _("Main Menu"), _(menu_instructions), active_menu, &s_scroll); if (res == 1 || res == KEY_ESC || res == -ERRDISPLAYTOOSMALL) break; if (!item_activate_selected()) continue; if (!item_tag()) continue; submenu = item_data(); active_menu = item_data(); if (submenu) sym = submenu->sym; else sym = NULL; switch (res) { case 0: switch (item_tag()) { case 'm': if (single_menu_mode) submenu->data = (void *) (long) !submenu->data; else conf(submenu); break; case 't': if (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes) conf_choice(submenu); else if (submenu->prompt->type == P_MENU) conf(submenu); break; case 's': conf_string(submenu); break; case 'L': conf_load(); break; case 'S': conf_save(); break; } break; case 2: if (sym) show_help(submenu); else show_helptext(_("README"), _(mconf_readme)); break; case 3: if (item_is_tag('t')) { if (sym_set_tristate_value(sym, yes)) break; if (sym_set_tristate_value(sym, mod)) show_textbox(NULL, setmod_text, 6, 74); } break; case 4: if (item_is_tag('t')) sym_set_tristate_value(sym, no); break; case 5: if (item_is_tag('t')) sym_set_tristate_value(sym, mod); break; case 6: if (item_is_tag('t')) sym_toggle_tristate_value(sym); else if (item_is_tag('m')) conf(submenu); break; case 7: search_conf(); break; } }//.........这里部分代码省略.........
开发者ID:16rd,项目名称:rt-n56u,代码行数:101,
示例7: build_confstatic void build_conf(struct menu *menu){ struct symbol *sym; struct property *prop; struct menu *child; int type, tmp, doint = 2; tristate val; char ch; if (!menu_is_visible(menu)) return; sym = menu->sym; prop = menu->prompt; if (!sym) { if (prop && menu != current_menu) { const char *prompt = menu_get_prompt(menu); switch (prop->type) { case P_MENU: child_count++; prompt = _(prompt); if (single_menu_mode) { item_make("%s%*c%s", menu->data ? "-->" : "++>", indent + 1, ' ', prompt); } else item_make(" %*c%s --->", indent + 1, ' ', prompt); item_set_tag('m'); item_set_data(menu); if (single_menu_mode && menu->data) goto conf_childs; return; case P_COMMENT: if (prompt) { child_count++; item_make(" %*c*** %s ***", indent + 1, ' ', _(prompt)); item_set_tag(':'); item_set_data(menu); } break; default: if (prompt) { child_count++; item_make("---%*c%s", indent + 1, ' ', _(prompt)); item_set_tag(':'); item_set_data(menu); } } } else doint = 0; goto conf_childs; } type = sym_get_type(sym); if (sym_is_choice(sym)) { struct symbol *def_sym = sym_get_choice_value(sym); struct menu *def_menu = NULL; child_count++; for (child = menu->list; child; child = child->next) { if (menu_is_visible(child) && child->sym == def_sym) def_menu = child; } val = sym_get_tristate_value(sym); if (sym_is_changable(sym)) { switch (type) { case S_BOOLEAN: item_make("[%c]", val == no ? ' ' : '*'); break; case S_TRISTATE: switch (val) { case yes: ch = '*'; break; case mod: ch = 'M'; break; default: ch = ' '; break; } item_make("<%c>", ch); break; } item_set_tag('t'); item_set_data(menu); } else { item_make(" "); item_set_tag(def_menu ? 't' : ':'); item_set_data(menu); } item_add_str("%*c%s", indent + 1, ' ', _(menu_get_prompt(menu))); if (val == yes) { if (def_menu) { item_add_str(" (%s)", _(menu_get_prompt(def_menu))); item_add_str(" --->"); if (def_menu->list) { indent += 2; build_conf(def_menu); indent -= 2; } } return;//.........这里部分代码省略.........
开发者ID:16rd,项目名称:rt-n56u,代码行数:101,
示例8: confstatic void conf(struct menu *menu){ struct dialog_list_item *active_item = NULL; struct menu *submenu; const char *prompt = menu_get_prompt(menu); struct symbol *sym; char active_entry[40]; int stat, type; unlink("lxdialog.scrltmp"); active_entry[0] = 0; while (1) { indent = 0; child_count = 0; current_menu = menu; cdone(); cinit(); build_conf(menu); if (!child_count) break; if (menu == &rootmenu) { cmake(); cprint_tag(":"); cprint_name("--- "); cmake(); cprint_tag("L"); cprint_name("Load an Alternate Configuration File"); cmake(); cprint_tag("S"); cprint_name("Save Configuration to an Alternate File"); } dialog_clear(); stat = dialog_menu(prompt ? prompt : "Main Menu", menu_instructions, rows, cols, rows - 10, active_entry, item_no, items); if (stat < 0) return; if (stat == 1 || stat == 255) break; active_item = first_sel_item(item_no, items); if (!active_item) continue; active_item->selected = 0; strncpy(active_entry, active_item->tag, sizeof(active_entry)); active_entry[sizeof(active_entry)-1] = 0; type = active_entry[0]; if (!type) continue; sym = NULL; submenu = NULL; if (sscanf(active_entry + 1, "%p", &submenu) == 1) sym = submenu->sym; switch (stat) { case 0: switch (type) { case 'm': if (single_menu_mode) submenu->data = (void *) (long) !submenu->data; else conf(submenu); break; case 't': if (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes) conf_choice(submenu); else if (submenu->prompt->type == P_MENU) conf(submenu); break; case 's': conf_string(submenu); break; case 'L': conf_load(); break; case 'S': conf_save(); break; } break; case 2: if (sym) show_help(submenu); else show_helptext("README", mconf_readme); break; case 3: if (type == 't') { if (sym_set_tristate_value(sym, yes)) break; if (sym_set_tristate_value(sym, mod)) show_textbox(NULL, setmod_text, 6, 74); } break; case 4: if (type == 't') sym_set_tristate_value(sym, no); break; case 5: if (type == 't') sym_set_tristate_value(sym, mod); break; case 6: if (type == 't') sym_toggle_tristate_value(sym);//.........这里部分代码省略.........
开发者ID:0919061,项目名称:PX4NuttX,代码行数:101,
示例9: build_confstatic void build_conf(struct menu *menu){ struct symbol *sym; struct property *prop; struct menu *child; int type, tmp, doint = 2; tristate val; char ch; if (!menu_is_visible(menu)) return; sym = menu->sym; prop = menu->prompt; if (!sym) { if (prop && menu != current_menu) { const char *prompt = menu_get_prompt(menu); switch (prop->type) { case P_MENU: child_count++; cmake(); cprint_tag("m%p", menu); if (single_menu_mode) { cprint_name("%s%*c%s", menu->data ? "-->" : "++>", indent + 1, ' ', prompt); } else { cprint_name(" %*c%s --->", indent + 1, ' ', prompt); } if (single_menu_mode && menu->data) goto conf_childs; return; default: if (prompt) { child_count++; cmake(); cprint_tag(":%p", menu); cprint_name("---%*c%s", indent + 1, ' ', prompt); } } } else doint = 0; goto conf_childs; } cmake(); type = sym_get_type(sym); if (sym_is_choice(sym)) { struct symbol *def_sym = sym_get_choice_value(sym); struct menu *def_menu = NULL; child_count++; for (child = menu->list; child; child = child->next) { if (menu_is_visible(child) && child->sym == def_sym) def_menu = child; } val = sym_get_tristate_value(sym); if (sym_is_changable(sym)) { cprint_tag("t%p", menu); switch (type) { case S_BOOLEAN: cprint_name("[%c]", val == no ? ' ' : '*'); break; case S_TRISTATE: switch (val) { case yes: ch = '*'; break; case mod: ch = 'M'; break; default: ch = ' '; break; } cprint_name("<%c>", ch); break; } } else { cprint_tag("%c%p", def_menu ? 't' : ':', menu); cprint_name(" "); } cprint_name("%*c%s", indent + 1, ' ', menu_get_prompt(menu)); if (val == yes) { if (def_menu) { cprint_name(" (%s)", menu_get_prompt(def_menu)); cprint_name(" --->"); if (def_menu->list) { indent += 2; build_conf(def_menu); indent -= 2; } } return; } } else { if (menu == current_menu) { cprint_tag(":%p", menu); cprint_name("---%*c%s", indent + 1, ' ', menu_get_prompt(menu)); goto conf_childs; } child_count++;//.........这里部分代码省略.........
开发者ID:0919061,项目名称:PX4NuttX,代码行数:101,
示例10: confstatic void conf(struct menu *menu){ struct menu *submenu; const char *prompt = menu_get_prompt(menu); struct symbol *sym; char active_entry[40]; int stat, type, i; unlink("lxdialog.scrltmp"); active_entry[0] = 0; while (1) { cprint_init(); cprint("--title"); cprint("%s", prompt ? prompt : "Main Menu"); cprint("--menu"); cprint(menu_instructions); cprint("%d", rows); cprint("%d", cols); cprint("%d", rows - 10); cprint("%s", active_entry); current_menu = menu; build_conf(menu); if (!child_count) break; if (menu == &rootmenu) { cprint(":"); cprint("--- "); cprint("L"); cprint(" Load an Alternate Configuration File"); cprint("S"); cprint(" Save Configuration to an Alternate File"); } stat = exec_conf(); if (stat < 0) continue; if (stat == 1 || stat == 255) break; type = input_buf[0]; if (!type) continue; for (i = 0; input_buf[i] && !isspace(input_buf[i]); i++) ; if (i >= sizeof(active_entry)) i = sizeof(active_entry) - 1; input_buf[i] = 0; strcpy(active_entry, input_buf); sym = NULL; submenu = NULL; if (sscanf(input_buf + 1, "%p", &submenu) == 1) sym = submenu->sym; switch (stat) { case 0: switch (type) { case 'm': if (single_menu_mode) submenu->data = (void *) (long) !submenu->data; else conf(submenu); break; case 't': if (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes) conf_choice(submenu); else if (submenu->prompt->type == P_MENU) conf(submenu); break; case 's': conf_string(submenu); break; case 'L': conf_load(); break; case 'S': conf_save(); break; } break; case 2: if (sym) show_help(submenu); else show_readme(); break; case 3: if (type == 't') { if (sym_set_tristate_value(sym, yes)) break; if (sym_set_tristate_value(sym, mod)) show_textbox(NULL, setmod_text, 6, 74); } break; case 4: if (type == 't') sym_set_tristate_value(sym, no); break; case 5://.........这里部分代码省略.........
开发者ID:FelipeFernandes1988,项目名称:Alice-1121-Modem,代码行数:101,
示例11: write_make_deps/* write dependencies of the infividual config-symbols */static int write_make_deps(const char *name){ struct menu *menu; struct symbol *sym; struct property *prop, *p; unsigned done; const char *const name_tmp = "..make.deps.tmp"; FILE *out; if (!name) name = ".auto.deps"; out = fopen(name_tmp, "w"); if (!out) return 1; fprintf(out, "# ATTENTION! This does not handle 'depends', just 'select'! /n" "# See package/config/util.c write_make_deps()/n#/n"); menu = &rootmenu; //rootmenu.list; while (menu) { sym = menu->sym; if (!sym) { if (!menu_is_visible(menu)) goto next; } else if (!(sym->flags & SYMBOL_CHOICE)) { sym_calc_value(sym); if (sym->type == S_BOOLEAN && sym_get_tristate_value(sym) != no) { done = 0; for_all_prompts(sym, prop) { struct expr *e;//printf("/nname=%s/n", sym->name); for_all_properties(sym, p, P_SELECT) { e = p->expr; if (e && e->left.sym->name) { if (!done) { fprintf(out, "%s: $(BASE_TARGETS)", br2_symbol_printer(sym->name)); done = 1; }//printf("SELECTS %s/n",e->left.sym->name); fprintf(out, " %s", br2_symbol_printer(e->left.sym->name)); } } if (done) fprintf(out, "/n");#if 0 e = sym->rev_dep.expr; if (e && e->type == E_SYMBOL && e->left.sym->name) { fprintf(out, "%s: %s", br2_symbol_printer(e->left.sym->name), br2_symbol_printer(sym->name)); printf("%s is Selected BY: %s", sym->name, e->left.sym->name); }#endif } }
开发者ID:CyParker,项目名称:at91bootstrap,代码行数:64,
示例12: report_changesvoid report_changes(void){ struct symbol *sym; struct menu *menu; int type, l; const char *str; fprintf(stdout, "/n#/n" "# Changes:/n" "#/n"); menu = rootmenu.list; while (menu) { sym = menu->sym; if (!sym) { if (!menu_is_visible(menu)) goto next; } else if (!(sym->flags & SYMBOL_CHOICE)) { sym_calc_value(sym); if ((sym->flags & (SYMBOL_WRITE | SYMBOL_CHANGED_REAL | SYMBOL_DEF_USER)) != (SYMBOL_WRITE | SYMBOL_CHANGED_REAL | SYMBOL_DEF_USER)) goto next; if (sym->visible == no) goto next; type = sym->type; if (type == S_TRISTATE) { sym_calc_value(modules_sym); if (modules_sym->curr.tri == no) type = S_BOOLEAN; } switch (type) { case S_BOOLEAN: case S_TRISTATE: switch (sym_get_tristate_value(sym)) { case no: fprintf(stdout, "# CONFIG_%s is not set/n", sym->name); break; case mod: fprintf(stdout, "CONFIG_%s=m/n", sym->name); break; case yes: fprintf(stdout, "CONFIG_%s=y/n", sym->name); break; } break; case S_STRING: str = sym_get_string_value(sym); fprintf(stdout, "CONFIG_%s=/"", sym->name); while (1) { l = strcspn(str, "/"//"); if (l) { fwrite(str, l, 1, stdout); str += l; } if (!*str) break; fprintf(stdout, "//%c", *str++); } fputs("/"/n", stdout); break; case S_HEX: str = sym_get_string_value(sym); if (str[0] != '0' || (str[1] != 'x' && str[1] != 'X')) { fprintf(stdout, "CONFIG_%s=%s/n", sym->name, str); break; } case S_INT: str = sym_get_string_value(sym); fprintf(stdout, "CONFIG_%s=%s/n", sym->name, str); break; } } next: if (menu->list) { menu = menu->list; continue; } if (menu->next) menu = menu->next; else while ((menu = menu->parent)) { if (menu->next) { menu = menu->next; break; } } }}
开发者ID:miettal,项目名称:armadillo420_standard_linux314,代码行数:87,
示例13: conf_choicestatic int conf_choice(struct menu *menu){ struct symbol *sym, *def_sym; struct menu *cmenu, *def_menu; const char *help; int type, len; bool is_new; sym = menu->sym; type = sym_get_type(sym); is_new = !sym_has_value(sym); if (sym_is_changable(sym)) { conf_sym(menu); sym_calc_value(sym); switch (sym_get_tristate_value(sym)) { case no: return 1; case mod: return 0; case yes: break; } } else { sym->def = sym->curr; if (S_TRI(sym->curr) == mod) { printf("%*s%s/n", indent - 1, "", menu_get_prompt(menu)); return 0; } } while (1) { printf("%*s%s ", indent - 1, "", menu_get_prompt(menu)); def_sym = sym_get_choice_value(sym); def_menu = NULL; for (cmenu = menu->list; cmenu; cmenu = cmenu->next) { if (!menu_is_visible(cmenu)) continue; printo(menu_get_prompt(cmenu)); if (cmenu->sym == def_sym) def_menu = cmenu; } printo(NULL); if (def_menu) printf("[%s] ", menu_get_prompt(def_menu)); else { printf("/n"); return 1; } switch (input_mode) { case ask_new: case ask_silent: case ask_all: if (is_new) sym->flags |= SYMBOL_NEW; conf_askvalue(sym, menu_get_prompt(def_menu)); strip(line); break; default: line[0] = 0; printf("/n"); } if (line[0] == '?' && !line[1]) { help = nohelp_text; if (menu->sym->help) help = menu->sym->help; printf("/n%s/n", help); continue; } if (line[0]) { len = strlen(line); line[len] = 0; def_menu = NULL; for (cmenu = menu->list; cmenu; cmenu = cmenu->next) { if (!cmenu->sym || !menu_is_visible(cmenu)) continue; if (!strncasecmp(line, menu_get_prompt(cmenu), len)) { def_menu = cmenu; break; } } } if (def_menu) { sym_set_choice_value(sym, def_menu->sym); if (def_menu->list) { indent += 2; conf(def_menu->list); indent -= 2; } return 1; } }}
开发者ID:mmikulicic,项目名称:acaros,代码行数:93,
示例14: conf_choicestatic int conf_choice(struct menu *menu){ struct symbol *sym, *def_sym; struct menu *child; // int type; backported future linux patch to 2.6.30 to fix gcc4.6 compiler warning bool is_new; sym = menu->sym; // type = sym_get_type(sym); see backported comment above is_new = !sym_has_value(sym); if (sym_is_changable(sym)) { conf_sym(menu); sym_calc_value(sym); switch (sym_get_tristate_value(sym)) { case no: return 1; case mod: return 0; case yes: break; } } else { switch (sym_get_tristate_value(sym)) { case no: return 1; case mod: printf("%*s%s/n", indent - 1, "", _(menu_get_prompt(menu))); return 0; case yes: break; } } while (1) { int cnt, def; printf("%*s%s/n", indent - 1, "", _(menu_get_prompt(menu))); def_sym = sym_get_choice_value(sym); cnt = def = 0; line[0] = 0; for (child = menu->list; child; child = child->next) { if (!menu_is_visible(child)) continue; if (!child->sym) { printf("%*c %s/n", indent, '*', _(menu_get_prompt(child))); continue; } cnt++; if (child->sym == def_sym) { def = cnt; printf("%*c", indent, '>'); } else printf("%*c", indent, ' '); printf(" %d. %s", cnt, _(menu_get_prompt(child))); if (child->sym->name) printf(" (%s)", child->sym->name); if (!sym_has_value(child->sym)) printf(_(" (NEW)")); printf("/n"); } printf(_("%*schoice"), indent - 1, ""); if (cnt == 1) { printf("[1]: 1/n"); goto conf_childs; } printf("[1-%d", cnt); if (menu_has_help(menu)) printf("?"); printf("]: "); switch (input_mode) { case ask_new: case ask_silent: if (!is_new) { cnt = def; printf("%d/n", cnt); break; } check_stdin(); case ask_all: fflush(stdout); if (NULL == fgets(line, 128, stdin)) { //BRCM: check ret val to fix compiler warning printf("fgets failed, exiting/n"); exit(2); } strip(line); if (line[0] == '?') { printf("/n%s/n", get_help(menu)); continue; } if (!line[0]) cnt = def; else if (isdigit(line[0])) cnt = atoi(line); else continue; break; default: break; }//.........这里部分代码省略.........
开发者ID:antonywcl,项目名称:AR-5315u_PLD,代码行数:101,
注:本文中的sym_get_tristate_value函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ sym_get_type函数代码示例 C++ sym_get_string_value函数代码示例 |