Decl : out Node_Id;
Pnam : out Entity_Id)
is
- pragma Assert (Typ = Base_Type (Typ));
- pragma Assert (not Is_Unchecked_Union (Typ));
+ Btyp : constant Entity_Id := Base_Type (Typ);
+ pragma Assert (not Is_Unchecked_Union (Btyp));
First_Time : Boolean := True;
Stms : constant List_Id := New_List;
Rdef : Node_Id;
Type_Decl : constant Node_Id :=
- Declaration_Node (Base_Type (Underlying_Type (Typ)));
+ Declaration_Node (Base_Type (Underlying_Type (Btyp)));
-- Start of processing for Build_Record_Put_Image_Procedure
Parameter_Associations => New_List
(Make_Identifier (Loc, Name_S))));
- Pnam := Make_Put_Image_Name (Loc, Typ);
- Build_Put_Image_Proc (Loc, Typ, Decl, Pnam, Stms);
+ Pnam := Make_Put_Image_Name (Loc, Btyp);
+ Build_Put_Image_Proc (Loc, Btyp, Decl, Pnam, Stms);
end Build_Record_Put_Image_Procedure;
-------------------------------
with Ada.Unchecked_Deallocation;
with System; use type System.Address;
+with System.Put_Images;
package body Ada.Containers.Vectors with
SPARK_Mode => Off
end return;
end Pseudo_Reference;
+ ---------------
+ -- Put_Image --
+ ---------------
+
+ procedure Put_Image
+ (S : in out Ada.Strings.Text_Output.Sink'Class; V : Vector)
+ is
+ First_Time : Boolean := True;
+ use System.Put_Images;
+ begin
+ Array_Before (S);
+
+ for X of V loop
+ if First_Time then
+ First_Time := False;
+ else
+ Simple_Array_Between (S);
+ end if;
+
+ Element_Type'Put_Image (S, X);
+ end loop;
+
+ Array_After (S);
+ end Put_Image;
+
-------------------
-- Query_Element --
-------------------
with Ada.Containers.Helpers;
private with Ada.Finalization;
private with Ada.Streams;
+private with Ada.Strings.Text_Output;
-- The language-defined generic package Containers.Vectors provides private
-- types Vector and Cursor, and a set of operations for each type. A vector
Elements : Elements_Access := null;
Last : Extended_Index := No_Index;
TC : aliased Tamper_Counts;
- end record;
+ end record with Put_Image => Put_Image;
+
+ procedure Put_Image
+ (S : in out Ada.Strings.Text_Output.Sink'Class; V : Vector);
overriding procedure Adjust (Container : in out Vector);
overriding procedure Finalize (Container : in out Vector);
pragma Assert (Base in 2 .. 36);
procedure Put_Image (S : in out Sink'Class; X : Integer_Type);
procedure Put_Image (S : in out Sink'Class; X : Unsigned_Type);
+ private
+ subtype Digit is Unsigned_Type range 0 .. Base - 1;
end Generic_Integer_Images;
package body Generic_Integer_Images is
A : constant := Character'Pos ('a');
Z : constant := Character'Pos ('0');
- subtype Digit is Unsigned_Type range 0 .. Base - 1;
function Digit_To_Character (X : Digit) return Character is
(Character'Val (if X < 10 then X + Z else X + A - 10));
-- after them. See Exp_Put_Image in the compiler for details of these
-- calls.
+ pragma Preelaborate;
+
subtype Sink is Ada.Strings.Text_Output.Sink;
procedure Put_Image_Integer (S : in out Sink'Class; X : Integer);
-- --
------------------------------------------------------------------------------
+with Ada.Strings.Text_Output.Utils;
with Ada.Unchecked_Conversion;
with System.Random_Seed;
return Result;
end Image;
+ ---------------
+ -- Put_Image --
+ ---------------
+
+ procedure Put_Image
+ (S : in out Strings.Text_Output.Sink'Class; V : State) is
+ begin
+ Strings.Text_Output.Utils.Put_String (S, Image (V));
+ end Put_Image;
+
-----------
-- Value --
-----------
with Interfaces;
+private with Ada.Strings.Text_Output;
+
package System.Random_Numbers with
SPARK_Mode => Off
is
-- Feedback distance from the current position
subtype State_Val is Interfaces.Unsigned_32;
- type State is array (0 .. N - 1) of State_Val;
+ type State is array (0 .. N - 1) of State_Val with Put_Image => Put_Image;
+
+ procedure Put_Image
+ (S : in out Ada.Strings.Text_Output.Sink'Class; V : State);
type Writable_Access (Self : access Generator) is limited null record;
-- Auxiliary type to make Generator a self-referential type