OSDN Git Service

* sem_ch3.adb (Find_Type_Of_Subtype_Indic): If subtype indication
[pf3gnuchains/gcc-fork.git] / gcc / ada / mdllfile.adb
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT COMPILER COMPONENTS                         --
4 --                                                                          --
5 --                            M D L L . F I L E S                           --
6 --                                                                          --
7 --                                 B o d y                                  --
8 --                                                                          --
9 --                            $Revision: 1.2 $                              --
10 --                                                                          --
11 --          Copyright (C) 1992-1999 Free Software Foundation, Inc.          --
12 --                                                                          --
13 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
14 -- terms of the  GNU General Public License as published  by the Free Soft- --
15 -- ware  Foundation;  either version 2,  or (at your option) any later ver- --
16 -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
17 -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
18 -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
19 -- for  more details.  You should have  received  a copy of the GNU General --
20 -- Public License  distributed with GNAT;  see file COPYING.  If not, write --
21 -- to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
22 -- MA 02111-1307, USA.                                                      --
23 --                                                                          --
24 -- GNAT was originally developed  by the GNAT team at  New York University. --
25 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
26 --                                                                          --
27 ------------------------------------------------------------------------------
28
29 --  Simple services used by GNATDLL to deal with Filename extension.
30
31 with Ada.Strings.Fixed;
32
33 package body MDLL.Files is
34
35    use Ada;
36
37    -------------
38    -- Get_Ext --
39    -------------
40
41    function Get_Ext (Filename : in String)
42                      return String
43    is
44       use Strings.Fixed;
45       I : constant Natural := Index (Filename, ".", Strings.Backward);
46    begin
47       if I = 0 then
48          return "";
49       else
50          return Filename (I .. Filename'Last);
51       end if;
52    end Get_Ext;
53
54    ------------
55    -- Is_Ali --
56    ------------
57
58    function Is_Ali (Filename : in String)
59                     return Boolean is
60    begin
61       return Get_Ext (Filename) = ".ali";
62    end Is_Ali;
63
64    ------------
65    -- Is_Obj --
66    ------------
67
68    function Is_Obj (Filename : in String)
69                     return Boolean
70    is
71       Ext : constant String := Get_Ext (Filename);
72    begin
73       return Ext = ".o" or else Ext = ".obj";
74    end Is_Obj;
75
76    ------------
77    -- Ext_To --
78    ------------
79
80    function Ext_To (Filename : in String;
81                     New_Ext  : in String := No_Ext)
82                     return String
83    is
84       use Strings.Fixed;
85       I : constant Natural := Index (Filename, ".", Strings.Backward);
86    begin
87       if I = 0 then
88          return Filename;
89       else
90          if New_Ext = "" then
91             return Head (Filename, I - 1);
92          else
93             return Head (Filename, I - 1) & '.' & New_Ext;
94          end if;
95       end if;
96    end Ext_To;
97
98 end MDLL.Files;