This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] Bad formatting in Wide and Wide_Wide Decimal_IO.Put


The parameters Fore, Aft and Exp were not correctly taken into account
when calling Wide and Wide_Wide Text_IO.Decimal_IO.Put (Current_Output).
This patch corrects this.

The output of the program Test_DecIO below should be:

Text_IO:
N=12.0
Wide_Text_IO:
N=12.0
Wide_Wide_Text_IO:
N=12.0

with Ada.Text_IO, Ada.Wide_Text_IO, Ada.Wide_Wide_Text_IO;

procedure Test_DecIO is

   type Num is delta 1.0 digits 3;

   N : constant Num := 12.0;

begin
TIO : declare
      package Dec_Io is new Ada.Text_Io.Decimal_IO (Num);
      use Ada.Text_IO, Dec_Io;
   begin
      Put_Line ("Text_IO:");
      Put ("N="); Dec_IO.Put (N, 2, 0, 0); New_Line;
   end TIO;

WTIO : declare
      package Dec_Io is new Ada.Wide_Text_Io.Decimal_IO (Num);
      use Ada.Wide_Text_IO, Dec_Io;
   begin
      Put_Line ("Wide_Text_IO:");
      Put ("N="); Dec_IO.Put (N, 2, 0, 0); New_Line;
   end WTIO;

WWTIO : declare
      package Dec_Io is new Ada.Wide_Wide_Text_Io.Decimal_IO (Num);
      use Ada.Wide_Wide_Text_IO, Dec_Io;
   begin
      Put_Line ("Wide_Wide_Text_IO:");
      Put ("N="); Dec_IO.Put (N, 2, 0, 0); New_Line;
   end WWTIO;
end Test_DecIO;

Tested on i686-pc-linux-gnu, committed on trunk

2008-08-05  Vincent Celier  <celier@adacore.com>

	* a-wtdeio.adb (Put (Current_Output)): Use Fore in the call to Put
	(File).
	
	* a-ztdeio.adb: Ditto.

Attachment: difs
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]