macrofy (multiterm branch)
PATCH 1/1 macrofy (multiterm branch)
Hi,
Find an attached patch to macrofy pos >> 8 and pos & 0xff in multiter. In my opinion should be macrofied, it's more clear.
Signature · 2 lines
Carles Pina i Estany http://pinux.info
=== modified file 'include/grub/term.h'
grub/term.h +2 -0
@@ -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'
i386/efi/linux.c +4 -4
@@ -700,8 +700,8 @@ grub_cmd_linux (grub_command_t cmd __attif (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 __attif (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'
i386/ieee1275/linux.c +4 -4
@@ -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'
i386/linux.c +4 -4
@@ -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'
menu_entry.c +2 -2
@@ -1098,7 +1098,7 @@ complete (struct screen *screen, int conif (*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_screegrub_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'
efi/console.c +1 -1
@@ -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'
i386/pc/vga.c +2 -2
@@ -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'
i386/pc/vga_text.c +2 -2
@@ -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
Quoted 5 lines · Carles Pina i Estany
Hi,
Find an attached patch to macrofy pos >> 8 and pos &
0xffin multiter. In my opinion should be macrofied, it's more clear.
Agreed.
grub/term.h line 36
Quoted 9 lines
=== modified file '
include/grub/term.h'grub/term.h +2
-0@@ -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.
Signature · 3 lines
Robert Millan "Be the change you want to see in the world" -- Gandhi