* [PATCH] macrofy (multiterm branch)
@ 2009-12-31 18:31 Carles Pina i Estany
2010-01-01 12:11 ` Robert Millan
0 siblings, 1 reply; 2+ messages in thread
From: Carles Pina i Estany @ 2009-12-31 18:31 UTC (permalink / raw)
To: grub-devel
[-- Attachment #1: Type: text/plain, Size: 174 bytes --]
Hi,
Find an attached patch to macrofy pos >> 8 and pos & 0xff in multiter.
In my opinion should be macrofied, it's more clear.
--
Carles Pina i Estany
http://pinux.info
[-- Attachment #2: macrofy.patch --]
[-- Type: text/x-diff, Size: 5490 bytes --]
=== modified file 'include/grub/term.h'
--- include/grub/term.h 2009-12-25 02:37:20 +0000
+++ include/grub/term.h 2009-12-30 18:17:55 +0000
@@ -32,6 +32,8 @@
#define GRUB_TERM_ESC '\e'
#define GRUB_TERM_TAB '\t'
#define GRUB_TERM_BACKSPACE 8
+#define GETX(XY) (XY >> 8)
+#define GETY(XY) (XY & 0xff)
#ifndef ASM_FILE
=== modified file 'loader/i386/efi/linux.c'
--- loader/i386/efi/linux.c 2009-12-26 21:16:14 +0000
+++ loader/i386/efi/linux.c 2009-12-30 18:19:32 +0000
@@ -700,8 +700,8 @@ grub_cmd_linux (grub_command_t cmd __att
if (grub_strcmp (term->name, "vga_text") == 0)
{
grub_uint16_t pos = grub_term_getxy (term);
- params->video_cursor_x = pos >> 8;
- params->video_cursor_y = pos & 0xff;
+ params->video_cursor_x = GETX (pos);
+ params->video_cursor_y = GETY (pos);
params->video_width = grub_term_width (term);
params->video_height = grub_term_height (term);
found = 1;
@@ -711,8 +711,8 @@ grub_cmd_linux (grub_command_t cmd __att
if (grub_strcmp (term->name, "console") == 0)
{
grub_uint16_t pos = grub_term_getxy (term);
- params->video_cursor_x = pos >> 8;
- params->video_cursor_y = pos & 0xff;
+ params->video_cursor_x = GETX (pos);
+ params->video_cursor_y = GETY (pos);
params->video_width = grub_term_width (term);
params->video_height = grub_term_height (term);
found = 1;
=== modified file 'loader/i386/ieee1275/linux.c'
--- loader/i386/ieee1275/linux.c 2009-12-28 21:06:30 +0000
+++ loader/i386/ieee1275/linux.c 2009-12-30 18:20:17 +0000
@@ -116,8 +116,8 @@ grub_linux_boot (void)
if (grub_strcmp (term->name, "vga_text") == 0)
{
grub_uint16_t pos = grub_term_getxy (term);
- params->video_cursor_x = pos >> 8;
- params->video_cursor_y = pos & 0xff;
+ params->video_cursor_x = GETX (pos);
+ params->video_cursor_y = GETY (pos);
params->video_width = grub_term_width (term);
params->video_height = grub_term_height (term);
found = 1;
@@ -127,8 +127,8 @@ grub_linux_boot (void)
if (grub_strcmp (term->name, "console") == 0)
{
grub_uint16_t pos = grub_term_getxy (term);
- params->video_cursor_x = pos >> 8;
- params->video_cursor_y = pos & 0xff;
+ params->video_cursor_x = GETX (pos);
+ params->video_cursor_y = GETY (pos);
params->video_width = grub_term_width (term);
params->video_height = grub_term_height (term);
found = 1;
=== modified file 'loader/i386/linux.c'
--- loader/i386/linux.c 2009-12-24 23:07:52 +0000
+++ loader/i386/linux.c 2009-12-30 18:18:24 +0000
@@ -554,8 +554,8 @@ grub_linux_boot (void)
if (grub_strcmp (term->name, "vga_text") == 0)
{
grub_uint16_t pos = grub_term_getxy (term);
- params->video_cursor_x = pos >> 8;
- params->video_cursor_y = pos & 0xff;
+ params->video_cursor_x = GETX (pos);
+ params->video_cursor_y = GETY (pos);
found = 1;
}
if (!found)
@@ -563,8 +563,8 @@ grub_linux_boot (void)
if (grub_strcmp (term->name, "console") == 0)
{
grub_uint16_t pos = grub_term_getxy (term);
- params->video_cursor_x = pos >> 8;
- params->video_cursor_y = pos & 0xff;
+ params->video_cursor_x = GETX (pos);
+ params->video_cursor_y = GETY (pos);
found = 1;
}
if (!found)
=== modified file 'normal/menu_entry.c'
--- normal/menu_entry.c 2009-12-25 15:28:31 +0000
+++ normal/menu_entry.c 2009-12-30 18:19:09 +0000
@@ -1098,7 +1098,7 @@ complete (struct screen *screen, int con
if (*p)
grub_putcode (GRUB_TERM_DISP_RIGHT, screen->terms[i].term);
- grub_term_gotoxy (screen->terms[i].term, pos >> 8, pos & 0xFF);
+ grub_term_gotoxy (screen->terms[i].term, GETX (pos), GETY (pos));
}
if (insert)
@@ -1132,7 +1132,7 @@ clear_completions (struct per_term_scree
grub_putcode ('\n', term_screen->term);
}
- grub_term_gotoxy (term_screen->term, pos >> 8, pos & 0xFF);
+ grub_term_gotoxy (term_screen->term, GETX (pos), GETY (pos));
grub_term_refresh (term_screen->term);
}
=== modified file 'term/efi/console.c'
--- term/efi/console.c 2009-12-24 23:13:03 +0000
+++ term/efi/console.c 2009-12-30 18:19:46 +0000
@@ -137,7 +137,7 @@ grub_console_checkkey (void)
grub_printf ("scan_code=%x,unicode_char=%x ",
(unsigned) key.scan_code,
(unsigned) key.unicode_char);
- grub_gotoxy (xy >> 8, xy & 0xff);
+ grub_gotoxy (GETX(xy), GETY(xy));
}
break;
=== modified file 'term/i386/pc/vga.c'
--- term/i386/pc/vga.c 2009-06-10 21:04:23 +0000
+++ term/i386/pc/vga.c 2009-12-30 18:27:04 +0000
@@ -379,8 +379,8 @@ grub_vga_putchar (grub_uint32_t c)
show = 0;
grub_gotoxy (0, 0);
- grub_printf ("[%u:%u]", (unsigned) (pos >> 8), (unsigned) (pos & 0xff));
- grub_gotoxy (pos >> 8, pos & 0xff);
+ grub_printf ("[%u:%u]", (unsigned) (GETX (pos)), (unsigned) (GETY (pos));
+ grub_gotoxy (GETX (pos), GETY (pos));
show = 1;
}
#endif
=== modified file 'term/i386/pc/vga_text.c'
--- term/i386/pc/vga_text.c 2009-12-24 23:13:03 +0000
+++ term/i386/pc/vga_text.c 2009-12-30 18:18:40 +0000
@@ -54,9 +54,9 @@ update_cursor (void)
{
unsigned int pos = grub_curr_y * COLS + grub_curr_x;
grub_outb (CRTC_CURSOR_ADDR_HIGH, CRTC_ADDR_PORT);
- grub_outb (pos >> 8, CRTC_DATA_PORT);
+ grub_outb (GETX (pos), CRTC_DATA_PORT);
grub_outb (CRTC_CURSOR_ADDR_LOW, CRTC_ADDR_PORT);
- grub_outb (pos & 0xFF, CRTC_DATA_PORT);
+ grub_outb (GETY (pos), CRTC_DATA_PORT);
}
static void
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] macrofy (multiterm branch)
2009-12-31 18:31 [PATCH] macrofy (multiterm branch) Carles Pina i Estany
@ 2010-01-01 12:11 ` Robert Millan
0 siblings, 0 replies; 2+ messages in thread
From: Robert Millan @ 2010-01-01 12:11 UTC (permalink / raw)
To: The development of GNU GRUB
On Thu, Dec 31, 2009 at 07:31:56PM +0100, Carles Pina i Estany wrote:
>
> Hi,
>
> Find an attached patch to macrofy pos >> 8 and pos & 0xff in multiter.
> In my opinion should be macrofied, it's more clear.
Agreed.
> === modified file 'include/grub/term.h'
> --- include/grub/term.h 2009-12-25 02:37:20 +0000
> +++ include/grub/term.h 2009-12-30 18:17:55 +0000
> @@ -32,6 +32,8 @@
> #define GRUB_TERM_ESC '\e'
> #define GRUB_TERM_TAB '\t'
> #define GRUB_TERM_BACKSPACE 8
> +#define GETX(XY) (XY >> 8)
> +#define GETY(XY) (XY & 0xff)
It should have GRUB_ prefix. Otherwise it can go in.
--
Robert Millan
"Be the change you want to see in the world" -- Gandhi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-01-01 12:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-31 18:31 [PATCH] macrofy (multiterm branch) Carles Pina i Estany
2010-01-01 12:11 ` Robert Millan
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.