1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
9 -- Copyright (C) 2001-2003 Free Software Foundation, Inc. --
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 --
19 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
20 -- MA 02111-1307, USA. --
22 -- GNAT was originally developed by the GNAT team at New York University. --
23 -- Extensive contributions were provided by Ada Core Technologies Inc. --
25 ------------------------------------------------------------------------------
27 package body Prj.Tree is
29 use Tree_Private_Part;
31 --------------------------------
32 -- Associative_Array_Index_Of --
33 --------------------------------
35 function Associative_Array_Index_Of
36 (Node : Project_Node_Id)
43 (Project_Nodes.Table (Node).Kind = N_Attribute_Declaration
45 Project_Nodes.Table (Node).Kind = N_Attribute_Reference));
46 return Project_Nodes.Table (Node).Value;
47 end Associative_Array_Index_Of;
49 ----------------------------
50 -- Associative_Package_Of --
51 ----------------------------
53 function Associative_Package_Of
54 (Node : Project_Node_Id)
55 return Project_Node_Id
61 (Project_Nodes.Table (Node).Kind = N_Attribute_Declaration));
62 return Project_Nodes.Table (Node).Field3;
63 end Associative_Package_Of;
65 ----------------------------
66 -- Associative_Project_Of --
67 ----------------------------
69 function Associative_Project_Of
70 (Node : Project_Node_Id)
71 return Project_Node_Id
77 (Project_Nodes.Table (Node).Kind = N_Attribute_Declaration));
78 return Project_Nodes.Table (Node).Field2;
79 end Associative_Project_Of;
81 ----------------------
82 -- Case_Insensitive --
83 ----------------------
85 function Case_Insensitive (Node : Project_Node_Id) return Boolean is
90 (Project_Nodes.Table (Node).Kind = N_Attribute_Declaration
92 Project_Nodes.Table (Node).Kind = N_Attribute_Reference));
93 return Project_Nodes.Table (Node).Case_Insensitive;
96 --------------------------------
97 -- Case_Variable_Reference_Of --
98 --------------------------------
100 function Case_Variable_Reference_Of
101 (Node : Project_Node_Id)
102 return Project_Node_Id
108 Project_Nodes.Table (Node).Kind = N_Case_Construction);
109 return Project_Nodes.Table (Node).Field1;
110 end Case_Variable_Reference_Of;
112 -----------------------
113 -- Current_Item_Node --
114 -----------------------
116 function Current_Item_Node
117 (Node : Project_Node_Id)
118 return Project_Node_Id
124 Project_Nodes.Table (Node).Kind = N_Declarative_Item);
125 return Project_Nodes.Table (Node).Field1;
126 end Current_Item_Node;
132 function Current_Term
133 (Node : Project_Node_Id)
134 return Project_Node_Id
140 Project_Nodes.Table (Node).Kind = N_Term);
141 return Project_Nodes.Table (Node).Field1;
144 --------------------------
145 -- Default_Project_Node --
146 --------------------------
148 function Default_Project_Node
149 (Of_Kind : Project_Node_Kind;
150 And_Expr_Kind : Variable_Kind := Undefined)
151 return Project_Node_Id
154 Project_Nodes.Increment_Last;
155 Project_Nodes.Table (Project_Nodes.Last) :=
157 Location => No_Location,
158 Directory => No_Name,
159 Expr_Kind => And_Expr_Kind,
160 Variables => Empty_Node,
161 Packages => Empty_Node,
162 Pkg_Id => Empty_Package,
164 Path_Name => No_Name,
166 Field1 => Empty_Node,
167 Field2 => Empty_Node,
168 Field3 => Empty_Node,
169 Case_Insensitive => False);
170 return Project_Nodes.Last;
171 end Default_Project_Node;
177 function Directory_Of (Node : Project_Node_Id) return Name_Id is
182 Project_Nodes.Table (Node).Kind = N_Project);
183 return Project_Nodes.Table (Node).Directory;
186 ------------------------
187 -- Expression_Kind_Of --
188 ------------------------
190 function Expression_Kind_Of (Node : Project_Node_Id) return Variable_Kind is
195 (Project_Nodes.Table (Node).Kind = N_Literal_String
197 Project_Nodes.Table (Node).Kind = N_Attribute_Declaration
199 Project_Nodes.Table (Node).Kind = N_Variable_Declaration
201 Project_Nodes.Table (Node).Kind = N_Typed_Variable_Declaration
203 Project_Nodes.Table (Node).Kind = N_Package_Declaration
205 Project_Nodes.Table (Node).Kind = N_Expression
207 Project_Nodes.Table (Node).Kind = N_Term
209 Project_Nodes.Table (Node).Kind = N_Variable_Reference
211 Project_Nodes.Table (Node).Kind = N_Attribute_Reference));
213 return Project_Nodes.Table (Node).Expr_Kind;
214 end Expression_Kind_Of;
220 function Expression_Of
221 (Node : Project_Node_Id)
222 return Project_Node_Id
228 (Project_Nodes.Table (Node).Kind = N_Attribute_Declaration
230 Project_Nodes.Table (Node).Kind = N_Typed_Variable_Declaration
232 Project_Nodes.Table (Node).Kind = N_Variable_Declaration));
234 return Project_Nodes.Table (Node).Field1;
237 -------------------------
238 -- Extended_Project_Of --
239 -------------------------
241 function Extended_Project_Of
242 (Node : Project_Node_Id)
243 return Project_Node_Id
249 Project_Nodes.Table (Node).Kind = N_Project_Declaration);
250 return Project_Nodes.Table (Node).Field2;
251 end Extended_Project_Of;
253 ------------------------------
254 -- Extended_Project_Path_Of --
255 ------------------------------
257 function Extended_Project_Path_Of
258 (Node : Project_Node_Id)
265 Project_Nodes.Table (Node).Kind = N_Project);
266 return Project_Nodes.Table (Node).Value;
267 end Extended_Project_Path_Of;
269 --------------------------
270 -- Extending_Project_Of --
271 --------------------------
272 function Extending_Project_Of
273 (Node : Project_Node_Id)
274 return Project_Node_Id
280 Project_Nodes.Table (Node).Kind = N_Project_Declaration);
281 return Project_Nodes.Table (Node).Field3;
282 end Extending_Project_Of;
284 ---------------------------
285 -- External_Reference_Of --
286 ---------------------------
288 function External_Reference_Of
289 (Node : Project_Node_Id)
290 return Project_Node_Id
296 Project_Nodes.Table (Node).Kind = N_External_Value);
297 return Project_Nodes.Table (Node).Field1;
298 end External_Reference_Of;
300 -------------------------
301 -- External_Default_Of --
302 -------------------------
304 function External_Default_Of
305 (Node : Project_Node_Id)
306 return Project_Node_Id
312 Project_Nodes.Table (Node).Kind = N_External_Value);
313 return Project_Nodes.Table (Node).Field2;
314 end External_Default_Of;
316 ------------------------
317 -- First_Case_Item_Of --
318 ------------------------
320 function First_Case_Item_Of
321 (Node : Project_Node_Id)
322 return Project_Node_Id
328 Project_Nodes.Table (Node).Kind = N_Case_Construction);
329 return Project_Nodes.Table (Node).Field2;
330 end First_Case_Item_Of;
332 ---------------------
333 -- First_Choice_Of --
334 ---------------------
336 function First_Choice_Of
337 (Node : Project_Node_Id)
338 return Project_Node_Id
344 Project_Nodes.Table (Node).Kind = N_Case_Item);
345 return Project_Nodes.Table (Node).Field1;
348 -------------------------------
349 -- First_Declarative_Item_Of --
350 -------------------------------
352 function First_Declarative_Item_Of
353 (Node : Project_Node_Id)
354 return Project_Node_Id
360 (Project_Nodes.Table (Node).Kind = N_Project_Declaration
362 Project_Nodes.Table (Node).Kind = N_Case_Item
364 Project_Nodes.Table (Node).Kind = N_Package_Declaration));
366 if Project_Nodes.Table (Node).Kind = N_Project_Declaration then
367 return Project_Nodes.Table (Node).Field1;
369 return Project_Nodes.Table (Node).Field2;
371 end First_Declarative_Item_Of;
373 ------------------------------
374 -- First_Expression_In_List --
375 ------------------------------
377 function First_Expression_In_List
378 (Node : Project_Node_Id)
379 return Project_Node_Id
385 Project_Nodes.Table (Node).Kind = N_Literal_String_List);
386 return Project_Nodes.Table (Node).Field1;
387 end First_Expression_In_List;
389 --------------------------
390 -- First_Literal_String --
391 --------------------------
393 function First_Literal_String
394 (Node : Project_Node_Id)
395 return Project_Node_Id
401 Project_Nodes.Table (Node).Kind = N_String_Type_Declaration);
402 return Project_Nodes.Table (Node).Field1;
403 end First_Literal_String;
405 ----------------------
406 -- First_Package_Of --
407 ----------------------
409 function First_Package_Of
410 (Node : Project_Node_Id)
411 return Package_Declaration_Id
417 Project_Nodes.Table (Node).Kind = N_Project);
418 return Project_Nodes.Table (Node).Packages;
419 end First_Package_Of;
421 --------------------------
422 -- First_String_Type_Of --
423 --------------------------
425 function First_String_Type_Of
426 (Node : Project_Node_Id)
427 return Project_Node_Id
433 Project_Nodes.Table (Node).Kind = N_Project);
434 return Project_Nodes.Table (Node).Field3;
435 end First_String_Type_Of;
442 (Node : Project_Node_Id)
443 return Project_Node_Id
449 Project_Nodes.Table (Node).Kind = N_Expression);
450 return Project_Nodes.Table (Node).Field1;
453 -----------------------
454 -- First_Variable_Of --
455 -----------------------
457 function First_Variable_Of
458 (Node : Project_Node_Id)
459 return Variable_Node_Id
465 (Project_Nodes.Table (Node).Kind = N_Project
467 Project_Nodes.Table (Node).Kind = N_Package_Declaration));
469 return Project_Nodes.Table (Node).Variables;
470 end First_Variable_Of;
472 --------------------------
473 -- First_With_Clause_Of --
474 --------------------------
476 function First_With_Clause_Of
477 (Node : Project_Node_Id)
478 return Project_Node_Id
484 Project_Nodes.Table (Node).Kind = N_Project);
485 return Project_Nodes.Table (Node).Field1;
486 end First_With_Clause_Of;
492 function Hash (N : Project_Node_Id) return Header_Num is
494 return Header_Num (N mod Project_Node_Id (Header_Num'Last));
497 -------------------------------------
498 -- Imported_Or_Extended_Project_Of --
499 -------------------------------------
501 function Imported_Or_Extended_Project_Of
502 (Project : Project_Node_Id;
504 return Project_Node_Id
506 With_Clause : Project_Node_Id := First_With_Clause_Of (Project);
507 Result : Project_Node_Id := Empty_Node;
510 -- First check all the imported projects
512 while With_Clause /= Empty_Node loop
514 -- Only non limited imported project may be used as prefix
515 -- of variable or attributes.
517 Result := Non_Limited_Project_Node_Of (With_Clause);
518 exit when Result /= Empty_Node and then Name_Of (Result) = With_Name;
519 With_Clause := Next_With_Clause_Of (With_Clause);
522 -- If it is not an imported project, it might be the imported project
524 if With_Clause = Empty_Node then
525 Result := Extended_Project_Of (Project_Declaration_Of (Project));
527 if Result /= Empty_Node
528 and then Name_Of (Result) /= With_Name
530 Result := Empty_Node;
535 end Imported_Or_Extended_Project_Of;
541 procedure Initialize is
543 Project_Nodes.Set_Last (Empty_Node);
544 Projects_Htable.Reset;
551 function Kind_Of (Node : Project_Node_Id) return Project_Node_Kind is
553 pragma Assert (Node /= Empty_Node);
554 return Project_Nodes.Table (Node).Kind;
561 function Location_Of (Node : Project_Node_Id) return Source_Ptr is
563 pragma Assert (Node /= Empty_Node);
564 return Project_Nodes.Table (Node).Location;
571 function Name_Of (Node : Project_Node_Id) return Name_Id is
573 pragma Assert (Node /= Empty_Node);
574 return Project_Nodes.Table (Node).Name;
581 function Next_Case_Item
582 (Node : Project_Node_Id)
583 return Project_Node_Id
589 Project_Nodes.Table (Node).Kind = N_Case_Item);
590 return Project_Nodes.Table (Node).Field3;
593 ---------------------------
594 -- Next_Declarative_Item --
595 ---------------------------
597 function Next_Declarative_Item
598 (Node : Project_Node_Id)
599 return Project_Node_Id
605 Project_Nodes.Table (Node).Kind = N_Declarative_Item);
606 return Project_Nodes.Table (Node).Field2;
607 end Next_Declarative_Item;
609 -----------------------------
610 -- Next_Expression_In_List --
611 -----------------------------
613 function Next_Expression_In_List
614 (Node : Project_Node_Id)
615 return Project_Node_Id
621 Project_Nodes.Table (Node).Kind = N_Expression);
622 return Project_Nodes.Table (Node).Field2;
623 end Next_Expression_In_List;
625 -------------------------
626 -- Next_Literal_String --
627 -------------------------
629 function Next_Literal_String
630 (Node : Project_Node_Id)
631 return Project_Node_Id
637 Project_Nodes.Table (Node).Kind = N_Literal_String);
638 return Project_Nodes.Table (Node).Field1;
639 end Next_Literal_String;
641 -----------------------------
642 -- Next_Package_In_Project --
643 -----------------------------
645 function Next_Package_In_Project
646 (Node : Project_Node_Id)
647 return Project_Node_Id
653 Project_Nodes.Table (Node).Kind = N_Package_Declaration);
654 return Project_Nodes.Table (Node).Field3;
655 end Next_Package_In_Project;
657 ----------------------
658 -- Next_String_Type --
659 ----------------------
661 function Next_String_Type
662 (Node : Project_Node_Id)
663 return Project_Node_Id
669 Project_Nodes.Table (Node).Kind = N_String_Type_Declaration);
670 return Project_Nodes.Table (Node).Field2;
671 end Next_String_Type;
678 (Node : Project_Node_Id)
679 return Project_Node_Id
685 Project_Nodes.Table (Node).Kind = N_Term);
686 return Project_Nodes.Table (Node).Field2;
693 function Next_Variable
694 (Node : Project_Node_Id)
695 return Project_Node_Id
701 (Project_Nodes.Table (Node).Kind = N_Typed_Variable_Declaration
703 Project_Nodes.Table (Node).Kind = N_Variable_Declaration));
705 return Project_Nodes.Table (Node).Field3;
708 -------------------------
709 -- Next_With_Clause_Of --
710 -------------------------
712 function Next_With_Clause_Of
713 (Node : Project_Node_Id)
714 return Project_Node_Id
720 Project_Nodes.Table (Node).Kind = N_With_Clause);
721 return Project_Nodes.Table (Node).Field2;
722 end Next_With_Clause_Of;
724 ---------------------------------
725 -- Non_Limited_Project_Node_Of --
726 ---------------------------------
728 function Non_Limited_Project_Node_Of
729 (Node : Project_Node_Id)
730 return Project_Node_Id
736 (Project_Nodes.Table (Node).Kind = N_With_Clause));
737 return Project_Nodes.Table (Node).Field3;
738 end Non_Limited_Project_Node_Of;
743 function Package_Id_Of (Node : Project_Node_Id) return Package_Node_Id is
748 Project_Nodes.Table (Node).Kind = N_Package_Declaration);
749 return Project_Nodes.Table (Node).Pkg_Id;
752 ---------------------
753 -- Package_Node_Of --
754 ---------------------
756 function Package_Node_Of
757 (Node : Project_Node_Id)
758 return Project_Node_Id
764 (Project_Nodes.Table (Node).Kind = N_Variable_Reference
766 Project_Nodes.Table (Node).Kind = N_Attribute_Reference));
767 return Project_Nodes.Table (Node).Field2;
774 function Path_Name_Of (Node : Project_Node_Id) return Name_Id is
779 (Project_Nodes.Table (Node).Kind = N_Project
781 Project_Nodes.Table (Node).Kind = N_With_Clause));
782 return Project_Nodes.Table (Node).Path_Name;
785 ----------------------------
786 -- Project_Declaration_Of --
787 ----------------------------
789 function Project_Declaration_Of
790 (Node : Project_Node_Id)
791 return Project_Node_Id
797 Project_Nodes.Table (Node).Kind = N_Project);
798 return Project_Nodes.Table (Node).Field2;
799 end Project_Declaration_Of;
801 ---------------------
802 -- Project_Node_Of --
803 ---------------------
805 function Project_Node_Of
806 (Node : Project_Node_Id)
807 return Project_Node_Id
813 (Project_Nodes.Table (Node).Kind = N_With_Clause
815 Project_Nodes.Table (Node).Kind = N_Variable_Reference
817 Project_Nodes.Table (Node).Kind = N_Attribute_Reference));
818 return Project_Nodes.Table (Node).Field1;
821 -----------------------------------
822 -- Project_Of_Renamed_Package_Of --
823 -----------------------------------
825 function Project_Of_Renamed_Package_Of
826 (Node : Project_Node_Id)
827 return Project_Node_Id
833 Project_Nodes.Table (Node).Kind = N_Package_Declaration);
834 return Project_Nodes.Table (Node).Field1;
835 end Project_Of_Renamed_Package_Of;
837 ------------------------------------
838 -- Set_Associative_Array_Index_Of --
839 ------------------------------------
841 procedure Set_Associative_Array_Index_Of
842 (Node : Project_Node_Id;
849 (Project_Nodes.Table (Node).Kind = N_Attribute_Declaration
851 Project_Nodes.Table (Node).Kind = N_Attribute_Reference));
852 Project_Nodes.Table (Node).Value := To;
853 end Set_Associative_Array_Index_Of;
855 --------------------------------
856 -- Set_Associative_Package_Of --
857 --------------------------------
859 procedure Set_Associative_Package_Of
860 (Node : Project_Node_Id;
861 To : Project_Node_Id)
867 Project_Nodes.Table (Node).Kind = N_Attribute_Declaration);
868 Project_Nodes.Table (Node).Field3 := To;
869 end Set_Associative_Package_Of;
871 --------------------------------
872 -- Set_Associative_Project_Of --
873 --------------------------------
875 procedure Set_Associative_Project_Of
876 (Node : Project_Node_Id;
877 To : Project_Node_Id)
883 (Project_Nodes.Table (Node).Kind = N_Attribute_Declaration));
884 Project_Nodes.Table (Node).Field2 := To;
885 end Set_Associative_Project_Of;
887 --------------------------
888 -- Set_Case_Insensitive --
889 --------------------------
891 procedure Set_Case_Insensitive
892 (Node : Project_Node_Id;
899 (Project_Nodes.Table (Node).Kind = N_Attribute_Declaration
901 Project_Nodes.Table (Node).Kind = N_Attribute_Reference));
902 Project_Nodes.Table (Node).Case_Insensitive := To;
903 end Set_Case_Insensitive;
905 ------------------------------------
906 -- Set_Case_Variable_Reference_Of --
907 ------------------------------------
909 procedure Set_Case_Variable_Reference_Of
910 (Node : Project_Node_Id;
911 To : Project_Node_Id)
917 Project_Nodes.Table (Node).Kind = N_Case_Construction);
918 Project_Nodes.Table (Node).Field1 := To;
919 end Set_Case_Variable_Reference_Of;
921 ---------------------------
922 -- Set_Current_Item_Node --
923 ---------------------------
925 procedure Set_Current_Item_Node
926 (Node : Project_Node_Id;
927 To : Project_Node_Id)
933 Project_Nodes.Table (Node).Kind = N_Declarative_Item);
934 Project_Nodes.Table (Node).Field1 := To;
935 end Set_Current_Item_Node;
937 ----------------------
938 -- Set_Current_Term --
939 ----------------------
941 procedure Set_Current_Term
942 (Node : Project_Node_Id;
943 To : Project_Node_Id)
949 Project_Nodes.Table (Node).Kind = N_Term);
950 Project_Nodes.Table (Node).Field1 := To;
951 end Set_Current_Term;
953 ----------------------
954 -- Set_Directory_Of --
955 ----------------------
957 procedure Set_Directory_Of
958 (Node : Project_Node_Id;
965 Project_Nodes.Table (Node).Kind = N_Project);
966 Project_Nodes.Table (Node).Directory := To;
967 end Set_Directory_Of;
969 ----------------------------
970 -- Set_Expression_Kind_Of --
971 ----------------------------
973 procedure Set_Expression_Kind_Of
974 (Node : Project_Node_Id;
981 (Project_Nodes.Table (Node).Kind = N_Literal_String
983 Project_Nodes.Table (Node).Kind = N_Attribute_Declaration
985 Project_Nodes.Table (Node).Kind = N_Variable_Declaration
987 Project_Nodes.Table (Node).Kind = N_Typed_Variable_Declaration
989 Project_Nodes.Table (Node).Kind = N_Package_Declaration
991 Project_Nodes.Table (Node).Kind = N_Expression
993 Project_Nodes.Table (Node).Kind = N_Term
995 Project_Nodes.Table (Node).Kind = N_Variable_Reference
997 Project_Nodes.Table (Node).Kind = N_Attribute_Reference));
998 Project_Nodes.Table (Node).Expr_Kind := To;
999 end Set_Expression_Kind_Of;
1001 -----------------------
1002 -- Set_Expression_Of --
1003 -----------------------
1005 procedure Set_Expression_Of
1006 (Node : Project_Node_Id;
1007 To : Project_Node_Id)
1013 (Project_Nodes.Table (Node).Kind = N_Attribute_Declaration
1015 Project_Nodes.Table (Node).Kind = N_Typed_Variable_Declaration
1017 Project_Nodes.Table (Node).Kind = N_Variable_Declaration));
1018 Project_Nodes.Table (Node).Field1 := To;
1019 end Set_Expression_Of;
1021 -------------------------------
1022 -- Set_External_Reference_Of --
1023 -------------------------------
1025 procedure Set_External_Reference_Of
1026 (Node : Project_Node_Id;
1027 To : Project_Node_Id)
1033 Project_Nodes.Table (Node).Kind = N_External_Value);
1034 Project_Nodes.Table (Node).Field1 := To;
1035 end Set_External_Reference_Of;
1037 -----------------------------
1038 -- Set_External_Default_Of --
1039 -----------------------------
1041 procedure Set_External_Default_Of
1042 (Node : Project_Node_Id;
1043 To : Project_Node_Id)
1049 Project_Nodes.Table (Node).Kind = N_External_Value);
1050 Project_Nodes.Table (Node).Field2 := To;
1051 end Set_External_Default_Of;
1053 ----------------------------
1054 -- Set_First_Case_Item_Of --
1055 ----------------------------
1057 procedure Set_First_Case_Item_Of
1058 (Node : Project_Node_Id;
1059 To : Project_Node_Id)
1065 Project_Nodes.Table (Node).Kind = N_Case_Construction);
1066 Project_Nodes.Table (Node).Field2 := To;
1067 end Set_First_Case_Item_Of;
1069 -------------------------
1070 -- Set_First_Choice_Of --
1071 -------------------------
1073 procedure Set_First_Choice_Of
1074 (Node : Project_Node_Id;
1075 To : Project_Node_Id)
1081 Project_Nodes.Table (Node).Kind = N_Case_Item);
1082 Project_Nodes.Table (Node).Field1 := To;
1083 end Set_First_Choice_Of;
1085 ------------------------
1086 -- Set_Next_Case_Item --
1087 ------------------------
1089 procedure Set_Next_Case_Item
1090 (Node : Project_Node_Id;
1091 To : Project_Node_Id)
1097 Project_Nodes.Table (Node).Kind = N_Case_Item);
1098 Project_Nodes.Table (Node).Field3 := To;
1099 end Set_Next_Case_Item;
1101 -----------------------------------
1102 -- Set_First_Declarative_Item_Of --
1103 -----------------------------------
1105 procedure Set_First_Declarative_Item_Of
1106 (Node : Project_Node_Id;
1107 To : Project_Node_Id)
1113 (Project_Nodes.Table (Node).Kind = N_Project_Declaration
1115 Project_Nodes.Table (Node).Kind = N_Case_Item
1117 Project_Nodes.Table (Node).Kind = N_Package_Declaration));
1119 if Project_Nodes.Table (Node).Kind = N_Project_Declaration then
1120 Project_Nodes.Table (Node).Field1 := To;
1122 Project_Nodes.Table (Node).Field2 := To;
1124 end Set_First_Declarative_Item_Of;
1126 ----------------------------------
1127 -- Set_First_Expression_In_List --
1128 ----------------------------------
1130 procedure Set_First_Expression_In_List
1131 (Node : Project_Node_Id;
1132 To : Project_Node_Id)
1138 Project_Nodes.Table (Node).Kind = N_Literal_String_List);
1139 Project_Nodes.Table (Node).Field1 := To;
1140 end Set_First_Expression_In_List;
1142 ------------------------------
1143 -- Set_First_Literal_String --
1144 ------------------------------
1146 procedure Set_First_Literal_String
1147 (Node : Project_Node_Id;
1148 To : Project_Node_Id)
1154 Project_Nodes.Table (Node).Kind = N_String_Type_Declaration);
1155 Project_Nodes.Table (Node).Field1 := To;
1156 end Set_First_Literal_String;
1158 --------------------------
1159 -- Set_First_Package_Of --
1160 --------------------------
1162 procedure Set_First_Package_Of
1163 (Node : Project_Node_Id;
1164 To : Package_Declaration_Id)
1170 Project_Nodes.Table (Node).Kind = N_Project);
1171 Project_Nodes.Table (Node).Packages := To;
1172 end Set_First_Package_Of;
1174 ------------------------------
1175 -- Set_First_String_Type_Of --
1176 ------------------------------
1178 procedure Set_First_String_Type_Of
1179 (Node : Project_Node_Id;
1180 To : Project_Node_Id)
1186 Project_Nodes.Table (Node).Kind = N_Project);
1187 Project_Nodes.Table (Node).Field3 := To;
1188 end Set_First_String_Type_Of;
1190 --------------------
1191 -- Set_First_Term --
1192 --------------------
1194 procedure Set_First_Term
1195 (Node : Project_Node_Id;
1196 To : Project_Node_Id)
1202 Project_Nodes.Table (Node).Kind = N_Expression);
1203 Project_Nodes.Table (Node).Field1 := To;
1206 ---------------------------
1207 -- Set_First_Variable_Of --
1208 ---------------------------
1210 procedure Set_First_Variable_Of
1211 (Node : Project_Node_Id;
1212 To : Variable_Node_Id)
1218 (Project_Nodes.Table (Node).Kind = N_Project
1220 Project_Nodes.Table (Node).Kind = N_Package_Declaration));
1221 Project_Nodes.Table (Node).Variables := To;
1222 end Set_First_Variable_Of;
1224 ------------------------------
1225 -- Set_First_With_Clause_Of --
1226 ------------------------------
1228 procedure Set_First_With_Clause_Of
1229 (Node : Project_Node_Id;
1230 To : Project_Node_Id)
1236 Project_Nodes.Table (Node).Kind = N_Project);
1237 Project_Nodes.Table (Node).Field1 := To;
1238 end Set_First_With_Clause_Of;
1244 procedure Set_Kind_Of
1245 (Node : Project_Node_Id;
1246 To : Project_Node_Kind)
1249 pragma Assert (Node /= Empty_Node);
1250 Project_Nodes.Table (Node).Kind := To;
1253 ---------------------
1254 -- Set_Location_Of --
1255 ---------------------
1257 procedure Set_Location_Of
1258 (Node : Project_Node_Id;
1262 pragma Assert (Node /= Empty_Node);
1263 Project_Nodes.Table (Node).Location := To;
1264 end Set_Location_Of;
1266 -----------------------------
1267 -- Set_Extended_Project_Of --
1268 -----------------------------
1270 procedure Set_Extended_Project_Of
1271 (Node : Project_Node_Id;
1272 To : Project_Node_Id)
1278 Project_Nodes.Table (Node).Kind = N_Project_Declaration);
1279 Project_Nodes.Table (Node).Field2 := To;
1280 end Set_Extended_Project_Of;
1282 ----------------------------------
1283 -- Set_Extended_Project_Path_Of --
1284 ----------------------------------
1286 procedure Set_Extended_Project_Path_Of
1287 (Node : Project_Node_Id;
1294 Project_Nodes.Table (Node).Kind = N_Project);
1295 Project_Nodes.Table (Node).Value := To;
1296 end Set_Extended_Project_Path_Of;
1298 ------------------------------
1299 -- Set_Extending_Project_Of --
1300 ------------------------------
1302 procedure Set_Extending_Project_Of
1303 (Node : Project_Node_Id;
1304 To : Project_Node_Id)
1310 Project_Nodes.Table (Node).Kind = N_Project_Declaration);
1311 Project_Nodes.Table (Node).Field3 := To;
1312 end Set_Extending_Project_Of;
1318 procedure Set_Name_Of
1319 (Node : Project_Node_Id;
1323 pragma Assert (Node /= Empty_Node);
1324 Project_Nodes.Table (Node).Name := To;
1327 -------------------------------
1328 -- Set_Next_Declarative_Item --
1329 -------------------------------
1331 procedure Set_Next_Declarative_Item
1332 (Node : Project_Node_Id;
1333 To : Project_Node_Id)
1339 Project_Nodes.Table (Node).Kind = N_Declarative_Item);
1340 Project_Nodes.Table (Node).Field2 := To;
1341 end Set_Next_Declarative_Item;
1343 ---------------------------------
1344 -- Set_Next_Expression_In_List --
1345 ---------------------------------
1347 procedure Set_Next_Expression_In_List
1348 (Node : Project_Node_Id;
1349 To : Project_Node_Id)
1355 Project_Nodes.Table (Node).Kind = N_Expression);
1356 Project_Nodes.Table (Node).Field2 := To;
1357 end Set_Next_Expression_In_List;
1359 -----------------------------
1360 -- Set_Next_Literal_String --
1361 -----------------------------
1363 procedure Set_Next_Literal_String
1364 (Node : Project_Node_Id;
1365 To : Project_Node_Id)
1371 Project_Nodes.Table (Node).Kind = N_Literal_String);
1372 Project_Nodes.Table (Node).Field1 := To;
1373 end Set_Next_Literal_String;
1375 ---------------------------------
1376 -- Set_Next_Package_In_Project --
1377 ---------------------------------
1379 procedure Set_Next_Package_In_Project
1380 (Node : Project_Node_Id;
1381 To : Project_Node_Id)
1387 Project_Nodes.Table (Node).Kind = N_Package_Declaration);
1388 Project_Nodes.Table (Node).Field3 := To;
1389 end Set_Next_Package_In_Project;
1391 --------------------------
1392 -- Set_Next_String_Type --
1393 --------------------------
1395 procedure Set_Next_String_Type
1396 (Node : Project_Node_Id;
1397 To : Project_Node_Id)
1403 Project_Nodes.Table (Node).Kind = N_String_Type_Declaration);
1404 Project_Nodes.Table (Node).Field2 := To;
1405 end Set_Next_String_Type;
1411 procedure Set_Next_Term
1412 (Node : Project_Node_Id;
1413 To : Project_Node_Id)
1419 Project_Nodes.Table (Node).Kind = N_Term);
1420 Project_Nodes.Table (Node).Field2 := To;
1423 -----------------------
1424 -- Set_Next_Variable --
1425 -----------------------
1427 procedure Set_Next_Variable
1428 (Node : Project_Node_Id;
1429 To : Project_Node_Id)
1435 (Project_Nodes.Table (Node).Kind = N_Typed_Variable_Declaration
1437 Project_Nodes.Table (Node).Kind = N_Variable_Declaration));
1438 Project_Nodes.Table (Node).Field3 := To;
1439 end Set_Next_Variable;
1441 -----------------------------
1442 -- Set_Next_With_Clause_Of --
1443 -----------------------------
1445 procedure Set_Next_With_Clause_Of
1446 (Node : Project_Node_Id;
1447 To : Project_Node_Id)
1453 Project_Nodes.Table (Node).Kind = N_With_Clause);
1454 Project_Nodes.Table (Node).Field2 := To;
1455 end Set_Next_With_Clause_Of;
1457 -----------------------
1458 -- Set_Package_Id_Of --
1459 -----------------------
1461 procedure Set_Package_Id_Of
1462 (Node : Project_Node_Id;
1463 To : Package_Node_Id)
1469 Project_Nodes.Table (Node).Kind = N_Package_Declaration);
1470 Project_Nodes.Table (Node).Pkg_Id := To;
1471 end Set_Package_Id_Of;
1473 -------------------------
1474 -- Set_Package_Node_Of --
1475 -------------------------
1477 procedure Set_Package_Node_Of
1478 (Node : Project_Node_Id;
1479 To : Project_Node_Id)
1485 (Project_Nodes.Table (Node).Kind = N_Variable_Reference
1487 Project_Nodes.Table (Node).Kind = N_Attribute_Reference));
1488 Project_Nodes.Table (Node).Field2 := To;
1489 end Set_Package_Node_Of;
1491 ----------------------
1492 -- Set_Path_Name_Of --
1493 ----------------------
1495 procedure Set_Path_Name_Of
1496 (Node : Project_Node_Id;
1503 (Project_Nodes.Table (Node).Kind = N_Project
1505 Project_Nodes.Table (Node).Kind = N_With_Clause));
1506 Project_Nodes.Table (Node).Path_Name := To;
1507 end Set_Path_Name_Of;
1509 --------------------------------
1510 -- Set_Project_Declaration_Of --
1511 --------------------------------
1513 procedure Set_Project_Declaration_Of
1514 (Node : Project_Node_Id;
1515 To : Project_Node_Id)
1521 Project_Nodes.Table (Node).Kind = N_Project);
1522 Project_Nodes.Table (Node).Field2 := To;
1523 end Set_Project_Declaration_Of;
1525 -------------------------
1526 -- Set_Project_Node_Of --
1527 -------------------------
1529 procedure Set_Project_Node_Of
1530 (Node : Project_Node_Id;
1531 To : Project_Node_Id;
1532 Limited_With : Boolean := False)
1538 (Project_Nodes.Table (Node).Kind = N_With_Clause
1540 Project_Nodes.Table (Node).Kind = N_Variable_Reference
1542 Project_Nodes.Table (Node).Kind = N_Attribute_Reference));
1543 Project_Nodes.Table (Node).Field1 := To;
1545 if Project_Nodes.Table (Node).Kind = N_With_Clause
1546 and then not Limited_With
1548 Project_Nodes.Table (Node).Field3 := To;
1550 end Set_Project_Node_Of;
1552 ---------------------------------------
1553 -- Set_Project_Of_Renamed_Package_Of --
1554 ---------------------------------------
1556 procedure Set_Project_Of_Renamed_Package_Of
1557 (Node : Project_Node_Id;
1558 To : Project_Node_Id)
1564 Project_Nodes.Table (Node).Kind = N_Package_Declaration);
1565 Project_Nodes.Table (Node).Field1 := To;
1566 end Set_Project_Of_Renamed_Package_Of;
1568 ------------------------
1569 -- Set_String_Type_Of --
1570 ------------------------
1572 procedure Set_String_Type_Of
1573 (Node : Project_Node_Id;
1574 To : Project_Node_Id)
1580 (Project_Nodes.Table (Node).Kind = N_Variable_Reference
1582 Project_Nodes.Table (Node).Kind = N_Typed_Variable_Declaration)
1584 Project_Nodes.Table (To).Kind = N_String_Type_Declaration);
1586 if Project_Nodes.Table (Node).Kind = N_Variable_Reference then
1587 Project_Nodes.Table (Node).Field3 := To;
1589 Project_Nodes.Table (Node).Field2 := To;
1591 end Set_String_Type_Of;
1593 -------------------------
1594 -- Set_String_Value_Of --
1595 -------------------------
1597 procedure Set_String_Value_Of
1598 (Node : Project_Node_Id;
1605 (Project_Nodes.Table (Node).Kind = N_With_Clause
1607 Project_Nodes.Table (Node).Kind = N_Literal_String));
1608 Project_Nodes.Table (Node).Value := To;
1609 end Set_String_Value_Of;
1611 --------------------
1612 -- String_Type_Of --
1613 --------------------
1615 function String_Type_Of (Node : Project_Node_Id)
1616 return Project_Node_Id is
1621 (Project_Nodes.Table (Node).Kind = N_Variable_Reference
1623 Project_Nodes.Table (Node).Kind = N_Typed_Variable_Declaration));
1625 if Project_Nodes.Table (Node).Kind = N_Variable_Reference then
1626 return Project_Nodes.Table (Node).Field3;
1628 return Project_Nodes.Table (Node).Field2;
1632 ---------------------
1633 -- String_Value_Of --
1634 ---------------------
1636 function String_Value_Of (Node : Project_Node_Id) return Name_Id is
1641 (Project_Nodes.Table (Node).Kind = N_With_Clause
1643 Project_Nodes.Table (Node).Kind = N_Literal_String));
1644 return Project_Nodes.Table (Node).Value;
1645 end String_Value_Of;
1647 --------------------
1648 -- Value_Is_Valid --
1649 --------------------
1651 function Value_Is_Valid
1652 (For_Typed_Variable : Project_Node_Id;
1658 (For_Typed_Variable /= Empty_Node
1660 (Project_Nodes.Table (For_Typed_Variable).Kind =
1661 N_Typed_Variable_Declaration));
1664 Current_String : Project_Node_Id :=
1665 First_Literal_String
1666 (String_Type_Of (For_Typed_Variable));
1669 while Current_String /= Empty_Node
1671 String_Value_Of (Current_String) /= Value
1674 Next_Literal_String (Current_String);
1677 return Current_String /= Empty_Node;