bool is_asymmetric_encrypted(struct item *item) //@ requires [?f]world(?pub, ?key_clsfy) &*& item(item, ?i, pub); /*@ ensures [f]world(pub, key_clsfy) &*& item(item, i, pub) &*& result ? i == asymmetric_encrypted_item(_, _, _, _) : true; @*/ { //@ open [f]world(pub, key_clsfy); //@ open item(item, i, pub); //@ open [_]item_constraints(i, ?cs, pub); return item_tag(item->content, item->size) == TAG_ASYMMETRIC_ENC; //@ close item(item, i, pub); //@ close [f]world(pub, key_clsfy); }
bool is_pair(struct item *item) //@ requires [?f]world(?pub, ?key_clsfy) &*& item(item, ?i, pub); /*@ ensures [f]world(pub, key_clsfy) &*& item(item, i, pub) &*& result ? i == pair_item(_, _) : true; @*/ { //@ open [f]world(pub, key_clsfy); //@ open item(item, i, pub); //@ open [_]item_constraints(i, ?cs, pub); return item_tag(item->content, item->size) == 'b'; //@ close item(item, i, pub); //@ close [f]world(pub, key_clsfy); }
static 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; } } }