1 ------------------------------------------------------------------------------
3 -- GNAT SYSTEM UTILITIES --
9 -- Copyright (C) 1997-2003 Free Software Foundation, Inc. --
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 2, 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. See the GNU General Public License --
17 -- for more details. You should have received a copy of the GNU General --
18 -- Public License distributed with GNAT; see file COPYING. If not, write --
19 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
20 -- MA 02111-1307, USA. --
22 -- GNAT was originally developed by the GNAT team at New York University. --
23 -- Extensive contributions were provided by Ada Core Technologies Inc. --
25 ------------------------------------------------------------------------------
27 -- Program to print out listing of Standard package for the target (not
28 -- the host) with all constants appearing explicitly. This is not really
29 -- valid Ada, since one cannot really define new base types, but it is a
30 -- helpful listing from a documentation point of view.
32 -- Note that special care has been taken to use the host parameters for
33 -- integer and floating point sizes.
35 with Ada.Text_IO; use Ada.Text_IO;
37 with Ttypef; use Ttypef;
38 with Ttypes; use Ttypes;
39 with Types; use Types;
42 pragma Ident (Gnatvsn.Gnat_Static_Version_String);
44 procedure P (Item : String) renames Ada.Text_IO.Put_Line;
46 procedure P_Int_Range (Size : Pos; Put_First : Boolean := True);
47 -- Prints the range of an integer based on its Size. If Put_First is
48 -- False, then skip the first bound.
50 procedure P_Float_Range (Nb_Digits : Pos);
51 -- Prints the maximum range of a Float whose 'Digits is given by Nb_Digits
57 procedure P_Float_Range (Nb_Digits : Pos) is
59 -- This routine assumes only IEEE floats.
60 -- ??? Should the following be adapted for OpenVMS ?
64 P (" range " & IEEES_First'Universal_Literal_String & " .. " &
65 IEEES_Last'Universal_Literal_String & ";");
67 P (" range " & IEEEL_First'Universal_Literal_String & " .. " &
68 IEEEL_Last'Universal_Literal_String & ";");
70 P (" range " & IEEEX_First'Universal_Literal_String & " .. " &
71 IEEEX_Last'Universal_Literal_String & ";");
77 -- If one of the floating point types of the host computer has the
78 -- same digits as the target float we are processing, then print out
79 -- the float range using the host computer float type.
81 if Nb_Digits = Short_Float'Digits then
83 Short_Float'First'Img & " .. " & Short_Float'Last'Img);
85 elsif Nb_Digits = Float'Digits then
87 Float'First'Img & " .. " & Float'Last'Img);
89 elsif Nb_Digits = Long_Float'Digits then
91 Long_Float'First'Img & " .. " & Long_Float'Last'Img);
93 elsif Nb_Digits = Long_Long_Float'Digits then
95 Long_Long_Float'First'Img & " .. " & Long_Long_Float'Last'Img);
105 procedure P_Int_Range (Size : Pos; Put_First : Boolean := True) is
108 Put (" is range -(2 **" & Pos'Image (Size - 1) & ")");
110 P (" .. +(2 **" & Pos'Image (Size - 1) & " - 1);");
113 -- Start of processing for GnatPsta
116 P ("package Standard is");
117 P ("pragma Pure(Standard);");
120 P (" type Boolean is (False, True);");
125 Put (" type Integer");
126 P_Int_Range (Standard_Integer_Size);
129 Put (" subtype Natural is Integer range 0");
130 P_Int_Range (Standard_Integer_Size, Put_First => False);
132 Put (" subtype Positive is Integer range 1");
133 P_Int_Range (Standard_Integer_Size, Put_First => False);
136 Put (" type Short_Short_Integer");
137 P_Int_Range (Standard_Short_Short_Integer_Size);
139 Put (" type Short_Integer ");
140 P_Int_Range (Standard_Short_Integer_Size);
142 Put (" type Long_Integer ");
143 P_Int_Range (Standard_Long_Integer_Size);
145 Put (" type Long_Long_Integer ");
146 P_Int_Range (Standard_Long_Long_Integer_Size);
149 -- Floating point types
151 P (" type Short_Float is digits"
152 & Standard_Short_Float_Digits'Img);
153 P_Float_Range (Standard_Short_Float_Digits);
155 P (" type Float is digits"
156 & Standard_Float_Digits'Img);
157 P_Float_Range (Standard_Float_Digits);
159 P (" type Long_Float is digits"
160 & Standard_Long_Float_Digits'Img);
161 P_Float_Range (Standard_Long_Float_Digits);
163 P (" type Long_Long_Float is digits"
164 & Standard_Long_Long_Float_Digits'Img);
165 P_Float_Range (Standard_Long_Long_Float_Digits);
167 P (" -- function ""*"" (Left : root_integer; Right : root_real)");
168 P (" -- return root_real;");
171 P (" -- function ""*"" (Left : root_real; Right : root_integer)");
172 P (" -- return root_real;");
175 P (" -- function ""/"" (Left : root_real; Right : root_integer)");
176 P (" -- return root_real;");
179 P (" -- function ""*"" (Left : universal_fixed; " &
180 "Right : universal_fixed)");
181 P (" -- return universal_fixed;");
184 P (" -- function ""/"" (Left : universal_fixed; " &
185 "Right : universal_fixed)");
186 P (" -- return universal_fixed;");
189 P (" -- The declaration of type Character is based on the standard");
190 P (" -- ISO 8859-1 character set.");
193 P (" -- There are no character literals corresponding to the positions");
194 P (" -- for control characters. They are indicated by lower case");
195 P (" -- identifiers in the following list.");
198 P (" -- Note: this type cannot be represented accurately in Ada");
201 P (" -- type Character is");
204 P (" -- (nul, soh, stx, etx, eot, enq, ack, bel,");
205 P (" -- bs, ht, lf, vt, ff, cr, so, si,");
208 P (" -- dle, dc1, dc2, dc3, dc4, nak, syn, etb,");
209 P (" -- can, em, sub, esc, fs, gs, rs, us,");
212 P (" -- ' ', '!', '""', '#', '$', '%', '&', ''',");
213 P (" -- '(', ')', '*', '+', ',', '-', '.', '/',");
216 P (" -- '0', '1', '2', '3', '4', '5', '6', '7',");
217 P (" -- '8', '9', ':', ';', '<', '=', '>', '?',");
220 P (" -- '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G',");
221 P (" -- 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',");
224 P (" -- 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',");
225 P (" -- 'X', 'Y', 'Z', '[', '\', ']', '^', '_',");
228 P (" -- '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g',");
229 P (" -- 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',");
232 P (" -- 'p', 'q', 'r', 's', 't', 'u', 'v', 'w',");
233 P (" -- 'x', 'y', 'z', '{', '|', '}', '~', del,");
236 P (" -- reserved_128, reserved_129, bph, nbh,");
237 P (" -- reserved_132, nel, ssa, esa,");
240 P (" -- hts, htj, vts, pld, plu, ri, ss2, ss3,");
243 P (" -- dcs, pu1, pu2, sts, cch, mw, spa, epa,");
246 P (" -- sos, reserved_153, sci, csi,");
247 P (" -- st, osc, pm, apc,");
253 P (" -- The declaration of type Wide_Character is based " &
255 P (" -- ISO 10646 BMP character set.");
258 P (" -- Note: this type cannot be represented accurately in Ada");
261 P (" -- The first 256 positions have the same contents as " &
265 P (" -- type Wide_Character is (nul, soh ... FFFE, FFFF);");
268 P (" package ASCII is");
271 P (" -- Control characters:");
274 P (" NUL : constant Character := Character'Val (16#00#);");
275 P (" SOH : constant Character := Character'Val (16#01#);");
276 P (" STX : constant Character := Character'Val (16#02#);");
277 P (" ETX : constant Character := Character'Val (16#03#);");
278 P (" EOT : constant Character := Character'Val (16#04#);");
279 P (" ENQ : constant Character := Character'Val (16#05#);");
280 P (" ACK : constant Character := Character'Val (16#06#);");
281 P (" BEL : constant Character := Character'Val (16#07#);");
282 P (" BS : constant Character := Character'Val (16#08#);");
283 P (" HT : constant Character := Character'Val (16#09#);");
284 P (" LF : constant Character := Character'Val (16#0A#);");
285 P (" VT : constant Character := Character'Val (16#0B#);");
286 P (" FF : constant Character := Character'Val (16#0C#);");
287 P (" CR : constant Character := Character'Val (16#0D#);");
288 P (" SO : constant Character := Character'Val (16#0E#);");
289 P (" SI : constant Character := Character'Val (16#0F#);");
290 P (" DLE : constant Character := Character'Val (16#10#);");
291 P (" DC1 : constant Character := Character'Val (16#11#);");
292 P (" DC2 : constant Character := Character'Val (16#12#);");
293 P (" DC3 : constant Character := Character'Val (16#13#);");
294 P (" DC4 : constant Character := Character'Val (16#14#);");
295 P (" NAK : constant Character := Character'Val (16#15#);");
296 P (" SYN : constant Character := Character'Val (16#16#);");
297 P (" ETB : constant Character := Character'Val (16#17#);");
298 P (" CAN : constant Character := Character'Val (16#18#);");
299 P (" EM : constant Character := Character'Val (16#19#);");
300 P (" SUB : constant Character := Character'Val (16#1A#);");
301 P (" ESC : constant Character := Character'Val (16#1B#);");
302 P (" FS : constant Character := Character'Val (16#1C#);");
303 P (" GS : constant Character := Character'Val (16#1D#);");
304 P (" RS : constant Character := Character'Val (16#1E#);");
305 P (" US : constant Character := Character'Val (16#1F#);");
306 P (" DEL : constant Character := Character'Val (16#7F#);");
309 P (" -- Other characters:");
312 P (" Exclam : constant Character := '!';");
313 P (" Quotation : constant Character := '""';");
314 P (" Sharp : constant Character := '#';");
315 P (" Dollar : constant Character := '$';");
316 P (" Percent : constant Character := '%';");
317 P (" Ampersand : constant Character := '&';");
318 P (" Colon : constant Character := ':';");
319 P (" Semicolon : constant Character := ';';");
320 P (" Query : constant Character := '?';");
321 P (" At_Sign : constant Character := '@';");
322 P (" L_Bracket : constant Character := '[';");
323 P (" Back_Slash : constant Character := '\';");
324 P (" R_Bracket : constant Character := ']';");
325 P (" Circumflex : constant Character := '^';");
326 P (" Underline : constant Character := '_';");
327 P (" Grave : constant Character := '`';");
328 P (" L_Brace : constant Character := '{';");
329 P (" Bar : constant Character := '|';");
330 P (" R_Brace : constant Character := '}';");
331 P (" Tilde : constant Character := '~';");
334 P (" -- Lower case letters:");
337 for C in Character range 'a' .. 'z' loop
338 P (" LC_" & Character'Val (Character'Pos (C) - 32) &
339 " : constant Character := '" & C & "';");
346 P (" type String is array (Positive range <>) of Character;");
347 P (" pragma Pack (String);");
350 P (" type Wide_String is array (Positive range <>) of Wide_Character;");
351 P (" pragma Pack (Wide_String);");
354 -- Here it's OK to use the Duration type of the host compiler since
355 -- the implementation of Duration in GNAT is target independent.
357 P (" type Duration is delta" &
358 Duration'Image (Duration'Delta));
359 P (" range -((2 **" & Natural'Image (Duration'Size - 1) &
360 " - 1) *" & Duration'Image (Duration'Delta) & ") ..");
361 P (" +((2 **" & Natural'Image (Duration'Size - 1) &
362 " - 1) *" & Duration'Image (Duration'Delta) & ");");
363 P (" for Duration'Small use" & Duration'Image (Duration'Small) & ";");
366 P (" Constraint_Error : exception;");
367 P (" Program_Error : exception;");
368 P (" Storage_Error : exception;");
369 P (" Tasking_Error : exception;");