Some fixes for profile test cases for autofdo
[official-gcc.git] / gcc / ada / prep.ads
blob801167ee5fb6631dc64dd5d554995e8ab3f1e219
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- P R E P --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 2002-2008, 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 ------------------------------------------------------------------------------
26 with GNAT.Dynamic_Tables;
28 with Namet; use Namet;
29 with Types; use Types;
31 package Prep is
33 -----------------
34 -- Symbol Data --
35 -----------------
37 type Symbol_Data is record
38 Symbol : Name_Id := No_Name;
39 -- The symbol in lower case
41 Original : Name_Id := No_Name;
42 -- The symbol as originally given in the definition file or on
43 -- the command line.
45 On_The_Command_Line : Boolean := False;
46 -- Set to True if symbol is defined on the command line.
47 -- Used to prevent replacement of command line symbols by definition
48 -- file symbols.
50 Is_A_String : Boolean := False;
51 -- Indicate if the value of the symbol has been specified as a string
52 -- or simply as a sequence of characters.
54 Value : String_Id := No_String;
55 -- The value of the symbol (string or sequence of characters)
57 end record;
59 True_Value : Symbol_Data :=
60 (Symbol => No_Name,
61 Original => No_Name,
62 On_The_Command_Line => False,
63 Is_A_String => False,
64 Value => No_String);
66 type Symbol_Id is new Nat;
67 No_Symbol : constant Symbol_Id := 0;
69 package Symbol_Table is new GNAT.Dynamic_Tables
70 (Table_Component_Type => Symbol_Data,
71 Table_Index_Type => Symbol_Id,
72 Table_Low_Bound => 1,
73 Table_Initial => 10,
74 Table_Increment => 100);
75 -- The table of all symbols
77 Mapping : Symbol_Table.Instance;
78 -- The mapping table of symbols to values used by procedure Parse_Def_File
79 -- and Preprocess.
81 function Index_Of (Symbol : Name_Id) return Symbol_Id;
82 -- Return the index in the Mapping table of Symbol.
83 -- Return No_Symbol if Symbol in not in the Mapping table.
85 -- Access to procedure types used by procedure Initialize below:
87 type Error_Msg_Proc is access procedure
88 (Msg : String; Flag_Location : Source_Ptr);
90 type Scan_Proc is access procedure;
92 type Set_Ignore_Errors_Proc is access procedure (To : Boolean);
94 type Put_Char_Proc is access procedure (C : Character);
96 type New_EOL_Proc is access procedure;
98 procedure Initialize;
99 -- Initialize the preprocessor's global structures
101 procedure Setup_Hooks
102 (Error_Msg : Error_Msg_Proc;
103 Scan : Scan_Proc;
104 Set_Ignore_Errors : Set_Ignore_Errors_Proc;
105 Put_Char : Put_Char_Proc;
106 New_EOL : New_EOL_Proc);
107 -- Set the i/o hooks used by the preprocessor
109 procedure Parse_Def_File;
110 -- Parse the definition file. The definition file must have already been
111 -- loaded and the scanner initialized.
113 procedure Preprocess (Source_Modified : out Boolean);
114 -- Preprocess the input file. The input file must have already been loaded
115 -- and the scanner initialized. Source_Modified is set to True iff the
116 -- preprocessor modified the source text.
118 procedure Check_Command_Line_Symbol_Definition
119 (Definition : String;
120 Data : out Symbol_Data);
121 -- Check the validity of a command line definition <symbol>=<value>.
122 -- Return the symbol and its value in Data if the definition is valid,
123 -- fail if it is not valid.
125 procedure Change_Reserved_Keyword_To_Symbol
126 (All_Keywords : Boolean := False);
127 -- If Token is an Ada reserved word (other than IF, ELSIF, ELSE,
128 -- END, AND, OR, THEN when All_Keywords is False), change it to
129 -- Tok_Identifier with the corresponding Token_Name.
131 procedure List_Symbols (Foreword : String);
132 -- List the symbols used for preprocessing a file, with their values.
133 -- If Foreword is not empty, Output Foreword before the list.
135 end Prep;