File: asis_ul-environment-check_parameters.adb

package info (click to toggle)
asis 2015-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 13,640 kB
  • sloc: ada: 140,372; makefile: 260; sh: 50; xml: 48; csh: 10
file content (94 lines) | stat: -rw-r--r-- 4,071 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
------------------------------------------------------------------------------
--                                                                          --
--                            GNATPP COMPONENTS                             --
--                                                                          --
-- A S I S _ U L . E N V I R O N M E N T . C H E C K  _ P A R A M E T E R S --
--                                                                          --
--              (adapted for gnatpp from ASIS Utility Library)              --
--                                                                          --
--                                 B o d y                                  --
--                                                                          --
--                     Copyright (C) 2009-2014, AdaCore                     --
--                                                                          --
-- GNATPP is free software; you can redistribute it  and/or modify it under --
-- terms of the  GNU General Public License as published  by the Free Soft- --
-- ware  Foundation;  either version 2,  or (at your option) any later ver- --
-- sion.  GNATPP is  distributed in the  hope that it will  be  useful, but --
-- WITHOUT ANY WARRANTY; without even the implied warranty of  MERCHANTABI- --
-- LITY or  FITNESS  FOR A  PARTICULAR  PURPOSE. See the GNU General Public --
-- License  for more details. You  should  have  received a copy of the GNU --
-- General Public License  distributed with GNAT; see file COPYING. If not, --
-- write to the Free Software Foundation,  51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA.                                              --
--                                                                          --
-- GNATPP is maintained by AdaCore (http://www.adacore.com)                 --
--                                                                          --
------------------------------------------------------------------------------

pragma Ada_2012;

with Gnat2xml.Command_Line; use Gnat2xml.Command_Line;
with Gnat2xml.Projects;

separate (ASIS_UL.Environment)
procedure Check_Parameters is
begin
   if Verbose_Mode then
      Print_Version_Info (2012);
   end if;

   if Incremental_Mode and Out_Dir = null then
      Error ("in --incremental mode, must also specify --output-dir=");
      raise Parameter_Error;
   end if;

   Set_Gnat2xml_Options (Gnat2xml.Command_Line.Options);
   --  Moved here from parameter processing routine to Check_Parameters when
   --  the direct project support is added.

   --  First, read all the argument files using all available path information
   if ASIS_UL.Options.No_Argument_File_Specified then
      Error ("No input source file set");
      raise Parameter_Error;
   end if;

   Read_Args_From_Temp_Storage
     (Duplication_Report =>
        not Gnat2xml.Projects.Is_Specified (Gnat2xml.Projects.Gnat2xml_Prj),
      Arg_Project        => Gnat2xml.Projects.Gnat2xml_Prj);

   Nothing_To_Do := Last_Source < First_SF_Id;

   if Nothing_To_Do then
      Error ("No existing file to process");
      --  All the rest does not make any sense
      return;
   end if;

   if Gnat2xml.Projects.Gnat2xml_Prj.Is_Specified then
      Gnat2xml.Projects.Set_Global_Result_Dirs
        (Gnat2xml.Projects.Gnat2xml_Prj);
      Gnat2xml.Projects.Set_Individual_Source_Options
        (Gnat2xml.Projects.Gnat2xml_Prj);
      Set_Arg_List;
   end if;

   Total_Sources := Natural (Last_Source);
   Sources_Left  := Total_Sources;

   if Last_Source = First_SF_Id then
      Multiple_File_Mode := False;

      --  If we have only one source to reformat, we have to check the settings
      --  of the output file, if it is set

      Progress_Indicator_Mode := False;
      --  We do not need this in case of one file, and we may be in the mode of
      --  outputting the reformatted source into Stdout
   end if;

   if not Verbose_Mode then
      Progress_Indicator_Mode := False;
   end if;

end Check_Parameters;