libadalang_tools_24.0.0_d864b5a8/testsuite/tests/pp/S225-027/in/utils-tool_names.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
with Ada.Strings;       use Ada.Strings;
with Ada.Strings.Fixed; use Ada.Strings.Fixed;

package body Utils.Tool_Names is

   ------------
   -- Target --
   ------------

   function Target return String is
      Tgt_Last : constant Natural := Index (Tool_Name, "-", Backward);
      AAMP_Idx : constant Natural := Index (Tool_Name, "gnaamp");
   begin
      if AAMP_Idx = Tool_Name'First then
         return "AAMP";
      elsif Tgt_Last > 0 then
         return Tool_Name (Tool_Name'First .. Tgt_Last - 1);
      else
         return "";
      end if;
   end Target;

   ---------------------
   -- Basic_Tool_Name --
   ---------------------

   function Basic_Tool_Name return String is
      Tgt_Last : constant Natural := Index (Tool_Name, "-", Backward);
   begin
      if Tgt_Last > 0 then
         return Tool_Name (Tgt_Last + 1 .. Tool_Name'Last);
      else
         return Tool_Name;
      end if;
   end Basic_Tool_Name;

end Utils.Tool_Names;