Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / gcc / ada / sfn_scan.ads
blob8ce848f28661f3adafb0a0f0aaa5e83b4953b23a
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- S F N _ S C A N --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 2000-2005, 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 -- This package provides a stand alone capability for scanning a gnat.adc
28 -- file for Source_File_Name pragmas. This is for use in tools other than
29 -- the compiler, which want to scan source file name pragmas without the
30 -- overhead of the full compiler scanner and parser.
32 -- Note that neither the package spec, nor the package body, of this
33 -- unit contains any with statements at all. This is a compeltely
34 -- independent package, suitable for incorporation into tools that do
35 -- not access any other units in the GNAT compiler or tools sources.
37 -- This package is NOT task safe, so multiple tasks that may call the
38 -- Scan_SFN_Pragmas procedure at the same time are responsibible for
39 -- avoiding such multiple calls by appropriate synchronization.
41 package SFN_Scan is
43 -- The call to SFN_Scan passes pointers to two procedures that are
44 -- used to store the results of scanning any Source_File_Name pragmas
45 -- that are encountered. The following access types define the form
46 -- of these procedures:
48 type Set_File_Name_Ptr is access
49 procedure
50 (Typ : Character;
51 U : String;
52 F : String;
53 Index : Natural);
54 -- The procedure with this profile is called when a Source_File_Name
55 -- pragma of the form having a unit name parameter. Typ is 'b' for
56 -- a body file name, and 's' for a spec file name. U is a string that
57 -- contains the unit name, exactly as it appeared in the source file,
58 -- and F is the file taken from the second parameter. Index is taken
59 -- from the third parameter, or is set to zero if no third parameter.
61 type Set_File_Name_Pattern_Ptr is access
62 procedure (Pat : String; Typ : Character; Dot : String; Cas : Character);
63 -- This is called to process a Source_File_Name pragma whose first
64 -- argument is a file pattern. Pat is this pattern string, which
65 -- contains an asterisk to correspond to the unit. Typ is one of
66 -- ('b'/'s'/'u') for body/spec/subunit, Dot is the separator string
67 -- for child/subunit names (default is "."), and Cas is one of
68 -- ('l'/'u'/'m') indicating the required case for the file name.
69 -- The default setting for Cas is 'l' if no parameter is present.
71 Cursor : Natural;
72 -- Used to record the cursor value if a syntax error is found
74 Syntax_Error_In_GNAT_ADC : exception;
75 -- Exception raised if a syntax error is found
77 procedure Scan_SFN_Pragmas
78 (Source : String;
79 SFN_Ptr : Set_File_Name_Ptr;
80 SFNP_Ptr : Set_File_Name_Pattern_Ptr);
81 -- This is the procedure called to scan a gnat.adc file. The Source
82 -- parameter points to the full text of the file, with normal line end
83 -- characters, in the format normally read by the compiler. The two
84 -- parameters SFN_Ptr and SFNP_Ptr point to procedures that will be
85 -- called to register Source_File_Name pragmas as they are found.
87 -- If a syntax error is found, then Syntax_Error_In_GNAT_ADC is raised,
88 -- and the location SFN_Scan.Cursor contains the approximate index of
89 -- the error in the source string.
91 -- The scan assumes that it is dealing with a valid gnat.adc file,
92 -- that includes only pragmas and comments. It does not do a full
93 -- syntax correctness scan by any means, but if it does find anything
94 -- that it can tell is wrong it will immediately raise the exception
95 -- to indicate the aproximate location of the error
97 end SFN_Scan;