1--  Meta description of nodes.
2--  Copyright (C) 2014 Tristan Gingold
3--
4--  This program is free software: you can redistribute it and/or modify
5--  it under the terms of the GNU General Public License as published by
6--  the Free Software Foundation, either version 2 of the License, or
7--  (at your option) any later version.
8--
9--  This program is distributed in the hope that it will be useful,
10--  but WITHOUT ANY WARRANTY; without even the implied warranty of
11--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12--  GNU General Public License for more details.
13--
14--  You should have received a copy of the GNU General Public License
15--  along with this program.  If not, see <gnu.org/licenses>.
16
17with Types; use Types;
18with Vhdl.Nodes; use Vhdl.Nodes;
19with Vhdl.Tokens; use Vhdl.Tokens;
20with PSL.Types; use PSL.Types;
21
22package Vhdl.Nodes_Meta is
23   --  The enumeration of all possible types in the nodes.
24   type Types_Enum is
25     (
26      --  TYPES
27     );
28
29   --  The enumeration of all fields defined in iirs.
30   type Fields_Enum is
31     (
32      --  FIELDS
33     );
34   pragma Discard_Names (Fields_Enum);
35
36   --  Return the type of field F.
37   function Get_Field_Type (F : Fields_Enum) return Types_Enum;
38
39   --  Get the name of a field.
40   function Get_Field_Image (F : Fields_Enum) return String;
41
42   --  Get the name of a kind.
43   function Get_Iir_Image (K : Iir_Kind) return String;
44
45   --  Possible attributes of a field.
46   type Field_Attribute is
47     (
48      --  ATTRS
49     );
50
51   --  Get the attribute of a field.
52   function Get_Field_Attribute (F : Fields_Enum) return Field_Attribute;
53
54   type Fields_Index_Extended is new Int32;
55   subtype Fields_Index is Fields_Index_Extended
56     range 0 .. Fields_Index_Extended'Last;
57
58   type Fields_Array is array (Fields_Index range <>) of Fields_Enum;
59
60   --  Return the list of fields for node K.  The fields are sorted: first
61   --  the non nodes/list of nodes, then the nodes/lists that aren't reference,
62   --  and then the reference.
63   function Get_Fields (K : Iir_Kind) return Fields_Array;
64
65   --  Likewise, but without using arrays (for interfacing with C).
66   function Get_Fields_First (K : Iir_Kind) return Fields_Index;
67   function Get_Fields_Last (K : Iir_Kind) return Fields_Index;
68   function Get_Field_By_Index (Idx : Fields_Index) return Fields_Enum;
69
70   --  Get/Set a field.
71   --  FUNCS
72end Vhdl.Nodes_Meta;
73