OSDN Git Service

2003-10-21 Arnaud Charlet <charlet@act-europe.fr>
[pf3gnuchains/gcc-fork.git] / gcc / ada / prj-tree.adb
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT COMPILER COMPONENTS                         --
4 --                                                                          --
5 --                              P R J . T R E E                             --
6 --                                                                          --
7 --                                 B o d y                                  --
8 --                                                                          --
9 --             Copyright (C) 2001-2003 Free Software Foundation, Inc.       --
10 --                                                                          --
11 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
12 -- terms of the  GNU General Public License as published  by the Free Soft- --
13 -- ware  Foundation;  either version 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.                                                      --
21 --                                                                          --
22 -- GNAT was originally developed  by the GNAT team at  New York University. --
23 -- Extensive contributions were provided by Ada Core Technologies Inc.      --
24 --                                                                          --
25 ------------------------------------------------------------------------------
26
27 package body Prj.Tree is
28
29    use Tree_Private_Part;
30
31    --------------------------------
32    -- Associative_Array_Index_Of --
33    --------------------------------
34
35    function Associative_Array_Index_Of
36      (Node : Project_Node_Id)
37       return Name_Id
38    is
39    begin
40       pragma Assert
41         (Node /= Empty_Node
42           and then
43             (Project_Nodes.Table (Node).Kind = N_Attribute_Declaration
44                or else
45              Project_Nodes.Table (Node).Kind = N_Attribute_Reference));
46       return Project_Nodes.Table (Node).Value;
47    end Associative_Array_Index_Of;
48
49    ----------------------------
50    -- Associative_Package_Of --
51    ----------------------------
52
53    function Associative_Package_Of
54      (Node  : Project_Node_Id)
55       return  Project_Node_Id
56    is
57    begin
58       pragma Assert
59         (Node /= Empty_Node
60           and then
61             (Project_Nodes.Table (Node).Kind = N_Attribute_Declaration));
62       return Project_Nodes.Table (Node).Field3;
63    end Associative_Package_Of;
64
65    ----------------------------
66    -- Associative_Project_Of --
67    ----------------------------
68
69    function Associative_Project_Of
70      (Node  : Project_Node_Id)
71       return  Project_Node_Id
72    is
73    begin
74       pragma Assert
75         (Node /= Empty_Node
76           and then
77             (Project_Nodes.Table (Node).Kind = N_Attribute_Declaration));
78       return Project_Nodes.Table (Node).Field2;
79    end Associative_Project_Of;
80
81    ----------------------
82    -- Case_Insensitive --
83    ----------------------
84
85    function Case_Insensitive (Node : Project_Node_Id) return Boolean is
86    begin
87       pragma Assert
88         (Node /= Empty_Node
89           and then
90             (Project_Nodes.Table (Node).Kind = N_Attribute_Declaration
91                or else
92              Project_Nodes.Table (Node).Kind = N_Attribute_Reference));
93       return Project_Nodes.Table (Node).Case_Insensitive;
94    end Case_Insensitive;
95
96    --------------------------------
97    -- Case_Variable_Reference_Of --
98    --------------------------------
99
100    function Case_Variable_Reference_Of
101      (Node : Project_Node_Id)
102       return Project_Node_Id
103    is
104    begin
105       pragma Assert
106         (Node /= Empty_Node
107           and then
108             Project_Nodes.Table (Node).Kind = N_Case_Construction);
109       return Project_Nodes.Table (Node).Field1;
110    end Case_Variable_Reference_Of;
111
112    -----------------------
113    -- Current_Item_Node --
114    -----------------------
115
116    function Current_Item_Node
117      (Node : Project_Node_Id)
118       return Project_Node_Id
119    is
120    begin
121       pragma Assert
122         (Node /= Empty_Node
123           and then
124             Project_Nodes.Table (Node).Kind = N_Declarative_Item);
125       return Project_Nodes.Table (Node).Field1;
126    end Current_Item_Node;
127
128    ------------------
129    -- Current_Term --
130    ------------------
131
132    function Current_Term
133      (Node : Project_Node_Id)
134       return Project_Node_Id
135    is
136    begin
137       pragma Assert
138         (Node /= Empty_Node
139           and then
140             Project_Nodes.Table (Node).Kind = N_Term);
141       return Project_Nodes.Table (Node).Field1;
142    end Current_Term;
143
144    --------------------------
145    -- Default_Project_Node --
146    --------------------------
147
148    function Default_Project_Node
149      (Of_Kind       : Project_Node_Kind;
150       And_Expr_Kind : Variable_Kind := Undefined)
151       return          Project_Node_Id
152    is
153    begin
154       Project_Nodes.Increment_Last;
155       Project_Nodes.Table (Project_Nodes.Last) :=
156            (Kind             => Of_Kind,
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,
163             Name             => No_Name,
164             Path_Name        => No_Name,
165             Value            => 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;
172
173    ------------------
174    -- Directory_Of --
175    ------------------
176
177    function Directory_Of (Node : Project_Node_Id) return Name_Id is
178    begin
179       pragma Assert
180         (Node /= Empty_Node
181           and then
182             Project_Nodes.Table (Node).Kind = N_Project);
183       return Project_Nodes.Table (Node).Directory;
184    end Directory_Of;
185
186    ------------------------
187    -- Expression_Kind_Of --
188    ------------------------
189
190    function Expression_Kind_Of (Node : Project_Node_Id) return Variable_Kind is
191    begin
192       pragma Assert
193         (Node /= Empty_Node
194            and then
195              (Project_Nodes.Table (Node).Kind = N_Literal_String
196                 or else
197               Project_Nodes.Table (Node).Kind = N_Attribute_Declaration
198                 or else
199               Project_Nodes.Table (Node).Kind = N_Variable_Declaration
200                 or else
201               Project_Nodes.Table (Node).Kind = N_Typed_Variable_Declaration
202                 or else
203               Project_Nodes.Table (Node).Kind = N_Package_Declaration
204                 or else
205               Project_Nodes.Table (Node).Kind = N_Expression
206                 or else
207               Project_Nodes.Table (Node).Kind = N_Term
208                 or else
209               Project_Nodes.Table (Node).Kind = N_Variable_Reference
210                 or else
211               Project_Nodes.Table (Node).Kind = N_Attribute_Reference));
212
213       return Project_Nodes.Table (Node).Expr_Kind;
214    end Expression_Kind_Of;
215
216    -------------------
217    -- Expression_Of --
218    -------------------
219
220    function Expression_Of
221      (Node : Project_Node_Id)
222       return Project_Node_Id
223    is
224    begin
225       pragma Assert
226         (Node /= Empty_Node
227           and then
228             (Project_Nodes.Table (Node).Kind = N_Attribute_Declaration
229                or else
230              Project_Nodes.Table (Node).Kind = N_Typed_Variable_Declaration
231                or else
232              Project_Nodes.Table (Node).Kind = N_Variable_Declaration));
233
234       return Project_Nodes.Table (Node).Field1;
235    end Expression_Of;
236
237    -------------------------
238    -- Extended_Project_Of --
239    -------------------------
240
241    function Extended_Project_Of
242      (Node : Project_Node_Id)
243       return Project_Node_Id
244    is
245    begin
246       pragma Assert
247         (Node /= Empty_Node
248           and then
249             Project_Nodes.Table (Node).Kind = N_Project_Declaration);
250       return Project_Nodes.Table (Node).Field2;
251    end Extended_Project_Of;
252
253    ------------------------------
254    -- Extended_Project_Path_Of --
255    ------------------------------
256
257    function Extended_Project_Path_Of
258      (Node : Project_Node_Id)
259       return Name_Id
260    is
261    begin
262       pragma Assert
263         (Node /= Empty_Node
264           and then
265             Project_Nodes.Table (Node).Kind = N_Project);
266       return Project_Nodes.Table (Node).Value;
267    end Extended_Project_Path_Of;
268
269    --------------------------
270    -- Extending_Project_Of --
271    --------------------------
272    function Extending_Project_Of
273      (Node  : Project_Node_Id)
274       return  Project_Node_Id
275    is
276    begin
277       pragma Assert
278         (Node /= Empty_Node
279           and then
280             Project_Nodes.Table (Node).Kind = N_Project_Declaration);
281       return Project_Nodes.Table (Node).Field3;
282    end Extending_Project_Of;
283
284    ---------------------------
285    -- External_Reference_Of --
286    ---------------------------
287
288    function External_Reference_Of
289      (Node : Project_Node_Id)
290       return Project_Node_Id
291    is
292    begin
293       pragma Assert
294         (Node /= Empty_Node
295           and then
296             Project_Nodes.Table (Node).Kind = N_External_Value);
297       return Project_Nodes.Table (Node).Field1;
298    end External_Reference_Of;
299
300    -------------------------
301    -- External_Default_Of --
302    -------------------------
303
304    function External_Default_Of
305      (Node : Project_Node_Id)
306       return Project_Node_Id
307    is
308    begin
309       pragma Assert
310         (Node /= Empty_Node
311           and then
312             Project_Nodes.Table (Node).Kind = N_External_Value);
313       return Project_Nodes.Table (Node).Field2;
314    end External_Default_Of;
315
316    ------------------------
317    -- First_Case_Item_Of --
318    ------------------------
319
320    function First_Case_Item_Of
321      (Node : Project_Node_Id)
322       return Project_Node_Id
323    is
324    begin
325       pragma Assert
326         (Node /= Empty_Node
327           and then
328             Project_Nodes.Table (Node).Kind = N_Case_Construction);
329       return Project_Nodes.Table (Node).Field2;
330    end First_Case_Item_Of;
331
332    ---------------------
333    -- First_Choice_Of --
334    ---------------------
335
336    function First_Choice_Of
337      (Node : Project_Node_Id)
338       return Project_Node_Id
339    is
340    begin
341       pragma Assert
342         (Node /= Empty_Node
343           and then
344             Project_Nodes.Table (Node).Kind = N_Case_Item);
345       return Project_Nodes.Table (Node).Field1;
346    end First_Choice_Of;
347
348    -------------------------------
349    -- First_Declarative_Item_Of --
350    -------------------------------
351
352    function First_Declarative_Item_Of
353      (Node : Project_Node_Id)
354       return Project_Node_Id
355    is
356    begin
357       pragma Assert
358         (Node /= Empty_Node
359           and then
360             (Project_Nodes.Table (Node).Kind = N_Project_Declaration
361                or else
362              Project_Nodes.Table (Node).Kind = N_Case_Item
363                or else
364              Project_Nodes.Table (Node).Kind = N_Package_Declaration));
365
366       if Project_Nodes.Table (Node).Kind = N_Project_Declaration then
367          return Project_Nodes.Table (Node).Field1;
368       else
369          return Project_Nodes.Table (Node).Field2;
370       end if;
371    end First_Declarative_Item_Of;
372
373    ------------------------------
374    -- First_Expression_In_List --
375    ------------------------------
376
377    function First_Expression_In_List
378      (Node : Project_Node_Id)
379       return Project_Node_Id
380    is
381    begin
382       pragma Assert
383         (Node /= Empty_Node
384           and then
385             Project_Nodes.Table (Node).Kind = N_Literal_String_List);
386       return Project_Nodes.Table (Node).Field1;
387    end First_Expression_In_List;
388
389    --------------------------
390    -- First_Literal_String --
391    --------------------------
392
393    function First_Literal_String
394      (Node : Project_Node_Id)
395       return Project_Node_Id
396    is
397    begin
398       pragma Assert
399         (Node /= Empty_Node
400           and then
401             Project_Nodes.Table (Node).Kind = N_String_Type_Declaration);
402       return Project_Nodes.Table (Node).Field1;
403    end First_Literal_String;
404
405    ----------------------
406    -- First_Package_Of --
407    ----------------------
408
409    function First_Package_Of
410      (Node : Project_Node_Id)
411       return Package_Declaration_Id
412    is
413    begin
414       pragma Assert
415         (Node /= Empty_Node
416           and then
417             Project_Nodes.Table (Node).Kind = N_Project);
418       return Project_Nodes.Table (Node).Packages;
419    end First_Package_Of;
420
421    --------------------------
422    -- First_String_Type_Of --
423    --------------------------
424
425    function First_String_Type_Of
426      (Node : Project_Node_Id)
427       return Project_Node_Id
428    is
429    begin
430       pragma Assert
431         (Node /= Empty_Node
432           and then
433             Project_Nodes.Table (Node).Kind = N_Project);
434       return Project_Nodes.Table (Node).Field3;
435    end First_String_Type_Of;
436
437    ----------------
438    -- First_Term --
439    ----------------
440
441    function First_Term
442      (Node : Project_Node_Id)
443       return Project_Node_Id
444    is
445    begin
446       pragma Assert
447         (Node /= Empty_Node
448           and then
449             Project_Nodes.Table (Node).Kind = N_Expression);
450       return Project_Nodes.Table (Node).Field1;
451    end First_Term;
452
453    -----------------------
454    -- First_Variable_Of --
455    -----------------------
456
457    function First_Variable_Of
458      (Node : Project_Node_Id)
459       return Variable_Node_Id
460    is
461    begin
462       pragma Assert
463         (Node /= Empty_Node
464           and then
465             (Project_Nodes.Table (Node).Kind = N_Project
466                or else
467              Project_Nodes.Table (Node).Kind = N_Package_Declaration));
468
469       return Project_Nodes.Table (Node).Variables;
470    end First_Variable_Of;
471
472    --------------------------
473    -- First_With_Clause_Of --
474    --------------------------
475
476    function First_With_Clause_Of
477      (Node : Project_Node_Id)
478       return Project_Node_Id
479    is
480    begin
481       pragma Assert
482         (Node /= Empty_Node
483           and then
484             Project_Nodes.Table (Node).Kind = N_Project);
485       return Project_Nodes.Table (Node).Field1;
486    end First_With_Clause_Of;
487
488    ----------
489    -- Hash --
490    ----------
491
492    function Hash (N : Project_Node_Id) return Header_Num is
493    begin
494       return Header_Num (N mod Project_Node_Id (Header_Num'Last));
495    end Hash;
496
497    -------------------------------------
498    -- Imported_Or_Extended_Project_Of --
499    -------------------------------------
500
501    function Imported_Or_Extended_Project_Of
502      (Project   : Project_Node_Id;
503       With_Name : Name_Id)
504       return      Project_Node_Id
505    is
506       With_Clause : Project_Node_Id := First_With_Clause_Of (Project);
507       Result      : Project_Node_Id := Empty_Node;
508
509    begin
510       --  First check all the imported projects
511
512       while With_Clause /= Empty_Node loop
513
514          --  Only non limited imported project may be used as prefix
515          --  of variable or attributes.
516
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);
520       end loop;
521
522       --  If it is not an imported project, it might be the imported project
523
524       if With_Clause = Empty_Node then
525          Result := Extended_Project_Of (Project_Declaration_Of (Project));
526
527          if Result /= Empty_Node
528            and then Name_Of (Result) /= With_Name
529          then
530             Result := Empty_Node;
531          end if;
532       end if;
533
534       return Result;
535    end Imported_Or_Extended_Project_Of;
536
537    ----------------
538    -- Initialize --
539    ----------------
540
541    procedure Initialize is
542    begin
543       Project_Nodes.Set_Last (Empty_Node);
544       Projects_Htable.Reset;
545    end Initialize;
546
547    -------------
548    -- Kind_Of --
549    -------------
550
551    function Kind_Of (Node : Project_Node_Id) return Project_Node_Kind is
552    begin
553       pragma Assert (Node /= Empty_Node);
554       return Project_Nodes.Table (Node).Kind;
555    end Kind_Of;
556
557    -----------------
558    -- Location_Of --
559    -----------------
560
561    function Location_Of (Node : Project_Node_Id) return Source_Ptr is
562    begin
563       pragma Assert (Node /= Empty_Node);
564       return Project_Nodes.Table (Node).Location;
565    end Location_Of;
566
567    -------------
568    -- Name_Of --
569    -------------
570
571    function Name_Of (Node : Project_Node_Id) return Name_Id is
572    begin
573       pragma Assert (Node /= Empty_Node);
574       return Project_Nodes.Table (Node).Name;
575    end Name_Of;
576
577    --------------------
578    -- Next_Case_Item --
579    --------------------
580
581    function Next_Case_Item
582      (Node : Project_Node_Id)
583       return Project_Node_Id
584    is
585    begin
586       pragma Assert
587         (Node /= Empty_Node
588           and then
589             Project_Nodes.Table (Node).Kind = N_Case_Item);
590       return Project_Nodes.Table (Node).Field3;
591    end Next_Case_Item;
592
593    ---------------------------
594    -- Next_Declarative_Item --
595    ---------------------------
596
597    function Next_Declarative_Item
598      (Node : Project_Node_Id)
599       return Project_Node_Id
600    is
601    begin
602       pragma Assert
603         (Node /= Empty_Node
604           and then
605             Project_Nodes.Table (Node).Kind = N_Declarative_Item);
606       return Project_Nodes.Table (Node).Field2;
607    end Next_Declarative_Item;
608
609    -----------------------------
610    -- Next_Expression_In_List --
611    -----------------------------
612
613    function Next_Expression_In_List
614      (Node : Project_Node_Id)
615       return Project_Node_Id
616    is
617    begin
618       pragma Assert
619         (Node /= Empty_Node
620           and then
621             Project_Nodes.Table (Node).Kind = N_Expression);
622       return Project_Nodes.Table (Node).Field2;
623    end Next_Expression_In_List;
624
625    -------------------------
626    -- Next_Literal_String --
627    -------------------------
628
629    function Next_Literal_String
630      (Node : Project_Node_Id)
631       return Project_Node_Id
632    is
633    begin
634       pragma Assert
635         (Node /= Empty_Node
636           and then
637             Project_Nodes.Table (Node).Kind = N_Literal_String);
638       return Project_Nodes.Table (Node).Field1;
639    end Next_Literal_String;
640
641    -----------------------------
642    -- Next_Package_In_Project --
643    -----------------------------
644
645    function Next_Package_In_Project
646      (Node : Project_Node_Id)
647       return Project_Node_Id
648    is
649    begin
650       pragma Assert
651         (Node /= Empty_Node
652           and then
653             Project_Nodes.Table (Node).Kind = N_Package_Declaration);
654       return Project_Nodes.Table (Node).Field3;
655    end Next_Package_In_Project;
656
657    ----------------------
658    -- Next_String_Type --
659    ----------------------
660
661    function Next_String_Type
662      (Node : Project_Node_Id)
663       return Project_Node_Id
664    is
665    begin
666       pragma Assert
667         (Node /= Empty_Node
668           and then
669             Project_Nodes.Table (Node).Kind = N_String_Type_Declaration);
670       return Project_Nodes.Table (Node).Field2;
671    end Next_String_Type;
672
673    ---------------
674    -- Next_Term --
675    ---------------
676
677    function Next_Term
678      (Node : Project_Node_Id)
679       return Project_Node_Id
680    is
681    begin
682       pragma Assert
683         (Node /= Empty_Node
684           and then
685             Project_Nodes.Table (Node).Kind = N_Term);
686       return Project_Nodes.Table (Node).Field2;
687    end Next_Term;
688
689    -------------------
690    -- Next_Variable --
691    -------------------
692
693    function Next_Variable
694      (Node : Project_Node_Id)
695       return Project_Node_Id
696    is
697    begin
698       pragma Assert
699         (Node /= Empty_Node
700           and then
701             (Project_Nodes.Table (Node).Kind = N_Typed_Variable_Declaration
702                or else
703              Project_Nodes.Table (Node).Kind = N_Variable_Declaration));
704
705       return Project_Nodes.Table (Node).Field3;
706    end Next_Variable;
707
708    -------------------------
709    -- Next_With_Clause_Of --
710    -------------------------
711
712    function Next_With_Clause_Of
713      (Node : Project_Node_Id)
714       return Project_Node_Id
715    is
716    begin
717       pragma Assert
718         (Node /= Empty_Node
719           and then
720             Project_Nodes.Table (Node).Kind = N_With_Clause);
721       return Project_Nodes.Table (Node).Field2;
722    end Next_With_Clause_Of;
723
724    ---------------------------------
725    -- Non_Limited_Project_Node_Of --
726    ---------------------------------
727
728    function Non_Limited_Project_Node_Of
729      (Node  : Project_Node_Id)
730       return  Project_Node_Id
731    is
732    begin
733       pragma Assert
734         (Node /= Empty_Node
735           and then
736            (Project_Nodes.Table (Node).Kind = N_With_Clause));
737       return Project_Nodes.Table (Node).Field3;
738    end Non_Limited_Project_Node_Of;
739    -------------------
740    -- Package_Id_Of --
741    -------------------
742
743    function Package_Id_Of (Node : Project_Node_Id) return Package_Node_Id is
744    begin
745       pragma Assert
746         (Node /= Empty_Node
747           and then
748             Project_Nodes.Table (Node).Kind = N_Package_Declaration);
749       return Project_Nodes.Table (Node).Pkg_Id;
750    end Package_Id_Of;
751
752    ---------------------
753    -- Package_Node_Of --
754    ---------------------
755
756    function Package_Node_Of
757      (Node : Project_Node_Id)
758       return Project_Node_Id
759    is
760    begin
761       pragma Assert
762         (Node /= Empty_Node
763           and then
764             (Project_Nodes.Table (Node).Kind = N_Variable_Reference
765                or else
766              Project_Nodes.Table (Node).Kind = N_Attribute_Reference));
767       return Project_Nodes.Table (Node).Field2;
768    end Package_Node_Of;
769
770    ------------------
771    -- Path_Name_Of --
772    ------------------
773
774    function Path_Name_Of (Node : Project_Node_Id) return Name_Id is
775    begin
776       pragma Assert
777         (Node /= Empty_Node
778           and then
779             (Project_Nodes.Table (Node).Kind = N_Project
780                or else
781              Project_Nodes.Table (Node).Kind = N_With_Clause));
782       return Project_Nodes.Table (Node).Path_Name;
783    end Path_Name_Of;
784
785    ----------------------------
786    -- Project_Declaration_Of --
787    ----------------------------
788
789    function Project_Declaration_Of
790      (Node : Project_Node_Id)
791       return Project_Node_Id
792    is
793    begin
794       pragma Assert
795         (Node /= Empty_Node
796           and then
797             Project_Nodes.Table (Node).Kind = N_Project);
798       return Project_Nodes.Table (Node).Field2;
799    end Project_Declaration_Of;
800
801    ---------------------
802    -- Project_Node_Of --
803    ---------------------
804
805    function Project_Node_Of
806      (Node : Project_Node_Id)
807       return Project_Node_Id
808    is
809    begin
810       pragma Assert
811         (Node /= Empty_Node
812           and then
813            (Project_Nodes.Table (Node).Kind = N_With_Clause
814               or else
815             Project_Nodes.Table (Node).Kind = N_Variable_Reference
816               or else
817             Project_Nodes.Table (Node).Kind = N_Attribute_Reference));
818       return Project_Nodes.Table (Node).Field1;
819    end Project_Node_Of;
820
821    -----------------------------------
822    -- Project_Of_Renamed_Package_Of --
823    -----------------------------------
824
825    function Project_Of_Renamed_Package_Of
826      (Node : Project_Node_Id)
827       return Project_Node_Id
828    is
829    begin
830       pragma Assert
831         (Node /= Empty_Node
832           and then
833             Project_Nodes.Table (Node).Kind = N_Package_Declaration);
834       return Project_Nodes.Table (Node).Field1;
835    end Project_Of_Renamed_Package_Of;
836
837    ------------------------------------
838    -- Set_Associative_Array_Index_Of --
839    ------------------------------------
840
841    procedure Set_Associative_Array_Index_Of
842      (Node : Project_Node_Id;
843       To   : Name_Id)
844    is
845    begin
846       pragma Assert
847         (Node /= Empty_Node
848           and then
849             (Project_Nodes.Table (Node).Kind = N_Attribute_Declaration
850                or else
851              Project_Nodes.Table (Node).Kind = N_Attribute_Reference));
852       Project_Nodes.Table (Node).Value := To;
853    end Set_Associative_Array_Index_Of;
854
855    --------------------------------
856    -- Set_Associative_Package_Of --
857    --------------------------------
858
859    procedure Set_Associative_Package_Of
860      (Node : Project_Node_Id;
861       To   : Project_Node_Id)
862    is
863    begin
864       pragma Assert
865          (Node /= Empty_Node
866           and then
867             Project_Nodes.Table (Node).Kind = N_Attribute_Declaration);
868       Project_Nodes.Table (Node).Field3 := To;
869    end Set_Associative_Package_Of;
870
871    --------------------------------
872    -- Set_Associative_Project_Of --
873    --------------------------------
874
875    procedure Set_Associative_Project_Of
876      (Node : Project_Node_Id;
877       To   : Project_Node_Id)
878    is
879    begin
880       pragma Assert
881         (Node /= Empty_Node
882           and then
883             (Project_Nodes.Table (Node).Kind = N_Attribute_Declaration));
884       Project_Nodes.Table (Node).Field2 := To;
885    end Set_Associative_Project_Of;
886
887    --------------------------
888    -- Set_Case_Insensitive --
889    --------------------------
890
891    procedure Set_Case_Insensitive
892      (Node : Project_Node_Id;
893       To   : Boolean)
894    is
895    begin
896       pragma Assert
897         (Node /= Empty_Node
898           and then
899            (Project_Nodes.Table (Node).Kind = N_Attribute_Declaration
900                or else
901             Project_Nodes.Table (Node).Kind = N_Attribute_Reference));
902       Project_Nodes.Table (Node).Case_Insensitive := To;
903    end Set_Case_Insensitive;
904
905    ------------------------------------
906    -- Set_Case_Variable_Reference_Of --
907    ------------------------------------
908
909    procedure Set_Case_Variable_Reference_Of
910      (Node : Project_Node_Id;
911       To   : Project_Node_Id)
912    is
913    begin
914       pragma Assert
915         (Node /= Empty_Node
916           and then
917             Project_Nodes.Table (Node).Kind = N_Case_Construction);
918       Project_Nodes.Table (Node).Field1 := To;
919    end Set_Case_Variable_Reference_Of;
920
921    ---------------------------
922    -- Set_Current_Item_Node --
923    ---------------------------
924
925    procedure Set_Current_Item_Node
926      (Node : Project_Node_Id;
927       To   : Project_Node_Id)
928    is
929    begin
930       pragma Assert
931         (Node /= Empty_Node
932           and then
933             Project_Nodes.Table (Node).Kind = N_Declarative_Item);
934       Project_Nodes.Table (Node).Field1 := To;
935    end Set_Current_Item_Node;
936
937    ----------------------
938    -- Set_Current_Term --
939    ----------------------
940
941    procedure Set_Current_Term
942      (Node : Project_Node_Id;
943       To   : Project_Node_Id)
944    is
945    begin
946       pragma Assert
947         (Node /= Empty_Node
948           and then
949             Project_Nodes.Table (Node).Kind = N_Term);
950       Project_Nodes.Table (Node).Field1 := To;
951    end Set_Current_Term;
952
953    ----------------------
954    -- Set_Directory_Of --
955    ----------------------
956
957    procedure Set_Directory_Of
958      (Node : Project_Node_Id;
959       To   : Name_Id)
960    is
961    begin
962       pragma Assert
963         (Node /= Empty_Node
964           and then
965             Project_Nodes.Table (Node).Kind = N_Project);
966       Project_Nodes.Table (Node).Directory := To;
967    end Set_Directory_Of;
968
969    ----------------------------
970    -- Set_Expression_Kind_Of --
971    ----------------------------
972
973    procedure Set_Expression_Kind_Of
974      (Node : Project_Node_Id;
975       To   : Variable_Kind)
976    is
977    begin
978       pragma Assert
979         (Node /= Empty_Node
980            and then
981              (Project_Nodes.Table (Node).Kind = N_Literal_String
982                 or else
983               Project_Nodes.Table (Node).Kind = N_Attribute_Declaration
984                 or else
985               Project_Nodes.Table (Node).Kind = N_Variable_Declaration
986                 or else
987               Project_Nodes.Table (Node).Kind = N_Typed_Variable_Declaration
988                 or else
989               Project_Nodes.Table (Node).Kind = N_Package_Declaration
990                 or else
991               Project_Nodes.Table (Node).Kind = N_Expression
992                 or else
993               Project_Nodes.Table (Node).Kind = N_Term
994                 or else
995               Project_Nodes.Table (Node).Kind = N_Variable_Reference
996                 or else
997               Project_Nodes.Table (Node).Kind = N_Attribute_Reference));
998       Project_Nodes.Table (Node).Expr_Kind := To;
999    end Set_Expression_Kind_Of;
1000
1001    -----------------------
1002    -- Set_Expression_Of --
1003    -----------------------
1004
1005    procedure Set_Expression_Of
1006      (Node : Project_Node_Id;
1007       To   : Project_Node_Id)
1008    is
1009    begin
1010       pragma Assert
1011         (Node /= Empty_Node
1012           and then
1013             (Project_Nodes.Table (Node).Kind = N_Attribute_Declaration
1014                or else
1015              Project_Nodes.Table (Node).Kind = N_Typed_Variable_Declaration
1016                or else
1017              Project_Nodes.Table (Node).Kind = N_Variable_Declaration));
1018       Project_Nodes.Table (Node).Field1 := To;
1019    end Set_Expression_Of;
1020
1021    -------------------------------
1022    -- Set_External_Reference_Of --
1023    -------------------------------
1024
1025    procedure Set_External_Reference_Of
1026      (Node : Project_Node_Id;
1027       To   : Project_Node_Id)
1028    is
1029    begin
1030       pragma Assert
1031         (Node /= Empty_Node
1032           and then
1033             Project_Nodes.Table (Node).Kind = N_External_Value);
1034       Project_Nodes.Table (Node).Field1 := To;
1035    end Set_External_Reference_Of;
1036
1037    -----------------------------
1038    -- Set_External_Default_Of --
1039    -----------------------------
1040
1041    procedure Set_External_Default_Of
1042      (Node : Project_Node_Id;
1043       To   : Project_Node_Id)
1044    is
1045    begin
1046       pragma Assert
1047         (Node /= Empty_Node
1048           and then
1049             Project_Nodes.Table (Node).Kind = N_External_Value);
1050       Project_Nodes.Table (Node).Field2 := To;
1051    end Set_External_Default_Of;
1052
1053    ----------------------------
1054    -- Set_First_Case_Item_Of --
1055    ----------------------------
1056
1057    procedure Set_First_Case_Item_Of
1058      (Node : Project_Node_Id;
1059       To   : Project_Node_Id)
1060    is
1061    begin
1062       pragma Assert
1063         (Node /= Empty_Node
1064           and then
1065             Project_Nodes.Table (Node).Kind = N_Case_Construction);
1066       Project_Nodes.Table (Node).Field2 := To;
1067    end Set_First_Case_Item_Of;
1068
1069    -------------------------
1070    -- Set_First_Choice_Of --
1071    -------------------------
1072
1073    procedure Set_First_Choice_Of
1074      (Node : Project_Node_Id;
1075       To   : Project_Node_Id)
1076    is
1077    begin
1078       pragma Assert
1079         (Node /= Empty_Node
1080           and then
1081             Project_Nodes.Table (Node).Kind = N_Case_Item);
1082       Project_Nodes.Table (Node).Field1 := To;
1083    end Set_First_Choice_Of;
1084
1085    ------------------------
1086    -- Set_Next_Case_Item --
1087    ------------------------
1088
1089    procedure Set_Next_Case_Item
1090      (Node : Project_Node_Id;
1091       To   : Project_Node_Id)
1092    is
1093    begin
1094       pragma Assert
1095         (Node /= Empty_Node
1096           and then
1097             Project_Nodes.Table (Node).Kind = N_Case_Item);
1098       Project_Nodes.Table (Node).Field3 := To;
1099    end Set_Next_Case_Item;
1100
1101    -----------------------------------
1102    -- Set_First_Declarative_Item_Of --
1103    -----------------------------------
1104
1105    procedure Set_First_Declarative_Item_Of
1106      (Node : Project_Node_Id;
1107       To   : Project_Node_Id)
1108    is
1109    begin
1110       pragma Assert
1111         (Node /= Empty_Node
1112           and then
1113             (Project_Nodes.Table (Node).Kind = N_Project_Declaration
1114                or else
1115              Project_Nodes.Table (Node).Kind = N_Case_Item
1116                or else
1117              Project_Nodes.Table (Node).Kind = N_Package_Declaration));
1118
1119       if Project_Nodes.Table (Node).Kind = N_Project_Declaration then
1120          Project_Nodes.Table (Node).Field1 := To;
1121       else
1122          Project_Nodes.Table (Node).Field2 := To;
1123       end if;
1124    end Set_First_Declarative_Item_Of;
1125
1126    ----------------------------------
1127    -- Set_First_Expression_In_List --
1128    ----------------------------------
1129
1130    procedure Set_First_Expression_In_List
1131      (Node : Project_Node_Id;
1132       To   : Project_Node_Id)
1133    is
1134    begin
1135       pragma Assert
1136         (Node /= Empty_Node
1137           and then
1138             Project_Nodes.Table (Node).Kind = N_Literal_String_List);
1139       Project_Nodes.Table (Node).Field1 := To;
1140    end Set_First_Expression_In_List;
1141
1142    ------------------------------
1143    -- Set_First_Literal_String --
1144    ------------------------------
1145
1146    procedure Set_First_Literal_String
1147      (Node : Project_Node_Id;
1148       To   : Project_Node_Id)
1149    is
1150    begin
1151       pragma Assert
1152         (Node /= Empty_Node
1153           and then
1154             Project_Nodes.Table (Node).Kind = N_String_Type_Declaration);
1155       Project_Nodes.Table (Node).Field1 := To;
1156    end Set_First_Literal_String;
1157
1158    --------------------------
1159    -- Set_First_Package_Of --
1160    --------------------------
1161
1162    procedure Set_First_Package_Of
1163      (Node : Project_Node_Id;
1164       To   : Package_Declaration_Id)
1165    is
1166    begin
1167       pragma Assert
1168         (Node /= Empty_Node
1169           and then
1170             Project_Nodes.Table (Node).Kind = N_Project);
1171       Project_Nodes.Table (Node).Packages := To;
1172    end Set_First_Package_Of;
1173
1174    ------------------------------
1175    -- Set_First_String_Type_Of --
1176    ------------------------------
1177
1178    procedure Set_First_String_Type_Of
1179      (Node : Project_Node_Id;
1180       To   : Project_Node_Id)
1181    is
1182    begin
1183       pragma Assert
1184         (Node /= Empty_Node
1185           and then
1186             Project_Nodes.Table (Node).Kind = N_Project);
1187       Project_Nodes.Table (Node).Field3 := To;
1188    end Set_First_String_Type_Of;
1189
1190    --------------------
1191    -- Set_First_Term --
1192    --------------------
1193
1194    procedure Set_First_Term
1195      (Node : Project_Node_Id;
1196       To   : Project_Node_Id)
1197    is
1198    begin
1199       pragma Assert
1200         (Node /= Empty_Node
1201           and then
1202             Project_Nodes.Table (Node).Kind = N_Expression);
1203       Project_Nodes.Table (Node).Field1 := To;
1204    end Set_First_Term;
1205
1206    ---------------------------
1207    -- Set_First_Variable_Of --
1208    ---------------------------
1209
1210    procedure Set_First_Variable_Of
1211      (Node : Project_Node_Id;
1212       To   : Variable_Node_Id)
1213    is
1214    begin
1215       pragma Assert
1216         (Node /= Empty_Node
1217           and then
1218             (Project_Nodes.Table (Node).Kind = N_Project
1219                or else
1220              Project_Nodes.Table (Node).Kind = N_Package_Declaration));
1221       Project_Nodes.Table (Node).Variables := To;
1222    end Set_First_Variable_Of;
1223
1224    ------------------------------
1225    -- Set_First_With_Clause_Of --
1226    ------------------------------
1227
1228    procedure Set_First_With_Clause_Of
1229      (Node : Project_Node_Id;
1230       To   : Project_Node_Id)
1231    is
1232    begin
1233       pragma Assert
1234         (Node /= Empty_Node
1235           and then
1236             Project_Nodes.Table (Node).Kind = N_Project);
1237       Project_Nodes.Table (Node).Field1 := To;
1238    end Set_First_With_Clause_Of;
1239
1240    -----------------
1241    -- Set_Kind_Of --
1242    -----------------
1243
1244    procedure Set_Kind_Of
1245      (Node : Project_Node_Id;
1246       To   : Project_Node_Kind)
1247    is
1248    begin
1249       pragma Assert (Node /= Empty_Node);
1250       Project_Nodes.Table (Node).Kind := To;
1251    end Set_Kind_Of;
1252
1253    ---------------------
1254    -- Set_Location_Of --
1255    ---------------------
1256
1257    procedure Set_Location_Of
1258      (Node : Project_Node_Id;
1259       To   : Source_Ptr)
1260    is
1261    begin
1262       pragma Assert (Node /= Empty_Node);
1263       Project_Nodes.Table (Node).Location := To;
1264    end Set_Location_Of;
1265
1266    -----------------------------
1267    -- Set_Extended_Project_Of --
1268    -----------------------------
1269
1270    procedure Set_Extended_Project_Of
1271      (Node : Project_Node_Id;
1272       To   : Project_Node_Id)
1273    is
1274    begin
1275       pragma Assert
1276         (Node /= Empty_Node
1277           and then
1278             Project_Nodes.Table (Node).Kind = N_Project_Declaration);
1279       Project_Nodes.Table (Node).Field2 := To;
1280    end Set_Extended_Project_Of;
1281
1282    ----------------------------------
1283    -- Set_Extended_Project_Path_Of --
1284    ----------------------------------
1285
1286    procedure Set_Extended_Project_Path_Of
1287      (Node : Project_Node_Id;
1288       To   : Name_Id)
1289    is
1290    begin
1291       pragma Assert
1292         (Node /= Empty_Node
1293           and then
1294             Project_Nodes.Table (Node).Kind = N_Project);
1295       Project_Nodes.Table (Node).Value := To;
1296    end Set_Extended_Project_Path_Of;
1297
1298    ------------------------------
1299    -- Set_Extending_Project_Of --
1300    ------------------------------
1301
1302    procedure Set_Extending_Project_Of
1303      (Node : Project_Node_Id;
1304       To   : Project_Node_Id)
1305    is
1306    begin
1307       pragma Assert
1308         (Node /= Empty_Node
1309           and then
1310             Project_Nodes.Table (Node).Kind = N_Project_Declaration);
1311       Project_Nodes.Table (Node).Field3 := To;
1312    end Set_Extending_Project_Of;
1313
1314    -----------------
1315    -- Set_Name_Of --
1316    -----------------
1317
1318    procedure Set_Name_Of
1319      (Node : Project_Node_Id;
1320       To   : Name_Id)
1321    is
1322    begin
1323       pragma Assert (Node /= Empty_Node);
1324       Project_Nodes.Table (Node).Name := To;
1325    end Set_Name_Of;
1326
1327    -------------------------------
1328    -- Set_Next_Declarative_Item --
1329    -------------------------------
1330
1331    procedure Set_Next_Declarative_Item
1332      (Node : Project_Node_Id;
1333       To   : Project_Node_Id)
1334    is
1335    begin
1336       pragma Assert
1337         (Node /= Empty_Node
1338           and then
1339             Project_Nodes.Table (Node).Kind = N_Declarative_Item);
1340       Project_Nodes.Table (Node).Field2 := To;
1341    end Set_Next_Declarative_Item;
1342
1343    ---------------------------------
1344    -- Set_Next_Expression_In_List --
1345    ---------------------------------
1346
1347    procedure Set_Next_Expression_In_List
1348      (Node : Project_Node_Id;
1349       To   : Project_Node_Id)
1350    is
1351    begin
1352       pragma Assert
1353         (Node /= Empty_Node
1354           and then
1355             Project_Nodes.Table (Node).Kind = N_Expression);
1356       Project_Nodes.Table (Node).Field2 := To;
1357    end Set_Next_Expression_In_List;
1358
1359    -----------------------------
1360    -- Set_Next_Literal_String --
1361    -----------------------------
1362
1363    procedure Set_Next_Literal_String
1364      (Node : Project_Node_Id;
1365       To   : Project_Node_Id)
1366    is
1367    begin
1368       pragma Assert
1369         (Node /= Empty_Node
1370           and then
1371             Project_Nodes.Table (Node).Kind = N_Literal_String);
1372       Project_Nodes.Table (Node).Field1 := To;
1373    end Set_Next_Literal_String;
1374
1375    ---------------------------------
1376    -- Set_Next_Package_In_Project --
1377    ---------------------------------
1378
1379    procedure Set_Next_Package_In_Project
1380      (Node : Project_Node_Id;
1381       To   : Project_Node_Id)
1382    is
1383    begin
1384       pragma Assert
1385         (Node /= Empty_Node
1386           and then
1387             Project_Nodes.Table (Node).Kind = N_Package_Declaration);
1388       Project_Nodes.Table (Node).Field3 := To;
1389    end Set_Next_Package_In_Project;
1390
1391    --------------------------
1392    -- Set_Next_String_Type --
1393    --------------------------
1394
1395    procedure Set_Next_String_Type
1396      (Node : Project_Node_Id;
1397       To   : Project_Node_Id)
1398    is
1399    begin
1400       pragma Assert
1401         (Node /= Empty_Node
1402           and then
1403             Project_Nodes.Table (Node).Kind = N_String_Type_Declaration);
1404       Project_Nodes.Table (Node).Field2 := To;
1405    end Set_Next_String_Type;
1406
1407    -------------------
1408    -- Set_Next_Term --
1409    -------------------
1410
1411    procedure Set_Next_Term
1412      (Node : Project_Node_Id;
1413       To   : Project_Node_Id)
1414    is
1415    begin
1416       pragma Assert
1417         (Node /= Empty_Node
1418           and then
1419             Project_Nodes.Table (Node).Kind = N_Term);
1420       Project_Nodes.Table (Node).Field2 := To;
1421    end Set_Next_Term;
1422
1423    -----------------------
1424    -- Set_Next_Variable --
1425    -----------------------
1426
1427    procedure Set_Next_Variable
1428      (Node : Project_Node_Id;
1429       To   : Project_Node_Id)
1430    is
1431    begin
1432       pragma Assert
1433         (Node /= Empty_Node
1434           and then
1435             (Project_Nodes.Table (Node).Kind = N_Typed_Variable_Declaration
1436                or else
1437              Project_Nodes.Table (Node).Kind = N_Variable_Declaration));
1438       Project_Nodes.Table (Node).Field3 := To;
1439    end Set_Next_Variable;
1440
1441    -----------------------------
1442    -- Set_Next_With_Clause_Of --
1443    -----------------------------
1444
1445    procedure Set_Next_With_Clause_Of
1446      (Node : Project_Node_Id;
1447       To   : Project_Node_Id)
1448    is
1449    begin
1450       pragma Assert
1451         (Node /= Empty_Node
1452           and then
1453             Project_Nodes.Table (Node).Kind = N_With_Clause);
1454       Project_Nodes.Table (Node).Field2 := To;
1455    end Set_Next_With_Clause_Of;
1456
1457    -----------------------
1458    -- Set_Package_Id_Of --
1459    -----------------------
1460
1461    procedure Set_Package_Id_Of
1462      (Node : Project_Node_Id;
1463       To   : Package_Node_Id)
1464    is
1465    begin
1466       pragma Assert
1467         (Node /= Empty_Node
1468           and then
1469             Project_Nodes.Table (Node).Kind = N_Package_Declaration);
1470       Project_Nodes.Table (Node).Pkg_Id := To;
1471    end Set_Package_Id_Of;
1472
1473    -------------------------
1474    -- Set_Package_Node_Of --
1475    -------------------------
1476
1477    procedure Set_Package_Node_Of
1478      (Node : Project_Node_Id;
1479       To   : Project_Node_Id)
1480    is
1481    begin
1482       pragma Assert
1483         (Node /= Empty_Node
1484           and then
1485             (Project_Nodes.Table (Node).Kind = N_Variable_Reference
1486                or else
1487              Project_Nodes.Table (Node).Kind = N_Attribute_Reference));
1488       Project_Nodes.Table (Node).Field2 := To;
1489    end Set_Package_Node_Of;
1490
1491    ----------------------
1492    -- Set_Path_Name_Of --
1493    ----------------------
1494
1495    procedure Set_Path_Name_Of
1496      (Node : Project_Node_Id;
1497       To   : Name_Id)
1498    is
1499    begin
1500       pragma Assert
1501         (Node /= Empty_Node
1502           and then
1503             (Project_Nodes.Table (Node).Kind = N_Project
1504                or else
1505              Project_Nodes.Table (Node).Kind = N_With_Clause));
1506       Project_Nodes.Table (Node).Path_Name := To;
1507    end Set_Path_Name_Of;
1508
1509    --------------------------------
1510    -- Set_Project_Declaration_Of --
1511    --------------------------------
1512
1513    procedure Set_Project_Declaration_Of
1514      (Node : Project_Node_Id;
1515       To   : Project_Node_Id)
1516    is
1517    begin
1518       pragma Assert
1519         (Node /= Empty_Node
1520          and then
1521            Project_Nodes.Table (Node).Kind = N_Project);
1522       Project_Nodes.Table (Node).Field2 := To;
1523    end Set_Project_Declaration_Of;
1524
1525    -------------------------
1526    -- Set_Project_Node_Of --
1527    -------------------------
1528
1529    procedure Set_Project_Node_Of
1530      (Node         : Project_Node_Id;
1531       To           : Project_Node_Id;
1532       Limited_With : Boolean := False)
1533    is
1534    begin
1535       pragma Assert
1536         (Node /= Empty_Node
1537           and then
1538             (Project_Nodes.Table (Node).Kind = N_With_Clause
1539                or else
1540              Project_Nodes.Table (Node).Kind = N_Variable_Reference
1541                or else
1542              Project_Nodes.Table (Node).Kind = N_Attribute_Reference));
1543       Project_Nodes.Table (Node).Field1 := To;
1544
1545       if Project_Nodes.Table (Node).Kind = N_With_Clause
1546         and then not Limited_With
1547       then
1548          Project_Nodes.Table (Node).Field3 := To;
1549       end if;
1550    end Set_Project_Node_Of;
1551
1552    ---------------------------------------
1553    -- Set_Project_Of_Renamed_Package_Of --
1554    ---------------------------------------
1555
1556    procedure Set_Project_Of_Renamed_Package_Of
1557      (Node : Project_Node_Id;
1558       To   : Project_Node_Id)
1559    is
1560    begin
1561       pragma Assert
1562         (Node /= Empty_Node
1563           and then
1564             Project_Nodes.Table (Node).Kind = N_Package_Declaration);
1565       Project_Nodes.Table (Node).Field1 := To;
1566    end Set_Project_Of_Renamed_Package_Of;
1567
1568    ------------------------
1569    -- Set_String_Type_Of --
1570    ------------------------
1571
1572    procedure Set_String_Type_Of
1573      (Node : Project_Node_Id;
1574       To   : Project_Node_Id)
1575    is
1576    begin
1577       pragma Assert
1578         (Node /= Empty_Node
1579           and then
1580             (Project_Nodes.Table (Node).Kind = N_Variable_Reference
1581                or else
1582              Project_Nodes.Table (Node).Kind = N_Typed_Variable_Declaration)
1583            and then
1584             Project_Nodes.Table (To).Kind    = N_String_Type_Declaration);
1585
1586       if Project_Nodes.Table (Node).Kind = N_Variable_Reference then
1587          Project_Nodes.Table (Node).Field3 := To;
1588       else
1589          Project_Nodes.Table (Node).Field2 := To;
1590       end if;
1591    end Set_String_Type_Of;
1592
1593    -------------------------
1594    -- Set_String_Value_Of --
1595    -------------------------
1596
1597    procedure Set_String_Value_Of
1598      (Node : Project_Node_Id;
1599       To   : Name_Id)
1600    is
1601    begin
1602       pragma Assert
1603         (Node /= Empty_Node
1604           and then
1605             (Project_Nodes.Table (Node).Kind = N_With_Clause
1606                or else
1607              Project_Nodes.Table (Node).Kind = N_Literal_String));
1608       Project_Nodes.Table (Node).Value := To;
1609    end Set_String_Value_Of;
1610
1611    --------------------
1612    -- String_Type_Of --
1613    --------------------
1614
1615    function String_Type_Of  (Node : Project_Node_Id)
1616                             return Project_Node_Id is
1617    begin
1618       pragma Assert
1619         (Node /= Empty_Node
1620           and then
1621             (Project_Nodes.Table (Node).Kind = N_Variable_Reference
1622                or else
1623              Project_Nodes.Table (Node).Kind = N_Typed_Variable_Declaration));
1624
1625       if Project_Nodes.Table (Node).Kind = N_Variable_Reference then
1626          return Project_Nodes.Table (Node).Field3;
1627       else
1628          return Project_Nodes.Table (Node).Field2;
1629       end if;
1630    end String_Type_Of;
1631
1632    ---------------------
1633    -- String_Value_Of --
1634    ---------------------
1635
1636    function String_Value_Of (Node : Project_Node_Id) return Name_Id is
1637    begin
1638       pragma Assert
1639         (Node /= Empty_Node
1640           and then
1641            (Project_Nodes.Table (Node).Kind = N_With_Clause
1642               or else
1643             Project_Nodes.Table (Node).Kind = N_Literal_String));
1644       return Project_Nodes.Table (Node).Value;
1645    end String_Value_Of;
1646
1647    --------------------
1648    -- Value_Is_Valid --
1649    --------------------
1650
1651    function Value_Is_Valid
1652      (For_Typed_Variable : Project_Node_Id;
1653       Value              : Name_Id)
1654       return               Boolean
1655    is
1656    begin
1657       pragma Assert
1658         (For_Typed_Variable /= Empty_Node
1659           and then
1660            (Project_Nodes.Table (For_Typed_Variable).Kind =
1661                                      N_Typed_Variable_Declaration));
1662
1663       declare
1664          Current_String : Project_Node_Id :=
1665                             First_Literal_String
1666                               (String_Type_Of (For_Typed_Variable));
1667
1668       begin
1669          while Current_String /= Empty_Node
1670            and then
1671              String_Value_Of (Current_String) /= Value
1672          loop
1673             Current_String :=
1674               Next_Literal_String (Current_String);
1675          end loop;
1676
1677          return Current_String /= Empty_Node;
1678       end;
1679
1680    end Value_Is_Valid;
1681
1682 end Prj.Tree;