Merge with main truk.
[official-gcc.git] / gcc / ada / vms_conv.ads
blobbba701505df6e29a4c84e63b7c13d4191880748b
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-2013, 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 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. --
20 -- --
21 -- GNAT was originally developed by the GNAT team at New York University. --
22 -- Extensive contributions were provided by Ada Core Technologies Inc. --
23 -- --
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.
31 with Table;
32 with VMS_Data; use VMS_Data;
33 with VMS_Cmds; use VMS_Cmds;
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 beginning
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 -- An unlimited number of whitespace separated parameters 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 Alternate_Command is (Comp, Ls, Kr, Pp, Prep);
97 -- Alternate command label for non VMS system use
99 Corresponding_To : constant array (Alternate_Command) of Command_Type :=
100 (Comp => Compile,
101 Ls => List,
102 Kr => Krunch,
103 Prep => Preprocess,
104 Pp => Pretty);
105 -- Mapping of alternate commands to commands
107 type Command_Entry is record
108 Cname : String_Ptr;
109 -- Command name for GNAT xxx command
111 Usage : String_Ptr;
112 -- A usage string, used for error messages
114 Unixcmd : String_Ptr;
115 -- Corresponding Unix command
117 Unixsws : Argument_List_Access;
118 -- Switches for the Unix command
120 VMS_Only : Boolean;
121 -- When True, the command can only be used on VMS
123 Switches : Switches_Ptr;
124 -- Pointer to array of switch strings
126 Params : Parameter_Ref;
127 -- Describes the allowable types of parameters.
128 -- Params (1) is the type of the first parameter, etc.
129 -- An empty parameter array means this command takes no parameters.
131 Defext : String (1 .. 3);
132 -- Default extension. If non-blank, then this extension is supplied by
133 -- default as the extension for any file parameter which does not have
134 -- an extension already.
135 end record;
137 -------------------
138 -- Switch Tables --
139 -------------------
141 -- The switch tables contain an entry for each switch recognized by the
142 -- command processor. It is initialized by procedure Initialize.
144 Command_List : array (Real_Command_Type) of Command_Entry;
146 ----------------
147 -- Procedures --
148 ----------------
150 procedure Initialize;
151 -- Initialized the switch table Command_List
153 procedure Output_Version;
154 -- Output the version of this program
156 procedure VMS_Conversion (The_Command : out Command_Type);
157 -- Converts VMS command line to equivalent Unix command line
159 end VMS_Conv;