Inline setcolorstate and move grub_Cls out of kernel.img
This commit is contained in:
parent
a68c419413
commit
919e37b0ac
5 changed files with 45 additions and 43 deletions
|
@ -336,19 +336,8 @@ grub_mini_cmd_exit (struct grub_command *cmd __attribute__ ((unused)),
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* clear */
|
|
||||||
static grub_err_t
|
|
||||||
grub_mini_cmd_clear (struct grub_command *cmd __attribute__ ((unused)),
|
|
||||||
int argc __attribute__ ((unused)),
|
|
||||||
char *argv[] __attribute__ ((unused)))
|
|
||||||
{
|
|
||||||
grub_cls ();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_command_t cmd_cat, cmd_help, cmd_root;
|
static grub_command_t cmd_cat, cmd_help, cmd_root;
|
||||||
static grub_command_t cmd_dump, cmd_rmmod, cmd_lsmod, cmd_exit;
|
static grub_command_t cmd_dump, cmd_rmmod, cmd_lsmod, cmd_exit;
|
||||||
static grub_command_t cmd_clear;
|
|
||||||
|
|
||||||
GRUB_MOD_INIT(minicmd)
|
GRUB_MOD_INIT(minicmd)
|
||||||
{
|
{
|
||||||
|
@ -373,9 +362,6 @@ GRUB_MOD_INIT(minicmd)
|
||||||
cmd_exit =
|
cmd_exit =
|
||||||
grub_register_command ("exit", grub_mini_cmd_exit,
|
grub_register_command ("exit", grub_mini_cmd_exit,
|
||||||
0, N_("Exit from GRUB."));
|
0, N_("Exit from GRUB."));
|
||||||
cmd_clear =
|
|
||||||
grub_register_command ("clear", grub_mini_cmd_clear,
|
|
||||||
0, N_("Clear the screen."));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(minicmd)
|
GRUB_MOD_FINI(minicmd)
|
||||||
|
@ -387,5 +373,4 @@ GRUB_MOD_FINI(minicmd)
|
||||||
grub_unregister_command (cmd_rmmod);
|
grub_unregister_command (cmd_rmmod);
|
||||||
grub_unregister_command (cmd_lsmod);
|
grub_unregister_command (cmd_lsmod);
|
||||||
grub_unregister_command (cmd_exit);
|
grub_unregister_command (cmd_exit);
|
||||||
grub_unregister_command (cmd_clear);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -263,8 +263,7 @@ void grub_putcode (grub_uint32_t code, struct grub_term_output *term);
|
||||||
int EXPORT_FUNC(grub_getkey) (void);
|
int EXPORT_FUNC(grub_getkey) (void);
|
||||||
int EXPORT_FUNC(grub_checkkey) (void);
|
int EXPORT_FUNC(grub_checkkey) (void);
|
||||||
int EXPORT_FUNC(grub_getkeystatus) (void);
|
int EXPORT_FUNC(grub_getkeystatus) (void);
|
||||||
void EXPORT_FUNC(grub_cls) (void);
|
void grub_cls (void);
|
||||||
void EXPORT_FUNC(grub_setcolorstate) (grub_term_color_state state);
|
|
||||||
void EXPORT_FUNC(grub_refresh) (void);
|
void EXPORT_FUNC(grub_refresh) (void);
|
||||||
void grub_puts_terminal (const char *str, struct grub_term_output *term);
|
void grub_puts_terminal (const char *str, struct grub_term_output *term);
|
||||||
grub_uint16_t *grub_term_save_pos (void);
|
grub_uint16_t *grub_term_save_pos (void);
|
||||||
|
@ -345,6 +344,15 @@ grub_term_setcolorstate (struct grub_term_output *term,
|
||||||
term->setcolorstate (term, state);
|
term->setcolorstate (term, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
grub_setcolorstate (grub_term_color_state state)
|
||||||
|
{
|
||||||
|
struct grub_term_output *term;
|
||||||
|
|
||||||
|
FOR_ACTIVE_TERM_OUTPUTS(term)
|
||||||
|
grub_term_setcolorstate (term, state);
|
||||||
|
}
|
||||||
|
|
||||||
/* Set the normal color and the highlight color. The format of each
|
/* Set the normal color and the highlight color. The format of each
|
||||||
color is VGA's. */
|
color is VGA's. */
|
||||||
static inline void
|
static inline void
|
||||||
|
|
26
kern/term.c
26
kern/term.c
|
@ -126,32 +126,6 @@ grub_getkeystatus (void)
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
grub_cls (void)
|
|
||||||
{
|
|
||||||
struct grub_term_output *term;
|
|
||||||
|
|
||||||
FOR_ACTIVE_TERM_OUTPUTS(term)
|
|
||||||
{
|
|
||||||
if ((term->flags & GRUB_TERM_DUMB) || (grub_env_get ("debug")))
|
|
||||||
{
|
|
||||||
grub_putcode_dumb ('\n', term);
|
|
||||||
grub_term_refresh (term);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
(term->cls) (term);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
grub_setcolorstate (grub_term_color_state state)
|
|
||||||
{
|
|
||||||
struct grub_term_output *term;
|
|
||||||
|
|
||||||
FOR_ACTIVE_TERM_OUTPUTS(term)
|
|
||||||
grub_term_setcolorstate (term, state);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
grub_refresh (void)
|
grub_refresh (void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -692,6 +692,18 @@ grub_env_write_pager (struct grub_env_var *var __attribute__ ((unused)),
|
||||||
return grub_strdup (val);
|
return grub_strdup (val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* clear */
|
||||||
|
static grub_err_t
|
||||||
|
grub_mini_cmd_clear (struct grub_command *cmd __attribute__ ((unused)),
|
||||||
|
int argc __attribute__ ((unused)),
|
||||||
|
char *argv[] __attribute__ ((unused)))
|
||||||
|
{
|
||||||
|
grub_cls ();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static grub_command_t cmd_clear;
|
||||||
|
|
||||||
static void (*grub_xputs_saved) (const char *str);
|
static void (*grub_xputs_saved) (const char *str);
|
||||||
|
|
||||||
GRUB_MOD_INIT(normal)
|
GRUB_MOD_INIT(normal)
|
||||||
|
@ -705,6 +717,10 @@ GRUB_MOD_INIT(normal)
|
||||||
if (mod)
|
if (mod)
|
||||||
grub_dl_ref (mod);
|
grub_dl_ref (mod);
|
||||||
|
|
||||||
|
cmd_clear =
|
||||||
|
grub_register_command ("clear", grub_mini_cmd_clear,
|
||||||
|
0, N_("Clear the screen."));
|
||||||
|
|
||||||
grub_set_history (GRUB_DEFAULT_HISTORY_SIZE);
|
grub_set_history (GRUB_DEFAULT_HISTORY_SIZE);
|
||||||
|
|
||||||
grub_register_variable_hook ("pager", 0, grub_env_write_pager);
|
grub_register_variable_hook ("pager", 0, grub_env_write_pager);
|
||||||
|
@ -734,4 +750,6 @@ GRUB_MOD_FINI(normal)
|
||||||
grub_register_variable_hook ("pager", 0, 0);
|
grub_register_variable_hook ("pager", 0, 0);
|
||||||
grub_fs_autoload_hook = 0;
|
grub_fs_autoload_hook = 0;
|
||||||
free_handler_list ();
|
free_handler_list ();
|
||||||
|
|
||||||
|
grub_unregister_command (cmd_clear);
|
||||||
}
|
}
|
||||||
|
|
|
@ -774,3 +774,20 @@ grub_xputs_normal (const char *str)
|
||||||
}
|
}
|
||||||
grub_free (unicode_str);
|
grub_free (unicode_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
grub_cls (void)
|
||||||
|
{
|
||||||
|
struct grub_term_output *term;
|
||||||
|
|
||||||
|
FOR_ACTIVE_TERM_OUTPUTS(term)
|
||||||
|
{
|
||||||
|
if ((term->flags & GRUB_TERM_DUMB) || (grub_env_get ("debug")))
|
||||||
|
{
|
||||||
|
grub_putcode ('\n', term);
|
||||||
|
grub_term_refresh (term);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
(term->cls) (term);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue