File : prj-part.ads


   1 ------------------------------------------------------------------------------
   2 --                                                                          --
   3 --                         GNAT COMPILER COMPONENTS                         --
   4 --                                                                          --
   5 --                              P R J . P A R T                             --
   6 --                                                                          --
   7 --                                 S p e c                                  --
   8 --                                                                          --
   9 --          Copyright (C) 2000-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 ------------------------------------------------------------------------------
  25 
  26 --  Implements the parsing of project files into a tree
  27 
  28 with Prj.Tree;  use Prj.Tree;
  29 
  30 package Prj.Part is
  31 
  32    type Errout_Mode is
  33      (Always_Finalize,
  34       Finalize_If_Error,
  35       Never_Finalize);
  36    --  Whether Parse should call Errout.Finalize (which prints the error
  37    --  messages on stdout). When Never_Finalize is used, Errout is not reset
  38    --  either at the beginning of Parse.
  39 
  40    procedure Parse
  41      (In_Tree           : Project_Node_Tree_Ref;
  42       Project           : out Project_Node_Id;
  43       Project_File_Name : String;
  44       Errout_Handling   : Errout_Mode := Always_Finalize;
  45       Packages_To_Check : String_List_Access;
  46       Store_Comments    : Boolean := False;
  47       Current_Directory : String := "";
  48       Is_Config_File    : Boolean;
  49       Env               : in out Prj.Tree.Environment;
  50       Target_Name       : String := "";
  51       Implicit_Project  : Boolean := False);
  52    --  Parse project file and all its imported project files and create a tree.
  53    --  Return the node for the project (or Empty_Node if parsing failed). If
  54    --  Always_Errout_Finalize is True, Errout.Finalize is called in all cases,
  55    --  Otherwise, Errout.Finalize is only called if there are errors (but not
  56    --  if there are only warnings). Packages_To_Check indicates the packages
  57    --  where any unknown attribute produces an error. For other packages, an
  58    --  unknown attribute produces a warning. When Store_Comments is True,
  59    --  comments are stored in the parse tree.
  60    --
  61    --  Current_Directory is used for optimization purposes only, avoiding extra
  62    --  system calls.
  63    --
  64    --  Is_Config_File should be set to True if the project represents a config
  65    --  file (.cgpr) since some specific checks apply.
  66    --
  67    --  Target_Name will be used to initialize the default project path, unless
  68    --  In_Tree.Project_Path has already been initialized (which is the
  69    --  recommended use).
  70    --
  71    --  If Implicit_Project is True, the main project file being parsed is
  72    --  deemed to be in the current working directory, even if it is not the
  73    --  case. Implicit_Project is set to True when a tool such as gprbuild is
  74    --  invoked without a project file and is using an implicit project file
  75    --  that is virtually in the current working directory, but is physically
  76    --  in another directory.
  77 
  78 end Prj.Part;