Core changes hopefully finished
This commit is contained in:
parent
e48625a306
commit
2e71383172
23 changed files with 1493 additions and 947 deletions
13
kern/misc.c
13
kern/misc.c
|
@ -882,10 +882,10 @@ grub_sprintf (char *str, const char *fmt, ...)
|
|||
/* Convert a (possibly null-terminated) UTF-8 string of at most SRCSIZE
|
||||
bytes (if SRCSIZE is -1, it is ignored) in length to a UCS-4 string.
|
||||
Return the number of characters converted. DEST must be able to hold
|
||||
at least DESTSIZE characters. If an invalid sequence is found, return -1.
|
||||
at least DESTSIZE characters.
|
||||
If SRCEND is not NULL, then *SRCEND is set to the next byte after the
|
||||
last byte used in SRC. */
|
||||
grub_ssize_t
|
||||
grub_size_t
|
||||
grub_utf8_to_ucs4 (grub_uint32_t *dest, grub_size_t destsize,
|
||||
const grub_uint8_t *src, grub_size_t srcsize,
|
||||
const grub_uint8_t **srcend)
|
||||
|
@ -907,7 +907,8 @@ grub_utf8_to_ucs4 (grub_uint32_t *dest, grub_size_t destsize,
|
|||
if ((c & 0xc0) != 0x80)
|
||||
{
|
||||
/* invalid */
|
||||
return -1;
|
||||
code = '?';
|
||||
count = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -949,7 +950,11 @@ grub_utf8_to_ucs4 (grub_uint32_t *dest, grub_size_t destsize,
|
|||
code = c & 0x01;
|
||||
}
|
||||
else
|
||||
return -1;
|
||||
{
|
||||
/* invalid */
|
||||
code = '?';
|
||||
count = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (count == 0)
|
||||
|
|
25
kern/term.c
25
kern/term.c
|
@ -31,13 +31,15 @@ struct grub_handler_class grub_term_input_class =
|
|||
|
||||
struct grub_term_output *grub_term_outputs;
|
||||
|
||||
void (*grub_newline_hook) (void) = NULL;
|
||||
|
||||
/* Put a Unicode character. */
|
||||
void
|
||||
grub_putcode (grub_uint32_t code, struct grub_term_output *term)
|
||||
{
|
||||
int height;
|
||||
|
||||
height = term->getwh () & 255;
|
||||
height = grub_term_height (term);
|
||||
|
||||
if (code == '\t' && term->getxy)
|
||||
{
|
||||
|
@ -50,6 +52,8 @@ grub_putcode (grub_uint32_t code, struct grub_term_output *term)
|
|||
return;
|
||||
}
|
||||
|
||||
if (code == '\n')
|
||||
(term->putchar) ('\r');
|
||||
(term->putchar) (code);
|
||||
}
|
||||
|
||||
|
@ -68,7 +72,7 @@ grub_putchar (int c)
|
|||
{
|
||||
struct grub_term_output *term = (struct grub_term_output *) item;
|
||||
|
||||
if (term->flags & GRUB_TERM_ACTIVE)
|
||||
if (grub_term_is_active (term))
|
||||
grub_putcode (code, term);
|
||||
|
||||
return 0;
|
||||
|
@ -77,14 +81,13 @@ grub_putchar (int c)
|
|||
buf[size++] = c;
|
||||
ret = grub_utf8_to_ucs4 (&code, 1, buf, size, 0);
|
||||
|
||||
if (ret < 0)
|
||||
code = '?';
|
||||
|
||||
if (ret != 0)
|
||||
{
|
||||
size = 0;
|
||||
grub_list_iterate (GRUB_AS_LIST (grub_term_outputs), do_putcode);
|
||||
}
|
||||
if (ret == '\n' && grub_newline_hook)
|
||||
grub_newline_hook ();
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -116,7 +119,7 @@ grub_cls (void)
|
|||
{
|
||||
struct grub_term_output *term = (struct grub_term_output *) item;
|
||||
|
||||
if (!(term->flags & GRUB_TERM_ACTIVE))
|
||||
if (! grub_term_is_active (term))
|
||||
return 0;
|
||||
|
||||
if ((term->flags & GRUB_TERM_DUMB) || (grub_env_get ("debug")))
|
||||
|
@ -141,11 +144,10 @@ grub_setcolorstate (grub_term_color_state state)
|
|||
{
|
||||
struct grub_term_output *term = (struct grub_term_output *) item;
|
||||
|
||||
if (!(term->flags & GRUB_TERM_ACTIVE))
|
||||
if (! grub_term_is_active (term))
|
||||
return 0;
|
||||
|
||||
if (term->setcolorstate)
|
||||
(term->setcolorstate) (state);
|
||||
grub_term_setcolorstate (term, state);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -161,11 +163,10 @@ grub_refresh (void)
|
|||
{
|
||||
struct grub_term_output *term = (struct grub_term_output *) item;
|
||||
|
||||
if (!(term->flags & GRUB_TERM_ACTIVE))
|
||||
if (!grub_term_is_active (term))
|
||||
return 0;
|
||||
|
||||
if (term->refresh)
|
||||
(term->refresh) ();
|
||||
grub_term_refresh (term);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue