arm.c (arm_return_in_memory): Fix return type.
[official-gcc.git] / gcc / ada / prj-attr.adb
blobd3ff283ada275e615aec1994692160ac3bb51525
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- P R J . A T T R --
6 -- --
7 -- B o d y --
8 -- --
9 -- Copyright (C) 2001-2008, 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 3, 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 COPYING3. If not, go to --
19 -- http://www.gnu.org/licenses for a complete copy of the license. --
20 -- --
21 -- GNAT was originally developed by the GNAT team at New York University. --
22 -- Extensive contributions were provided by Ada Core Technologies Inc. --
23 -- --
24 ------------------------------------------------------------------------------
26 with Osint;
27 with Prj.Com; use Prj.Com;
29 with GNAT.Case_Util; use GNAT.Case_Util;
31 package body Prj.Attr is
33 use GNAT;
35 -- Data for predefined attributes and packages
37 -- Names are in lower case and end with '#'
39 -- Package names are preceded by 'P'
41 -- Attribute names are preceded by two or three letters:
43 -- The first letter is one of
44 -- 'S' for Single
45 -- 's' for Single with optional index
46 -- 'L' for List
47 -- 'l' for List of strings with optional indexes
49 -- The second letter is one of
50 -- 'V' for single variable
51 -- 'A' for associative array
52 -- 'a' for case insensitive associative array
53 -- 'b' for associative array, case insensitive if file names are case
54 -- insensitive
55 -- 'c' same as 'b', with optional index
57 -- The third optional letter is
58 -- 'R' to indicate that the attribute is read-only
60 -- End is indicated by two consecutive '#'
62 Initialization_Data : constant String :=
64 -- project level attributes
66 -- General
68 "SVRname#" &
69 "lVmain#" &
70 "LVlanguages#" &
71 "SVmain_language#" &
72 "Lbroots#" &
73 "SVexternally_built#" &
75 -- Directories
77 "SVobject_dir#" &
78 "SVexec_dir#" &
79 "LVsource_dirs#" &
80 "Lainherit_source_path#" &
81 "LVexcluded_source_dirs#" &
83 -- Source files
85 "LVsource_files#" &
86 "LVlocally_removed_files#" &
87 "LVexcluded_source_files#" &
88 "SVsource_list_file#" &
90 -- Libraries
92 "SVlibrary_dir#" &
93 "SVlibrary_name#" &
94 "SVlibrary_kind#" &
95 "SVlibrary_version#" &
96 "LVlibrary_interface#" &
97 "SVlibrary_auto_init#" &
98 "LVlibrary_options#" &
99 "SVlibrary_src_dir#" &
100 "SVlibrary_ali_dir#" &
101 "SVlibrary_gcc#" &
102 "SVlibrary_symbol_file#" &
103 "SVlibrary_symbol_policy#" &
104 "SVlibrary_reference_symbol_file#" &
106 -- Configuration - General
108 "SVdefault_language#" &
109 "LVrun_path_option#" &
110 "Satoolchain_version#" &
111 "Satoolchain_description#" &
113 -- Configuration - Libraries
115 "SVlibrary_builder#" &
116 "SVlibrary_support#" &
118 -- Configuration - Archives
120 "LVarchive_builder#" &
121 "LVarchive_builder_append_option#" &
122 "LVarchive_indexer#" &
123 "SVarchive_suffix#" &
124 "LVlibrary_partial_linker#" &
126 -- Configuration - Shared libraries
128 "SVshared_library_prefix#" &
129 "SVshared_library_suffix#" &
130 "SVsymbolic_link_supported#" &
131 "SVlibrary_major_minor_id_supported#" &
132 "SVlibrary_auto_init_supported#" &
133 "LVshared_library_minimum_switches#" &
134 "LVlibrary_version_switches#" &
135 "Saruntime_library_dir#" &
137 -- package Naming
139 "Pnaming#" &
140 "Saspecification_suffix#" &
141 "Saspec_suffix#" &
142 "Saimplementation_suffix#" &
143 "Sabody_suffix#" &
144 "SVseparate_suffix#" &
145 "SVcasing#" &
146 "SVdot_replacement#" &
147 "sAspecification#" &
148 "sAspec#" &
149 "sAimplementation#" &
150 "sAbody#" &
151 "Laspecification_exceptions#" &
152 "Laimplementation_exceptions#" &
154 -- package Compiler
156 "Pcompiler#" &
157 "Ladefault_switches#" &
158 "Lcswitches#" &
159 "SVlocal_configuration_pragmas#" &
160 "Salocal_config_file#" &
162 -- Configuration - Compiling
164 "Sadriver#" &
165 "Larequired_switches#" &
166 "Lapic_option#" &
168 -- Configuration - Mapping files
170 "Lamapping_file_switches#" &
171 "Samapping_spec_suffix#" &
172 "Samapping_body_suffix#" &
174 -- Configuration - Config files
176 "Laconfig_file_switches#" &
177 "Saconfig_body_file_name#" &
178 "Saconfig_spec_file_name#" &
179 "Saconfig_body_file_name_pattern#" &
180 "Saconfig_spec_file_name_pattern#" &
181 "Saconfig_file_unique#" &
183 -- Configuration - Dependencies
185 "Ladependency_switches#" &
186 "Ladependency_driver#" &
188 -- Configuration - Search paths
190 "Lainclude_switches#" &
191 "Sainclude_path#" &
192 "Sainclude_path_file#" &
194 -- package Builder
196 "Pbuilder#" &
197 "Ladefault_switches#" &
198 "Lcswitches#" &
199 "Scexecutable#" &
200 "SVexecutable_suffix#" &
201 "SVglobal_configuration_pragmas#" &
202 "Saglobal_config_file#" &
204 -- package gnatls
206 "Pgnatls#" &
207 "LVswitches#" &
209 -- package Binder
211 "Pbinder#" &
212 "Ladefault_switches#" &
213 "Lcswitches#" &
215 -- Configuration - Binding
217 "Sadriver#" &
218 "Larequired_switches#" &
219 "Saprefix#" &
220 "Saobjects_path#" &
221 "Saobjects_path_file#" &
223 -- package Linker
225 "Plinker#" &
226 "LVrequired_switches#" &
227 "Ladefault_switches#" &
228 "Lcswitches#" &
229 "LVlinker_options#" &
231 -- Configuration - Linking
233 "SVdriver#" &
234 "LVexecutable_switch#" &
235 "SVlib_dir_switch#" &
236 "SVlib_name_switch#" &
238 -- package Cross_Reference
240 "Pcross_reference#" &
241 "Ladefault_switches#" &
242 "Lbswitches#" &
244 -- package Finder
246 "Pfinder#" &
247 "Ladefault_switches#" &
248 "Lbswitches#" &
250 -- package Pretty_Printer
252 "Ppretty_printer#" &
253 "Ladefault_switches#" &
254 "Lbswitches#" &
256 -- package gnatstub
258 "Pgnatstub#" &
259 "Ladefault_switches#" &
260 "Lbswitches#" &
262 -- package Check
264 "Pcheck#" &
265 "Ladefault_switches#" &
266 "Lbswitches#" &
268 -- package Synchronize
270 "Psynchronize#" &
271 "Ladefault_switches#" &
272 "Lbswitches#" &
274 -- package Eliminate
276 "Peliminate#" &
277 "Ladefault_switches#" &
278 "Lbswitches#" &
280 -- package Metrics
282 "Pmetrics#" &
283 "Ladefault_switches#" &
284 "Lbswitches#" &
286 -- package Ide
288 "Pide#" &
289 "Ladefault_switches#" &
290 "SVremote_host#" &
291 "SVprogram_host#" &
292 "SVcommunication_protocol#" &
293 "Sacompiler_command#" &
294 "SVdebugger_command#" &
295 "SVgnatlist#" &
296 "SVvcs_kind#" &
297 "SVvcs_file_check#" &
298 "SVvcs_log_check#" &
300 -- package Stack
302 "Pstack#" &
303 "LVswitches#" &
305 "#";
307 Initialized : Boolean := False;
308 -- A flag to avoid multiple initialization
310 Package_Names : String_List_Access := new Strings.String_List (1 .. 20);
311 Last_Package_Name : Natural := 0;
312 -- Package_Names (1 .. Last_Package_Name) contains the list of the known
313 -- package names, coming from the Initialization_Data string or from
314 -- calls to one of the two procedures Register_New_Package.
316 procedure Add_Package_Name (Name : String);
317 -- Add a package name in the Package_Name list, extending it, if necessary
319 function Name_Id_Of (Name : String) return Name_Id;
320 -- Returns the Name_Id for Name in lower case
322 ----------------------
323 -- Add_Package_Name --
324 ----------------------
326 procedure Add_Package_Name (Name : String) is
327 begin
328 if Last_Package_Name = Package_Names'Last then
329 declare
330 New_List : constant Strings.String_List_Access :=
331 new Strings.String_List (1 .. Package_Names'Last * 2);
332 begin
333 New_List (Package_Names'Range) := Package_Names.all;
334 Package_Names := New_List;
335 end;
336 end if;
338 Last_Package_Name := Last_Package_Name + 1;
339 Package_Names (Last_Package_Name) := new String'(Name);
340 end Add_Package_Name;
342 -----------------------
343 -- Attribute_Kind_Of --
344 -----------------------
346 function Attribute_Kind_Of
347 (Attribute : Attribute_Node_Id) return Attribute_Kind
349 begin
350 if Attribute = Empty_Attribute then
351 return Unknown;
352 else
353 return Attrs.Table (Attribute.Value).Attr_Kind;
354 end if;
355 end Attribute_Kind_Of;
357 -----------------------
358 -- Attribute_Name_Of --
359 -----------------------
361 function Attribute_Name_Of (Attribute : Attribute_Node_Id) return Name_Id is
362 begin
363 if Attribute = Empty_Attribute then
364 return No_Name;
365 else
366 return Attrs.Table (Attribute.Value).Name;
367 end if;
368 end Attribute_Name_Of;
370 --------------------------
371 -- Attribute_Node_Id_Of --
372 --------------------------
374 function Attribute_Node_Id_Of
375 (Name : Name_Id;
376 Starting_At : Attribute_Node_Id) return Attribute_Node_Id
378 Id : Attr_Node_Id := Starting_At.Value;
380 begin
381 while Id /= Empty_Attr
382 and then Attrs.Table (Id).Name /= Name
383 loop
384 Id := Attrs.Table (Id).Next;
385 end loop;
387 return (Value => Id);
388 end Attribute_Node_Id_Of;
390 ----------------
391 -- Initialize --
392 ----------------
394 procedure Initialize is
395 Start : Positive := Initialization_Data'First;
396 Finish : Positive := Start;
397 Current_Package : Pkg_Node_Id := Empty_Pkg;
398 Current_Attribute : Attr_Node_Id := Empty_Attr;
399 Is_An_Attribute : Boolean := False;
400 Var_Kind : Variable_Kind := Undefined;
401 Optional_Index : Boolean := False;
402 Attr_Kind : Attribute_Kind := Single;
403 Package_Name : Name_Id := No_Name;
404 Attribute_Name : Name_Id := No_Name;
405 First_Attribute : Attr_Node_Id := Attr.First_Attribute;
406 Read_Only : Boolean;
408 function Attribute_Location return String;
409 -- Returns a string depending if we are in the project level attributes
410 -- or in the attributes of a package.
412 ------------------------
413 -- Attribute_Location --
414 ------------------------
416 function Attribute_Location return String is
417 begin
418 if Package_Name = No_Name then
419 return "project level attributes";
421 else
422 return "attribute of package """ &
423 Get_Name_String (Package_Name) & """";
424 end if;
425 end Attribute_Location;
427 -- Start of processing for Initialize
429 begin
430 -- Don't allow Initialize action to be repeated
432 if Initialized then
433 return;
434 end if;
436 -- Make sure the two tables are empty
438 Attrs.Init;
439 Package_Attributes.Init;
441 while Initialization_Data (Start) /= '#' loop
442 Is_An_Attribute := True;
443 case Initialization_Data (Start) is
444 when 'P' =>
446 -- New allowed package
448 Start := Start + 1;
450 Finish := Start;
451 while Initialization_Data (Finish) /= '#' loop
452 Finish := Finish + 1;
453 end loop;
455 Package_Name :=
456 Name_Id_Of (Initialization_Data (Start .. Finish - 1));
458 for Index in First_Package .. Package_Attributes.Last loop
459 if Package_Name = Package_Attributes.Table (Index).Name then
460 Osint.Fail ("duplicate name """,
461 Initialization_Data (Start .. Finish - 1),
462 """ in predefined packages.");
463 end if;
464 end loop;
466 Is_An_Attribute := False;
467 Current_Attribute := Empty_Attr;
468 Package_Attributes.Increment_Last;
469 Current_Package := Package_Attributes.Last;
470 Package_Attributes.Table (Current_Package) :=
471 (Name => Package_Name,
472 Known => True,
473 First_Attribute => Empty_Attr);
474 Start := Finish + 1;
476 Add_Package_Name (Get_Name_String (Package_Name));
478 when 'S' =>
479 Var_Kind := Single;
480 Optional_Index := False;
482 when 's' =>
483 Var_Kind := Single;
484 Optional_Index := True;
486 when 'L' =>
487 Var_Kind := List;
488 Optional_Index := False;
490 when 'l' =>
491 Var_Kind := List;
492 Optional_Index := True;
494 when others =>
495 raise Program_Error;
496 end case;
498 if Is_An_Attribute then
500 -- New attribute
502 Start := Start + 1;
503 case Initialization_Data (Start) is
504 when 'V' =>
505 Attr_Kind := Single;
507 when 'A' =>
508 Attr_Kind := Associative_Array;
510 when 'a' =>
511 Attr_Kind := Case_Insensitive_Associative_Array;
513 when 'b' =>
514 if Osint.File_Names_Case_Sensitive then
515 Attr_Kind := Associative_Array;
516 else
517 Attr_Kind := Case_Insensitive_Associative_Array;
518 end if;
520 when 'c' =>
521 if Osint.File_Names_Case_Sensitive then
522 Attr_Kind := Optional_Index_Associative_Array;
523 else
524 Attr_Kind :=
525 Optional_Index_Case_Insensitive_Associative_Array;
526 end if;
528 when others =>
529 raise Program_Error;
530 end case;
532 Start := Start + 1;
534 if Initialization_Data (Start) = 'R' then
535 Read_Only := True;
536 Start := Start + 1;
538 else
539 Read_Only := False;
540 end if;
542 Finish := Start;
544 while Initialization_Data (Finish) /= '#' loop
545 Finish := Finish + 1;
546 end loop;
548 Attribute_Name :=
549 Name_Id_Of (Initialization_Data (Start .. Finish - 1));
550 Attrs.Increment_Last;
552 if Current_Attribute = Empty_Attr then
553 First_Attribute := Attrs.Last;
555 if Current_Package /= Empty_Pkg then
556 Package_Attributes.Table (Current_Package).First_Attribute
557 := Attrs.Last;
558 end if;
560 else
561 -- Check that there are no duplicate attributes
563 for Index in First_Attribute .. Attrs.Last - 1 loop
564 if Attribute_Name = Attrs.Table (Index).Name then
565 Osint.Fail ("duplicate attribute """,
566 Initialization_Data (Start .. Finish - 1),
567 """ in " & Attribute_Location);
568 end if;
569 end loop;
571 Attrs.Table (Current_Attribute).Next :=
572 Attrs.Last;
573 end if;
575 Current_Attribute := Attrs.Last;
576 Attrs.Table (Current_Attribute) :=
577 (Name => Attribute_Name,
578 Var_Kind => Var_Kind,
579 Optional_Index => Optional_Index,
580 Attr_Kind => Attr_Kind,
581 Read_Only => Read_Only,
582 Next => Empty_Attr);
583 Start := Finish + 1;
584 end if;
585 end loop;
587 Initialized := True;
588 end Initialize;
590 ------------------
591 -- Is_Read_Only --
592 ------------------
594 function Is_Read_Only (Attribute : Attribute_Node_Id) return Boolean is
595 begin
596 return Attrs.Table (Attribute.Value).Read_Only;
597 end Is_Read_Only;
599 ----------------
600 -- Name_Id_Of --
601 ----------------
603 function Name_Id_Of (Name : String) return Name_Id is
604 begin
605 Name_Len := 0;
606 Add_Str_To_Name_Buffer (Name);
607 To_Lower (Name_Buffer (1 .. Name_Len));
608 return Name_Find;
609 end Name_Id_Of;
611 --------------------
612 -- Next_Attribute --
613 --------------------
615 function Next_Attribute
616 (After : Attribute_Node_Id) return Attribute_Node_Id
618 begin
619 if After = Empty_Attribute then
620 return Empty_Attribute;
621 else
622 return (Value => Attrs.Table (After.Value).Next);
623 end if;
624 end Next_Attribute;
626 -----------------------
627 -- Optional_Index_Of --
628 -----------------------
630 function Optional_Index_Of (Attribute : Attribute_Node_Id) return Boolean is
631 begin
632 if Attribute = Empty_Attribute then
633 return False;
634 else
635 return Attrs.Table (Attribute.Value).Optional_Index;
636 end if;
637 end Optional_Index_Of;
639 -----------------------
640 -- Package_Name_List --
641 -----------------------
643 function Package_Name_List return Strings.String_List is
644 begin
645 return Package_Names (1 .. Last_Package_Name);
646 end Package_Name_List;
648 ------------------------
649 -- Package_Node_Id_Of --
650 ------------------------
652 function Package_Node_Id_Of (Name : Name_Id) return Package_Node_Id is
653 begin
654 for Index in Package_Attributes.First .. Package_Attributes.Last loop
655 if Package_Attributes.Table (Index).Name = Name then
656 if Package_Attributes.Table (Index).Known then
657 return (Value => Index);
658 else
659 return Unknown_Package;
660 end if;
661 end if;
662 end loop;
664 -- If there is no package with this name, return Empty_Package
666 return Empty_Package;
667 end Package_Node_Id_Of;
669 ----------------------------
670 -- Register_New_Attribute --
671 ----------------------------
673 procedure Register_New_Attribute
674 (Name : String;
675 In_Package : Package_Node_Id;
676 Attr_Kind : Defined_Attribute_Kind;
677 Var_Kind : Defined_Variable_Kind;
678 Index_Is_File_Name : Boolean := False;
679 Opt_Index : Boolean := False)
681 Attr_Name : Name_Id;
682 First_Attr : Attr_Node_Id := Empty_Attr;
683 Curr_Attr : Attr_Node_Id;
684 Real_Attr_Kind : Attribute_Kind;
686 begin
687 if Name'Length = 0 then
688 Fail ("cannot register an attribute with no name");
689 raise Project_Error;
690 end if;
692 if In_Package = Empty_Package then
693 Fail ("attempt to add attribute """, Name,
694 """ to an undefined package");
695 raise Project_Error;
696 end if;
698 Attr_Name := Name_Id_Of (Name);
700 First_Attr :=
701 Package_Attributes.Table (In_Package.Value).First_Attribute;
703 -- Check if attribute name is a duplicate
705 Curr_Attr := First_Attr;
706 while Curr_Attr /= Empty_Attr loop
707 if Attrs.Table (Curr_Attr).Name = Attr_Name then
708 Fail ("duplicate attribute name """, Name,
709 """ in package """ &
710 Get_Name_String
711 (Package_Attributes.Table (In_Package.Value).Name) &
712 """");
713 raise Project_Error;
714 end if;
716 Curr_Attr := Attrs.Table (Curr_Attr).Next;
717 end loop;
719 Real_Attr_Kind := Attr_Kind;
721 -- If Index_Is_File_Name, change the attribute kind if necessary
723 if Index_Is_File_Name and then not Osint.File_Names_Case_Sensitive then
724 case Attr_Kind is
725 when Associative_Array =>
726 Real_Attr_Kind := Case_Insensitive_Associative_Array;
728 when Optional_Index_Associative_Array =>
729 Real_Attr_Kind :=
730 Optional_Index_Case_Insensitive_Associative_Array;
732 when others =>
733 null;
734 end case;
735 end if;
737 -- Add the new attribute
739 Attrs.Increment_Last;
740 Attrs.Table (Attrs.Last) :=
741 (Name => Attr_Name,
742 Var_Kind => Var_Kind,
743 Optional_Index => Opt_Index,
744 Attr_Kind => Real_Attr_Kind,
745 Read_Only => False,
746 Next => First_Attr);
748 Package_Attributes.Table (In_Package.Value).First_Attribute :=
749 Attrs.Last;
750 end Register_New_Attribute;
752 --------------------------
753 -- Register_New_Package --
754 --------------------------
756 procedure Register_New_Package (Name : String; Id : out Package_Node_Id) is
757 Pkg_Name : Name_Id;
759 begin
760 if Name'Length = 0 then
761 Fail ("cannot register a package with no name");
762 Id := Empty_Package;
763 return;
764 end if;
766 Pkg_Name := Name_Id_Of (Name);
768 for Index in Package_Attributes.First .. Package_Attributes.Last loop
769 if Package_Attributes.Table (Index).Name = Pkg_Name then
770 Fail ("cannot register a package with a non unique name""",
771 Name, """");
772 Id := Empty_Package;
773 return;
774 end if;
775 end loop;
777 Package_Attributes.Increment_Last;
778 Id := (Value => Package_Attributes.Last);
779 Package_Attributes.Table (Package_Attributes.Last) :=
780 (Name => Pkg_Name,
781 Known => True,
782 First_Attribute => Empty_Attr);
784 Add_Package_Name (Get_Name_String (Pkg_Name));
785 end Register_New_Package;
787 procedure Register_New_Package
788 (Name : String;
789 Attributes : Attribute_Data_Array)
791 Pkg_Name : Name_Id;
792 Attr_Name : Name_Id;
793 First_Attr : Attr_Node_Id := Empty_Attr;
794 Curr_Attr : Attr_Node_Id;
795 Attr_Kind : Attribute_Kind;
797 begin
798 if Name'Length = 0 then
799 Fail ("cannot register a package with no name");
800 raise Project_Error;
801 end if;
803 Pkg_Name := Name_Id_Of (Name);
805 for Index in Package_Attributes.First .. Package_Attributes.Last loop
806 if Package_Attributes.Table (Index).Name = Pkg_Name then
807 Fail ("cannot register a package with a non unique name""",
808 Name, """");
809 raise Project_Error;
810 end if;
811 end loop;
813 for Index in Attributes'Range loop
814 Attr_Name := Name_Id_Of (Attributes (Index).Name);
816 Curr_Attr := First_Attr;
817 while Curr_Attr /= Empty_Attr loop
818 if Attrs.Table (Curr_Attr).Name = Attr_Name then
819 Fail ("duplicate attribute name """, Attributes (Index).Name,
820 """ in new package """ & Name & """");
821 raise Project_Error;
822 end if;
824 Curr_Attr := Attrs.Table (Curr_Attr).Next;
825 end loop;
827 Attr_Kind := Attributes (Index).Attr_Kind;
829 if Attributes (Index).Index_Is_File_Name
830 and then not Osint.File_Names_Case_Sensitive
831 then
832 case Attr_Kind is
833 when Associative_Array =>
834 Attr_Kind := Case_Insensitive_Associative_Array;
836 when Optional_Index_Associative_Array =>
837 Attr_Kind :=
838 Optional_Index_Case_Insensitive_Associative_Array;
840 when others =>
841 null;
842 end case;
843 end if;
845 Attrs.Increment_Last;
846 Attrs.Table (Attrs.Last) :=
847 (Name => Attr_Name,
848 Var_Kind => Attributes (Index).Var_Kind,
849 Optional_Index => Attributes (Index).Opt_Index,
850 Attr_Kind => Attr_Kind,
851 Read_Only => False,
852 Next => First_Attr);
853 First_Attr := Attrs.Last;
854 end loop;
856 Package_Attributes.Increment_Last;
857 Package_Attributes.Table (Package_Attributes.Last) :=
858 (Name => Pkg_Name,
859 Known => True,
860 First_Attribute => First_Attr);
862 Add_Package_Name (Get_Name_String (Pkg_Name));
863 end Register_New_Package;
865 ---------------------------
866 -- Set_Attribute_Kind_Of --
867 ---------------------------
869 procedure Set_Attribute_Kind_Of
870 (Attribute : Attribute_Node_Id;
871 To : Attribute_Kind)
873 begin
874 if Attribute /= Empty_Attribute then
875 Attrs.Table (Attribute.Value).Attr_Kind := To;
876 end if;
877 end Set_Attribute_Kind_Of;
879 --------------------------
880 -- Set_Variable_Kind_Of --
881 --------------------------
883 procedure Set_Variable_Kind_Of
884 (Attribute : Attribute_Node_Id;
885 To : Variable_Kind)
887 begin
888 if Attribute /= Empty_Attribute then
889 Attrs.Table (Attribute.Value).Var_Kind := To;
890 end if;
891 end Set_Variable_Kind_Of;
893 ----------------------
894 -- Variable_Kind_Of --
895 ----------------------
897 function Variable_Kind_Of
898 (Attribute : Attribute_Node_Id) return Variable_Kind
900 begin
901 if Attribute = Empty_Attribute then
902 return Undefined;
903 else
904 return Attrs.Table (Attribute.Value).Var_Kind;
905 end if;
906 end Variable_Kind_Of;
908 ------------------------
909 -- First_Attribute_Of --
910 ------------------------
912 function First_Attribute_Of
913 (Pkg : Package_Node_Id) return Attribute_Node_Id
915 begin
916 if Pkg = Empty_Package then
917 return Empty_Attribute;
918 else
919 return
920 (Value => Package_Attributes.Table (Pkg.Value).First_Attribute);
921 end if;
922 end First_Attribute_Of;
924 end Prj.Attr;