| 1 |
281 |
jeremybenn |
/****************************************************************************
|
| 2 |
|
|
* *
|
| 3 |
|
|
* GNAT COMPILER COMPONENTS *
|
| 4 |
|
|
* *
|
| 5 |
|
|
* E L I S T S *
|
| 6 |
|
|
* *
|
| 7 |
|
|
* C Header File *
|
| 8 |
|
|
* *
|
| 9 |
|
|
* Copyright (C) 1992-2007, Free Software Foundation, Inc. *
|
| 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 3, 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 COPYING3. If not, go to *
|
| 19 |
|
|
* http://www.gnu.org/licenses for a complete copy of the license. *
|
| 20 |
|
|
* *
|
| 21 |
|
|
* GNAT was originally developed by the GNAT team at New York University. *
|
| 22 |
|
|
* Extensive contributions were provided by Ada Core Technologies Inc. *
|
| 23 |
|
|
* *
|
| 24 |
|
|
****************************************************************************/
|
| 25 |
|
|
|
| 26 |
|
|
/* This is the C header corresponding to the Ada package specification for
|
| 27 |
|
|
Elists. It also contains the implementations of inlined functions from the
|
| 28 |
|
|
package body for Elists. It was generated manually from elists.ads and
|
| 29 |
|
|
elists.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
|
| 32 |
|
|
tree transformer is not supposed to modify the tree in any way. */
|
| 33 |
|
|
|
| 34 |
|
|
/* The following are the structures used to hold element lists */
|
| 35 |
|
|
|
| 36 |
|
|
struct Elist_Header
|
| 37 |
|
|
{
|
| 38 |
|
|
Elmt_Id first;
|
| 39 |
|
|
Elmt_Id last;
|
| 40 |
|
|
};
|
| 41 |
|
|
|
| 42 |
|
|
struct Elmt_Item
|
| 43 |
|
|
{
|
| 44 |
|
|
Node_Id node;
|
| 45 |
|
|
Int next;
|
| 46 |
|
|
};
|
| 47 |
|
|
|
| 48 |
|
|
/* The element list headers and element descriptors themselves are stored in
|
| 49 |
|
|
two arrays. The pointers to these arrays are passed as a parameter to the
|
| 50 |
|
|
tree transformer procedure and stored in the global variables Elists_Ptr
|
| 51 |
|
|
and Elmts_Ptr. */
|
| 52 |
|
|
|
| 53 |
|
|
extern struct Elist_Header *Elists_Ptr;
|
| 54 |
|
|
extern struct Elmt_Item *Elmts_Ptr;
|
| 55 |
|
|
|
| 56 |
|
|
/* Element List Access Functions: */
|
| 57 |
|
|
|
| 58 |
|
|
static Node_Id Node (Elmt_Id);
|
| 59 |
|
|
static Elmt_Id First_Elmt (Elist_Id);
|
| 60 |
|
|
static Elmt_Id Last_Elmt (Elist_Id);
|
| 61 |
|
|
static Elmt_Id Next_Elmt (Elmt_Id);
|
| 62 |
|
|
static Boolean Is_Empty_Elmt_List (Elist_Id);
|
| 63 |
|
|
|
| 64 |
|
|
INLINE Node_Id
|
| 65 |
|
|
Node (Elmt_Id Elmt)
|
| 66 |
|
|
{
|
| 67 |
|
|
return Elmts_Ptr[Elmt - First_Elmt_Id].node;
|
| 68 |
|
|
}
|
| 69 |
|
|
|
| 70 |
|
|
INLINE Elmt_Id
|
| 71 |
|
|
First_Elmt (Elist_Id List)
|
| 72 |
|
|
{
|
| 73 |
|
|
return Elists_Ptr[List - First_Elist_Id].first;
|
| 74 |
|
|
}
|
| 75 |
|
|
|
| 76 |
|
|
INLINE Elmt_Id
|
| 77 |
|
|
Last_Elmt (Elist_Id List)
|
| 78 |
|
|
{
|
| 79 |
|
|
return Elists_Ptr[List - First_Elist_Id].last;
|
| 80 |
|
|
}
|
| 81 |
|
|
|
| 82 |
|
|
INLINE Elmt_Id
|
| 83 |
|
|
Next_Elmt (Elmt_Id Node)
|
| 84 |
|
|
{
|
| 85 |
|
|
Int N = Elmts_Ptr[Node - First_Elmt_Id].next;
|
| 86 |
|
|
|
| 87 |
|
|
if (IN (N, Elist_Range))
|
| 88 |
|
|
return No_Elmt;
|
| 89 |
|
|
else
|
| 90 |
|
|
return N;
|
| 91 |
|
|
}
|
| 92 |
|
|
|
| 93 |
|
|
INLINE Boolean
|
| 94 |
|
|
Is_Empty_Elmt_List (Elist_Id Id)
|
| 95 |
|
|
{
|
| 96 |
|
|
return Elists_Ptr[Id - First_Elist_Id].first == No_Elmt;
|
| 97 |
|
|
}
|