gcc/gcc/ada/a-wtflau.adb
Arnaud Charlet 72eaa36512 [multiple changes]
2015-01-06  Robert Dewar  <dewar@adacore.com>

	* s-valllu.adb, a-tiinau.adb, a-timoau.adb, a-ztinau.adb, a-ztmoau.adb,
	s-valuns.adb, s-valrea.adb, a-wtflau.adb, a-tiflau.adb, a-ztflau.adb,
	a-wtinau.adb, a-wtmoau.adb: Document recognition of : in place of #.

2015-01-06  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch13.adb (Analyze_Aspect_Specifications): For aspects
	that specify stream subprograms, if the prefix is a class-wide
	type then the generated attribute definition clause must apply
	to the same class-wide type.
	(Default_Iterator): An iterator defined by an aspect of some
	container type T must have a first parameter of type T, T'class,
	or an access to such (from code reading RM 5.5.1 (2/3)).

2015-01-06  Arnaud Charlet  <charlet@adacore.com>

	* gnat1drv.adb: Minor: complete previous change.

2015-01-06  Olivier Hainque  <hainque@adacore.com>

	* set_targ.ads (C_Type_For): New function. Return the name of
	a C type supported by the back-end and suitable as a basis to
	construct the standard Ada floating point type identified by
	the T parameter. This is used as a common ground to feed both
	ttypes values and the GNAT tree nodes for the standard floating
	point types.
	* set_targ.adb (Long_Double_Index): The index at which "long
	double" gets registered in the FPT_Mode_Table. This is useful to
	know whether we have a "long double" available at all and get at
	it's characteristics without having to search the FPT_Mode_Table
	when we need to decide which C type should be used as the
	basis for Long_Long_Float in Ada.
	(Register_Float_Type): Fill Long_Double_Index.
	(FPT_Mode_Index_For): New function. Return the index in
	FPT_Mode_Table that designates the entry corresponding to the
	provided C type name.
	(FPT_Mode_Index_For): New function. Return the index in
	FPT_Mode_Table that designates the entry for a back-end type
	suitable as a basis to construct the standard Ada floating point
	type identified by the input T parameter.
	(elaboration code): Register_Back_End_Types unconditionally,
	so C_Type_For can operate regardless of -gnateT. Do it
	early so we can query it for the floating point sizes, via
	FPT_Mode_Index_For. Initialize Float_Size, Double_Size and
	Long_Double_Size from the FPT_Mode_Table, as cstand will do.
	* cstand.adb (Create_Float_Types): Use C_Type_For to determine
	which C type should be used as the basis for the construction
	of the Standard Ada floating point types.
	* get_targ.ads (Get_Float_Size, Get_Double_Size,
	Get_Long_Double_Size): Remove.
	* get_targ.adb: Likewise.

2015-01-06  Thomas Quinot  <quinot@adacore.com>

	* sem_cat.adb (In_RCI_Declaration): Remove unnecessary
	parameter and rename to...
	(In_RCI_Visible_Declarations): Fix handling of private part of nested
	package.
	(Validate_RCI_Subprogram_Declaration): Reject illegal function
	returning anonymous access in RCI unit.

From-SVN: r219233
2015-01-06 10:24:33 +01:00

236 lines
6.7 KiB
Ada

------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . W I D E _ T E X T _ I O . F L O A T _ A U X --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2014, 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- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Ada.Wide_Text_IO.Generic_Aux; use Ada.Wide_Text_IO.Generic_Aux;
with System.Img_Real; use System.Img_Real;
with System.Val_Real; use System.Val_Real;
package body Ada.Wide_Text_IO.Float_Aux is
---------
-- Get --
---------
procedure Get
(File : File_Type;
Item : out Long_Long_Float;
Width : Field)
is
Buf : String (1 .. Field'Last);
Stop : Integer := 0;
Ptr : aliased Integer := 1;
begin
if Width /= 0 then
Load_Width (File, Width, Buf, Stop);
String_Skip (Buf, Ptr);
else
Load_Real (File, Buf, Stop);
end if;
Item := Scan_Real (Buf, Ptr'Access, Stop);
Check_End_Of_Field (Buf, Stop, Ptr, Width);
end Get;
----------
-- Gets --
----------
procedure Gets
(From : String;
Item : out Long_Long_Float;
Last : out Positive)
is
Pos : aliased Integer;
begin
String_Skip (From, Pos);
Item := Scan_Real (From, Pos'Access, From'Last);
Last := Pos - 1;
exception
when Constraint_Error =>
raise Data_Error;
end Gets;
---------------
-- Load_Real --
---------------
procedure Load_Real
(File : File_Type;
Buf : out String;
Ptr : in out Natural)
is
Loaded : Boolean;
begin
-- Skip initial blanks and load possible sign
Load_Skip (File);
Load (File, Buf, Ptr, '+', '-');
-- Case of .nnnn
Load (File, Buf, Ptr, '.', Loaded);
if Loaded then
Load_Digits (File, Buf, Ptr, Loaded);
-- Hopeless junk if no digits loaded
if not Loaded then
return;
end if;
-- Otherwise must have digits to start
else
Load_Digits (File, Buf, Ptr, Loaded);
-- Hopeless junk if no digits loaded
if not Loaded then
return;
end if;
-- Deal with based case. We recognize either the standard '#' or the
-- allowed alternative replacement ':' (see RM J.2(3)).
Load (File, Buf, Ptr, '#', ':', Loaded);
if Loaded then
-- Case of nnn#.xxx#
Load (File, Buf, Ptr, '.', Loaded);
if Loaded then
Load_Extended_Digits (File, Buf, Ptr);
Load (File, Buf, Ptr, '#', ':');
-- Case of nnn#xxx.[xxx]# or nnn#xxx#
else
Load_Extended_Digits (File, Buf, Ptr);
Load (File, Buf, Ptr, '.', Loaded);
if Loaded then
Load_Extended_Digits (File, Buf, Ptr);
end if;
-- As usual, it seems strange to allow mixed base characters,
-- but that is what ACVC tests expect, see CE3804M, case (3).
Load (File, Buf, Ptr, '#', ':');
end if;
-- Case of nnn.[nnn] or nnn
else
-- Prevent the potential processing of '.' in cases where the
-- initial digits have a trailing underscore.
if Buf (Ptr) = '_' then
return;
end if;
Load (File, Buf, Ptr, '.', Loaded);
if Loaded then
Load_Digits (File, Buf, Ptr);
end if;
end if;
end if;
-- Deal with exponent
Load (File, Buf, Ptr, 'E', 'e', Loaded);
if Loaded then
Load (File, Buf, Ptr, '+', '-');
Load_Digits (File, Buf, Ptr);
end if;
end Load_Real;
---------
-- Put --
---------
procedure Put
(File : File_Type;
Item : Long_Long_Float;
Fore : Field;
Aft : Field;
Exp : Field)
is
Buf : String (1 .. Field'Last);
Ptr : Natural := 0;
begin
Set_Image_Real (Item, Buf, Ptr, Fore, Aft, Exp);
Put_Item (File, Buf (1 .. Ptr));
end Put;
----------
-- Puts --
----------
procedure Puts
(To : out String;
Item : Long_Long_Float;
Aft : Field;
Exp : Field)
is
Buf : String (1 .. Field'Last);
Ptr : Natural := 0;
begin
Set_Image_Real (Item, Buf, Ptr, Fore => 1, Aft => Aft, Exp => Exp);
if Ptr > To'Length then
raise Layout_Error;
else
for J in 1 .. Ptr loop
To (To'Last - Ptr + J) := Buf (J);
end loop;
for J in To'First .. To'Last - Ptr loop
To (J) := ' ';
end loop;
end if;
end Puts;
end Ada.Wide_Text_IO.Float_Aux;