| 1 | 706 | jeremybenn | /****************************************************************************
 | 
      
         | 2 |  |  |  *                                                                          *
 | 
      
         | 3 |  |  |  *                         GNAT COMPILER COMPONENTS                         *
 | 
      
         | 4 |  |  |  *                                                                          *
 | 
      
         | 5 |  |  |  *                               N L I S T S                                *
 | 
      
         | 6 |  |  |  *                                                                          *
 | 
      
         | 7 |  |  |  *                              C Header File                               *
 | 
      
         | 8 |  |  |  *                                                                          *
 | 
      
         | 9 |  |  |  *            Copyright (C) 1992-2011, 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 along with GCC; see the file COPYING3.  If not see        *
 | 
      
         | 19 |  |  |  * <http://www.gnu.org/licenses/>.                                          *
 | 
      
         | 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 |  |  |    Nlists. It also contains the implementations of inlined functions from
 | 
      
         | 28 |  |  |    the package body for Nlists.  It was generated manually from nlists.ads and
 | 
      
         | 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
 | 
      
         | 32 |  |  |    tree transformer is not supposed to modify the tree in any way.  */
 | 
      
         | 33 |  |  |  
 | 
      
         | 34 |  |  | #ifdef __cplusplus
 | 
      
         | 35 |  |  | extern "C" {
 | 
      
         | 36 |  |  | #endif
 | 
      
         | 37 |  |  |  
 | 
      
         | 38 |  |  | /*  The following is the structure used for the list headers table */
 | 
      
         | 39 |  |  |  
 | 
      
         | 40 |  |  | struct 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
 | 
      
         | 49 |  |  |    List_Headers_Ptr.  */
 | 
      
         | 50 |  |  |  
 | 
      
         | 51 |  |  | extern struct List_Header *List_Headers_Ptr;
 | 
      
         | 52 |  |  |  
 | 
      
         | 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.  */
 | 
      
         | 56 |  |  |  
 | 
      
         | 57 |  |  | extern Node_Id *Next_Node_Ptr;
 | 
      
         | 58 |  |  | extern Node_Id *Prev_Node_Ptr;
 | 
      
         | 59 |  |  |  
 | 
      
         | 60 |  |  | /* Node List Access Functions */
 | 
      
         | 61 |  |  |  
 | 
      
         | 62 |  |  | static Node_Id First (List_Id);
 | 
      
         | 63 |  |  |  
 | 
      
         | 64 |  |  | INLINE Node_Id
 | 
      
         | 65 |  |  | First (List_Id List)
 | 
      
         | 66 |  |  | {
 | 
      
         | 67 |  |  |   return List_Headers_Ptr[List - First_List_Id].first;
 | 
      
         | 68 |  |  | }
 | 
      
         | 69 |  |  |  
 | 
      
         | 70 |  |  | #define First_Non_Pragma nlists__first_non_pragma
 | 
      
         | 71 |  |  | extern Node_Id First_Non_Pragma (Node_Id);
 | 
      
         | 72 |  |  |  
 | 
      
         | 73 |  |  | static Node_Id Last (List_Id);
 | 
      
         | 74 |  |  |  
 | 
      
         | 75 |  |  | INLINE Node_Id
 | 
      
         | 76 |  |  | Last (List_Id List)
 | 
      
         | 77 |  |  | {
 | 
      
         | 78 |  |  |   return List_Headers_Ptr[List - First_List_Id].last;
 | 
      
         | 79 |  |  | }
 | 
      
         | 80 |  |  |  
 | 
      
         | 81 |  |  | #define First_Non_Pragma nlists__first_non_pragma
 | 
      
         | 82 |  |  | extern Node_Id First_Non_Pragma (List_Id);
 | 
      
         | 83 |  |  |  
 | 
      
         | 84 |  |  | static Node_Id Next (Node_Id);
 | 
      
         | 85 |  |  |  
 | 
      
         | 86 |  |  | INLINE Node_Id
 | 
      
         | 87 |  |  | Next (Node_Id Node)
 | 
      
         | 88 |  |  | {
 | 
      
         | 89 |  |  |   return Next_Node_Ptr[Node - First_Node_Id];
 | 
      
         | 90 |  |  | }
 | 
      
         | 91 |  |  |  
 | 
      
         | 92 |  |  | #define Next_Non_Pragma nlists__next_non_pragma
 | 
      
         | 93 |  |  | extern Node_Id Next_Non_Pragma (List_Id);
 | 
      
         | 94 |  |  |  
 | 
      
         | 95 |  |  | static Node_Id Prev (Node_Id);
 | 
      
         | 96 |  |  |  
 | 
      
         | 97 |  |  | INLINE Node_Id
 | 
      
         | 98 |  |  | Prev (Node_Id Node)
 | 
      
         | 99 |  |  | {
 | 
      
         | 100 |  |  |   return Prev_Node_Ptr[Node - First_Node_Id];
 | 
      
         | 101 |  |  | }
 | 
      
         | 102 |  |  |  
 | 
      
         | 103 |  |  |  
 | 
      
         | 104 |  |  | #define Prev_Non_Pragma nlists__prev_non_pragma
 | 
      
         | 105 |  |  | extern Node_Id Prev_Non_Pragma          (Node_Id);
 | 
      
         | 106 |  |  |  
 | 
      
         | 107 |  |  | static Boolean Is_Empty_List            (List_Id);
 | 
      
         | 108 |  |  | static Boolean Is_Non_Empty_List        (List_Id);
 | 
      
         | 109 |  |  | static Boolean Is_List_Member           (Node_Id);
 | 
      
         | 110 |  |  | static List_Id List_Containing          (Node_Id);
 | 
      
         | 111 |  |  |  
 | 
      
         | 112 |  |  | INLINE Boolean
 | 
      
         | 113 |  |  | Is_Empty_List (List_Id Id)
 | 
      
         | 114 |  |  | {
 | 
      
         | 115 |  |  |   return (First (Id) == Empty);
 | 
      
         | 116 |  |  | }
 | 
      
         | 117 |  |  |  
 | 
      
         | 118 |  |  | INLINE Boolean
 | 
      
         | 119 |  |  | Is_Non_Empty_List (List_Id Id)
 | 
      
         | 120 |  |  | {
 | 
      
         | 121 |  |  |   return (Present (Id) && First (Id) != Empty);
 | 
      
         | 122 |  |  | }
 | 
      
         | 123 |  |  |  
 | 
      
         | 124 |  |  | INLINE Boolean
 | 
      
         | 125 |  |  | Is_List_Member (Node_Id Node)
 | 
      
         | 126 |  |  | {
 | 
      
         | 127 |  |  |   return Nodes_Ptr[Node - First_Node_Id].U.K.in_list;
 | 
      
         | 128 |  |  | }
 | 
      
         | 129 |  |  |  
 | 
      
         | 130 |  |  | INLINE List_Id
 | 
      
         | 131 |  |  | List_Containing (Node_Id Node)
 | 
      
         | 132 |  |  | {
 | 
      
         | 133 |  |  |   return Nodes_Ptr[Node - First_Node_Id].V.NX.link;
 | 
      
         | 134 |  |  | }
 | 
      
         | 135 |  |  |  
 | 
      
         | 136 |  |  | #ifdef __cplusplus
 | 
      
         | 137 |  |  | }
 | 
      
         | 138 |  |  | #endif
 |