* gcc.dg/vect/vect-22.c: Require vect_float.
[official-gcc.git] / gcc / ada / vms_conv.ads
blobcb59ff9bb7c1372b66473e2111be8ec1dc1580e0
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- V M S _ C O N V --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 2003-2005 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 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, 51 Franklin Street, Fifth Floor, --
20 -- Boston, MA 02110-1301, USA. --
21 -- --
22 -- GNAT was originally developed by the GNAT team at New York University. --
23 -- Extensive contributions were provided by Ada Core Technologies Inc. --
24 -- --
25 ------------------------------------------------------------------------------
27 -- This package is part of the GNAT driver. It contains the procedure
28 -- VMS_Conversion to convert a VMS command line to the equivalent command
29 -- line with switches for the GNAT tools that the GNAT driver will invoke.
30 -- The qualifier declarations are contained in package VMS_Data.
32 with Table;
33 with VMS_Data; use VMS_Data;
35 with GNAT.OS_Lib; use GNAT.OS_Lib;
37 package VMS_Conv is
39 -- A table to keep the switches on the command line
41 package Last_Switches is new Table.Table
42 (Table_Component_Type => String_Access,
43 Table_Index_Type => Integer,
44 Table_Low_Bound => 1,
45 Table_Initial => 20,
46 Table_Increment => 100,
47 Table_Name => "Gnatcmd.Last_Switches");
49 Normal_Exit : exception;
50 -- Raise this exception for normal program termination
52 Error_Exit : exception;
53 -- Raise this exception if error detected
55 Errors : Natural := 0;
56 -- Count errors detected
58 Display_Command : Boolean := False;
59 -- Set true if /? switch causes display of generated command (on VMS)
61 -------------------
62 -- Command Table --
63 -------------------
65 -- The command table contains an entry for each command recognized by
66 -- GNATCmd. The entries are represented by an array of records.
68 type Parameter_Type is
69 -- A parameter is defined as a whitespace bounded string, not begining
70 -- with a slash. (But see note under FILES_OR_WILDCARD).
71 (File,
72 -- A required file or directory parameter
74 Optional_File,
75 -- An optional file or directory parameter
77 Other_As_Is,
78 -- A parameter that's passed through as is (not canonicalized)
80 Unlimited_Files,
81 -- An unlimited number of whitespace separate file or directory
82 -- parameters including wildcard specifications.
84 Unlimited_As_Is,
85 -- Un unlimited number of whitespace separated paameters that are
86 -- passed through as is (not canonicalized).
88 Files_Or_Wildcard);
89 -- A comma separated list of files and/or wildcard file specifications.
90 -- A comma preceded by or followed by whitespace is considered as a
91 -- single comma character w/o whitespace.
93 type Parameter_Array is array (Natural range <>) of Parameter_Type;
94 type Parameter_Ref is access all Parameter_Array;
96 type Command_Type is
97 (Bind,
98 Chop,
99 Clean,
100 Compile,
101 Elim,
102 Find,
103 Krunch,
104 Link,
105 List,
106 Make,
107 Metric,
108 Name,
109 Preprocess,
110 Pretty,
111 Setup,
112 Shared,
113 Stub,
114 Xref,
115 Undefined);
117 type Alternate_Command is (Comp, Ls, Kr, Pp, Prep);
118 -- Alternate command label for non VMS system use
120 Corresponding_To : constant array (Alternate_Command) of Command_Type :=
121 (Comp => Compile,
122 Ls => List,
123 Kr => Krunch,
124 Prep => Preprocess,
125 Pp => Pretty);
126 -- Mapping of alternate commands to commands
128 subtype Real_Command_Type is Command_Type range Bind .. Xref;
130 type Command_Entry is record
131 Cname : String_Ptr;
132 -- Command name for GNAT xxx command
134 Usage : String_Ptr;
135 -- A usage string, used for error messages
137 Unixcmd : String_Ptr;
138 -- Corresponding Unix command
140 Unixsws : Argument_List_Access;
141 -- Switches for the Unix command
143 VMS_Only : Boolean;
144 -- When True, the command can only be used on VMS
146 Switches : Switches_Ptr;
147 -- Pointer to array of switch strings
149 Params : Parameter_Ref;
150 -- Describes the allowable types of parameters.
151 -- Params (1) is the type of the first parameter, etc.
152 -- An empty parameter array means this command takes no parameters.
154 Defext : String (1 .. 3);
155 -- Default extension. If non-blank, then this extension is supplied by
156 -- default as the extension for any file parameter which does not have
157 -- an extension already.
158 end record;
160 -------------------------
161 -- Internal Structures --
162 -------------------------
164 -- The switches and commands are defined by strings in the previous
165 -- section so that they are easy to modify, but internally, they are
166 -- kept in a more conveniently accessible form described in this
167 -- section.
169 -- Commands, command qualifers and options have a similar common format
170 -- so that searching for matching names can be done in a common manner.
172 type Item_Id is (Id_Command, Id_Switch, Id_Option);
174 type Translation_Type is
176 T_Direct,
177 -- A qualifier with no options.
178 -- Example: GNAT MAKE /VERBOSE
180 T_Directories,
181 -- A qualifier followed by a list of directories
182 -- Example: GNAT COMPILE /SEARCH=([], [.FOO], [.BAR])
184 T_Directory,
185 -- A qualifier followed by one directory
186 -- Example: GNAT LIBRARY /SET=[.VAXFLOATLIB]
188 T_File,
189 -- A qualifier followed by a filename
190 -- Example: GNAT LINK /EXECUTABLE=FOO.EXE
192 T_No_Space_File,
193 -- A qualifier followed by a filename
194 -- Example: GNAT MAKE /PROJECT_FILE=PRJ.GPR
196 T_Numeric,
197 -- A qualifier followed by a numeric value.
198 -- Example: GNAT CHOP /FILE_NAME_MAX_LENGTH=39
200 T_String,
201 -- A qualifier followed by a quoted string. Only used by
202 -- /IDENTIFICATION qualifier.
203 -- Example: GNAT LINK /IDENTIFICATION="3.14a1 version"
205 T_Options,
206 -- A qualifier followed by a list of options.
207 -- Example: GNAT COMPILE /REPRESENTATION_INFO=(ARRAYS,OBJECTS)
209 T_Commands,
210 -- A qualifier followed by a list. Only used for
211 -- MAKE /COMPILER_QUALIFIERS /BINDER_QUALIFIERS /LINKER_QUALIFIERS
212 -- (gnatmake -cargs -bargs -largs )
213 -- Example: GNAT MAKE ... /LINKER_QUALIFIERS /VERBOSE FOOBAR.OBJ
215 T_Other,
216 -- A qualifier passed directly to the linker. Only used
217 -- for LINK and SHARED if no other match is found.
218 -- Example: GNAT LINK FOO.ALI /SYSSHR
220 T_Alphanumplus
221 -- A qualifier followed by a legal linker symbol prefix. Only used
222 -- for BIND /BUILD_LIBRARY (gnatbind -Lxyz).
223 -- Example: GNAT BIND /BUILD_LIBRARY=foobar
226 type Item (Id : Item_Id);
227 type Item_Ptr is access all Item;
229 type Item (Id : Item_Id) is record
230 Name : String_Ptr;
231 -- Name of the command, switch (with slash) or option
233 Next : Item_Ptr;
234 -- Pointer to next item on list, always has the same Id value
236 Command : Command_Type := Undefined;
238 Unix_String : String_Ptr := null;
239 -- Corresponding Unix string. For a command, this is the unix command
240 -- name and possible default switches. For a switch or option it is
241 -- the unix switch string.
243 case Id is
245 when Id_Command =>
247 Switches : Item_Ptr;
248 -- Pointer to list of switch items for the command, linked
249 -- through the Next fields with null terminating the list.
251 Usage : String_Ptr;
252 -- Usage information, used only for errors and the default
253 -- list of commands output.
255 Params : Parameter_Ref;
256 -- Array of parameters
258 Defext : String (1 .. 3);
259 -- Default extension. If non-blank, then this extension is
260 -- supplied by default as the extension for any file parameter
261 -- which does not have an extension already.
263 when Id_Switch =>
265 Translation : Translation_Type;
266 -- Type of switch translation. For all cases, except Options,
267 -- this is the only field needed, since the Unix translation
268 -- is found in Unix_String.
270 Options : Item_Ptr;
271 -- For the Options case, this field is set to point to a list
272 -- of options item (for this case Unix_String is null in the
273 -- main switch item). The end of the list is marked by null.
275 when Id_Option =>
277 null;
278 -- No special fields needed, since Name and Unix_String are
279 -- sufficient to completely described an option.
281 end case;
282 end record;
284 subtype Command_Item is Item (Id_Command);
285 subtype Switch_Item is Item (Id_Switch);
286 subtype Option_Item is Item (Id_Option);
288 -------------------
289 -- Switch Tables --
290 -------------------
292 -- The switch tables contain an entry for each switch recognized by the
293 -- command processor. It is initialized by procedure Initialize.
295 Command_List : array (Real_Command_Type) of Command_Entry;
297 ----------------
298 -- Procedures --
299 ----------------
301 procedure Initialize;
302 -- Initialized the switch table Command_List
304 procedure Output_Version;
305 -- Output the version of this program
307 procedure VMS_Conversion (The_Command : out Command_Type);
308 -- Converts VMS command line to equivalent Unix command line
310 end VMS_Conv;