Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EZLVm-00015F-NQ for mharc-grub-devel@gnu.org; Mon, 07 Nov 2005 23:55:10 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EZLVk-000141-6K for grub-devel@gnu.org; Mon, 07 Nov 2005 23:55:08 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EZLVj-00013N-4P for grub-devel@gnu.org; Mon, 07 Nov 2005 23:55:07 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EZLVi-00013A-RS for grub-devel@gnu.org; Mon, 07 Nov 2005 23:55:06 -0500 Received: from [209.86.89.62] (helo=smtpauth02.mail.atl.earthlink.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EZLVj-0007Jl-1Z for grub-devel@gnu.org; Mon, 07 Nov 2005 23:55:07 -0500 Received: from [63.246.184.80] (helo=[192.168.0.101]) by smtpauth02.mail.atl.earthlink.net with asmtp (Exim 4.34) id 1EZLVi-0006aF-5e for grub-devel@gnu.org; Mon, 07 Nov 2005 23:55:06 -0500 Mime-Version: 1.0 (Apple Message framework v623) To: The development of GRUB 2 Message-Id: <28ec5adc7b401784d274908e3a641565@penguinppc.org> Content-Type: multipart/mixed; boundary=Apple-Mail-4-647165812 From: Hollis Blanchard Date: Mon, 7 Nov 2005 22:55:04 -0600 X-Mailer: Apple Mail (2.623) X-ELNK-Trace: 77a46389d001b1f223bcf3e39c2f8b5f1aa676d7e74259b7b3291a7d08dfec79e12927067f01c2d869f1258553695a16350badd9bab72f9c350badd9bab72f9c X-Originating-IP: 63.246.184.80 Subject: [ppc patch] fix line-wrapping X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Nov 2005 04:55:09 -0000 --Apple-Mail-4-647165812 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed This patch fixes the line-wrapping problems we've been having on PPC. I rearranged grub_ofconsole_getwh() slightly to avoid excessive indentation. I will apply soon unless people criticize my ChangeLog entry. ;) -Hollis --Apple-Mail-4-647165812 Content-Transfer-Encoding: 7bit Content-Type: text/plain; x-unix-mode=0644; name="linewrap.txt" Content-Disposition: attachment; filename=linewrap.txt Index: ChangeLog =================================================================== RCS file: /cvsroot/grub/grub2/ChangeLog,v retrieving revision 1.193 diff -u -p -r1.193 ChangeLog --- ChangeLog 7 Nov 2005 22:28:55 -0000 1.193 +++ ChangeLog 8 Nov 2005 04:50:12 -0000 @@ -1,3 +1,12 @@ +2005-11-03 Hollis Blanchard + + * 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 * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Add Index: term/ieee1275/ofconsole.c =================================================================== RCS file: /cvsroot/grub/grub2/term/ieee1275/ofconsole.c,v retrieving revision 1.7 diff -u -p -r1.7 ofconsole.c --- term/ieee1275/ofconsole.c 4 Nov 2005 04:50:14 -0000 1.7 +++ term/ieee1275/ofconsole.c 8 Nov 2005 04:50:13 -0000 @@ -28,6 +28,9 @@ static grub_ieee1275_ihandle_t stdout_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_y; @@ -79,7 +82,11 @@ grub_ofconsole_putchar (grub_uint32_t c) grub_curr_x = 0; } 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); } @@ -220,50 +227,48 @@ grub_ofconsole_getwh (void) grub_ieee1275_ihandle_t options; char *val; grub_ssize_t lval; - static grub_uint8_t w, h; - /* Once we have them, don't ask them again. */ - if (!w || !h) + if (grub_ofconsole_width && grub_ofconsole_height) + 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) - && options != (grub_ieee1275_ihandle_t) -1) - { - if (! grub_ieee1275_get_property_length (options, "screen-#columns", - &lval) && lval != -1) - { - val = grub_malloc (lval); - if (val) - { - if (! grub_ieee1275_get_property (options, "screen-#columns", - val, lval, 0)) - w = (grub_uint8_t) grub_strtoul (val, 0, 10); - - grub_free (val); - } - } - if (! grub_ieee1275_get_property_length (options, "screen-#rows", - &lval) && lval != -1) - { - val = grub_malloc (lval); - if (val) - { - if (! grub_ieee1275_get_property (options, "screen-#rows", - val, lval, 0)) - h = (grub_uint8_t) grub_strtoul (val, 0, 10); - - grub_free (val); - } - } + if (! grub_ieee1275_get_property_length (options, "screen-#columns", + &lval) && lval != -1) + { + val = grub_malloc (lval); + if (val) + { + if (! grub_ieee1275_get_property (options, "screen-#columns", + val, lval, 0)) + grub_ofconsole_width = (grub_uint8_t) grub_strtoul (val, 0, 10); + + grub_free (val); + } + } + if (! grub_ieee1275_get_property_length (options, "screen-#rows", + &lval) && lval != -1) + { + val = grub_malloc (lval); + if (val) + { + if (! grub_ieee1275_get_property (options, "screen-#rows", + val, lval, 0)) + grub_ofconsole_height = (grub_uint8_t) grub_strtoul (val, 0, 10); + + grub_free (val); + } } } /* Use a small console by default. */ - if (! w) - w = 80; - if (! h) - h = 24; + if (! grub_ofconsole_width) + grub_ofconsole_width = 80; + if (! grub_ofconsole_height) + grub_ofconsole_height = 24; - return (w << 8) | h; + return (grub_ofconsole_width << 8) | grub_ofconsole_height; } static void --Apple-Mail-4-647165812--