+ -----------------------
+ -- Create procedures --
+ -----------------------
+ -- The following procedures are used to edit a project file tree. They are
+ -- slightly higher-level than the Set_* procedures below
+
+ function Create_Project
+ (In_Tree : Project_Node_Tree_Ref;
+ Name : Name_Id;
+ Full_Path : Path_Name_Type;
+ Is_Config_File : Boolean := False) return Project_Node_Id;
+ -- Create a new node for a project and register it in the tree so that it
+ -- can be retrieved later on.
+
+ function Create_Package
+ (Tree : Project_Node_Tree_Ref;
+ Project : Project_Node_Id;
+ Pkg : String) return Project_Node_Id;
+ -- Create a new package in Project. If the package already exists, it is
+ -- returned. The name of the package *must* be lower-cases, or none of its
+ -- attributes will be recognized.
+
+ function Create_Attribute
+ (Tree : Project_Node_Tree_Ref;
+ Prj_Or_Pkg : Project_Node_Id;
+ Name : Name_Id;
+ Index_Name : Name_Id := No_Name;
+ Kind : Variable_Kind := List;
+ At_Index : Integer := 0;
+ Value : Project_Node_Id := Empty_Node) return Project_Node_Id;
+ -- Create a new attribute. The new declaration is added at the end of the
+ -- declarative item list for Prj_Or_Pkg (a project or a package), but
+ -- before any package declaration). No addition is done if Prj_Or_Pkg is
+ -- Empty_Node. If Index_Name is not "", then if creates an attribute value
+ -- for a specific index. At_Index is used for the " at <idx>" in the naming
+ -- exceptions.
+ --
+ -- To set the value of the attribute, either provide a value for Value, or
+ -- use Set_Expression_Of to set the value of the attribute (in which case
+ -- Enclose_In_Expression might be useful). The former is recommended since
+ -- it will more correctly handle cases where the index needs to be set on
+ -- the expression rather than on the index of the attribute (i.e. 'for
+ -- Specification ("unit") use "file" at 3', versus 'for Executable ("file"
+ -- at 3) use "name"'). Value must be a N_String_Literal if an index will be
+ -- added to it.
+
+ function Create_Literal_String
+ (Str : Namet.Name_Id;
+ Tree : Project_Node_Tree_Ref) return Project_Node_Id;
+ -- Create a literal string whose value is Str
+
+ procedure Add_At_End
+ (Tree : Project_Node_Tree_Ref;
+ Parent : Project_Node_Id;
+ Expr : Project_Node_Id;
+ Add_Before_First_Pkg : Boolean := False;
+ Add_Before_First_Case : Boolean := False);
+ -- Add a new declarative item in the list in Parent. This new declarative
+ -- item will contain Expr (unless Expr is already a declarative item, in
+ -- which case it is added directly to the list). The new item is inserted
+ -- at the end of the list, unless Add_Before_First_Pkg is True. In the
+ -- latter case, it is added just before the first case construction is
+ -- seen, or before the first package (this assumes that all packages are
+ -- found at the end of the project, which isn't true in the general case
+ -- unless you have normalized the project to match this description).
+
+ function Enclose_In_Expression
+ (Node : Project_Node_Id;
+ Tree : Project_Node_Tree_Ref) return Project_Node_Id;
+ -- Enclose the Node inside a N_Expression node, and return this expression.
+ -- This does nothing if Node is already a N_Expression.
+