text
stringlengths
0
234
declare
Arg_Name : constant String
:= Xml_Parser_Utils.Adaify_Variable_Name (Name (Child.Arg_Tag.all));
begin
Max_Name_Length := Natural'Max (Max_Name_Length, Arg_Name'Length);
Function Definition: procedure Generate_Code_For_Listener_Type_Definition is
Function Body: function Get_Name (Event_Tag : Wayland_XML.Event_Tag) return String is
(Xml_Parser_Utils.Adaify_Name (Name (Event_Tag)));
Name_Length : Natural := 0;
procedure Generate_Code_For_Record_Component
(Event_Tag : aliased Wayland_XML.Event_Tag)
is
Component_Name : constant String := Get_Name (Event_Tag);
Component_Type_Name : constant String
:= Xml_Parser_Utils.Adaify_Name
(Name (Interface_Tag) & "_" &
Name (Event_Tag) & "_Subprogram_Ptr");
Component_Name_Aligned : constant String := SF.Head (Component_Name & (if Is_Reserved_Keyword (Component_Name) then "_F" else ""), Name_Length, ' ');
use type Wayland_XML.Version_Number;
begin
-- Patch out events from wl_output that exist since v4 because
-- the high level bindings assume v3
if Wayland_XML.Name (Interface_Tag) = "wl_output"
and (Exists_Since (Event_Tag) and then Since (Event_Tag) >= 4)
then
return;
end if;
Put_Line (File, " " & Component_Name_Aligned & " : " & Component_Type_Name & ";");
end Generate_Code_For_Record_Component;
Name : constant String
:= Xml_Parser_Utils.Adaify_Name
(Wayland_XML.Name (Interface_Tag) & "_Listener_T");
Ptr_Name : constant String
:= Xml_Parser_Utils.Adaify_Name
(Wayland_XML.Name (Interface_Tag) & "_Listener_Ptr");
begin
Put_Line (File, " type " & Name & " is record");
for Child of Children (Interface_Tag) loop
if Child.Kind_Id = Child_Event then
declare
Arg_Name : constant String := Get_Name (Child.Event_Tag.all);
begin
Name_Length := Natural'Max (Name_Length, Arg_Name'Length + (if Is_Reserved_Keyword (Arg_Name) then 2 else 0));
Function Definition: procedure Generate_Code_For_Add_Listener_Subprogram_Declaration is
Function Body: Ptr_Listener_Name : constant String
:= Xml_Parser_Utils.Adaify_Name
(Wayland_XML.Name (Interface_Tag) & "_Listener_Ptr");
begin
Generate_Pretty_Code_For_Subprogram
(File, Declaration, Interface_Tag, "Add_Listener", "Interfaces.C.int",
((+"Listener", +Ptr_Listener_Name),
(+"Data", +"Void_Ptr")));
end Generate_Code_For_Add_Listener_Subprogram_Declaration;
procedure Generate_Code_For_Set_User_Data_Subprogram_Declaration is
begin
Generate_Pretty_Code_For_Subprogram
(File, Declaration, Interface_Tag, "Set_User_Data", "",
(1 => (+"Data", +"Void_Ptr")));
end Generate_Code_For_Set_User_Data_Subprogram_Declaration;
procedure Generate_Code_For_Get_User_Data_Subprogram_Declaration is
begin
Generate_Pretty_Code_For_Subprogram
(File, Declaration, Interface_Tag, "Get_User_Data", "Void_Ptr");
end Generate_Code_For_Get_User_Data_Subprogram_Declaration;
procedure Generate_Code_For_Get_ID_Subprogram_Declaration is
begin
Generate_Pretty_Code_For_Subprogram
(File, Declaration, Interface_Tag, "Get_ID", "Unsigned_32");
end Generate_Code_For_Get_ID_Subprogram_Declaration;
procedure Generate_Code_For_Get_Version_Subprogram_Declaration is
begin
Generate_Pretty_Code_For_Subprogram
(File, Declaration, Interface_Tag, "Get_Version", "Unsigned_32");
end Generate_Code_For_Get_Version_Subprogram_Declaration;
procedure Generate_Code_For_Destroy_Subprogram_Declaration is
begin
Generate_Pretty_Code_For_Subprogram
(File, Declaration, Interface_Tag, "Destroy", "");
end Generate_Code_For_Destroy_Subprogram_Declaration;
procedure Generate_Code_For_Requests is
procedure Generate_Code_For_Subprogram_Declaration
(Request_Tag : aliased Wayland_XML.Request_Tag)
is