text
stringlengths
0
234
Full_Type_Decl : constant Ada_Pretty.Node_Access :=
F.New_Type
(Type_Name,
Discriminants => F.New_Parameter
(Name => Subpool,
Type_Definition => F.New_Null_Exclusion
(F.New_Selected_Name
(+"System.Storage_Pools.Subpools.Subpool_Handle"))),
Definition => F.New_Record
(Is_Limited => True, Is_Tagged => True));
Root : constant Ada_Pretty.Node_Access :=
F.New_Package
(F.New_Selected_Name (Package_Name), Public_Part, Full_Type_Decl);
With_Clauses : constant Ada_Pretty.Node_Access_Array :=
(F.New_With (F.New_Selected_Name (+"System.Storage_Pools.Subpools")),
Get_With_Clauses
(F'Access, Vector, Is_Limited => False),
F.New_With
(F.New_Selected_Name (Get_Package_Name (Lexical_Element))),
F.New_With
(F.New_Selected_Name (Get_Package_Name (Element_Vector))));
Unit : constant Ada_Pretty.Node_Access :=
F.New_Compilation_Unit
(Root,
F.New_List (With_Clauses));
Output : Ada.Wide_Wide_Text_IO.File_Type;
begin
Open_File (Output, Package_Name, "nodes/");
Ada.Wide_Wide_Text_IO.Put_Line
(Output,
F.To_Text (Unit).Join (Ada.Characters.Wide_Wide_Latin_1.LF)
.To_Wide_Wide_String);
Ada.Wide_Wide_Text_IO.Close (Output);
end Write_Factories;
--------------------------
-- Write_Factories_Body --
--------------------------
procedure Write_Factories_Body
(Vector : Meta.Read.Class_Vectors.Vector;
Implicit : Boolean := False)
is
function Methods return Ada_Pretty.Node_Access;
Package_Name : constant League.Strings.Universal_String :=
(if Implicit then +"Program.Implicit_Element_Factories"
else +"Program.Element_Factories");
F : aliased Ada_Pretty.Factory;
Type_Name : constant Ada_Pretty.Node_Access :=
F.New_Name (+"Element_Factory");
function Prop_Parameters is new Generic_List_Reduce
(Classes.Property, Classes.Property_Array, Prop_Parameter, F);
function Prop_Arguments is new Generic_List_Reduce
(Classes.Property, Classes.Property_Array, Prop_Argument, F);
function Get_Params
(Item : Classes.Class) return Ada_Pretty.Node_Access;
function Allocator_Args
(Item : Classes.Class) return Ada_Pretty.Node_Access;
function Get_With_Clauses return Ada_Pretty.Node_Access;
function Access_Types return Ada_Pretty.Node_Access;
function Prop_List
(Item : Classes.Class) return Classes.Property_Array;
------------------
-- Access_Types --
------------------
function Access_Types return Ada_Pretty.Node_Access is
Result : Ada_Pretty.Node_Access;
begin
for Item of Vector loop
if not Item.Is_Abstract then
declare
Element_Name : constant League.Strings.Universal_String :=
(if Implicit then "Implicit_" & Item.Name
else To_Element_Name (Item.Name));
Def : constant Ada_Pretty.Node_Access := F.New_Access
(Target => F.New_Selected_Name
(F.New_Selected_Name (Node_Package_Name (Item.Name)),
F.New_Name (Element_Name)));
begin
Result := F.New_List
(Result,
F.New_Type
(F.New_Name (Item.Name & "_Access"),