-- --
------------------------------------------------------------------------------
+pragma Ada_2020;
+
with Ada.Unchecked_Deallocation;
-with Ada.Characters.Conversions; use Ada.Characters.Conversions;
+with Ada.Strings.Text_Output.Utils;
with Interfaces; use Interfaces;
-- Put_Image --
---------------
- procedure Put_Image
- (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
- Arg : Big_Integer) is
+ procedure Put_Image (S : in out Sink'Class; V : Big_Integer) is
+ -- This is implemented in terms of To_String. It might be more elegant
+ -- and more efficient to do it the other way around, but this is the
+ -- most expedient implementation for now.
begin
- Wide_Wide_String'Write (Stream, To_Wide_Wide_String (To_String (Arg)));
+ Strings.Text_Output.Utils.Put_UTF_8 (S, To_String (V));
end Put_Image;
---------
-- --
------------------------------------------------------------------------------
-with Ada.Streams;
+pragma Ada_2020;
+
+with Ada.Strings.Text_Output; use Ada.Strings.Text_Output;
private with Ada.Finalization;
private with System;
package Ada.Numerics.Big_Numbers.Big_Integers
with Preelaborate
is
- type Big_Integer is private;
- -- with Integer_Literal => From_String,
- -- Put_Image => Put_Image;
+ type Big_Integer is private with
+ -- Integer_Literal => From_String,
+ Put_Image => Put_Image;
function Is_Valid (Arg : Big_Integer) return Boolean
with Convention => Intrinsic;
function From_String (Arg : String) return Big_Integer;
- procedure Put_Image
- (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
- Arg : Big_Integer);
+ procedure Put_Image (S : in out Sink'Class; V : Big_Integer);
function "+" (L : Big_Integer) return Big_Integer;
-- This is the GMP version of this package
+pragma Ada_2020;
+
with Ada.Unchecked_Conversion;
with Ada.Unchecked_Deallocation;
with Interfaces.C; use Interfaces.C;
with Interfaces.C.Strings; use Interfaces.C.Strings;
-with Ada.Characters.Conversions; use Ada.Characters.Conversions;
+with Ada.Strings.Text_Output.Utils;
with Ada.Characters.Handling; use Ada.Characters.Handling;
package body Ada.Numerics.Big_Numbers.Big_Integers is
-- Put_Image --
---------------
- procedure Put_Image
- (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
- Arg : Big_Integer) is
+ procedure Put_Image (S : in out Sink'Class; V : Big_Real) is
+ -- This is implemented in terms of To_String. It might be more elegant
+ -- and more efficient to do it the other way around, but this is the
+ -- most expedient implementation for now.
begin
- Wide_Wide_String'Write (Stream, To_Wide_Wide_String (To_String (Arg)));
+ Strings.Text_Output.Utils.Put_UTF_8 (S, To_String (V));
end Put_Image;
---------
-- This is the default version of this package, based on Big_Integers only.
-with Ada.Characters.Conversions; use Ada.Characters.Conversions;
+pragma Ada_2020;
+
+with Ada.Strings.Text_Output.Utils;
package body Ada.Numerics.Big_Numbers.Big_Reals is
-- Put_Image --
---------------
- procedure Put_Image
- (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
- Arg : Big_Real) is
+ procedure Put_Image (S : in out Sink'Class; V : Big_Real) is
+ -- This is implemented in terms of To_String. It might be more elegant
+ -- and more efficient to do it the other way around, but this is the
+ -- most expedient implementation for now.
begin
- Wide_Wide_String'Write (Stream, To_Wide_Wide_String (To_String (Arg)));
+ Strings.Text_Output.Utils.Put_UTF_8 (S, To_String (V));
end Put_Image;
---------
-- --
------------------------------------------------------------------------------
+pragma Ada_2020;
+
with Ada.Numerics.Big_Numbers.Big_Integers;
-with Ada.Streams;
+
+with Ada.Strings.Text_Output; use Ada.Strings.Text_Output;
-- Note that some Ada 2020 aspects are commented out since they are not
-- supported yet.
package Ada.Numerics.Big_Numbers.Big_Reals
with Preelaborate
is
- type Big_Real is private;
--- with Real_Literal => From_String,
--- Put_Image => Put_Image;
+ type Big_Real is private with
+-- Real_Literal => From_String,
+ Put_Image => Put_Image;
function Is_Valid (Arg : Big_Real) return Boolean
with Convention => Intrinsic;
function From_Quotient_String (Arg : String) return Big_Real;
- procedure Put_Image
- (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
- Arg : Big_Real);
+ procedure Put_Image (S : in out Sink'Class; V : Big_Real);
function "+" (L : Big_Real) return Big_Real;
pragma Ada_2020;
-package Ada.Strings.Text_Output.Utils is
+package Ada.Strings.Text_Output.Utils with Preelaborate is
-- This package provides utility functions on Sink'Class. These are
-- intended for use by Put_Image attributes, both the default versions
with Ada.Strings.UTF_Encoding;
with Ada.Strings.UTF_Encoding.Wide_Wide_Strings;
-package Ada.Strings.Text_Output is
+package Ada.Strings.Text_Output with Preelaborate is
-- This package provides a "Sink" abstraction, to which characters of type
-- Character, Wide_Character, and Wide_Wide_Character can be sent. This