/* * Pause for user response XXX XXX XXX */ void pause_line(int row) { prtf(0, row, ""); put_fstr(23, row, "[Press any key to continue]"); inkey(); prtf(0, row, ""); }
/* Show the option */ static bool show_option(int x, int y, menu_type *option, char c, bool scroll, bool select) { if (option->flags & MN_ACTIVE) { /* Is this option selected */ if (select) { /* Highlight this option? */ if (scroll) { prtf(x, y, " %c) " CLR_L_BLUE "%s", c, option->text); } else { prtf(x, y, "*%c) %s", c, option->text); } } else { prtf(x, y, " %c) %s", c, option->text); } return (TRUE); } /* Not a valid option */ prtf(x, y, " %s", option->text); return (FALSE); }
main(int argc,char **argv) { openit(argc,argv); prtf(W_RASTS, rasts); prtf(W_BEHIND, behind); prtf(W_ONERAST, onerast); prtf(W_YDOTS, ydots); closeit(); }
/* * Get a string from the user * * The "prompt" should take the form "Prompt: " * * Note that the initial contents of the string is used as * the default response, so be sure to "clear" it if needed. * * We clear the input, and return FALSE, on "ESCAPE". */ bool get_string(char *buf, int len, cptr str, ...) { bool res; va_list vp; char prompt[1024]; /* Begin the Varargs Stuff */ va_start(vp, str); /* Format the args, save the length */ (void)vstrnfmt(prompt, 1024, str, &vp); /* End the Varargs Stuff */ va_end(vp); /* Paranoia XXX XXX XXX */ message_flush(); /* Display prompt */ prtf(0, 0, prompt); /* Ask the user for a string */ res = askfor_aux(buf, len); /* Clear prompt */ clear_msg(); /* Result */ return (res); }
void CXmlOutPro::prtf_ident(PSTR fmt,...) { ident(); va_list argptr; char buf[280]; va_start(argptr, fmt); vsprintf(buf, fmt, argptr); va_end(argptr); prtf("%s",buf); }
//写个struct mulitboot 省着老有警告 用的时候再改 //grub标准里有这个http://gnu.april.org/software/grub/manual/multiboot/multiboot.html //struct multiboot{}; int kmain(struct multiboot_info* mboot_ptr)//name is mentioned in boot.s { init_gdt(); init_idt(); monitor_write("qhello!!@#$%^&*()[]+= bcdef:wworld! 1234"); monitor_write("\n"); monitor_write_hex(256); monitor_write("finished"); monitor_write_dec(256); monitor_write("done ss"); monitor_write_hex(kss); monitor_write("done esp"); monitor_write_hex(kesp); monitor_put('\n'); //init_gdt(); //init_idt(); asm volatile("int $0x3"); asm volatile("int $0x4"); prtf("aa bb %x %u %s 11\t \nbb\n", 10, 10, "str"); //asm volatile("sti"); //init_timer(500); //monitor_write_hex((u32int)&end); prtf("1\tend is at addr :%x end itself:%x kend:%x &kend:%x\n", (u32int)&end, end, kend, &kend); /*旧的paging实现 init_paging(); prtf("paging enabled!\n"); u32int* ptr = (u32int*)0xa0000000; *ptr = 1; */ //新的paging //换了个管理物理内存的方法 这个没啥大区别 //分割物理内存管理 虚拟内存管理 //显式映射虚拟地址 //pmm里搞的都是物理地址 函数返回的也是物理地址 init_pmm ((u32int)&end, 1 << 25);//32MB init_vmm (); /*prtf("mboot_ptr : %x\n", mboot_ptr);//大概0x2d000 没到640k呢 prtf("mem_upper %x\n", mboot_ptr->mem_upper);*/ map(0xa0000000, 0x300000, PAGE_WRITE|PAGE_PRESENT); prtf("mapped!\n"); u32int* ptr = (u32int*)0xa0000000; *ptr = 1; prtf("assigned!\n"); unmap(0xa0000000); prtf("unmapped!\n"); *ptr = 2; prtf("end!\n"); return 0xdeadbeef; }
/* * Verify something with the user * * The "prompt" should take the form "Query? " * * Note that "[y/n]" is appended to the prompt. */ static bool get_check_base(bool def, bool esc, cptr prompt) { int i; /* Do not skip */ p_ptr->state.skip_more = FALSE; /* Paranoia XXX XXX XXX */ message_flush(); /* Prompt for it */ prtf(0, 0, "%.70s[y/n] ", prompt); /* Get an acceptable answer */ while (TRUE) { i = inkey(); if (quick_messages) break; if (i == ESCAPE) break; if (strchr("YyNn\n\r", i)) break; bell("Illegal response to a 'yes/no' question!"); } /* Erase the prompt */ clear_msg(); /* Success? */ switch (i) { case 'y': case 'Y': return (TRUE); case ESCAPE: return (esc); case '\n': case '\r': return (def); default: return (FALSE); } }
/* * Prompts for a keypress * * The "prompt" should take the form "Command: " * * Returns TRUE unless the character is "Escape" */ bool get_com(cptr prompt, char *command) { /* Paranoia XXX XXX XXX */ message_flush(); /* Display a prompt */ prtf(0, 0, prompt); /* Get a key */ *command = inkey(); /* Clear the prompt */ clear_msg(); /* Handle "cancel" */ if (*command == ESCAPE) return (FALSE); /* Success */ return (TRUE); }
int context_menu_player(int mx, int my) { menu_type *m; rect_region r; int selected; char *labels; cave_type *c_ptr = area(p_ptr->px,p_ptr->py); pcave_type *pc_ptr = parea(p_ptr->px,p_ptr->py); feature_type *feat; m = menu_dynamic_new(); if (!m) { return 0; } labels = (char*)string_make(lower_case); m->selections = labels; feat = &(f_info[c_ptr->feat]); menu_dynamic_add_label(m, "Use Item", 'u', 1, labels); /* if player can cast, add casting option */ if (player_is_caster()) { if (player_can_cast()) { menu_dynamic_add_label(m, "Cast", 'm', 2, labels); } else { menu_dynamic_add_label(m, "$Cast", 'm', 2, labels); } } /* if player can use racial powers or mutations, add option */ if (player_has_power()) { if (player_can_use_power()) { menu_dynamic_add_label(m, "Use Power", 'U', 16, labels); } else { menu_dynamic_add_label(m, "$Use Power", 'U', 16, labels); } } /* if player is on stairs add option to use them */ if (feat->flags & FF_EXIT_UP) { menu_dynamic_add_label(m, "Go Up", '<', 11, labels); } if (feat->flags & FF_EXIT_DOWN) { menu_dynamic_add_label(m, "Go Down", '>', 12, labels); } menu_dynamic_add_label(m, "Search", 's', 3, labels); menu_dynamic_add_label(m, "Look", 'l', 6, labels); menu_dynamic_add_label(m, "Rest", 'R', 4, labels); menu_dynamic_add_label(m, "Inventory", 'i', 5, labels); /* if object under player add pickup option */ if (c_ptr->o_idx) { object_type *o_ptr = &(o_list[c_ptr->o_idx]); //if (!squelch_item_ok(o_ptr)) { menu_dynamic_add_label(m, "Floor", 'i', 13, labels); if (inven_carry_okay(o_ptr)) { menu_dynamic_add_label(m, "Pickup", 'g', 14, labels); } else { menu_dynamic_add_label(m, "$Pickup", 'g', 14, labels); } //} } menu_dynamic_add_label(m, "Character", 'C', 7, labels); /* XXX Don't show the keymap line until the keymap list is implemented, to * avoid confusion as to what should be there */ /*menu_dynamic_add(m, "Keymaps", 10);*/ if (!OPT(center_player)) { menu_dynamic_add_label(m, "^Center Map", 'L', 15, labels); } menu_dynamic_add_label(m, "Other", ' ', 9, labels); /* work out display region */ r.width = menu_dynamic_longest_entry(m) + 3 + 2; /* +3 for tag, 2 for pad */ if (mx > Term->wid - r.width - 1) { r.col = Term->wid - r.width - 1; } else { r.col = mx + 1; } r.page_rows = m->count; if (my > Term->hgt - r.page_rows - 1) { if (my - r.page_rows - 1 <= 0) { /* menu has too many items, so put in upper right corner */ r.row = 1; r.col = Term->wid - r.width - 1; } else { r.row = Term->hgt - r.page_rows - 1; } } else { r.row = my + 1; } /* Hack -- no flush needed */ msg_flag = FALSE; screen_save(); button_backup_all(TRUE); menu_layout(m, &r); rect_region_erase_bordered(&r); prtf(0, 0, "($UEnter to select$Y\n$V, $UESC$Y%c$V) Command:", ESCAPE); selected = menu_dynamic_select(m); menu_dynamic_free(m); string_free(labels); button_restore(); screen_load(); switch(selected) { case 1: { /* use an item */ p_ptr->cmd.cmd = 'u'; repeat_check(); do_cmd_use(); } break; case 2: { /* Cast a spell */ p_ptr->cmd.cmd = 'm'; repeat_check(); do_cmd_cast_wrapper(); } break; case 3: { /* search */ p_ptr->cmd.cmd = 's'; repeat_check(); do_cmd_search(); } break; case 4: { /* rest */ p_ptr->cmd.cmd = 'R'; repeat_check(); do_cmd_rest(); } break; case 5: { /* show inventory screen */ Term_keypress('i');//,0); } break; case 6: { /* look mode */ if (target_set(TARGET_LOOK)) { //if (target_set_interactive(TARGET_LOOK, p_ptr->px, p_ptr->py)) { msgf("Target Selected."); } } break; case 7: { /* show character screen */ do_cmd_character(); } break; case 9: { /* show another layer of menu options screen */ int res; while ((res = context_menu_player_2(mx,my)) == 3); if (res == 2) return 3; } break; case 10: { /* show the commands */ int res; while ((res = context_menu_command(mx,my)) == 3); if (res == 2) return 3; } break; case 11: { /* go up stairs */ p_ptr->cmd.cmd = '<'; repeat_check(); do_cmd_go_up(); } break; case 12: { /* go down stairs */ p_ptr->cmd.cmd = '>'; repeat_check(); do_cmd_go_down(); } break; case 13: { if (c_ptr->o_idx) { object_type *o_ptr = &(o_list[c_ptr->o_idx]); /* there is an item on the floor, show the inventory screen starting * from the floor */ if (o_ptr->next_o_idx) { do_cmd_inven_floor(); } else { /* if we only have one item, show the context menu directly */ if (o_ptr->k_idx) { /* Track the object kind */ object_kind_track(o_ptr->k_idx); while (context_menu_object(o_ptr) == 2); } } } } break; case 14: { /* pick the item up */ //cmd_insert(CMD_PICKUP); //cmd_set_arg_item(cmd_get_top(), 0, -1); carry(TRUE); } break; case 15: { /* center the map on the player */ /*panel_center(p_ptr->px, p_ptr->py);*/ do_cmd_center_map(); } break; case 16: { /* use character powers */ p_ptr->cmd.cmd = 'U'; repeat_check(); do_cmd_racial_power(); } break; } return 1; }
int context_menu_player_2(int mx, int my) { menu_type *m; rect_region r; int selected; char *labels; m = menu_dynamic_new(); if (!m) { return 0; } labels = (char*)string_make(lower_case); m->selections = labels; menu_dynamic_add_label(m, "Knowledge", '~', 1, labels); menu_dynamic_add_label(m, "Show Map", 'M', 2, labels); menu_dynamic_add_label(m, "^Show Messages", 'P', 3, labels); menu_dynamic_add_label(m, "Show Monster List", '[', 9, labels); menu_dynamic_add_label(m, "Show Object List", ']', 10, labels); menu_dynamic_add_label(m, "Toggle Searching", 'S', 4, labels); if (player_has_pets()) { menu_dynamic_add_label(m, "Pet Commands", 'p', 5, labels); } menu_dynamic_add_label(m, "Destroy an item", 'k', 6, labels); menu_dynamic_add_label(m, "Options", '=', 8, labels); menu_dynamic_add_label(m, "Commands", '?', 7, labels); menu_dynamic_add_label(m, "Back", ' ', 11, labels); /* work out display region */ r.width = menu_dynamic_longest_entry(m) + 3 + 2; /* +3 for tag, 2 for pad */ if (mx > Term->wid - r.width - 1) { r.col = Term->wid - r.width - 1; } else { r.col = mx + 1; } r.page_rows = m->count; if (my > Term->hgt - r.page_rows - 1) { if (my - r.page_rows - 1 <= 0) { /* menu has too many items, so put in upper right corner */ r.row = 1; r.col = Term->wid - r.width - 1; } else { r.row = Term->hgt - r.page_rows - 1; } } else { r.row = my + 1; } /* Hack -- no flush needed */ msg_flag = FALSE; screen_save(); button_backup_all(TRUE); menu_layout(m, &r); rect_region_erase_bordered(&r); prtf(0, 0, "($UEnter to select$Y\n$V, $UESC$Y%c$V) Command:", ESCAPE); selected = menu_dynamic_select(m); menu_dynamic_free(m); string_free(labels); button_restore(); screen_load(); if (selected == 1) { /* show knowledge screen */ Term_keypress('~');//,0); } else if (selected == 2) { /* Toggle show map */ p_ptr->cmd.cmd = 'M'; repeat_check(); do_cmd_view_map(); } else if (selected == 3) { /* Toggle show messages */ Term_keypress(KTRL('p'));//,0);/*XXX should be ('p', KC_MOD_CONTROL);*/ } else if (selected == 4) { /* Toggle search mode */ Term_keypress('S');//,0); } else if (selected == 5) { /* show pet menu */ p_ptr->cmd.cmd = 'p'; repeat_check(); do_cmd_pet(); } else if (selected == 6) { /* destroy/squelch an item */ Term_keypress('k');//,0); } else if (selected == 7) { /* show the commands */ context_menu_command(mx,my); } else if (selected == 8) { /* show options screen */ Term_keypress('=');//,0); } else if (selected == 9) { /* show the monster list */ p_ptr->cmd.dir = 5; do_cmd_list_monster(0); //Term_keypress('[');//,0); } else if (selected == 10) { /* show the object list */ p_ptr->cmd.dir = 5; do_cmd_list_object(0); //Term_keypress(']');//,0); } else if (selected == 11) { /* show the previous menu again */ return 2; } return 1; }
/* pick the context menu options appropiate for the item */ int context_menu_object(const object_type *o_ptr) { menu_type *m; rect_region r; int selected; int location = 0; char *labels; char header[120]; s16b *list; m = menu_dynamic_new(); if (!m || !o_ptr) { return 0; } object_desc(header, o_ptr, TRUE, 2, sizeof(header)); list = look_up_list((object_type*)o_ptr); if (list) { if (list == &(p_ptr->inventory)) { location = USE_INVEN; } else if (list == &(area(p_ptr->px, p_ptr->py)->o_idx)) { location = USE_FLOOR; } else { /* check if in a container */ location = USE_INVEN; } } else if (GET_ARRAY_INDEX(p_ptr->equipment, o_ptr) >= EQUIP_WIELD) { location = USE_EQUIP; } labels = (char*)string_make(lower_case); m->selections = labels; menu_dynamic_add_label(m, "Inspect", 'I', 1, labels); if (item_tester_hook_is_book(o_ptr)) { if (player_can_cast_from(o_ptr)) { if (player_can_cast()) { menu_dynamic_add_label(m, "Cast", 'm', 8, labels); } else { menu_dynamic_add_label(m, "$Cast", 'm', 8, labels); } if (player_can_study()) { menu_dynamic_add_label(m, "Study", 'G', 10, labels); } else { menu_dynamic_add_label(m, "$Study", 'G', 10, labels); } } if (player_is_caster() && player_can_read()) { menu_dynamic_add_label(m, "Browse", 'b', 9, labels); } } else if (item_tester_hook_useable(o_ptr)) { if (obj_is_wand(o_ptr)) { if (obj_has_charges(o_ptr)) { menu_dynamic_add_label(m, "Aim", 'a', 8, labels); } else { menu_dynamic_add_label(m, "$Aim", 'a', 8, labels); } } else if (obj_is_rod(o_ptr)) { if (obj_can_zap(o_ptr)) { menu_dynamic_add_label(m, "Zap", 'z', 8, labels); } else { menu_dynamic_add_label(m, "$Zap", 'z', 8, labels); } } else if (obj_is_staff(o_ptr)) { if (obj_has_charges(o_ptr)) { menu_dynamic_add_label(m, "Use", 'u', 8, labels); } else { menu_dynamic_add_label(m, "$Use", 'u', 8, labels); } } else if (obj_is_scroll(o_ptr)) { if (player_can_read()) { menu_dynamic_add_label(m, "Read", 'r', 8, labels); } else { menu_dynamic_add_label(m, "$Read", 'r', 8, labels); } } else if (obj_is_potion(o_ptr)) { menu_dynamic_add_label(m, "Quaff", 'q', 8, labels); } else if (obj_is_food(o_ptr)) { menu_dynamic_add_label(m, "Eat", 'E', 8, labels); } else if (item_tester_hook_activate(o_ptr)) { if (obj_is_activatable(o_ptr)) { menu_dynamic_add_label(m, "Activate", 'A', 8, labels); } else { menu_dynamic_add_label(m, "$Activate", 'A', 8, labels); } } else { menu_dynamic_add_label(m, "Use", 'U', 8, labels); } } else if (item_tester_hook_ammo(o_ptr)) { if (obj_can_fire(o_ptr)) { menu_dynamic_add_label(m, "Fire", 'f', 15, labels); } else { menu_dynamic_add_label(m, "$Fire", 'f', 15, labels); } } if (obj_can_refill(o_ptr)) { menu_dynamic_add_label(m, "Refill", 'F', 11, labels); } if (item_tester_hook_wear(o_ptr)) { if (location == USE_EQUIP) { menu_dynamic_add_label(m, "Take off", 't', 3, labels); } else if (location == USE_INVEN) { if (item_tester_hook_armour(o_ptr)) { menu_dynamic_add_label(m, "Wear", 'w', 2, labels); } else { menu_dynamic_add_label(m, "Wield", 'w', 2, labels); } /*menu_dynamic_add_label(m, "Equip", 'w', 2, labels);*/ } } if ((location == USE_INVEN) || (location == USE_EQUIP)) { menu_dynamic_add_label(m, "Drop", 'd', 6, labels); if (o_ptr->number > 1) { menu_dynamic_add_label(m, "Drop All", 'd', 13, labels); } } else if (location == USE_FLOOR) { if (inven_carry_okay(o_ptr)) { menu_dynamic_add_label(m, "Pickup", 'g', 7, labels); } else { menu_dynamic_add_label(m, "$Pickup", 'g', 7, labels); } } menu_dynamic_add_label(m, "Throw", 'v', 12, labels); /*if (obj_has_inscrip(o_ptr)) {*/ if (o_ptr->inscription) { menu_dynamic_add_label(m, "Uninscribe", '}', 5, labels); } else { menu_dynamic_add_label(m, "Inscribe", '{', 4, labels); } menu_dynamic_add_label(m, "Destroy", 'k', 14, labels); #if 0 if (object_is_squelched(o_ptr)) { menu_dynamic_add_label(m, "Unignore", 'k', 14, labels); } else { menu_dynamic_add_label(m, "Ignore", 'k', 14, labels); } #endif /* work out display region */ r.width = menu_dynamic_longest_entry(m) + 3 + 2; /* +3 for tag, 2 for pad */ r.col = Term->wid - r.width - 1; r.row = 1; r.page_rows = m->count; /* Hack -- no flush needed */ msg_flag = FALSE; screen_save(); button_backup_all(TRUE); /* Recall object */ roff_set_width(r.col); roff_obj_aux(o_ptr); roff_set_width(0); menu_layout(m, &r); rect_region_erase_bordered(&r); prtf(0, 0, "($UEnter to select$Y\n$V, $UESC$Y%c$V) Command for %s:", ESCAPE, header); selected = menu_dynamic_select(m); menu_dynamic_free(m); string_free(labels); button_restore(); screen_load(); if (selected == 1) { /* inspect it */ identify_fully_aux(o_ptr); return 2; } else if (selected == 2) { /* wield the item */ set_get_item_object(o_ptr); p_ptr->cmd.cmd = 'w'; do_cmd_wield(); /*cmd_insert(CMD_WIELD); cmd_set_arg_item(cmd_get_top(), 0, slot);*/ } else if (selected == 3) { /* take the item off */ set_get_item_object(o_ptr); p_ptr->cmd.cmd = 't'; do_cmd_takeoff(); /*cmd_insert(CMD_TAKEOFF); cmd_set_arg_item(cmd_get_top(), 0, slot);*/ } else if (selected == 4) { /* inscribe the item */ set_get_item_object(o_ptr); p_ptr->cmd.cmd = '{'; do_cmd_inscribe(); /*cmd_insert(CMD_INSCRIBE); cmd_set_arg_item(cmd_get_top(), 0, slot);*/ } else if (selected == 5) { /* uninscribe the item */ set_get_item_object(o_ptr); p_ptr->cmd.cmd = '}'; do_cmd_uninscribe(); /*cmd_insert(CMD_UNINSCRIBE); cmd_set_arg_item(cmd_get_top(), 0, slot);*/ } else if (selected == 6) { /* drop the item */ set_get_item_object(o_ptr); p_ptr->cmd.cmd = 'd'; do_cmd_drop(); /*cmd_insert(CMD_DROP); cmd_set_arg_item(cmd_get_top(), 0, slot);*/ } else if (selected == 7) { /* pick the item up */ p_ptr->cmd.cmd = 'g'; if (inven_carry_okay(o_ptr)) { py_pickup_aux((object_type*)o_ptr); } else { carry(TRUE); } /*cmd_insert(CMD_PICKUP); cmd_set_arg_item(cmd_get_top(), 0, slot);*/ } else if (selected == 8) { /* use the item */ bool full = item_tester_full; item_tester_full = FALSE; if (player_can_cast_from(o_ptr)) { set_get_item_object(o_ptr); p_ptr->cmd.cmd = 'm'; do_cmd_cast(); } else { set_get_item_object(o_ptr); p_ptr->cmd.cmd = 'u'; repeat_check(); do_cmd_use(); /*cmd_insert(CMD_USE_ANY); cmd_set_arg_item(cmd_get_top(), 0, slot);*/ } item_tester_full = full; } else if (selected == 9) { /* browse a spellbook */ p_ptr->cmd.cmd = 'b'; do_cmd_browse_aux(o_ptr); /* copied from textui_spell_browse */ /*textui_book_browse(o_ptr);*/ return 2; } else if (selected == 10) { /* study a spell book */ p_ptr->cmd.cmd = 'G'; do_cmd_study(FALSE, (object_type*)o_ptr); } else if (selected == 11) { /* use the item to refill a light source */ set_get_item_object(o_ptr); p_ptr->cmd.cmd = 'F'; do_cmd_refill(); /*cmd_insert(CMD_REFILL); cmd_set_arg_item(cmd_get_top(), 0, slot);*/ } else if (selected == 12) { /* throw the item */ set_get_item_object(o_ptr); p_ptr->cmd.cmd = 'v'; repeat_check(); do_cmd_throw(); /*cmd_insert(CMD_THROW); cmd_set_arg_item(cmd_get_top(), 0, slot);*/ } else if (selected == 13) { /* drop all of the item stack */ if (get_check(format("Drop %s? ", header))) { set_get_item_object(o_ptr); p_ptr->cmd.arg = o_ptr->number; p_ptr->cmd.cmd = 'd'; do_cmd_drop(); /*cmd_insert(CMD_DROP); cmd_set_arg_item(cmd_get_top(), 0, slot); cmd_set_arg_number(cmd_get_top(), 1, o_ptr->number);*/ } } else if (selected == 14) { /* squelch or unsquelch the item */ set_get_item_object(o_ptr); p_ptr->cmd.cmd = 'k'; do_cmd_destroy(); /*textui_cmd_destroy_menu(slot);*/ } else if (selected == 15) { /* fire some ammo */ set_get_item_object(o_ptr); p_ptr->cmd.cmd = 'f'; repeat_check(); do_cmd_fire(); } else if (selected == -1) { /* this menu was canceled, tell whatever called us to display its menu again */ return 3; } return 1; }
/* * Display a menu of choices on the screen * * We return the number of active options. */ static int show_menu(int num, menu_type *options, int select, bool scroll, int disp(int), cptr prompt) { int cnt = 0; int i; bool select_me; int x, y; int offset = 0; /* * Display 'special' information */ if (disp) offset = disp(num); /* Border on top of menu */ clear_row(1); /* Will they fit in one column? */ if (num < 19) { for (i = 0; i < num; i++) { select_me = i == select; if (show_option(0, i + 2 + offset, &options[i], I2A(cnt), scroll, select_me)) { cnt++; } } /* Border below menu */ clear_row(num + 2 + offset); } /* Two columns (use numbers as well) */ else if (num < 37) { for (i = 0; i < num; i++) { select_me = i == select; x = (i / 18) * 40; y = (i % 18) + 2; if (show_option(x, y + offset, &options[i], listsym[cnt], scroll, select_me)) { cnt++; } } /* Border below menu */ clear_row(20 + offset); } /* Three columns - need to use upper case letters */ else { for (i = 0; i < num; i++) { select_me = i == select; x = (i / 20) * 30; y = (i % 20) + 2; if (show_option(x, y + offset, &options[i], listsym[cnt], scroll, select_me)) { cnt++; } } /* Border below menu */ clear_row(22 + offset); } /* * Display the prompt. * (Do this last, so we get the cursor in the right spot) */ if (!cnt) { prtf(0, 0, "%s (No commands available, ESC=exit)", prompt); } else if (cnt == 1) { /* Display the prompt */ prtf(0, 0, "%s (Command (a), ESC=exit)", prompt ? prompt : "Select a command: "); } else if (cnt < 19) { /* Display the prompt */ prtf(0, 0, "%s (Command (a-%c), ESC=exit)", prompt ? prompt : "Select a command: " ,I2A(cnt - 1)); } else { /* Display the prompt */ prtf(0, 0, "%s (Command (0-%c), ESC=exit)", prompt ? prompt : "Select a command: " ,listsym[cnt - 1]); } return (cnt); }
void panic_assert(const char* file, u32int line, const char* des) { prtf("%s %u %s\n", file, des, line); while(1); }
void panic(const char* msg, const char* file, u32int line) { prtf("%s %s %u\n", msg, file, line); while(1); }