1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
10 -- Copyright (C) 2001 Free Software Foundation, Inc. --
12 -- GNAT is free software; you can redistribute it and/or modify it under --
13 -- terms of the GNU General Public License as published by the Free Soft- --
14 -- ware Foundation; either version 2, or (at your option) any later ver- --
15 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
16 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
17 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
18 -- for more details. You should have received a copy of the GNU General --
19 -- Public License distributed with GNAT; see file COPYING. If not, write --
20 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
21 -- MA 02111-1307, USA. --
23 -- GNAT was originally developed by the GNAT team at New York University. --
24 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
26 ------------------------------------------------------------------------------
28 with Stringt
; use Stringt
;
30 package body Prj
.Tree
is
32 use Tree_Private_Part
;
34 --------------------------------
35 -- Associative_Array_Index_Of --
36 --------------------------------
38 function Associative_Array_Index_Of
39 (Node
: Project_Node_Id
)
46 (Project_Nodes
.Table
(Node
).Kind
= N_Attribute_Declaration
48 Project_Nodes
.Table
(Node
).Kind
= N_Attribute_Reference
));
49 return Project_Nodes
.Table
(Node
).Value
;
50 end Associative_Array_Index_Of
;
52 ----------------------
53 -- Case_Insensitive --
54 ----------------------
56 function Case_Insensitive
(Node
: Project_Node_Id
) return Boolean is
61 (Project_Nodes
.Table
(Node
).Kind
= N_Attribute_Declaration
63 Project_Nodes
.Table
(Node
).Kind
= N_Attribute_Reference
));
64 return Project_Nodes
.Table
(Node
).Case_Insensitive
;
67 --------------------------------
68 -- Case_Variable_Reference_Of --
69 --------------------------------
71 function Case_Variable_Reference_Of
72 (Node
: Project_Node_Id
)
73 return Project_Node_Id
79 Project_Nodes
.Table
(Node
).Kind
= N_Case_Construction
);
80 return Project_Nodes
.Table
(Node
).Field1
;
81 end Case_Variable_Reference_Of
;
83 -----------------------
84 -- Current_Item_Node --
85 -----------------------
87 function Current_Item_Node
88 (Node
: Project_Node_Id
)
89 return Project_Node_Id
95 Project_Nodes
.Table
(Node
).Kind
= N_Declarative_Item
);
96 return Project_Nodes
.Table
(Node
).Field1
;
97 end Current_Item_Node
;
103 function Current_Term
104 (Node
: Project_Node_Id
)
105 return Project_Node_Id
111 Project_Nodes
.Table
(Node
).Kind
= N_Term
);
112 return Project_Nodes
.Table
(Node
).Field1
;
115 --------------------------
116 -- Default_Project_Node --
117 --------------------------
119 function Default_Project_Node
120 (Of_Kind
: Project_Node_Kind
;
121 And_Expr_Kind
: Variable_Kind
:= Undefined
)
122 return Project_Node_Id
125 Project_Nodes
.Increment_Last
;
126 Project_Nodes
.Table
(Project_Nodes
.Last
) :=
128 Location
=> No_Location
,
129 Directory
=> No_Name
,
130 Expr_Kind
=> And_Expr_Kind
,
131 Variables
=> Empty_Node
,
132 Packages
=> Empty_Node
,
133 Pkg_Id
=> Empty_Package
,
135 Path_Name
=> No_Name
,
137 Field1
=> Empty_Node
,
138 Field2
=> Empty_Node
,
139 Field3
=> Empty_Node
,
140 Case_Insensitive
=> False);
141 return Project_Nodes
.Last
;
142 end Default_Project_Node
;
148 function Directory_Of
(Node
: Project_Node_Id
) return Name_Id
is
153 Project_Nodes
.Table
(Node
).Kind
= N_Project
);
154 return Project_Nodes
.Table
(Node
).Directory
;
157 ------------------------
158 -- Expression_Kind_Of --
159 ------------------------
161 function Expression_Kind_Of
(Node
: Project_Node_Id
) return Variable_Kind
is
166 (Project_Nodes
.Table
(Node
).Kind
= N_Literal_String
168 Project_Nodes
.Table
(Node
).Kind
= N_Attribute_Declaration
170 Project_Nodes
.Table
(Node
).Kind
= N_Variable_Declaration
172 Project_Nodes
.Table
(Node
).Kind
= N_Typed_Variable_Declaration
174 Project_Nodes
.Table
(Node
).Kind
= N_Expression
176 Project_Nodes
.Table
(Node
).Kind
= N_Term
178 Project_Nodes
.Table
(Node
).Kind
= N_Variable_Reference
180 Project_Nodes
.Table
(Node
).Kind
= N_Attribute_Reference
));
182 return Project_Nodes
.Table
(Node
).Expr_Kind
;
183 end Expression_Kind_Of
;
189 function Expression_Of
190 (Node
: Project_Node_Id
)
191 return Project_Node_Id
197 (Project_Nodes
.Table
(Node
).Kind
= N_Attribute_Declaration
199 Project_Nodes
.Table
(Node
).Kind
= N_Typed_Variable_Declaration
201 Project_Nodes
.Table
(Node
).Kind
= N_Variable_Declaration
));
203 return Project_Nodes
.Table
(Node
).Field1
;
206 ---------------------------
207 -- External_Reference_Of --
208 ---------------------------
210 function External_Reference_Of
211 (Node
: Project_Node_Id
)
212 return Project_Node_Id
218 Project_Nodes
.Table
(Node
).Kind
= N_External_Value
);
219 return Project_Nodes
.Table
(Node
).Field1
;
220 end External_Reference_Of
;
222 -------------------------
223 -- External_Default_Of --
224 -------------------------
226 function External_Default_Of
227 (Node
: Project_Node_Id
)
228 return Project_Node_Id
234 Project_Nodes
.Table
(Node
).Kind
= N_External_Value
);
235 return Project_Nodes
.Table
(Node
).Field2
;
236 end External_Default_Of
;
238 ------------------------
239 -- First_Case_Item_Of --
240 ------------------------
242 function First_Case_Item_Of
243 (Node
: Project_Node_Id
)
244 return Project_Node_Id
250 Project_Nodes
.Table
(Node
).Kind
= N_Case_Construction
);
251 return Project_Nodes
.Table
(Node
).Field2
;
252 end First_Case_Item_Of
;
254 ---------------------
255 -- First_Choice_Of --
256 ---------------------
258 function First_Choice_Of
259 (Node
: Project_Node_Id
)
260 return Project_Node_Id
266 Project_Nodes
.Table
(Node
).Kind
= N_Case_Item
);
267 return Project_Nodes
.Table
(Node
).Field1
;
270 -------------------------------
271 -- First_Declarative_Item_Of --
272 -------------------------------
274 function First_Declarative_Item_Of
275 (Node
: Project_Node_Id
)
276 return Project_Node_Id
282 (Project_Nodes
.Table
(Node
).Kind
= N_Project_Declaration
284 Project_Nodes
.Table
(Node
).Kind
= N_Case_Item
286 Project_Nodes
.Table
(Node
).Kind
= N_Package_Declaration
));
288 if Project_Nodes
.Table
(Node
).Kind
= N_Project_Declaration
then
289 return Project_Nodes
.Table
(Node
).Field1
;
291 return Project_Nodes
.Table
(Node
).Field2
;
293 end First_Declarative_Item_Of
;
295 ------------------------------
296 -- First_Expression_In_List --
297 ------------------------------
299 function First_Expression_In_List
300 (Node
: Project_Node_Id
)
301 return Project_Node_Id
307 Project_Nodes
.Table
(Node
).Kind
= N_Literal_String_List
);
308 return Project_Nodes
.Table
(Node
).Field1
;
309 end First_Expression_In_List
;
311 --------------------------
312 -- First_Literal_String --
313 --------------------------
315 function First_Literal_String
316 (Node
: Project_Node_Id
)
317 return Project_Node_Id
323 Project_Nodes
.Table
(Node
).Kind
= N_String_Type_Declaration
);
324 return Project_Nodes
.Table
(Node
).Field1
;
325 end First_Literal_String
;
327 ----------------------
328 -- First_Package_Of --
329 ----------------------
331 function First_Package_Of
332 (Node
: Project_Node_Id
)
333 return Package_Declaration_Id
339 Project_Nodes
.Table
(Node
).Kind
= N_Project
);
340 return Project_Nodes
.Table
(Node
).Packages
;
341 end First_Package_Of
;
343 --------------------------
344 -- First_String_Type_Of --
345 --------------------------
347 function First_String_Type_Of
348 (Node
: Project_Node_Id
)
349 return Project_Node_Id
355 Project_Nodes
.Table
(Node
).Kind
= N_Project
);
356 return Project_Nodes
.Table
(Node
).Field3
;
357 end First_String_Type_Of
;
364 (Node
: Project_Node_Id
)
365 return Project_Node_Id
371 Project_Nodes
.Table
(Node
).Kind
= N_Expression
);
372 return Project_Nodes
.Table
(Node
).Field1
;
375 -----------------------
376 -- First_Variable_Of --
377 -----------------------
379 function First_Variable_Of
380 (Node
: Project_Node_Id
)
381 return Variable_Node_Id
387 (Project_Nodes
.Table
(Node
).Kind
= N_Project
389 Project_Nodes
.Table
(Node
).Kind
= N_Package_Declaration
));
391 return Project_Nodes
.Table
(Node
).Variables
;
392 end First_Variable_Of
;
394 --------------------------
395 -- First_With_Clause_Of --
396 --------------------------
398 function First_With_Clause_Of
399 (Node
: Project_Node_Id
)
400 return Project_Node_Id
406 Project_Nodes
.Table
(Node
).Kind
= N_Project
);
407 return Project_Nodes
.Table
(Node
).Field1
;
408 end First_With_Clause_Of
;
414 procedure Initialize
is
416 Project_Nodes
.Set_Last
(Empty_Node
);
417 Projects_Htable
.Reset
;
424 function Kind_Of
(Node
: Project_Node_Id
) return Project_Node_Kind
is
426 pragma Assert
(Node
/= Empty_Node
);
427 return Project_Nodes
.Table
(Node
).Kind
;
434 function Location_Of
(Node
: Project_Node_Id
) return Source_Ptr
is
436 pragma Assert
(Node
/= Empty_Node
);
437 return Project_Nodes
.Table
(Node
).Location
;
440 -------------------------
441 -- Modified_Project_Of --
442 -------------------------
444 function Modified_Project_Of
445 (Node
: Project_Node_Id
)
446 return Project_Node_Id
452 Project_Nodes
.Table
(Node
).Kind
= N_Project_Declaration
);
453 return Project_Nodes
.Table
(Node
).Field2
;
454 end Modified_Project_Of
;
456 ------------------------------
457 -- Modified_Project_Path_Of --
458 ------------------------------
460 function Modified_Project_Path_Of
461 (Node
: Project_Node_Id
)
468 Project_Nodes
.Table
(Node
).Kind
= N_Project
);
469 return Project_Nodes
.Table
(Node
).Value
;
470 end Modified_Project_Path_Of
;
476 function Name_Of
(Node
: Project_Node_Id
) return Name_Id
is
478 pragma Assert
(Node
/= Empty_Node
);
479 return Project_Nodes
.Table
(Node
).Name
;
486 function Next_Case_Item
487 (Node
: Project_Node_Id
)
488 return Project_Node_Id
494 Project_Nodes
.Table
(Node
).Kind
= N_Case_Item
);
495 return Project_Nodes
.Table
(Node
).Field3
;
498 ---------------------------
499 -- Next_Declarative_Item --
500 ---------------------------
502 function Next_Declarative_Item
503 (Node
: Project_Node_Id
)
504 return Project_Node_Id
510 Project_Nodes
.Table
(Node
).Kind
= N_Declarative_Item
);
511 return Project_Nodes
.Table
(Node
).Field2
;
512 end Next_Declarative_Item
;
514 -----------------------------
515 -- Next_Expression_In_List --
516 -----------------------------
518 function Next_Expression_In_List
519 (Node
: Project_Node_Id
)
520 return Project_Node_Id
526 Project_Nodes
.Table
(Node
).Kind
= N_Expression
);
527 return Project_Nodes
.Table
(Node
).Field2
;
528 end Next_Expression_In_List
;
530 -------------------------
531 -- Next_Literal_String --
532 -------------------------
534 function Next_Literal_String
535 (Node
: Project_Node_Id
)
536 return Project_Node_Id
542 Project_Nodes
.Table
(Node
).Kind
= N_Literal_String
);
543 return Project_Nodes
.Table
(Node
).Field1
;
544 end Next_Literal_String
;
546 -----------------------------
547 -- Next_Package_In_Project --
548 -----------------------------
550 function Next_Package_In_Project
551 (Node
: Project_Node_Id
)
552 return Project_Node_Id
558 Project_Nodes
.Table
(Node
).Kind
= N_Package_Declaration
);
559 return Project_Nodes
.Table
(Node
).Field3
;
560 end Next_Package_In_Project
;
562 ----------------------
563 -- Next_String_Type --
564 ----------------------
566 function Next_String_Type
567 (Node
: Project_Node_Id
)
568 return Project_Node_Id
574 Project_Nodes
.Table
(Node
).Kind
= N_String_Type_Declaration
);
575 return Project_Nodes
.Table
(Node
).Field2
;
576 end Next_String_Type
;
583 (Node
: Project_Node_Id
)
584 return Project_Node_Id
590 Project_Nodes
.Table
(Node
).Kind
= N_Term
);
591 return Project_Nodes
.Table
(Node
).Field2
;
598 function Next_Variable
599 (Node
: Project_Node_Id
)
600 return Project_Node_Id
606 (Project_Nodes
.Table
(Node
).Kind
= N_Typed_Variable_Declaration
608 Project_Nodes
.Table
(Node
).Kind
= N_Variable_Declaration
));
610 return Project_Nodes
.Table
(Node
).Field3
;
613 -------------------------
614 -- Next_With_Clause_Of --
615 -------------------------
617 function Next_With_Clause_Of
618 (Node
: Project_Node_Id
)
619 return Project_Node_Id
625 Project_Nodes
.Table
(Node
).Kind
= N_With_Clause
);
626 return Project_Nodes
.Table
(Node
).Field2
;
627 end Next_With_Clause_Of
;
633 function Package_Id_Of
(Node
: Project_Node_Id
) return Package_Node_Id
is
638 Project_Nodes
.Table
(Node
).Kind
= N_Package_Declaration
);
639 return Project_Nodes
.Table
(Node
).Pkg_Id
;
642 ---------------------
643 -- Package_Node_Of --
644 ---------------------
646 function Package_Node_Of
647 (Node
: Project_Node_Id
)
648 return Project_Node_Id
654 (Project_Nodes
.Table
(Node
).Kind
= N_Variable_Reference
656 Project_Nodes
.Table
(Node
).Kind
= N_Attribute_Reference
));
657 return Project_Nodes
.Table
(Node
).Field2
;
664 function Path_Name_Of
(Node
: Project_Node_Id
) return Name_Id
is
669 (Project_Nodes
.Table
(Node
).Kind
= N_Project
671 Project_Nodes
.Table
(Node
).Kind
= N_With_Clause
));
672 return Project_Nodes
.Table
(Node
).Path_Name
;
675 ----------------------------
676 -- Project_Declaration_Of --
677 ----------------------------
679 function Project_Declaration_Of
680 (Node
: Project_Node_Id
)
681 return Project_Node_Id
687 Project_Nodes
.Table
(Node
).Kind
= N_Project
);
688 return Project_Nodes
.Table
(Node
).Field2
;
689 end Project_Declaration_Of
;
691 ---------------------
692 -- Project_Node_Of --
693 ---------------------
695 function Project_Node_Of
696 (Node
: Project_Node_Id
)
697 return Project_Node_Id
703 (Project_Nodes
.Table
(Node
).Kind
= N_With_Clause
705 Project_Nodes
.Table
(Node
).Kind
= N_Variable_Reference
707 Project_Nodes
.Table
(Node
).Kind
= N_Attribute_Reference
));
708 return Project_Nodes
.Table
(Node
).Field1
;
711 -----------------------------------
712 -- Project_Of_Renamed_Package_Of --
713 -----------------------------------
715 function Project_Of_Renamed_Package_Of
716 (Node
: Project_Node_Id
)
717 return Project_Node_Id
723 Project_Nodes
.Table
(Node
).Kind
= N_Package_Declaration
);
724 return Project_Nodes
.Table
(Node
).Field1
;
725 end Project_Of_Renamed_Package_Of
;
727 ------------------------------------
728 -- Set_Associative_Array_Index_Of --
729 ------------------------------------
731 procedure Set_Associative_Array_Index_Of
732 (Node
: Project_Node_Id
;
739 (Project_Nodes
.Table
(Node
).Kind
= N_Attribute_Declaration
741 Project_Nodes
.Table
(Node
).Kind
= N_Attribute_Reference
));
742 Project_Nodes
.Table
(Node
).Value
:= To
;
743 end Set_Associative_Array_Index_Of
;
745 --------------------------
746 -- Set_Case_Insensitive --
747 --------------------------
749 procedure Set_Case_Insensitive
750 (Node
: Project_Node_Id
;
757 (Project_Nodes
.Table
(Node
).Kind
= N_Attribute_Declaration
759 Project_Nodes
.Table
(Node
).Kind
= N_Attribute_Reference
));
760 Project_Nodes
.Table
(Node
).Case_Insensitive
:= To
;
761 end Set_Case_Insensitive
;
763 ------------------------------------
764 -- Set_Case_Variable_Reference_Of --
765 ------------------------------------
767 procedure Set_Case_Variable_Reference_Of
768 (Node
: Project_Node_Id
;
769 To
: Project_Node_Id
)
775 Project_Nodes
.Table
(Node
).Kind
= N_Case_Construction
);
776 Project_Nodes
.Table
(Node
).Field1
:= To
;
777 end Set_Case_Variable_Reference_Of
;
779 ---------------------------
780 -- Set_Current_Item_Node --
781 ---------------------------
783 procedure Set_Current_Item_Node
784 (Node
: Project_Node_Id
;
785 To
: Project_Node_Id
)
791 Project_Nodes
.Table
(Node
).Kind
= N_Declarative_Item
);
792 Project_Nodes
.Table
(Node
).Field1
:= To
;
793 end Set_Current_Item_Node
;
795 ----------------------
796 -- Set_Current_Term --
797 ----------------------
799 procedure Set_Current_Term
800 (Node
: Project_Node_Id
;
801 To
: Project_Node_Id
)
807 Project_Nodes
.Table
(Node
).Kind
= N_Term
);
808 Project_Nodes
.Table
(Node
).Field1
:= To
;
809 end Set_Current_Term
;
811 ----------------------
812 -- Set_Directory_Of --
813 ----------------------
815 procedure Set_Directory_Of
816 (Node
: Project_Node_Id
;
823 Project_Nodes
.Table
(Node
).Kind
= N_Project
);
824 Project_Nodes
.Table
(Node
).Directory
:= To
;
825 end Set_Directory_Of
;
827 ----------------------------
828 -- Set_Expression_Kind_Of --
829 ----------------------------
831 procedure Set_Expression_Kind_Of
832 (Node
: Project_Node_Id
;
839 (Project_Nodes
.Table
(Node
).Kind
= N_Literal_String
841 Project_Nodes
.Table
(Node
).Kind
= N_Attribute_Declaration
843 Project_Nodes
.Table
(Node
).Kind
= N_Variable_Declaration
845 Project_Nodes
.Table
(Node
).Kind
= N_Typed_Variable_Declaration
847 Project_Nodes
.Table
(Node
).Kind
= N_Expression
849 Project_Nodes
.Table
(Node
).Kind
= N_Term
851 Project_Nodes
.Table
(Node
).Kind
= N_Variable_Reference
853 Project_Nodes
.Table
(Node
).Kind
= N_Attribute_Reference
));
854 Project_Nodes
.Table
(Node
).Expr_Kind
:= To
;
855 end Set_Expression_Kind_Of
;
857 -----------------------
858 -- Set_Expression_Of --
859 -----------------------
861 procedure Set_Expression_Of
862 (Node
: Project_Node_Id
;
863 To
: Project_Node_Id
)
869 (Project_Nodes
.Table
(Node
).Kind
= N_Attribute_Declaration
871 Project_Nodes
.Table
(Node
).Kind
= N_Typed_Variable_Declaration
873 Project_Nodes
.Table
(Node
).Kind
= N_Variable_Declaration
));
874 Project_Nodes
.Table
(Node
).Field1
:= To
;
875 end Set_Expression_Of
;
877 -------------------------------
878 -- Set_External_Reference_Of --
879 -------------------------------
881 procedure Set_External_Reference_Of
882 (Node
: Project_Node_Id
;
883 To
: Project_Node_Id
)
889 Project_Nodes
.Table
(Node
).Kind
= N_External_Value
);
890 Project_Nodes
.Table
(Node
).Field1
:= To
;
891 end Set_External_Reference_Of
;
893 -----------------------------
894 -- Set_External_Default_Of --
895 -----------------------------
897 procedure Set_External_Default_Of
898 (Node
: Project_Node_Id
;
899 To
: Project_Node_Id
)
905 Project_Nodes
.Table
(Node
).Kind
= N_External_Value
);
906 Project_Nodes
.Table
(Node
).Field2
:= To
;
907 end Set_External_Default_Of
;
909 ----------------------------
910 -- Set_First_Case_Item_Of --
911 ----------------------------
913 procedure Set_First_Case_Item_Of
914 (Node
: Project_Node_Id
;
915 To
: Project_Node_Id
)
921 Project_Nodes
.Table
(Node
).Kind
= N_Case_Construction
);
922 Project_Nodes
.Table
(Node
).Field2
:= To
;
923 end Set_First_Case_Item_Of
;
925 -------------------------
926 -- Set_First_Choice_Of --
927 -------------------------
929 procedure Set_First_Choice_Of
930 (Node
: Project_Node_Id
;
931 To
: Project_Node_Id
)
937 Project_Nodes
.Table
(Node
).Kind
= N_Case_Item
);
938 Project_Nodes
.Table
(Node
).Field1
:= To
;
939 end Set_First_Choice_Of
;
941 ------------------------
942 -- Set_Next_Case_Item --
943 ------------------------
945 procedure Set_Next_Case_Item
946 (Node
: Project_Node_Id
;
947 To
: Project_Node_Id
)
953 Project_Nodes
.Table
(Node
).Kind
= N_Case_Item
);
954 Project_Nodes
.Table
(Node
).Field3
:= To
;
955 end Set_Next_Case_Item
;
957 -----------------------------------
958 -- Set_First_Declarative_Item_Of --
959 -----------------------------------
961 procedure Set_First_Declarative_Item_Of
962 (Node
: Project_Node_Id
;
963 To
: Project_Node_Id
)
969 (Project_Nodes
.Table
(Node
).Kind
= N_Project_Declaration
971 Project_Nodes
.Table
(Node
).Kind
= N_Case_Item
973 Project_Nodes
.Table
(Node
).Kind
= N_Package_Declaration
));
975 if Project_Nodes
.Table
(Node
).Kind
= N_Project_Declaration
then
976 Project_Nodes
.Table
(Node
).Field1
:= To
;
978 Project_Nodes
.Table
(Node
).Field2
:= To
;
980 end Set_First_Declarative_Item_Of
;
982 ----------------------------------
983 -- Set_First_Expression_In_List --
984 ----------------------------------
986 procedure Set_First_Expression_In_List
987 (Node
: Project_Node_Id
;
988 To
: Project_Node_Id
)
994 Project_Nodes
.Table
(Node
).Kind
= N_Literal_String_List
);
995 Project_Nodes
.Table
(Node
).Field1
:= To
;
996 end Set_First_Expression_In_List
;
998 ------------------------------
999 -- Set_First_Literal_String --
1000 ------------------------------
1002 procedure Set_First_Literal_String
1003 (Node
: Project_Node_Id
;
1004 To
: Project_Node_Id
)
1010 Project_Nodes
.Table
(Node
).Kind
= N_String_Type_Declaration
);
1011 Project_Nodes
.Table
(Node
).Field1
:= To
;
1012 end Set_First_Literal_String
;
1014 --------------------------
1015 -- Set_First_Package_Of --
1016 --------------------------
1018 procedure Set_First_Package_Of
1019 (Node
: Project_Node_Id
;
1020 To
: Package_Declaration_Id
)
1026 Project_Nodes
.Table
(Node
).Kind
= N_Project
);
1027 Project_Nodes
.Table
(Node
).Packages
:= To
;
1028 end Set_First_Package_Of
;
1030 ------------------------------
1031 -- Set_First_String_Type_Of --
1032 ------------------------------
1034 procedure Set_First_String_Type_Of
1035 (Node
: Project_Node_Id
;
1036 To
: Project_Node_Id
)
1042 Project_Nodes
.Table
(Node
).Kind
= N_Project
);
1043 Project_Nodes
.Table
(Node
).Field3
:= To
;
1044 end Set_First_String_Type_Of
;
1046 --------------------
1047 -- Set_First_Term --
1048 --------------------
1050 procedure Set_First_Term
1051 (Node
: Project_Node_Id
;
1052 To
: Project_Node_Id
)
1058 Project_Nodes
.Table
(Node
).Kind
= N_Expression
);
1059 Project_Nodes
.Table
(Node
).Field1
:= To
;
1062 ---------------------------
1063 -- Set_First_Variable_Of --
1064 ---------------------------
1066 procedure Set_First_Variable_Of
1067 (Node
: Project_Node_Id
;
1068 To
: Variable_Node_Id
)
1074 (Project_Nodes
.Table
(Node
).Kind
= N_Project
1076 Project_Nodes
.Table
(Node
).Kind
= N_Package_Declaration
));
1077 Project_Nodes
.Table
(Node
).Variables
:= To
;
1078 end Set_First_Variable_Of
;
1080 ------------------------------
1081 -- Set_First_With_Clause_Of --
1082 ------------------------------
1084 procedure Set_First_With_Clause_Of
1085 (Node
: Project_Node_Id
;
1086 To
: Project_Node_Id
)
1092 Project_Nodes
.Table
(Node
).Kind
= N_Project
);
1093 Project_Nodes
.Table
(Node
).Field1
:= To
;
1094 end Set_First_With_Clause_Of
;
1100 procedure Set_Kind_Of
1101 (Node
: Project_Node_Id
;
1102 To
: Project_Node_Kind
)
1105 pragma Assert
(Node
/= Empty_Node
);
1106 Project_Nodes
.Table
(Node
).Kind
:= To
;
1109 ---------------------
1110 -- Set_Location_Of --
1111 ---------------------
1113 procedure Set_Location_Of
1114 (Node
: Project_Node_Id
;
1118 pragma Assert
(Node
/= Empty_Node
);
1119 Project_Nodes
.Table
(Node
).Location
:= To
;
1120 end Set_Location_Of
;
1122 -----------------------------
1123 -- Set_Modified_Project_Of --
1124 -----------------------------
1126 procedure Set_Modified_Project_Of
1127 (Node
: Project_Node_Id
;
1128 To
: Project_Node_Id
)
1134 Project_Nodes
.Table
(Node
).Kind
= N_Project_Declaration
);
1135 Project_Nodes
.Table
(Node
).Field2
:= To
;
1136 end Set_Modified_Project_Of
;
1138 ----------------------------------
1139 -- Set_Modified_Project_Path_Of --
1140 ----------------------------------
1142 procedure Set_Modified_Project_Path_Of
1143 (Node
: Project_Node_Id
;
1150 Project_Nodes
.Table
(Node
).Kind
= N_Project
);
1151 Project_Nodes
.Table
(Node
).Value
:= To
;
1152 end Set_Modified_Project_Path_Of
;
1158 procedure Set_Name_Of
1159 (Node
: Project_Node_Id
;
1163 pragma Assert
(Node
/= Empty_Node
);
1164 Project_Nodes
.Table
(Node
).Name
:= To
;
1167 -------------------------------
1168 -- Set_Next_Declarative_Item --
1169 -------------------------------
1171 procedure Set_Next_Declarative_Item
1172 (Node
: Project_Node_Id
;
1173 To
: Project_Node_Id
)
1179 Project_Nodes
.Table
(Node
).Kind
= N_Declarative_Item
);
1180 Project_Nodes
.Table
(Node
).Field2
:= To
;
1181 end Set_Next_Declarative_Item
;
1183 ---------------------------------
1184 -- Set_Next_Expression_In_List --
1185 ---------------------------------
1187 procedure Set_Next_Expression_In_List
1188 (Node
: Project_Node_Id
;
1189 To
: Project_Node_Id
)
1195 Project_Nodes
.Table
(Node
).Kind
= N_Expression
);
1196 Project_Nodes
.Table
(Node
).Field2
:= To
;
1197 end Set_Next_Expression_In_List
;
1199 -----------------------------
1200 -- Set_Next_Literal_String --
1201 -----------------------------
1203 procedure Set_Next_Literal_String
1204 (Node
: Project_Node_Id
;
1205 To
: Project_Node_Id
)
1211 Project_Nodes
.Table
(Node
).Kind
= N_Literal_String
);
1212 Project_Nodes
.Table
(Node
).Field1
:= To
;
1213 end Set_Next_Literal_String
;
1215 ---------------------------------
1216 -- Set_Next_Package_In_Project --
1217 ---------------------------------
1219 procedure Set_Next_Package_In_Project
1220 (Node
: Project_Node_Id
;
1221 To
: Project_Node_Id
)
1227 Project_Nodes
.Table
(Node
).Kind
= N_Package_Declaration
);
1228 Project_Nodes
.Table
(Node
).Field3
:= To
;
1229 end Set_Next_Package_In_Project
;
1231 --------------------------
1232 -- Set_Next_String_Type --
1233 --------------------------
1235 procedure Set_Next_String_Type
1236 (Node
: Project_Node_Id
;
1237 To
: Project_Node_Id
)
1243 Project_Nodes
.Table
(Node
).Kind
= N_String_Type_Declaration
);
1244 Project_Nodes
.Table
(Node
).Field2
:= To
;
1245 end Set_Next_String_Type
;
1251 procedure Set_Next_Term
1252 (Node
: Project_Node_Id
;
1253 To
: Project_Node_Id
)
1259 Project_Nodes
.Table
(Node
).Kind
= N_Term
);
1260 Project_Nodes
.Table
(Node
).Field2
:= To
;
1263 -----------------------
1264 -- Set_Next_Variable --
1265 -----------------------
1267 procedure Set_Next_Variable
1268 (Node
: Project_Node_Id
;
1269 To
: Project_Node_Id
)
1275 (Project_Nodes
.Table
(Node
).Kind
= N_Typed_Variable_Declaration
1277 Project_Nodes
.Table
(Node
).Kind
= N_Variable_Declaration
));
1278 Project_Nodes
.Table
(Node
).Field3
:= To
;
1279 end Set_Next_Variable
;
1281 -----------------------------
1282 -- Set_Next_With_Clause_Of --
1283 -----------------------------
1285 procedure Set_Next_With_Clause_Of
1286 (Node
: Project_Node_Id
;
1287 To
: Project_Node_Id
)
1293 Project_Nodes
.Table
(Node
).Kind
= N_With_Clause
);
1294 Project_Nodes
.Table
(Node
).Field2
:= To
;
1295 end Set_Next_With_Clause_Of
;
1297 -----------------------
1298 -- Set_Package_Id_Of --
1299 -----------------------
1301 procedure Set_Package_Id_Of
1302 (Node
: Project_Node_Id
;
1303 To
: Package_Node_Id
)
1309 Project_Nodes
.Table
(Node
).Kind
= N_Package_Declaration
);
1310 Project_Nodes
.Table
(Node
).Pkg_Id
:= To
;
1311 end Set_Package_Id_Of
;
1313 -------------------------
1314 -- Set_Package_Node_Of --
1315 -------------------------
1317 procedure Set_Package_Node_Of
1318 (Node
: Project_Node_Id
;
1319 To
: Project_Node_Id
)
1325 (Project_Nodes
.Table
(Node
).Kind
= N_Variable_Reference
1327 Project_Nodes
.Table
(Node
).Kind
= N_Attribute_Reference
));
1328 Project_Nodes
.Table
(Node
).Field2
:= To
;
1329 end Set_Package_Node_Of
;
1331 ----------------------
1332 -- Set_Path_Name_Of --
1333 ----------------------
1335 procedure Set_Path_Name_Of
1336 (Node
: Project_Node_Id
;
1343 (Project_Nodes
.Table
(Node
).Kind
= N_Project
1345 Project_Nodes
.Table
(Node
).Kind
= N_With_Clause
));
1346 Project_Nodes
.Table
(Node
).Path_Name
:= To
;
1347 end Set_Path_Name_Of
;
1349 --------------------------------
1350 -- Set_Project_Declaration_Of --
1351 --------------------------------
1353 procedure Set_Project_Declaration_Of
1354 (Node
: Project_Node_Id
;
1355 To
: Project_Node_Id
)
1361 Project_Nodes
.Table
(Node
).Kind
= N_Project
);
1362 Project_Nodes
.Table
(Node
).Field2
:= To
;
1363 end Set_Project_Declaration_Of
;
1365 -------------------------
1366 -- Set_Project_Node_Of --
1367 -------------------------
1369 procedure Set_Project_Node_Of
1370 (Node
: Project_Node_Id
;
1371 To
: Project_Node_Id
)
1377 (Project_Nodes
.Table
(Node
).Kind
= N_With_Clause
1379 Project_Nodes
.Table
(Node
).Kind
= N_Variable_Reference
1381 Project_Nodes
.Table
(Node
).Kind
= N_Attribute_Reference
));
1382 Project_Nodes
.Table
(Node
).Field1
:= To
;
1383 end Set_Project_Node_Of
;
1385 ---------------------------------------
1386 -- Set_Project_Of_Renamed_Package_Of --
1387 ---------------------------------------
1389 procedure Set_Project_Of_Renamed_Package_Of
1390 (Node
: Project_Node_Id
;
1391 To
: Project_Node_Id
)
1397 Project_Nodes
.Table
(Node
).Kind
= N_Package_Declaration
);
1398 Project_Nodes
.Table
(Node
).Field1
:= To
;
1399 end Set_Project_Of_Renamed_Package_Of
;
1401 ------------------------
1402 -- Set_String_Type_Of --
1403 ------------------------
1405 procedure Set_String_Type_Of
1406 (Node
: Project_Node_Id
;
1407 To
: Project_Node_Id
)
1413 (Project_Nodes
.Table
(Node
).Kind
= N_Variable_Reference
1415 Project_Nodes
.Table
(Node
).Kind
= N_Typed_Variable_Declaration
)
1417 Project_Nodes
.Table
(To
).Kind
= N_String_Type_Declaration
);
1419 if Project_Nodes
.Table
(Node
).Kind
= N_Variable_Reference
then
1420 Project_Nodes
.Table
(Node
).Field3
:= To
;
1422 Project_Nodes
.Table
(Node
).Field2
:= To
;
1424 end Set_String_Type_Of
;
1426 -------------------------
1427 -- Set_String_Value_Of --
1428 -------------------------
1430 procedure Set_String_Value_Of
1431 (Node
: Project_Node_Id
;
1438 (Project_Nodes
.Table
(Node
).Kind
= N_With_Clause
1440 Project_Nodes
.Table
(Node
).Kind
= N_Literal_String
));
1441 Project_Nodes
.Table
(Node
).Value
:= To
;
1442 end Set_String_Value_Of
;
1444 --------------------
1445 -- String_Type_Of --
1446 --------------------
1448 function String_Type_Of
(Node
: Project_Node_Id
)
1449 return Project_Node_Id
is
1454 (Project_Nodes
.Table
(Node
).Kind
= N_Variable_Reference
1456 Project_Nodes
.Table
(Node
).Kind
= N_Typed_Variable_Declaration
));
1458 if Project_Nodes
.Table
(Node
).Kind
= N_Variable_Reference
then
1459 return Project_Nodes
.Table
(Node
).Field3
;
1461 return Project_Nodes
.Table
(Node
).Field2
;
1465 ---------------------
1466 -- String_Value_Of --
1467 ---------------------
1469 function String_Value_Of
(Node
: Project_Node_Id
) return String_Id
is
1474 (Project_Nodes
.Table
(Node
).Kind
= N_With_Clause
1476 Project_Nodes
.Table
(Node
).Kind
= N_Literal_String
));
1477 return Project_Nodes
.Table
(Node
).Value
;
1478 end String_Value_Of
;
1480 --------------------
1481 -- Value_Is_Valid --
1482 --------------------
1484 function Value_Is_Valid
1485 (For_Typed_Variable
: Project_Node_Id
;
1491 (For_Typed_Variable
/= Empty_Node
1493 (Project_Nodes
.Table
(For_Typed_Variable
).Kind
=
1494 N_Typed_Variable_Declaration
));
1497 Current_String
: Project_Node_Id
:=
1498 First_Literal_String
1499 (String_Type_Of
(For_Typed_Variable
));
1502 while Current_String
/= Empty_Node
1504 not String_Equal
(String_Value_Of
(Current_String
), Value
)
1507 Next_Literal_String
(Current_String
);
1510 return Current_String
/= Empty_Node
;