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-2020, 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   Version_String : char_array (0 .. Ver_Len_Max - 1);
52   --  Import the C string defined in the (language-independent) source file
53   --  version.c using the zero-based convention of the C language.
54   --  The size is not the real one, which does not matter since we will
55   --  check for the nul character in Gnat_Version_String.
56   pragma Import (C, Version_String, "version_string");
57
58   -------------------------
59   -- Gnat_Version_String --
60   -------------------------
61
62   function Gnat_Version_String return String is
63      S : String (1 .. Ver_Len_Max);
64      Pos : Natural := 0;
65   begin
66      loop
67         exit when Version_String (Pos) = ASCII.NUL;
68
69         S (Pos + 1) := Version_String (Pos);
70         Pos := Pos + 1;
71
72         exit when Pos = Ver_Len_Max;
73      end loop;
74
75      return S (1 .. Pos);
76   end Gnat_Version_String;
77
78end Gnatvsn;
79