1------------------------------------------------------------------------------
2--                                                                          --
3--                         GNAT COMPILER COMPONENTS                         --
4--                                                                          --
5--                  M L I B . T G T . V M S _ C O M M O N                   --
6--                                                                          --
7--                                 B o d y                                  --
8--                                                                          --
9--          Copyright (C) 2003-2011, 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--  This is the part of MLib.Tgt.Specific common to both VMS versions
27
28with System.Case_Util; use System.Case_Util;
29
30package body MLib.Tgt.VMS_Common is
31
32   --  Non default subprograms. See comments in mlib-tgt.ads
33
34   function Archive_Ext return String;
35
36   function Default_Symbol_File_Name return String;
37
38   function DLL_Ext return String;
39
40   function Is_Object_Ext (Ext : String) return Boolean;
41
42   function Is_Archive_Ext (Ext : String) return Boolean;
43
44   function Libgnat return String;
45
46   function Object_Ext return String;
47
48   function Library_Major_Minor_Id_Supported return Boolean;
49
50   function PIC_Option return String;
51
52   -----------------
53   -- Archive_Ext --
54   -----------------
55
56   function Archive_Ext return String is
57   begin
58      return "olb";
59   end Archive_Ext;
60
61   ------------------------------
62   -- Default_Symbol_File_Name --
63   ------------------------------
64
65   function Default_Symbol_File_Name return String is
66   begin
67      return "symvec.opt";
68   end Default_Symbol_File_Name;
69
70   -------------
71   -- DLL_Ext --
72   -------------
73
74   function DLL_Ext return String is
75   begin
76      return "exe";
77   end DLL_Ext;
78
79   --------------------
80   -- Init_Proc_Name --
81   --------------------
82
83   function Init_Proc_Name (Library_Name : String) return String is
84      Result : String := Library_Name & "INIT";
85   begin
86      To_Upper (Result);
87
88      if Result = "ADAINIT" then
89         return "ADA_INIT";
90
91      else
92         return Result;
93      end if;
94   end Init_Proc_Name;
95
96   -------------------
97   -- Is_Object_Ext --
98   -------------------
99
100   function Is_Object_Ext (Ext : String) return Boolean is
101   begin
102      return Ext = ".obj";
103   end Is_Object_Ext;
104
105   --------------------
106   -- Is_Archive_Ext --
107   --------------------
108
109   function Is_Archive_Ext (Ext : String) return Boolean is
110   begin
111      return Ext = ".olb" or else Ext = ".exe";
112   end Is_Archive_Ext;
113
114   -------------
115   -- Libgnat --
116   -------------
117
118   function Libgnat return String is
119      Libgnat_A : constant String := "libgnat.a";
120      Libgnat_Olb : constant String := "libgnat.olb";
121
122   begin
123      Name_Len := Libgnat_A'Length;
124      Name_Buffer (1 .. Name_Len) := Libgnat_A;
125
126      if Osint.Find_File (Name_Enter, Osint.Library) /= No_File then
127         return Libgnat_A;
128      else
129         return Libgnat_Olb;
130      end if;
131   end Libgnat;
132
133   --------------------------------------
134   -- Library_Major_Minor_Id_Supported --
135   --------------------------------------
136
137   function Library_Major_Minor_Id_Supported return Boolean is
138   begin
139      return False;
140   end Library_Major_Minor_Id_Supported;
141
142   ----------------
143   -- Object_Ext --
144   ----------------
145
146   function Object_Ext return String is
147   begin
148      return "obj";
149   end Object_Ext;
150
151   ----------------
152   -- PIC_Option --
153   ----------------
154
155   function PIC_Option return String is
156   begin
157      return "";
158   end PIC_Option;
159
160--  Package initialization
161
162begin
163   Archive_Ext_Ptr              := Archive_Ext'Access;
164   Default_Symbol_File_Name_Ptr := Default_Symbol_File_Name'Access;
165   DLL_Ext_Ptr                  := DLL_Ext'Access;
166   Is_Object_Ext_Ptr            := Is_Object_Ext'Access;
167   Is_Archive_Ext_Ptr           := Is_Archive_Ext'Access;
168   Libgnat_Ptr                  := Libgnat'Access;
169   Object_Ext_Ptr               := Object_Ext'Access;
170   PIC_Option_Ptr               := PIC_Option'Access;
171   Library_Major_Minor_Id_Supported_Ptr :=
172                                   Library_Major_Minor_Id_Supported'Access;
173
174end MLib.Tgt.VMS_Common;
175