libgpr2_24.0.0_eda3c693/src/lib/gpr2-project-registry-pack-description.adb

  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
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
--
--  Copyright (C) 2019-2023, AdaCore
--
--  SPDX-License-Identifier: Apache-2.0 WITH LLVM-Exception
--

package body GPR2.Project.Registry.Pack.Description is

   -----------------------------
   -- Get_Package_Description --
   -----------------------------

   function Get_Package_Description (Key : Package_Id) return String is
   begin
      if Pack_Package_Description.Contains (Package_Description, Key)
      then
         return Pack_Package_Description.Element (Package_Description, Key);
      else
         return "";
      end if;
   end Get_Package_Description;

   ----------
   -- Hash --
   ----------

   function Hash (Key : Package_Id)
                  return Hash_Type is (Ada.Strings.Hash (Image (Key)));

   -----------------------------
   -- Set_Package_Description --
   -----------------------------

   procedure Set_Package_Description
     (Key : Package_Id; Description : String) is
      use Pack_Package_Description;

      C : constant Cursor := Find (Package_Description, Key);
   begin
      if C = No_Element then
         Insert (Package_Description, Key, Description);
      else
         Replace_Element (Package_Description, C, Description);
      end if;
   end Set_Package_Description;

begin

   --  Binder
   Set_Package_Description
     (Binder,
      "This package specifies characteristics useful when invoking the binder "
      & "either directly via the gnat driver or when using GPRbuild.");

   --  Builder
   Set_Package_Description
     (Builder,
      "This package specifies the compilation options used when building an "
      & "executable or a library for a project. Most of the options should be "
      & "set in one of Compiler, Binder or Linker packages, but there are "
      & "some general options that should be defined in this package.");

   --  Clean
   Set_Package_Description
     (Clean,
      "This package specifies the options used when cleaning a project or a "
      & "project tree using the tools gnatclean or gprclean.");

   --  Compiler
   Set_Package_Description
     (Compiler,
      "This package specifies the compilation options used by the compiler "
      & "for each language.");

   --  Gnatls
   Set_Package_Description
     (Gnatls,
      "This package specifies the options to use when invoking gnatls via the "
      & "gnat driver.");

   --  Install
   Set_Package_Description
     (Install,
      "This package specifies the options used when installing a project with "
      & "gprinstall.");

   --  Linker
   Set_Package_Description
     (Linker,
      "This package specifies the options used by the linker.");

   --  Naming
   Set_Package_Description
     (Naming,
      "This package specifies the naming conventions that apply to the source "
      & "files in a project. In particular, these conventions are used to "
      & "automatically find all source files in the source directories, or "
      & "given a file name to find out its language for proper processing.");

   --  Remote
   Set_Package_Description
     (Remote,
      "This package is used by GPRbuild to describe how distributed "
      & "compilation should be done.");

end GPR2.Project.Registry.Pack.Description;