* config/i386/uwin.h: Remove SUBTARGET_PROLOGUE.
[official-gcc.git] / gcc / ada / lib.adb
blobb58fa7e78c93857c37c8e98b0387e73b26834721
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- L I B --
6 -- --
7 -- B o d y --
8 -- --
9 -- Copyright (C) 1992-2001 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 -- As a special exception, if other files instantiate generics from this --
23 -- unit, or you link this unit with other files to produce an executable, --
24 -- this unit does not by itself cause the resulting executable to be --
25 -- covered by the GNU General Public License. This exception does not --
26 -- however invalidate any other reasons why the executable file might be --
27 -- covered by the GNU Public License. --
28 -- --
29 -- GNAT was originally developed by the GNAT team at New York University. --
30 -- Extensive contributions were provided by Ada Core Technologies Inc. --
31 -- --
32 ------------------------------------------------------------------------------
34 pragma Style_Checks (All_Checks);
35 -- Subprogram ordering not enforced in this unit
36 -- (because of some logical groupings).
38 with Atree; use Atree;
39 with Einfo; use Einfo;
40 with Fname; use Fname;
41 with Namet; use Namet;
42 with Namet; use Namet;
43 with Output; use Output;
44 with Sinfo; use Sinfo;
45 with Sinput; use Sinput;
46 with Stand; use Stand;
47 with Stringt; use Stringt;
48 with Tree_IO; use Tree_IO;
49 with Uname; use Uname;
51 package body Lib is
53 -----------------------
54 -- Local Subprograms --
55 -----------------------
57 type SEU_Result is (
58 Yes_Before, -- S1 is in same extended unit as S2 and appears before it
59 Yes_Same, -- S1 is in same extended unit as S2, Slocs are the same
60 Yes_After, -- S1 is in same extended unit as S2, and appears after it
61 No); -- S2 is not in same extended unit as S2
63 function Check_Same_Extended_Unit (S1, S2 : Source_Ptr) return SEU_Result;
64 -- Used by In_Same_Extended_Unit and Earlier_In_Extended_Unit. Returns
65 -- value as described above.
67 --------------------------------------------
68 -- Access Functions for Unit Table Fields --
69 --------------------------------------------
71 function Cunit (U : Unit_Number_Type) return Node_Id is
72 begin
73 return Units.Table (U).Cunit;
74 end Cunit;
76 function Cunit_Entity (U : Unit_Number_Type) return Entity_Id is
77 begin
78 return Units.Table (U).Cunit_Entity;
79 end Cunit_Entity;
81 function Dependency_Num (U : Unit_Number_Type) return Nat is
82 begin
83 return Units.Table (U).Dependency_Num;
84 end Dependency_Num;
86 function Dependent_Unit (U : Unit_Number_Type) return Boolean is
87 begin
88 return Units.Table (U).Dependent_Unit;
89 end Dependent_Unit;
91 function Dynamic_Elab (U : Unit_Number_Type) return Boolean is
92 begin
93 return Units.Table (U).Dynamic_Elab;
94 end Dynamic_Elab;
96 function Error_Location (U : Unit_Number_Type) return Source_Ptr is
97 begin
98 return Units.Table (U).Error_Location;
99 end Error_Location;
101 function Expected_Unit (U : Unit_Number_Type) return Unit_Name_Type is
102 begin
103 return Units.Table (U).Expected_Unit;
104 end Expected_Unit;
106 function Fatal_Error (U : Unit_Number_Type) return Boolean is
107 begin
108 return Units.Table (U).Fatal_Error;
109 end Fatal_Error;
111 function Generate_Code (U : Unit_Number_Type) return Boolean is
112 begin
113 return Units.Table (U).Generate_Code;
114 end Generate_Code;
116 function Has_RACW (U : Unit_Number_Type) return Boolean is
117 begin
118 return Units.Table (U).Has_RACW;
119 end Has_RACW;
121 function Ident_String (U : Unit_Number_Type) return Node_Id is
122 begin
123 return Units.Table (U).Ident_String;
124 end Ident_String;
126 function Loading (U : Unit_Number_Type) return Boolean is
127 begin
128 return Units.Table (U).Loading;
129 end Loading;
131 function Main_Priority (U : Unit_Number_Type) return Int is
132 begin
133 return Units.Table (U).Main_Priority;
134 end Main_Priority;
136 function Source_Index (U : Unit_Number_Type) return Source_File_Index is
137 begin
138 return Units.Table (U).Source_Index;
139 end Source_Index;
141 function Unit_File_Name (U : Unit_Number_Type) return File_Name_Type is
142 begin
143 return Units.Table (U).Unit_File_Name;
144 end Unit_File_Name;
146 function Unit_Name (U : Unit_Number_Type) return Unit_Name_Type is
147 begin
148 return Units.Table (U).Unit_Name;
149 end Unit_Name;
151 ------------------------------------------
152 -- Subprograms to Set Unit Table Fields --
153 ------------------------------------------
155 procedure Set_Cunit (U : Unit_Number_Type; N : Node_Id) is
156 begin
157 Units.Table (U).Cunit := N;
158 end Set_Cunit;
160 procedure Set_Cunit_Entity (U : Unit_Number_Type; E : Entity_Id) is
161 begin
162 Units.Table (U).Cunit_Entity := E;
163 Set_Is_Compilation_Unit (E);
164 end Set_Cunit_Entity;
166 procedure Set_Dynamic_Elab (U : Unit_Number_Type; B : Boolean := True) is
167 begin
168 Units.Table (U).Dynamic_Elab := B;
169 end Set_Dynamic_Elab;
171 procedure Set_Error_Location (U : Unit_Number_Type; W : Source_Ptr) is
172 begin
173 Units.Table (U).Error_Location := W;
174 end Set_Error_Location;
176 procedure Set_Fatal_Error (U : Unit_Number_Type; B : Boolean := True) is
177 begin
178 Units.Table (U).Fatal_Error := B;
179 end Set_Fatal_Error;
181 procedure Set_Generate_Code (U : Unit_Number_Type; B : Boolean := True) is
182 begin
183 Units.Table (U).Generate_Code := B;
184 end Set_Generate_Code;
186 procedure Set_Has_RACW (U : Unit_Number_Type; B : Boolean := True) is
187 begin
188 Units.Table (U).Has_RACW := B;
189 end Set_Has_RACW;
191 procedure Set_Ident_String (U : Unit_Number_Type; N : Node_Id) is
192 begin
193 Units.Table (U).Ident_String := N;
194 end Set_Ident_String;
196 procedure Set_Loading (U : Unit_Number_Type; B : Boolean := True) is
197 begin
198 Units.Table (U).Loading := B;
199 end Set_Loading;
201 procedure Set_Main_Priority (U : Unit_Number_Type; P : Int) is
202 begin
203 Units.Table (U).Main_Priority := P;
204 end Set_Main_Priority;
206 procedure Set_Unit_Name (U : Unit_Number_Type; N : Unit_Name_Type) is
207 begin
208 Units.Table (U).Unit_Name := N;
209 end Set_Unit_Name;
211 ------------------------------
212 -- Check_Same_Extended_Unit --
213 ------------------------------
215 function Check_Same_Extended_Unit (S1, S2 : Source_Ptr) return SEU_Result is
216 Sloc1 : Source_Ptr;
217 Sloc2 : Source_Ptr;
218 Sind1 : Source_File_Index;
219 Sind2 : Source_File_Index;
220 Inst1 : Source_Ptr;
221 Inst2 : Source_Ptr;
222 Unum1 : Unit_Number_Type;
223 Unum2 : Unit_Number_Type;
224 Unit1 : Node_Id;
225 Unit2 : Node_Id;
226 Depth1 : Nat;
227 Depth2 : Nat;
229 begin
230 if S1 = No_Location or else S2 = No_Location then
231 return No;
233 elsif S1 = Standard_Location then
234 if S2 = Standard_Location then
235 return Yes_Same;
236 else
237 return No;
238 end if;
240 elsif S2 = Standard_Location then
241 return No;
242 end if;
244 Sloc1 := S1;
245 Sloc2 := S2;
246 Unum1 := Get_Code_Unit (Sloc1);
247 Unum2 := Get_Code_Unit (Sloc2);
249 loop
250 Sind1 := Get_Source_File_Index (Sloc1);
251 Sind2 := Get_Source_File_Index (Sloc2);
253 if Sind1 = Sind2 then
254 if Sloc1 < Sloc2 then
255 return Yes_Before;
256 elsif Sloc1 > Sloc2 then
257 return Yes_After;
258 else
259 return Yes_Same;
260 end if;
261 end if;
263 -- OK, the two nodes are in separate source elements, but this is not
264 -- decisive, because of the issue of subunits and instantiations.
266 -- First we deal with subunits, since if the subunit is in an
267 -- instantiation, we know that the parent is in the corresponding
268 -- instantiation, since that is the only way we can have a subunit
269 -- that is part of an instantiation.
271 Unit1 := Unit (Cunit (Unum1));
272 Unit2 := Unit (Cunit (Unum2));
274 if Nkind (Unit1) = N_Subunit
275 and then Present (Corresponding_Stub (Unit1))
276 then
277 -- Both in subunits. They could have a common ancestor. If they
278 -- do, then the deeper one must have a longer unit name. Replace
279 -- the deeper one with its corresponding stub, in order to find
280 -- nearest common ancestor, if any.
282 if Nkind (Unit2) = N_Subunit
283 and then Present (Corresponding_Stub (Unit2))
284 then
285 if Length_Of_Name (Unit_Name (Unum1)) <
286 Length_Of_Name (Unit_Name (Unum2))
287 then
288 Sloc2 := Sloc (Corresponding_Stub (Unit2));
289 Unum2 := Get_Source_Unit (Sloc2);
290 goto Continue;
292 else
293 Sloc1 := Sloc (Corresponding_Stub (Unit1));
294 Unum1 := Get_Source_Unit (Sloc1);
295 goto Continue;
296 end if;
298 -- Nod1 in subunit, Nod2 not
300 else
301 Sloc1 := Sloc (Corresponding_Stub (Unit1));
302 Unum1 := Get_Source_Unit (Sloc1);
303 goto Continue;
304 end if;
306 -- Nod2 in subunit, Nod1 not
308 elsif Nkind (Unit2) = N_Subunit
309 and then Present (Corresponding_Stub (Unit2))
310 then
311 Sloc2 := Sloc (Corresponding_Stub (Unit2));
312 Unum2 := Get_Source_Unit (Sloc2);
313 goto Continue;
314 end if;
316 -- At this stage we know that neither is a subunit, so we deal
317 -- with instantiations, since we culd have a common ancestor
319 Inst1 := Instantiation (Sind1);
320 Inst2 := Instantiation (Sind2);
322 if Inst1 /= No_Location then
324 -- Both are instantiations
326 if Inst2 /= No_Location then
328 Depth1 := Instantiation_Depth (Sloc1);
329 Depth2 := Instantiation_Depth (Sloc2);
331 if Depth1 < Depth2 then
332 Sloc2 := Inst2;
333 Unum2 := Get_Source_Unit (Sloc2);
334 goto Continue;
336 elsif Depth1 > Depth2 then
337 Sloc1 := Inst1;
338 Unum1 := Get_Source_Unit (Sloc1);
339 goto Continue;
341 else
342 Sloc1 := Inst1;
343 Sloc2 := Inst2;
344 Unum1 := Get_Source_Unit (Sloc1);
345 Unum2 := Get_Source_Unit (Sloc2);
346 goto Continue;
347 end if;
349 -- Only first node is in instantiation
351 else
352 Sloc1 := Inst1;
353 Unum1 := Get_Source_Unit (Sloc1);
354 goto Continue;
355 end if;
357 -- Only second node is instantiation
359 elsif Inst2 /= No_Location then
360 Sloc2 := Inst2;
361 Unum2 := Get_Source_Unit (Sloc2);
362 goto Continue;
363 end if;
365 -- No instantiations involved, so we are not in the same unit
366 -- However, there is one case still to check, namely the case
367 -- where one location is in the spec, and the other in the
368 -- corresponding body (the spec location is earlier).
370 if Nkind (Unit1) = N_Subprogram_Body
371 or else
372 Nkind (Unit1) = N_Package_Body
373 then
374 if Library_Unit (Cunit (Unum1)) = Cunit (Unum2) then
375 return Yes_After;
376 end if;
378 elsif Nkind (Unit2) = N_Subprogram_Body
379 or else
380 Nkind (Unit2) = N_Package_Body
381 then
382 if Library_Unit (Cunit (Unum2)) = Cunit (Unum1) then
383 return Yes_Before;
384 end if;
385 end if;
387 -- If that special case does not occur, then we are certain that
388 -- the two locations are really in separate units.
390 return No;
392 <<Continue>>
393 null;
394 end loop;
396 end Check_Same_Extended_Unit;
398 -------------------------------
399 -- Compilation_Switches_Last --
400 -------------------------------
402 function Compilation_Switches_Last return Nat is
403 begin
404 return Compilation_Switches.Last;
405 end Compilation_Switches_Last;
407 ------------------------------
408 -- Earlier_In_Extended_Unit --
409 ------------------------------
411 function Earlier_In_Extended_Unit (S1, S2 : Source_Ptr) return Boolean is
412 begin
413 return Check_Same_Extended_Unit (S1, S2) = Yes_Before;
414 end Earlier_In_Extended_Unit;
416 ----------------------------
417 -- Entity_Is_In_Main_Unit --
418 ----------------------------
420 function Entity_Is_In_Main_Unit (E : Entity_Id) return Boolean is
421 S : Entity_Id;
423 begin
424 S := Scope (E);
426 while S /= Standard_Standard loop
427 if S = Main_Unit_Entity then
428 return True;
429 elsif Ekind (S) = E_Package and then Is_Child_Unit (S) then
430 return False;
431 else
432 S := Scope (S);
433 end if;
434 end loop;
436 return False;
437 end Entity_Is_In_Main_Unit;
439 ---------------------------------
440 -- Generic_Separately_Compiled --
441 ---------------------------------
443 function Generic_Separately_Compiled (E : Entity_Id) return Boolean is
444 begin
445 -- We do not generate object files for internal generics, because
446 -- the only thing they would contain is the elaboration boolean, and
447 -- we are careful to elaborate all predefined units first anyway, so
448 -- this boolean is not needed.
450 if Is_Internal_File_Name
451 (Fname => Unit_File_Name (Get_Source_Unit (E)),
452 Renamings_Included => True)
453 then
454 return False;
456 -- All other generic units do generate object files
458 else
459 return True;
460 end if;
461 end Generic_Separately_Compiled;
463 -------------------
464 -- Get_Code_Unit --
465 -------------------
467 function Get_Code_Unit (S : Source_Ptr) return Unit_Number_Type is
468 Source_File : Source_File_Index :=
469 Get_Source_File_Index (Top_Level_Location (S));
471 begin
472 for U in Units.First .. Units.Last loop
473 if Source_Index (U) = Source_File then
474 return U;
475 end if;
476 end loop;
478 -- If not in the table, must be the main source unit, and we just
479 -- have not got it put into the table yet.
481 return Main_Unit;
482 end Get_Code_Unit;
484 function Get_Code_Unit (N : Node_Or_Entity_Id) return Unit_Number_Type is
485 begin
486 return Get_Code_Unit (Sloc (N));
487 end Get_Code_Unit;
489 ----------------------------
490 -- Get_Compilation_Switch --
491 ----------------------------
493 function Get_Compilation_Switch (N : Pos) return String_Ptr is
494 begin
495 if N <= Compilation_Switches.Last then
496 return Compilation_Switches.Table (N);
498 else
499 return null;
500 end if;
501 end Get_Compilation_Switch;
503 ----------------------------------
504 -- Get_Cunit_Entity_Unit_Number --
505 ----------------------------------
507 function Get_Cunit_Entity_Unit_Number
508 (E : Entity_Id)
509 return Unit_Number_Type
511 begin
512 for U in Units.First .. Units.Last loop
513 if Cunit_Entity (U) = E then
514 return U;
515 end if;
516 end loop;
518 -- If not in the table, must be the main source unit, and we just
519 -- have not got it put into the table yet.
521 return Main_Unit;
522 end Get_Cunit_Entity_Unit_Number;
524 ---------------------------
525 -- Get_Cunit_Unit_Number --
526 ---------------------------
528 function Get_Cunit_Unit_Number (N : Node_Id) return Unit_Number_Type is
529 begin
530 for U in Units.First .. Units.Last loop
531 if Cunit (U) = N then
532 return U;
533 end if;
534 end loop;
536 -- If not in the table, must be the main source unit, and we just
537 -- have not got it put into the table yet.
539 return Main_Unit;
540 end Get_Cunit_Unit_Number;
542 ---------------------
543 -- Get_Source_Unit --
544 ---------------------
546 function Get_Source_Unit (S : Source_Ptr) return Unit_Number_Type is
547 Source_File : Source_File_Index :=
548 Get_Source_File_Index (Top_Level_Location (S));
550 begin
551 Source_File := Get_Source_File_Index (S);
552 while Template (Source_File) /= No_Source_File loop
553 Source_File := Template (Source_File);
554 end loop;
556 for U in Units.First .. Units.Last loop
557 if Source_Index (U) = Source_File then
558 return U;
559 end if;
560 end loop;
562 -- If not in the table, must be the main source unit, and we just
563 -- have not got it put into the table yet.
565 return Main_Unit;
566 end Get_Source_Unit;
568 function Get_Source_Unit (N : Node_Or_Entity_Id) return Unit_Number_Type is
569 begin
570 return Get_Source_Unit (Sloc (N));
571 end Get_Source_Unit;
573 --------------------------------
574 -- In_Extended_Main_Code_Unit --
575 --------------------------------
577 function In_Extended_Main_Code_Unit
578 (N : Node_Or_Entity_Id)
579 return Boolean
581 begin
582 if Sloc (N) = Standard_Location then
583 return True;
585 elsif Sloc (N) = No_Location then
586 return False;
588 -- Special case Itypes to test the Sloc of the associated node. The
589 -- reason we do this is for possible calls from gigi after -gnatD
590 -- processing is complete in sprint. This processing updates the
591 -- sloc fields of all nodes in the tree, but itypes are not in the
592 -- tree so their slocs do not get updated.
594 elsif Nkind (N) = N_Defining_Identifier
595 and then Is_Itype (N)
596 then
597 return In_Extended_Main_Code_Unit (Associated_Node_For_Itype (N));
599 elsif Get_Code_Unit (Sloc (N)) = Get_Code_Unit (Cunit (Main_Unit)) then
600 return True;
602 else -- node may be in spec of main unit
603 return
604 In_Same_Extended_Unit (Sloc (N), Sloc (Cunit (Main_Unit)));
605 end if;
606 end In_Extended_Main_Code_Unit;
608 ----------------------------------
609 -- In_Extended_Main_Source_Unit --
610 ----------------------------------
612 function In_Extended_Main_Source_Unit
613 (N : Node_Or_Entity_Id)
614 return Boolean
616 begin
617 if Sloc (N) = Standard_Location then
618 return True;
620 elsif Sloc (N) = No_Location then
621 return False;
623 -- Special case Itypes to test the Sloc of the associated node. The
624 -- reason we do this is for possible calls from gigi after -gnatD
625 -- processing is complete in sprint. This processing updates the
626 -- sloc fields of all nodes in the tree, but itypes are not in the
627 -- tree so their slocs do not get updated.
629 elsif Nkind (N) = N_Defining_Identifier
630 and then Is_Itype (N)
631 then
632 return In_Extended_Main_Source_Unit (Associated_Node_For_Itype (N));
634 else
635 return
636 In_Same_Extended_Unit
637 (Original_Location (Sloc (N)),
638 Original_Location (Sloc (Cunit (Main_Unit))));
639 end if;
640 end In_Extended_Main_Source_Unit;
642 -----------------------
643 -- In_Same_Code_Unit --
644 -----------------------
646 function In_Same_Code_Unit (N1, N2 : Node_Or_Entity_Id) return Boolean is
647 S1 : constant Source_Ptr := Sloc (N1);
648 S2 : constant Source_Ptr := Sloc (N2);
650 begin
651 if S1 = No_Location or else S2 = No_Location then
652 return False;
654 elsif S1 = Standard_Location then
655 return S2 = Standard_Location;
657 elsif S2 = Standard_Location then
658 return False;
659 end if;
661 return Get_Code_Unit (N1) = Get_Code_Unit (N2);
662 end In_Same_Code_Unit;
664 ---------------------------
665 -- In_Same_Extended_Unit --
666 ---------------------------
668 function In_Same_Extended_Unit (S1, S2 : Source_Ptr) return Boolean is
669 begin
670 return Check_Same_Extended_Unit (S1, S2) /= No;
671 end In_Same_Extended_Unit;
673 -------------------------
674 -- In_Same_Source_Unit --
675 -------------------------
677 function In_Same_Source_Unit (N1, N2 : Node_Or_Entity_Id) return Boolean is
678 S1 : constant Source_Ptr := Sloc (N1);
679 S2 : constant Source_Ptr := Sloc (N2);
681 begin
682 if S1 = No_Location or else S2 = No_Location then
683 return False;
685 elsif S1 = Standard_Location then
686 return S2 = Standard_Location;
688 elsif S2 = Standard_Location then
689 return False;
690 end if;
692 return Get_Source_Unit (N1) = Get_Source_Unit (N2);
693 end In_Same_Source_Unit;
695 -----------------------------
696 -- Increment_Serial_Number --
697 -----------------------------
699 function Increment_Serial_Number return Nat is
700 TSN : Int renames Units.Table (Current_Sem_Unit).Serial_Number;
702 begin
703 TSN := TSN + 1;
704 return TSN;
705 end Increment_Serial_Number;
707 ----------------
708 -- Initialize --
709 ----------------
711 procedure Initialize is
712 begin
713 Linker_Option_Lines.Init;
714 Load_Stack.Init;
715 Units.Init;
716 Unit_Exception_Table_Present := False;
717 Compilation_Switches.Init;
718 end Initialize;
720 ---------------
721 -- Is_Loaded --
722 ---------------
724 function Is_Loaded (Uname : Unit_Name_Type) return Boolean is
725 begin
726 for Unum in Units.First .. Units.Last loop
727 if Uname = Unit_Name (Unum) then
728 return True;
729 end if;
730 end loop;
732 return False;
733 end Is_Loaded;
735 ---------------
736 -- Last_Unit --
737 ---------------
739 function Last_Unit return Unit_Number_Type is
740 begin
741 return Units.Last;
742 end Last_Unit;
744 ----------
745 -- List --
746 ----------
748 procedure List (File_Names_Only : Boolean := False) is separate;
750 ----------
751 -- Lock --
752 ----------
754 procedure Lock is
755 begin
756 Linker_Option_Lines.Locked := True;
757 Load_Stack.Locked := True;
758 Units.Locked := True;
759 Linker_Option_Lines.Release;
760 Load_Stack.Release;
761 Units.Release;
762 end Lock;
764 ---------------
765 -- Num_Units --
766 ---------------
768 function Num_Units return Nat is
769 begin
770 return Int (Units.Last) - Int (Main_Unit) + 1;
771 end Num_Units;
773 ----------------------------------
774 -- Replace_Linker_Option_String --
775 ----------------------------------
777 procedure Replace_Linker_Option_String
778 (S : String_Id; Match_String : String)
780 begin
781 if Match_String'Length > 0 then
782 for J in 1 .. Linker_Option_Lines.Last loop
783 String_To_Name_Buffer (Linker_Option_Lines.Table (J).Option);
785 if Match_String = Name_Buffer (1 .. Match_String'Length) then
786 Linker_Option_Lines.Table (J).Option := S;
787 return;
788 end if;
789 end loop;
790 end if;
792 Store_Linker_Option_String (S);
793 end Replace_Linker_Option_String;
795 ----------
796 -- Sort --
797 ----------
799 procedure Sort (Tbl : in out Unit_Ref_Table) is separate;
801 ------------------------------
802 -- Store_Compilation_Switch --
803 ------------------------------
805 procedure Store_Compilation_Switch (Switch : String) is
806 begin
807 Compilation_Switches.Increment_Last;
808 Compilation_Switches.Table (Compilation_Switches.Last) :=
809 new String'(Switch);
810 end Store_Compilation_Switch;
812 --------------------------------
813 -- Store_Linker_Option_String --
814 --------------------------------
816 procedure Store_Linker_Option_String (S : String_Id) is
817 begin
818 Linker_Option_Lines.Increment_Last;
819 Linker_Option_Lines.Table (Linker_Option_Lines.Last) :=
820 (Option => S, Unit => Current_Sem_Unit);
821 end Store_Linker_Option_String;
823 ---------------
824 -- Tree_Read --
825 ---------------
827 procedure Tree_Read is
828 N : Nat;
829 S : String_Ptr;
831 begin
832 Units.Tree_Read;
834 -- Read Compilation_Switches table
836 Tree_Read_Int (N);
837 Compilation_Switches.Set_Last (N);
839 for J in 1 .. N loop
840 Tree_Read_Str (S);
841 Compilation_Switches.Table (J) := S;
842 end loop;
843 end Tree_Read;
845 ----------------
846 -- Tree_Write --
847 ----------------
849 procedure Tree_Write is
850 begin
851 Units.Tree_Write;
853 -- Write Compilation_Switches table
855 Tree_Write_Int (Compilation_Switches.Last);
857 for J in 1 .. Compilation_Switches.Last loop
858 Tree_Write_Str (Compilation_Switches.Table (J));
859 end loop;
860 end Tree_Write;
862 -----------------
863 -- Version_Get --
864 -----------------
866 function Version_Get (U : Unit_Number_Type) return Word_Hex_String is
867 begin
868 return Get_Hex_String (Units.Table (U).Version);
869 end Version_Get;
871 ------------------------
872 -- Version_Referenced --
873 ------------------------
875 procedure Version_Referenced (S : String_Id) is
876 begin
877 Version_Ref.Append (S);
878 end Version_Referenced;
880 end Lib;