2005-08-20 Yoshinori K. Okuji <okuji@enbug.org>

* kern/term.c (grub_putchar): Use grub_utf8_to_ucs4 for the
        conversion.
        (grub_getcharwidth): New function.

        * kern/misc.c (grub_utf8_to_ucs4): New function.

        * include/grub/term.h (struct grub_term): Added a new member
        "getcharwidth".
        (grub_getcharwidth): New prototype.

        * include/grub/misc.h (grub_utf8_to_ucs4): New prototype.

        * term/i386/pc/console.c (map_char): New function. Segregated from
        grub_console_putchar.
        (grub_console_putchar): Use map_char.
        (grub_console_getcharwidth): New function.
        (grub_console_term): Specified grub_console_getcharwidth as
        getcharwidth.

        * term/i386/pc/vga.c (grub_vga_getcharwidth): New function.
        (grub_vga_term): Specified grub_vga_getcharwidth as getcharwidth.

        * term/i386/pc/vesafb.c (grub_virtual_screen_setup): Return
        GRUB_ERRNO.
        (grub_vesafb_init): Do not use RC. Instead, use GRUB_ERRNO. Rely
        on grub_strtoul completely.
        (write_char): Declare local variables in the beginning of the
        function.
        (grub_vesafb_getcharwidth): New function.
        (grub_vesafb_term): Specified grub_vesafb_getcharwidth as
        getcharwidth.
This commit is contained in:
okuji 2005-08-20 05:26:51 +00:00
parent 1f0a95e481
commit ef0954341c
8 changed files with 205 additions and 117 deletions

View file

@ -72,6 +72,9 @@ void EXPORT_FUNC(grub_stop) (void) __attribute__ ((noreturn));
grub_uint8_t *EXPORT_FUNC(grub_utf16_to_utf8) (grub_uint8_t *dest,
grub_uint16_t *src,
grub_size_t size);
grub_ssize_t EXPORT_FUNC(grub_utf8_to_ucs4) (grub_uint32_t *dest,
grub_uint8_t *src,
grub_size_t size);
grub_err_t EXPORT_FUNC(grub_split_cmdline) (const char *str,
grub_err_t (* getline) (char **),

View file

@ -135,6 +135,10 @@ struct grub_term
/* Put a character. C is encoded in Unicode. */
void (*putchar) (grub_uint32_t c);
/* Get the number of columns occupied by a given character C. C is
encoded in Unicode. */
grub_ssize_t (*getcharwidth) (grub_uint32_t c);
/* Check if any input character is available. */
int (*checkkey) (void);
@ -184,6 +188,7 @@ grub_term_t EXPORT_FUNC(grub_term_get_current) (void);
void EXPORT_FUNC(grub_putchar) (int c);
void EXPORT_FUNC(grub_putcode) (grub_uint32_t code);
grub_ssize_t EXPORT_FUNC(grub_getcharwidth) (grub_uint32_t code);
int EXPORT_FUNC(grub_getkey) (void);
int EXPORT_FUNC(grub_checkkey) (void);
grub_uint16_t EXPORT_FUNC(grub_getwh) (void);