OSDN Git Service

* 41intnam.ads, 42intnam.ads, 4aintnam.ads, 4cintnam.ads,
[pf3gnuchains/gcc-fork.git] / gcc / ada / nlists.h
1 /****************************************************************************
2  *                                                                          *
3  *                         GNAT COMPILER COMPONENTS                         *
4  *                                                                          *
5  *                               N L I S T S                                *
6  *                                                                          *
7  *                              C Header File                               *
8  *                                                                          *
9  *                            $Revision$
10  *                                                                          *
11  *          Copyright (C) 1992-2001, Free Software Foundation, Inc.         *
12  *                                                                          *
13  * GNAT is free software;  you can  redistribute it  and/or modify it under *
14  * terms of the  GNU General Public License as published  by the Free Soft- *
15  * ware  Foundation;  either version 2,  or (at your option) any later ver- *
16  * sion.  GNAT is distributed in the hope that it will be useful, but WITH- *
17  * OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY *
18  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License *
19  * for  more details.  You should have  received  a copy of the GNU General *
20  * Public License  distributed with GNAT;  see file COPYING.  If not, write *
21  * to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, *
22  * MA 02111-1307, USA.                                                      *
23  *                                                                          *
24  * GNAT was originally developed  by the GNAT team at  New York University. *
25  * It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). *
26  *                                                                          *
27  ****************************************************************************/
28
29 /* This is the C header corresponding to the Ada package specification for
30    Nlists. It also contains the implementations of inlined functions from the
31    the package body for Nlists.  It was generated manually from nlists.ads and
32    nlists.adb and must be kept synchronized with changes in these files.
33
34    Note that only routines for reading the tree are included, since the
35    tree transformer is not supposed to modify the tree in any way. */
36
37 /*  The following is the structure used for the list headers table */
38
39 struct List_Header
40 {
41   Node_Id first;
42   Node_Id last;
43   Node_Id parent;
44 };
45
46 /* The list headers are stored in an array.  The pointer to this array is
47    passed as a parameter to gigi and stored in the global variable
48    List_Headers_Ptr.  */
49
50 extern struct List_Header *List_Headers_Ptr;
51
52 /* The previous and next links for lists are held in two arrays, Next_Node and
53    Prev_Node.  The pointers to these arrays are passed as parameters to gigi
54    and stored in the global variables Prev_Node_Ptr and Next_Node_Ptr.  */
55
56 extern Node_Id *Next_Node_Ptr;
57 extern Node_Id *Prev_Node_Ptr;
58
59 /* Node List Access Functions */
60
61 static Node_Id First PARAMS ((List_Id));
62
63 INLINE Node_Id
64 First (List)
65      List_Id List;
66 {
67   return List_Headers_Ptr[List - First_List_Id].first;
68 }
69
70 #define First_Non_Pragma nlists__first_non_pragma
71 extern Node_Id First_Non_Pragma PARAMS ((Node_Id));
72
73 static Node_Id Last PARAMS ((List_Id));
74
75 INLINE Node_Id
76 Last (List)
77      List_Id List;
78 {
79   return List_Headers_Ptr[List - First_List_Id].last;
80 }
81
82 #define First_Non_Pragma nlists__first_non_pragma
83 extern Node_Id First_Non_Pragma PARAMS ((List_Id));
84
85 static Node_Id Next PARAMS ((Node_Id));
86
87 INLINE Node_Id
88 Next (Node)
89      Node_Id Node;
90 {
91   return Next_Node_Ptr[Node - First_Node_Id];
92 }
93
94 #define Next_Non_Pragma nlists__next_non_pragma
95 extern Node_Id Next_Non_Pragma PARAMS ((List_Id));
96
97 static Node_Id Prev PARAMS ((Node_Id));
98
99 INLINE Node_Id
100 Prev (Node)
101      Node_Id Node;
102 {
103   return Prev_Node_Ptr[Node - First_Node_Id];
104 }
105
106
107 #define Prev_Non_Pragma nlists__prev_non_pragma
108 extern Node_Id Prev_Non_Pragma          PARAMS ((Node_Id));
109
110 static Boolean Is_Empty_List            PARAMS ((List_Id));
111 static Boolean Is_Non_Empty_List        PARAMS ((List_Id));
112 static Boolean Is_List_Member           PARAMS ((Node_Id));
113 static List_Id List_Containing          PARAMS ((Node_Id));
114
115 INLINE Boolean
116 Is_Empty_List (Id)
117      List_Id Id;
118 {
119   return (First (Id) == Empty);
120 }
121
122 INLINE Boolean
123 Is_Non_Empty_List (Id)
124      List_Id Id;
125 {
126   return (Present (Id) && First (Id) != Empty);
127 }
128
129 INLINE Boolean
130 Is_List_Member (Node)
131      Node_Id Node;
132 {
133   return Nodes_Ptr[Node - First_Node_Id].U.K.in_list;
134 }
135
136 INLINE List_Id
137 List_Containing (Node)
138      Node_Id Node;
139 {
140   return Nodes_Ptr[Node - First_Node_Id].V.NX.link;
141 }