1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
9 -- Copyright (C) 2003-2008, 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 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. 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 COPYING3. If not, go to --
19 -- http://www.gnu.org/licenses for a complete copy of the license. --
21 -- GNAT was originally developed by the GNAT team at New York University. --
22 -- Extensive contributions were provided by Ada Core Technologies Inc. --
24 ------------------------------------------------------------------------------
26 -- This package is part of the GNAT driver. It contains the procedure
27 -- VMS_Conversion to convert a VMS command line to the equivalent command
28 -- line with switches for the GNAT tools that the GNAT driver will invoke.
29 -- The qualifier declarations are contained in package VMS_Data.
32 with VMS_Data; use VMS_Data;
34 with GNAT.OS_Lib; use GNAT.OS_Lib;
38 -- A table to keep the switches on the command line
40 package Last_Switches is new Table.Table
41 (Table_Component_Type => String_Access,
42 Table_Index_Type => Integer,
45 Table_Increment => 100,
46 Table_Name => "Gnatcmd.Last_Switches");
48 Normal_Exit : exception;
49 -- Raise this exception for normal program termination
51 Error_Exit : exception;
52 -- Raise this exception if error detected
54 Errors : Natural := 0;
55 -- Count errors detected
57 Display_Command : Boolean := False;
58 -- Set true if /? switch causes display of generated command (on VMS)
64 -- The command table contains an entry for each command recognized by
65 -- GNATCmd. The entries are represented by an array of records.
67 type Parameter_Type is
68 -- A parameter is defined as a whitespace bounded string, not beginning
69 -- with a slash. (But see note under FILES_OR_WILDCARD).
71 -- A required file or directory parameter
74 -- An optional file or directory parameter
77 -- A parameter that's passed through as is (not canonicalized)
80 -- An unlimited number of whitespace separate file or directory
81 -- parameters including wildcard specifications.
84 -- An unlimited number of whitespace separated parameters that are
85 -- passed through as is (not canonicalized).
88 -- A comma separated list of files and/or wildcard file specifications.
89 -- A comma preceded by or followed by whitespace is considered as a
90 -- single comma character w/o whitespace.
92 type Parameter_Array is array (Natural range <>) of Parameter_Type;
93 type Parameter_Ref is access all Parameter_Array;
118 type Alternate_Command is (Comp, Ls, Kr, Pp, Prep);
119 -- Alternate command label for non VMS system use
121 Corresponding_To : constant array (Alternate_Command) of Command_Type :=
127 -- Mapping of alternate commands to commands
129 subtype Real_Command_Type is Command_Type range Bind .. Xref;
131 type Command_Entry is record
133 -- Command name for GNAT xxx command
136 -- A usage string, used for error messages
138 Unixcmd : String_Ptr;
139 -- Corresponding Unix command
141 Unixsws : Argument_List_Access;
142 -- Switches for the Unix command
145 -- When True, the command can only be used on VMS
147 Switches : Switches_Ptr;
148 -- Pointer to array of switch strings
150 Params : Parameter_Ref;
151 -- Describes the allowable types of parameters.
152 -- Params (1) is the type of the first parameter, etc.
153 -- An empty parameter array means this command takes no parameters.
155 Defext : String (1 .. 3);
156 -- Default extension. If non-blank, then this extension is supplied by
157 -- default as the extension for any file parameter which does not have
158 -- an extension already.
165 -- The switch tables contain an entry for each switch recognized by the
166 -- command processor. It is initialized by procedure Initialize.
168 Command_List : array (Real_Command_Type) of Command_Entry;
174 procedure Initialize;
175 -- Initialized the switch table Command_List
177 procedure Output_Version;
178 -- Output the version of this program
180 procedure VMS_Conversion (The_Command : out Command_Type);
181 -- Converts VMS command line to equivalent Unix command line