Skip to content

Commit 3204e37

Browse files
committed
Simplify the float streaming code.
There is no need for the Put parameter as we do not control the float format and this is equivalent to using the 'Image attribute. Continued work for T310-007.
1 parent 3aca5ec commit 3204e37

File tree

1 file changed

+3
-33
lines changed

1 file changed

+3
-33
lines changed

src/soap/soap-types.adb

Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030
pragma Ada_2012;
3131

3232
with Ada.Calendar.Time_Zones;
33-
with Ada.Float_Text_IO;
34-
with Ada.Long_Float_Text_IO;
3533
with Ada.Strings.Fixed;
3634
with Ada.Tags;
3735
with Ada.Task_Attributes;
@@ -79,7 +77,6 @@ package body SOAP.Types is
7977
generic
8078
type T is digits <>;
8179
Inf : T;
82-
with procedure Put (Result : out String; V : T);
8380
function F_Image_G (V : T) return String;
8481
-- Generic routine to get the Image of a floating point number, this is
8582
-- used for Float and Long_Float to support the NaN and +/-INF special
@@ -355,12 +352,7 @@ package body SOAP.Types is
355352
end if;
356353

357354
else
358-
declare
359-
Result : String (1 .. T'Width * 2);
360-
begin
361-
Put (Result, V);
362-
return Strings.Fixed.Trim (Result, Strings.Both);
363-
end;
355+
return Strings.Fixed.Trim (T'Image (V), Strings.Both);
364356
end if;
365357
end F_Image_G;
366358

@@ -873,18 +865,7 @@ package body SOAP.Types is
873865

874866
pragma Suppress (Validity_Check);
875867

876-
procedure Put (R : out String; V : Float);
877-
878-
---------
879-
-- Put --
880-
---------
881-
882-
procedure Put (R : out String; V : Float) is
883-
begin
884-
Float_Text_IO.Put (R, V);
885-
end Put;
886-
887-
function Image is new F_Image_G (Float, Float_Infinity, Put);
868+
function Image is new F_Image_G (Float, Float_Infinity);
888869

889870
begin
890871
return Image (O.V);
@@ -894,18 +875,7 @@ package body SOAP.Types is
894875

895876
pragma Suppress (Validity_Check);
896877

897-
procedure Put (R : out String; V : Long_Float);
898-
899-
---------
900-
-- Put --
901-
---------
902-
903-
procedure Put (R : out String; V : Long_Float) is
904-
begin
905-
Long_Float_Text_IO.Put (R, V);
906-
end Put;
907-
908-
function Image is new F_Image_G (Long_Float, Long_Float_Infinity, Put);
878+
function Image is new F_Image_G (Long_Float, Long_Float_Infinity);
909879

910880
begin
911881
return Image (O.V);

0 commit comments

Comments
 (0)