Debian Codegraph @

gcc/testsuite/ada/acats/support/fd72a00.a

raw
1 -- FD72A00.A
2 --
3 -- Grant of Unlimited Rights
4 --
5 -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
6 -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
7 -- unlimited rights in the software and documentation contained herein.
8 -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
9 -- this public release, the Government intends to confer upon all
10 -- recipients unlimited rights equal to those held by the Government.
11 -- These rights include rights to use, duplicate, release or disclose the
12 -- released technical data and computer software in whole or in part, in
13 -- any manner and for any purpose whatsoever, and to have or permit others
14 -- to do so.
15 --
16 -- DISCLAIMER
17 --
18 -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
19 -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
20 -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
21 -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
22 -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
23 -- PARTICULAR PURPOSE OF SAID MATERIAL.
24 --*
25 --
26 -- FOUNDATION DESCRIPTION:
27 -- This foundation provides a basis for testing package
28 -- System.Address_To_Access_Conversions
29 --
30 -- TEST FILES:
31 -- The following files comprise this foundation:
32 --
33 -- FD72A00.A
34 --
35 -- CHANGE HISTORY:
36 -- 08 FEB 96 SAIC Initial version
37 --
38 --!
39
40 with Impdef;
41 with System.Storage_Elements;
42 package FD72A00 is
43 use System;
44
45 subtype Number is System.Storage_Elements.Integer_Address;
46
47 package Num_IO renames Impdef.Address_Value_IO;
48
49 -- the following conversions To/From Hex are to prevent optimizers from
50 -- optimizing out the otherwise senseless identity conversions, and
51 -- given the unknown nature of the type Number, the Identity operations
52 -- provided in Report will not suffice to this cause.
53
54 function Address_To_Hex( Adder: System.Address ) return String;
55
56 function Hex_To_Address( Hex: access String ) return System.Address;
57
58 end FD72A00;
59
60 package body FD72A00 is
61
62 function Address_To_Hex( Adder: System.Address ) return String is
63 S : String(1..64)
64 := "uninitializedDEFuninitializedDEFuninitializedDEFuninitializedDEF";
65 DeBlank : Positive := S'First;
66 begin
67 Num_IO.Put( S, Number( System.Storage_Elements.To_Integer( Adder ) ),
68 Base => 16 );
69 while S(DeBlank) = ' ' loop
70 DeBlank := DeBlank +1;
71 end loop;
72 return S(DeBlank..S'Last);
73 end Address_To_Hex;
74
75 function Hex_To_Address( Hex: access String ) return System.Address is
76 The_Number : Number;
77 Tail : Natural;
78 begin
79 Num_IO.Get( Hex.all, The_Number, Tail );
80 return System.Storage_Elements.To_Address(
81 System.Storage_Elements.Integer_Address( The_Number ) );
82 end Hex_To_Address;
83
84 end FD72A00;