Daily bump.
[official-gcc.git] / gcc / ada / nlists.h
blob33a30236d560e5dd35ebd545feafcf5c619937f4
1 /****************************************************************************
2 * *
3 * GNAT COMPILER COMPONENTS *
4 * *
5 * N L I S T S *
6 * *
7 * C Header File *
8 * *
9 * $Revision: 1.1 $
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 * Extensive contributions were provided by Ada Core Technologies Inc. *
26 * *
27 ****************************************************************************/
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.
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. */
37 /* The following is the structure used for the list headers table */
39 struct List_Header
41 Node_Id first;
42 Node_Id last;
43 Node_Id parent;
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 after adjusting it by subtracting List_First_Entry,
49 so that List_Id values can be used as subscripts. */
51 extern struct List_Header *List_Headers_Ptr;
53 /* The previous and next links for lists are held in two arrays, Next_Node
54 and Prev_Node. The pointers to these arrays are passed as parameters
55 to gigi and stored in the global variables Prev_Node_Ptr and Next_Node_Ptr
56 after adjusting them by subtracting First_Node_Id so that Node_Id values
57 can be used as subscripts. */
59 extern Node_Id *Next_Node_Ptr;
60 extern Node_Id *Prev_Node_Ptr;
62 /* Node List Access Functions */
64 static Node_Id First PARAMS ((List_Id));
66 INLINE Node_Id
67 First (List)
68 List_Id List;
70 return List_Headers_Ptr [List].first;
73 #define First_Non_Pragma nlists__first_non_pragma
74 extern Node_Id First_Non_Pragma PARAMS((Node_Id));
76 static Node_Id Last PARAMS ((List_Id));
78 INLINE Node_Id
79 Last (List)
80 List_Id List;
82 return List_Headers_Ptr [List].last;
85 #define First_Non_Pragma nlists__first_non_pragma
86 extern Node_Id First_Non_Pragma PARAMS((List_Id));
88 static Node_Id Next PARAMS ((Node_Id));
90 INLINE Node_Id
91 Next (Node)
92 Node_Id Node;
94 return Next_Node_Ptr [Node];
97 #define Next_Non_Pragma nlists__next_non_pragma
98 extern Node_Id Next_Non_Pragma PARAMS((List_Id));
100 static Node_Id Prev PARAMS ((Node_Id));
102 INLINE Node_Id
103 Prev (Node)
104 Node_Id Node;
106 return Prev_Node_Ptr [Node];
110 #define Prev_Non_Pragma nlists__prev_non_pragma
111 extern Node_Id Prev_Non_Pragma PARAMS((Node_Id));
113 static Boolean Is_Empty_List PARAMS ((List_Id));
114 static Boolean Is_Non_Empty_List PARAMS ((List_Id));
115 static Boolean Is_List_Member PARAMS ((Node_Id));
116 static List_Id List_Containing PARAMS ((Node_Id));
118 INLINE Boolean
119 Is_Empty_List (Id)
120 List_Id Id;
122 return (First (Id) == Empty);
125 INLINE Boolean
126 Is_Non_Empty_List (Id)
127 List_Id Id;
129 return (Present (Id) && First (Id) != Empty);
132 INLINE Boolean
133 Is_List_Member (Node)
134 Node_Id Node;
136 return Nodes_Ptr [Node].U.K.in_list;
139 INLINE List_Id
140 List_Containing (Node)
141 Node_Id Node;
143 return Nodes_Ptr [Node].V.NX.link;