--- ai12s/ai12-0058-1.txt 2016/10/06 04:09:17 1.9 +++ ai12s/ai12-0058-1.txt 2016/10/28 03:34:13 1.10 @@ -1,9 +1,12 @@ -!standard B.5(19) 16-10-04 AI12-0058-1/04 +!standard B.5(10) 16-10-08 AI12-0058-1/05 +!standard B.5(18) !standard B.5(21) !standard B.5(31) !standard B.5(33) !standard 1.2(3/2) !class binding interpretation 13-05-20 +!status Amendment 1-2012 16-10-27 +!status ARG Approved 9-0-0 16-10-08 !status work item 13-01-22 !status received 12-07-03 !priority Medium @@ -11,9 +14,9 @@ !subject The Fortran Annex needs updating to support Fortran 2008 !summary -Update obsolete references and remove implementation device that is considered -to be bad practice from the Fortran annex, and add better support for double -precision complex arithmetic. +In the Fortran Annex, update obsolete references and remove implementation +advice that is considered to be bad practice, and add better support for +double precision complex arithmetic. !question @@ -172,6 +175,15 @@ ISO/IEC 1539-1:[2004]{2010}, Information technology - Programming languages - Fortran - Part 1: Base language. +Add after B.5(10): + + package Double_Precision_Complex_Types is + new Ada.Numerics.Generic_Complex_Types (Double_Precision); + + type Double_Complex is new Double_Precision_Complex_Types.Complex; + + subtype Double_Imaginary is Double_Precision_Complex_Types.Imaginary; + Modify AARM B.5(17.a): Ramification: The means by which the Complex type {and Double_Complex type} @@ -181,7 +193,7 @@ Complex type {and Double_Complex type} is to be useful in Ada code without duplicating facilities defined elsewhere. -Modify B.5(19): +Modify B.5(18): The types Fortran_Integer, Real, Double_Precision, Logical, Complex, {Double_Complex, Character_Set,} and Fortran_Character are Fortran-compatible. @@ -199,10 +211,10 @@ kinds of intrinsic types, e.g. Integer (Kind=n), Real (Kind=n), Logical (Kind=n), Complex (Kind=n), and Character (Kind=n), may contain the declarations of types with the recommended names Integer_Kind_n, Real_Kind_n, -Logical_Kind_n, Complex_Kind_n, and Character_Kind_n]{declarations for the -character types corresponding to Fortran character kinds 'ascii' and -'iso_10646', which in turn correspond to ISO/IEC 646:1991, and -to UCS-4 as specified in ISO/IEC 10646:2011 are permitted}. +Logical_Kind_n, Complex_Kind_n, and Character_Kind_n]{declarations are permitted +for the character types corresponding to Fortran character kinds 'ascii' and +'iso_10646', which in turn correspond to ISO/IEC 646:1991 and +to UCS-4 as specified in ISO/IEC 10646:2011}. Modify AARM B.5(21.a): {Reason: Fortran compilers are required to recognize 'ascii' and 'iso_10646' @@ -216,20 +228,21 @@ type. Similarly,] if a wide character type is defined to match a Fortran 90 wide character type (accessible in Fortran 90 with the Kind [modifier]{attribute}), then an auxiliary character set may be declared to - serve as its component type." + serve as its component type. Add after B.5(31): - - Precision: constant := 6; - type Standard_Deviation is digits Precision with Convention => Fortran; - Deviation : Standard_Deviation; - type Atomic_Number is new Integer8 with Convention => Fortran; + Precision: constant := 6; + type Standard_Deviation is digits Precision + with Convention => Fortran; + Deviation : Standard_Deviation; + -- Declarations to match the following Fortran declarations: + -- integer, parameter :: precision = selected_real_kind(p=6) + -- real(precision) :: deviation Add after B.5(33): Deviation := ...; - Atomic_Number := ...; !discussion @@ -244,14 +257,14 @@ pointer and allocatable variables in Fortran, are completely absent. A recent ISO Technical Specification (29133), which will be incorporated into the next revision of the Fortran standard, specifies how these -entities are described to C functions, by defining structs and functions +entities are described in C, by defining structs and functions to create, manipulate, and inquire descriptors and the objects they -describe, similarly interoperation with Fortran modules which are similar -to Ada packages are not mentioned. +describe. Similarly, interoperation with Fortran modules (which are similar +to Ada packages) are not mentioned. Presumably, an Ada processor could use these descriptors and functions, without burdening the programmer, as is required in C, to exploit these -facilities. Even better would be for an Ada processor and a Fortran +facilities. Even better would be for an Ada processor and a Fortran processor to conspire to use the same internal representation for these entities, so that Fortran programmers need not declare an Ada procedure to be referenced from Fortran, or a Fortran procedure to be referenced @@ -307,8 +320,90 @@ correspondence of Ada access types and Fortran pointers, if there is any, should be illustrated. +!corrigendum 1.2(3/2) + +@drepl +ISO/IEC 1539-1:2004, @i<Information technology @emdash Programming languages +@emdash Fortran @emdash Part 1: Base language>. +@dby +ISO/IEC 1539-1:2010, @i<Information technology @emdash Programming languages +@emdash Fortran @emdash Part 1: Base language>. + +!corrigendum B.5(10) + +@dinsa +@xcode< @b<subtype> Imaginary @b<is> Single_Precision_Complex_Types.Imaginary; + i : Imaginary @b<renames> Single_Precision_Complex_Types.i; + j : Imaginary @b<renames> Single_Precision_Complex_Types.j;> +@dinss +@xcode< @b<package> Double_Precision_Complex_Types @b<is> + @b<new> Ada.Numerics.Generic_Complex_Types (Double_Precision);> + +@xcode< @b<type> Double_Complex @b<is new> Double_Precision_Complex_Types.Complex;> + +@xcode< @b<subtype> Double_Imaginary @b<is> Double_Precision_Complex_Types.Imaginary;> + +!corrigendum B.5(18) + +@drepl +The types Fortran_Integer, Real, Double_Precision, Logical, Complex, and +Fortran_Character are Fortran-compatible. +@dby +The types Fortran_Integer, Real, Double_Precision, Logical, Complex, +Double_Complex, Character_Set, and Fortran_Character are Fortran-compatible. + +!corrigendum B.5(21) + +@drepl +An implementation may add additional declarations to the Fortran interface +packages. For example, the Fortran interface package for an implementation +of Fortran 77 (ANSI X3.9-1978) that defines types like Integer*@i<n>, +Real*@i<n>, Logical*@i<n>, and Complex*@i<n> may contain the declarations +of types named Integer_Star_@i<n>, Real_Star_@i<n>, Logical_Star_@i<n>, and +Complex_Star_@i<n>. (This convention should not apply to Character*@i<n>, for +which the Ada analog is the constrained array subtype Fortran_Character +(1..n).) Similarly, the Fortran interface package for an implementation of +Fortran 90 that provides multiple kinds of intrinsic types, e.g. +Integer (Kind=@i<n>), Real (Kind=@i<n>), Logical (Kind=@i<n>), +Complex (Kind=@i<n>), and Character (Kind=@i<n>), may contain the declarations +of types with the recommended names Integer_Kind_@i<n>, Real_Kind_@i<n>, +Logical_Kind_@i<n>, Complex_Kind_@i<n>, and Character_Kind_@i<n>. +@dby +An implementation may add additional declarations to the Fortran interface +packages. For example, declarations are permitted +for the character types corresponding to Fortran character kinds 'ascii' and +'iso_10646', which in turn correspond to ISO/IEC 646:1991 and +to UCS-4 as specified in ISO/IEC 10646:2011. + +!corrigendum B.5(31) + +@dinsa +@xcode< Rank : @b<constant> Fortran_Integer := 100; + My_Matrix : Fortran_Matrix (1 .. Rank, 1 .. Rank);> +@dinst +@xcode< Precision: @b<constant> := 6; + @b<type> Standard_Deviation @b<is digits> Precision + @b<with> Convention =@> Fortran; + Deviation : Standard_Deviation; + -- @FT<@I<Declarations to match the following Fortran declarations:>> + -- @i<integer, parameter :: precision = selected_real_kind(p=6)> + -- @i<real(precision) :: deviation>> + +!corrigendum B.5(33) + +@dinsa +@xcode< ... + My_Matrix := ...; + ... + Invert (Rank, My_Matrix); + ...> +@dinst +@xcode< Deviation := ...; + ...> + !example +(See wording.) !ASIS

Questions? Ask the ACAA Technical Agent