1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
11 -- Copyright (C) 2001 Free Software Foundation, Inc. --
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. --
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). --
27 ------------------------------------------------------------------------------
29 with Stringt; use Stringt;
31 package body Prj.Tree is
33 use Tree_Private_Part;
35 --------------------------------
36 -- Associative_Array_Index_Of --
37 --------------------------------
39 function Associative_Array_Index_Of
40 (Node : Project_Node_Id)
47 (Project_Nodes.Table (Node).Kind = N_Attribute_Declaration));
48 return Project_Nodes.Table (Node).Value;
49 end Associative_Array_Index_Of;
51 --------------------------------
52 -- Case_Variable_Reference_Of --
53 --------------------------------
55 function Case_Variable_Reference_Of
56 (Node : Project_Node_Id)
57 return Project_Node_Id
63 Project_Nodes.Table (Node).Kind = N_Case_Construction);
64 return Project_Nodes.Table (Node).Field1;
65 end Case_Variable_Reference_Of;
67 -----------------------
68 -- Current_Item_Node --
69 -----------------------
71 function Current_Item_Node
72 (Node : Project_Node_Id)
73 return Project_Node_Id
79 Project_Nodes.Table (Node).Kind = N_Declarative_Item);
80 return Project_Nodes.Table (Node).Field1;
81 end Current_Item_Node;
88 (Node : Project_Node_Id)
89 return Project_Node_Id
95 Project_Nodes.Table (Node).Kind = N_Term);
96 return Project_Nodes.Table (Node).Field1;
99 --------------------------
100 -- Default_Project_Node --
101 --------------------------
103 function Default_Project_Node
104 (Of_Kind : Project_Node_Kind;
105 And_Expr_Kind : Variable_Kind := Undefined)
106 return Project_Node_Id
109 Project_Nodes.Increment_Last;
110 Project_Nodes.Table (Project_Nodes.Last) :=
112 Location => No_Location,
113 Directory => No_Name,
114 Expr_Kind => And_Expr_Kind,
115 Variables => Empty_Node,
116 Packages => Empty_Node,
117 Pkg_Id => Empty_Package,
119 Path_Name => No_Name,
121 Field1 => Empty_Node,
122 Field2 => Empty_Node,
123 Field3 => Empty_Node);
124 return Project_Nodes.Last;
125 end Default_Project_Node;
131 function Directory_Of (Node : Project_Node_Id) return Name_Id is
136 Project_Nodes.Table (Node).Kind = N_Project);
137 return Project_Nodes.Table (Node).Directory;
140 ------------------------
141 -- Expression_Kind_Of --
142 ------------------------
144 function Expression_Kind_Of (Node : Project_Node_Id) return Variable_Kind is
149 (Project_Nodes.Table (Node).Kind = N_Literal_String
151 Project_Nodes.Table (Node).Kind = N_Attribute_Declaration
153 Project_Nodes.Table (Node).Kind = N_Variable_Declaration
155 Project_Nodes.Table (Node).Kind = N_Typed_Variable_Declaration
157 Project_Nodes.Table (Node).Kind = N_Expression
159 Project_Nodes.Table (Node).Kind = N_Term
161 Project_Nodes.Table (Node).Kind = N_Variable_Reference
163 Project_Nodes.Table (Node).Kind = N_Attribute_Reference));
165 return Project_Nodes.Table (Node).Expr_Kind;
166 end Expression_Kind_Of;
172 function Expression_Of
173 (Node : Project_Node_Id)
174 return Project_Node_Id
180 (Project_Nodes.Table (Node).Kind = N_Attribute_Declaration
182 Project_Nodes.Table (Node).Kind = N_Typed_Variable_Declaration
184 Project_Nodes.Table (Node).Kind = N_Variable_Declaration));
186 return Project_Nodes.Table (Node).Field1;
189 ---------------------------
190 -- External_Reference_Of --
191 ---------------------------
193 function External_Reference_Of
194 (Node : Project_Node_Id)
195 return Project_Node_Id
201 Project_Nodes.Table (Node).Kind = N_External_Value);
202 return Project_Nodes.Table (Node).Field1;
203 end External_Reference_Of;
205 -------------------------
206 -- External_Default_Of --
207 -------------------------
209 function External_Default_Of
210 (Node : Project_Node_Id)
211 return Project_Node_Id
217 Project_Nodes.Table (Node).Kind = N_External_Value);
218 return Project_Nodes.Table (Node).Field2;
219 end External_Default_Of;
221 ------------------------
222 -- First_Case_Item_Of --
223 ------------------------
225 function First_Case_Item_Of
226 (Node : Project_Node_Id)
227 return Project_Node_Id
233 Project_Nodes.Table (Node).Kind = N_Case_Construction);
234 return Project_Nodes.Table (Node).Field2;
235 end First_Case_Item_Of;
237 ---------------------
238 -- First_Choice_Of --
239 ---------------------
241 function First_Choice_Of
242 (Node : Project_Node_Id)
243 return Project_Node_Id
249 Project_Nodes.Table (Node).Kind = N_Case_Item);
250 return Project_Nodes.Table (Node).Field1;
253 -------------------------------
254 -- First_Declarative_Item_Of --
255 -------------------------------
257 function First_Declarative_Item_Of
258 (Node : Project_Node_Id)
259 return Project_Node_Id
265 (Project_Nodes.Table (Node).Kind = N_Project_Declaration
267 Project_Nodes.Table (Node).Kind = N_Case_Item
269 Project_Nodes.Table (Node).Kind = N_Package_Declaration));
271 if Project_Nodes.Table (Node).Kind = N_Project_Declaration then
272 return Project_Nodes.Table (Node).Field1;
274 return Project_Nodes.Table (Node).Field2;
276 end First_Declarative_Item_Of;
278 ------------------------------
279 -- First_Expression_In_List --
280 ------------------------------
282 function First_Expression_In_List
283 (Node : Project_Node_Id)
284 return Project_Node_Id
290 Project_Nodes.Table (Node).Kind = N_Literal_String_List);
291 return Project_Nodes.Table (Node).Field1;
292 end First_Expression_In_List;
294 --------------------------
295 -- First_Literal_String --
296 --------------------------
298 function First_Literal_String
299 (Node : Project_Node_Id)
300 return Project_Node_Id
306 Project_Nodes.Table (Node).Kind = N_String_Type_Declaration);
307 return Project_Nodes.Table (Node).Field1;
308 end First_Literal_String;
310 ----------------------
311 -- First_Package_Of --
312 ----------------------
314 function First_Package_Of
315 (Node : Project_Node_Id)
316 return Package_Declaration_Id
322 Project_Nodes.Table (Node).Kind = N_Project);
323 return Project_Nodes.Table (Node).Packages;
324 end First_Package_Of;
326 --------------------------
327 -- First_String_Type_Of --
328 --------------------------
330 function First_String_Type_Of
331 (Node : Project_Node_Id)
332 return Project_Node_Id
338 Project_Nodes.Table (Node).Kind = N_Project);
339 return Project_Nodes.Table (Node).Field3;
340 end First_String_Type_Of;
347 (Node : Project_Node_Id)
348 return Project_Node_Id
354 Project_Nodes.Table (Node).Kind = N_Expression);
355 return Project_Nodes.Table (Node).Field1;
358 -----------------------
359 -- First_Variable_Of --
360 -----------------------
362 function First_Variable_Of
363 (Node : Project_Node_Id)
364 return Variable_Node_Id
370 (Project_Nodes.Table (Node).Kind = N_Project
372 Project_Nodes.Table (Node).Kind = N_Package_Declaration));
374 return Project_Nodes.Table (Node).Variables;
375 end First_Variable_Of;
377 --------------------------
378 -- First_With_Clause_Of --
379 --------------------------
381 function First_With_Clause_Of
382 (Node : Project_Node_Id)
383 return Project_Node_Id
389 Project_Nodes.Table (Node).Kind = N_Project);
390 return Project_Nodes.Table (Node).Field1;
391 end First_With_Clause_Of;
397 procedure Initialize is
399 Project_Nodes.Set_Last (Empty_Node);
400 Projects_Htable.Reset;
407 function Kind_Of (Node : Project_Node_Id) return Project_Node_Kind is
409 pragma Assert (Node /= Empty_Node);
410 return Project_Nodes.Table (Node).Kind;
417 function Location_Of (Node : Project_Node_Id) return Source_Ptr is
419 pragma Assert (Node /= Empty_Node);
420 return Project_Nodes.Table (Node).Location;
423 -------------------------
424 -- Modified_Project_Of --
425 -------------------------
427 function Modified_Project_Of
428 (Node : Project_Node_Id)
429 return Project_Node_Id
435 Project_Nodes.Table (Node).Kind = N_Project_Declaration);
436 return Project_Nodes.Table (Node).Field2;
437 end Modified_Project_Of;
439 ------------------------------
440 -- Modified_Project_Path_Of --
441 ------------------------------
443 function Modified_Project_Path_Of
444 (Node : Project_Node_Id)
451 Project_Nodes.Table (Node).Kind = N_Project);
452 return Project_Nodes.Table (Node).Value;
453 end Modified_Project_Path_Of;
459 function Name_Of (Node : Project_Node_Id) return Name_Id is
461 pragma Assert (Node /= Empty_Node);
462 return Project_Nodes.Table (Node).Name;
469 function Next_Case_Item
470 (Node : Project_Node_Id)
471 return Project_Node_Id
477 Project_Nodes.Table (Node).Kind = N_Case_Item);
478 return Project_Nodes.Table (Node).Field3;
481 ---------------------------
482 -- Next_Declarative_Item --
483 ---------------------------
485 function Next_Declarative_Item
486 (Node : Project_Node_Id)
487 return Project_Node_Id
493 Project_Nodes.Table (Node).Kind = N_Declarative_Item);
494 return Project_Nodes.Table (Node).Field2;
495 end Next_Declarative_Item;
497 -----------------------------
498 -- Next_Expression_In_List --
499 -----------------------------
501 function Next_Expression_In_List
502 (Node : Project_Node_Id)
503 return Project_Node_Id
509 Project_Nodes.Table (Node).Kind = N_Expression);
510 return Project_Nodes.Table (Node).Field2;
511 end Next_Expression_In_List;
513 -------------------------
514 -- Next_Literal_String --
515 -------------------------
517 function Next_Literal_String
518 (Node : Project_Node_Id)
519 return Project_Node_Id
525 Project_Nodes.Table (Node).Kind = N_Literal_String);
526 return Project_Nodes.Table (Node).Field1;
527 end Next_Literal_String;
529 -----------------------------
530 -- Next_Package_In_Project --
531 -----------------------------
533 function Next_Package_In_Project
534 (Node : Project_Node_Id)
535 return Project_Node_Id
541 Project_Nodes.Table (Node).Kind = N_Package_Declaration);
542 return Project_Nodes.Table (Node).Field3;
543 end Next_Package_In_Project;
545 ----------------------
546 -- Next_String_Type --
547 ----------------------
549 function Next_String_Type
550 (Node : Project_Node_Id)
551 return Project_Node_Id
557 Project_Nodes.Table (Node).Kind = N_String_Type_Declaration);
558 return Project_Nodes.Table (Node).Field2;
559 end Next_String_Type;
566 (Node : Project_Node_Id)
567 return Project_Node_Id
573 Project_Nodes.Table (Node).Kind = N_Term);
574 return Project_Nodes.Table (Node).Field2;
581 function Next_Variable
582 (Node : Project_Node_Id)
583 return Project_Node_Id
589 (Project_Nodes.Table (Node).Kind = N_Typed_Variable_Declaration
591 Project_Nodes.Table (Node).Kind = N_Variable_Declaration));
593 return Project_Nodes.Table (Node).Field3;
596 -------------------------
597 -- Next_With_Clause_Of --
598 -------------------------
600 function Next_With_Clause_Of
601 (Node : Project_Node_Id)
602 return Project_Node_Id
608 Project_Nodes.Table (Node).Kind = N_With_Clause);
609 return Project_Nodes.Table (Node).Field2;
610 end Next_With_Clause_Of;
616 function Package_Id_Of (Node : Project_Node_Id) return Package_Node_Id is
621 Project_Nodes.Table (Node).Kind = N_Package_Declaration);
622 return Project_Nodes.Table (Node).Pkg_Id;
625 ---------------------
626 -- Package_Node_Of --
627 ---------------------
629 function Package_Node_Of
630 (Node : Project_Node_Id)
631 return Project_Node_Id
637 (Project_Nodes.Table (Node).Kind = N_Variable_Reference
639 Project_Nodes.Table (Node).Kind = N_Attribute_Reference));
640 return Project_Nodes.Table (Node).Field2;
647 function Path_Name_Of (Node : Project_Node_Id) return Name_Id is
652 (Project_Nodes.Table (Node).Kind = N_Project
654 Project_Nodes.Table (Node).Kind = N_With_Clause));
655 return Project_Nodes.Table (Node).Path_Name;
658 ----------------------------
659 -- Project_Declaration_Of --
660 ----------------------------
662 function Project_Declaration_Of
663 (Node : Project_Node_Id)
664 return Project_Node_Id
670 Project_Nodes.Table (Node).Kind = N_Project);
671 return Project_Nodes.Table (Node).Field2;
672 end Project_Declaration_Of;
674 ---------------------
675 -- Project_Node_Of --
676 ---------------------
678 function Project_Node_Of
679 (Node : Project_Node_Id)
680 return Project_Node_Id
686 (Project_Nodes.Table (Node).Kind = N_With_Clause
688 Project_Nodes.Table (Node).Kind = N_Variable_Reference
690 Project_Nodes.Table (Node).Kind = N_Attribute_Reference));
691 return Project_Nodes.Table (Node).Field1;
694 -----------------------------------
695 -- Project_Of_Renamed_Package_Of --
696 -----------------------------------
698 function Project_Of_Renamed_Package_Of
699 (Node : Project_Node_Id)
700 return Project_Node_Id
706 Project_Nodes.Table (Node).Kind = N_Package_Declaration);
707 return Project_Nodes.Table (Node).Field1;
708 end Project_Of_Renamed_Package_Of;
710 ------------------------------------
711 -- Set_Associative_Array_Index_Of --
712 ------------------------------------
714 procedure Set_Associative_Array_Index_Of
715 (Node : Project_Node_Id;
722 Project_Nodes.Table (Node).Kind = N_Attribute_Declaration);
723 Project_Nodes.Table (Node).Value := To;
724 end Set_Associative_Array_Index_Of;
726 ------------------------------------
727 -- Set_Case_Variable_Reference_Of --
728 ------------------------------------
730 procedure Set_Case_Variable_Reference_Of
731 (Node : Project_Node_Id;
732 To : Project_Node_Id)
738 Project_Nodes.Table (Node).Kind = N_Case_Construction);
739 Project_Nodes.Table (Node).Field1 := To;
740 end Set_Case_Variable_Reference_Of;
742 ---------------------------
743 -- Set_Current_Item_Node --
744 ---------------------------
746 procedure Set_Current_Item_Node
747 (Node : Project_Node_Id;
748 To : Project_Node_Id)
754 Project_Nodes.Table (Node).Kind = N_Declarative_Item);
755 Project_Nodes.Table (Node).Field1 := To;
756 end Set_Current_Item_Node;
758 ----------------------
759 -- Set_Current_Term --
760 ----------------------
762 procedure Set_Current_Term
763 (Node : Project_Node_Id;
764 To : Project_Node_Id)
770 Project_Nodes.Table (Node).Kind = N_Term);
771 Project_Nodes.Table (Node).Field1 := To;
772 end Set_Current_Term;
774 ----------------------
775 -- Set_Directory_Of --
776 ----------------------
778 procedure Set_Directory_Of
779 (Node : Project_Node_Id;
786 Project_Nodes.Table (Node).Kind = N_Project);
787 Project_Nodes.Table (Node).Directory := To;
788 end Set_Directory_Of;
790 ----------------------------
791 -- Set_Expression_Kind_Of --
792 ----------------------------
794 procedure Set_Expression_Kind_Of
795 (Node : Project_Node_Id;
802 (Project_Nodes.Table (Node).Kind = N_Literal_String
804 Project_Nodes.Table (Node).Kind = N_Attribute_Declaration
806 Project_Nodes.Table (Node).Kind = N_Variable_Declaration
808 Project_Nodes.Table (Node).Kind = N_Typed_Variable_Declaration
810 Project_Nodes.Table (Node).Kind = N_Expression
812 Project_Nodes.Table (Node).Kind = N_Term
814 Project_Nodes.Table (Node).Kind = N_Variable_Reference
816 Project_Nodes.Table (Node).Kind = N_Attribute_Reference));
817 Project_Nodes.Table (Node).Expr_Kind := To;
818 end Set_Expression_Kind_Of;
820 -----------------------
821 -- Set_Expression_Of --
822 -----------------------
824 procedure Set_Expression_Of
825 (Node : Project_Node_Id;
826 To : Project_Node_Id)
832 (Project_Nodes.Table (Node).Kind = N_Attribute_Declaration
834 Project_Nodes.Table (Node).Kind = N_Typed_Variable_Declaration
836 Project_Nodes.Table (Node).Kind = N_Variable_Declaration));
837 Project_Nodes.Table (Node).Field1 := To;
838 end Set_Expression_Of;
840 -------------------------------
841 -- Set_External_Reference_Of --
842 -------------------------------
844 procedure Set_External_Reference_Of
845 (Node : Project_Node_Id;
846 To : Project_Node_Id)
852 Project_Nodes.Table (Node).Kind = N_External_Value);
853 Project_Nodes.Table (Node).Field1 := To;
854 end Set_External_Reference_Of;
856 -----------------------------
857 -- Set_External_Default_Of --
858 -----------------------------
860 procedure Set_External_Default_Of
861 (Node : Project_Node_Id;
862 To : Project_Node_Id)
868 Project_Nodes.Table (Node).Kind = N_External_Value);
869 Project_Nodes.Table (Node).Field2 := To;
870 end Set_External_Default_Of;
872 ----------------------------
873 -- Set_First_Case_Item_Of --
874 ----------------------------
876 procedure Set_First_Case_Item_Of
877 (Node : Project_Node_Id;
878 To : Project_Node_Id)
884 Project_Nodes.Table (Node).Kind = N_Case_Construction);
885 Project_Nodes.Table (Node).Field2 := To;
886 end Set_First_Case_Item_Of;
888 -------------------------
889 -- Set_First_Choice_Of --
890 -------------------------
892 procedure Set_First_Choice_Of
893 (Node : Project_Node_Id;
894 To : Project_Node_Id)
900 Project_Nodes.Table (Node).Kind = N_Case_Item);
901 Project_Nodes.Table (Node).Field1 := To;
902 end Set_First_Choice_Of;
904 ------------------------
905 -- Set_Next_Case_Item --
906 ------------------------
908 procedure Set_Next_Case_Item
909 (Node : Project_Node_Id;
910 To : Project_Node_Id)
916 Project_Nodes.Table (Node).Kind = N_Case_Item);
917 Project_Nodes.Table (Node).Field3 := To;
918 end Set_Next_Case_Item;
920 -----------------------------------
921 -- Set_First_Declarative_Item_Of --
922 -----------------------------------
924 procedure Set_First_Declarative_Item_Of
925 (Node : Project_Node_Id;
926 To : Project_Node_Id)
932 (Project_Nodes.Table (Node).Kind = N_Project_Declaration
934 Project_Nodes.Table (Node).Kind = N_Case_Item
936 Project_Nodes.Table (Node).Kind = N_Package_Declaration));
938 if Project_Nodes.Table (Node).Kind = N_Project_Declaration then
939 Project_Nodes.Table (Node).Field1 := To;
941 Project_Nodes.Table (Node).Field2 := To;
943 end Set_First_Declarative_Item_Of;
945 ----------------------------------
946 -- Set_First_Expression_In_List --
947 ----------------------------------
949 procedure Set_First_Expression_In_List
950 (Node : Project_Node_Id;
951 To : Project_Node_Id)
957 Project_Nodes.Table (Node).Kind = N_Literal_String_List);
958 Project_Nodes.Table (Node).Field1 := To;
959 end Set_First_Expression_In_List;
961 ------------------------------
962 -- Set_First_Literal_String --
963 ------------------------------
965 procedure Set_First_Literal_String
966 (Node : Project_Node_Id;
967 To : Project_Node_Id)
973 Project_Nodes.Table (Node).Kind = N_String_Type_Declaration);
974 Project_Nodes.Table (Node).Field1 := To;
975 end Set_First_Literal_String;
977 --------------------------
978 -- Set_First_Package_Of --
979 --------------------------
981 procedure Set_First_Package_Of
982 (Node : Project_Node_Id;
983 To : Package_Declaration_Id)
989 Project_Nodes.Table (Node).Kind = N_Project);
990 Project_Nodes.Table (Node).Packages := To;
991 end Set_First_Package_Of;
993 ------------------------------
994 -- Set_First_String_Type_Of --
995 ------------------------------
997 procedure Set_First_String_Type_Of
998 (Node : Project_Node_Id;
999 To : Project_Node_Id)
1005 Project_Nodes.Table (Node).Kind = N_Project);
1006 Project_Nodes.Table (Node).Field3 := To;
1007 end Set_First_String_Type_Of;
1009 --------------------
1010 -- Set_First_Term --
1011 --------------------
1013 procedure Set_First_Term
1014 (Node : Project_Node_Id;
1015 To : Project_Node_Id)
1021 Project_Nodes.Table (Node).Kind = N_Expression);
1022 Project_Nodes.Table (Node).Field1 := To;
1025 ---------------------------
1026 -- Set_First_Variable_Of --
1027 ---------------------------
1029 procedure Set_First_Variable_Of
1030 (Node : Project_Node_Id;
1031 To : Variable_Node_Id)
1037 (Project_Nodes.Table (Node).Kind = N_Project
1039 Project_Nodes.Table (Node).Kind = N_Package_Declaration));
1040 Project_Nodes.Table (Node).Variables := To;
1041 end Set_First_Variable_Of;
1043 ------------------------------
1044 -- Set_First_With_Clause_Of --
1045 ------------------------------
1047 procedure Set_First_With_Clause_Of
1048 (Node : Project_Node_Id;
1049 To : Project_Node_Id)
1055 Project_Nodes.Table (Node).Kind = N_Project);
1056 Project_Nodes.Table (Node).Field1 := To;
1057 end Set_First_With_Clause_Of;
1063 procedure Set_Kind_Of
1064 (Node : Project_Node_Id;
1065 To : Project_Node_Kind)
1068 pragma Assert (Node /= Empty_Node);
1069 Project_Nodes.Table (Node).Kind := To;
1072 ---------------------
1073 -- Set_Location_Of --
1074 ---------------------
1076 procedure Set_Location_Of
1077 (Node : Project_Node_Id;
1081 pragma Assert (Node /= Empty_Node);
1082 Project_Nodes.Table (Node).Location := To;
1083 end Set_Location_Of;
1085 -----------------------------
1086 -- Set_Modified_Project_Of --
1087 -----------------------------
1089 procedure Set_Modified_Project_Of
1090 (Node : Project_Node_Id;
1091 To : Project_Node_Id)
1097 Project_Nodes.Table (Node).Kind = N_Project_Declaration);
1098 Project_Nodes.Table (Node).Field2 := To;
1099 end Set_Modified_Project_Of;
1101 ----------------------------------
1102 -- Set_Modified_Project_Path_Of --
1103 ----------------------------------
1105 procedure Set_Modified_Project_Path_Of
1106 (Node : Project_Node_Id;
1113 Project_Nodes.Table (Node).Kind = N_Project);
1114 Project_Nodes.Table (Node).Value := To;
1115 end Set_Modified_Project_Path_Of;
1121 procedure Set_Name_Of
1122 (Node : Project_Node_Id;
1126 pragma Assert (Node /= Empty_Node);
1127 Project_Nodes.Table (Node).Name := To;
1130 -------------------------------
1131 -- Set_Next_Declarative_Item --
1132 -------------------------------
1134 procedure Set_Next_Declarative_Item
1135 (Node : Project_Node_Id;
1136 To : Project_Node_Id)
1142 Project_Nodes.Table (Node).Kind = N_Declarative_Item);
1143 Project_Nodes.Table (Node).Field2 := To;
1144 end Set_Next_Declarative_Item;
1146 ---------------------------------
1147 -- Set_Next_Expression_In_List --
1148 ---------------------------------
1150 procedure Set_Next_Expression_In_List
1151 (Node : Project_Node_Id;
1152 To : Project_Node_Id)
1158 Project_Nodes.Table (Node).Kind = N_Expression);
1159 Project_Nodes.Table (Node).Field2 := To;
1160 end Set_Next_Expression_In_List;
1162 -----------------------------
1163 -- Set_Next_Literal_String --
1164 -----------------------------
1166 procedure Set_Next_Literal_String
1167 (Node : Project_Node_Id;
1168 To : Project_Node_Id)
1174 Project_Nodes.Table (Node).Kind = N_Literal_String);
1175 Project_Nodes.Table (Node).Field1 := To;
1176 end Set_Next_Literal_String;
1178 ---------------------------------
1179 -- Set_Next_Package_In_Project --
1180 ---------------------------------
1182 procedure Set_Next_Package_In_Project
1183 (Node : Project_Node_Id;
1184 To : Project_Node_Id)
1190 Project_Nodes.Table (Node).Kind = N_Package_Declaration);
1191 Project_Nodes.Table (Node).Field3 := To;
1192 end Set_Next_Package_In_Project;
1194 --------------------------
1195 -- Set_Next_String_Type --
1196 --------------------------
1198 procedure Set_Next_String_Type
1199 (Node : Project_Node_Id;
1200 To : Project_Node_Id)
1206 Project_Nodes.Table (Node).Kind = N_String_Type_Declaration);
1207 Project_Nodes.Table (Node).Field2 := To;
1208 end Set_Next_String_Type;
1214 procedure Set_Next_Term
1215 (Node : Project_Node_Id;
1216 To : Project_Node_Id)
1222 Project_Nodes.Table (Node).Kind = N_Term);
1223 Project_Nodes.Table (Node).Field2 := To;
1226 -----------------------
1227 -- Set_Next_Variable --
1228 -----------------------
1230 procedure Set_Next_Variable
1231 (Node : Project_Node_Id;
1232 To : Project_Node_Id)
1238 (Project_Nodes.Table (Node).Kind = N_Typed_Variable_Declaration
1240 Project_Nodes.Table (Node).Kind = N_Variable_Declaration));
1241 Project_Nodes.Table (Node).Field3 := To;
1242 end Set_Next_Variable;
1244 -----------------------------
1245 -- Set_Next_With_Clause_Of --
1246 -----------------------------
1248 procedure Set_Next_With_Clause_Of
1249 (Node : Project_Node_Id;
1250 To : Project_Node_Id)
1256 Project_Nodes.Table (Node).Kind = N_With_Clause);
1257 Project_Nodes.Table (Node).Field2 := To;
1258 end Set_Next_With_Clause_Of;
1260 -----------------------
1261 -- Set_Package_Id_Of --
1262 -----------------------
1264 procedure Set_Package_Id_Of
1265 (Node : Project_Node_Id;
1266 To : Package_Node_Id)
1272 Project_Nodes.Table (Node).Kind = N_Package_Declaration);
1273 Project_Nodes.Table (Node).Pkg_Id := To;
1274 end Set_Package_Id_Of;
1276 -------------------------
1277 -- Set_Package_Node_Of --
1278 -------------------------
1280 procedure Set_Package_Node_Of
1281 (Node : Project_Node_Id;
1282 To : Project_Node_Id)
1288 (Project_Nodes.Table (Node).Kind = N_Variable_Reference
1290 Project_Nodes.Table (Node).Kind = N_Attribute_Reference));
1291 Project_Nodes.Table (Node).Field2 := To;
1292 end Set_Package_Node_Of;
1294 ----------------------
1295 -- Set_Path_Name_Of --
1296 ----------------------
1298 procedure Set_Path_Name_Of
1299 (Node : Project_Node_Id;
1306 (Project_Nodes.Table (Node).Kind = N_Project
1308 Project_Nodes.Table (Node).Kind = N_With_Clause));
1309 Project_Nodes.Table (Node).Path_Name := To;
1310 end Set_Path_Name_Of;
1312 --------------------------------
1313 -- Set_Project_Declaration_Of --
1314 --------------------------------
1316 procedure Set_Project_Declaration_Of
1317 (Node : Project_Node_Id;
1318 To : Project_Node_Id)
1324 Project_Nodes.Table (Node).Kind = N_Project);
1325 Project_Nodes.Table (Node).Field2 := To;
1326 end Set_Project_Declaration_Of;
1328 -------------------------
1329 -- Set_Project_Node_Of --
1330 -------------------------
1332 procedure Set_Project_Node_Of
1333 (Node : Project_Node_Id;
1334 To : Project_Node_Id)
1340 (Project_Nodes.Table (Node).Kind = N_With_Clause
1342 Project_Nodes.Table (Node).Kind = N_Variable_Reference
1344 Project_Nodes.Table (Node).Kind = N_Attribute_Reference));
1345 Project_Nodes.Table (Node).Field1 := To;
1346 end Set_Project_Node_Of;
1348 ---------------------------------------
1349 -- Set_Project_Of_Renamed_Package_Of --
1350 ---------------------------------------
1352 procedure Set_Project_Of_Renamed_Package_Of
1353 (Node : Project_Node_Id;
1354 To : Project_Node_Id)
1360 Project_Nodes.Table (Node).Kind = N_Package_Declaration);
1361 Project_Nodes.Table (Node).Field1 := To;
1362 end Set_Project_Of_Renamed_Package_Of;
1364 ------------------------
1365 -- Set_String_Type_Of --
1366 ------------------------
1368 procedure Set_String_Type_Of
1369 (Node : Project_Node_Id;
1370 To : Project_Node_Id)
1376 (Project_Nodes.Table (Node).Kind = N_Variable_Reference
1378 Project_Nodes.Table (Node).Kind = N_Typed_Variable_Declaration)
1380 Project_Nodes.Table (To).Kind = N_String_Type_Declaration);
1382 if Project_Nodes.Table (Node).Kind = N_Variable_Reference then
1383 Project_Nodes.Table (Node).Field3 := To;
1385 Project_Nodes.Table (Node).Field2 := To;
1387 end Set_String_Type_Of;
1389 -------------------------
1390 -- Set_String_Value_Of --
1391 -------------------------
1393 procedure Set_String_Value_Of
1394 (Node : Project_Node_Id;
1401 (Project_Nodes.Table (Node).Kind = N_With_Clause
1403 Project_Nodes.Table (Node).Kind = N_Literal_String));
1404 Project_Nodes.Table (Node).Value := To;
1405 end Set_String_Value_Of;
1407 --------------------
1408 -- String_Type_Of --
1409 --------------------
1411 function String_Type_Of (Node : Project_Node_Id)
1412 return Project_Node_Id is
1417 (Project_Nodes.Table (Node).Kind = N_Variable_Reference
1419 Project_Nodes.Table (Node).Kind = N_Typed_Variable_Declaration));
1421 if Project_Nodes.Table (Node).Kind = N_Variable_Reference then
1422 return Project_Nodes.Table (Node).Field3;
1424 return Project_Nodes.Table (Node).Field2;
1428 ---------------------
1429 -- String_Value_Of --
1430 ---------------------
1432 function String_Value_Of (Node : Project_Node_Id) return String_Id is
1437 (Project_Nodes.Table (Node).Kind = N_With_Clause
1439 Project_Nodes.Table (Node).Kind = N_Literal_String));
1440 return Project_Nodes.Table (Node).Value;
1441 end String_Value_Of;
1443 --------------------
1444 -- Value_Is_Valid --
1445 --------------------
1447 function Value_Is_Valid
1448 (For_Typed_Variable : Project_Node_Id;
1454 (For_Typed_Variable /= Empty_Node
1456 (Project_Nodes.Table (For_Typed_Variable).Kind =
1457 N_Typed_Variable_Declaration));
1460 Current_String : Project_Node_Id :=
1461 First_Literal_String
1462 (String_Type_Of (For_Typed_Variable));
1465 while Current_String /= Empty_Node
1467 not String_Equal (String_Value_Of (Current_String), Value)
1470 Next_Literal_String (Current_String);
1473 return Current_String /= Empty_Node;