OSDN Git Service

New Language: Ada
[pf3gnuchains/gcc-fork.git] / gcc / ada / elists.h
1 /****************************************************************************
2  *                                                                          *
3  *                         GNAT COMPILER COMPONENTS                         *
4  *                                                                          *
5  *                               E 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  * 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    Elists. It also contains the implementations of inlined functions from the
31    package body for Elists.  It was generated manually from elists.ads and
32    elists.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 are the structures used to hold element lists */
38
39 struct Elist_Header
40 {
41   Elmt_Id first;
42   Elmt_Id last;
43 };
44
45 struct Elmt_Item
46 {
47   Node_Id node;
48   Int next;
49 };
50
51 /* The element list headers and element descriptors themselves are stored in
52    two arrays. The pointers to these arrays are passed as a parameter to the
53    tree transformer procedure and stored in the global variables Elists_Ptr
54    and Elmts_Ptr after adjusting them by subtracting Elist_First_Entry and
55    Elmt_First_Entry, so that Elist_Id and Elmt_Id values can be used as
56    subscripts into these arrays */
57
58 extern struct Elist_Header *Elists_Ptr;
59 extern struct Elmt_Item *Elmts_Ptr;
60
61 /* Element List Access Functions:  */
62
63 static Node_Id Node             PARAMS ((Elmt_Id));
64 static Elmt_Id First_Elmt       PARAMS ((Elist_Id));
65 static Elmt_Id Last_Elmt        PARAMS ((Elist_Id));
66 static Elmt_Id Next_Elmt        PARAMS ((Elmt_Id));
67 static Boolean Is_Empty_Elmt_List PARAMS ((Elist_Id));
68
69 INLINE Node_Id
70 Node (Elmt)
71      Elmt_Id Elmt;
72 {
73   return Elmts_Ptr [Elmt].node;
74 }
75
76 INLINE Elmt_Id
77 First_Elmt (List)
78      Elist_Id List;
79 {
80   return Elists_Ptr [List].first;
81 }
82
83 INLINE Elmt_Id
84 Last_Elmt (List)
85      Elist_Id List;
86 {
87   return Elists_Ptr [List].last;
88 }
89
90 INLINE Elmt_Id
91 Next_Elmt (Node)
92      Elmt_Id Node;
93 {
94   Int N = Elmts_Ptr [Node].next;
95
96   if (IN (N, Elist_Range))
97     return No_Elmt;
98   else
99     return N;
100 }
101
102 INLINE Boolean
103 Is_Empty_Elmt_List (Id)
104      Elist_Id Id;
105 {
106   return Elists_Ptr [Id].first == No_Elmt;
107 }