libgpr2_24.0.0_eda3c693/testsuite/tests/tilde-separator/main.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
with Ada.Text_IO;
with GPR2.Project.Tree;
with GPR2.Context;
with GPR2.Path_Name;
with Ada.Containers.Doubly_Linked_Lists;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
procedure Main is
   Ctx  : GPR2.Context.Object;
   Tree : GPR2.Project.Tree.Object;
   package Set is new Ada.Containers.Doubly_Linked_Lists (Unbounded_String);
   package Sort is new Set.Generic_Sorting;
   List : Set.List;

   procedure Print_And_Clean_List;
   procedure Print_And_Clean_List is
   begin
      Sort.Sort (List);
      for S of List loop
         Ada.Text_IO.Put_Line (To_String (S));
      end loop;
      List.Clear;
   end Print_And_Clean_List;

begin
   Tree.Load_Autoconf
     (GPR2.Path_Name.Create_File ("default.gpr"), Ctx);

   Tree.Update_Sources;

   for Source of Tree.Root_Project.Sources loop
      List.Append (To_Unbounded_String (String (Source.Path_Name.Name)));
   end loop;
   Print_And_Clean_List;

   for Unit of Tree.Root_Project.Units loop
      List.Append (To_Unbounded_String (String (Unit.Name)));
   end loop;
   Print_And_Clean_List;

end Main;