text
stringlengths
0
234
end if;
else
Put (File, Spaces * " " & Get_Value (Child.Arg_Tag.all, Xml_Parser_Utils.Adaify_Variable_Name (Wayland_XML.Name (Child.Arg_Tag.all))));
end if;
else
Put (File, Spaces * " " & "Proxy_Ptr (" & Get_Value (Child.Arg_Tag.all, Xml_Parser_Utils.Adaify_Variable_Name (Wayland_XML.Name (Child.Arg_Tag.all))) & ")");
end if;
end if;
end loop;
end Generate_Arguments;
procedure Generate_Code_Before_Arguments is
Interface_Name : constant String := Xml_Parser_Utils.Adaify_Name
(Xml_Parser_Utils.Find_Specified_Interface (Request_Tag)) & "_Interface";
begin
Put_Line (File, " P : constant Proxy_Ptr :=");
Put_Line (File, " Wayland.API.Proxy_Marshal_Constructor");
Put_Line (File, " (" & Name & ".all,");
Put_Line (File, " " & Opcode & ",");
Put_Line (File, " " & Interface_Name & "'Access,");
end Generate_Code_Before_Arguments;
procedure Generate_Code_After_Arguments is
begin
Put_Line (File, ");");
Put_Line (File, " begin");
Put_Line (File, " return (if P /= null then P.all'Access else null);");
Put_Line (File, " end " & Subprogram_Name & ";");
end Generate_Code_After_Arguments;
Enum_Types : String_Maps.Map;
procedure Generate_Conversion_Code_For_Args is
procedure Generate_Convert (Cursor : String_Maps.Cursor) is
From : constant String := String_Maps.Key (Cursor);
To : constant String := String_Maps.Element (Cursor);
begin
Put_Line (File, " function Convert is new Ada.Unchecked_Conversion");
Put_Line (File, " (" & From & ", " & To & ");");
end Generate_Convert;
begin
Enum_Types.Iterate (Generate_Convert'Access);
end Generate_Conversion_Code_For_Args;
V : Wayland_XML.Request_Child_Vectors.Vector;
Max_Name_Length : Natural := Name'Length;
function Align (Value : String) return String is (SF.Head (Value, Max_Name_Length, ' '));
begin
Put_Line (File, "");
if Xml_Parser_Utils.Is_New_Id_Argument_Present (Request_Tag) then
if Xml_Parser_Utils.Is_Interface_Specified (Request_Tag) then
declare
Return_Type : constant String := Xml_Parser_Utils.Adaify_Name
(Xml_Parser_Utils.Find_Specified_Interface (Request_Tag) & "_Ptr");
begin
Get_Max_Arg_Length (Request_Tag, V, Max_Name_Length);
if Xml_Parser_Utils.Number_Of_Args (Request_Tag) > 1 then
Put_Line (File, " function " & Subprogram_Name);
Put_Line (File, " (" & Align (Name) & " : " & Ptr_Name & ";");
for Child of V loop
if Child.Kind_Id = Child_Arg then
Generate_Code_For_Arg
(File,
Interface_Tag,
Child.Arg_Tag.all,
Max_Name_Length,
Child = V.Last_Element,
Enum_Types);
end if;
end loop;
Put_Line (File, " return " & Return_Type);
Put_Line (File, " is");
Generate_Conversion_Code_For_Args;
if not Enum_Types.Is_Empty then
Put_Line (File, "");
end if;
else
if 27 + Subprogram_Name'Length + Name'Length + Ptr_Name'Length + Return_Type'Length <= Max_Line_Length then
Put_Line (File, " function " & Subprogram_Name & " (" & Name & " : " & Ptr_Name & ") return " & Return_Type & " is");
else
Put_Line (File, " function " & Subprogram_Name);
Put_Line (File, " (" & Name & " : " & Ptr_Name & ") return " & Return_Type);
Put_Line (File, " is");
end if;
end if;
Generate_Code_Before_Arguments;
Generate_Arguments (11, True);
Generate_Code_After_Arguments;
Function Definition: procedure Print_Active_Map is
Function Body: C: Active_Clients.Cursor := Active_Clients.First(Active_Map);
EP_Image: ASU.Unbounded_String;
begin
Ada.Text_IO.Put_Line ("ACTIVE CLIENTS");
Ada.Text_IO.Put_Line ("==============");