1------------------------------------------------------------------------------ 2-- -- 3-- GNAT RUN-TIME COMPONENTS -- 4-- -- 5-- SYSTEM.PUT_IMAGES -- 6-- -- 7-- S p e c -- 8-- -- 9-- Copyright (C) 2020, Free Software Foundation, Inc. -- 10-- -- 11-- GNAT is free software; you can redistribute it and/or modify it under -- 12-- terms of the GNU General Public License as published by the Free Soft- -- 13-- ware Foundation; either version 3, or (at your option) any later ver- -- 14-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- 15-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- 16-- or FITNESS FOR A PARTICULAR PURPOSE. -- 17-- -- 18-- As a special exception under Section 7 of GPL version 3, you are granted -- 19-- additional permissions described in the GCC Runtime Library Exception, -- 20-- version 3.1, as published by the Free Software Foundation. -- 21-- -- 22-- You should have received a copy of the GNU General Public License and -- 23-- a copy of the GCC Runtime Library Exception along with this program; -- 24-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- 25-- <http://www.gnu.org/licenses/>. -- 26-- -- 27-- GNAT was originally developed by the GNAT team at New York University. -- 28-- Extensive contributions were provided by Ada Core Technologies Inc. -- 29-- -- 30------------------------------------------------------------------------------ 31 32with Ada.Strings.Text_Output; 33with System.Unsigned_Types; 34 35package System.Put_Images with Pure is 36 37 -- This package contains subprograms that are called by the generated code 38 -- for the 'Put_Image attribute. 39 -- 40 -- For a signed integer type that fits in Integer, the actual parameter is 41 -- converted to Integer, and Put_Image_Integer is called. For larger types, 42 -- Put_Image_Long_Long_Integer or Put_Image_Long_Long_Long_Integer is used. 43 -- For a modular integer type, this is similar with Integer replaced with 44 -- Unsigned. Access values are unchecked-converted to either Thin_Pointer 45 -- or Fat_Pointer, and Put_Image_Thin_Pointer or Put_Image_Fat_Pointer is 46 -- called. The Before/Between/After procedures are called before printing 47 -- the components of a composite type, between pairs of components, and 48 -- after them. See Exp_Put_Image in the compiler for details of these 49 -- calls. 50 51 pragma Preelaborate; 52 53 subtype Sink is Ada.Strings.Text_Output.Sink; 54 55 procedure Put_Image_Integer (S : in out Sink'Class; X : Integer); 56 procedure Put_Image_Long_Long_Integer 57 (S : in out Sink'Class; X : Long_Long_Integer); 58 procedure Put_Image_Long_Long_Long_Integer 59 (S : in out Sink'Class; X : Long_Long_Long_Integer); 60 61 subtype Unsigned is Unsigned_Types.Unsigned; 62 subtype Long_Long_Unsigned is Unsigned_Types.Long_Long_Unsigned; 63 subtype Long_Long_Long_Unsigned is Unsigned_Types.Long_Long_Long_Unsigned; 64 65 procedure Put_Image_Unsigned (S : in out Sink'Class; X : Unsigned); 66 procedure Put_Image_Long_Long_Unsigned 67 (S : in out Sink'Class; X : Long_Long_Unsigned); 68 procedure Put_Image_Long_Long_Long_Unsigned 69 (S : in out Sink'Class; X : Long_Long_Long_Unsigned); 70 71 type Byte is new Character with Alignment => 1; 72 type Byte_String is array (Positive range <>) of Byte with Alignment => 1; 73 type Thin_Pointer is access all Byte with Storage_Size => 0; 74 type Fat_Pointer is access all Byte_String with Storage_Size => 0; 75 procedure Put_Image_Thin_Pointer (S : in out Sink'Class; X : Thin_Pointer); 76 procedure Put_Image_Fat_Pointer (S : in out Sink'Class; X : Fat_Pointer); 77 -- Print "null", or the address of the designated object as an unsigned 78 -- hexadecimal integer. 79 80 procedure Put_Image_Access_Subp (S : in out Sink'Class; X : Thin_Pointer); 81 -- For access-to-subprogram types 82 83 procedure Put_Image_Access_Prot_Subp 84 (S : in out Sink'Class; X : Thin_Pointer); 85 -- For access-to-protected-subprogram types 86 87 procedure Put_Image_String (S : in out Sink'Class; X : String); 88 procedure Put_Image_Wide_String (S : in out Sink'Class; X : Wide_String); 89 procedure Put_Image_Wide_Wide_String 90 (S : in out Sink'Class; X : Wide_Wide_String); 91 92 procedure Array_Before (S : in out Sink'Class); 93 procedure Array_Between (S : in out Sink'Class); 94 procedure Array_After (S : in out Sink'Class); 95 96 procedure Simple_Array_Between (S : in out Sink'Class); 97 -- For "simple" arrays, where we don't want a newline between every 98 -- component. 99 100 procedure Record_Before (S : in out Sink'Class); 101 procedure Record_Between (S : in out Sink'Class); 102 procedure Record_After (S : in out Sink'Class); 103 104 procedure Put_Arrow (S : in out Sink'Class); 105 106 procedure Put_Image_Unknown (S : in out Sink'Class; Type_Name : String); 107 -- For Put_Image of types that don't have the attribute, such as type 108 -- Sink. 109 110end System.Put_Images; 111