1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
9 -- Copyright (C) 2006-2012, Free Software Foundation, Inc. --
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. --
21 -- GNAT was originally developed by the GNAT team at New York University. --
22 -- Extensive contributions were provided by Ada Core Technologies Inc. --
24 ------------------------------------------------------------------------------
27 with Makeutl
; use Makeutl
;
30 with Output
; use Output
;
35 with Prj
.Proc
; use Prj
.Proc
;
36 with Prj
.Tree
; use Prj
.Tree
;
37 with Prj
.Util
; use Prj
.Util
;
39 with Snames
; use Snames
;
41 with Ada
.Directories
; use Ada
.Directories
;
42 with Ada
.Exceptions
; use Ada
.Exceptions
;
44 with GNAT
.Case_Util
; use GNAT
.Case_Util
;
45 with GNAT
.HTable
; use GNAT
.HTable
;
47 package body Prj
.Conf
is
49 Auto_Cgpr
: constant String := "auto.cgpr";
51 Config_Project_Env_Var
: constant String := "GPR_CONFIG";
52 -- Name of the environment variable that provides the name of the
53 -- configuration file to use.
55 Gprconfig_Name
: constant String := "gprconfig";
57 package RTS_Languages
is new GNAT
.HTable
.Simple_HTable
58 (Header_Num
=> Prj
.Header_Num
,
60 No_Element
=> No_Name
,
64 -- Stores the runtime names for the various languages. This is in general
65 -- set from a --RTS command line option.
67 -----------------------
68 -- Local_Subprograms --
69 -----------------------
71 procedure Add_Attributes
72 (Project_Tree
: Project_Tree_Ref
;
73 Conf_Decl
: Declarations
;
74 User_Decl
: in out Declarations
);
75 -- Process the attributes in the config declarations.
76 -- For single string values, if the attribute is not declared in the user
77 -- declarations, declare it with the value in the config declarations.
78 -- For string list values, prepend the value in the user declarations with
79 -- the value in the config declarations.
82 (Config_File
: Prj
.Project_Id
;
83 Autoconf_Specified
: Boolean;
84 Project_Tree
: Prj
.Project_Tree_Ref
;
85 Target
: String := "") return Boolean;
86 -- Check that the config file's target matches Target.
87 -- Target should be set to the empty string when the user did not specify
88 -- a target. If the target in the configuration file is invalid, this
89 -- function will raise Invalid_Config with an appropriate message.
90 -- Autoconf_Specified should be set to True if the user has used
93 function Locate_Config_File
(Name
: String) return String_Access
;
94 -- Search for Name in the config files directory. Return full path if
95 -- found, or null otherwise.
97 procedure Raise_Invalid_Config
(Msg
: String);
98 pragma No_Return
(Raise_Invalid_Config
);
99 -- Raises exception Invalid_Config with given message
101 procedure Apply_Config_File
102 (Config_File
: Prj
.Project_Id
;
103 Project_Tree
: Prj
.Project_Tree_Ref
);
104 -- Apply the configuration file settings to all the projects in the
105 -- project tree. The Project_Tree must have been parsed first, and
106 -- processed through the first phase so that all its projects are known.
108 -- Currently, this will add new attributes and packages in the various
109 -- projects, so that when the second phase of the processing is performed
110 -- these attributes are automatically taken into account.
116 procedure Add_Attributes
117 (Project_Tree
: Project_Tree_Ref
;
118 Conf_Decl
: Declarations
;
119 User_Decl
: in out Declarations
)
121 Shared
: constant Shared_Project_Tree_Data_Access
:= Project_Tree
.Shared
;
122 Conf_Attr_Id
: Variable_Id
;
123 Conf_Attr
: Variable
;
124 Conf_Array_Id
: Array_Id
;
125 Conf_Array
: Array_Data
;
126 Conf_Array_Elem_Id
: Array_Element_Id
;
127 Conf_Array_Elem
: Array_Element
;
128 Conf_List
: String_List_Id
;
129 Conf_List_Elem
: String_Element
;
131 User_Attr_Id
: Variable_Id
;
132 User_Attr
: Variable
;
133 User_Array_Id
: Array_Id
;
134 User_Array
: Array_Data
;
135 User_Array_Elem_Id
: Array_Element_Id
;
136 User_Array_Elem
: Array_Element
;
139 Conf_Attr_Id
:= Conf_Decl
.Attributes
;
140 User_Attr_Id
:= User_Decl
.Attributes
;
141 while Conf_Attr_Id
/= No_Variable
loop
142 Conf_Attr
:= Shared
.Variable_Elements
.Table
(Conf_Attr_Id
);
143 User_Attr
:= Shared
.Variable_Elements
.Table
(User_Attr_Id
);
145 if not Conf_Attr
.Value
.Default
then
146 if User_Attr
.Value
.Default
then
148 -- No attribute declared in user project file: just copy the
149 -- value of the configuration attribute.
151 User_Attr
.Value
:= Conf_Attr
.Value
;
152 Shared
.Variable_Elements
.Table
(User_Attr_Id
) := User_Attr
;
154 elsif User_Attr
.Value
.Kind
= List
155 and then Conf_Attr
.Value
.Values
/= Nil_String
157 -- List attribute declared in both the user project and the
158 -- configuration project: prepend the user list with the
159 -- configuration list.
162 User_List
: constant String_List_Id
:=
163 User_Attr
.Value
.Values
;
164 Conf_List
: String_List_Id
:= Conf_Attr
.Value
.Values
;
165 Conf_Elem
: String_Element
;
166 New_List
: String_List_Id
;
167 New_Elem
: String_Element
;
172 String_Element_Table
.Increment_Last
173 (Shared
.String_Elements
);
175 String_Element_Table
.Last
(Shared
.String_Elements
);
177 -- Value of attribute is new list
179 User_Attr
.Value
.Values
:= New_List
;
180 Shared
.Variable_Elements
.Table
(User_Attr_Id
) := User_Attr
;
183 -- Get each element of configuration list
185 Conf_Elem
:= Shared
.String_Elements
.Table
(Conf_List
);
186 New_Elem
:= Conf_Elem
;
187 Conf_List
:= Conf_Elem
.Next
;
189 if Conf_List
= Nil_String
then
191 -- If it is the last element in the list, connect to
192 -- first element of user list, and we are done.
194 New_Elem
.Next
:= User_List
;
195 Shared
.String_Elements
.Table
(New_List
) := New_Elem
;
199 -- If it is not the last element in the list, add to
202 String_Element_Table
.Increment_Last
203 (Shared
.String_Elements
);
205 String_Element_Table
.Last
(Shared
.String_Elements
);
206 Shared
.String_Elements
.Table
(New_List
) := New_Elem
;
207 New_List
:= New_Elem
.Next
;
214 Conf_Attr_Id
:= Conf_Attr
.Next
;
215 User_Attr_Id
:= User_Attr
.Next
;
218 Conf_Array_Id
:= Conf_Decl
.Arrays
;
219 while Conf_Array_Id
/= No_Array
loop
220 Conf_Array
:= Shared
.Arrays
.Table
(Conf_Array_Id
);
222 User_Array_Id
:= User_Decl
.Arrays
;
223 while User_Array_Id
/= No_Array
loop
224 User_Array
:= Shared
.Arrays
.Table
(User_Array_Id
);
225 exit when User_Array
.Name
= Conf_Array
.Name
;
226 User_Array_Id
:= User_Array
.Next
;
229 -- If this associative array does not exist in the user project file,
230 -- do a shallow copy of the full associative array.
232 if User_Array_Id
= No_Array
then
233 Array_Table
.Increment_Last
(Shared
.Arrays
);
234 User_Array
:= Conf_Array
;
235 User_Array
.Next
:= User_Decl
.Arrays
;
236 User_Decl
.Arrays
:= Array_Table
.Last
(Shared
.Arrays
);
237 Shared
.Arrays
.Table
(User_Decl
.Arrays
) := User_Array
;
239 -- Otherwise, check each array element
242 Conf_Array_Elem_Id
:= Conf_Array
.Value
;
243 while Conf_Array_Elem_Id
/= No_Array_Element
loop
245 Shared
.Array_Elements
.Table
(Conf_Array_Elem_Id
);
247 User_Array_Elem_Id
:= User_Array
.Value
;
248 while User_Array_Elem_Id
/= No_Array_Element
loop
250 Shared
.Array_Elements
.Table
(User_Array_Elem_Id
);
251 exit when User_Array_Elem
.Index
= Conf_Array_Elem
.Index
;
252 User_Array_Elem_Id
:= User_Array_Elem
.Next
;
255 -- If the array element doesn't exist in the user array, insert
256 -- a shallow copy of the conf array element in the user array.
258 if User_Array_Elem_Id
= No_Array_Element
then
259 Array_Element_Table
.Increment_Last
(Shared
.Array_Elements
);
260 User_Array_Elem
:= Conf_Array_Elem
;
261 User_Array_Elem
.Next
:= User_Array
.Value
;
263 Array_Element_Table
.Last
(Shared
.Array_Elements
);
264 Shared
.Array_Elements
.Table
(User_Array
.Value
) :=
266 Shared
.Arrays
.Table
(User_Array_Id
) := User_Array
;
268 -- Otherwise, if the value is a string list, prepend the conf
269 -- array element value to the array element.
271 elsif Conf_Array_Elem
.Value
.Kind
= List
then
272 Conf_List
:= Conf_Array_Elem
.Value
.Values
;
274 if Conf_List
/= Nil_String
then
276 Link
: constant String_List_Id
:=
277 User_Array_Elem
.Value
.Values
;
278 Previous
: String_List_Id
:= Nil_String
;
279 Next
: String_List_Id
;
284 Shared
.String_Elements
.Table
(Conf_List
);
285 String_Element_Table
.Increment_Last
286 (Shared
.String_Elements
);
288 String_Element_Table
.Last
289 (Shared
.String_Elements
);
290 Shared
.String_Elements
.Table
(Next
) :=
293 if Previous
= Nil_String
then
294 User_Array_Elem
.Value
.Values
:= Next
;
295 Shared
.Array_Elements
.Table
296 (User_Array_Elem_Id
) := User_Array_Elem
;
299 Shared
.String_Elements
.Table
300 (Previous
).Next
:= Next
;
305 Conf_List
:= Conf_List_Elem
.Next
;
307 if Conf_List
= Nil_String
then
308 Shared
.String_Elements
.Table
(Previous
).Next
:=
317 Conf_Array_Elem_Id
:= Conf_Array_Elem
.Next
;
321 Conf_Array_Id
:= Conf_Array
.Next
;
325 ------------------------------------
326 -- Add_Default_GNAT_Naming_Scheme --
327 ------------------------------------
329 procedure Add_Default_GNAT_Naming_Scheme
330 (Config_File
: in out Project_Node_Id
;
331 Project_Tree
: Project_Node_Tree_Ref
)
333 procedure Create_Attribute
336 Index
: String := "";
337 Pkg
: Project_Node_Id
:= Empty_Node
);
339 ----------------------
340 -- Create_Attribute --
341 ----------------------
343 procedure Create_Attribute
346 Index
: String := "";
347 Pkg
: Project_Node_Id
:= Empty_Node
)
349 Attr
: Project_Node_Id
;
350 pragma Unreferenced
(Attr
);
352 Expr
: Name_Id
:= No_Name
;
353 Val
: Name_Id
:= No_Name
;
354 Parent
: Project_Node_Id
:= Config_File
;
358 Name_Len
:= Index
'Length;
359 Name_Buffer
(1 .. Name_Len
) := Index
;
363 if Pkg
/= Empty_Node
then
367 Name_Len
:= Value
'Length;
368 Name_Buffer
(1 .. Name_Len
) := Value
;
371 Attr
:= Create_Attribute
372 (Tree
=> Project_Tree
,
373 Prj_Or_Pkg
=> Parent
,
377 Value
=> Create_Literal_String
(Expr
, Project_Tree
));
378 end Create_Attribute
;
383 Naming
: Project_Node_Id
;
384 Compiler
: Project_Node_Id
;
386 -- Start of processing for Add_Default_GNAT_Naming_Scheme
389 if Config_File
= Empty_Node
then
391 -- Create a dummy config file is none was found
393 Name_Len
:= Auto_Cgpr
'Length;
394 Name_Buffer
(1 .. Name_Len
) := Auto_Cgpr
;
397 -- An invalid project name to avoid conflicts with user-created ones
400 Name_Buffer
(1 .. Name_Len
) := "_auto";
404 (In_Tree
=> Project_Tree
,
406 Full_Path
=> Path_Name_Type
(Name
),
407 Is_Config_File
=> True);
409 -- Setup library support
411 case MLib
.Tgt
.Support_For_Libraries
is
416 Create_Attribute
(Name_Library_Support
, "static_only");
419 Create_Attribute
(Name_Library_Support
, "full");
422 if MLib
.Tgt
.Standalone_Library_Auto_Init_Is_Supported
then
423 Create_Attribute
(Name_Library_Auto_Init_Supported
, "true");
425 Create_Attribute
(Name_Library_Auto_Init_Supported
, "false");
428 -- Setup Ada support (Ada is the default language here, since this
429 -- is only called when no config file existed initially, ie for
432 Create_Attribute
(Name_Default_Language
, "ada");
434 Compiler
:= Create_Package
(Project_Tree
, Config_File
, "compiler");
436 (Name_Driver
, "gcc", "ada", Pkg
=> Compiler
);
438 (Name_Language_Kind
, "unit_based", "ada", Pkg
=> Compiler
);
440 (Name_Dependency_Kind
, "ALI_File", "ada", Pkg
=> Compiler
);
442 Naming
:= Create_Package
(Project_Tree
, Config_File
, "naming");
443 Create_Attribute
(Name_Spec_Suffix
, ".ads", "ada", Pkg
=> Naming
);
444 Create_Attribute
(Name_Separate_Suffix
, ".adb", "ada", Pkg
=> Naming
);
445 Create_Attribute
(Name_Body_Suffix
, ".adb", "ada", Pkg
=> Naming
);
446 Create_Attribute
(Name_Dot_Replacement
, "-", Pkg
=> Naming
);
447 Create_Attribute
(Name_Casing
, "lowercase", Pkg
=> Naming
);
449 if Current_Verbosity
= High
then
450 Write_Line
("Automatically generated (in-memory) config file");
452 (Project
=> Config_File
,
453 In_Tree
=> Project_Tree
,
454 Backward_Compatibility
=> False);
457 end Add_Default_GNAT_Naming_Scheme
;
459 -----------------------
460 -- Apply_Config_File --
461 -----------------------
463 procedure Apply_Config_File
464 (Config_File
: Prj
.Project_Id
;
465 Project_Tree
: Prj
.Project_Tree_Ref
)
467 Shared
: constant Shared_Project_Tree_Data_Access
:= Project_Tree
.Shared
;
469 Conf_Decl
: constant Declarations
:= Config_File
.Decl
;
470 Conf_Pack_Id
: Package_Id
;
471 Conf_Pack
: Package_Element
;
473 User_Decl
: Declarations
;
474 User_Pack_Id
: Package_Id
;
475 User_Pack
: Package_Element
;
479 Debug_Output
("Applying config file to a project tree");
481 Proj
:= Project_Tree
.Projects
;
482 while Proj
/= null loop
483 if Proj
.Project
/= Config_File
then
484 User_Decl
:= Proj
.Project
.Decl
;
486 (Project_Tree
=> Project_Tree
,
487 Conf_Decl
=> Conf_Decl
,
488 User_Decl
=> User_Decl
);
490 Conf_Pack_Id
:= Conf_Decl
.Packages
;
491 while Conf_Pack_Id
/= No_Package
loop
492 Conf_Pack
:= Shared
.Packages
.Table
(Conf_Pack_Id
);
494 User_Pack_Id
:= User_Decl
.Packages
;
495 while User_Pack_Id
/= No_Package
loop
496 User_Pack
:= Shared
.Packages
.Table
(User_Pack_Id
);
497 exit when User_Pack
.Name
= Conf_Pack
.Name
;
498 User_Pack_Id
:= User_Pack
.Next
;
501 if User_Pack_Id
= No_Package
then
502 Package_Table
.Increment_Last
(Shared
.Packages
);
503 User_Pack
:= Conf_Pack
;
504 User_Pack
.Next
:= User_Decl
.Packages
;
505 User_Decl
.Packages
:= Package_Table
.Last
(Shared
.Packages
);
506 Shared
.Packages
.Table
(User_Decl
.Packages
) := User_Pack
;
510 (Project_Tree
=> Project_Tree
,
511 Conf_Decl
=> Conf_Pack
.Decl
,
512 User_Decl
=> Shared
.Packages
.Table
513 (User_Pack_Id
).Decl
);
516 Conf_Pack_Id
:= Conf_Pack
.Next
;
519 Proj
.Project
.Decl
:= User_Decl
;
521 -- For aggregate projects, we need to apply the config to all
522 -- their aggregated trees as well.
524 if Proj
.Project
.Qualifier
in Aggregate_Project
then
526 List
: Aggregated_Project_List
;
528 List
:= Proj
.Project
.Aggregated_Projects
;
529 while List
/= null loop
531 ("Recursively apply config to aggregated tree",
534 (Config_File
, Project_Tree
=> List
.Tree
);
543 end Apply_Config_File
;
549 function Check_Target
550 (Config_File
: Project_Id
;
551 Autoconf_Specified
: Boolean;
552 Project_Tree
: Prj
.Project_Tree_Ref
;
553 Target
: String := "") return Boolean
555 Shared
: constant Shared_Project_Tree_Data_Access
:=
557 Variable
: constant Variable_Value
:=
559 (Name_Target
, Config_File
.Decl
.Attributes
, Shared
);
560 Tgt_Name
: Name_Id
:= No_Name
;
564 if Variable
/= Nil_Variable_Value
and then not Variable
.Default
then
565 Tgt_Name
:= Variable
.Value
;
569 OK
:= Autoconf_Specified
or else Tgt_Name
= No_Name
;
571 OK
:= Tgt_Name
/= No_Name
572 and then Target
= Get_Name_String
(Tgt_Name
);
576 if Autoconf_Specified
then
578 Write_Line
("inconsistent targets, performing autoconf");
584 if Tgt_Name
/= No_Name
then
586 ("invalid target name """
587 & Get_Name_String
(Tgt_Name
) & """ in configuration");
590 ("no target specified in configuration file");
598 --------------------------------------
599 -- Get_Or_Create_Configuration_File --
600 --------------------------------------
602 procedure Get_Or_Create_Configuration_File
603 (Project
: Project_Id
;
604 Project_Tree
: Project_Tree_Ref
;
605 Project_Node_Tree
: Prj
.Tree
.Project_Node_Tree_Ref
;
606 Env
: in out Prj
.Tree
.Environment
;
607 Allow_Automatic_Generation
: Boolean;
608 Config_File_Name
: String := "";
609 Autoconf_Specified
: Boolean;
610 Target_Name
: String := "";
611 Normalized_Hostname
: String;
612 Packages_To_Check
: String_List_Access
:= null;
613 Config
: out Prj
.Project_Id
;
614 Config_File_Path
: out String_Access
;
615 Automatically_Generated
: out Boolean;
616 On_Load_Config
: Config_File_Hook
:= null)
618 Shared
: constant Shared_Project_Tree_Data_Access
:= Project_Tree
.Shared
;
620 At_Least_One_Compiler_Command
: Boolean := False;
621 -- Set to True if at least one attribute Ide'Compiler_Command is
622 -- specified for one language of the system.
624 Conf_File_Name
: String_Access
:= new String'(Config_File_Name);
625 -- The configuration project file name. May be modified if there are
626 -- switches --config= in the Builder package of the main project.
628 function Default_File_Name return String;
629 -- Return the name of the default config file that should be tested
631 procedure Do_Autoconf;
632 -- Generate a new config file through gprconfig. In case of error, this
633 -- raises the Invalid_Config exception with an appropriate message
635 procedure Check_Builder_Switches;
636 -- Check for switches --config and --RTS in package Builder
638 function Get_Config_Switches return Argument_List_Access;
639 -- Return the --config switches to use for gprconfig
641 function Get_Db_Switches return Argument_List_Access;
642 -- Return the --db switches to use for gprconfig
644 function Might_Have_Sources (Project : Project_Id) return Boolean;
645 -- True if the specified project might have sources (ie the user has not
646 -- explicitly specified it. We haven't checked the file system, nor do
647 -- we need to at this stage.
649 ----------------------------
650 -- Check_Builder_Switches --
651 ----------------------------
653 procedure Check_Builder_Switches is
654 Get_RTS_Switches : constant Boolean :=
655 RTS_Languages.Get_First = No_Name;
656 -- If no switch --RTS have been specified on the command line, look
657 -- for --RTS switches in the Builder switches.
659 Builder : constant Package_Id :=
660 Value_Of (Name_Builder, Project.Decl.Packages, Shared);
662 Switch_Array_Id : Array_Element_Id;
663 -- The Switches to be checked
665 procedure Check_Switches;
666 -- Check the switches in Switch_Array_Id
672 procedure Check_Switches is
673 Switch_Array : Array_Element;
674 Switch_List : String_List_Id := Nil_String;
675 Switch : String_Element;
677 Lang_Last : Positive;
680 while Switch_Array_Id /= No_Array_Element loop
682 Shared.Array_Elements.Table (Switch_Array_Id);
684 Switch_List := Switch_Array.Value.Values;
685 List_Loop : while Switch_List /= Nil_String loop
686 Switch := Shared.String_Elements.Table (Switch_List);
688 if Switch.Value /= No_Name then
689 Get_Name_String (Switch.Value);
691 if Conf_File_Name'Length = 0
692 and then Name_Len > 9
693 and then Name_Buffer (1 .. 9) = "--config="
696 new String'(Name_Buffer
(10 .. Name_Len
));
698 elsif Get_RTS_Switches
699 and then Name_Len
>= 7
700 and then Name_Buffer
(1 .. 5) = "--RTS"
702 if Name_Buffer
(6) = '=' then
703 if not Runtime_Name_Set_For
(Name_Ada
) then
706 Name_Buffer
(7 .. Name_Len
));
707 Locate_Runtime
(Name_Ada
, Project_Tree
);
711 and then Name_Buffer
(6) = ':'
712 and then Name_Buffer
(7) /= '='
715 while Lang_Last
< Name_Len
716 and then Name_Buffer
(Lang_Last
+ 1) /= '='
718 Lang_Last
:= Lang_Last
+ 1;
721 if Name_Buffer
(Lang_Last
+ 1) = '=' then
723 RTS
: constant String :=
724 Name_Buffer
(Lang_Last
+ 2 .. Name_Len
);
726 Name_Buffer
(1 .. Lang_Last
- 6) :=
727 Name_Buffer
(7 .. Lang_Last
);
728 Name_Len
:= Lang_Last
- 6;
729 To_Lower
(Name_Buffer
(1 .. Name_Len
));
732 if not Runtime_Name_Set_For
(Lang
) then
733 Set_Runtime_For
(Lang
, RTS
);
734 Locate_Runtime
(Lang
, Project_Tree
);
742 Switch_List
:= Switch
.Next
;
745 Switch_Array_Id
:= Switch_Array
.Next
;
749 -- Start of processing for Check_Builder_Switches
752 if Builder
/= No_Package
then
755 (Name
=> Name_Switches
,
756 In_Arrays
=> Shared
.Packages
.Table
(Builder
).Decl
.Arrays
,
762 (Name
=> Name_Default_Switches
,
763 In_Arrays
=> Shared
.Packages
.Table
(Builder
).Decl
.Arrays
,
767 end Check_Builder_Switches
;
769 -----------------------
770 -- Default_File_Name --
771 -----------------------
773 function Default_File_Name
return String is
774 Ada_RTS
: constant String := Runtime_Name_For
(Name_Ada
);
778 if Target_Name
/= "" then
779 if Ada_RTS
/= "" then
781 Target_Name
& '-' & Ada_RTS
& Config_Project_File_Extension
;
784 Target_Name
& Config_Project_File_Extension
;
787 elsif Ada_RTS
/= "" then
788 return Ada_RTS
& Config_Project_File_Extension
;
791 Tmp
:= Getenv
(Config_Project_Env_Var
);
794 T
: constant String := Tmp
.all;
800 return Default_Config_Name
;
806 end Default_File_Name
;
812 procedure Do_Autoconf
is
813 Obj_Dir
: constant Variable_Value
:=
816 Project
.Decl
.Attributes
,
819 Gprconfig_Path
: String_Access
;
823 Gprconfig_Path
:= Locate_Exec_On_Path
(Gprconfig_Name
);
825 if Gprconfig_Path
= null then
827 ("could not locate gprconfig for auto-configuration");
830 -- First, find the object directory of the user's project
832 if Obj_Dir
= Nil_Variable_Value
or else Obj_Dir
.Default
then
833 Get_Name_String
(Project
.Directory
.Display_Name
);
836 if Is_Absolute_Path
(Get_Name_String
(Obj_Dir
.Value
)) then
837 Get_Name_String
(Obj_Dir
.Value
);
841 Add_Str_To_Name_Buffer
842 (Get_Name_String
(Project
.Directory
.Display_Name
));
843 Add_Str_To_Name_Buffer
(Get_Name_String
(Obj_Dir
.Value
));
847 if Subdirs
/= null then
848 Add_Char_To_Name_Buffer
(Directory_Separator
);
849 Add_Str_To_Name_Buffer
(Subdirs
.all);
852 for J
in 1 .. Name_Len
loop
853 if Name_Buffer
(J
) = '/' then
854 Name_Buffer
(J
) := Directory_Separator
;
858 -- Make sure that Obj_Dir ends with a directory separator
860 if Name_Buffer
(Name_Len
) /= Directory_Separator
then
861 Name_Len
:= Name_Len
+ 1;
862 Name_Buffer
(Name_Len
) := Directory_Separator
;
866 Obj_Dir
: constant String := Name_Buffer
(1 .. Name_Len
);
867 Config_Switches
: Argument_List_Access
;
868 Db_Switches
: Argument_List_Access
;
869 Args
: Argument_List
(1 .. 5);
871 Obj_Dir_Exists
: Boolean := True;
874 -- Check if the object directory exists. If Setup_Projects is True
875 -- (-p) and directory does not exist, attempt to create it.
876 -- Otherwise, if directory does not exist, fail without calling
879 if not Is_Directory
(Obj_Dir
)
880 and then (Setup_Projects
or else Subdirs
/= null)
883 Create_Path
(Obj_Dir
);
885 if not Quiet_Output
then
886 Write_Str
("object directory """);
888 Write_Line
(""" created");
894 ("could not create object directory " & Obj_Dir
);
898 if not Is_Directory
(Obj_Dir
) then
899 case Env
.Flags
.Require_Obj_Dirs
is
902 ("object directory " & Obj_Dir
& " does not exist");
907 "?object directory " & Obj_Dir
& " does not exist");
908 Obj_Dir_Exists
:= False;
915 -- Get the config switches. This should be done only now, as some
916 -- runtimes may have been found if the Builder switches.
918 Config_Switches
:= Get_Config_Switches
;
920 -- Get eventual --db switches
922 Db_Switches
:= Get_Db_Switches
;
926 Args
(1) := new String'("--batch");
927 Args (2) := new String'("-o");
929 -- If no config file was specified, set the auto.cgpr one
931 if Conf_File_Name
'Length = 0 then
932 if Obj_Dir_Exists
then
933 Args
(3) := new String'(Obj_Dir & Auto_Cgpr);
937 Path_FD : File_Descriptor;
938 Path_Name : Path_Name_Type;
941 Prj.Env.Create_Temp_File
942 (Shared => Project_Tree.Shared,
944 Path_Name => Path_Name,
945 File_Use => "configuration file");
947 if Path_FD /= Invalid_FD then
949 Temp_Dir : constant String :=
951 (Get_Name_String (Path_Name));
953 GNAT.OS_Lib.Close (Path_FD);
955 new String'(Temp_Dir
&
956 Directory_Separator
&
958 Delete_File
(Get_Name_String
(Path_Name
));
962 -- We'll have an error message later on
964 Args
(3) := new String'(Obj_Dir & Auto_Cgpr);
969 Args (3) := Conf_File_Name;
972 if Normalized_Hostname = "" then
975 if Target_Name = "" then
977 -- Check if attribute Target is specified in the main
978 -- project, or in a project it extends. If it is, use this
979 -- target to invoke gprconfig.
982 Variable : Variable_Value;
984 Tgt_Name : Name_Id := No_Name;
989 while Proj /= No_Project loop
991 Value_Of (Name_Target, Proj.Decl.Attributes, Shared);
993 if Variable /= Nil_Variable_Value
994 and then not Variable.Default
995 and then Variable.Value /= No_Name
997 Tgt_Name := Variable.Value;
1001 Proj := Proj.Extends;
1002 end loop Project_Loop;
1004 if Tgt_Name /= No_Name then
1006 new String'("--target=" &
1007 Get_Name_String
(Tgt_Name
));
1009 elsif At_Least_One_Compiler_Command
then
1010 Args
(4) := new String'("--target=all");
1014 new String'("--target=" & Normalized_Hostname
);
1019 Args
(4) := new String'("--target=" & Target_Name);
1025 if not Verbose_Mode then
1026 Arg_Last := Arg_Last + 1;
1027 Args (Arg_Last) := new String'("-q");
1030 if Verbose_Mode
then
1031 Write_Str
(Gprconfig_Name
);
1033 for J
in 1 .. Arg_Last
loop
1035 Write_Str
(Args
(J
).all);
1038 for J
in Config_Switches
'Range loop
1040 Write_Str
(Config_Switches
(J
).all);
1043 for J
in Db_Switches
'Range loop
1045 Write_Str
(Db_Switches
(J
).all);
1050 elsif not Quiet_Output
then
1051 -- Display no message if we are creating auto.cgpr, unless in
1054 if Config_File_Name
'Length > 0
1055 or else Verbose_Mode
1057 Write_Str
("creating ");
1058 Write_Str
(Simple_Name
(Args
(3).all));
1063 Spawn
(Gprconfig_Path
.all, Args
(1 .. Arg_Last
) &
1064 Config_Switches
.all & Db_Switches
.all,
1067 Free
(Config_Switches
);
1069 Config_File_Path
:= Locate_Config_File
(Args
(3).all);
1071 if Config_File_Path
= null then
1072 Raise_Invalid_Config
1073 ("could not create " & Args
(3).all);
1076 for F
in Args
'Range loop
1082 ---------------------
1083 -- Get_Db_Switches --
1084 ---------------------
1086 function Get_Db_Switches
return Argument_List_Access
is
1087 Result
: Argument_List_Access
;
1091 (2 * Db_Switch_Args
.Last
) + Boolean'Pos (not Load_Standard_Base
);
1092 Result
:= new Argument_List
(1 .. Nmb_Arg
);
1094 if Nmb_Arg
/= 0 then
1095 for J
in 1 .. Db_Switch_Args
.Last
loop
1096 Result
(2 * J
- 1) :=
1097 new String'("--db");
1099 new String'(Get_Name_String
(Db_Switch_Args
.Table
(J
)));
1102 if not Load_Standard_Base
then
1103 Result
(Result
'Last) := new String'("--db-");
1108 end Get_Db_Switches;
1110 -------------------------
1111 -- Get_Config_Switches --
1112 -------------------------
1114 function Get_Config_Switches return Argument_List_Access is
1116 package Language_Htable is new GNAT.HTable.Simple_HTable
1117 (Header_Num => Prj.Header_Num,
1119 No_Element => No_Name,
1123 -- Hash table to keep the languages used in the project tree
1125 IDE : constant Package_Id :=
1126 Value_Of (Name_Ide, Project.Decl.Packages, Shared);
1128 procedure Add_Config_Switches_For_Project
1129 (Project : Project_Id;
1130 Tree : Project_Tree_Ref;
1131 With_State : in out Integer);
1132 -- Add all --config switches for this project. This is also called
1133 -- for aggregate projects.
1135 -------------------------------------
1136 -- Add_Config_Switches_For_Project --
1137 -------------------------------------
1139 procedure Add_Config_Switches_For_Project
1140 (Project : Project_Id;
1141 Tree : Project_Tree_Ref;
1142 With_State : in out Integer)
1144 pragma Unreferenced (With_State);
1146 Shared : constant Shared_Project_Tree_Data_Access := Tree.Shared;
1148 Variable : Variable_Value;
1149 Check_Default : Boolean;
1151 List : String_List_Id;
1152 Elem : String_Element;
1155 if Might_Have_Sources (Project) then
1157 Value_Of (Name_Languages, Project.Decl.Attributes, Shared);
1159 if Variable = Nil_Variable_Value or else Variable.Default then
1161 -- Languages is not declared. If it is not an extending
1162 -- project, or if it extends a project with no Languages,
1163 -- check for Default_Language.
1165 Check_Default := Project.Extends = No_Project;
1167 if not Check_Default then
1171 Project.Extends.Decl.Attributes,
1174 Variable /= Nil_Variable_Value
1175 and then Variable.Values = Nil_String;
1178 if Check_Default then
1181 (Name_Default_Language,
1182 Project.Decl.Attributes,
1185 if Variable /= Nil_Variable_Value
1186 and then not Variable.Default
1188 Get_Name_String (Variable.Value);
1189 To_Lower (Name_Buffer (1 .. Name_Len));
1191 Language_Htable.Set (Lang, Lang);
1193 -- If no default language is declared, default to Ada
1196 Language_Htable.Set (Name_Ada, Name_Ada);
1200 elsif Variable.Values /= Nil_String then
1202 -- Attribute Languages is declared with a non empty list:
1203 -- put all the languages in Language_HTable.
1205 List := Variable.Values;
1206 while List /= Nil_String loop
1207 Elem := Shared.String_Elements.Table (List);
1209 Get_Name_String (Elem.Value);
1210 To_Lower (Name_Buffer (1 .. Name_Len));
1212 Language_Htable.Set (Lang, Lang);
1218 end Add_Config_Switches_For_Project;
1220 procedure For_Every_Imported_Project is new For_Every_Project_Imported
1221 (State => Integer, Action => Add_Config_Switches_For_Project);
1222 -- Document this procedure ???
1228 Result : Argument_List_Access;
1229 Variable : Variable_Value;
1230 Dummy : Integer := 0;
1232 -- Start of processing for Get_Config_Switches
1235 For_Every_Imported_Project
1237 Tree => Project_Tree,
1238 With_State => Dummy,
1239 Include_Aggregated => True);
1241 Name := Language_Htable.Get_First;
1243 while Name /= No_Name loop
1245 Name := Language_Htable.Get_Next;
1248 Result := new String_List (1 .. Count);
1251 Name := Language_Htable.Get_First;
1252 while Name /= No_Name loop
1254 -- Check if IDE'Compiler_Command is declared for the language.
1255 -- If it is, use its value to invoke gprconfig.
1260 Attribute_Or_Array_Name => Name_Compiler_Command,
1263 Force_Lower_Case_Index => True);
1266 Config_Command : constant String :=
1267 "--config=" & Get_Name_String (Name);
1269 Runtime_Name : constant String :=
1270 Runtime_Name_For (Name);
1273 if Variable = Nil_Variable_Value
1274 or else Length_Of_Name (Variable.Value) = 0
1277 new String'(Config_Command
& ",," & Runtime_Name
);
1280 At_Least_One_Compiler_Command
:= True;
1283 Compiler_Command
: constant String :=
1284 Get_Name_String
(Variable
.Value
);
1287 if Is_Absolute_Path
(Compiler_Command
) then
1290 (Config_Command & ",," & Runtime_Name & "," &
1291 Containing_Directory (Compiler_Command) & "," &
1292 Simple_Name (Compiler_Command));
1296 (Config_Command
& ",," & Runtime_Name
& ",," &
1304 Name
:= Language_Htable
.Get_Next
;
1308 end Get_Config_Switches
;
1310 ------------------------
1311 -- Might_Have_Sources --
1312 ------------------------
1314 function Might_Have_Sources
(Project
: Project_Id
) return Boolean is
1315 Variable
: Variable_Value
;
1321 Project
.Decl
.Attributes
,
1324 if Variable
= Nil_Variable_Value
1325 or else Variable
.Default
1326 or else Variable
.Values
/= Nil_String
1331 Project
.Decl
.Attributes
,
1333 return Variable
= Nil_Variable_Value
1334 or else Variable
.Default
1335 or else Variable
.Values
/= Nil_String
;
1340 end Might_Have_Sources
;
1343 Config_Project_Node
: Project_Node_Id
:= Empty_Node
;
1346 pragma Assert
(Prj
.Env
.Is_Initialized
(Env
.Project_Path
));
1348 Free
(Config_File_Path
);
1349 Config
:= No_Project
;
1351 Check_Builder_Switches
;
1353 if Conf_File_Name
'Length > 0 then
1354 Config_File_Path
:= Locate_Config_File
(Conf_File_Name
.all);
1356 Config_File_Path
:= Locate_Config_File
(Default_File_Name
);
1359 if Config_File_Path
= null then
1360 if not Allow_Automatic_Generation
1361 and then Conf_File_Name
'Length > 0
1363 Raise_Invalid_Config
1364 ("could not locate main configuration project "
1365 & Conf_File_Name
.all);
1369 Automatically_Generated
:=
1370 Allow_Automatic_Generation
and then Config_File_Path
= null;
1372 <<Process_Config_File
>>
1374 if Automatically_Generated
then
1375 if Hostparm
.OpenVMS
then
1377 -- There is no gprconfig on VMS
1379 Raise_Invalid_Config
1380 ("could not locate any configuration project file");
1383 -- This might raise an Invalid_Config exception
1388 -- If the config file is not auto-generated, warn if there is any --RTS
1389 -- switch, but not when the config file is generated in memory.
1391 elsif RTS_Languages
.Get_First
/= No_Name
1392 and then Opt
.Warning_Mode
/= Opt
.Suppress
1393 and then On_Load_Config
= null
1396 ("warning: --RTS is taken into account only in auto-configuration");
1399 -- Parse the configuration file
1401 if Verbose_Mode
and then Config_File_Path
/= null then
1402 Write_Str
("Checking configuration ");
1403 Write_Line
(Config_File_Path
.all);
1406 if On_Load_Config
/= null then
1408 (Config_File
=> Config_Project_Node
,
1409 Project_Node_Tree
=> Project_Node_Tree
);
1411 elsif Config_File_Path
/= null then
1413 (In_Tree
=> Project_Node_Tree
,
1414 Project
=> Config_Project_Node
,
1415 Project_File_Name
=> Config_File_Path
.all,
1416 Errout_Handling
=> Prj
.Part
.Finalize_If_Error
,
1417 Packages_To_Check
=> Packages_To_Check
,
1418 Current_Directory
=> Current_Directory
,
1419 Is_Config_File
=> True,
1422 Config_Project_Node
:= Empty_Node
;
1425 if Config_Project_Node
/= Empty_Node
then
1426 Prj
.Proc
.Process_Project_Tree_Phase_1
1427 (In_Tree
=> Project_Tree
,
1429 Packages_To_Check
=> Packages_To_Check
,
1431 From_Project_Node
=> Config_Project_Node
,
1432 From_Project_Node_Tree
=> Project_Node_Tree
,
1434 Reset_Tree
=> False);
1437 if Config_Project_Node
= Empty_Node
1438 or else Config
= No_Project
1440 Raise_Invalid_Config
1441 ("processing of configuration project """
1442 & Config_File_Path
.all & """ failed");
1445 -- Check that the target of the configuration file is the one the user
1446 -- specified on the command line. We do not need to check that when in
1447 -- auto-conf mode, since the appropriate target was passed to gprconfig.
1449 if not Automatically_Generated
1451 Check_Target
(Config
, Autoconf_Specified
, Project_Tree
, Target_Name
)
1453 Automatically_Generated
:= True;
1454 goto Process_Config_File
;
1456 end Get_Or_Create_Configuration_File
;
1458 ------------------------
1459 -- Locate_Config_File --
1460 ------------------------
1462 function Locate_Config_File
(Name
: String) return String_Access
is
1463 Prefix_Path
: constant String := Executable_Prefix_Path
;
1465 if Prefix_Path
'Length /= 0 then
1466 return Locate_Regular_File
1468 "." & Path_Separator
&
1469 Prefix_Path
& "share" & Directory_Separator
& "gpr");
1471 return Locate_Regular_File
(Name
, ".");
1473 end Locate_Config_File
;
1475 --------------------
1476 -- Locate_Runtime --
1477 --------------------
1479 procedure Locate_Runtime
1480 (Language
: Name_Id
;
1481 Project_Tree
: Prj
.Project_Tree_Ref
)
1483 function Is_Base_Name
(Path
: String) return Boolean;
1484 -- Returns True if Path has no directory separator
1490 function Is_Base_Name
(Path
: String) return Boolean is
1492 for I
in Path
'Range loop
1493 if Path
(I
) = Directory_Separator
or else Path
(I
) = '/' then
1500 -- Local declarations
1502 function Find_Rts_In_Path
is new Prj
.Env
.Find_Name_In_Path
1503 (Check_Filename
=> Is_Directory
);
1505 RTS_Name
: constant String := Runtime_Name_For
(Language
);
1507 Full_Path
: String_Access
;
1509 -- Start of processing for Locate_Runtime
1512 if not Is_Base_Name
(RTS_Name
) then
1514 Find_Rts_In_Path
(Root_Environment
.Project_Path
, RTS_Name
);
1516 if Full_Path
= null then
1517 Fail_Program
(Project_Tree
, "cannot find RTS " & RTS_Name
);
1520 Set_Runtime_For
(Language
, Normalize_Pathname
(Full_Path
.all));
1525 ------------------------------------
1526 -- Parse_Project_And_Apply_Config --
1527 ------------------------------------
1529 procedure Parse_Project_And_Apply_Config
1530 (Main_Project
: out Prj
.Project_Id
;
1531 User_Project_Node
: out Prj
.Tree
.Project_Node_Id
;
1532 Config_File_Name
: String := "";
1533 Autoconf_Specified
: Boolean;
1534 Project_File_Name
: String;
1535 Project_Tree
: Prj
.Project_Tree_Ref
;
1536 Project_Node_Tree
: Prj
.Tree
.Project_Node_Tree_Ref
;
1537 Env
: in out Prj
.Tree
.Environment
;
1538 Packages_To_Check
: String_List_Access
;
1539 Allow_Automatic_Generation
: Boolean := True;
1540 Automatically_Generated
: out Boolean;
1541 Config_File_Path
: out String_Access
;
1542 Target_Name
: String := "";
1543 Normalized_Hostname
: String;
1544 On_Load_Config
: Config_File_Hook
:= null)
1547 pragma Assert
(Prj
.Env
.Is_Initialized
(Env
.Project_Path
));
1549 -- Parse the user project tree
1551 Prj
.Initialize
(Project_Tree
);
1553 Main_Project
:= No_Project
;
1554 Automatically_Generated
:= False;
1557 (In_Tree
=> Project_Node_Tree
,
1558 Project
=> User_Project_Node
,
1559 Project_File_Name
=> Project_File_Name
,
1560 Errout_Handling
=> Prj
.Part
.Finalize_If_Error
,
1561 Packages_To_Check
=> Packages_To_Check
,
1562 Current_Directory
=> Current_Directory
,
1563 Is_Config_File
=> False,
1566 if User_Project_Node
= Empty_Node
then
1567 User_Project_Node
:= Empty_Node
;
1571 Process_Project_And_Apply_Config
1572 (Main_Project
=> Main_Project
,
1573 User_Project_Node
=> User_Project_Node
,
1574 Config_File_Name
=> Config_File_Name
,
1575 Autoconf_Specified
=> Autoconf_Specified
,
1576 Project_Tree
=> Project_Tree
,
1577 Project_Node_Tree
=> Project_Node_Tree
,
1579 Packages_To_Check
=> Packages_To_Check
,
1580 Allow_Automatic_Generation
=> Allow_Automatic_Generation
,
1581 Automatically_Generated
=> Automatically_Generated
,
1582 Config_File_Path
=> Config_File_Path
,
1583 Target_Name
=> Target_Name
,
1584 Normalized_Hostname
=> Normalized_Hostname
,
1585 On_Load_Config
=> On_Load_Config
);
1586 end Parse_Project_And_Apply_Config
;
1588 --------------------------------------
1589 -- Process_Project_And_Apply_Config --
1590 --------------------------------------
1592 procedure Process_Project_And_Apply_Config
1593 (Main_Project
: out Prj
.Project_Id
;
1594 User_Project_Node
: Prj
.Tree
.Project_Node_Id
;
1595 Config_File_Name
: String := "";
1596 Autoconf_Specified
: Boolean;
1597 Project_Tree
: Prj
.Project_Tree_Ref
;
1598 Project_Node_Tree
: Prj
.Tree
.Project_Node_Tree_Ref
;
1599 Env
: in out Prj
.Tree
.Environment
;
1600 Packages_To_Check
: String_List_Access
;
1601 Allow_Automatic_Generation
: Boolean := True;
1602 Automatically_Generated
: out Boolean;
1603 Config_File_Path
: out String_Access
;
1604 Target_Name
: String := "";
1605 Normalized_Hostname
: String;
1606 On_Load_Config
: Config_File_Hook
:= null;
1607 Reset_Tree
: Boolean := True)
1609 Shared
: constant Shared_Project_Tree_Data_Access
:=
1610 Project_Tree
.Shared
;
1611 Main_Config_Project
: Project_Id
;
1615 Main_Project
:= No_Project
;
1616 Automatically_Generated
:= False;
1618 Process_Project_Tree_Phase_1
1619 (In_Tree
=> Project_Tree
,
1620 Project
=> Main_Project
,
1621 Packages_To_Check
=> Packages_To_Check
,
1623 From_Project_Node
=> User_Project_Node
,
1624 From_Project_Node_Tree
=> Project_Node_Tree
,
1626 Reset_Tree
=> Reset_Tree
);
1629 Main_Project
:= No_Project
;
1633 if Project_Tree
.Source_Info_File_Name
/= null then
1634 if not Is_Absolute_Path
(Project_Tree
.Source_Info_File_Name
.all) then
1636 Obj_Dir
: constant Variable_Value
:=
1639 Main_Project
.Decl
.Attributes
,
1643 if Obj_Dir
= Nil_Variable_Value
or else Obj_Dir
.Default
then
1644 Get_Name_String
(Main_Project
.Directory
.Display_Name
);
1647 if Is_Absolute_Path
(Get_Name_String
(Obj_Dir
.Value
)) then
1648 Get_Name_String
(Obj_Dir
.Value
);
1652 Add_Str_To_Name_Buffer
1653 (Get_Name_String
(Main_Project
.Directory
.Display_Name
));
1654 Add_Str_To_Name_Buffer
(Get_Name_String
(Obj_Dir
.Value
));
1658 Add_Char_To_Name_Buffer
(Directory_Separator
);
1659 Add_Str_To_Name_Buffer
(Project_Tree
.Source_Info_File_Name
.all);
1660 Free
(Project_Tree
.Source_Info_File_Name
);
1661 Project_Tree
.Source_Info_File_Name
:=
1662 new String'(Name_Buffer (1 .. Name_Len));
1666 Read_Source_Info_File (Project_Tree);
1669 -- Find configuration file
1671 Get_Or_Create_Configuration_File
1672 (Config => Main_Config_Project,
1673 Project => Main_Project,
1674 Project_Tree => Project_Tree,
1675 Project_Node_Tree => Project_Node_Tree,
1677 Allow_Automatic_Generation => Allow_Automatic_Generation,
1678 Config_File_Name => Config_File_Name,
1679 Autoconf_Specified => Autoconf_Specified,
1680 Target_Name => Target_Name,
1681 Normalized_Hostname => Normalized_Hostname,
1682 Packages_To_Check => Packages_To_Check,
1683 Config_File_Path => Config_File_Path,
1684 Automatically_Generated => Automatically_Generated,
1685 On_Load_Config => On_Load_Config);
1687 Apply_Config_File (Main_Config_Project, Project_Tree);
1689 -- Finish processing the user's project
1691 Prj.Proc.Process_Project_Tree_Phase_2
1692 (In_Tree => Project_Tree,
1693 Project => Main_Project,
1695 From_Project_Node => User_Project_Node,
1696 From_Project_Node_Tree => Project_Node_Tree,
1700 if Project_Tree.Source_Info_File_Name /= null
1701 and then not Project_Tree.Source_Info_File_Exists
1703 Write_Source_Info_File (Project_Tree);
1707 Main_Project := No_Project;
1709 end Process_Project_And_Apply_Config;
1711 --------------------------
1712 -- Raise_Invalid_Config --
1713 --------------------------
1715 procedure Raise_Invalid_Config (Msg : String) is
1717 Raise_Exception (Invalid_Config'Identity, Msg);
1718 end Raise_Invalid_Config;
1720 ----------------------
1721 -- Runtime_Name_For --
1722 ----------------------
1724 function Runtime_Name_For (Language : Name_Id) return String is
1726 if RTS_Languages.Get (Language) /= No_Name then
1727 return Get_Name_String (RTS_Languages.Get (Language));
1731 end Runtime_Name_For;
1733 --------------------------
1734 -- Runtime_Name_Set_For --
1735 --------------------------
1737 function Runtime_Name_Set_For (Language : Name_Id) return Boolean is
1739 return RTS_Languages.Get (Language) /= No_Name;
1740 end Runtime_Name_Set_For;
1742 ---------------------
1743 -- Set_Runtime_For --
1744 ---------------------
1746 procedure Set_Runtime_For (Language : Name_Id; RTS_Name : String) is
1748 Name_Len := RTS_Name'Length;
1749 Name_Buffer (1 .. Name_Len) := RTS_Name;
1750 RTS_Languages.Set (Language, Name_Find);
1751 end Set_Runtime_For;