1------------------------------------------------------------------------------
2--                                                                          --
3--                         GNAT COMPILER COMPONENTS                         --
4--                                                                          --
5--                       G E T _ S P A R K _ X R E F S                      --
6--                                                                          --
7--                                 S p e c                                  --
8--                                                                          --
9--          Copyright (C) 2011-2013, 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 package contains the function used to read SPARK cross-reference
27--  information from an ALI file and populate the tables defined in package
28--  SPARK_Xrefs with the result.
29
30generic
31   --  These subprograms provide access to the ALI file. Locating, opening and
32   --  providing access to the ALI file is the callers' responsibility.
33
34   with function Getc return Character is <>;
35   --  Get next character, positioning the ALI file ready to read the following
36   --  character (equivalent to calling Nextc, then Skipc). If the end of file
37   --  is encountered, the value Types.EOF is returned.
38
39   with function Nextc return Character is <>;
40   --  Look at the next character, and return it, leaving the position of the
41   --  file unchanged, so that a subsequent call to Getc or Nextc will return
42   --  this same character. If the file is positioned at the end of file, then
43   --  Types.EOF is returned.
44
45   with procedure Skipc is <>;
46   --  Skip past the current character (which typically was read with Nextc),
47   --  and position to the next character, which will be returned by the next
48   --  call to Getc or Nextc.
49
50procedure Get_SPARK_Xrefs;
51--  Load SPARK cross-reference information from ALI file text format into
52--  internal SPARK tables (SPARK_Xrefs.SPARK_Xref_Table,
53--  SPARK_Xrefs.SPARK_Scope_Table and SPARK_Xrefs.SPARK_File_Table). On entry
54--  the input file is positioned to the initial 'F' of the first SPARK specific
55--  line in the ALI file. On return, the file is positioned either to the end
56--  of file, or to the first character of the line following the SPARK specific
57--  information (which will never start with an 'F').
58--
59--  If a format error is detected in the input, then an exception is raised
60--  (Ada.IO_Exceptions.Data_Error), with the file positioned to the error.
61