1------------------------------------------------------------------------------ 2-- -- 3-- GNAT RUN-TIME COMPONENTS -- 4-- -- 5-- S Y S T E M . S T R E A M _ A T T R I B U T E S . X D R -- 6-- -- 7-- S p e c -- 8-- -- 9-- Copyright (C) 1992-2021, 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 32-- This package contains alternate implementations of the stream attributes 33-- for elementary types based on the XDR standard. These are the subprograms 34-- that are directly accessed by occurrences of the stream attributes where 35-- the type is elementary. 36 37-- It is especially useful for exchanging streams between two different 38-- systems with different basic type representations and endianness. 39 40-- We only provide the subprograms for the standard base types. For user 41-- defined types, the subprogram for the corresponding root type is called 42-- with an appropriate conversion. 43 44package System.Stream_Attributes.XDR is 45 pragma Preelaborate; 46 47 pragma Suppress (Accessibility_Check, XDR); 48 -- No need to check accessibility on arguments of subprograms 49 50 --------------------- 51 -- Input Functions -- 52 --------------------- 53 54 -- Functions for S'Input attribute. These functions are also used for 55 -- S'Read, with the obvious transformation, since the input operation 56 -- is the same for all elementary types (no bounds or discriminants 57 -- are involved). 58 59 function I_AD (Stream : not null access RST) return Fat_Pointer; 60 function I_AS (Stream : not null access RST) return Thin_Pointer; 61 function I_B (Stream : not null access RST) return Boolean; 62 function I_C (Stream : not null access RST) return Character; 63 function I_F (Stream : not null access RST) return Float; 64 function I_I (Stream : not null access RST) return Integer; 65 function I_I24 (Stream : not null access RST) return Integer_24; 66 function I_LF (Stream : not null access RST) return Long_Float; 67 function I_LI (Stream : not null access RST) return Long_Integer; 68 function I_LLF (Stream : not null access RST) return Long_Long_Float; 69 function I_LLI (Stream : not null access RST) return Long_Long_Integer; 70 function I_LLU (Stream : not null access RST) return UST.Long_Long_Unsigned; 71 function I_LU (Stream : not null access RST) return UST.Long_Unsigned; 72 function I_SF (Stream : not null access RST) return Short_Float; 73 function I_SI (Stream : not null access RST) return Short_Integer; 74 function I_SSI (Stream : not null access RST) return Short_Short_Integer; 75 function I_SSU (Stream : not null access RST) return 76 UST.Short_Short_Unsigned; 77 function I_SU (Stream : not null access RST) return UST.Short_Unsigned; 78 function I_U (Stream : not null access RST) return UST.Unsigned; 79 function I_U24 (Stream : not null access RST) return Unsigned_24; 80 function I_WC (Stream : not null access RST) return Wide_Character; 81 function I_WWC (Stream : not null access RST) return Wide_Wide_Character; 82 83 ----------------------- 84 -- Output Procedures -- 85 ----------------------- 86 87 -- Procedures for S'Write attribute. These procedures are also used for 88 -- 'Output, since for elementary types there is no difference between 89 -- 'Write and 'Output because there are no discriminants or bounds to 90 -- be written. 91 92 procedure W_AD (Stream : not null access RST; Item : Fat_Pointer); 93 procedure W_AS (Stream : not null access RST; Item : Thin_Pointer); 94 procedure W_B (Stream : not null access RST; Item : Boolean); 95 procedure W_C (Stream : not null access RST; Item : Character); 96 procedure W_F (Stream : not null access RST; Item : Float); 97 procedure W_I (Stream : not null access RST; Item : Integer); 98 procedure W_I24 (Stream : not null access RST; Item : Integer_24); 99 procedure W_LF (Stream : not null access RST; Item : Long_Float); 100 procedure W_LI (Stream : not null access RST; Item : Long_Integer); 101 procedure W_LLF (Stream : not null access RST; Item : Long_Long_Float); 102 procedure W_LLI (Stream : not null access RST; Item : Long_Long_Integer); 103 procedure W_LLU (Stream : not null access RST; Item : 104 UST.Long_Long_Unsigned); 105 procedure W_LU (Stream : not null access RST; Item : UST.Long_Unsigned); 106 procedure W_SF (Stream : not null access RST; Item : Short_Float); 107 procedure W_SI (Stream : not null access RST; Item : Short_Integer); 108 procedure W_SSI (Stream : not null access RST; Item : Short_Short_Integer); 109 procedure W_SSU (Stream : not null access RST; Item : 110 UST.Short_Short_Unsigned); 111 procedure W_SU (Stream : not null access RST; Item : UST.Short_Unsigned); 112 procedure W_U (Stream : not null access RST; Item : UST.Unsigned); 113 procedure W_U24 (Stream : not null access RST; Item : Unsigned_24); 114 procedure W_WC (Stream : not null access RST; Item : Wide_Character); 115 procedure W_WWC (Stream : not null access RST; Item : Wide_Wide_Character); 116 117end System.Stream_Attributes.XDR; 118