From: Carles Pina i Estany <carles@pina.cat>
To: grub-devel@gnu.org
Subject: [PATCH] macrofy (multiterm branch)
Date: Thu, 31 Dec 2009 19:31:56 +0100 [thread overview]
Message-ID: <20091231183156.GA25874@pina.cat> (raw)
[-- 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
next reply other threads:[~2009-12-31 18:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-31 18:31 Carles Pina i Estany [this message]
2010-01-01 12:11 ` [PATCH] macrofy (multiterm branch) Robert Millan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091231183156.GA25874@pina.cat \
--to=carles@pina.cat \
--cc=grub-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.