Debian Codegraph @

gcc/ada/gnatvsn.adb

raw
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-2025, 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
26 package 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 "There is NO" &
46 ASCII.LF &
47 "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR " &
48 "PURPOSE.";
49 end Gnat_Free_Software;
50
51 type char_array is array (Natural range <>) of aliased Character;
52 C_Version_String : char_array (0 .. Ver_Len_Max - 1);
53 pragma Import (C, C_Version_String, "gnat_version_string");
54 -- Import the C string defined in the source file version.c using the
55 -- zero-based convention of the C language. The size is not the real
56 -- one, which does not matter since we will check for the nul character.
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 C_Version_String (Pos) = ASCII.NUL;
68
69 S (Pos + 1) := C_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
78 end Gnatvsn;