1------------------------------------------------------------------------------
2--                                                                          --
3--                         GNAT COMPILER COMPONENTS                         --
4--                                                                          --
5--                              G N A T V S N                               --
6--                                                                          --
7--                                 B o d y                                  --
8--                                                                          --
9--          Copyright (C) 1992-2021, 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
26package body Gnatvsn is
27
28   ----------------------
29   -- Copyright_Holder --
30   ----------------------
31
32   function Copyright_Holder return String is
33   begin
34      return "Free Software Foundation, Inc.";
35   end Copyright_Holder;
36
37   ------------------------
38   -- Gnat_Free_Software --
39   ------------------------
40
41   function Gnat_Free_Software return String is
42   begin
43      return
44        "This is free software; see the source for copying conditions." &
45        ASCII.LF &
46        "There is NO warranty; not even for MERCHANTABILITY or FITNESS" &
47        " FOR A PARTICULAR PURPOSE.";
48   end Gnat_Free_Software;
49
50   type char_array is array (Natural range <>) of aliased Character;
51   C_Version_String : char_array (0 .. Ver_Len_Max - 1);
52   pragma Import (C, C_Version_String, "gnat_version_string");
53   --  Import the C string defined in the source file version.c using the
54   --  zero-based convention of the C language.  The size is not the real
55   --  one, which does not matter since we will check for the nul character.
56
57   -------------------------
58   -- Gnat_Version_String --
59   -------------------------
60
61   function Gnat_Version_String return String is
62      S : String (1 .. Ver_Len_Max);
63      Pos : Natural := 0;
64   begin
65      loop
66         exit when C_Version_String (Pos) = ASCII.NUL;
67
68         S (Pos + 1) := C_Version_String (Pos);
69         Pos := Pos + 1;
70
71         exit when Pos = Ver_Len_Max;
72      end loop;
73
74      return S (1 .. Pos);
75   end Gnat_Version_String;
76
77end Gnatvsn;
78