这篇教程C++ sym_tristate_within_range函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中sym_tristate_within_range函数的典型用法代码示例。如果您正苦于以下问题:C++ sym_tristate_within_range函数的具体用法?C++ sym_tristate_within_range怎么用?C++ sym_tristate_within_range使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了sym_tristate_within_range函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: change_sym_value/* Change the value of a symbol and update the tree */static void change_sym_value(struct menu *menu, gint col){ struct symbol *sym = menu->sym; tristate oldval, newval; if (!sym) return; if (col == COL_NO) newval = no; else if (col == COL_MOD) newval = mod; else if (col == COL_YES) newval = yes; else return; switch (sym_get_type(sym)) { case S_BOOLEAN: case S_TRISTATE: oldval = sym_get_tristate_value(sym); if (!sym_tristate_within_range(sym, newval)) newval = yes; sym_set_tristate_value(sym, newval); config_changed = TRUE; if (view_mode == FULL_VIEW) update_tree(&rootmenu, NULL); else if (view_mode == SPLIT_VIEW) { update_tree(browsed, NULL); display_list(); } else if (view_mode == SINGLE_VIEW) display_tree_part(); //fixme: keep exp/coll break; case S_INT: case S_HEX: case S_STRING: default: break; }}
开发者ID:OpenHMR,项目名称:Open-HMR600,代码行数:42,
示例2: 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,
示例3: conf_askvaluestatic void conf_askvalue(struct symbol *sym, const char *def){ enum symbol_type type = sym_get_type(sym); tristate val; if (!sym_has_value(sym)) printf("(NEW) "); line[0] = '/n'; line[1] = 0; if (!sym_is_changable(sym)) { printf("%s/n", def); line[0] = '/n'; line[1] = 0; return; } switch (input_mode) { case set_no: case set_mod: case set_yes: case set_random: if (sym_has_value(sym)) { printf("%s/n", def); return; } break; case ask_new: case ask_silent: if (sym_has_value(sym)) { printf("%s/n", def); return; } check_stdin(); case ask_all: fflush(stdout); fgets(line, 128, stdin); return; case set_default: printf("%s/n", def); return; default: break; } switch (type) { case S_INT: case S_HEX: case S_STRING: printf("%s/n", def); return; default: ; } switch (input_mode) { case set_yes: if (sym_tristate_within_range(sym, yes)) { line[0] = 'y'; line[1] = '/n'; line[2] = 0; break; } case set_mod: if (type == S_TRISTATE) { if (sym_tristate_within_range(sym, mod)) { line[0] = 'm'; line[1] = '/n'; line[2] = 0; break; } } else { if (sym_tristate_within_range(sym, yes)) { line[0] = 'y'; line[1] = '/n'; line[2] = 0; break; } } case set_no: if (sym_tristate_within_range(sym, no)) { line[0] = 'n'; line[1] = '/n'; line[2] = 0; break; } case set_random: do { val = (tristate)(random() % 3); } while (!sym_tristate_within_range(sym, val)); switch (val) { case no: line[0] = 'n'; break; case mod: line[0] = 'm'; break; case yes: line[0] = 'y'; break; } line[1] = '/n'; line[2] = 0; break; default: break;//.........这里部分代码省略.........
开发者ID:0x6e3078,项目名称:toybox,代码行数:101,
示例4: conf_askvaluestatic void conf_askvalue(struct symbol *sym, const char *def){ enum symbol_type type = sym_get_type(sym); tristate val; if (!sym_has_value(sym)) printf("(NEW) "); line[0] = '/n'; line[1] = 0; switch (input_mode) { case ask_new: case ask_silent: if (sym_has_value(sym)) { printf("%s/n", def); return; } if (!valid_stdin && input_mode == ask_silent) { printf("aborted!/n/n"); printf("Console input/output is redirected. "); printf("Run 'make oldconfig' to update configuration./n/n"); exit(1); } case ask_all: fflush(stdout); fgets(line, 128, stdin); return; case set_default: printf("%s/n", def); return; default: break; } switch (type) { case S_INT: case S_HEX: case S_STRING: printf("%s/n", def); return; default: ; } switch (input_mode) { case set_yes: if (sym_tristate_within_range(sym, yes)) { line[0] = 'y'; line[1] = '/n'; line[2] = 0; break; } case set_mod: if (type == S_TRISTATE) { if (sym_tristate_within_range(sym, mod)) { line[0] = 'm'; line[1] = '/n'; line[2] = 0; break; } } else { if (sym_tristate_within_range(sym, yes)) { line[0] = 'y'; line[1] = '/n'; line[2] = 0; break; } } case set_no: if (sym_tristate_within_range(sym, no)) { line[0] = 'n'; line[1] = '/n'; line[2] = 0; break; } case set_random: do { val = (tristate)(random() % 3); } while (!sym_tristate_within_range(sym, val)); switch (val) { case no: line[0] = 'n'; break; case mod: line[0] = 'm'; break; case yes: line[0] = 'y'; break; } line[1] = '/n'; line[2] = 0; break; default: break; } printf("%s", line);}
开发者ID:mmikulicic,项目名称:acaros,代码行数:92,
注:本文中的sym_tristate_within_range函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ symbol函数代码示例 C++ sym_set_angle_tolerance函数代码示例 |