]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/ada/nlists.h
[Ada] Variable-sized node types
[thirdparty/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 * *
8d0d46f4 9 * Copyright (C) 1992-2021, 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- *
d70c0bd6 13 * ware Foundation; either version 3, or (at your option) any later ver- *
38cbfe40
RK
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 *
d70c0bd6
NC
17 * for more details. You should have received a copy of the GNU General *
18 * Public License along with GCC; see the file COPYING3. If not see *
19 * <http://www.gnu.org/licenses/>. *
38cbfe40
RK
20 * *
21 * GNAT was originally developed by the GNAT team at New York University. *
71ff80dc 22 * Extensive contributions were provided by Ada Core Technologies Inc. *
38cbfe40
RK
23 * *
24 ****************************************************************************/
25
c7732bbe
EB
26/* This is the C header that corresponds to the Ada package specification for
27 Nlists. It also contains the implementation of inlined functions from the
28 package body for Nlists. It was created manually from nlists.ads and
38cbfe40
RK
29 nlists.adb and must be kept synchronized with changes in these files.
30
31 Note that only routines for reading the tree are included, since the
9e9bd455
LG
32 tree transformer is not supposed to modify the tree in any way. */
33
34#ifdef __cplusplus
35extern "C" {
36#endif
38cbfe40
RK
37
38/* The following is the structure used for the list headers table */
39
40struct List_Header
41{
42 Node_Id first;
43 Node_Id last;
44 Node_Id parent;
45};
46
47/* The list headers are stored in an array. The pointer to this array is
48 passed as a parameter to gigi and stored in the global variable
07fc65c4 49 List_Headers_Ptr. */
38cbfe40
RK
50
51extern struct List_Header *List_Headers_Ptr;
52
07fc65c4
GB
53/* The previous and next links for lists are held in two arrays, Next_Node and
54 Prev_Node. The pointers to these arrays are passed as parameters to gigi
55 and stored in the global variables Prev_Node_Ptr and Next_Node_Ptr. */
38cbfe40
RK
56
57extern Node_Id *Next_Node_Ptr;
58extern Node_Id *Prev_Node_Ptr;
59
60/* Node List Access Functions */
61
b4e2d709 62static Node_Id First (List_Id);
38cbfe40
RK
63
64INLINE Node_Id
b4e2d709 65First (List_Id List)
38cbfe40 66{
07fc65c4 67 return List_Headers_Ptr[List - First_List_Id].first;
38cbfe40
RK
68}
69
70#define First_Non_Pragma nlists__first_non_pragma
b4e2d709 71extern Node_Id First_Non_Pragma (Node_Id);
38cbfe40 72
b4e2d709 73static Node_Id Last (List_Id);
38cbfe40
RK
74
75INLINE Node_Id
b4e2d709 76Last (List_Id List)
38cbfe40 77{
07fc65c4 78 return List_Headers_Ptr[List - First_List_Id].last;
38cbfe40
RK
79}
80
81#define First_Non_Pragma nlists__first_non_pragma
b4e2d709 82extern Node_Id First_Non_Pragma (List_Id);
38cbfe40 83
b4e2d709 84static Node_Id Next (Node_Id);
38cbfe40
RK
85
86INLINE Node_Id
b4e2d709 87Next (Node_Id Node)
38cbfe40 88{
07fc65c4 89 return Next_Node_Ptr[Node - First_Node_Id];
38cbfe40
RK
90}
91
92#define Next_Non_Pragma nlists__next_non_pragma
b4e2d709 93extern Node_Id Next_Non_Pragma (List_Id);
38cbfe40 94
b4e2d709 95static Node_Id Prev (Node_Id);
38cbfe40
RK
96
97INLINE Node_Id
b4e2d709 98Prev (Node_Id Node)
38cbfe40 99{
07fc65c4 100 return Prev_Node_Ptr[Node - First_Node_Id];
38cbfe40
RK
101}
102
103
104#define Prev_Non_Pragma nlists__prev_non_pragma
b4e2d709 105extern Node_Id Prev_Non_Pragma (Node_Id);
38cbfe40 106
b4e2d709 107static Boolean Is_Empty_List (List_Id);
38cbfe40
RK
108
109INLINE Boolean
b4e2d709 110Is_Empty_List (List_Id Id)
38cbfe40
RK
111{
112 return (First (Id) == Empty);
113}
114
9e9bd455
LG
115#ifdef __cplusplus
116}
117#endif