Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / gcc / ada / sinput-p.adb
blob102e437809ef91a8804a831dba9ac1af01db1f89
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- S I N P U T . P --
6 -- --
7 -- B o d y --
8 -- --
9 -- Copyright (C) 1992-2003 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 2, 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 COPYING. If not, write --
19 -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
20 -- Boston, MA 02110-1301, USA. --
21 -- --
22 -- GNAT was originally developed by the GNAT team at New York University. --
23 -- Extensive contributions were provided by Ada Core Technologies Inc. --
24 -- --
25 ------------------------------------------------------------------------------
27 with Prj.Err;
28 with Sinput.C;
30 package body Sinput.P is
32 First : Boolean := True;
33 -- Flag used when Load_Project_File is called the first time,
34 -- to set Main_Source_File.
35 -- The flag is reset to False at the first call to Load_Project_File
37 -----------------------
38 -- Load_Project_File --
39 -----------------------
41 function Load_Project_File (Path : String) return Source_File_Index is
42 X : Source_File_Index;
44 begin
45 X := Sinput.C.Load_File (Path);
47 if First then
48 Main_Source_File := X;
49 First := False;
50 end if;
52 return X;
53 end Load_Project_File;
55 --------------------------------
56 -- Restore_Project_Scan_State --
57 --------------------------------
59 procedure Restore_Project_Scan_State
60 (Saved_State : in Saved_Project_Scan_State)
62 begin
63 Restore_Scan_State (Saved_State.Scan_State);
64 Source := Saved_State.Source;
65 Current_Source_File := Saved_State.Current_Source_File;
66 end Restore_Project_Scan_State;
68 -----------------------------
69 -- Save_Project_Scan_State --
70 -----------------------------
72 procedure Save_Project_Scan_State
73 (Saved_State : out Saved_Project_Scan_State)
75 begin
76 Save_Scan_State (Saved_State.Scan_State);
77 Saved_State.Source := Source;
78 Saved_State.Current_Source_File := Current_Source_File;
79 end Save_Project_Scan_State;
81 ----------------------------
82 -- Source_File_Is_Subunit --
83 ----------------------------
85 function Source_File_Is_Subunit (X : Source_File_Index) return Boolean is
86 begin
87 Prj.Err.Scanner.Initialize_Scanner (No_Unit, X);
89 -- We scan past junk to the first interesting compilation unit
90 -- token, to see if it is SEPARATE. We ignore WITH keywords during
91 -- this and also PRIVATE. The reason for ignoring PRIVATE is that
92 -- it handles some error situations, and also it is possible that
93 -- a PRIVATE WITH feature might be approved some time in the future.
95 while Token = Tok_With
96 or else Token = Tok_Private
97 or else (Token not in Token_Class_Cunit and then Token /= Tok_EOF)
98 loop
99 Prj.Err.Scanner.Scan;
100 end loop;
102 return Token = Tok_Separate;
103 end Source_File_Is_Subunit;
105 end Sinput.P;