dependency_graph_extractor_22.0.0_992fc1c4/src/extraction-utilities.ads

 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
with Ada.Containers.Vectors;

private package Extraction.Utilities is

   type Project_Context is private;

   function Open_Project (Project : String) return Project_Context;

   package Analysis_Unit_Vectors is new Ada.Containers.Vectors
     (Index_Type => Positive, Element_Type => LAL.Analysis_Unit,
      "="        => LAL."=");

   package Project_Vectors is new Ada.Containers.Vectors
     (Index_Type => Positive, Element_Type => GPR.Project_Type,
      "="        => GPR."=");

   function Open_Analysis_Units
     (Context : Project_Context; Recurse_Projects : Boolean)
      return Analysis_Unit_Vectors.Vector;

   function Get_Projects
     (Context : Project_Context; Recurse_Projects : Boolean)
      return Project_Vectors.Vector;

   function Is_Buildable_File_In_Project_Context
     (Filename : String; Context : Project_Context) return Boolean;

   function Is_Ada_File_In_Project_Context
     (Ada_Filename     : String; Context : Project_Context;
      Recurse_Projects : Boolean) return Boolean;

   function Is_Project_Main_Program
     (Node : LAL.Ada_Node'Class; Context : Project_Context) return Boolean;

   Standard_Unit_File : constant VFS.Virtual_File;

   function Get_Unique_Filename
     (Filename        : String; Directory_Prefix : VFS.Virtual_File;
      Make_Lower_Case : Boolean) return String;
   --  Get a unique name for Filename. The name will be relative to
   --  Directory_Prefix if Directory_Prefix is a parent of Filename. For file
   --  names from the GNATPRO installation path, the installation path will be
   --  replaced by with `%GNATPRO_PATH%`.

   function Get_Unique_Filename
     (File            : VFS.Virtual_File; Directory_Prefix : VFS.Virtual_File;
      Make_Lower_Case : Boolean) return String;
   --  Get a unique name for File. The name will be relative to
   --  Directory_Prefix if Directory_Prefix is a parent of File.
   --  For files from the GNATPRO installation path, the installation path
   --  will be replaced by `%GNATPRO_PATH%`.

   function Get_Referenced_Decl (Name : LAL.Name'Class) return LAL.Basic_Decl;

   function Get_Referenced_Defining_Name
     (Name : LAL.Name'Class) return LAL.Defining_Name;

   function Get_Parent_Basic_Decl
     (Node : LAL.Ada_Node'Class) return LAL.Basic_Decl;

   function Is_Relevant_Basic_Decl (Node : LAL.Ada_Node'Class) return Boolean;

private

   use type VFS.Filesystem_String;

   type Project_Context is record
      Project_Environment : GPR.Project_Environment_Access;
      Project_Tree        : GPR.Project_Tree_Access;
      Unit_Provider       : LAL.Unit_Provider_Reference;
      Analysis_Context    : LAL.Analysis_Context;
   end record;

   Standard_Unit_Filename : constant String           := "__standard";
   Standard_Unit_File     : constant VFS.Virtual_File :=
     VFS.Create (+Standard_Unit_Filename, Normalize => True);

end Extraction.Utilities;