#include <grub/err.h>
#include <grub/types.h>
+#include <grub/term.h>
char *grub_terminfo_get_current (void);
grub_err_t grub_terminfo_set_current (const char *);
-void grub_terminfo_gotoxy (grub_uint8_t x, grub_uint8_t y);
-void grub_terminfo_cls (void);
-void grub_terminfo_reverse_video_on (void);
-void grub_terminfo_reverse_video_off (void);
-void grub_terminfo_cursor_on (void);
-void grub_terminfo_cursor_off (void);
+void grub_terminfo_gotoxy (grub_uint8_t x, grub_uint8_t y,
+ grub_term_output_t oterm);
+void grub_terminfo_cls (grub_term_output_t oterm);
+void grub_terminfo_reverse_video_on (grub_term_output_t oterm);
+void grub_terminfo_reverse_video_off (grub_term_output_t oterm);
+void grub_terminfo_cursor_on (grub_term_output_t oterm);
+void grub_terminfo_cursor_off (grub_term_output_t oterm);
#endif /* ! GRUB_TERMINFO_HEADER */
#define TEXT_WIDTH 80
#define TEXT_HEIGHT 25
+static struct grub_term_output grub_serial_term_output;
static unsigned int xpos, ypos;
static unsigned int keep_track = 1;
static unsigned int registered = 0;
else
{
keep_track = 0;
- grub_terminfo_gotoxy (x, y);
+ grub_terminfo_gotoxy (x, y, &grub_serial_term_output);
keep_track = 1;
xpos = x;
grub_serial_cls (void)
{
keep_track = 0;
- grub_terminfo_cls ();
+ grub_terminfo_cls (&grub_serial_term_output);
keep_track = 1;
xpos = ypos = 0;
{
case GRUB_TERM_COLOR_STANDARD:
case GRUB_TERM_COLOR_NORMAL:
- grub_terminfo_reverse_video_off ();
+ grub_terminfo_reverse_video_off (&grub_serial_term_output);
break;
case GRUB_TERM_COLOR_HIGHLIGHT:
- grub_terminfo_reverse_video_on ();
+ grub_terminfo_reverse_video_on (&grub_serial_term_output);
break;
default:
break;
grub_serial_setcursor (const int on)
{
if (on)
- grub_terminfo_cursor_on ();
+ grub_terminfo_cursor_on (&grub_serial_term_output);
else
- grub_terminfo_cursor_off ();
+ grub_terminfo_cursor_off (&grub_serial_term_output);
}
static struct grub_term_input grub_serial_term_input =
/* Wrapper for grub_putchar to write strings. */
static void
-putstr (const char *str)
+putstr (const char *str, grub_term_output_t oterm)
{
while (*str)
- grub_putchar (*str++);
+ grub_putcode (*str++, oterm);
}
/* Move the cursor to the given position starting with "0". */
void
-grub_terminfo_gotoxy (grub_uint8_t x, grub_uint8_t y)
+grub_terminfo_gotoxy (grub_uint8_t x, grub_uint8_t y, grub_term_output_t oterm)
{
- putstr (grub_terminfo_tparm (term.gotoxy, y, x));
+ putstr (grub_terminfo_tparm (term.gotoxy, y, x), oterm);
}
/* Clear the screen. */
void
-grub_terminfo_cls (void)
+grub_terminfo_cls (grub_term_output_t oterm)
{
- putstr (grub_terminfo_tparm (term.cls));
+ putstr (grub_terminfo_tparm (term.cls), oterm);
}
/* Set reverse video mode on. */
void
-grub_terminfo_reverse_video_on (void)
+grub_terminfo_reverse_video_on (grub_term_output_t oterm)
{
- putstr (grub_terminfo_tparm (term.reverse_video_on));
+ putstr (grub_terminfo_tparm (term.reverse_video_on), oterm);
}
/* Set reverse video mode off. */
void
-grub_terminfo_reverse_video_off (void)
+grub_terminfo_reverse_video_off (grub_term_output_t oterm)
{
- putstr (grub_terminfo_tparm (term.reverse_video_off));
+ putstr (grub_terminfo_tparm (term.reverse_video_off), oterm);
}
/* Show cursor. */
void
-grub_terminfo_cursor_on (void)
+grub_terminfo_cursor_on (grub_term_output_t oterm)
{
- putstr (grub_terminfo_tparm (term.cursor_on));
+ putstr (grub_terminfo_tparm (term.cursor_on), oterm);
}
/* Hide cursor. */
void
-grub_terminfo_cursor_off (void)
+grub_terminfo_cursor_off (grub_term_output_t oterm)
{
- putstr (grub_terminfo_tparm (term.cursor_off));
+ putstr (grub_terminfo_tparm (term.cursor_off), oterm);
}
/* GRUB Command. */