2005-11-09 Hollis Blanchard <hollis@penguinppc.org>
* term/ieee1275/ofconsole.c (grub_ofconsole_width): New variable. (grub_ofconsole_height): Likewise. (grub_ofconsole_putchar): If `grub_curr_x' exceeds console width, manually insert a '\n'. (grub_ofconsole_getwh): Set and return `grub_ofconsole_width' and `grub_ofconsole_height'. Return early if these are already set.
This commit is contained in:
parent
a8fcf2065b
commit
d13ea639a8
2 changed files with 50 additions and 36 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2005-11-09 Hollis Blanchard <hollis@penguinppc.org>
|
||||||
|
|
||||||
|
* term/ieee1275/ofconsole.c (grub_ofconsole_width): New variable.
|
||||||
|
(grub_ofconsole_height): Likewise.
|
||||||
|
(grub_ofconsole_putchar): If `grub_curr_x' exceeds console width,
|
||||||
|
manually insert a '\n'.
|
||||||
|
(grub_ofconsole_getwh): Set and return `grub_ofconsole_width' and
|
||||||
|
`grub_ofconsole_height'. Return early if these are already set.
|
||||||
|
|
||||||
2005-11-07 Vincent Pelletier <subdino2004@yahoo.fr>
|
2005-11-07 Vincent Pelletier <subdino2004@yahoo.fr>
|
||||||
|
|
||||||
* conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Add
|
* conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Add
|
||||||
|
|
|
@ -28,6 +28,9 @@
|
||||||
static grub_ieee1275_ihandle_t stdout_ihandle;
|
static grub_ieee1275_ihandle_t stdout_ihandle;
|
||||||
static grub_ieee1275_ihandle_t stdin_ihandle;
|
static grub_ieee1275_ihandle_t stdin_ihandle;
|
||||||
|
|
||||||
|
static grub_uint8_t grub_ofconsole_width;
|
||||||
|
static grub_uint8_t grub_ofconsole_height;
|
||||||
|
|
||||||
static int grub_curr_x;
|
static int grub_curr_x;
|
||||||
static int grub_curr_y;
|
static int grub_curr_y;
|
||||||
|
|
||||||
|
@ -79,7 +82,11 @@ grub_ofconsole_putchar (grub_uint32_t c)
|
||||||
grub_curr_x = 0;
|
grub_curr_x = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
grub_curr_x++;
|
{
|
||||||
|
grub_curr_x++;
|
||||||
|
if (grub_curr_x > grub_ofconsole_width)
|
||||||
|
grub_putcode ('\n');
|
||||||
|
}
|
||||||
grub_ieee1275_write (stdout_ihandle, &chr, 1, 0);
|
grub_ieee1275_write (stdout_ihandle, &chr, 1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -220,50 +227,48 @@ grub_ofconsole_getwh (void)
|
||||||
grub_ieee1275_ihandle_t options;
|
grub_ieee1275_ihandle_t options;
|
||||||
char *val;
|
char *val;
|
||||||
grub_ssize_t lval;
|
grub_ssize_t lval;
|
||||||
static grub_uint8_t w, h;
|
|
||||||
|
|
||||||
/* Once we have them, don't ask them again. */
|
if (grub_ofconsole_width && grub_ofconsole_height)
|
||||||
if (!w || !h)
|
return (grub_ofconsole_width << 8) | grub_ofconsole_height;
|
||||||
|
|
||||||
|
if (! grub_ieee1275_finddevice ("/options", &options)
|
||||||
|
&& options != (grub_ieee1275_ihandle_t) -1)
|
||||||
{
|
{
|
||||||
if (! grub_ieee1275_finddevice ("/options", &options)
|
if (! grub_ieee1275_get_property_length (options, "screen-#columns",
|
||||||
&& options != (grub_ieee1275_ihandle_t) -1)
|
&lval) && lval != -1)
|
||||||
{
|
{
|
||||||
if (! grub_ieee1275_get_property_length (options, "screen-#columns",
|
val = grub_malloc (lval);
|
||||||
&lval) && lval != -1)
|
if (val)
|
||||||
{
|
{
|
||||||
val = grub_malloc (lval);
|
if (! grub_ieee1275_get_property (options, "screen-#columns",
|
||||||
if (val)
|
val, lval, 0))
|
||||||
{
|
grub_ofconsole_width = (grub_uint8_t) grub_strtoul (val, 0, 10);
|
||||||
if (! grub_ieee1275_get_property (options, "screen-#columns",
|
|
||||||
val, lval, 0))
|
|
||||||
w = (grub_uint8_t) grub_strtoul (val, 0, 10);
|
|
||||||
|
|
||||||
grub_free (val);
|
grub_free (val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (! grub_ieee1275_get_property_length (options, "screen-#rows",
|
if (! grub_ieee1275_get_property_length (options, "screen-#rows",
|
||||||
&lval) && lval != -1)
|
&lval) && lval != -1)
|
||||||
{
|
{
|
||||||
val = grub_malloc (lval);
|
val = grub_malloc (lval);
|
||||||
if (val)
|
if (val)
|
||||||
{
|
{
|
||||||
if (! grub_ieee1275_get_property (options, "screen-#rows",
|
if (! grub_ieee1275_get_property (options, "screen-#rows",
|
||||||
val, lval, 0))
|
val, lval, 0))
|
||||||
h = (grub_uint8_t) grub_strtoul (val, 0, 10);
|
grub_ofconsole_height = (grub_uint8_t) grub_strtoul (val, 0, 10);
|
||||||
|
|
||||||
grub_free (val);
|
grub_free (val);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Use a small console by default. */
|
/* Use a small console by default. */
|
||||||
if (! w)
|
if (! grub_ofconsole_width)
|
||||||
w = 80;
|
grub_ofconsole_width = 80;
|
||||||
if (! h)
|
if (! grub_ofconsole_height)
|
||||||
h = 24;
|
grub_ofconsole_height = 24;
|
||||||
|
|
||||||
return (w << 8) | h;
|
return (grub_ofconsole_width << 8) | grub_ofconsole_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue