Merge from mainline (163495:164578).
[official-gcc/graphite-test-results.git] / gcc / ada / vms_conv.ads
blob7e2127f10a2ac042f8d44f0daead3f6d78ee4cb8
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-2010, 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 subtype Real_Command_Type is Command_Type range Bind .. Xref;
109 type Command_Entry is record
110 Cname : String_Ptr;
111 -- Command name for GNAT xxx command
113 Usage : String_Ptr;
114 -- A usage string, used for error messages
116 Unixcmd : String_Ptr;
117 -- Corresponding Unix command
119 Unixsws : Argument_List_Access;
120 -- Switches for the Unix command
122 VMS_Only : Boolean;
123 -- When True, the command can only be used on VMS
125 Switches : Switches_Ptr;
126 -- Pointer to array of switch strings
128 Params : Parameter_Ref;
129 -- Describes the allowable types of parameters.
130 -- Params (1) is the type of the first parameter, etc.
131 -- An empty parameter array means this command takes no parameters.
133 Defext : String (1 .. 3);
134 -- Default extension. If non-blank, then this extension is supplied by
135 -- default as the extension for any file parameter which does not have
136 -- an extension already.
137 end record;
139 -------------------
140 -- Switch Tables --
141 -------------------
143 -- The switch tables contain an entry for each switch recognized by the
144 -- command processor. It is initialized by procedure Initialize.
146 Command_List : array (Real_Command_Type) of Command_Entry;
148 ----------------
149 -- Procedures --
150 ----------------
152 procedure Initialize;
153 -- Initialized the switch table Command_List
155 procedure Output_Version;
156 -- Output the version of this program
158 procedure VMS_Conversion (The_Command : out Command_Type);
159 -- Converts VMS command line to equivalent Unix command line
161 end VMS_Conv;