]> gcc.gnu.org Git - gcc.git/blame - gcc/ada/nlists.h
trans-io.c (set_string): Use fold_build2 and build_int_cst instead of build2 and...
[gcc.git] / gcc / ada / nlists.h
CommitLineData
38cbfe40
RK
1/****************************************************************************
2 * *
3 * GNAT COMPILER COMPONENTS *
4 * *
5 * N L I S T S *
6 * *
7 * C Header File *
8 * *
b0f26df5 9 * Copyright (C) 1992-2003, Free Software Foundation, Inc. *
38cbfe40
RK
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 *
cb5fee25
KC
19 * to the Free Software Foundation, 51 Franklin Street, Fifth Floor, *
20 * Boston, MA 02110-1301, USA. *
38cbfe40
RK
21 * *
22 * GNAT was originally developed by the GNAT team at New York University. *
71ff80dc 23 * Extensive contributions were provided by Ada Core Technologies Inc. *
38cbfe40
RK
24 * *
25 ****************************************************************************/
26
27/* This is the C header corresponding to the Ada package specification for
28 Nlists. It also contains the implementations of inlined functions from the
29 the package body for Nlists. It was generated manually from nlists.ads and
30 nlists.adb and must be kept synchronized with changes in these files.
31
32 Note that only routines for reading the tree are included, since the
33 tree transformer is not supposed to modify the tree in any way. */
34
35/* The following is the structure used for the list headers table */
36
37struct List_Header
38{
39 Node_Id first;
40 Node_Id last;
41 Node_Id parent;
42};
43
44/* The list headers are stored in an array. The pointer to this array is
45 passed as a parameter to gigi and stored in the global variable
07fc65c4 46 List_Headers_Ptr. */
38cbfe40
RK
47
48extern struct List_Header *List_Headers_Ptr;
49
07fc65c4
GB
50/* The previous and next links for lists are held in two arrays, Next_Node and
51 Prev_Node. The pointers to these arrays are passed as parameters to gigi
52 and stored in the global variables Prev_Node_Ptr and Next_Node_Ptr. */
38cbfe40
RK
53
54extern Node_Id *Next_Node_Ptr;
55extern Node_Id *Prev_Node_Ptr;
56
57/* Node List Access Functions */
58
b4e2d709 59static Node_Id First (List_Id);
38cbfe40
RK
60
61INLINE Node_Id
b4e2d709 62First (List_Id List)
38cbfe40 63{
07fc65c4 64 return List_Headers_Ptr[List - First_List_Id].first;
38cbfe40
RK
65}
66
67#define First_Non_Pragma nlists__first_non_pragma
b4e2d709 68extern Node_Id First_Non_Pragma (Node_Id);
38cbfe40 69
b4e2d709 70static Node_Id Last (List_Id);
38cbfe40
RK
71
72INLINE Node_Id
b4e2d709 73Last (List_Id List)
38cbfe40 74{
07fc65c4 75 return List_Headers_Ptr[List - First_List_Id].last;
38cbfe40
RK
76}
77
78#define First_Non_Pragma nlists__first_non_pragma
b4e2d709 79extern Node_Id First_Non_Pragma (List_Id);
38cbfe40 80
b4e2d709 81static Node_Id Next (Node_Id);
38cbfe40
RK
82
83INLINE Node_Id
b4e2d709 84Next (Node_Id Node)
38cbfe40 85{
07fc65c4 86 return Next_Node_Ptr[Node - First_Node_Id];
38cbfe40
RK
87}
88
89#define Next_Non_Pragma nlists__next_non_pragma
b4e2d709 90extern Node_Id Next_Non_Pragma (List_Id);
38cbfe40 91
b4e2d709 92static Node_Id Prev (Node_Id);
38cbfe40
RK
93
94INLINE Node_Id
b4e2d709 95Prev (Node_Id Node)
38cbfe40 96{
07fc65c4 97 return Prev_Node_Ptr[Node - First_Node_Id];
38cbfe40
RK
98}
99
100
101#define Prev_Non_Pragma nlists__prev_non_pragma
b4e2d709 102extern Node_Id Prev_Non_Pragma (Node_Id);
38cbfe40 103
b4e2d709
NN
104static Boolean Is_Empty_List (List_Id);
105static Boolean Is_Non_Empty_List (List_Id);
106static Boolean Is_List_Member (Node_Id);
107static List_Id List_Containing (Node_Id);
38cbfe40
RK
108
109INLINE Boolean
b4e2d709 110Is_Empty_List (List_Id Id)
38cbfe40
RK
111{
112 return (First (Id) == Empty);
113}
114
115INLINE Boolean
b4e2d709 116Is_Non_Empty_List (List_Id Id)
38cbfe40
RK
117{
118 return (Present (Id) && First (Id) != Empty);
119}
120
121INLINE Boolean
b4e2d709 122Is_List_Member (Node_Id Node)
38cbfe40 123{
07fc65c4 124 return Nodes_Ptr[Node - First_Node_Id].U.K.in_list;
38cbfe40
RK
125}
126
127INLINE List_Id
b4e2d709 128List_Containing (Node_Id Node)
38cbfe40 129{
07fc65c4 130 return Nodes_Ptr[Node - First_Node_Id].V.NX.link;
38cbfe40 131}
This page took 1.051495 seconds and 5 git commands to generate.