grub/grub-core/normal/menu_entry.c

1461 lines
33 KiB
C
Raw Normal View History

2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
/*
* GRUB -- GRand Unified Bootloader
2010-01-03 Robert Millan <rmh.grub@aybabtu.com> * boot/i386/pc/boot.S: Update copyright year. * boot/i386/pc/cdboot.S: Likewise. * boot/i386/pc/diskboot.S: Likewise. * boot/i386/pc/lnxboot.S: Likewise. * boot/i386/pc/pxeboot.S: Likewise. * bus/pci.c: Likewise. * commands/cmp.c: Likewise. * commands/help.c: Likewise. * commands/hexdump.c: Likewise. * commands/i386/pc/halt.c: Likewise. * commands/i386/pc/play.c: Likewise. * commands/i386/pc/vbeinfo.c: Likewise. * commands/ls.c: Likewise. * commands/test.c: Likewise. * disk/dmraid_nvidia.c: Likewise. * disk/i386/pc/biosdisk.c: Likewise. * disk/ieee1275/nand.c: Likewise. * disk/ieee1275/ofdisk.c: Likewise. * disk/lvm.c: Likewise. * disk/raid.c: Likewise. * disk/raid6_recover.c: Likewise. * disk/scsi.c: Likewise. * fs/affs.c: Likewise. * fs/cpio.c: Likewise. * fs/ext2.c: Likewise. * fs/hfs.c: Likewise. * fs/iso9660.c: Likewise. * fs/ntfs.c: Likewise. * fs/sfs.c: Likewise. * fs/udf.c: Likewise. * fs/ufs.c: Likewise. * fs/xfs.c: Likewise. * gencmdlist.sh: Likewise. * genmk.rb: Likewise. * include/grub/disk.h: Likewise. * include/grub/efi/api.h: Likewise. * include/grub/efi/efi.h: Likewise. * include/grub/efi/pe32.h: Likewise. * include/grub/elf.h: Likewise. * include/grub/fs.h: Likewise. * include/grub/i386/at_keyboard.h: Likewise. * include/grub/i386/pc/memory.h: Likewise. * include/grub/i386/pc/vbe.h: Likewise. * include/grub/i386/pci.h: Likewise. * include/grub/i386/tsc.h: Likewise. * include/grub/ieee1275/ieee1275.h: Likewise. * include/grub/ntfs.h: Likewise. * include/grub/sparc64/ieee1275/ieee1275.h: Likewise. * include/grub/sparc64/libgcc.h: Likewise. * include/grub/symbol.h: Likewise. * include/grub/types.h: Likewise. * include/multiboot2.h: Likewise. * io/gzio.c: Likewise. * kern/device.c: Likewise. * kern/disk.c: Likewise. * kern/efi/efi.c: Likewise. * kern/efi/mm.c: Likewise. * kern/elf.c: Likewise. * kern/file.c: Likewise. * kern/i386/dl.c: Likewise. * kern/i386/pc/init.c: Likewise. * kern/i386/pc/startup.S: Likewise. * kern/ieee1275/ieee1275.c: Likewise. * kern/ieee1275/init.c: Likewise. * kern/main.c: Likewise. * kern/mm.c: Likewise. * kern/powerpc/dl.c: Likewise. * kern/sparc64/dl.c: Likewise. * kern/x86_64/dl.c: Likewise. * lib/hexdump.c: Likewise. * loader/efi/appleloader.c: Likewise. * loader/i386/ieee1275/linux.c: Likewise. * loader/i386/pc/chainloader.c: Likewise. * loader/i386/pc/linux.c: Likewise. * loader/i386/pc/multiboot2.c: Likewise. * loader/ieee1275/multiboot2.c: Likewise. * loader/multiboot2.c: Likewise. * loader/multiboot_loader.c: Likewise. * loader/powerpc/ieee1275/linux.c: Likewise. * normal/completion.c: Likewise. * normal/menu_entry.c: Likewise. * partmap/apple.c: Likewise. * util/grub.d/10_hurd.in: Likewise. * util/hostfs.c: Likewise. * video/readers/png.c: Likewise.
2010-01-03 22:05:07 +00:00
* Copyright (C) 2005,2006,2007,2008,2009 Free Software Foundation, Inc.
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
*
2007-07-22 Yoshinori K. Okuji <okuji@enbug.org> Migrate to GNU General Public License Version 3. * COPYING: Replaced with the plain text version of GPLv3. * config.guess: Updated from gnulib. * config.sub: Likewise. * geninit.sh: Output a GPLv3 copyright notice. * geninitheader.sh: Likewise. * genmodsrc.sh: Likewise. * gensymlist.sh.in: Likewise. * boot/i386/pc/boot.S: Upgraded to GPLv3. * boot/i386/pc/diskboot.S: Likewise. * boot/i386/pc/pxeboot.S: Likewise. * commands/blocklist.c: Likewise. * commands/boot.c: Likewise. * commands/cat.c: Likewise. * commands/cmp.c: Likewise. * commands/configfile.c: Likewise. * commands/echo.c: Likewise. * commands/help.c: Likewise. * commands/ls.c: Likewise. * commands/search.c: Likewise. * commands/terminal.c: Likewise. * commands/test.c: Likewise. * commands/videotest.c: Likewise. * commands/i386/cpuid.c: Likewise. * commands/i386/pc/halt.c: Likewise. * commands/i386/pc/play.c: Likewise. * commands/i386/pc/reboot.c: Likewise. * commands/i386/pc/vbeinfo.c: Likewise. * commands/i386/pc/vbetest.c: Likewise. * commands/ieee1275/halt.c: Likewise. * commands/ieee1275/reboot.c: Likewise. * commands/ieee1275/suspend.c: Likewise. * disk/loopback.c: Likewise. * disk/lvm.c: Likewise. * disk/raid.c: Likewise. * disk/efi/efidisk.c: Likewise. * disk/i386/pc/biosdisk.c: Likewise. * disk/ieee1275/ofdisk.c: Likewise. * font/manager.c: Likewise. * fs/affs.c: Likewise. * fs/ext2.c: Likewise. * fs/fat.c: Likewise. * fs/fshelp.c: Likewise. * fs/hfs.c: Likewise. * fs/hfsplus.c: Likewise. * fs/iso9660.c: Likewise. * fs/jfs.c: Likewise. * fs/minix.c: Likewise. * fs/sfs.c: Likewise. * fs/ufs.c: Likewise. * fs/xfs.c: Likewise. * hello/hello.c: Likewise. * include/grub/acorn_filecore.h: Likewise. * include/grub/arg.h: Likewise. * include/grub/bitmap.h: Likewise. * include/grub/boot.h: Likewise. * include/grub/cache.h: Likewise. * include/grub/device.h: Likewise. * include/grub/disk.h: Likewise. * include/grub/dl.h: Likewise. * include/grub/elfload.h: Likewise. * include/grub/env.h: Likewise. * include/grub/err.h: Likewise. * include/grub/file.h: Likewise. * include/grub/font.h: Likewise. * include/grub/fs.h: Likewise. * include/grub/fshelp.h: Likewise. * include/grub/gzio.h: Likewise. * include/grub/hfs.h: Likewise. * include/grub/kernel.h: Likewise. * include/grub/loader.h: Likewise. * include/grub/lvm.h: Likewise. * include/grub/misc.h: Likewise. * include/grub/mm.h: Likewise. * include/grub/net.h: Likewise. * include/grub/normal.h: Likewise. * include/grub/parser.h: Likewise. * include/grub/partition.h: Likewise. * include/grub/pc_partition.h: Likewise. * include/grub/raid.h: Likewise. * include/grub/rescue.h: Likewise. * include/grub/script.h: Likewise. * include/grub/setjmp.h: Likewise. * include/grub/symbol.h: Likewise. * include/grub/term.h: Likewise. * include/grub/terminfo.h: Likewise. * include/grub/tparm.h: Likewise. * include/grub/types.h: Likewise. * include/grub/video.h: Likewise. * include/grub/efi/api.h: Likewise. * include/grub/efi/chainloader.h: Likewise. * include/grub/efi/console.h: Likewise. * include/grub/efi/console_control.h: Likewise. * include/grub/efi/disk.h: Likewise. * include/grub/efi/efi.h: Likewise. * include/grub/efi/pe32.h: Likewise. * include/grub/efi/time.h: Likewise. * include/grub/i386/linux.h: Likewise. * include/grub/i386/setjmp.h: Likewise. * include/grub/i386/types.h: Likewise. * include/grub/i386/efi/kernel.h: Likewise. * include/grub/i386/efi/loader.h: Likewise. * include/grub/i386/efi/time.h: Likewise. * include/grub/i386/pc/biosdisk.h: Likewise. * include/grub/i386/pc/boot.h: Likewise. * include/grub/i386/pc/chainloader.h: Likewise. * include/grub/i386/pc/console.h: Likewise. * include/grub/i386/pc/init.h: Likewise. * include/grub/i386/pc/kernel.h: Likewise. * include/grub/i386/pc/loader.h: Likewise. * include/grub/i386/pc/memory.h: Likewise. * include/grub/i386/pc/multiboot.h: Likewise. * include/grub/i386/pc/serial.h: Likewise. * include/grub/i386/pc/time.h: Likewise. * include/grub/i386/pc/vbe.h: Likewise. * include/grub/i386/pc/vbeblit.h: Likewise. * include/grub/i386/pc/vbefill.h: Likewise. * include/grub/i386/pc/vbeutil.h: Likewise. * include/grub/i386/pc/vga.h: Likewise. * include/grub/ieee1275/ieee1275.h: Likewise. * include/grub/ieee1275/ofdisk.h: Likewise. * include/grub/powerpc/libgcc.h: Likewise. * include/grub/powerpc/setjmp.h: Likewise. * include/grub/powerpc/types.h: Likewise. * include/grub/powerpc/ieee1275/biosdisk.h: Likewise. * include/grub/powerpc/ieee1275/console.h: Likewise. * include/grub/powerpc/ieee1275/ieee1275.h: Likewise. * include/grub/powerpc/ieee1275/kernel.h: Likewise. * include/grub/powerpc/ieee1275/loader.h: Likewise. * include/grub/powerpc/ieee1275/multiboot.h: Likewise. * include/grub/powerpc/ieee1275/time.h: Likewise. * include/grub/powerpc/ieee1275/util/biosdisk.h: Likewise. * include/grub/sparc64/libgcc.h: Likewise. * include/grub/sparc64/setjmp.h: Likewise. * include/grub/sparc64/types.h: Likewise. * include/grub/sparc64/ieee1275/console.h: Likewise. * include/grub/sparc64/ieee1275/ieee1275.h: Likewise. * include/grub/sparc64/ieee1275/kernel.h: Likewise. * include/grub/sparc64/ieee1275/time.h: Likewise. * include/grub/util/biosdisk.h: Likewise. * include/grub/util/getroot.h: Likewise. * include/grub/util/lvm.h: Likewise. * include/grub/util/misc.h: Likewise. * include/grub/util/raid.h: Likewise. * include/grub/util/resolve.h: Likewise. * io/gzio.c: Likewise. * kern/device.c: Likewise. * kern/disk.c: Likewise. * kern/dl.c: Likewise. * kern/elf.c: Likewise. * kern/env.c: Likewise. * kern/err.c: Likewise. * kern/file.c: Likewise. * kern/fs.c: Likewise. * kern/loader.c: Likewise. * kern/main.c: Likewise. * kern/misc.c: Likewise. * kern/mm.c: Likewise. * kern/parser.c: Likewise. * kern/partition.c: Likewise. * kern/rescue.c: Likewise. * kern/term.c: Likewise. * kern/efi/efi.c: Likewise. * kern/efi/init.c: Likewise. * kern/efi/mm.c: Likewise. * kern/i386/dl.c: Likewise. * kern/i386/efi/init.c: Likewise. * kern/i386/efi/startup.S: Likewise. * kern/i386/pc/init.c: Likewise. * kern/i386/pc/lzo1x.S: Likewise. * kern/i386/pc/startup.S: Likewise. * kern/ieee1275/ieee1275.c: Likewise. * kern/powerpc/cache.S: Likewise. * kern/powerpc/dl.c: Likewise. * kern/powerpc/ieee1275/cmain.c: Likewise. * kern/powerpc/ieee1275/crt0.S: Likewise. * kern/powerpc/ieee1275/init.c: Likewise. * kern/powerpc/ieee1275/openfw.c: Likewise. * kern/sparc64/cache.S: Likewise. * kern/sparc64/dl.c: Likewise. * kern/sparc64/ieee1275/init.c: Likewise. * kern/sparc64/ieee1275/openfw.c: Likewise. * loader/efi/chainloader.c: Likewise. * loader/efi/chainloader_normal.c: Likewise. * loader/i386/efi/linux.c: Likewise. * loader/i386/efi/linux_normal.c: Likewise. * loader/i386/pc/chainloader.c: Likewise. * loader/i386/pc/chainloader_normal.c: Likewise. * loader/i386/pc/linux.c: Likewise. * loader/i386/pc/linux_normal.c: Likewise. * loader/i386/pc/multiboot.c: Likewise. * loader/i386/pc/multiboot_normal.c: Likewise. * loader/powerpc/ieee1275/linux.c: Likewise. * loader/powerpc/ieee1275/linux_normal.c: Likewise. * normal/arg.c: Likewise. * normal/cmdline.c: Likewise. * normal/command.c: Likewise. * normal/completion.c: Likewise. * normal/execute.c: Likewise. * normal/function.c: Likewise. * normal/lexer.c: Likewise. * normal/main.c: Likewise. * normal/menu.c: Likewise. * normal/menu_entry.c: Likewise. * normal/misc.c: Likewise. * normal/parser.y: Likewise. * normal/script.c: Likewise. * normal/i386/setjmp.S: Likewise. * normal/powerpc/setjmp.S: Likewise. * normal/sparc64/setjmp.S: Likewise. * partmap/acorn.c: Likewise. * partmap/amiga.c: Likewise. * partmap/apple.c: Likewise. * partmap/gpt.c: Likewise. * partmap/pc.c: Likewise. * partmap/sun.c: Likewise. * term/gfxterm.c: Likewise. * term/terminfo.c: Likewise. * term/efi/console.c: Likewise. * term/i386/pc/console.c: Likewise. * term/i386/pc/serial.c: Likewise. * term/i386/pc/vesafb.c: Likewise. * term/i386/pc/vga.c: Likewise. * term/ieee1275/ofconsole.c: Likewise. * util/biosdisk.c: Likewise. * util/console.c: Likewise. * util/genmoddep.c: Likewise. * util/getroot.c: Likewise. * util/grub-emu.c: Likewise. * util/grub-mkdevicemap.c: Likewise. * util/grub-probe.c: Likewise. * util/lvm.c: Likewise. * util/misc.c: Likewise. * util/raid.c: Likewise. * util/resolve.c: Likewise. * util/update-grub.in: Likewise. * util/update-grub_lib.in: Likewise. * util/grub.d/00_header.in: Likewise. * util/grub.d/10_hurd.in: Likewise. * util/grub.d/10_linux.in: Likewise. * util/i386/efi/grub-install.in: Likewise. * util/i386/efi/grub-mkimage.c: Likewise. * util/i386/pc/grub-install.in: Likewise. * util/i386/pc/grub-mkimage.c: Likewise. * util/i386/pc/grub-mkrescue.in: Likewise. * util/i386/pc/grub-setup.c: Likewise. * util/i386/pc/misc.c: Likewise. * util/powerpc/ieee1275/grub-install.in: Likewise. * util/powerpc/ieee1275/grub-mkimage.c: Likewise. * util/powerpc/ieee1275/misc.c: Likewise. * video/bitmap.c: Likewise. * video/video.c: Likewise. * video/i386/pc/vbe.c: Likewise. * video/i386/pc/vbeblit.c: Likewise. * video/i386/pc/vbefill.c: Likewise. * video/i386/pc/vbeutil.c: Likewise. * video/readers/tga.c: Likewise.
2007-07-21 23:32:33 +00:00
* GRUB is free software: you can redistribute it and/or modify
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
* it under the terms of the GNU General Public License as published by
2007-07-22 Yoshinori K. Okuji <okuji@enbug.org> Migrate to GNU General Public License Version 3. * COPYING: Replaced with the plain text version of GPLv3. * config.guess: Updated from gnulib. * config.sub: Likewise. * geninit.sh: Output a GPLv3 copyright notice. * geninitheader.sh: Likewise. * genmodsrc.sh: Likewise. * gensymlist.sh.in: Likewise. * boot/i386/pc/boot.S: Upgraded to GPLv3. * boot/i386/pc/diskboot.S: Likewise. * boot/i386/pc/pxeboot.S: Likewise. * commands/blocklist.c: Likewise. * commands/boot.c: Likewise. * commands/cat.c: Likewise. * commands/cmp.c: Likewise. * commands/configfile.c: Likewise. * commands/echo.c: Likewise. * commands/help.c: Likewise. * commands/ls.c: Likewise. * commands/search.c: Likewise. * commands/terminal.c: Likewise. * commands/test.c: Likewise. * commands/videotest.c: Likewise. * commands/i386/cpuid.c: Likewise. * commands/i386/pc/halt.c: Likewise. * commands/i386/pc/play.c: Likewise. * commands/i386/pc/reboot.c: Likewise. * commands/i386/pc/vbeinfo.c: Likewise. * commands/i386/pc/vbetest.c: Likewise. * commands/ieee1275/halt.c: Likewise. * commands/ieee1275/reboot.c: Likewise. * commands/ieee1275/suspend.c: Likewise. * disk/loopback.c: Likewise. * disk/lvm.c: Likewise. * disk/raid.c: Likewise. * disk/efi/efidisk.c: Likewise. * disk/i386/pc/biosdisk.c: Likewise. * disk/ieee1275/ofdisk.c: Likewise. * font/manager.c: Likewise. * fs/affs.c: Likewise. * fs/ext2.c: Likewise. * fs/fat.c: Likewise. * fs/fshelp.c: Likewise. * fs/hfs.c: Likewise. * fs/hfsplus.c: Likewise. * fs/iso9660.c: Likewise. * fs/jfs.c: Likewise. * fs/minix.c: Likewise. * fs/sfs.c: Likewise. * fs/ufs.c: Likewise. * fs/xfs.c: Likewise. * hello/hello.c: Likewise. * include/grub/acorn_filecore.h: Likewise. * include/grub/arg.h: Likewise. * include/grub/bitmap.h: Likewise. * include/grub/boot.h: Likewise. * include/grub/cache.h: Likewise. * include/grub/device.h: Likewise. * include/grub/disk.h: Likewise. * include/grub/dl.h: Likewise. * include/grub/elfload.h: Likewise. * include/grub/env.h: Likewise. * include/grub/err.h: Likewise. * include/grub/file.h: Likewise. * include/grub/font.h: Likewise. * include/grub/fs.h: Likewise. * include/grub/fshelp.h: Likewise. * include/grub/gzio.h: Likewise. * include/grub/hfs.h: Likewise. * include/grub/kernel.h: Likewise. * include/grub/loader.h: Likewise. * include/grub/lvm.h: Likewise. * include/grub/misc.h: Likewise. * include/grub/mm.h: Likewise. * include/grub/net.h: Likewise. * include/grub/normal.h: Likewise. * include/grub/parser.h: Likewise. * include/grub/partition.h: Likewise. * include/grub/pc_partition.h: Likewise. * include/grub/raid.h: Likewise. * include/grub/rescue.h: Likewise. * include/grub/script.h: Likewise. * include/grub/setjmp.h: Likewise. * include/grub/symbol.h: Likewise. * include/grub/term.h: Likewise. * include/grub/terminfo.h: Likewise. * include/grub/tparm.h: Likewise. * include/grub/types.h: Likewise. * include/grub/video.h: Likewise. * include/grub/efi/api.h: Likewise. * include/grub/efi/chainloader.h: Likewise. * include/grub/efi/console.h: Likewise. * include/grub/efi/console_control.h: Likewise. * include/grub/efi/disk.h: Likewise. * include/grub/efi/efi.h: Likewise. * include/grub/efi/pe32.h: Likewise. * include/grub/efi/time.h: Likewise. * include/grub/i386/linux.h: Likewise. * include/grub/i386/setjmp.h: Likewise. * include/grub/i386/types.h: Likewise. * include/grub/i386/efi/kernel.h: Likewise. * include/grub/i386/efi/loader.h: Likewise. * include/grub/i386/efi/time.h: Likewise. * include/grub/i386/pc/biosdisk.h: Likewise. * include/grub/i386/pc/boot.h: Likewise. * include/grub/i386/pc/chainloader.h: Likewise. * include/grub/i386/pc/console.h: Likewise. * include/grub/i386/pc/init.h: Likewise. * include/grub/i386/pc/kernel.h: Likewise. * include/grub/i386/pc/loader.h: Likewise. * include/grub/i386/pc/memory.h: Likewise. * include/grub/i386/pc/multiboot.h: Likewise. * include/grub/i386/pc/serial.h: Likewise. * include/grub/i386/pc/time.h: Likewise. * include/grub/i386/pc/vbe.h: Likewise. * include/grub/i386/pc/vbeblit.h: Likewise. * include/grub/i386/pc/vbefill.h: Likewise. * include/grub/i386/pc/vbeutil.h: Likewise. * include/grub/i386/pc/vga.h: Likewise. * include/grub/ieee1275/ieee1275.h: Likewise. * include/grub/ieee1275/ofdisk.h: Likewise. * include/grub/powerpc/libgcc.h: Likewise. * include/grub/powerpc/setjmp.h: Likewise. * include/grub/powerpc/types.h: Likewise. * include/grub/powerpc/ieee1275/biosdisk.h: Likewise. * include/grub/powerpc/ieee1275/console.h: Likewise. * include/grub/powerpc/ieee1275/ieee1275.h: Likewise. * include/grub/powerpc/ieee1275/kernel.h: Likewise. * include/grub/powerpc/ieee1275/loader.h: Likewise. * include/grub/powerpc/ieee1275/multiboot.h: Likewise. * include/grub/powerpc/ieee1275/time.h: Likewise. * include/grub/powerpc/ieee1275/util/biosdisk.h: Likewise. * include/grub/sparc64/libgcc.h: Likewise. * include/grub/sparc64/setjmp.h: Likewise. * include/grub/sparc64/types.h: Likewise. * include/grub/sparc64/ieee1275/console.h: Likewise. * include/grub/sparc64/ieee1275/ieee1275.h: Likewise. * include/grub/sparc64/ieee1275/kernel.h: Likewise. * include/grub/sparc64/ieee1275/time.h: Likewise. * include/grub/util/biosdisk.h: Likewise. * include/grub/util/getroot.h: Likewise. * include/grub/util/lvm.h: Likewise. * include/grub/util/misc.h: Likewise. * include/grub/util/raid.h: Likewise. * include/grub/util/resolve.h: Likewise. * io/gzio.c: Likewise. * kern/device.c: Likewise. * kern/disk.c: Likewise. * kern/dl.c: Likewise. * kern/elf.c: Likewise. * kern/env.c: Likewise. * kern/err.c: Likewise. * kern/file.c: Likewise. * kern/fs.c: Likewise. * kern/loader.c: Likewise. * kern/main.c: Likewise. * kern/misc.c: Likewise. * kern/mm.c: Likewise. * kern/parser.c: Likewise. * kern/partition.c: Likewise. * kern/rescue.c: Likewise. * kern/term.c: Likewise. * kern/efi/efi.c: Likewise. * kern/efi/init.c: Likewise. * kern/efi/mm.c: Likewise. * kern/i386/dl.c: Likewise. * kern/i386/efi/init.c: Likewise. * kern/i386/efi/startup.S: Likewise. * kern/i386/pc/init.c: Likewise. * kern/i386/pc/lzo1x.S: Likewise. * kern/i386/pc/startup.S: Likewise. * kern/ieee1275/ieee1275.c: Likewise. * kern/powerpc/cache.S: Likewise. * kern/powerpc/dl.c: Likewise. * kern/powerpc/ieee1275/cmain.c: Likewise. * kern/powerpc/ieee1275/crt0.S: Likewise. * kern/powerpc/ieee1275/init.c: Likewise. * kern/powerpc/ieee1275/openfw.c: Likewise. * kern/sparc64/cache.S: Likewise. * kern/sparc64/dl.c: Likewise. * kern/sparc64/ieee1275/init.c: Likewise. * kern/sparc64/ieee1275/openfw.c: Likewise. * loader/efi/chainloader.c: Likewise. * loader/efi/chainloader_normal.c: Likewise. * loader/i386/efi/linux.c: Likewise. * loader/i386/efi/linux_normal.c: Likewise. * loader/i386/pc/chainloader.c: Likewise. * loader/i386/pc/chainloader_normal.c: Likewise. * loader/i386/pc/linux.c: Likewise. * loader/i386/pc/linux_normal.c: Likewise. * loader/i386/pc/multiboot.c: Likewise. * loader/i386/pc/multiboot_normal.c: Likewise. * loader/powerpc/ieee1275/linux.c: Likewise. * loader/powerpc/ieee1275/linux_normal.c: Likewise. * normal/arg.c: Likewise. * normal/cmdline.c: Likewise. * normal/command.c: Likewise. * normal/completion.c: Likewise. * normal/execute.c: Likewise. * normal/function.c: Likewise. * normal/lexer.c: Likewise. * normal/main.c: Likewise. * normal/menu.c: Likewise. * normal/menu_entry.c: Likewise. * normal/misc.c: Likewise. * normal/parser.y: Likewise. * normal/script.c: Likewise. * normal/i386/setjmp.S: Likewise. * normal/powerpc/setjmp.S: Likewise. * normal/sparc64/setjmp.S: Likewise. * partmap/acorn.c: Likewise. * partmap/amiga.c: Likewise. * partmap/apple.c: Likewise. * partmap/gpt.c: Likewise. * partmap/pc.c: Likewise. * partmap/sun.c: Likewise. * term/gfxterm.c: Likewise. * term/terminfo.c: Likewise. * term/efi/console.c: Likewise. * term/i386/pc/console.c: Likewise. * term/i386/pc/serial.c: Likewise. * term/i386/pc/vesafb.c: Likewise. * term/i386/pc/vga.c: Likewise. * term/ieee1275/ofconsole.c: Likewise. * util/biosdisk.c: Likewise. * util/console.c: Likewise. * util/genmoddep.c: Likewise. * util/getroot.c: Likewise. * util/grub-emu.c: Likewise. * util/grub-mkdevicemap.c: Likewise. * util/grub-probe.c: Likewise. * util/lvm.c: Likewise. * util/misc.c: Likewise. * util/raid.c: Likewise. * util/resolve.c: Likewise. * util/update-grub.in: Likewise. * util/update-grub_lib.in: Likewise. * util/grub.d/00_header.in: Likewise. * util/grub.d/10_hurd.in: Likewise. * util/grub.d/10_linux.in: Likewise. * util/i386/efi/grub-install.in: Likewise. * util/i386/efi/grub-mkimage.c: Likewise. * util/i386/pc/grub-install.in: Likewise. * util/i386/pc/grub-mkimage.c: Likewise. * util/i386/pc/grub-mkrescue.in: Likewise. * util/i386/pc/grub-setup.c: Likewise. * util/i386/pc/misc.c: Likewise. * util/powerpc/ieee1275/grub-install.in: Likewise. * util/powerpc/ieee1275/grub-mkimage.c: Likewise. * util/powerpc/ieee1275/misc.c: Likewise. * video/bitmap.c: Likewise. * video/video.c: Likewise. * video/i386/pc/vbe.c: Likewise. * video/i386/pc/vbeblit.c: Likewise. * video/i386/pc/vbefill.c: Likewise. * video/i386/pc/vbeutil.c: Likewise. * video/readers/tga.c: Likewise.
2007-07-21 23:32:33 +00:00
* the Free Software Foundation, either version 3 of the License, or
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
* (at your option) any later version.
*
2007-07-22 Yoshinori K. Okuji <okuji@enbug.org> Migrate to GNU General Public License Version 3. * COPYING: Replaced with the plain text version of GPLv3. * config.guess: Updated from gnulib. * config.sub: Likewise. * geninit.sh: Output a GPLv3 copyright notice. * geninitheader.sh: Likewise. * genmodsrc.sh: Likewise. * gensymlist.sh.in: Likewise. * boot/i386/pc/boot.S: Upgraded to GPLv3. * boot/i386/pc/diskboot.S: Likewise. * boot/i386/pc/pxeboot.S: Likewise. * commands/blocklist.c: Likewise. * commands/boot.c: Likewise. * commands/cat.c: Likewise. * commands/cmp.c: Likewise. * commands/configfile.c: Likewise. * commands/echo.c: Likewise. * commands/help.c: Likewise. * commands/ls.c: Likewise. * commands/search.c: Likewise. * commands/terminal.c: Likewise. * commands/test.c: Likewise. * commands/videotest.c: Likewise. * commands/i386/cpuid.c: Likewise. * commands/i386/pc/halt.c: Likewise. * commands/i386/pc/play.c: Likewise. * commands/i386/pc/reboot.c: Likewise. * commands/i386/pc/vbeinfo.c: Likewise. * commands/i386/pc/vbetest.c: Likewise. * commands/ieee1275/halt.c: Likewise. * commands/ieee1275/reboot.c: Likewise. * commands/ieee1275/suspend.c: Likewise. * disk/loopback.c: Likewise. * disk/lvm.c: Likewise. * disk/raid.c: Likewise. * disk/efi/efidisk.c: Likewise. * disk/i386/pc/biosdisk.c: Likewise. * disk/ieee1275/ofdisk.c: Likewise. * font/manager.c: Likewise. * fs/affs.c: Likewise. * fs/ext2.c: Likewise. * fs/fat.c: Likewise. * fs/fshelp.c: Likewise. * fs/hfs.c: Likewise. * fs/hfsplus.c: Likewise. * fs/iso9660.c: Likewise. * fs/jfs.c: Likewise. * fs/minix.c: Likewise. * fs/sfs.c: Likewise. * fs/ufs.c: Likewise. * fs/xfs.c: Likewise. * hello/hello.c: Likewise. * include/grub/acorn_filecore.h: Likewise. * include/grub/arg.h: Likewise. * include/grub/bitmap.h: Likewise. * include/grub/boot.h: Likewise. * include/grub/cache.h: Likewise. * include/grub/device.h: Likewise. * include/grub/disk.h: Likewise. * include/grub/dl.h: Likewise. * include/grub/elfload.h: Likewise. * include/grub/env.h: Likewise. * include/grub/err.h: Likewise. * include/grub/file.h: Likewise. * include/grub/font.h: Likewise. * include/grub/fs.h: Likewise. * include/grub/fshelp.h: Likewise. * include/grub/gzio.h: Likewise. * include/grub/hfs.h: Likewise. * include/grub/kernel.h: Likewise. * include/grub/loader.h: Likewise. * include/grub/lvm.h: Likewise. * include/grub/misc.h: Likewise. * include/grub/mm.h: Likewise. * include/grub/net.h: Likewise. * include/grub/normal.h: Likewise. * include/grub/parser.h: Likewise. * include/grub/partition.h: Likewise. * include/grub/pc_partition.h: Likewise. * include/grub/raid.h: Likewise. * include/grub/rescue.h: Likewise. * include/grub/script.h: Likewise. * include/grub/setjmp.h: Likewise. * include/grub/symbol.h: Likewise. * include/grub/term.h: Likewise. * include/grub/terminfo.h: Likewise. * include/grub/tparm.h: Likewise. * include/grub/types.h: Likewise. * include/grub/video.h: Likewise. * include/grub/efi/api.h: Likewise. * include/grub/efi/chainloader.h: Likewise. * include/grub/efi/console.h: Likewise. * include/grub/efi/console_control.h: Likewise. * include/grub/efi/disk.h: Likewise. * include/grub/efi/efi.h: Likewise. * include/grub/efi/pe32.h: Likewise. * include/grub/efi/time.h: Likewise. * include/grub/i386/linux.h: Likewise. * include/grub/i386/setjmp.h: Likewise. * include/grub/i386/types.h: Likewise. * include/grub/i386/efi/kernel.h: Likewise. * include/grub/i386/efi/loader.h: Likewise. * include/grub/i386/efi/time.h: Likewise. * include/grub/i386/pc/biosdisk.h: Likewise. * include/grub/i386/pc/boot.h: Likewise. * include/grub/i386/pc/chainloader.h: Likewise. * include/grub/i386/pc/console.h: Likewise. * include/grub/i386/pc/init.h: Likewise. * include/grub/i386/pc/kernel.h: Likewise. * include/grub/i386/pc/loader.h: Likewise. * include/grub/i386/pc/memory.h: Likewise. * include/grub/i386/pc/multiboot.h: Likewise. * include/grub/i386/pc/serial.h: Likewise. * include/grub/i386/pc/time.h: Likewise. * include/grub/i386/pc/vbe.h: Likewise. * include/grub/i386/pc/vbeblit.h: Likewise. * include/grub/i386/pc/vbefill.h: Likewise. * include/grub/i386/pc/vbeutil.h: Likewise. * include/grub/i386/pc/vga.h: Likewise. * include/grub/ieee1275/ieee1275.h: Likewise. * include/grub/ieee1275/ofdisk.h: Likewise. * include/grub/powerpc/libgcc.h: Likewise. * include/grub/powerpc/setjmp.h: Likewise. * include/grub/powerpc/types.h: Likewise. * include/grub/powerpc/ieee1275/biosdisk.h: Likewise. * include/grub/powerpc/ieee1275/console.h: Likewise. * include/grub/powerpc/ieee1275/ieee1275.h: Likewise. * include/grub/powerpc/ieee1275/kernel.h: Likewise. * include/grub/powerpc/ieee1275/loader.h: Likewise. * include/grub/powerpc/ieee1275/multiboot.h: Likewise. * include/grub/powerpc/ieee1275/time.h: Likewise. * include/grub/powerpc/ieee1275/util/biosdisk.h: Likewise. * include/grub/sparc64/libgcc.h: Likewise. * include/grub/sparc64/setjmp.h: Likewise. * include/grub/sparc64/types.h: Likewise. * include/grub/sparc64/ieee1275/console.h: Likewise. * include/grub/sparc64/ieee1275/ieee1275.h: Likewise. * include/grub/sparc64/ieee1275/kernel.h: Likewise. * include/grub/sparc64/ieee1275/time.h: Likewise. * include/grub/util/biosdisk.h: Likewise. * include/grub/util/getroot.h: Likewise. * include/grub/util/lvm.h: Likewise. * include/grub/util/misc.h: Likewise. * include/grub/util/raid.h: Likewise. * include/grub/util/resolve.h: Likewise. * io/gzio.c: Likewise. * kern/device.c: Likewise. * kern/disk.c: Likewise. * kern/dl.c: Likewise. * kern/elf.c: Likewise. * kern/env.c: Likewise. * kern/err.c: Likewise. * kern/file.c: Likewise. * kern/fs.c: Likewise. * kern/loader.c: Likewise. * kern/main.c: Likewise. * kern/misc.c: Likewise. * kern/mm.c: Likewise. * kern/parser.c: Likewise. * kern/partition.c: Likewise. * kern/rescue.c: Likewise. * kern/term.c: Likewise. * kern/efi/efi.c: Likewise. * kern/efi/init.c: Likewise. * kern/efi/mm.c: Likewise. * kern/i386/dl.c: Likewise. * kern/i386/efi/init.c: Likewise. * kern/i386/efi/startup.S: Likewise. * kern/i386/pc/init.c: Likewise. * kern/i386/pc/lzo1x.S: Likewise. * kern/i386/pc/startup.S: Likewise. * kern/ieee1275/ieee1275.c: Likewise. * kern/powerpc/cache.S: Likewise. * kern/powerpc/dl.c: Likewise. * kern/powerpc/ieee1275/cmain.c: Likewise. * kern/powerpc/ieee1275/crt0.S: Likewise. * kern/powerpc/ieee1275/init.c: Likewise. * kern/powerpc/ieee1275/openfw.c: Likewise. * kern/sparc64/cache.S: Likewise. * kern/sparc64/dl.c: Likewise. * kern/sparc64/ieee1275/init.c: Likewise. * kern/sparc64/ieee1275/openfw.c: Likewise. * loader/efi/chainloader.c: Likewise. * loader/efi/chainloader_normal.c: Likewise. * loader/i386/efi/linux.c: Likewise. * loader/i386/efi/linux_normal.c: Likewise. * loader/i386/pc/chainloader.c: Likewise. * loader/i386/pc/chainloader_normal.c: Likewise. * loader/i386/pc/linux.c: Likewise. * loader/i386/pc/linux_normal.c: Likewise. * loader/i386/pc/multiboot.c: Likewise. * loader/i386/pc/multiboot_normal.c: Likewise. * loader/powerpc/ieee1275/linux.c: Likewise. * loader/powerpc/ieee1275/linux_normal.c: Likewise. * normal/arg.c: Likewise. * normal/cmdline.c: Likewise. * normal/command.c: Likewise. * normal/completion.c: Likewise. * normal/execute.c: Likewise. * normal/function.c: Likewise. * normal/lexer.c: Likewise. * normal/main.c: Likewise. * normal/menu.c: Likewise. * normal/menu_entry.c: Likewise. * normal/misc.c: Likewise. * normal/parser.y: Likewise. * normal/script.c: Likewise. * normal/i386/setjmp.S: Likewise. * normal/powerpc/setjmp.S: Likewise. * normal/sparc64/setjmp.S: Likewise. * partmap/acorn.c: Likewise. * partmap/amiga.c: Likewise. * partmap/apple.c: Likewise. * partmap/gpt.c: Likewise. * partmap/pc.c: Likewise. * partmap/sun.c: Likewise. * term/gfxterm.c: Likewise. * term/terminfo.c: Likewise. * term/efi/console.c: Likewise. * term/i386/pc/console.c: Likewise. * term/i386/pc/serial.c: Likewise. * term/i386/pc/vesafb.c: Likewise. * term/i386/pc/vga.c: Likewise. * term/ieee1275/ofconsole.c: Likewise. * util/biosdisk.c: Likewise. * util/console.c: Likewise. * util/genmoddep.c: Likewise. * util/getroot.c: Likewise. * util/grub-emu.c: Likewise. * util/grub-mkdevicemap.c: Likewise. * util/grub-probe.c: Likewise. * util/lvm.c: Likewise. * util/misc.c: Likewise. * util/raid.c: Likewise. * util/resolve.c: Likewise. * util/update-grub.in: Likewise. * util/update-grub_lib.in: Likewise. * util/grub.d/00_header.in: Likewise. * util/grub.d/10_hurd.in: Likewise. * util/grub.d/10_linux.in: Likewise. * util/i386/efi/grub-install.in: Likewise. * util/i386/efi/grub-mkimage.c: Likewise. * util/i386/pc/grub-install.in: Likewise. * util/i386/pc/grub-mkimage.c: Likewise. * util/i386/pc/grub-mkrescue.in: Likewise. * util/i386/pc/grub-setup.c: Likewise. * util/i386/pc/misc.c: Likewise. * util/powerpc/ieee1275/grub-install.in: Likewise. * util/powerpc/ieee1275/grub-mkimage.c: Likewise. * util/powerpc/ieee1275/misc.c: Likewise. * video/bitmap.c: Likewise. * video/video.c: Likewise. * video/i386/pc/vbe.c: Likewise. * video/i386/pc/vbeblit.c: Likewise. * video/i386/pc/vbefill.c: Likewise. * video/i386/pc/vbeutil.c: Likewise. * video/readers/tga.c: Likewise.
2007-07-21 23:32:33 +00:00
* GRUB is distributed in the hope that it will be useful,
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
2007-07-22 Yoshinori K. Okuji <okuji@enbug.org> Migrate to GNU General Public License Version 3. * COPYING: Replaced with the plain text version of GPLv3. * config.guess: Updated from gnulib. * config.sub: Likewise. * geninit.sh: Output a GPLv3 copyright notice. * geninitheader.sh: Likewise. * genmodsrc.sh: Likewise. * gensymlist.sh.in: Likewise. * boot/i386/pc/boot.S: Upgraded to GPLv3. * boot/i386/pc/diskboot.S: Likewise. * boot/i386/pc/pxeboot.S: Likewise. * commands/blocklist.c: Likewise. * commands/boot.c: Likewise. * commands/cat.c: Likewise. * commands/cmp.c: Likewise. * commands/configfile.c: Likewise. * commands/echo.c: Likewise. * commands/help.c: Likewise. * commands/ls.c: Likewise. * commands/search.c: Likewise. * commands/terminal.c: Likewise. * commands/test.c: Likewise. * commands/videotest.c: Likewise. * commands/i386/cpuid.c: Likewise. * commands/i386/pc/halt.c: Likewise. * commands/i386/pc/play.c: Likewise. * commands/i386/pc/reboot.c: Likewise. * commands/i386/pc/vbeinfo.c: Likewise. * commands/i386/pc/vbetest.c: Likewise. * commands/ieee1275/halt.c: Likewise. * commands/ieee1275/reboot.c: Likewise. * commands/ieee1275/suspend.c: Likewise. * disk/loopback.c: Likewise. * disk/lvm.c: Likewise. * disk/raid.c: Likewise. * disk/efi/efidisk.c: Likewise. * disk/i386/pc/biosdisk.c: Likewise. * disk/ieee1275/ofdisk.c: Likewise. * font/manager.c: Likewise. * fs/affs.c: Likewise. * fs/ext2.c: Likewise. * fs/fat.c: Likewise. * fs/fshelp.c: Likewise. * fs/hfs.c: Likewise. * fs/hfsplus.c: Likewise. * fs/iso9660.c: Likewise. * fs/jfs.c: Likewise. * fs/minix.c: Likewise. * fs/sfs.c: Likewise. * fs/ufs.c: Likewise. * fs/xfs.c: Likewise. * hello/hello.c: Likewise. * include/grub/acorn_filecore.h: Likewise. * include/grub/arg.h: Likewise. * include/grub/bitmap.h: Likewise. * include/grub/boot.h: Likewise. * include/grub/cache.h: Likewise. * include/grub/device.h: Likewise. * include/grub/disk.h: Likewise. * include/grub/dl.h: Likewise. * include/grub/elfload.h: Likewise. * include/grub/env.h: Likewise. * include/grub/err.h: Likewise. * include/grub/file.h: Likewise. * include/grub/font.h: Likewise. * include/grub/fs.h: Likewise. * include/grub/fshelp.h: Likewise. * include/grub/gzio.h: Likewise. * include/grub/hfs.h: Likewise. * include/grub/kernel.h: Likewise. * include/grub/loader.h: Likewise. * include/grub/lvm.h: Likewise. * include/grub/misc.h: Likewise. * include/grub/mm.h: Likewise. * include/grub/net.h: Likewise. * include/grub/normal.h: Likewise. * include/grub/parser.h: Likewise. * include/grub/partition.h: Likewise. * include/grub/pc_partition.h: Likewise. * include/grub/raid.h: Likewise. * include/grub/rescue.h: Likewise. * include/grub/script.h: Likewise. * include/grub/setjmp.h: Likewise. * include/grub/symbol.h: Likewise. * include/grub/term.h: Likewise. * include/grub/terminfo.h: Likewise. * include/grub/tparm.h: Likewise. * include/grub/types.h: Likewise. * include/grub/video.h: Likewise. * include/grub/efi/api.h: Likewise. * include/grub/efi/chainloader.h: Likewise. * include/grub/efi/console.h: Likewise. * include/grub/efi/console_control.h: Likewise. * include/grub/efi/disk.h: Likewise. * include/grub/efi/efi.h: Likewise. * include/grub/efi/pe32.h: Likewise. * include/grub/efi/time.h: Likewise. * include/grub/i386/linux.h: Likewise. * include/grub/i386/setjmp.h: Likewise. * include/grub/i386/types.h: Likewise. * include/grub/i386/efi/kernel.h: Likewise. * include/grub/i386/efi/loader.h: Likewise. * include/grub/i386/efi/time.h: Likewise. * include/grub/i386/pc/biosdisk.h: Likewise. * include/grub/i386/pc/boot.h: Likewise. * include/grub/i386/pc/chainloader.h: Likewise. * include/grub/i386/pc/console.h: Likewise. * include/grub/i386/pc/init.h: Likewise. * include/grub/i386/pc/kernel.h: Likewise. * include/grub/i386/pc/loader.h: Likewise. * include/grub/i386/pc/memory.h: Likewise. * include/grub/i386/pc/multiboot.h: Likewise. * include/grub/i386/pc/serial.h: Likewise. * include/grub/i386/pc/time.h: Likewise. * include/grub/i386/pc/vbe.h: Likewise. * include/grub/i386/pc/vbeblit.h: Likewise. * include/grub/i386/pc/vbefill.h: Likewise. * include/grub/i386/pc/vbeutil.h: Likewise. * include/grub/i386/pc/vga.h: Likewise. * include/grub/ieee1275/ieee1275.h: Likewise. * include/grub/ieee1275/ofdisk.h: Likewise. * include/grub/powerpc/libgcc.h: Likewise. * include/grub/powerpc/setjmp.h: Likewise. * include/grub/powerpc/types.h: Likewise. * include/grub/powerpc/ieee1275/biosdisk.h: Likewise. * include/grub/powerpc/ieee1275/console.h: Likewise. * include/grub/powerpc/ieee1275/ieee1275.h: Likewise. * include/grub/powerpc/ieee1275/kernel.h: Likewise. * include/grub/powerpc/ieee1275/loader.h: Likewise. * include/grub/powerpc/ieee1275/multiboot.h: Likewise. * include/grub/powerpc/ieee1275/time.h: Likewise. * include/grub/powerpc/ieee1275/util/biosdisk.h: Likewise. * include/grub/sparc64/libgcc.h: Likewise. * include/grub/sparc64/setjmp.h: Likewise. * include/grub/sparc64/types.h: Likewise. * include/grub/sparc64/ieee1275/console.h: Likewise. * include/grub/sparc64/ieee1275/ieee1275.h: Likewise. * include/grub/sparc64/ieee1275/kernel.h: Likewise. * include/grub/sparc64/ieee1275/time.h: Likewise. * include/grub/util/biosdisk.h: Likewise. * include/grub/util/getroot.h: Likewise. * include/grub/util/lvm.h: Likewise. * include/grub/util/misc.h: Likewise. * include/grub/util/raid.h: Likewise. * include/grub/util/resolve.h: Likewise. * io/gzio.c: Likewise. * kern/device.c: Likewise. * kern/disk.c: Likewise. * kern/dl.c: Likewise. * kern/elf.c: Likewise. * kern/env.c: Likewise. * kern/err.c: Likewise. * kern/file.c: Likewise. * kern/fs.c: Likewise. * kern/loader.c: Likewise. * kern/main.c: Likewise. * kern/misc.c: Likewise. * kern/mm.c: Likewise. * kern/parser.c: Likewise. * kern/partition.c: Likewise. * kern/rescue.c: Likewise. * kern/term.c: Likewise. * kern/efi/efi.c: Likewise. * kern/efi/init.c: Likewise. * kern/efi/mm.c: Likewise. * kern/i386/dl.c: Likewise. * kern/i386/efi/init.c: Likewise. * kern/i386/efi/startup.S: Likewise. * kern/i386/pc/init.c: Likewise. * kern/i386/pc/lzo1x.S: Likewise. * kern/i386/pc/startup.S: Likewise. * kern/ieee1275/ieee1275.c: Likewise. * kern/powerpc/cache.S: Likewise. * kern/powerpc/dl.c: Likewise. * kern/powerpc/ieee1275/cmain.c: Likewise. * kern/powerpc/ieee1275/crt0.S: Likewise. * kern/powerpc/ieee1275/init.c: Likewise. * kern/powerpc/ieee1275/openfw.c: Likewise. * kern/sparc64/cache.S: Likewise. * kern/sparc64/dl.c: Likewise. * kern/sparc64/ieee1275/init.c: Likewise. * kern/sparc64/ieee1275/openfw.c: Likewise. * loader/efi/chainloader.c: Likewise. * loader/efi/chainloader_normal.c: Likewise. * loader/i386/efi/linux.c: Likewise. * loader/i386/efi/linux_normal.c: Likewise. * loader/i386/pc/chainloader.c: Likewise. * loader/i386/pc/chainloader_normal.c: Likewise. * loader/i386/pc/linux.c: Likewise. * loader/i386/pc/linux_normal.c: Likewise. * loader/i386/pc/multiboot.c: Likewise. * loader/i386/pc/multiboot_normal.c: Likewise. * loader/powerpc/ieee1275/linux.c: Likewise. * loader/powerpc/ieee1275/linux_normal.c: Likewise. * normal/arg.c: Likewise. * normal/cmdline.c: Likewise. * normal/command.c: Likewise. * normal/completion.c: Likewise. * normal/execute.c: Likewise. * normal/function.c: Likewise. * normal/lexer.c: Likewise. * normal/main.c: Likewise. * normal/menu.c: Likewise. * normal/menu_entry.c: Likewise. * normal/misc.c: Likewise. * normal/parser.y: Likewise. * normal/script.c: Likewise. * normal/i386/setjmp.S: Likewise. * normal/powerpc/setjmp.S: Likewise. * normal/sparc64/setjmp.S: Likewise. * partmap/acorn.c: Likewise. * partmap/amiga.c: Likewise. * partmap/apple.c: Likewise. * partmap/gpt.c: Likewise. * partmap/pc.c: Likewise. * partmap/sun.c: Likewise. * term/gfxterm.c: Likewise. * term/terminfo.c: Likewise. * term/efi/console.c: Likewise. * term/i386/pc/console.c: Likewise. * term/i386/pc/serial.c: Likewise. * term/i386/pc/vesafb.c: Likewise. * term/i386/pc/vga.c: Likewise. * term/ieee1275/ofconsole.c: Likewise. * util/biosdisk.c: Likewise. * util/console.c: Likewise. * util/genmoddep.c: Likewise. * util/getroot.c: Likewise. * util/grub-emu.c: Likewise. * util/grub-mkdevicemap.c: Likewise. * util/grub-probe.c: Likewise. * util/lvm.c: Likewise. * util/misc.c: Likewise. * util/raid.c: Likewise. * util/resolve.c: Likewise. * util/update-grub.in: Likewise. * util/update-grub_lib.in: Likewise. * util/grub.d/00_header.in: Likewise. * util/grub.d/10_hurd.in: Likewise. * util/grub.d/10_linux.in: Likewise. * util/i386/efi/grub-install.in: Likewise. * util/i386/efi/grub-mkimage.c: Likewise. * util/i386/pc/grub-install.in: Likewise. * util/i386/pc/grub-mkimage.c: Likewise. * util/i386/pc/grub-mkrescue.in: Likewise. * util/i386/pc/grub-setup.c: Likewise. * util/i386/pc/misc.c: Likewise. * util/powerpc/ieee1275/grub-install.in: Likewise. * util/powerpc/ieee1275/grub-mkimage.c: Likewise. * util/powerpc/ieee1275/misc.c: Likewise. * video/bitmap.c: Likewise. * video/video.c: Likewise. * video/i386/pc/vbe.c: Likewise. * video/i386/pc/vbeblit.c: Likewise. * video/i386/pc/vbefill.c: Likewise. * video/i386/pc/vbeutil.c: Likewise. * video/readers/tga.c: Likewise.
2007-07-21 23:32:33 +00:00
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
*/
#include <grub/normal.h>
#include <grub/term.h>
#include <grub/misc.h>
#include <grub/mm.h>
#include <grub/loader.h>
2009-05-02 Bean <bean123ch@gmail.com> * conf/common.rmk (grub_script.tab.c): Change normal/parser.y to script/sh/parser.y. (pkglib_MODULES): Add normal.mod and sh.mod. (normal_SOURCES): New variable. (normal_mod_CFLAGS): Likewise. (normal_mod_LDFLAGS): Likewise. (sh_mod_SOURCES): Likewise. (sh_mod_CFLAGS): Likewise. (sh_mod_LDFLAGS): Likewise. * conf/i386-pc.rmk (normal/lexer.c_DEPENDENCIES): Changed to script/sh/lexer.c_DEPENDENCIES. (kernel_img_SOURCES): Remove kern/rescue.c, and kern/reader.c, kern/rescue_reader.c and kern/rescue_parser.c. (kernel_img_HEADERS): Remove rescue.h, add reader.h. (grub_emu_SOURCES): Change source files. (pkglib_MODULES): Remove normal.mod. (normal_SOURCES): Removed. (normal_mod_CFLAGS): Likewise. (normal_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk: Likewise. * conf/i386-efi.rmk: Likewise. * conf/i386-ieee1276.rmk: Likewise. * conf/powerpc-ieee1275.rmk: Likewise. * conf/sparc64-ieee1275.rmk: Likewise. * conf/x86_64-efi.rmk: Likewise. * include/grub/command.h (grub_command_execute): New inline function. * include/grub/menu.h (grub_menu_entry): Removed commands field. * include/grub/normal.h: Remove <grub/setjmp.h>. (grub_fs_module_list): Moved to normal/autofs.c. (grub_exit_env): Removed. (grub_command_execute): Likewise. (grub_normal_menu_addentry): Renamed to grub_menu_addentry, removed parameter script. (read_command_list): New function declaration. (read_fs_list): Likewise. * include/parser.h: Include <grub/reader.h>. (grub_parser_split_cmdline): Change type of getline parameter. (grub_parser): New structure. (grub_parser_class): New variable. (grub_parser_execute): New function declaration. (grub_register_rescue_parser): Likewise. (grub_parser_register): New inline function. (grub_parser_unregister): Likewise. (grub_parser_get_current): Likewise. (grub_parser_set_current): Likewise. * include/grub/reader.h: New file. * kern/reader.c: Likewise. * kern/rescue_parser.c: Likewise. * kern/rescue_reader.c: Likewise. * normal/autofs.c: Likewise. * normal/dyncmd.c: Likewise. * include/grub/rescue.h: Removed. * normal/command.h: Likewise. * include/grub/script.h: Moved to ... * include/grub/script_sh.h: ... Moved here. * normal/execute.c: Moved to ... * script/sh/execute.c: ... Moved here. * normal/function.c: Moved to ... * script/sh/function.c: ... Moved here. * normal/lexer.c: Moved to ... * script/sh/lexer.c: ... Moved here. * normal/parser.y: Moved to ... * script/sh/parser.y: ... Moved here. * normal/script.c: Moved to ... * script/sh/script.c: ... Moved here. * normal/main.c: Remove <grub/rescue.h> and <grub/script.h>, include <grub/reader.h>. (grub_exit_env): Removed. (fs_module_list): Moved to normal/autofs.c. (grub_file_getline): Don't handle comment here. (free_menu): Skip removed field entry->commands. (grub_normal_menu_addentry): Removed as grub_menu_entry, removed script parameter. (read_config_file): Removed nested parameter, change getline function. (grub_enter_normal_mode): Removed. (grub_dyncmd_dispatcher): Moved to normal/dyncmd.c. (read_command_list): Likewise. (autoload_fs_module): Moved to normal/autofs.c. (read_fs_list): Likewise. (reader_nested): New variable. (grub_normal_execute): Run parser.sh to switch to sh parser. (grub_cmd_rescue): Removed. (cmd_normal): Removed. (grub_cmd_normal): Unregister itself at the beginning. Don't register rescue command. (grub_cmdline_run): New function. (grub_normal_reader_init): Likewise. (grub_normal_read_line): Likewise. (grub_env_write_pager): Likewise. (cmdline): New variable. (grub_normal_reader): Likewise. (GRUB_MOD_INIT): Register normal reader and set as current, register pager hook, register normal command with grub_register_command_prio, so that it won't show up in command.lst. (GRUB_MOD_FINI): Unregister normal reader, unhook pager, clear grub_fs_autoload_hook. * normal/menu.c: Remove <grub/script.h>, add <grub/command.h>. (grub_menu_execute_entry): Replace grub_script_execute with grub_parser_execute, change parameter to grub_command_execute. * normal/menu_text.c: Remove <grub/script.h>. * normal/menu_entry.c: Remove <grub/script.h>, add <grub/command.h> and <grub/parser.h>. (run): Change editor_getline to use new parser interface. Change parameter to grub_command_execute. * kern/main.c: Remove <grub/rescue.h>, include <grub/command.h>, <grub/reader.h> and <grub/parser.h>. (grub_load_normal_mode): Execute normal command. (grub_main): Call grub_register_core_commands, grub_register_rescue_parser and grub_register_rescue_reader, use grub_reader_loop to enter input loop. * kern/parser.c (grub_parser_spli_cmdline): Change type of getline parameter. (grub_parser_class): New variable. (grub_parser_execute): New function. * loader/i386/multiboot.c: Remove <grub/rescue.h>. * loader/multiboot2.c: Likewise. * loader/sparc64/ieee1275/linux.c: Likewise. * util/grub-emu.c (read_command_list): New dummy function.
2009-05-02 19:49:34 +00:00
#include <grub/command.h>
#include <grub/parser.h>
2010-03-26 23:19:42 +00:00
#include <grub/script_sh.h>
2009-08-24 23:55:06 +00:00
#include <grub/auth.h>
#include <grub/i18n.h>
2010-03-15 10:49:27 +00:00
#include <grub/charset.h>
#include <grub/safemath.h>
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
enum update_mode
{
NO_LINE,
SINGLE_LINE,
ALL_LINES
};
struct line
{
/* The line buffer. */
grub_uint32_t *buf;
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
/* The length of the line. */
int len;
/* The maximum length of the line. */
int max_len;
2013-01-16 12:41:16 +00:00
struct grub_term_pos **pos;
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
};
2009-12-24 14:34:33 +00:00
struct per_term_screen
{
struct grub_term_output *term;
int y_line_start;
struct grub_term_screen_geometry geo;
/* Scratch variables used when updating. Having them here avoids
loads of small mallocs. */
int orig_num;
int down;
enum update_mode mode;
2009-12-24 14:34:33 +00:00
};
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
struct screen
{
/* The array of lines. */
struct line *lines;
/* The number of lines. */
int num_lines;
/* The current column. */
int column;
/* The real column. */
int real_column;
/* The current line. */
int line;
/* The kill buffer. */
char *killed_text;
2005-08-18 Yoshinori K. Okuji <okuji@enbug.org> * normal/misc.c: New file. * DISTLIST: Added normal/misc.c. * partmap/amiga.c (amiga_partition_map_iterate): Add an argument DISK to HOOK. Call HOOK with DISK. * partmap/apple.c (apple_partition_map_iterate): Likewise. * partmap/pc.c (pc_partition_map_iterate): Likewise. * partmap/sun.c (sun_partition_map_iterate): Likewise. * normal/menu_entry.c (struct screen): Added a new member "completion_shown". (completion_buffer): New global variable. (make_screen): Set SCREEN->COMPLETION_SHOWN to zero. (store_completion): New function. (complete): Likewise. (clear_completions): Likewise. (grub_menu_entry_run): If SCREEN->COMPLETION_SHOWN is non-zero, call clear_completions and reset SCREEN->COMPLETION_SHOWN. If C is a tab, call complete. * normal/completion.c (disk_dev): Removed. (print_simple_completion): Likewise. (print_partition_completion): Likewise. (print_func): New global variable. (add_completion): Do not take the arguments WHAT or PRINT any longer. Added a new argument TYPE. Instead of printing directly, call PRINT_FUNC if not NULL. All callers changed. (complete_device): Use a local variable DEV instead of DISK_DEV. Do not move CURRENT_WORD to the end of a device name. (grub_normal_do_completion): Take a new argument HOOK. Do not initialize DISK_DEV. Initialize PRINT_FUNC to HOOK. If RET is an empty string, return NULL instead. All callers changed. * normal/cmdline.c (print_completion): New function. * kern/partition.c (grub_partition_iterate): Add an argument DISK to HOOK. All callers changed. * kern/disk.c (grub_print_partinfo): Removed. * include/grub/partition.h (struct grub_partition_map): Add a new argument DISK into HOOK of ITERATE. (grub_partition_iterate): Add a new argument DISK to HOOK. * include/grub/normal.h (enum grub_completion_type): New enum. (grub_completion_type_t): New type. (GRUB_COMPLETION_TYPE_COMMAND): New constant. (GRUB_COMPLETION_TYPE_DEVICE): Likewise. (GRUB_COMPLETION_TYPE_PARTITION): Likewise. (GRUB_COMPLETION_TYPE_FILE): Likewise. (grub_normal_do_completion): Added a new argument HOOK. (grub_normal_print_device_info): New prototype. * include/grub/disk.h (grub_print_partinfo): Removed. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/misc.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. * commands/ls.c (grub_ls_list_disks): Use grub_normal_print_device_info instead of grub_print_partinfo. Free PNAME. (grub_ls_list_files): Use grub_normal_print_device_info instead of duplicating the code.
2005-08-18 03:14:39 +00:00
/* The flag of a completion window. */
int completion_shown;
2009-12-24 14:34:33 +00:00
int submenu;
2009-12-24 14:34:33 +00:00
struct per_term_screen *terms;
unsigned nterms;
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
};
2005-08-18 Yoshinori K. Okuji <okuji@enbug.org> * normal/misc.c: New file. * DISTLIST: Added normal/misc.c. * partmap/amiga.c (amiga_partition_map_iterate): Add an argument DISK to HOOK. Call HOOK with DISK. * partmap/apple.c (apple_partition_map_iterate): Likewise. * partmap/pc.c (pc_partition_map_iterate): Likewise. * partmap/sun.c (sun_partition_map_iterate): Likewise. * normal/menu_entry.c (struct screen): Added a new member "completion_shown". (completion_buffer): New global variable. (make_screen): Set SCREEN->COMPLETION_SHOWN to zero. (store_completion): New function. (complete): Likewise. (clear_completions): Likewise. (grub_menu_entry_run): If SCREEN->COMPLETION_SHOWN is non-zero, call clear_completions and reset SCREEN->COMPLETION_SHOWN. If C is a tab, call complete. * normal/completion.c (disk_dev): Removed. (print_simple_completion): Likewise. (print_partition_completion): Likewise. (print_func): New global variable. (add_completion): Do not take the arguments WHAT or PRINT any longer. Added a new argument TYPE. Instead of printing directly, call PRINT_FUNC if not NULL. All callers changed. (complete_device): Use a local variable DEV instead of DISK_DEV. Do not move CURRENT_WORD to the end of a device name. (grub_normal_do_completion): Take a new argument HOOK. Do not initialize DISK_DEV. Initialize PRINT_FUNC to HOOK. If RET is an empty string, return NULL instead. All callers changed. * normal/cmdline.c (print_completion): New function. * kern/partition.c (grub_partition_iterate): Add an argument DISK to HOOK. All callers changed. * kern/disk.c (grub_print_partinfo): Removed. * include/grub/partition.h (struct grub_partition_map): Add a new argument DISK into HOOK of ITERATE. (grub_partition_iterate): Add a new argument DISK to HOOK. * include/grub/normal.h (enum grub_completion_type): New enum. (grub_completion_type_t): New type. (GRUB_COMPLETION_TYPE_COMMAND): New constant. (GRUB_COMPLETION_TYPE_DEVICE): Likewise. (GRUB_COMPLETION_TYPE_PARTITION): Likewise. (GRUB_COMPLETION_TYPE_FILE): Likewise. (grub_normal_do_completion): Added a new argument HOOK. (grub_normal_print_device_info): New prototype. * include/grub/disk.h (grub_print_partinfo): Removed. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/misc.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. * commands/ls.c (grub_ls_list_disks): Use grub_normal_print_device_info instead of grub_print_partinfo. Free PNAME. (grub_ls_list_files): Use grub_normal_print_device_info instead of duplicating the code.
2005-08-18 03:14:39 +00:00
/* Used for storing completion items temporarily. */
static struct {
char *buf;
grub_size_t len;
grub_size_t max_len;
} completion_buffer;
2009-12-24 14:34:33 +00:00
static int completion_type;
2005-08-18 Yoshinori K. Okuji <okuji@enbug.org> * normal/misc.c: New file. * DISTLIST: Added normal/misc.c. * partmap/amiga.c (amiga_partition_map_iterate): Add an argument DISK to HOOK. Call HOOK with DISK. * partmap/apple.c (apple_partition_map_iterate): Likewise. * partmap/pc.c (pc_partition_map_iterate): Likewise. * partmap/sun.c (sun_partition_map_iterate): Likewise. * normal/menu_entry.c (struct screen): Added a new member "completion_shown". (completion_buffer): New global variable. (make_screen): Set SCREEN->COMPLETION_SHOWN to zero. (store_completion): New function. (complete): Likewise. (clear_completions): Likewise. (grub_menu_entry_run): If SCREEN->COMPLETION_SHOWN is non-zero, call clear_completions and reset SCREEN->COMPLETION_SHOWN. If C is a tab, call complete. * normal/completion.c (disk_dev): Removed. (print_simple_completion): Likewise. (print_partition_completion): Likewise. (print_func): New global variable. (add_completion): Do not take the arguments WHAT or PRINT any longer. Added a new argument TYPE. Instead of printing directly, call PRINT_FUNC if not NULL. All callers changed. (complete_device): Use a local variable DEV instead of DISK_DEV. Do not move CURRENT_WORD to the end of a device name. (grub_normal_do_completion): Take a new argument HOOK. Do not initialize DISK_DEV. Initialize PRINT_FUNC to HOOK. If RET is an empty string, return NULL instead. All callers changed. * normal/cmdline.c (print_completion): New function. * kern/partition.c (grub_partition_iterate): Add an argument DISK to HOOK. All callers changed. * kern/disk.c (grub_print_partinfo): Removed. * include/grub/partition.h (struct grub_partition_map): Add a new argument DISK into HOOK of ITERATE. (grub_partition_iterate): Add a new argument DISK to HOOK. * include/grub/normal.h (enum grub_completion_type): New enum. (grub_completion_type_t): New type. (GRUB_COMPLETION_TYPE_COMMAND): New constant. (GRUB_COMPLETION_TYPE_DEVICE): Likewise. (GRUB_COMPLETION_TYPE_PARTITION): Likewise. (GRUB_COMPLETION_TYPE_FILE): Likewise. (grub_normal_do_completion): Added a new argument HOOK. (grub_normal_print_device_info): New prototype. * include/grub/disk.h (grub_print_partinfo): Removed. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/misc.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. * commands/ls.c (grub_ls_list_disks): Use grub_normal_print_device_info instead of grub_print_partinfo. Free PNAME. (grub_ls_list_files): Use grub_normal_print_device_info instead of duplicating the code.
2005-08-18 03:14:39 +00:00
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
/* Initialize a line. */
static int
2013-01-16 12:41:16 +00:00
init_line (struct screen *screen, struct line *linep)
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
{
linep->len = 0;
linep->max_len = 80;
linep->buf = grub_calloc (linep->max_len + 1, sizeof (linep->buf[0]));
linep->pos = grub_calloc (screen->nterms, sizeof (linep->pos[0]));
2013-01-16 12:41:16 +00:00
if (! linep->buf || !linep->pos)
{
grub_free (linep->buf);
grub_free (linep->pos);
return 0;
}
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
return 1;
}
/* Allocate extra space if necessary. */
static int
ensure_space (struct line *linep, int extra)
{
if (linep->max_len < linep->len + extra)
{
grub_size_t sz0, sz1;
if (grub_add (linep->len, extra, &sz0) ||
grub_mul (sz0, 2, &sz0) ||
grub_add (sz0, 1, &sz1) ||
grub_mul (sz1, sizeof (linep->buf[0]), &sz1))
return 0;
linep->buf = grub_realloc (linep->buf, sz1);
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
if (! linep->buf)
return 0;
linep->max_len = sz0;
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
}
return 1;
}
/* Return the number of lines occupied by this line on the screen. */
static int
2009-12-24 14:34:33 +00:00
get_logical_num_lines (struct line *linep, struct per_term_screen *term_screen)
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
{
grub_size_t width = grub_getstringwidth (linep->buf, linep->buf + linep->len,
term_screen->term);
/* Empty line still consumes space on screen */
return width ? (width + (unsigned) term_screen->geo.entry_width - 1) /
(unsigned) term_screen->geo.entry_width
: 1;
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
}
static void
advance_to (struct screen *screen, int c)
{
if (c > screen->lines[screen->line].len)
c = screen->lines[screen->line].len;
2013-01-16 12:41:16 +00:00
screen->column = grub_unicode_get_comb_end (screen->lines[screen->line].buf
+ screen->lines[screen->line].len,
screen->lines[screen->line].buf
+ c)
- screen->lines[screen->line].buf;
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
}
/* Print an empty line. */
static void
2009-12-24 14:34:33 +00:00
print_empty_line (int y, struct per_term_screen *term_screen)
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
{
int i;
2009-06-10 21:04:23 +00:00
2009-12-24 14:34:33 +00:00
grub_term_gotoxy (term_screen->term,
(struct grub_term_coordinate) { term_screen->geo.first_entry_x,
y + term_screen->geo.first_entry_y });
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
for (i = 0; i < term_screen->geo.entry_width + 1; i++)
grub_putcode (' ', term_screen->term);
}
static void
print_updown (int upflag, int downflag, struct per_term_screen *term_screen)
{
grub_term_gotoxy (term_screen->term,
(struct grub_term_coordinate) { term_screen->geo.first_entry_x
+ term_screen->geo.entry_width + 1
+ term_screen->geo.border,
term_screen->geo.first_entry_y });
if (upflag && downflag)
grub_putcode (GRUB_UNICODE_UPDOWNARROW, term_screen->term);
else if (upflag)
grub_putcode (GRUB_UNICODE_UPARROW, term_screen->term);
else if (downflag)
grub_putcode (GRUB_UNICODE_DOWNARROW, term_screen->term);
else
2009-12-24 14:34:33 +00:00
grub_putcode (' ', term_screen->term);
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
}
/* Print an up arrow. */
static void
2009-12-24 14:34:33 +00:00
print_up (int flag, struct per_term_screen *term_screen)
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
{
grub_term_gotoxy (term_screen->term,
(struct grub_term_coordinate) { term_screen->geo.first_entry_x
+ term_screen->geo.entry_width + 1
+ term_screen->geo.border,
term_screen->geo.first_entry_y });
2009-06-10 21:04:23 +00:00
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
if (flag)
grub_putcode (GRUB_UNICODE_UPARROW, term_screen->term);
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
else
2009-12-24 14:34:33 +00:00
grub_putcode (' ', term_screen->term);
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
}
2009-06-10 21:04:23 +00:00
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
/* Print a down arrow. */
static void
2009-12-24 14:34:33 +00:00
print_down (int flag, struct per_term_screen *term_screen)
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
{
grub_term_gotoxy (term_screen->term,
(struct grub_term_coordinate) { term_screen->geo.first_entry_x
+ term_screen->geo.entry_width + 1
+ term_screen->geo.border,
term_screen->geo.first_entry_y
+ term_screen->geo.num_entries - 1 });
2009-06-10 21:04:23 +00:00
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
if (flag)
grub_putcode (GRUB_UNICODE_DOWNARROW, term_screen->term);
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
else
2009-12-24 14:34:33 +00:00
grub_putcode (' ', term_screen->term);
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
}
2009-06-10 21:04:23 +00:00
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
/* Draw the lines of the screen SCREEN. */
static void
2009-12-24 14:34:33 +00:00
update_screen (struct screen *screen, struct per_term_screen *term_screen,
2013-01-16 12:41:16 +00:00
int region_start, int region_column __attribute__ ((unused)),
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
int up, int down, enum update_mode mode)
{
int up_flag = 0;
int down_flag = 0;
int y;
int i;
struct line *linep;
2009-06-10 21:04:23 +00:00
2013-01-16 12:41:16 +00:00
y = term_screen->y_line_start;
linep = screen->lines;
for (i = 0; i < screen->line; i++, linep++)
y += get_logical_num_lines (linep, term_screen);
linep = screen->lines + screen->line;
grub_size_t t = grub_getstringwidth (linep->buf, linep->buf + screen->column,
term_screen->term);
y += t / (unsigned) term_screen->geo.entry_width;
if (t % (unsigned) term_screen->geo.entry_width == 0
&& t != 0 && screen->column == linep->len)
y--;
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
/* Check if scrolling is necessary. */
if (y < 0 || y >= term_screen->geo.num_entries)
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
{
int delta;
2013-01-16 12:41:16 +00:00
if (y < 0)
delta = -y;
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
else
delta = term_screen->geo.num_entries - 1 - y;
term_screen->y_line_start += delta;
2009-06-10 21:04:23 +00:00
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
region_start = 0;
up = 1;
down = 1;
mode = ALL_LINES;
}
grub_term_setcursor (term_screen->term, 0);
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
if (mode != NO_LINE)
{
/* Draw lines. This code is tricky, because this must calculate logical
positions. */
y = term_screen->y_line_start;
2013-01-16 12:41:16 +00:00
i = 0;
linep = screen->lines;
while (1)
{
int add;
add = get_logical_num_lines (linep, term_screen);
if (y + add > 0)
break;
i++;
linep++;
y += add;
}
2009-06-10 21:04:23 +00:00
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
if (y < 0 || i > 0)
up_flag = 1;
2009-06-10 21:04:23 +00:00
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
do
{
2013-01-16 12:41:16 +00:00
struct grub_term_pos **pos;
2009-06-10 21:04:23 +00:00
2010-03-23 15:46:45 +00:00
if (linep >= screen->lines + screen->num_lines)
break;
2013-01-16 12:41:16 +00:00
pos = linep->pos + (term_screen - screen->terms);
2013-01-16 12:41:16 +00:00
if (!*pos)
*pos = grub_calloc (linep->len + 1, sizeof (**pos));
2013-01-16 12:41:16 +00:00
if (i == region_start || linep == screen->lines + screen->line
|| (i > region_start && mode == ALL_LINES))
2013-01-16 12:41:16 +00:00
{
grub_term_gotoxy (term_screen->term,
(struct grub_term_coordinate) { term_screen->geo.first_entry_x,
(y < 0 ? 0 : y)
+ term_screen->geo.first_entry_y });
2013-01-16 12:41:16 +00:00
grub_print_ucs4_menu (linep->buf,
linep->buf + linep->len,
term_screen->geo.first_entry_x,
term_screen->geo.right_margin,
2013-01-16 12:41:16 +00:00
term_screen->term,
(y < 0) ? -y : 0,
term_screen->geo.num_entries
2013-01-16 12:41:16 +00:00
- ((y > 0) ? y : 0), '\\',
*pos);
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
}
2013-01-16 12:41:16 +00:00
y += get_logical_num_lines (linep, term_screen);
if (y >= term_screen->geo.num_entries)
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
{
if (i + 1 < screen->num_lines)
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
down_flag = 1;
}
2009-06-10 21:04:23 +00:00
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
linep++;
i++;
if (mode == ALL_LINES && i == screen->num_lines)
for (; y < term_screen->geo.num_entries; y++)
2009-12-24 14:34:33 +00:00
print_empty_line (y, term_screen);
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
}
while (y < term_screen->geo.num_entries);
2009-06-10 21:04:23 +00:00
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
/* Draw up and down arrows. */
if (term_screen->geo.num_entries == 1)
{
if (up || down)
print_updown (up_flag, down_flag, term_screen);
}
else
{
if (up)
print_up (up_flag, term_screen);
if (down)
print_down (down_flag, term_screen);
}
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
}
2009-06-10 21:04:23 +00:00
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
/* Place the cursor. */
2013-01-16 12:41:16 +00:00
if (screen->lines[screen->line].pos[term_screen - screen->terms])
{
const struct grub_term_pos *cpos;
for (cpos = &(screen->lines[screen->line].pos[term_screen - screen->terms])[screen->column];
cpos >= &(screen->lines[screen->line].pos[term_screen - screen->terms])[0];
cpos--)
if (cpos->valid)
break;
y = term_screen->y_line_start;
for (i = 0; i < screen->line; i++)
y += get_logical_num_lines (screen->lines + i, term_screen);
if (cpos >= &(screen->lines[screen->line].pos[term_screen - screen->terms])[0])
grub_term_gotoxy (term_screen->term,
(struct grub_term_coordinate) { cpos->x + term_screen->geo.first_entry_x,
cpos->y + y
+ term_screen->geo.first_entry_y });
2013-01-16 12:41:16 +00:00
else
grub_term_gotoxy (term_screen->term,
(struct grub_term_coordinate) { term_screen->geo.first_entry_x,
y + term_screen->geo.first_entry_y });
2013-01-16 12:41:16 +00:00
}
2009-06-10 21:04:23 +00:00
grub_term_setcursor (term_screen->term, 1);
2009-12-24 14:34:33 +00:00
grub_term_refresh (term_screen->term);
}
static void
update_screen_all (struct screen *screen,
int region_start, int region_column,
int up, int down, enum update_mode mode)
{
unsigned i;
for (i = 0; i < screen->nterms; i++)
update_screen (screen, &screen->terms[i], region_start, region_column,
up, down, mode);
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
}
static int
Add missing const qualifiers. * grub-core/commands/i386/pc/sendkey.c (keysym): Add missing const. * grub-core/commands/lspci.c (grub_pci_classname): Likewise. * grub-core/commands/menuentry.c (hotkey_aliases): Likewise. * grub-core/disk/lvm.c (grub_lvm_getvalue): Likewise. (grub_lvm_check_flag): Likewise. * grub-core/efiemu/i386/coredetect.c (grub_efiemu_get_default_core_name): Likewise * grub-core/efiemu/main.c (grub_efiemu_autocore): Likewise. * grub-core/fs/hfsplus.c (grub_hfsplus_catkey_internal): Likewise. * grub-core/fs/ntfs.c (fixup): Likewise. * grub-core/fs/xfs.c (grub_xfs_iterate_dir): Likewise. * grub-core/fs/zfs/zfs.c (decomp_entry): Likewise. (fzap_lookup): Likewise. (zap_lookup): Likewise. * grub-core/gnulib/regcomp.c (init_dfa): Likewise. * grub-core/lib/legacy_parse.c (check_option): Likewise. * grub-core/lib/posix_wrap/langinfo.h (nl_langinfo): Likewise. * grub-core/loader/i386/bsd.c (grub_bsd_add_meta): Likewise. (grub_freebsd_add_meta_module): Likewise. (grub_cmd_freebsd_module): Likewise. * grub-core/loader/i386/xnu.c (tbl_alias): Likewise. * grub-core/loader/xnu.c (grub_xnu_register_memory): Likewise. (grub_xnu_writetree_get_size): Likewise. (grub_xnu_writetree_toheap_real): Likewise. (grub_xnu_find_key): Likewise. (grub_xnu_create_key): Likewise. (grub_xnu_create_value): Likewise. (grub_xnu_register_memory): Likewise. (grub_xnu_check_os_bundle_required): Likewise. (grub_xnu_scan_dir_for_kexts): Likewise. (grub_xnu_load_kext_from_dir): Likewise. * grub-core/normal/color.c (color_list): Likewise. * grub-core/normal/completion.c (current_word): Likewise. * grub-core/normal/menu_entry.c (insert_string): Likewise. * grub-core/term/serial.c (grub_serial_find): Likewise. * grub-core/term/tparm.c (grub_terminfo_tparm): Likewise. * include/grub/efiemu/efiemu.h (grub_efiemu_get_default_core_name): Likewise. * include/grub/i386/bsd.h (grub_bsd_add_meta): Likewise. (grub_freebsd_add_meta_module): Likewise. * include/grub/lib/arg.h (grub_arg_option): Likewise. * include/grub/net.h (grub_net_card_driver): Likewise. (grub_net_card): Likewise. (grub_net_app_protocol): Likewise. * include/grub/parttool.h (grub_parttool_argdesc): Likewise. * include/grub/serial.h (grub_serial_find): Likewise. * include/grub/tparm.h (grub_terminfo_tparm): Likewise. * include/grub/xnu.h (grub_xnu_create_key): Likewise. (grub_xnu_create_value): Likewise. (grub_xnu_find_key): Likewise. (grub_xnu_scan_dir_for_kexts): Likewise. (grub_xnu_load_kext_from_dir): Likewise. * include/grub/zfs/zio_checksum.h (zio_checksum_t): Moved from here ... * grub-core/fs/zfs/zfs.c (zio_checksum_t): ...here. * include/grub/zfs/zio_checksum.h (zio_checksum_info): Moved from here ... * grub-core/fs/zfs/zfs.c (zio_checksum_info): ... here. Added missing const.
2011-11-30 15:20:13 +00:00
insert_string (struct screen *screen, const char *s, int update)
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
{
int region_start = screen->num_lines;
int region_column = 0;
2009-12-24 14:34:33 +00:00
unsigned i;
for (i = 0; i < screen->nterms; i++)
{
screen->terms[i].down = 0;
screen->terms[i].mode = NO_LINE;
2009-12-24 14:34:33 +00:00
}
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
while (*s)
{
if (*s == '\n')
{
/* LF is special because it creates a new line. */
struct line *current_linep;
struct line *next_linep;
int size;
2009-06-10 21:04:23 +00:00
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
/* Make a new line. */
screen->num_lines++;
screen->lines = grub_realloc (screen->lines,
screen->num_lines
2010-03-23 15:46:45 +00:00
* sizeof (screen->lines[0]));
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
if (! screen->lines)
return 0;
/* Shift down if not appending after the last line. */
if (screen->line < screen->num_lines - 2)
grub_memmove (screen->lines + screen->line + 2,
screen->lines + screen->line + 1,
((screen->num_lines - screen->line - 2)
* sizeof (struct line)));
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
2013-01-16 12:41:16 +00:00
if (! init_line (screen, screen->lines + screen->line + 1))
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
return 0;
2009-06-10 21:04:23 +00:00
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
/* Fold the line. */
current_linep = screen->lines + screen->line;
next_linep = current_linep + 1;
size = current_linep->len - screen->column;
2009-06-10 21:04:23 +00:00
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
if (! ensure_space (next_linep, size))
return 0;
2009-06-10 21:04:23 +00:00
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
grub_memmove (next_linep->buf,
current_linep->buf + screen->column,
size * sizeof (next_linep->buf[0]));
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
current_linep->len = screen->column;
2013-01-16 12:41:16 +00:00
for (i = 0; i < screen->nterms; i++)
{
grub_free (current_linep->pos[i]);
current_linep->pos[i] = 0;
}
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
next_linep->len = size;
/* Update a dirty region. */
if (region_start > screen->line)
{
region_start = screen->line;
region_column = screen->column;
}
2009-12-24 14:34:33 +00:00
for (i = 0; i < screen->nterms; i++)
{
screen->terms[i].mode = ALL_LINES;
screen->terms[i].down = 1; /* XXX not optimal. */
2009-12-24 14:34:33 +00:00
}
2009-06-10 21:04:23 +00:00
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
/* Move the cursor. */
screen->column = screen->real_column = 0;
screen->line++;
s++;
}
else
{
/* All but LF. */
Add missing const qualifiers. * grub-core/commands/i386/pc/sendkey.c (keysym): Add missing const. * grub-core/commands/lspci.c (grub_pci_classname): Likewise. * grub-core/commands/menuentry.c (hotkey_aliases): Likewise. * grub-core/disk/lvm.c (grub_lvm_getvalue): Likewise. (grub_lvm_check_flag): Likewise. * grub-core/efiemu/i386/coredetect.c (grub_efiemu_get_default_core_name): Likewise * grub-core/efiemu/main.c (grub_efiemu_autocore): Likewise. * grub-core/fs/hfsplus.c (grub_hfsplus_catkey_internal): Likewise. * grub-core/fs/ntfs.c (fixup): Likewise. * grub-core/fs/xfs.c (grub_xfs_iterate_dir): Likewise. * grub-core/fs/zfs/zfs.c (decomp_entry): Likewise. (fzap_lookup): Likewise. (zap_lookup): Likewise. * grub-core/gnulib/regcomp.c (init_dfa): Likewise. * grub-core/lib/legacy_parse.c (check_option): Likewise. * grub-core/lib/posix_wrap/langinfo.h (nl_langinfo): Likewise. * grub-core/loader/i386/bsd.c (grub_bsd_add_meta): Likewise. (grub_freebsd_add_meta_module): Likewise. (grub_cmd_freebsd_module): Likewise. * grub-core/loader/i386/xnu.c (tbl_alias): Likewise. * grub-core/loader/xnu.c (grub_xnu_register_memory): Likewise. (grub_xnu_writetree_get_size): Likewise. (grub_xnu_writetree_toheap_real): Likewise. (grub_xnu_find_key): Likewise. (grub_xnu_create_key): Likewise. (grub_xnu_create_value): Likewise. (grub_xnu_register_memory): Likewise. (grub_xnu_check_os_bundle_required): Likewise. (grub_xnu_scan_dir_for_kexts): Likewise. (grub_xnu_load_kext_from_dir): Likewise. * grub-core/normal/color.c (color_list): Likewise. * grub-core/normal/completion.c (current_word): Likewise. * grub-core/normal/menu_entry.c (insert_string): Likewise. * grub-core/term/serial.c (grub_serial_find): Likewise. * grub-core/term/tparm.c (grub_terminfo_tparm): Likewise. * include/grub/efiemu/efiemu.h (grub_efiemu_get_default_core_name): Likewise. * include/grub/i386/bsd.h (grub_bsd_add_meta): Likewise. (grub_freebsd_add_meta_module): Likewise. * include/grub/lib/arg.h (grub_arg_option): Likewise. * include/grub/net.h (grub_net_card_driver): Likewise. (grub_net_card): Likewise. (grub_net_app_protocol): Likewise. * include/grub/parttool.h (grub_parttool_argdesc): Likewise. * include/grub/serial.h (grub_serial_find): Likewise. * include/grub/tparm.h (grub_terminfo_tparm): Likewise. * include/grub/xnu.h (grub_xnu_create_key): Likewise. (grub_xnu_create_value): Likewise. (grub_xnu_find_key): Likewise. (grub_xnu_scan_dir_for_kexts): Likewise. (grub_xnu_load_kext_from_dir): Likewise. * include/grub/zfs/zio_checksum.h (zio_checksum_t): Moved from here ... * grub-core/fs/zfs/zfs.c (zio_checksum_t): ...here. * include/grub/zfs/zio_checksum.h (zio_checksum_info): Moved from here ... * grub-core/fs/zfs/zfs.c (zio_checksum_info): ... here. Added missing const.
2011-11-30 15:20:13 +00:00
const char *p;
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
struct line *current_linep;
int size;
grub_uint32_t *unicode_msg;
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
/* Find a string delimited by LF. */
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
p = grub_strchr (s, '\n');
if (! p)
p = s + grub_strlen (s);
/* Insert the string. */
current_linep = screen->lines + screen->line;
unicode_msg = grub_calloc (p - s, sizeof (grub_uint32_t));
if (!unicode_msg)
return 0;
size = grub_utf8_to_ucs4 (unicode_msg, (p - s),
(grub_uint8_t *) s, (p - s), 0);
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
if (! ensure_space (current_linep, size))
{
grub_free (unicode_msg);
return 0;
}
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
grub_memmove (current_linep->buf + screen->column + size,
current_linep->buf + screen->column,
(current_linep->len - screen->column)
* sizeof (current_linep->buf[0]));
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
grub_memmove (current_linep->buf + screen->column,
unicode_msg,
size * sizeof (current_linep->buf[0]));
grub_free (unicode_msg);
2013-01-16 12:41:16 +00:00
for (i = 0; i < screen->nterms; i++)
{
grub_free (current_linep->pos[i]);
current_linep->pos[i] = 0;
}
2009-12-24 14:34:33 +00:00
for (i = 0; i < screen->nterms; i++)
screen->terms[i].orig_num = get_logical_num_lines (current_linep,
2009-12-24 14:34:33 +00:00
&screen->terms[i]);
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
current_linep->len += size;
/* Update the dirty region. */
if (region_start > screen->line)
{
region_start = screen->line;
region_column = screen->column;
}
2009-06-10 21:04:23 +00:00
2009-12-24 14:34:33 +00:00
for (i = 0; i < screen->nterms; i++)
{
int new_num = get_logical_num_lines (current_linep,
&screen->terms[i]);
if (screen->terms[i].orig_num != new_num)
{
screen->terms[i].mode = ALL_LINES;
screen->terms[i].down = 1; /* XXX not optimal. */
}
else if (screen->terms[i].mode != ALL_LINES)
screen->terms[i].mode = SINGLE_LINE;
}
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
/* Move the cursor. */
advance_to (screen, screen->column + size);
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
screen->real_column = screen->column;
s = p;
}
}
if (update)
2009-12-24 14:34:33 +00:00
for (i = 0; i < screen->nterms; i++)
update_screen (screen, &screen->terms[i],
region_start, region_column, 0, screen->terms[i].down,
screen->terms[i].mode);
2009-06-10 21:04:23 +00:00
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
return 1;
}
/* Release the resource allocated for SCREEN. */
static void
destroy_screen (struct screen *screen)
{
int i;
if (screen->lines)
for (i = 0; i < screen->num_lines; i++)
{
struct line *linep = screen->lines + i;
2009-06-10 21:04:23 +00:00
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
if (linep)
2013-05-04 11:47:10 +00:00
{
unsigned j;
if (linep->pos)
for (j = 0; j < screen->nterms; j++)
grub_free (linep->pos[j]);
grub_free (linep->buf);
grub_free (linep->pos);
}
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
}
grub_free (screen->killed_text);
grub_free (screen->lines);
2009-12-24 14:34:33 +00:00
grub_free (screen->terms);
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
grub_free (screen);
}
/* Make a new screen. */
static struct screen *
make_screen (grub_menu_entry_t entry)
{
struct screen *screen;
2009-12-24 14:34:33 +00:00
unsigned i;
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
/* Initialize the screen. */
2009-07-16 Pavel Roskin <proski@gnu.org> * kern/mm.c (grub_zalloc): New function. (grub_debug_zalloc): Likewise. * include/grub/mm.h: Declare grub_zalloc() and grub_debug_zalloc(). * util/misc.c (grub_zalloc): New function. * bus/usb/uhci.c (grub_uhci_pci_iter): Use grub_zalloc() instead of grub_malloc(), remove unneeded initializations. * bus/usb/usbhub.c (grub_usb_hub_add_dev): Likewise. * commands/extcmd.c (grub_extcmd_dispatcher): Likewise. * commands/parttool.c (grub_cmd_parttool): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_open): Likewise. * disk/raid5_recover.c (grub_raid5_recover): Likewise. * disk/raid6_recover.c (grub_raid6_recover): Likewise. * disk/usbms.c (grub_usbms_finddevs): Likewise. * efiemu/mm.c (grub_efiemu_request_memalign): Likewise. * efiemu/pnvram.c (grub_efiemu_pnvram): Likewise. (grub_cmd_efiemu_pnvram): Likewise. * fs/i386/pc/pxe.c (grub_pxefs_open): Likewise. * fs/iso9660.c (grub_iso9660_mount): Likewise. (grub_iso9660_iterate_dir): Likewise. * fs/jfs.c (grub_jfs_opendir): Likewise. * fs/ntfs.c (list_file): Likewise. (grub_ntfs_mount): Likewise. * kern/disk.c (grub_disk_open): Likewise. * kern/dl.c (grub_dl_load_core): Likewise. * kern/elf.c (grub_elf_file): Likewise. * kern/env.c (grub_env_context_open): Likewise. (grub_env_set): Likewise. (grub_env_set_data_slot): Likewise. * kern/file.c (grub_file_open): Likewise. * kern/fs.c (grub_fs_blocklist_open): Likewise. * loader/i386/multiboot.c (grub_module): Likewise. * loader/xnu.c (grub_xnu_create_key): Likewise. (grub_xnu_create_value): Likewise. * normal/main.c (grub_normal_add_menu_entry): Likewise. (read_config_file): Likewise. * normal/menu_entry.c (make_screen): Likewise. * partmap/sun.c (sun_partition_map_iterate): Likewise. * script/sh/lexer.c (grub_script_lexer_init): Likewise. * script/sh/script.c (grub_script_parse): Likewise. * video/bitmap.c (grub_video_bitmap_create): Likewise. * video/readers/jpeg.c (grub_video_reader_jpeg): Likewise. * video/readers/png.c (grub_png_output_byte): Likewise. (grub_video_reader_png): Likewise.
2009-07-16 22:14:09 +00:00
screen = grub_zalloc (sizeof (*screen));
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
if (! screen)
return 0;
screen->submenu = entry->submenu;
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
screen->num_lines = 1;
screen->lines = grub_malloc (sizeof (struct line));
if (! screen->lines)
goto fail;
/* Initialize the first line which must be always present. */
2013-01-16 12:41:16 +00:00
if (! init_line (screen, screen->lines))
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
goto fail;
2006-01-17 Marco Gerards <marco@gnu.org> * include/grub/normal.h: Include <grub/script.h>. (grub_command_list): Removed struct. (grub_command_list_t): Removed type. (grub_menu_entry): Remove members `num' and `command_list'. Add members `commands' and `sourcecode'. * include/grub/script.h: Add inclusion guards. (grub_script_cmd_menuentry): New struct. (grub_script_execute_menuentry): New prototype. (grub_script_lexer_record_start): Likewise. (grub_script_lexer_record_stop): Likewise. * normal/execute.c (grub_script_execute_menuentry): New function. * normal/lexer.c (record, recording, recordpos, recordlen): New variables. (grub_script_lexer_record_start): New function. (grub_script_lexer_record_stop): Likewise. (recordchar): Likewise. (nextchar): Likewise. (grub_script_yylex): Use `nextchar' to fetch new characters. Use 2048 as the buffer size. Add the tokens `menuentry' and `@'. * normal/main.c: Include <grub/parser.h> and <grub/script.h> (current_menu): New variable. (free_menu): Mainly rewritten. (grub_normal_menu_addentry): New function. (read_config_file): Rewritten. * normal/menu.c (run_menu_entry): Mainly rewritten. * normal/menu_entry.c (make_screen): Rewritten te code to insert the menu entry. (run): Mainly rewritten. * normal/parser.y (menu_entry): New variable. (GRUB_PARSER_TOKEN_MENUENTRY): New token. (menuentry): New rule. (command): Add `menuentry'. (if_statement): Allow additional returns before `fi'. * normal/script.c (grub_script_create_cmdmenu): New function.
2006-01-17 09:50:47 +00:00
insert_string (screen, (char *) entry->sourcecode, 0);
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
/* Reset the cursor position. */
screen->column = 0;
screen->real_column = 0;
screen->line = 0;
2009-12-24 14:34:33 +00:00
for (i = 0; i < screen->nterms; i++)
{
2013-01-16 12:41:16 +00:00
screen->terms[i].y_line_start = 0;
2009-12-24 14:34:33 +00:00
}
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
return screen;
fail:
destroy_screen (screen);
return 0;
}
static int
forward_char (struct screen *screen, int update)
{
struct line *linep;
2009-06-10 21:04:23 +00:00
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
linep = screen->lines + screen->line;
if (screen->column < linep->len)
2013-01-16 12:41:16 +00:00
{
screen->column = grub_unicode_get_comb_end (screen->lines[screen->line].buf
+ screen->lines[screen->line].len,
screen->lines[screen->line].buf
+ screen->column + 1)
- screen->lines[screen->line].buf;
}
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
else if (screen->num_lines > screen->line + 1)
{
screen->column = 0;
screen->line++;
}
screen->real_column = screen->column;
if (update)
2009-12-24 14:34:33 +00:00
update_screen_all (screen, screen->num_lines, 0, 0, 0, NO_LINE);
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
return 1;
}
static int
backward_char (struct screen *screen, int update)
{
if (screen->column > 0)
{
struct grub_unicode_glyph glyph;
struct line *linep;
linep = screen->lines + screen->line;
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
screen->column--;
screen->column = grub_unicode_get_comb_start (linep->buf,
linep->buf + screen->column)
- linep->buf;
grub_unicode_aglomerate_comb (screen->lines[screen->line].buf + screen->column,
screen->lines[screen->line].len - screen->column,
&glyph);
2013-01-16 12:41:16 +00:00
screen->column = grub_unicode_get_comb_start (linep->buf,
linep->buf + screen->column)
- linep->buf;
grub_unicode_destroy_glyph (&glyph);
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
}
else if (screen->line > 0)
{
screen->line--;
2013-01-16 12:41:16 +00:00
screen->column = screen->lines[screen->line].len;
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
}
screen->real_column = screen->column;
if (update)
2009-12-24 14:34:33 +00:00
update_screen_all (screen, screen->num_lines, 0, 0, 0, NO_LINE);
2009-06-10 21:04:23 +00:00
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
return 1;
}
static int
previous_line (struct screen *screen, int update)
{
if (screen->line > 0)
{
struct line *linep;
2009-12-24 14:34:33 +00:00
int col;
2009-06-10 21:04:23 +00:00
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
screen->line--;
2009-06-10 21:04:23 +00:00
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
linep = screen->lines + screen->line;
if (linep->len < screen->real_column)
col = linep->len;
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
else
col = screen->real_column;
screen->column = 0;
advance_to (screen, col);
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
}
else
{
screen->column = 0;
}
if (update)
2009-12-24 14:34:33 +00:00
update_screen_all (screen, screen->num_lines, 0, 0, 0, NO_LINE);
2009-06-10 21:04:23 +00:00
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
return 1;
}
static int
next_line (struct screen *screen, int update)
{
if (screen->line < screen->num_lines - 1)
{
struct line *linep;
int c;
2009-06-10 21:04:23 +00:00
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
/* How many physical lines from the current position
to the last physical line? */
linep = screen->lines + screen->line;
2009-06-10 21:04:23 +00:00
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
screen->line++;
if ((linep + 1)->len < screen->real_column)
c = (linep + 1)->len;
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
else
c = screen->real_column;
screen->column = 0;
2009-06-10 21:04:23 +00:00
advance_to (screen, c);
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
}
else
advance_to (screen, screen->lines[screen->line].len);
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
if (update)
2009-12-24 14:34:33 +00:00
update_screen_all (screen, screen->num_lines, 0, 0, 0, NO_LINE);
2009-06-10 21:04:23 +00:00
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
return 1;
}
static int
beginning_of_line (struct screen *screen, int update)
{
screen->column = screen->real_column = 0;
if (update)
2009-12-24 14:34:33 +00:00
update_screen_all (screen, screen->num_lines, 0, 0, 0, NO_LINE);
2009-06-10 21:04:23 +00:00
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
return 1;
}
static int
end_of_line (struct screen *screen, int update)
{
advance_to (screen, screen->lines[screen->line].len);
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
if (update)
2009-12-24 14:34:33 +00:00
update_screen_all (screen, screen->num_lines, 0, 0, 0, NO_LINE);
2009-06-10 21:04:23 +00:00
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
return 1;
}
static int
delete_char (struct screen *screen, int update)
{
struct line *linep;
int start = screen->num_lines;
int column = 0;
2009-06-10 21:04:23 +00:00
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
linep = screen->lines + screen->line;
if (linep->len > screen->column)
{
2009-12-24 14:34:33 +00:00
unsigned i;
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
2009-12-24 14:34:33 +00:00
for (i = 0; i < screen->nterms; i++)
screen->terms[i].orig_num = get_logical_num_lines (linep, &screen->terms[i]);
2009-06-10 21:04:23 +00:00
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
grub_memmove (linep->buf + screen->column,
linep->buf + screen->column + 1,
(linep->len - screen->column - 1)
* sizeof (linep->buf[0]));
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
linep->len--;
2013-01-16 12:41:16 +00:00
for (i = 0; i < screen->nterms; i++)
{
grub_free (linep->pos[i]);
linep->pos[i] = 0;
}
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
start = screen->line;
column = screen->column;
2009-12-24 14:34:33 +00:00
screen->real_column = screen->column;
if (update)
{
for (i = 0; i < screen->nterms; i++)
{
int new_num;
2009-12-24 14:34:33 +00:00
new_num = get_logical_num_lines (linep, &screen->terms[i]);
if (screen->terms[i].orig_num != new_num)
2009-12-24 14:34:33 +00:00
update_screen (screen, &screen->terms[i],
start, column, 0, 0, ALL_LINES);
else
update_screen (screen, &screen->terms[i],
start, column, 0, 0, SINGLE_LINE);
}
}
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
}
else if (screen->num_lines > screen->line + 1)
{
struct line *next_linep;
2013-01-16 12:41:16 +00:00
unsigned i;
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
next_linep = linep + 1;
if (! ensure_space (linep, next_linep->len))
return 0;
grub_memmove (linep->buf + linep->len, next_linep->buf,
next_linep->len * sizeof (linep->buf[0]));
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
linep->len += next_linep->len;
2013-01-16 12:41:16 +00:00
for (i = 0; i < screen->nterms; i++)
{
grub_free (linep->pos[i]);
linep->pos[i] = 0;
}
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
grub_free (next_linep->buf);
grub_memmove (next_linep,
next_linep + 1,
(screen->num_lines - screen->line - 2)
* sizeof (struct line));
screen->num_lines--;
2009-06-10 21:04:23 +00:00
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
start = screen->line;
column = screen->column;
2009-12-24 14:34:33 +00:00
screen->real_column = screen->column;
if (update)
update_screen_all (screen, start, column, 0, 1, ALL_LINES);
}
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
return 1;
}
static int
backward_delete_char (struct screen *screen, int update)
{
int saved_column;
int saved_line;
saved_column = screen->column;
saved_line = screen->line;
2009-06-10 21:04:23 +00:00
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
if (! backward_char (screen, 0))
return 0;
if (saved_column != screen->column || saved_line != screen->line)
if (! delete_char (screen, update))
return 0;
return 1;
}
static int
kill_line (struct screen *screen, int continuous, int update)
{
struct line *linep;
char *p;
int size;
int offset;
2009-06-10 21:04:23 +00:00
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
p = screen->killed_text;
if (! continuous && p)
p[0] = '\0';
2009-06-10 21:04:23 +00:00
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
linep = screen->lines + screen->line;
size = linep->len - screen->column;
2009-06-10 21:04:23 +00:00
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
if (p)
offset = grub_strlen (p);
else
offset = 0;
2009-06-10 21:04:23 +00:00
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
if (size > 0)
{
2009-12-24 14:34:33 +00:00
unsigned i;
2009-06-10 21:04:23 +00:00
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
p = grub_realloc (p, offset + size + 1);
if (! p)
return 0;
grub_memmove (p + offset, linep->buf + screen->column, size);
p[offset + size] = '\0';
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
screen->killed_text = p;
2009-06-10 21:04:23 +00:00
2009-12-24 14:34:33 +00:00
for (i = 0; i < screen->nterms; i++)
screen->terms[i].orig_num = get_logical_num_lines (linep, &screen->terms[i]);
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
linep->len = screen->column;
2009-12-24 14:34:33 +00:00
if (update)
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
{
2009-12-24 14:34:33 +00:00
for (i = 0; i < screen->nterms; i++)
{
int new_num;
new_num = get_logical_num_lines (linep, &screen->terms[i]);
if (screen->terms[i].orig_num != new_num)
2009-12-24 14:34:33 +00:00
update_screen (screen, &screen->terms[i],
screen->line, screen->column, 0, 1, ALL_LINES);
else
update_screen (screen, &screen->terms[i],
screen->line, screen->column, 0, 0, SINGLE_LINE);
}
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
}
}
else if (screen->line + 1 < screen->num_lines)
{
p = grub_realloc (p, offset + 1 + 1);
if (! p)
return 0;
p[offset] = '\n';
p[offset + 1] = '\0';
screen->killed_text = p;
2009-06-10 21:04:23 +00:00
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
return delete_char (screen, update);
}
2009-06-10 21:04:23 +00:00
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
return 1;
}
static int
yank (struct screen *screen, int update)
{
if (screen->killed_text)
return insert_string (screen, screen->killed_text, update);
return 1;
}
static int
open_line (struct screen *screen, int update)
{
if (! insert_string (screen, "\n", 0))
return 0;
if (! backward_char (screen, 0))
return 0;
if (update)
2009-12-24 14:34:33 +00:00
update_screen_all (screen, screen->line, screen->column, 0, 1, ALL_LINES);
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
return 1;
}
2005-08-18 Yoshinori K. Okuji <okuji@enbug.org> * normal/misc.c: New file. * DISTLIST: Added normal/misc.c. * partmap/amiga.c (amiga_partition_map_iterate): Add an argument DISK to HOOK. Call HOOK with DISK. * partmap/apple.c (apple_partition_map_iterate): Likewise. * partmap/pc.c (pc_partition_map_iterate): Likewise. * partmap/sun.c (sun_partition_map_iterate): Likewise. * normal/menu_entry.c (struct screen): Added a new member "completion_shown". (completion_buffer): New global variable. (make_screen): Set SCREEN->COMPLETION_SHOWN to zero. (store_completion): New function. (complete): Likewise. (clear_completions): Likewise. (grub_menu_entry_run): If SCREEN->COMPLETION_SHOWN is non-zero, call clear_completions and reset SCREEN->COMPLETION_SHOWN. If C is a tab, call complete. * normal/completion.c (disk_dev): Removed. (print_simple_completion): Likewise. (print_partition_completion): Likewise. (print_func): New global variable. (add_completion): Do not take the arguments WHAT or PRINT any longer. Added a new argument TYPE. Instead of printing directly, call PRINT_FUNC if not NULL. All callers changed. (complete_device): Use a local variable DEV instead of DISK_DEV. Do not move CURRENT_WORD to the end of a device name. (grub_normal_do_completion): Take a new argument HOOK. Do not initialize DISK_DEV. Initialize PRINT_FUNC to HOOK. If RET is an empty string, return NULL instead. All callers changed. * normal/cmdline.c (print_completion): New function. * kern/partition.c (grub_partition_iterate): Add an argument DISK to HOOK. All callers changed. * kern/disk.c (grub_print_partinfo): Removed. * include/grub/partition.h (struct grub_partition_map): Add a new argument DISK into HOOK of ITERATE. (grub_partition_iterate): Add a new argument DISK to HOOK. * include/grub/normal.h (enum grub_completion_type): New enum. (grub_completion_type_t): New type. (GRUB_COMPLETION_TYPE_COMMAND): New constant. (GRUB_COMPLETION_TYPE_DEVICE): Likewise. (GRUB_COMPLETION_TYPE_PARTITION): Likewise. (GRUB_COMPLETION_TYPE_FILE): Likewise. (grub_normal_do_completion): Added a new argument HOOK. (grub_normal_print_device_info): New prototype. * include/grub/disk.h (grub_print_partinfo): Removed. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/misc.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. * commands/ls.c (grub_ls_list_disks): Use grub_normal_print_device_info instead of grub_print_partinfo. Free PNAME. (grub_ls_list_files): Use grub_normal_print_device_info instead of duplicating the code.
2005-08-18 03:14:39 +00:00
/* A completion hook to print items. */
static void
2009-12-24 14:34:33 +00:00
store_completion (const char *item, grub_completion_type_t type,
int count __attribute__ ((unused)))
2005-08-18 Yoshinori K. Okuji <okuji@enbug.org> * normal/misc.c: New file. * DISTLIST: Added normal/misc.c. * partmap/amiga.c (amiga_partition_map_iterate): Add an argument DISK to HOOK. Call HOOK with DISK. * partmap/apple.c (apple_partition_map_iterate): Likewise. * partmap/pc.c (pc_partition_map_iterate): Likewise. * partmap/sun.c (sun_partition_map_iterate): Likewise. * normal/menu_entry.c (struct screen): Added a new member "completion_shown". (completion_buffer): New global variable. (make_screen): Set SCREEN->COMPLETION_SHOWN to zero. (store_completion): New function. (complete): Likewise. (clear_completions): Likewise. (grub_menu_entry_run): If SCREEN->COMPLETION_SHOWN is non-zero, call clear_completions and reset SCREEN->COMPLETION_SHOWN. If C is a tab, call complete. * normal/completion.c (disk_dev): Removed. (print_simple_completion): Likewise. (print_partition_completion): Likewise. (print_func): New global variable. (add_completion): Do not take the arguments WHAT or PRINT any longer. Added a new argument TYPE. Instead of printing directly, call PRINT_FUNC if not NULL. All callers changed. (complete_device): Use a local variable DEV instead of DISK_DEV. Do not move CURRENT_WORD to the end of a device name. (grub_normal_do_completion): Take a new argument HOOK. Do not initialize DISK_DEV. Initialize PRINT_FUNC to HOOK. If RET is an empty string, return NULL instead. All callers changed. * normal/cmdline.c (print_completion): New function. * kern/partition.c (grub_partition_iterate): Add an argument DISK to HOOK. All callers changed. * kern/disk.c (grub_print_partinfo): Removed. * include/grub/partition.h (struct grub_partition_map): Add a new argument DISK into HOOK of ITERATE. (grub_partition_iterate): Add a new argument DISK to HOOK. * include/grub/normal.h (enum grub_completion_type): New enum. (grub_completion_type_t): New type. (GRUB_COMPLETION_TYPE_COMMAND): New constant. (GRUB_COMPLETION_TYPE_DEVICE): Likewise. (GRUB_COMPLETION_TYPE_PARTITION): Likewise. (GRUB_COMPLETION_TYPE_FILE): Likewise. (grub_normal_do_completion): Added a new argument HOOK. (grub_normal_print_device_info): New prototype. * include/grub/disk.h (grub_print_partinfo): Removed. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/misc.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. * commands/ls.c (grub_ls_list_disks): Use grub_normal_print_device_info instead of grub_print_partinfo. Free PNAME. (grub_ls_list_files): Use grub_normal_print_device_info instead of duplicating the code.
2005-08-18 03:14:39 +00:00
{
char *p;
2009-06-10 21:04:23 +00:00
2009-12-24 14:34:33 +00:00
completion_type = type;
2005-08-18 Yoshinori K. Okuji <okuji@enbug.org> * normal/misc.c: New file. * DISTLIST: Added normal/misc.c. * partmap/amiga.c (amiga_partition_map_iterate): Add an argument DISK to HOOK. Call HOOK with DISK. * partmap/apple.c (apple_partition_map_iterate): Likewise. * partmap/pc.c (pc_partition_map_iterate): Likewise. * partmap/sun.c (sun_partition_map_iterate): Likewise. * normal/menu_entry.c (struct screen): Added a new member "completion_shown". (completion_buffer): New global variable. (make_screen): Set SCREEN->COMPLETION_SHOWN to zero. (store_completion): New function. (complete): Likewise. (clear_completions): Likewise. (grub_menu_entry_run): If SCREEN->COMPLETION_SHOWN is non-zero, call clear_completions and reset SCREEN->COMPLETION_SHOWN. If C is a tab, call complete. * normal/completion.c (disk_dev): Removed. (print_simple_completion): Likewise. (print_partition_completion): Likewise. (print_func): New global variable. (add_completion): Do not take the arguments WHAT or PRINT any longer. Added a new argument TYPE. Instead of printing directly, call PRINT_FUNC if not NULL. All callers changed. (complete_device): Use a local variable DEV instead of DISK_DEV. Do not move CURRENT_WORD to the end of a device name. (grub_normal_do_completion): Take a new argument HOOK. Do not initialize DISK_DEV. Initialize PRINT_FUNC to HOOK. If RET is an empty string, return NULL instead. All callers changed. * normal/cmdline.c (print_completion): New function. * kern/partition.c (grub_partition_iterate): Add an argument DISK to HOOK. All callers changed. * kern/disk.c (grub_print_partinfo): Removed. * include/grub/partition.h (struct grub_partition_map): Add a new argument DISK into HOOK of ITERATE. (grub_partition_iterate): Add a new argument DISK to HOOK. * include/grub/normal.h (enum grub_completion_type): New enum. (grub_completion_type_t): New type. (GRUB_COMPLETION_TYPE_COMMAND): New constant. (GRUB_COMPLETION_TYPE_DEVICE): Likewise. (GRUB_COMPLETION_TYPE_PARTITION): Likewise. (GRUB_COMPLETION_TYPE_FILE): Likewise. (grub_normal_do_completion): Added a new argument HOOK. (grub_normal_print_device_info): New prototype. * include/grub/disk.h (grub_print_partinfo): Removed. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/misc.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. * commands/ls.c (grub_ls_list_disks): Use grub_normal_print_device_info instead of grub_print_partinfo. Free PNAME. (grub_ls_list_files): Use grub_normal_print_device_info instead of duplicating the code.
2005-08-18 03:14:39 +00:00
/* Make sure that the completion buffer has enough room. */
if (completion_buffer.max_len < (completion_buffer.len
+ (int) grub_strlen (item) + 1 + 1))
{
grub_size_t new_len;
2009-06-10 21:04:23 +00:00
2005-08-18 Yoshinori K. Okuji <okuji@enbug.org> * normal/misc.c: New file. * DISTLIST: Added normal/misc.c. * partmap/amiga.c (amiga_partition_map_iterate): Add an argument DISK to HOOK. Call HOOK with DISK. * partmap/apple.c (apple_partition_map_iterate): Likewise. * partmap/pc.c (pc_partition_map_iterate): Likewise. * partmap/sun.c (sun_partition_map_iterate): Likewise. * normal/menu_entry.c (struct screen): Added a new member "completion_shown". (completion_buffer): New global variable. (make_screen): Set SCREEN->COMPLETION_SHOWN to zero. (store_completion): New function. (complete): Likewise. (clear_completions): Likewise. (grub_menu_entry_run): If SCREEN->COMPLETION_SHOWN is non-zero, call clear_completions and reset SCREEN->COMPLETION_SHOWN. If C is a tab, call complete. * normal/completion.c (disk_dev): Removed. (print_simple_completion): Likewise. (print_partition_completion): Likewise. (print_func): New global variable. (add_completion): Do not take the arguments WHAT or PRINT any longer. Added a new argument TYPE. Instead of printing directly, call PRINT_FUNC if not NULL. All callers changed. (complete_device): Use a local variable DEV instead of DISK_DEV. Do not move CURRENT_WORD to the end of a device name. (grub_normal_do_completion): Take a new argument HOOK. Do not initialize DISK_DEV. Initialize PRINT_FUNC to HOOK. If RET is an empty string, return NULL instead. All callers changed. * normal/cmdline.c (print_completion): New function. * kern/partition.c (grub_partition_iterate): Add an argument DISK to HOOK. All callers changed. * kern/disk.c (grub_print_partinfo): Removed. * include/grub/partition.h (struct grub_partition_map): Add a new argument DISK into HOOK of ITERATE. (grub_partition_iterate): Add a new argument DISK to HOOK. * include/grub/normal.h (enum grub_completion_type): New enum. (grub_completion_type_t): New type. (GRUB_COMPLETION_TYPE_COMMAND): New constant. (GRUB_COMPLETION_TYPE_DEVICE): Likewise. (GRUB_COMPLETION_TYPE_PARTITION): Likewise. (GRUB_COMPLETION_TYPE_FILE): Likewise. (grub_normal_do_completion): Added a new argument HOOK. (grub_normal_print_device_info): New prototype. * include/grub/disk.h (grub_print_partinfo): Removed. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/misc.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. * commands/ls.c (grub_ls_list_disks): Use grub_normal_print_device_info instead of grub_print_partinfo. Free PNAME. (grub_ls_list_files): Use grub_normal_print_device_info instead of duplicating the code.
2005-08-18 03:14:39 +00:00
new_len = completion_buffer.len + grub_strlen (item) + 80;
p = grub_realloc (completion_buffer.buf, new_len);
if (! p)
{
/* Possibly not fatal. */
grub_errno = GRUB_ERR_NONE;
return;
}
p[completion_buffer.len] = 0;
completion_buffer.buf = p;
completion_buffer.max_len = new_len;
}
p = completion_buffer.buf + completion_buffer.len;
if (completion_buffer.len != 0)
{
*p++ = ' ';
completion_buffer.len++;
}
grub_strcpy (p, item);
completion_buffer.len += grub_strlen (item);
}
static int
complete (struct screen *screen, int continuous, int update)
{
struct line *linep;
int restore;
char *insert;
static int count = -1;
2009-12-24 14:34:33 +00:00
unsigned i;
grub_uint32_t *ucs4;
grub_size_t buflen;
grub_ssize_t ucs4len;
char *u8;
2005-08-18 Yoshinori K. Okuji <okuji@enbug.org> * normal/misc.c: New file. * DISTLIST: Added normal/misc.c. * partmap/amiga.c (amiga_partition_map_iterate): Add an argument DISK to HOOK. Call HOOK with DISK. * partmap/apple.c (apple_partition_map_iterate): Likewise. * partmap/pc.c (pc_partition_map_iterate): Likewise. * partmap/sun.c (sun_partition_map_iterate): Likewise. * normal/menu_entry.c (struct screen): Added a new member "completion_shown". (completion_buffer): New global variable. (make_screen): Set SCREEN->COMPLETION_SHOWN to zero. (store_completion): New function. (complete): Likewise. (clear_completions): Likewise. (grub_menu_entry_run): If SCREEN->COMPLETION_SHOWN is non-zero, call clear_completions and reset SCREEN->COMPLETION_SHOWN. If C is a tab, call complete. * normal/completion.c (disk_dev): Removed. (print_simple_completion): Likewise. (print_partition_completion): Likewise. (print_func): New global variable. (add_completion): Do not take the arguments WHAT or PRINT any longer. Added a new argument TYPE. Instead of printing directly, call PRINT_FUNC if not NULL. All callers changed. (complete_device): Use a local variable DEV instead of DISK_DEV. Do not move CURRENT_WORD to the end of a device name. (grub_normal_do_completion): Take a new argument HOOK. Do not initialize DISK_DEV. Initialize PRINT_FUNC to HOOK. If RET is an empty string, return NULL instead. All callers changed. * normal/cmdline.c (print_completion): New function. * kern/partition.c (grub_partition_iterate): Add an argument DISK to HOOK. All callers changed. * kern/disk.c (grub_print_partinfo): Removed. * include/grub/partition.h (struct grub_partition_map): Add a new argument DISK into HOOK of ITERATE. (grub_partition_iterate): Add a new argument DISK to HOOK. * include/grub/normal.h (enum grub_completion_type): New enum. (grub_completion_type_t): New type. (GRUB_COMPLETION_TYPE_COMMAND): New constant. (GRUB_COMPLETION_TYPE_DEVICE): Likewise. (GRUB_COMPLETION_TYPE_PARTITION): Likewise. (GRUB_COMPLETION_TYPE_FILE): Likewise. (grub_normal_do_completion): Added a new argument HOOK. (grub_normal_print_device_info): New prototype. * include/grub/disk.h (grub_print_partinfo): Removed. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/misc.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. * commands/ls.c (grub_ls_list_disks): Use grub_normal_print_device_info instead of grub_print_partinfo. Free PNAME. (grub_ls_list_files): Use grub_normal_print_device_info instead of duplicating the code.
2005-08-18 03:14:39 +00:00
if (continuous)
count++;
else
count = 0;
2009-06-10 21:04:23 +00:00
2005-08-18 Yoshinori K. Okuji <okuji@enbug.org> * normal/misc.c: New file. * DISTLIST: Added normal/misc.c. * partmap/amiga.c (amiga_partition_map_iterate): Add an argument DISK to HOOK. Call HOOK with DISK. * partmap/apple.c (apple_partition_map_iterate): Likewise. * partmap/pc.c (pc_partition_map_iterate): Likewise. * partmap/sun.c (sun_partition_map_iterate): Likewise. * normal/menu_entry.c (struct screen): Added a new member "completion_shown". (completion_buffer): New global variable. (make_screen): Set SCREEN->COMPLETION_SHOWN to zero. (store_completion): New function. (complete): Likewise. (clear_completions): Likewise. (grub_menu_entry_run): If SCREEN->COMPLETION_SHOWN is non-zero, call clear_completions and reset SCREEN->COMPLETION_SHOWN. If C is a tab, call complete. * normal/completion.c (disk_dev): Removed. (print_simple_completion): Likewise. (print_partition_completion): Likewise. (print_func): New global variable. (add_completion): Do not take the arguments WHAT or PRINT any longer. Added a new argument TYPE. Instead of printing directly, call PRINT_FUNC if not NULL. All callers changed. (complete_device): Use a local variable DEV instead of DISK_DEV. Do not move CURRENT_WORD to the end of a device name. (grub_normal_do_completion): Take a new argument HOOK. Do not initialize DISK_DEV. Initialize PRINT_FUNC to HOOK. If RET is an empty string, return NULL instead. All callers changed. * normal/cmdline.c (print_completion): New function. * kern/partition.c (grub_partition_iterate): Add an argument DISK to HOOK. All callers changed. * kern/disk.c (grub_print_partinfo): Removed. * include/grub/partition.h (struct grub_partition_map): Add a new argument DISK into HOOK of ITERATE. (grub_partition_iterate): Add a new argument DISK to HOOK. * include/grub/normal.h (enum grub_completion_type): New enum. (grub_completion_type_t): New type. (GRUB_COMPLETION_TYPE_COMMAND): New constant. (GRUB_COMPLETION_TYPE_DEVICE): Likewise. (GRUB_COMPLETION_TYPE_PARTITION): Likewise. (GRUB_COMPLETION_TYPE_FILE): Likewise. (grub_normal_do_completion): Added a new argument HOOK. (grub_normal_print_device_info): New prototype. * include/grub/disk.h (grub_print_partinfo): Removed. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/misc.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. * commands/ls.c (grub_ls_list_disks): Use grub_normal_print_device_info instead of grub_print_partinfo. Free PNAME. (grub_ls_list_files): Use grub_normal_print_device_info instead of duplicating the code.
2005-08-18 03:14:39 +00:00
completion_buffer.buf = 0;
completion_buffer.len = 0;
completion_buffer.max_len = 0;
linep = screen->lines + screen->line;
u8 = grub_ucs4_to_utf8_alloc (linep->buf, screen->column);
if (!u8)
return 1;
2005-08-18 Yoshinori K. Okuji <okuji@enbug.org> * normal/misc.c: New file. * DISTLIST: Added normal/misc.c. * partmap/amiga.c (amiga_partition_map_iterate): Add an argument DISK to HOOK. Call HOOK with DISK. * partmap/apple.c (apple_partition_map_iterate): Likewise. * partmap/pc.c (pc_partition_map_iterate): Likewise. * partmap/sun.c (sun_partition_map_iterate): Likewise. * normal/menu_entry.c (struct screen): Added a new member "completion_shown". (completion_buffer): New global variable. (make_screen): Set SCREEN->COMPLETION_SHOWN to zero. (store_completion): New function. (complete): Likewise. (clear_completions): Likewise. (grub_menu_entry_run): If SCREEN->COMPLETION_SHOWN is non-zero, call clear_completions and reset SCREEN->COMPLETION_SHOWN. If C is a tab, call complete. * normal/completion.c (disk_dev): Removed. (print_simple_completion): Likewise. (print_partition_completion): Likewise. (print_func): New global variable. (add_completion): Do not take the arguments WHAT or PRINT any longer. Added a new argument TYPE. Instead of printing directly, call PRINT_FUNC if not NULL. All callers changed. (complete_device): Use a local variable DEV instead of DISK_DEV. Do not move CURRENT_WORD to the end of a device name. (grub_normal_do_completion): Take a new argument HOOK. Do not initialize DISK_DEV. Initialize PRINT_FUNC to HOOK. If RET is an empty string, return NULL instead. All callers changed. * normal/cmdline.c (print_completion): New function. * kern/partition.c (grub_partition_iterate): Add an argument DISK to HOOK. All callers changed. * kern/disk.c (grub_print_partinfo): Removed. * include/grub/partition.h (struct grub_partition_map): Add a new argument DISK into HOOK of ITERATE. (grub_partition_iterate): Add a new argument DISK to HOOK. * include/grub/normal.h (enum grub_completion_type): New enum. (grub_completion_type_t): New type. (GRUB_COMPLETION_TYPE_COMMAND): New constant. (GRUB_COMPLETION_TYPE_DEVICE): Likewise. (GRUB_COMPLETION_TYPE_PARTITION): Likewise. (GRUB_COMPLETION_TYPE_FILE): Likewise. (grub_normal_do_completion): Added a new argument HOOK. (grub_normal_print_device_info): New prototype. * include/grub/disk.h (grub_print_partinfo): Removed. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/misc.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. * commands/ls.c (grub_ls_list_disks): Use grub_normal_print_device_info instead of grub_print_partinfo. Free PNAME. (grub_ls_list_files): Use grub_normal_print_device_info instead of duplicating the code.
2005-08-18 03:14:39 +00:00
insert = grub_normal_do_completion (u8, &restore, store_completion);
2010-03-23 15:46:45 +00:00
if (completion_buffer.buf)
2009-12-24 14:34:33 +00:00
{
2010-03-23 15:46:45 +00:00
buflen = grub_strlen (completion_buffer.buf);
ucs4 = grub_calloc (buflen + 1, sizeof (grub_uint32_t));
2010-03-23 15:46:45 +00:00
if (!ucs4)
{
grub_print_error ();
grub_errno = GRUB_ERR_NONE;
return 1;
}
2005-08-18 Yoshinori K. Okuji <okuji@enbug.org> * normal/misc.c: New file. * DISTLIST: Added normal/misc.c. * partmap/amiga.c (amiga_partition_map_iterate): Add an argument DISK to HOOK. Call HOOK with DISK. * partmap/apple.c (apple_partition_map_iterate): Likewise. * partmap/pc.c (pc_partition_map_iterate): Likewise. * partmap/sun.c (sun_partition_map_iterate): Likewise. * normal/menu_entry.c (struct screen): Added a new member "completion_shown". (completion_buffer): New global variable. (make_screen): Set SCREEN->COMPLETION_SHOWN to zero. (store_completion): New function. (complete): Likewise. (clear_completions): Likewise. (grub_menu_entry_run): If SCREEN->COMPLETION_SHOWN is non-zero, call clear_completions and reset SCREEN->COMPLETION_SHOWN. If C is a tab, call complete. * normal/completion.c (disk_dev): Removed. (print_simple_completion): Likewise. (print_partition_completion): Likewise. (print_func): New global variable. (add_completion): Do not take the arguments WHAT or PRINT any longer. Added a new argument TYPE. Instead of printing directly, call PRINT_FUNC if not NULL. All callers changed. (complete_device): Use a local variable DEV instead of DISK_DEV. Do not move CURRENT_WORD to the end of a device name. (grub_normal_do_completion): Take a new argument HOOK. Do not initialize DISK_DEV. Initialize PRINT_FUNC to HOOK. If RET is an empty string, return NULL instead. All callers changed. * normal/cmdline.c (print_completion): New function. * kern/partition.c (grub_partition_iterate): Add an argument DISK to HOOK. All callers changed. * kern/disk.c (grub_print_partinfo): Removed. * include/grub/partition.h (struct grub_partition_map): Add a new argument DISK into HOOK of ITERATE. (grub_partition_iterate): Add a new argument DISK to HOOK. * include/grub/normal.h (enum grub_completion_type): New enum. (grub_completion_type_t): New type. (GRUB_COMPLETION_TYPE_COMMAND): New constant. (GRUB_COMPLETION_TYPE_DEVICE): Likewise. (GRUB_COMPLETION_TYPE_PARTITION): Likewise. (GRUB_COMPLETION_TYPE_FILE): Likewise. (grub_normal_do_completion): Added a new argument HOOK. (grub_normal_print_device_info): New prototype. * include/grub/disk.h (grub_print_partinfo): Removed. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/misc.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. * commands/ls.c (grub_ls_list_disks): Use grub_normal_print_device_info instead of grub_print_partinfo. Free PNAME. (grub_ls_list_files): Use grub_normal_print_device_info instead of duplicating the code.
2005-08-18 03:14:39 +00:00
2010-03-23 15:46:45 +00:00
ucs4len = grub_utf8_to_ucs4 (ucs4, buflen,
(grub_uint8_t *) completion_buffer.buf,
buflen, 0);
ucs4[ucs4len] = 0;
2009-12-24 14:34:33 +00:00
2010-03-23 15:46:45 +00:00
if (restore)
for (i = 0; i < screen->nterms; i++)
2009-12-24 14:34:33 +00:00
{
unsigned width = grub_term_width (screen->terms[i].term);
if (width > 2)
width -= 2;
if (width > 15)
width -= 6;
unsigned num_sections = ((completion_buffer.len
+ width - 1)
/ width);
2010-03-23 15:46:45 +00:00
grub_uint32_t *endp;
struct grub_term_coordinate pos;
2010-03-23 15:46:45 +00:00
grub_uint32_t *p = ucs4;
pos = grub_term_getxy (screen->terms[i].term);
screen->completion_shown = 1;
grub_term_gotoxy (screen->terms[i].term,
(struct grub_term_coordinate) { 0,
screen->terms[i].geo.timeout_y });
if (screen->terms[i].geo.timeout_lines >= 2)
2010-03-23 15:46:45 +00:00
{
grub_puts_terminal (" ", screen->terms[i].term);
switch (completion_type)
{
case GRUB_COMPLETION_TYPE_COMMAND:
grub_puts_terminal (_("Possible commands are:"),
screen->terms[i].term);
break;
case GRUB_COMPLETION_TYPE_DEVICE:
grub_puts_terminal (_("Possible devices are:"),
screen->terms[i].term);
break;
case GRUB_COMPLETION_TYPE_FILE:
grub_puts_terminal (_("Possible files are:"),
screen->terms[i].term);
break;
case GRUB_COMPLETION_TYPE_PARTITION:
grub_puts_terminal (_("Possible partitions are:"),
screen->terms[i].term);
break;
case GRUB_COMPLETION_TYPE_ARGUMENT:
grub_puts_terminal (_("Possible arguments are:"),
screen->terms[i].term);
break;
default:
grub_puts_terminal (_("Possible things are:"),
screen->terms[i].term);
break;
}
grub_puts_terminal ("\n ", screen->terms[i].term);
2010-03-23 15:46:45 +00:00
}
2009-12-24 14:34:33 +00:00
p += ((unsigned) count % num_sections) * width;
endp = p + width;
2009-12-24 14:34:33 +00:00
2010-03-23 15:46:45 +00:00
if (p != ucs4)
grub_putcode (GRUB_UNICODE_LEFTARROW, screen->terms[i].term);
2010-03-23 15:46:45 +00:00
else
grub_putcode (' ', screen->terms[i].term);
2009-12-24 14:34:33 +00:00
2010-03-23 15:46:45 +00:00
grub_print_ucs4 (p, ucs4 + ucs4len < endp ? ucs4 + ucs4len : endp,
0, 0, screen->terms[i].term);
2009-12-24 14:34:33 +00:00
2010-03-23 15:46:45 +00:00
if (ucs4 + ucs4len > endp)
grub_putcode (GRUB_UNICODE_RIGHTARROW, screen->terms[i].term);
grub_term_gotoxy (screen->terms[i].term, pos);
2010-03-23 15:46:45 +00:00
}
}
2009-06-10 21:04:23 +00:00
2005-08-18 Yoshinori K. Okuji <okuji@enbug.org> * normal/misc.c: New file. * DISTLIST: Added normal/misc.c. * partmap/amiga.c (amiga_partition_map_iterate): Add an argument DISK to HOOK. Call HOOK with DISK. * partmap/apple.c (apple_partition_map_iterate): Likewise. * partmap/pc.c (pc_partition_map_iterate): Likewise. * partmap/sun.c (sun_partition_map_iterate): Likewise. * normal/menu_entry.c (struct screen): Added a new member "completion_shown". (completion_buffer): New global variable. (make_screen): Set SCREEN->COMPLETION_SHOWN to zero. (store_completion): New function. (complete): Likewise. (clear_completions): Likewise. (grub_menu_entry_run): If SCREEN->COMPLETION_SHOWN is non-zero, call clear_completions and reset SCREEN->COMPLETION_SHOWN. If C is a tab, call complete. * normal/completion.c (disk_dev): Removed. (print_simple_completion): Likewise. (print_partition_completion): Likewise. (print_func): New global variable. (add_completion): Do not take the arguments WHAT or PRINT any longer. Added a new argument TYPE. Instead of printing directly, call PRINT_FUNC if not NULL. All callers changed. (complete_device): Use a local variable DEV instead of DISK_DEV. Do not move CURRENT_WORD to the end of a device name. (grub_normal_do_completion): Take a new argument HOOK. Do not initialize DISK_DEV. Initialize PRINT_FUNC to HOOK. If RET is an empty string, return NULL instead. All callers changed. * normal/cmdline.c (print_completion): New function. * kern/partition.c (grub_partition_iterate): Add an argument DISK to HOOK. All callers changed. * kern/disk.c (grub_print_partinfo): Removed. * include/grub/partition.h (struct grub_partition_map): Add a new argument DISK into HOOK of ITERATE. (grub_partition_iterate): Add a new argument DISK to HOOK. * include/grub/normal.h (enum grub_completion_type): New enum. (grub_completion_type_t): New type. (GRUB_COMPLETION_TYPE_COMMAND): New constant. (GRUB_COMPLETION_TYPE_DEVICE): Likewise. (GRUB_COMPLETION_TYPE_PARTITION): Likewise. (GRUB_COMPLETION_TYPE_FILE): Likewise. (grub_normal_do_completion): Added a new argument HOOK. (grub_normal_print_device_info): New prototype. * include/grub/disk.h (grub_print_partinfo): Removed. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/misc.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. * commands/ls.c (grub_ls_list_disks): Use grub_normal_print_device_info instead of grub_print_partinfo. Free PNAME. (grub_ls_list_files): Use grub_normal_print_device_info instead of duplicating the code.
2005-08-18 03:14:39 +00:00
if (insert)
{
insert_string (screen, insert, update);
count = -1;
grub_free (insert);
}
else if (update)
grub_refresh ();
2009-06-10 21:04:23 +00:00
2005-08-18 Yoshinori K. Okuji <okuji@enbug.org> * normal/misc.c: New file. * DISTLIST: Added normal/misc.c. * partmap/amiga.c (amiga_partition_map_iterate): Add an argument DISK to HOOK. Call HOOK with DISK. * partmap/apple.c (apple_partition_map_iterate): Likewise. * partmap/pc.c (pc_partition_map_iterate): Likewise. * partmap/sun.c (sun_partition_map_iterate): Likewise. * normal/menu_entry.c (struct screen): Added a new member "completion_shown". (completion_buffer): New global variable. (make_screen): Set SCREEN->COMPLETION_SHOWN to zero. (store_completion): New function. (complete): Likewise. (clear_completions): Likewise. (grub_menu_entry_run): If SCREEN->COMPLETION_SHOWN is non-zero, call clear_completions and reset SCREEN->COMPLETION_SHOWN. If C is a tab, call complete. * normal/completion.c (disk_dev): Removed. (print_simple_completion): Likewise. (print_partition_completion): Likewise. (print_func): New global variable. (add_completion): Do not take the arguments WHAT or PRINT any longer. Added a new argument TYPE. Instead of printing directly, call PRINT_FUNC if not NULL. All callers changed. (complete_device): Use a local variable DEV instead of DISK_DEV. Do not move CURRENT_WORD to the end of a device name. (grub_normal_do_completion): Take a new argument HOOK. Do not initialize DISK_DEV. Initialize PRINT_FUNC to HOOK. If RET is an empty string, return NULL instead. All callers changed. * normal/cmdline.c (print_completion): New function. * kern/partition.c (grub_partition_iterate): Add an argument DISK to HOOK. All callers changed. * kern/disk.c (grub_print_partinfo): Removed. * include/grub/partition.h (struct grub_partition_map): Add a new argument DISK into HOOK of ITERATE. (grub_partition_iterate): Add a new argument DISK to HOOK. * include/grub/normal.h (enum grub_completion_type): New enum. (grub_completion_type_t): New type. (GRUB_COMPLETION_TYPE_COMMAND): New constant. (GRUB_COMPLETION_TYPE_DEVICE): Likewise. (GRUB_COMPLETION_TYPE_PARTITION): Likewise. (GRUB_COMPLETION_TYPE_FILE): Likewise. (grub_normal_do_completion): Added a new argument HOOK. (grub_normal_print_device_info): New prototype. * include/grub/disk.h (grub_print_partinfo): Removed. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/misc.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. * commands/ls.c (grub_ls_list_disks): Use grub_normal_print_device_info instead of grub_print_partinfo. Free PNAME. (grub_ls_list_files): Use grub_normal_print_device_info instead of duplicating the code.
2005-08-18 03:14:39 +00:00
grub_free (completion_buffer.buf);
return 1;
}
/* Clear displayed completions. */
static void
2009-12-24 14:34:33 +00:00
clear_completions (struct per_term_screen *term_screen)
2005-08-18 Yoshinori K. Okuji <okuji@enbug.org> * normal/misc.c: New file. * DISTLIST: Added normal/misc.c. * partmap/amiga.c (amiga_partition_map_iterate): Add an argument DISK to HOOK. Call HOOK with DISK. * partmap/apple.c (apple_partition_map_iterate): Likewise. * partmap/pc.c (pc_partition_map_iterate): Likewise. * partmap/sun.c (sun_partition_map_iterate): Likewise. * normal/menu_entry.c (struct screen): Added a new member "completion_shown". (completion_buffer): New global variable. (make_screen): Set SCREEN->COMPLETION_SHOWN to zero. (store_completion): New function. (complete): Likewise. (clear_completions): Likewise. (grub_menu_entry_run): If SCREEN->COMPLETION_SHOWN is non-zero, call clear_completions and reset SCREEN->COMPLETION_SHOWN. If C is a tab, call complete. * normal/completion.c (disk_dev): Removed. (print_simple_completion): Likewise. (print_partition_completion): Likewise. (print_func): New global variable. (add_completion): Do not take the arguments WHAT or PRINT any longer. Added a new argument TYPE. Instead of printing directly, call PRINT_FUNC if not NULL. All callers changed. (complete_device): Use a local variable DEV instead of DISK_DEV. Do not move CURRENT_WORD to the end of a device name. (grub_normal_do_completion): Take a new argument HOOK. Do not initialize DISK_DEV. Initialize PRINT_FUNC to HOOK. If RET is an empty string, return NULL instead. All callers changed. * normal/cmdline.c (print_completion): New function. * kern/partition.c (grub_partition_iterate): Add an argument DISK to HOOK. All callers changed. * kern/disk.c (grub_print_partinfo): Removed. * include/grub/partition.h (struct grub_partition_map): Add a new argument DISK into HOOK of ITERATE. (grub_partition_iterate): Add a new argument DISK to HOOK. * include/grub/normal.h (enum grub_completion_type): New enum. (grub_completion_type_t): New type. (GRUB_COMPLETION_TYPE_COMMAND): New constant. (GRUB_COMPLETION_TYPE_DEVICE): Likewise. (GRUB_COMPLETION_TYPE_PARTITION): Likewise. (GRUB_COMPLETION_TYPE_FILE): Likewise. (grub_normal_do_completion): Added a new argument HOOK. (grub_normal_print_device_info): New prototype. * include/grub/disk.h (grub_print_partinfo): Removed. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/misc.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. * commands/ls.c (grub_ls_list_disks): Use grub_normal_print_device_info instead of grub_print_partinfo. Free PNAME. (grub_ls_list_files): Use grub_normal_print_device_info instead of duplicating the code.
2005-08-18 03:14:39 +00:00
{
struct grub_term_coordinate pos;
unsigned j;
int i;
2009-06-10 21:04:23 +00:00
2009-12-24 14:34:33 +00:00
pos = grub_term_getxy (term_screen->term);
grub_term_gotoxy (term_screen->term,
(struct grub_term_coordinate) { 0,
term_screen->geo.timeout_y });
2009-06-10 21:04:23 +00:00
for (i = 0; i < term_screen->geo.timeout_lines; i++)
2005-08-18 Yoshinori K. Okuji <okuji@enbug.org> * normal/misc.c: New file. * DISTLIST: Added normal/misc.c. * partmap/amiga.c (amiga_partition_map_iterate): Add an argument DISK to HOOK. Call HOOK with DISK. * partmap/apple.c (apple_partition_map_iterate): Likewise. * partmap/pc.c (pc_partition_map_iterate): Likewise. * partmap/sun.c (sun_partition_map_iterate): Likewise. * normal/menu_entry.c (struct screen): Added a new member "completion_shown". (completion_buffer): New global variable. (make_screen): Set SCREEN->COMPLETION_SHOWN to zero. (store_completion): New function. (complete): Likewise. (clear_completions): Likewise. (grub_menu_entry_run): If SCREEN->COMPLETION_SHOWN is non-zero, call clear_completions and reset SCREEN->COMPLETION_SHOWN. If C is a tab, call complete. * normal/completion.c (disk_dev): Removed. (print_simple_completion): Likewise. (print_partition_completion): Likewise. (print_func): New global variable. (add_completion): Do not take the arguments WHAT or PRINT any longer. Added a new argument TYPE. Instead of printing directly, call PRINT_FUNC if not NULL. All callers changed. (complete_device): Use a local variable DEV instead of DISK_DEV. Do not move CURRENT_WORD to the end of a device name. (grub_normal_do_completion): Take a new argument HOOK. Do not initialize DISK_DEV. Initialize PRINT_FUNC to HOOK. If RET is an empty string, return NULL instead. All callers changed. * normal/cmdline.c (print_completion): New function. * kern/partition.c (grub_partition_iterate): Add an argument DISK to HOOK. All callers changed. * kern/disk.c (grub_print_partinfo): Removed. * include/grub/partition.h (struct grub_partition_map): Add a new argument DISK into HOOK of ITERATE. (grub_partition_iterate): Add a new argument DISK to HOOK. * include/grub/normal.h (enum grub_completion_type): New enum. (grub_completion_type_t): New type. (GRUB_COMPLETION_TYPE_COMMAND): New constant. (GRUB_COMPLETION_TYPE_DEVICE): Likewise. (GRUB_COMPLETION_TYPE_PARTITION): Likewise. (GRUB_COMPLETION_TYPE_FILE): Likewise. (grub_normal_do_completion): Added a new argument HOOK. (grub_normal_print_device_info): New prototype. * include/grub/disk.h (grub_print_partinfo): Removed. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/misc.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. * commands/ls.c (grub_ls_list_disks): Use grub_normal_print_device_info instead of grub_print_partinfo. Free PNAME. (grub_ls_list_files): Use grub_normal_print_device_info instead of duplicating the code.
2005-08-18 03:14:39 +00:00
{
2009-12-24 14:34:33 +00:00
for (j = 0; j < grub_term_width (term_screen->term) - 1; j++)
grub_putcode (' ', term_screen->term);
if (i + 1 < term_screen->geo.timeout_lines)
grub_putcode ('\n', term_screen->term);
2005-08-18 Yoshinori K. Okuji <okuji@enbug.org> * normal/misc.c: New file. * DISTLIST: Added normal/misc.c. * partmap/amiga.c (amiga_partition_map_iterate): Add an argument DISK to HOOK. Call HOOK with DISK. * partmap/apple.c (apple_partition_map_iterate): Likewise. * partmap/pc.c (pc_partition_map_iterate): Likewise. * partmap/sun.c (sun_partition_map_iterate): Likewise. * normal/menu_entry.c (struct screen): Added a new member "completion_shown". (completion_buffer): New global variable. (make_screen): Set SCREEN->COMPLETION_SHOWN to zero. (store_completion): New function. (complete): Likewise. (clear_completions): Likewise. (grub_menu_entry_run): If SCREEN->COMPLETION_SHOWN is non-zero, call clear_completions and reset SCREEN->COMPLETION_SHOWN. If C is a tab, call complete. * normal/completion.c (disk_dev): Removed. (print_simple_completion): Likewise. (print_partition_completion): Likewise. (print_func): New global variable. (add_completion): Do not take the arguments WHAT or PRINT any longer. Added a new argument TYPE. Instead of printing directly, call PRINT_FUNC if not NULL. All callers changed. (complete_device): Use a local variable DEV instead of DISK_DEV. Do not move CURRENT_WORD to the end of a device name. (grub_normal_do_completion): Take a new argument HOOK. Do not initialize DISK_DEV. Initialize PRINT_FUNC to HOOK. If RET is an empty string, return NULL instead. All callers changed. * normal/cmdline.c (print_completion): New function. * kern/partition.c (grub_partition_iterate): Add an argument DISK to HOOK. All callers changed. * kern/disk.c (grub_print_partinfo): Removed. * include/grub/partition.h (struct grub_partition_map): Add a new argument DISK into HOOK of ITERATE. (grub_partition_iterate): Add a new argument DISK to HOOK. * include/grub/normal.h (enum grub_completion_type): New enum. (grub_completion_type_t): New type. (GRUB_COMPLETION_TYPE_COMMAND): New constant. (GRUB_COMPLETION_TYPE_DEVICE): Likewise. (GRUB_COMPLETION_TYPE_PARTITION): Likewise. (GRUB_COMPLETION_TYPE_FILE): Likewise. (grub_normal_do_completion): Added a new argument HOOK. (grub_normal_print_device_info): New prototype. * include/grub/disk.h (grub_print_partinfo): Removed. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/misc.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. * commands/ls.c (grub_ls_list_disks): Use grub_normal_print_device_info instead of grub_print_partinfo. Free PNAME. (grub_ls_list_files): Use grub_normal_print_device_info instead of duplicating the code.
2005-08-18 03:14:39 +00:00
}
2009-06-10 21:04:23 +00:00
grub_term_gotoxy (term_screen->term, pos);
2009-12-24 14:34:33 +00:00
grub_term_refresh (term_screen->term);
}
static void
clear_completions_all (struct screen *screen)
{
unsigned i;
for (i = 0; i < screen->nterms; i++)
clear_completions (&screen->terms[i]);
2005-08-18 Yoshinori K. Okuji <okuji@enbug.org> * normal/misc.c: New file. * DISTLIST: Added normal/misc.c. * partmap/amiga.c (amiga_partition_map_iterate): Add an argument DISK to HOOK. Call HOOK with DISK. * partmap/apple.c (apple_partition_map_iterate): Likewise. * partmap/pc.c (pc_partition_map_iterate): Likewise. * partmap/sun.c (sun_partition_map_iterate): Likewise. * normal/menu_entry.c (struct screen): Added a new member "completion_shown". (completion_buffer): New global variable. (make_screen): Set SCREEN->COMPLETION_SHOWN to zero. (store_completion): New function. (complete): Likewise. (clear_completions): Likewise. (grub_menu_entry_run): If SCREEN->COMPLETION_SHOWN is non-zero, call clear_completions and reset SCREEN->COMPLETION_SHOWN. If C is a tab, call complete. * normal/completion.c (disk_dev): Removed. (print_simple_completion): Likewise. (print_partition_completion): Likewise. (print_func): New global variable. (add_completion): Do not take the arguments WHAT or PRINT any longer. Added a new argument TYPE. Instead of printing directly, call PRINT_FUNC if not NULL. All callers changed. (complete_device): Use a local variable DEV instead of DISK_DEV. Do not move CURRENT_WORD to the end of a device name. (grub_normal_do_completion): Take a new argument HOOK. Do not initialize DISK_DEV. Initialize PRINT_FUNC to HOOK. If RET is an empty string, return NULL instead. All callers changed. * normal/cmdline.c (print_completion): New function. * kern/partition.c (grub_partition_iterate): Add an argument DISK to HOOK. All callers changed. * kern/disk.c (grub_print_partinfo): Removed. * include/grub/partition.h (struct grub_partition_map): Add a new argument DISK into HOOK of ITERATE. (grub_partition_iterate): Add a new argument DISK to HOOK. * include/grub/normal.h (enum grub_completion_type): New enum. (grub_completion_type_t): New type. (GRUB_COMPLETION_TYPE_COMMAND): New constant. (GRUB_COMPLETION_TYPE_DEVICE): Likewise. (GRUB_COMPLETION_TYPE_PARTITION): Likewise. (GRUB_COMPLETION_TYPE_FILE): Likewise. (grub_normal_do_completion): Added a new argument HOOK. (grub_normal_print_device_info): New prototype. * include/grub/disk.h (grub_print_partinfo): Removed. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/misc.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. * commands/ls.c (grub_ls_list_disks): Use grub_normal_print_device_info instead of grub_print_partinfo. Free PNAME. (grub_ls_list_files): Use grub_normal_print_device_info instead of duplicating the code.
2005-08-18 03:14:39 +00:00
}
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
/* Execute the command list in the screen SCREEN. */
static int
run (struct screen *screen)
{
char *script;
int errs_before;
grub_menu_t menu = NULL;
char *dummy[1] = { NULL };
2006-01-17 Marco Gerards <marco@gnu.org> * include/grub/normal.h: Include <grub/script.h>. (grub_command_list): Removed struct. (grub_command_list_t): Removed type. (grub_menu_entry): Remove members `num' and `command_list'. Add members `commands' and `sourcecode'. * include/grub/script.h: Add inclusion guards. (grub_script_cmd_menuentry): New struct. (grub_script_execute_menuentry): New prototype. (grub_script_lexer_record_start): Likewise. (grub_script_lexer_record_stop): Likewise. * normal/execute.c (grub_script_execute_menuentry): New function. * normal/lexer.c (record, recording, recordpos, recordlen): New variables. (grub_script_lexer_record_start): New function. (grub_script_lexer_record_stop): Likewise. (recordchar): Likewise. (nextchar): Likewise. (grub_script_yylex): Use `nextchar' to fetch new characters. Use 2048 as the buffer size. Add the tokens `menuentry' and `@'. * normal/main.c: Include <grub/parser.h> and <grub/script.h> (current_menu): New variable. (free_menu): Mainly rewritten. (grub_normal_menu_addentry): New function. (read_config_file): Rewritten. * normal/menu.c (run_menu_entry): Mainly rewritten. * normal/menu_entry.c (make_screen): Rewritten te code to insert the menu entry. (run): Mainly rewritten. * normal/parser.y (menu_entry): New variable. (GRUB_PARSER_TOKEN_MENUENTRY): New token. (menuentry): New rule. (command): Add `menuentry'. (if_statement): Allow additional returns before `fi'. * normal/script.c (grub_script_create_cmdmenu): New function.
2006-01-17 09:50:47 +00:00
grub_cls ();
grub_printf (" ");
grub_printf_ (N_("Booting a command list"));
grub_printf ("\n\n");
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
errs_before = grub_err_printed_errors;
2006-01-17 Marco Gerards <marco@gnu.org> * include/grub/normal.h: Include <grub/script.h>. (grub_command_list): Removed struct. (grub_command_list_t): Removed type. (grub_menu_entry): Remove members `num' and `command_list'. Add members `commands' and `sourcecode'. * include/grub/script.h: Add inclusion guards. (grub_script_cmd_menuentry): New struct. (grub_script_execute_menuentry): New prototype. (grub_script_lexer_record_start): Likewise. (grub_script_lexer_record_stop): Likewise. * normal/execute.c (grub_script_execute_menuentry): New function. * normal/lexer.c (record, recording, recordpos, recordlen): New variables. (grub_script_lexer_record_start): New function. (grub_script_lexer_record_stop): Likewise. (recordchar): Likewise. (nextchar): Likewise. (grub_script_yylex): Use `nextchar' to fetch new characters. Use 2048 as the buffer size. Add the tokens `menuentry' and `@'. * normal/main.c: Include <grub/parser.h> and <grub/script.h> (current_menu): New variable. (free_menu): Mainly rewritten. (grub_normal_menu_addentry): New function. (read_config_file): Rewritten. * normal/menu.c (run_menu_entry): Mainly rewritten. * normal/menu_entry.c (make_screen): Rewritten te code to insert the menu entry. (run): Mainly rewritten. * normal/parser.y (menu_entry): New variable. (GRUB_PARSER_TOKEN_MENUENTRY): New token. (menuentry): New rule. (command): Add `menuentry'. (if_statement): Allow additional returns before `fi'. * normal/script.c (grub_script_create_cmdmenu): New function.
2006-01-17 09:50:47 +00:00
if (screen->submenu)
{
grub_env_context_open ();
menu = grub_zalloc (sizeof (*menu));
if (! menu)
return 0;
grub_env_set_menu (menu);
}
2006-01-17 Marco Gerards <marco@gnu.org> * include/grub/normal.h: Include <grub/script.h>. (grub_command_list): Removed struct. (grub_command_list_t): Removed type. (grub_menu_entry): Remove members `num' and `command_list'. Add members `commands' and `sourcecode'. * include/grub/script.h: Add inclusion guards. (grub_script_cmd_menuentry): New struct. (grub_script_execute_menuentry): New prototype. (grub_script_lexer_record_start): Likewise. (grub_script_lexer_record_stop): Likewise. * normal/execute.c (grub_script_execute_menuentry): New function. * normal/lexer.c (record, recording, recordpos, recordlen): New variables. (grub_script_lexer_record_start): New function. (grub_script_lexer_record_stop): Likewise. (recordchar): Likewise. (nextchar): Likewise. (grub_script_yylex): Use `nextchar' to fetch new characters. Use 2048 as the buffer size. Add the tokens `menuentry' and `@'. * normal/main.c: Include <grub/parser.h> and <grub/script.h> (current_menu): New variable. (free_menu): Mainly rewritten. (grub_normal_menu_addentry): New function. (read_config_file): Rewritten. * normal/menu.c (run_menu_entry): Mainly rewritten. * normal/menu_entry.c (make_screen): Rewritten te code to insert the menu entry. (run): Mainly rewritten. * normal/parser.y (menu_entry): New variable. (GRUB_PARSER_TOKEN_MENUENTRY): New token. (menuentry): New rule. (command): Add `menuentry'. (if_statement): Allow additional returns before `fi'. * normal/script.c (grub_script_create_cmdmenu): New function.
2006-01-17 09:50:47 +00:00
/* Execute the script, line for line. */
{
int i;
grub_size_t size = 0, tot_size = 0;
for (i = 0; i < screen->num_lines; i++)
tot_size += grub_get_num_of_utf8_bytes (screen->lines[i].buf,
screen->lines[i].len) + 1;
script = grub_malloc (tot_size + 1);
if (! script)
return 0;
for (i = 0; i < screen->num_lines; i++)
{
size += grub_ucs4_to_utf8 (screen->lines[i].buf, screen->lines[i].len,
(grub_uint8_t *) script + size,
tot_size - size);
script[size++] = '\n';
}
script[size] = '\0';
}
grub_script_execute_new_scope (script, 0, dummy);
grub_free (script);
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
if (errs_before != grub_err_printed_errors)
grub_wait_after_message ();
if (grub_errno == GRUB_ERR_NONE && grub_loader_is_loaded ())
/* Implicit execution of boot, only if something is loaded. */
2009-05-02 Bean <bean123ch@gmail.com> * conf/common.rmk (grub_script.tab.c): Change normal/parser.y to script/sh/parser.y. (pkglib_MODULES): Add normal.mod and sh.mod. (normal_SOURCES): New variable. (normal_mod_CFLAGS): Likewise. (normal_mod_LDFLAGS): Likewise. (sh_mod_SOURCES): Likewise. (sh_mod_CFLAGS): Likewise. (sh_mod_LDFLAGS): Likewise. * conf/i386-pc.rmk (normal/lexer.c_DEPENDENCIES): Changed to script/sh/lexer.c_DEPENDENCIES. (kernel_img_SOURCES): Remove kern/rescue.c, and kern/reader.c, kern/rescue_reader.c and kern/rescue_parser.c. (kernel_img_HEADERS): Remove rescue.h, add reader.h. (grub_emu_SOURCES): Change source files. (pkglib_MODULES): Remove normal.mod. (normal_SOURCES): Removed. (normal_mod_CFLAGS): Likewise. (normal_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk: Likewise. * conf/i386-efi.rmk: Likewise. * conf/i386-ieee1276.rmk: Likewise. * conf/powerpc-ieee1275.rmk: Likewise. * conf/sparc64-ieee1275.rmk: Likewise. * conf/x86_64-efi.rmk: Likewise. * include/grub/command.h (grub_command_execute): New inline function. * include/grub/menu.h (grub_menu_entry): Removed commands field. * include/grub/normal.h: Remove <grub/setjmp.h>. (grub_fs_module_list): Moved to normal/autofs.c. (grub_exit_env): Removed. (grub_command_execute): Likewise. (grub_normal_menu_addentry): Renamed to grub_menu_addentry, removed parameter script. (read_command_list): New function declaration. (read_fs_list): Likewise. * include/parser.h: Include <grub/reader.h>. (grub_parser_split_cmdline): Change type of getline parameter. (grub_parser): New structure. (grub_parser_class): New variable. (grub_parser_execute): New function declaration. (grub_register_rescue_parser): Likewise. (grub_parser_register): New inline function. (grub_parser_unregister): Likewise. (grub_parser_get_current): Likewise. (grub_parser_set_current): Likewise. * include/grub/reader.h: New file. * kern/reader.c: Likewise. * kern/rescue_parser.c: Likewise. * kern/rescue_reader.c: Likewise. * normal/autofs.c: Likewise. * normal/dyncmd.c: Likewise. * include/grub/rescue.h: Removed. * normal/command.h: Likewise. * include/grub/script.h: Moved to ... * include/grub/script_sh.h: ... Moved here. * normal/execute.c: Moved to ... * script/sh/execute.c: ... Moved here. * normal/function.c: Moved to ... * script/sh/function.c: ... Moved here. * normal/lexer.c: Moved to ... * script/sh/lexer.c: ... Moved here. * normal/parser.y: Moved to ... * script/sh/parser.y: ... Moved here. * normal/script.c: Moved to ... * script/sh/script.c: ... Moved here. * normal/main.c: Remove <grub/rescue.h> and <grub/script.h>, include <grub/reader.h>. (grub_exit_env): Removed. (fs_module_list): Moved to normal/autofs.c. (grub_file_getline): Don't handle comment here. (free_menu): Skip removed field entry->commands. (grub_normal_menu_addentry): Removed as grub_menu_entry, removed script parameter. (read_config_file): Removed nested parameter, change getline function. (grub_enter_normal_mode): Removed. (grub_dyncmd_dispatcher): Moved to normal/dyncmd.c. (read_command_list): Likewise. (autoload_fs_module): Moved to normal/autofs.c. (read_fs_list): Likewise. (reader_nested): New variable. (grub_normal_execute): Run parser.sh to switch to sh parser. (grub_cmd_rescue): Removed. (cmd_normal): Removed. (grub_cmd_normal): Unregister itself at the beginning. Don't register rescue command. (grub_cmdline_run): New function. (grub_normal_reader_init): Likewise. (grub_normal_read_line): Likewise. (grub_env_write_pager): Likewise. (cmdline): New variable. (grub_normal_reader): Likewise. (GRUB_MOD_INIT): Register normal reader and set as current, register pager hook, register normal command with grub_register_command_prio, so that it won't show up in command.lst. (GRUB_MOD_FINI): Unregister normal reader, unhook pager, clear grub_fs_autoload_hook. * normal/menu.c: Remove <grub/script.h>, add <grub/command.h>. (grub_menu_execute_entry): Replace grub_script_execute with grub_parser_execute, change parameter to grub_command_execute. * normal/menu_text.c: Remove <grub/script.h>. * normal/menu_entry.c: Remove <grub/script.h>, add <grub/command.h> and <grub/parser.h>. (run): Change editor_getline to use new parser interface. Change parameter to grub_command_execute. * kern/main.c: Remove <grub/rescue.h>, include <grub/command.h>, <grub/reader.h> and <grub/parser.h>. (grub_load_normal_mode): Execute normal command. (grub_main): Call grub_register_core_commands, grub_register_rescue_parser and grub_register_rescue_reader, use grub_reader_loop to enter input loop. * kern/parser.c (grub_parser_spli_cmdline): Change type of getline parameter. (grub_parser_class): New variable. (grub_parser_execute): New function. * loader/i386/multiboot.c: Remove <grub/rescue.h>. * loader/multiboot2.c: Likewise. * loader/sparc64/ieee1275/linux.c: Likewise. * util/grub-emu.c (read_command_list): New dummy function.
2009-05-02 19:49:34 +00:00
grub_command_execute ("boot", 0, 0);
if (screen->submenu)
{
if (menu && menu->size)
{
grub_show_menu (menu, 1, 0);
grub_normal_free_menu (menu);
}
grub_env_context_close ();
}
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
if (grub_errno != GRUB_ERR_NONE)
{
grub_print_error ();
grub_errno = GRUB_ERR_NONE;
2008-01-05 Robert Millan <rmh@aybabtu.com> * include/grub/normal.h (grub_env_write_color_normal): New prototype. (grub_env_write_color_highlight): Likewise. (grub_wait_after_message): Likewise. * normal/color.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Add `normal/color.c'. (normal_mod_DEPENDENCIES): Likewise. * conf/i386-efi.rmk (grub_emu_SOURCES): Add `normal/color.c'. (normal_mod_DEPENDENCIES): Likewise. * conf/i386-linuxbios.rmk (grub_emu_SOURCES): Add `normal/color.c'. (normal_mod_DEPENDENCIES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Add `normal/color.c'. (normal_mod_DEPENDENCIES): Likewise. * normal/menu_entry.c (run): Rely on grub_wait_after_message() for waiting after a message is printed. * normal/main.c (read_config_file): Likewise. (grub_normal_init): Register grub_env_write_color_normal() and grub_env_write_color_highlight() hooks. Mark `color_normal' and `color_highlight' variables as global. * normal/menu.c (grub_wait_after_message): New function. (grub_color_menu_normal): New variable. Replaces ... (GRUB_COLOR_MENU_NORMAL): ... this macro. (grub_color_menu_highlight): New variable. Replaces ... (GRUB_COLOR_MENU_HIGHLIGHT): ... this macro. (draw_border): Set color state to `GRUB_TERM_COLOR_NORMAL' instead of `GRUB_TERM_COLOR_STANDARD'. (print_message): Use `grub_setcolorstate' to reload colors. Rename `normal_code' and `highlight_code' to `old_color_normal' and `old_color_highlight', respectively. (grub_menu_init_page): Update colors when drawing the menu, based on `menu_color_normal' and `menu_color_highlight' variables. (grub_menu_run): Rely on grub_wait_after_message() for waiting after a message is printed.
2008-01-05 12:10:28 +00:00
grub_wait_after_message ();
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
}
2006-01-17 Marco Gerards <marco@gnu.org> * include/grub/normal.h: Include <grub/script.h>. (grub_command_list): Removed struct. (grub_command_list_t): Removed type. (grub_menu_entry): Remove members `num' and `command_list'. Add members `commands' and `sourcecode'. * include/grub/script.h: Add inclusion guards. (grub_script_cmd_menuentry): New struct. (grub_script_execute_menuentry): New prototype. (grub_script_lexer_record_start): Likewise. (grub_script_lexer_record_stop): Likewise. * normal/execute.c (grub_script_execute_menuentry): New function. * normal/lexer.c (record, recording, recordpos, recordlen): New variables. (grub_script_lexer_record_start): New function. (grub_script_lexer_record_stop): Likewise. (recordchar): Likewise. (nextchar): Likewise. (grub_script_yylex): Use `nextchar' to fetch new characters. Use 2048 as the buffer size. Add the tokens `menuentry' and `@'. * normal/main.c: Include <grub/parser.h> and <grub/script.h> (current_menu): New variable. (free_menu): Mainly rewritten. (grub_normal_menu_addentry): New function. (read_config_file): Rewritten. * normal/menu.c (run_menu_entry): Mainly rewritten. * normal/menu_entry.c (make_screen): Rewritten te code to insert the menu entry. (run): Mainly rewritten. * normal/parser.y (menu_entry): New variable. (GRUB_PARSER_TOKEN_MENUENTRY): New token. (menuentry): New rule. (command): Add `menuentry'. (if_statement): Allow additional returns before `fi'. * normal/script.c (grub_script_create_cmdmenu): New function.
2006-01-17 09:50:47 +00:00
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
return 1;
}
/* Edit a menu entry with an Emacs-like interface. */
void
grub_menu_entry_run (grub_menu_entry_t entry)
{
struct screen *screen;
int prev_c;
2009-08-24 23:55:06 +00:00
grub_err_t err = GRUB_ERR_NONE;
2009-12-24 14:34:33 +00:00
unsigned i;
2009-12-25 03:12:29 +00:00
grub_term_output_t term;
2009-08-24 23:55:06 +00:00
err = grub_auth_check_authentication (NULL);
if (err)
{
grub_print_error ();
grub_errno = GRUB_ERR_NONE;
return;
}
2009-06-10 21:04:23 +00:00
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
screen = make_screen (entry);
if (! screen)
return;
2009-12-25 03:12:29 +00:00
screen->terms = NULL;
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
refresh:
2009-12-25 03:12:29 +00:00
grub_free (screen->terms);
screen->nterms = 0;
FOR_ACTIVE_TERM_OUTPUTS(term)
screen->nterms++;
2013-01-16 12:41:16 +00:00
for (i = 0; i < (unsigned) screen->num_lines; i++)
{
grub_free (screen->lines[i].pos);
screen->lines[i].pos = grub_calloc (screen->nterms, sizeof (screen->lines[i].pos[0]));
2013-01-16 12:41:16 +00:00
if (! screen->lines[i].pos)
{
grub_print_error ();
destroy_screen (screen);
2013-01-16 12:41:16 +00:00
grub_errno = GRUB_ERR_NONE;
return;
}
}
screen->terms = grub_calloc (screen->nterms, sizeof (screen->terms[0]));
2009-12-25 03:12:29 +00:00
if (!screen->terms)
{
grub_print_error ();
destroy_screen (screen);
2009-12-25 03:12:29 +00:00
grub_errno = GRUB_ERR_NONE;
return;
}
i = 0;
FOR_ACTIVE_TERM_OUTPUTS(term)
{
screen->terms[i].term = term;
2013-01-16 12:41:16 +00:00
screen->terms[i].y_line_start = 0;
2009-12-25 12:18:08 +00:00
i++;
2009-12-25 03:12:29 +00:00
}
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
/* Draw the screen. */
2009-12-24 14:34:33 +00:00
for (i = 0; i < screen->nterms; i++)
grub_menu_init_page (0, 1, &screen->terms[i].geo,
screen->terms[i].term);
2009-12-24 14:34:33 +00:00
update_screen_all (screen, 0, 0, 1, 1, ALL_LINES);
for (i = 0; i < screen->nterms; i++)
grub_term_setcursor (screen->terms[i].term, 1);
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
prev_c = '\0';
2009-06-10 21:04:23 +00:00
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
while (1)
{
2010-05-10 12:54:51 +00:00
int c = grub_getkey ();
2005-08-18 Yoshinori K. Okuji <okuji@enbug.org> * normal/misc.c: New file. * DISTLIST: Added normal/misc.c. * partmap/amiga.c (amiga_partition_map_iterate): Add an argument DISK to HOOK. Call HOOK with DISK. * partmap/apple.c (apple_partition_map_iterate): Likewise. * partmap/pc.c (pc_partition_map_iterate): Likewise. * partmap/sun.c (sun_partition_map_iterate): Likewise. * normal/menu_entry.c (struct screen): Added a new member "completion_shown". (completion_buffer): New global variable. (make_screen): Set SCREEN->COMPLETION_SHOWN to zero. (store_completion): New function. (complete): Likewise. (clear_completions): Likewise. (grub_menu_entry_run): If SCREEN->COMPLETION_SHOWN is non-zero, call clear_completions and reset SCREEN->COMPLETION_SHOWN. If C is a tab, call complete. * normal/completion.c (disk_dev): Removed. (print_simple_completion): Likewise. (print_partition_completion): Likewise. (print_func): New global variable. (add_completion): Do not take the arguments WHAT or PRINT any longer. Added a new argument TYPE. Instead of printing directly, call PRINT_FUNC if not NULL. All callers changed. (complete_device): Use a local variable DEV instead of DISK_DEV. Do not move CURRENT_WORD to the end of a device name. (grub_normal_do_completion): Take a new argument HOOK. Do not initialize DISK_DEV. Initialize PRINT_FUNC to HOOK. If RET is an empty string, return NULL instead. All callers changed. * normal/cmdline.c (print_completion): New function. * kern/partition.c (grub_partition_iterate): Add an argument DISK to HOOK. All callers changed. * kern/disk.c (grub_print_partinfo): Removed. * include/grub/partition.h (struct grub_partition_map): Add a new argument DISK into HOOK of ITERATE. (grub_partition_iterate): Add a new argument DISK to HOOK. * include/grub/normal.h (enum grub_completion_type): New enum. (grub_completion_type_t): New type. (GRUB_COMPLETION_TYPE_COMMAND): New constant. (GRUB_COMPLETION_TYPE_DEVICE): Likewise. (GRUB_COMPLETION_TYPE_PARTITION): Likewise. (GRUB_COMPLETION_TYPE_FILE): Likewise. (grub_normal_do_completion): Added a new argument HOOK. (grub_normal_print_device_info): New prototype. * include/grub/disk.h (grub_print_partinfo): Removed. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/misc.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. * commands/ls.c (grub_ls_list_disks): Use grub_normal_print_device_info instead of grub_print_partinfo. Free PNAME. (grub_ls_list_files): Use grub_normal_print_device_info instead of duplicating the code.
2005-08-18 03:14:39 +00:00
if (screen->completion_shown)
{
2009-12-24 14:34:33 +00:00
clear_completions_all (screen);
2005-08-18 Yoshinori K. Okuji <okuji@enbug.org> * normal/misc.c: New file. * DISTLIST: Added normal/misc.c. * partmap/amiga.c (amiga_partition_map_iterate): Add an argument DISK to HOOK. Call HOOK with DISK. * partmap/apple.c (apple_partition_map_iterate): Likewise. * partmap/pc.c (pc_partition_map_iterate): Likewise. * partmap/sun.c (sun_partition_map_iterate): Likewise. * normal/menu_entry.c (struct screen): Added a new member "completion_shown". (completion_buffer): New global variable. (make_screen): Set SCREEN->COMPLETION_SHOWN to zero. (store_completion): New function. (complete): Likewise. (clear_completions): Likewise. (grub_menu_entry_run): If SCREEN->COMPLETION_SHOWN is non-zero, call clear_completions and reset SCREEN->COMPLETION_SHOWN. If C is a tab, call complete. * normal/completion.c (disk_dev): Removed. (print_simple_completion): Likewise. (print_partition_completion): Likewise. (print_func): New global variable. (add_completion): Do not take the arguments WHAT or PRINT any longer. Added a new argument TYPE. Instead of printing directly, call PRINT_FUNC if not NULL. All callers changed. (complete_device): Use a local variable DEV instead of DISK_DEV. Do not move CURRENT_WORD to the end of a device name. (grub_normal_do_completion): Take a new argument HOOK. Do not initialize DISK_DEV. Initialize PRINT_FUNC to HOOK. If RET is an empty string, return NULL instead. All callers changed. * normal/cmdline.c (print_completion): New function. * kern/partition.c (grub_partition_iterate): Add an argument DISK to HOOK. All callers changed. * kern/disk.c (grub_print_partinfo): Removed. * include/grub/partition.h (struct grub_partition_map): Add a new argument DISK into HOOK of ITERATE. (grub_partition_iterate): Add a new argument DISK to HOOK. * include/grub/normal.h (enum grub_completion_type): New enum. (grub_completion_type_t): New type. (GRUB_COMPLETION_TYPE_COMMAND): New constant. (GRUB_COMPLETION_TYPE_DEVICE): Likewise. (GRUB_COMPLETION_TYPE_PARTITION): Likewise. (GRUB_COMPLETION_TYPE_FILE): Likewise. (grub_normal_do_completion): Added a new argument HOOK. (grub_normal_print_device_info): New prototype. * include/grub/disk.h (grub_print_partinfo): Removed. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/misc.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. * commands/ls.c (grub_ls_list_disks): Use grub_normal_print_device_info instead of grub_print_partinfo. Free PNAME. (grub_ls_list_files): Use grub_normal_print_device_info instead of duplicating the code.
2005-08-18 03:14:39 +00:00
screen->completion_shown = 0;
}
2009-06-10 21:04:23 +00:00
2009-12-25 15:28:31 +00:00
if (grub_normal_exit_level)
{
destroy_screen (screen);
return;
}
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
switch (c)
{
2010-05-10 12:54:51 +00:00
case GRUB_TERM_KEY_UP:
case GRUB_TERM_CTRL | 'p':
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
if (! previous_line (screen, 1))
goto fail;
break;
2010-05-10 12:54:51 +00:00
case GRUB_TERM_CTRL | 'n':
case GRUB_TERM_KEY_DOWN:
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
if (! next_line (screen, 1))
goto fail;
break;
2010-05-10 12:54:51 +00:00
case GRUB_TERM_CTRL | 'f':
case GRUB_TERM_KEY_RIGHT:
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
if (! forward_char (screen, 1))
goto fail;
break;
2009-06-10 21:04:23 +00:00
2010-05-10 12:54:51 +00:00
case GRUB_TERM_CTRL | 'b':
case GRUB_TERM_KEY_LEFT:
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
if (! backward_char (screen, 1))
goto fail;
break;
2010-05-10 12:54:51 +00:00
case GRUB_TERM_CTRL | 'a':
case GRUB_TERM_KEY_HOME:
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
if (! beginning_of_line (screen, 1))
goto fail;
break;
2010-05-10 12:54:51 +00:00
case GRUB_TERM_CTRL | 'e':
case GRUB_TERM_KEY_END:
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
if (! end_of_line (screen, 1))
goto fail;
break;
2009-06-10 21:04:23 +00:00
2010-05-10 12:54:51 +00:00
case GRUB_TERM_CTRL | 'i':
case '\t':
2005-08-18 Yoshinori K. Okuji <okuji@enbug.org> * normal/misc.c: New file. * DISTLIST: Added normal/misc.c. * partmap/amiga.c (amiga_partition_map_iterate): Add an argument DISK to HOOK. Call HOOK with DISK. * partmap/apple.c (apple_partition_map_iterate): Likewise. * partmap/pc.c (pc_partition_map_iterate): Likewise. * partmap/sun.c (sun_partition_map_iterate): Likewise. * normal/menu_entry.c (struct screen): Added a new member "completion_shown". (completion_buffer): New global variable. (make_screen): Set SCREEN->COMPLETION_SHOWN to zero. (store_completion): New function. (complete): Likewise. (clear_completions): Likewise. (grub_menu_entry_run): If SCREEN->COMPLETION_SHOWN is non-zero, call clear_completions and reset SCREEN->COMPLETION_SHOWN. If C is a tab, call complete. * normal/completion.c (disk_dev): Removed. (print_simple_completion): Likewise. (print_partition_completion): Likewise. (print_func): New global variable. (add_completion): Do not take the arguments WHAT or PRINT any longer. Added a new argument TYPE. Instead of printing directly, call PRINT_FUNC if not NULL. All callers changed. (complete_device): Use a local variable DEV instead of DISK_DEV. Do not move CURRENT_WORD to the end of a device name. (grub_normal_do_completion): Take a new argument HOOK. Do not initialize DISK_DEV. Initialize PRINT_FUNC to HOOK. If RET is an empty string, return NULL instead. All callers changed. * normal/cmdline.c (print_completion): New function. * kern/partition.c (grub_partition_iterate): Add an argument DISK to HOOK. All callers changed. * kern/disk.c (grub_print_partinfo): Removed. * include/grub/partition.h (struct grub_partition_map): Add a new argument DISK into HOOK of ITERATE. (grub_partition_iterate): Add a new argument DISK to HOOK. * include/grub/normal.h (enum grub_completion_type): New enum. (grub_completion_type_t): New type. (GRUB_COMPLETION_TYPE_COMMAND): New constant. (GRUB_COMPLETION_TYPE_DEVICE): Likewise. (GRUB_COMPLETION_TYPE_PARTITION): Likewise. (GRUB_COMPLETION_TYPE_FILE): Likewise. (grub_normal_do_completion): Added a new argument HOOK. (grub_normal_print_device_info): New prototype. * include/grub/disk.h (grub_print_partinfo): Removed. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/misc.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. * commands/ls.c (grub_ls_list_disks): Use grub_normal_print_device_info instead of grub_print_partinfo. Free PNAME. (grub_ls_list_files): Use grub_normal_print_device_info instead of duplicating the code.
2005-08-18 03:14:39 +00:00
if (! complete (screen, prev_c == c, 1))
goto fail;
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
break;
2009-06-10 21:04:23 +00:00
2010-05-10 12:54:51 +00:00
case GRUB_TERM_CTRL | 'd':
case GRUB_TERM_KEY_DC:
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
if (! delete_char (screen, 1))
goto fail;
break;
2010-05-10 12:54:51 +00:00
case GRUB_TERM_CTRL | 'h':
2010-08-18 23:07:50 +00:00
case '\b':
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
if (! backward_delete_char (screen, 1))
goto fail;
break;
2009-06-10 21:04:23 +00:00
2010-05-10 12:54:51 +00:00
case GRUB_TERM_CTRL | 'k':
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
if (! kill_line (screen, prev_c == c, 1))
goto fail;
break;
2009-06-10 21:04:23 +00:00
2010-05-10 12:54:51 +00:00
case GRUB_TERM_CTRL | 'u':
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
/* FIXME: What behavior is good for this key? */
break;
2009-06-10 21:04:23 +00:00
2010-05-10 12:54:51 +00:00
case GRUB_TERM_CTRL | 'y':
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
if (! yank (screen, 1))
goto fail;
break;
2010-05-10 12:54:51 +00:00
case GRUB_TERM_CTRL | 'l':
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
/* FIXME: centering. */
goto refresh;
2009-06-10 21:04:23 +00:00
2010-05-10 12:54:51 +00:00
case GRUB_TERM_CTRL | 'o':
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
if (! open_line (screen, 1))
goto fail;
break;
case '\n':
case '\r':
if (! insert_string (screen, "\n", 1))
goto fail;
break;
case GRUB_TERM_ESC:
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
destroy_screen (screen);
return;
2009-06-10 21:04:23 +00:00
2010-05-10 12:54:51 +00:00
case GRUB_TERM_CTRL | 'c':
2010-08-18 23:07:50 +00:00
case GRUB_TERM_KEY_F2:
grub_cmdline_run (1, 0);
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
goto refresh;
2009-06-10 21:04:23 +00:00
2010-05-10 12:54:51 +00:00
case GRUB_TERM_CTRL | 'x':
2010-08-18 23:07:50 +00:00
case GRUB_TERM_KEY_F10:
run (screen);
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
goto refresh;
2010-05-10 12:54:51 +00:00
case GRUB_TERM_CTRL | 'r':
case GRUB_TERM_CTRL | 's':
case GRUB_TERM_CTRL | 't':
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
/* FIXME */
break;
2009-06-10 21:04:23 +00:00
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
default:
if (grub_isprint (c))
{
char buf[2];
buf[0] = c;
buf[1] = '\0';
if (! insert_string (screen, buf, 1))
goto fail;
}
break;
}
prev_c = c;
}
fail:
destroy_screen (screen);
2009-06-10 21:04:23 +00:00
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
grub_cls ();
grub_print_error ();
grub_errno = GRUB_ERR_NONE;
2010-03-15 10:49:27 +00:00
grub_xputs ("\n");
grub_printf_ (N_("Press any key to continue..."));
2005-02-19 Yoshinori K. Okuji <okuji@enbug.org> This implements an Emacs-like menu entry editor. * normal/menu_entry.c: New file. * util/console.c (grub_ncurses_putchar): Translate some Unicode characters to ASCII. (saved_char): New variable. (grub_ncurses_checkkey): Rewritten completely. (grub_ncurses_getkey): Likewise. (grub_ncurses_init): Call raw instead of cbreak. * normal/menu.c (print_entry): Do not put a space. (init_page): Renamed to ... (grub_menu_init_page): ... this. All callers changed. (edit_menu_entry): Removed. (run_menu): Call grub_menu_entry_run instead of edit_menu_entry. * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor. * kern/misc.c (grub_vprintf): Call grub_refresh. * normal/menu.c (DISP_LEFT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this. * normal/menu.c (DISP_UP): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UP): ... this. * normal/menu.c (DISP_RIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this. * normal/menu.c (DISP_DOWN): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this. * normal/menu.c (DISP_HLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this. * normal/menu.c (DISP_VLINE): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this. * normal/menu.c (DISP_UL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UL): ... this. * normal/menu.c (DISP_UR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_UR): ... this. * normal/menu.c (DISP_LL): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LL): ... this. * normal/menu.c (DISP_LR): Renamed to ... * include/grub/term.h (GRUB_TERM_DISP_LR): ... this. * normal/menu.c (TERM_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_WIDTH): ... this. * normal/menu.c (TERM_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_HEIGHT): ... this. * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this. * normal/menu.c (TERM_MARGIN): Renamed to ... * include/grub/term.h (GRUB_TERM_MARGIN): ... this. * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this. * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this. * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ... * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this. * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this. * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this. * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ... * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this. * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ... * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this. * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ... * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this. * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ... * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this. * normal/menu.c (TERM_CURSOR_X): Renamed to ... * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this. All callers changed. * include/grub/normal.h: New prototype. * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/menu_entry.c. (normal_mod_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. (normal_mod_SOURCES): Likewise. 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org> * include/grub/normal.h (grub_halt_init): New prototype. (grub_halt_fini): Likewise. (grub_reboot_init): Likewise. (grub_reboot_fini): Likewise. * util/grub-emu.c: Include signal.h. (main_env): New global variable. (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot catch C-c. (grub_machine_fini): New function. (main): Call grub_halt_init and grub_reboot_init before grub_main, and grub_reboot_fini and grub_halt_fini after it. Call setjmp with MAIN_ENV to go back afterwards. Call grub_machine_fini right before return. * include/grub/util/misc.h: Include setjmp.h. (main_env): New prototype. * include/grub/kernel.h (grub_machine_fini): New prototype. * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise. * include/grub/i386/pc/console.h (grub_console_fini): Likewise. * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function. * kern/i386/pc/init.c (grub_machine_fini): Likewise. * term/i386/pc/console.c (grub_console_fini): Likewise. * util/i386/pc/misc.c: New file. * conf/i386-pc.rmk (grub_emu_SOURCES): Added util/i386/pc/misc.c, commands/i386/pc/halt.c and commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
(void) grub_getkey ();
}