* config/xtensa/xtensa.h (GO_IF_MODE_DEPENDENT_ADDRESS): Treat
[official-gcc.git] / gcc / ada / gnatpsta.adb
blob6a3d582e1c769677c13953b2e455d2de05983cff
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT SYSTEM UTILITIES --
4 -- --
5 -- G N A T P S T A --
6 -- --
7 -- B o d y --
8 -- --
9 -- --
10 -- Copyright (C) 1997-2001 Free Software Foundation, Inc. --
11 -- --
12 -- GNAT is free software; you can redistribute it and/or modify it under --
13 -- terms of the GNU General Public License as published by the Free Soft- --
14 -- ware Foundation; either version 2, or (at your option) any later ver- --
15 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
16 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
17 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
18 -- for more details. You should have received a copy of the GNU General --
19 -- Public License distributed with GNAT; see file COPYING. If not, write --
20 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
21 -- MA 02111-1307, USA. --
22 -- --
23 -- GNAT was originally developed by the GNAT team at New York University. --
24 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
25 -- --
26 ------------------------------------------------------------------------------
28 -- Program to print out listing of Standard package for the target (not
29 -- the host) with all constants appearing explicitly. This is not really
30 -- valid Ada, since one cannot really define new base types, but it is a
31 -- helpful listing from a documentation point of view.
33 -- Note that special care has been taken to use the host parameters for
34 -- integer and floating point sizes.
36 with Ada.Text_IO; use Ada.Text_IO;
37 with Gnatvsn;
38 with Ttypef; use Ttypef;
39 with Ttypes; use Ttypes;
40 with Types; use Types;
42 procedure GnatPsta is
43 pragma Ident (Gnatvsn.Gnat_Version_String);
45 procedure P (Item : String) renames Ada.Text_IO.Put_Line;
47 procedure P_Int_Range (Size : Pos; Put_First : Boolean := True);
48 -- Prints the range of an integer based on its Size. If Put_First is
49 -- False, then skip the first bound.
51 procedure P_Float_Range (Nb_Digits : Pos);
52 -- Prints the maximum range of a Float whose 'Digits is given by Nb_Digits
54 -------------------
55 -- P_Float_Range --
56 -------------------
58 procedure P_Float_Range (Nb_Digits : Pos) is
59 begin
60 -- This routine assumes only IEEE floats.
61 -- ??? Should the following be adapted for OpenVMS ?
63 case Nb_Digits is
64 when IEEES_Digits =>
65 P (" range " & IEEES_First'Universal_Literal_String & " .. " &
66 IEEES_Last'Universal_Literal_String & ";");
67 when IEEEL_Digits =>
68 P (" range " & IEEEL_First'Universal_Literal_String & " .. " &
69 IEEEL_Last'Universal_Literal_String & ";");
70 when IEEEX_Digits =>
71 P (" range " & IEEEX_First'Universal_Literal_String & " .. " &
72 IEEEX_Last'Universal_Literal_String & ";");
74 when others =>
75 P (";");
76 end case;
78 -- If one of the floating point types of the host computer has the
79 -- same digits as the target float we are processing, then print out
80 -- the float range using the host computer float type.
82 if Nb_Digits = Short_Float'Digits then
83 P (" -- " &
84 Short_Float'First'Img & " .. " & Short_Float'Last'Img);
86 elsif Nb_Digits = Float'Digits then
87 P (" -- " &
88 Float'First'Img & " .. " & Float'Last'Img);
90 elsif Nb_Digits = Long_Float'Digits then
91 P (" -- " &
92 Long_Float'First'Img & " .. " & Long_Float'Last'Img);
94 elsif Nb_Digits = Long_Long_Float'Digits then
95 P (" -- " &
96 Long_Long_Float'First'Img & " .. " & Long_Long_Float'Last'Img);
97 end if;
99 New_Line;
100 end P_Float_Range;
102 -----------------
103 -- P_Int_Range --
104 -----------------
106 procedure P_Int_Range (Size : Pos; Put_First : Boolean := True) is
107 begin
108 if Put_First then
109 Put (" is range -(2 **" & Pos'Image (Size - 1) & ")");
110 end if;
111 P (" .. +(2 **" & Pos'Image (Size - 1) & " - 1);");
112 end P_Int_Range;
114 -- Start of processing for GnatPsta
116 begin
117 P ("package Standard is");
118 P ("pragma Pure(Standard);");
119 New_Line;
121 P (" type Boolean is (False, True);");
122 New_Line;
124 -- Integer types
126 Put (" type Integer");
127 P_Int_Range (Standard_Integer_Size);
128 New_Line;
130 Put (" subtype Natural is Integer range 0");
131 P_Int_Range (Standard_Integer_Size, Put_First => False);
133 Put (" subtype Positive is Integer range 1");
134 P_Int_Range (Standard_Integer_Size, Put_First => False);
135 New_Line;
137 Put (" type Short_Short_Integer");
138 P_Int_Range (Standard_Short_Short_Integer_Size);
140 Put (" type Short_Integer ");
141 P_Int_Range (Standard_Short_Integer_Size);
143 Put (" type Long_Integer ");
144 P_Int_Range (Standard_Long_Integer_Size);
146 Put (" type Long_Long_Integer ");
147 P_Int_Range (Standard_Long_Long_Integer_Size);
148 New_Line;
150 -- Floating point types
152 P (" type Short_Float is digits"
153 & Standard_Short_Float_Digits'Img);
154 P_Float_Range (Standard_Short_Float_Digits);
156 P (" type Float is digits"
157 & Standard_Float_Digits'Img);
158 P_Float_Range (Standard_Float_Digits);
160 P (" type Long_Float is digits"
161 & Standard_Long_Float_Digits'Img);
162 P_Float_Range (Standard_Long_Float_Digits);
164 P (" type Long_Long_Float is digits"
165 & Standard_Long_Long_Float_Digits'Img);
166 P_Float_Range (Standard_Long_Long_Float_Digits);
168 P (" -- function ""*"" (Left : root_integer; Right : root_real)");
169 P (" -- return root_real;");
170 New_Line;
172 P (" -- function ""*"" (Left : root_real; Right : root_integer)");
173 P (" -- return root_real;");
174 New_Line;
176 P (" -- function ""/"" (Left : root_real; Right : root_integer)");
177 P (" -- return root_real;");
178 New_Line;
180 P (" -- function ""*"" (Left : universal_fixed; " &
181 "Right : universal_fixed)");
182 P (" -- return universal_fixed;");
183 New_Line;
185 P (" -- function ""/"" (Left : universal_fixed; " &
186 "Right : universal_fixed)");
187 P (" -- return universal_fixed;");
188 New_Line;
190 P (" -- The declaration of type Character is based on the standard");
191 P (" -- ISO 8859-1 character set.");
192 New_Line;
194 P (" -- There are no character literals corresponding to the positions");
195 P (" -- for control characters. They are indicated by lower case");
196 P (" -- identifiers in the following list.");
197 New_Line;
199 P (" -- Note: this type cannot be represented accurately in Ada");
200 New_Line;
202 P (" -- type Character is");
203 New_Line;
205 P (" -- (nul, soh, stx, etx, eot, enq, ack, bel,");
206 P (" -- bs, ht, lf, vt, ff, cr, so, si,");
207 New_Line;
209 P (" -- dle, dc1, dc2, dc3, dc4, nak, syn, etb,");
210 P (" -- can, em, sub, esc, fs, gs, rs, us,");
211 New_Line;
213 P (" -- ' ', '!', '""', '#', '$', '%', '&', ''',");
214 P (" -- '(', ')', '*', '+', ',', '-', '.', '/',");
215 New_Line;
217 P (" -- '0', '1', '2', '3', '4', '5', '6', '7',");
218 P (" -- '8', '9', ':', ';', '<', '=', '>', '?',");
219 New_Line;
221 P (" -- '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G',");
222 P (" -- 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',");
223 New_Line;
225 P (" -- 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',");
226 P (" -- 'X', 'Y', 'Z', '[', '\', ']', '^', '_',");
227 New_Line;
229 P (" -- '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g',");
230 P (" -- 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',");
231 New_Line;
233 P (" -- 'p', 'q', 'r', 's', 't', 'u', 'v', 'w',");
234 P (" -- 'x', 'y', 'z', '{', '|', '}', '~', del,");
235 New_Line;
237 P (" -- reserved_128, reserved_129, bph, nbh,");
238 P (" -- reserved_132, nel, ssa, esa,");
239 New_Line;
241 P (" -- hts, htj, vts, pld, plu, ri, ss2, ss3,");
242 New_Line;
244 P (" -- dcs, pu1, pu2, sts, cch, mw, spa, epa,");
245 New_Line;
247 P (" -- sos, reserved_153, sci, csi,");
248 P (" -- st, osc, pm, apc,");
249 New_Line;
251 P (" -- ... );");
252 New_Line;
254 P (" -- The declaration of type Wide_Character is based " &
255 "on the standard");
256 P (" -- ISO 10646 BMP character set.");
257 New_Line;
259 P (" -- Note: this type cannot be represented accurately in Ada");
260 New_Line;
262 P (" -- The first 256 positions have the same contents as " &
263 "type Character");
264 New_Line;
266 P (" -- type Wide_Character is (nul, soh ... FFFE, FFFF);");
267 New_Line;
269 P (" package ASCII is");
270 New_Line;
272 P (" -- Control characters:");
273 New_Line;
275 P (" NUL : constant Character := Character'Val (16#00#);");
276 P (" SOH : constant Character := Character'Val (16#01#);");
277 P (" STX : constant Character := Character'Val (16#02#);");
278 P (" ETX : constant Character := Character'Val (16#03#);");
279 P (" EOT : constant Character := Character'Val (16#04#);");
280 P (" ENQ : constant Character := Character'Val (16#05#);");
281 P (" ACK : constant Character := Character'Val (16#06#);");
282 P (" BEL : constant Character := Character'Val (16#07#);");
283 P (" BS : constant Character := Character'Val (16#08#);");
284 P (" HT : constant Character := Character'Val (16#09#);");
285 P (" LF : constant Character := Character'Val (16#0A#);");
286 P (" VT : constant Character := Character'Val (16#0B#);");
287 P (" FF : constant Character := Character'Val (16#0C#);");
288 P (" CR : constant Character := Character'Val (16#0D#);");
289 P (" SO : constant Character := Character'Val (16#0E#);");
290 P (" SI : constant Character := Character'Val (16#0F#);");
291 P (" DLE : constant Character := Character'Val (16#10#);");
292 P (" DC1 : constant Character := Character'Val (16#11#);");
293 P (" DC2 : constant Character := Character'Val (16#12#);");
294 P (" DC3 : constant Character := Character'Val (16#13#);");
295 P (" DC4 : constant Character := Character'Val (16#14#);");
296 P (" NAK : constant Character := Character'Val (16#15#);");
297 P (" SYN : constant Character := Character'Val (16#16#);");
298 P (" ETB : constant Character := Character'Val (16#17#);");
299 P (" CAN : constant Character := Character'Val (16#18#);");
300 P (" EM : constant Character := Character'Val (16#19#);");
301 P (" SUB : constant Character := Character'Val (16#1A#);");
302 P (" ESC : constant Character := Character'Val (16#1B#);");
303 P (" FS : constant Character := Character'Val (16#1C#);");
304 P (" GS : constant Character := Character'Val (16#1D#);");
305 P (" RS : constant Character := Character'Val (16#1E#);");
306 P (" US : constant Character := Character'Val (16#1F#);");
307 P (" DEL : constant Character := Character'Val (16#7F#);");
308 New_Line;
310 P (" -- Other characters:");
311 New_Line;
313 P (" Exclam : constant Character := '!';");
314 P (" Quotation : constant Character := '""';");
315 P (" Sharp : constant Character := '#';");
316 P (" Dollar : constant Character := '$';");
317 P (" Percent : constant Character := '%';");
318 P (" Ampersand : constant Character := '&';");
319 P (" Colon : constant Character := ':';");
320 P (" Semicolon : constant Character := ';';");
321 P (" Query : constant Character := '?';");
322 P (" At_Sign : constant Character := '@';");
323 P (" L_Bracket : constant Character := '[';");
324 P (" Back_Slash : constant Character := '\';");
325 P (" R_Bracket : constant Character := ']';");
326 P (" Circumflex : constant Character := '^';");
327 P (" Underline : constant Character := '_';");
328 P (" Grave : constant Character := '`';");
329 P (" L_Brace : constant Character := '{';");
330 P (" Bar : constant Character := '|';");
331 P (" R_Brace : constant Character := '}';");
332 P (" Tilde : constant Character := '~';");
333 New_Line;
335 P (" -- Lower case letters:");
336 New_Line;
338 for C in Character range 'a' .. 'z' loop
339 P (" LC_" & Character'Val (Character'Pos (C) - 32) &
340 " : constant Character := '" & C & "';");
341 end loop;
342 New_Line;
344 P (" end ASCII;");
345 New_Line;
347 P (" type String is array (Positive range <>) of Character;");
348 P (" pragma Pack (String);");
349 New_Line;
351 P (" type Wide_String is array (Positive range <>) of Wide_Character;");
352 P (" pragma Pack (Wide_String);");
353 New_Line;
355 -- Here it's OK to use the Duration type of the host compiler since
356 -- the implementation of Duration in GNAT is target independent.
358 P (" type Duration is delta" &
359 Duration'Image (Duration'Delta));
360 P (" range -((2 **" & Natural'Image (Duration'Size - 1) &
361 " - 1) *" & Duration'Image (Duration'Delta) & ") ..");
362 P (" +((2 **" & Natural'Image (Duration'Size - 1) &
363 " - 1) *" & Duration'Image (Duration'Delta) & ");");
364 P (" for Duration'Small use" & Duration'Image (Duration'Small) & ";");
365 New_Line;
367 P (" Constraint_Error : exception;");
368 P (" Program_Error : exception;");
369 P (" Storage_Error : exception;");
370 P (" Tasking_Error : exception;");
371 New_Line;
373 P ("end Standard;");
374 end GnatPsta;