[Ada] AI 328

Arnaud Charlet charlet@adacore.com
Wed Feb 15 10:09:00 GMT 2006


Tested on i686-linux, committed on trunk

This patch implements Ada 2005 AI 328 (preinstantiations of Complex_IO)
http://www.ada-auth.org/cgi-bin/cvsweb.cgi/AIs/AI-00328.TXT?rev=1.4
A simple test is:
with Ada.Complex_Text_IO;        use Ada.Complex_Text_IO;
with Ada.Numerics.Complex_Types; use Ada.Numerics.Complex_Types;
procedure P is
   C : Complex := (1.0, 2.0);
begin
   Put (C);
end;

Compiled with -gnat05, this should output:

( 1.00000E+00, 2.00000E+00)

2006-02-13  Robert Dewar  <dewar@adacore.com>

	* a-ticoio.ads, a-ticoio.adb: Add use clause (moved here from spec)

	* a-coteio.ads, a-lcteio.ads, a-llctio.ads, a-scteio.ads: New files.

-------------- next part --------------
Index: a-ticoio.ads
===================================================================
--- a-ticoio.ads	(revision 110833)
+++ a-ticoio.ads	(working copy)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-1997 Free Software Foundation, Inc.          --
+--          Copyright (C) 1992-2005, Free Software Foundation, Inc.         --
 --                                                                          --
 -- This specification is derived from the Ada Reference Manual for use with --
 -- GNAT. The copyright notice above, and the license provisions that follow --
@@ -42,44 +42,42 @@
 
 package Ada.Text_IO.Complex_IO is
 
-   use Complex_Types;
-
    Default_Fore : Field := 2;
-   Default_Aft  : Field := Real'Digits - 1;
+   Default_Aft  : Field := Complex_Types.Real'Digits - 1;
    Default_Exp  : Field := 3;
 
    procedure Get
-     (File  : in  File_Type;
-      Item  : out Complex;
-      Width : in  Field := 0);
+     (File  : File_Type;
+      Item  : out Complex_Types.Complex;
+      Width : Field := 0);
 
    procedure Get
-     (Item  : out Complex;
-      Width : in  Field := 0);
+     (Item  : out Complex_Types.Complex;
+      Width : Field := 0);
 
    procedure Put
-     (File : in File_Type;
-      Item : in Complex;
-      Fore : in Field := Default_Fore;
-      Aft  : in Field := Default_Aft;
-      Exp  : in Field := Default_Exp);
+     (File : File_Type;
+      Item : Complex_Types.Complex;
+      Fore : Field := Default_Fore;
+      Aft  : Field := Default_Aft;
+      Exp  : Field := Default_Exp);
 
    procedure Put
-     (Item : in Complex;
-      Fore : in Field := Default_Fore;
-      Aft  : in Field := Default_Aft;
-      Exp  : in Field := Default_Exp);
+     (Item : Complex_Types.Complex;
+      Fore : Field := Default_Fore;
+      Aft  : Field := Default_Aft;
+      Exp  : Field := Default_Exp);
 
    procedure Get
-     (From : in  String;
-      Item : out Complex;
+     (From : String;
+      Item : out Complex_Types.Complex;
       Last : out Positive);
 
    procedure Put
      (To   : out String;
-      Item : in  Complex;
-      Aft  : in  Field := Default_Aft;
-      Exp  : in  Field := Default_Exp);
+      Item : Complex_Types.Complex;
+      Aft  : Field := Default_Aft;
+      Exp  : Field := Default_Exp);
 
 private
    pragma Inline (Get);
Index: a-ticoio.adb
===================================================================
--- a-ticoio.adb	(revision 110833)
+++ a-ticoio.adb	(working copy)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2005, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2006, Free Software Foundation, Inc.         --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -37,6 +37,8 @@
 
 package body Ada.Text_IO.Complex_IO is
 
+   use Complex_Types;
+
    package Aux renames Ada.Text_IO.Complex_Aux;
 
    subtype LLF is Long_Long_Float;
@@ -47,12 +49,12 @@
    ---------
 
    procedure Get
-     (File  : in  File_Type;
+     (File  : File_Type;
       Item  : out Complex_Types.Complex;
-      Width : in  Field := 0)
+      Width : Field := 0)
    is
-      Real_Item  : Real'Base;
-      Imag_Item  : Real'Base;
+      Real_Item : Real'Base;
+      Imag_Item : Real'Base;
 
    begin
       Aux.Get (File, LLF (Real_Item), LLF (Imag_Item), Width);
@@ -68,7 +70,7 @@
 
    procedure Get
      (Item  : out Complex_Types.Complex;
-      Width : in  Field := 0)
+      Width : Field := 0)
    is
    begin
       Get (Current_In, Item, Width);
@@ -79,7 +81,7 @@
    ---------
 
    procedure Get
-     (From : in  String;
+     (From : String;
       Item : out Complex_Types.Complex;
       Last : out Positive)
    is
@@ -99,11 +101,11 @@
    ---------
 
    procedure Put
-     (File : in File_Type;
-      Item : in Complex_Types.Complex;
-      Fore : in Field := Default_Fore;
-      Aft  : in Field := Default_Aft;
-      Exp  : in Field := Default_Exp)
+     (File : File_Type;
+      Item : Complex_Types.Complex;
+      Fore : Field := Default_Fore;
+      Aft  : Field := Default_Aft;
+      Exp  : Field := Default_Exp)
    is
    begin
       Aux.Put (File, LLF (Re (Item)), LLF (Im (Item)), Fore, Aft, Exp);
@@ -114,10 +116,10 @@
    ---------
 
    procedure Put
-     (Item : in Complex_Types.Complex;
-      Fore : in Field := Default_Fore;
-      Aft  : in Field := Default_Aft;
-      Exp  : in Field := Default_Exp)
+     (Item : Complex_Types.Complex;
+      Fore : Field := Default_Fore;
+      Aft  : Field := Default_Aft;
+      Exp  : Field := Default_Exp)
    is
    begin
       Put (Current_Out, Item, Fore, Aft, Exp);
@@ -129,9 +131,9 @@
 
    procedure Put
      (To   : out String;
-      Item : in  Complex_Types.Complex;
-      Aft  : in  Field := Default_Aft;
-      Exp  : in  Field := Default_Exp)
+      Item : Complex_Types.Complex;
+      Aft  : Field := Default_Aft;
+      Exp  : Field := Default_Exp)
    is
    begin
       Aux.Puts (To, LLF (Re (Item)), LLF (Im (Item)), Aft, Exp);
Index: a-coteio.ads
===================================================================
--- a-coteio.ads	(revision 0)
+++ a-coteio.ads	(revision 0)
@@ -0,0 +1,24 @@
+------------------------------------------------------------------------------
+--                                                                          --
+--                         GNAT RUN-TIME COMPONENTS                         --
+--                                                                          --
+--                   A D A . C O M P L E X _ T E X T _ I O                  --
+--                                                                          --
+--                                 S p e c                                  --
+--                                                                          --
+-- This specification is adapted from the Ada Reference Manual for use with --
+-- GNAT.  In accordance with the copyright of that document, you can freely --
+-- copy and modify this specification,  provided that if you redistribute a --
+-- modified version,  any changes that you have made are clearly indicated. --
+--                                                                          --
+------------------------------------------------------------------------------
+
+--  Ada 2005 AI-328
+
+with Ada.Text_IO.Complex_IO;
+with Ada.Numerics.Complex_Types;
+
+pragma Elaborate_All (Ada.Text_IO.Complex_IO);
+
+package Ada.Complex_Text_IO is
+  new Ada.Text_IO.Complex_IO (Ada.Numerics.Complex_Types);

Property changes on: a-coteio.ads
___________________________________________________________________
Name: svn:executable
   + *

Index: a-lcteio.ads
===================================================================
--- a-lcteio.ads	(revision 0)
+++ a-lcteio.ads	(revision 0)
@@ -0,0 +1,24 @@
+------------------------------------------------------------------------------
+--                                                                          --
+--                         GNAT RUN-TIME COMPONENTS                         --
+--                                                                          --
+--              A D A . L O N G _ C O M P L E X _ T E X T _ I O             --
+--                                                                          --
+--                                 S p e c                                  --
+--                                                                          --
+-- This specification is adapted from the Ada Reference Manual for use with --
+-- GNAT.  In accordance with the copyright of that document, you can freely --
+-- copy and modify this specification,  provided that if you redistribute a --
+-- modified version,  any changes that you have made are clearly indicated. --
+--                                                                          --
+------------------------------------------------------------------------------
+
+--  Ada 2005 AI-328
+
+with Ada.Text_IO.Complex_IO;
+with Ada.Numerics.Long_Complex_Types;
+
+pragma Elaborate_All (Ada.Text_IO.Complex_IO);
+
+package Ada.Long_Complex_Text_IO is
+  new Ada.Text_IO.Complex_IO (Ada.Numerics.Long_Complex_Types);

Property changes on: a-lcteio.ads
___________________________________________________________________
Name: svn:executable
   + *

Index: a-llctio.ads
===================================================================
--- a-llctio.ads	(revision 0)
+++ a-llctio.ads	(revision 0)
@@ -0,0 +1,24 @@
+------------------------------------------------------------------------------
+--                                                                          --
+--                         GNAT RUN-TIME COMPONENTS                         --
+--                                                                          --
+--         A D A . L O N G _ L O N G _ C O M P L E X _ T E X T _ I O        --
+--                                                                          --
+--                                 S p e c                                  --
+--                                                                          --
+-- This specification is adapted from the Ada Reference Manual for use with --
+-- GNAT.  In accordance with the copyright of that document, you can freely --
+-- copy and modify this specification,  provided that if you redistribute a --
+-- modified version,  any changes that you have made are clearly indicated. --
+--                                                                          --
+------------------------------------------------------------------------------
+
+--  Ada 2005 AI-328
+
+with Ada.Text_IO.Complex_IO;
+with Ada.Numerics.Long_Long_Complex_Types;
+
+pragma Elaborate_All (Ada.Text_IO.Complex_IO);
+
+package Ada.Long_Long_Complex_Text_IO is
+  new Ada.Text_IO.Complex_IO (Ada.Numerics.Long_Long_Complex_Types);

Property changes on: a-llctio.ads
___________________________________________________________________
Name: svn:executable
   + *

Index: a-scteio.ads
===================================================================
--- a-scteio.ads	(revision 0)
+++ a-scteio.ads	(revision 0)
@@ -0,0 +1,24 @@
+------------------------------------------------------------------------------
+--                                                                          --
+--                         GNAT RUN-TIME COMPONENTS                         --
+--                                                                          --
+--             A D A . S H O R T _ C O M P L E X _ T E X T _ I O            --
+--                                                                          --
+--                                 S p e c                                  --
+--                                                                          --
+-- This specification is adapted from the Ada Reference Manual for use with --
+-- GNAT.  In accordance with the copyright of that document, you can freely --
+-- copy and modify this specification,  provided that if you redistribute a --
+-- modified version,  any changes that you have made are clearly indicated. --
+--                                                                          --
+------------------------------------------------------------------------------
+
+--  Ada 2005 AI-328
+
+with Ada.Text_IO.Complex_IO;
+with Ada.Numerics.Short_Complex_Types;
+
+pragma Elaborate_All (Ada.Text_IO.Complex_IO);
+
+package Ada.Short_Complex_Text_IO is
+  new Ada.Text_IO.Complex_IO (Ada.Numerics.Short_Complex_Types);

Property changes on: a-scteio.ads
___________________________________________________________________
Name: svn:executable
   + *



More information about the Gcc-patches mailing list