text
stringlengths
0
234
procedure Generate_Comment (Text : String) is
Interval_Identifier : constant Xml_Parser_Utils.Interval_Identifier := Xml_Parser_Utils.Make (Text);
begin
for Interval of Interval_Identifier.Intervals loop
declare
Comment : constant String := Trim (Text (Interval.First .. Interval.Last));
begin
if Comment'Length > 0 then
Put_Line (File, " -- " & Comment);
else
Put_Line (File, " --");
end if;
Function Definition: Put_Line (File, " function Display_Connect return Display_Ptr;");
Function Body: Put_Line (File, "");
Put_Line (File, " procedure Display_Disconnect (This : in out Display_Ptr);");
elsif Protocol_Name = "xdg_decoration_unstable_v1" then
Put_Line (File, " use Wayland.Protocols.Thin_Xdg_Shell;");
else
Put_Line (File, " use Wayland.Protocols.Thin_Client;");
end if;
Put_Line (File, "");
Generate_Code_For_Interface_Constants;
if Generate_Interfaces_For_Client or Protocol_Name /= "client" then
New_Line (File);
Put_Line (File, " procedure Initialize;");
New_Line (File);
end if;
Generate_Code_For_Interface_Ptrs;
Generate_Code_For_Each_Interface;
if Generate_Interfaces_For_Client or Protocol_Name /= "client" then
Put_Line (File, "private");
New_Line (File);
Generate_Private_Code_For_Interface_Constants;
New_Line (File);
end if;
end Create_Wl_Thin_Spec_File;
procedure Generate_Use_Type_Declarions (Package_Name : String) is
procedure Handle_Interface (Interface_Tag : aliased Wayland_XML.Interface_Tag) is
Name : constant String
:= Xml_Parser_Utils.Adaify_Name (Wayland_XML.Name (Interface_Tag));
begin
Put_Line (File, " use type Thin." & Name & "_Ptr;");
end Handle_Interface;
begin
Put_Line (File, " package Thin renames Wayland.Protocols.Thin_" & Package_Name & ";");
Put_Line (File, "");
Iterate_Over_Interfaces (Handle_Interface'Access);
end Generate_Use_Type_Declarions;
procedure Generate_Manually_Edited_Code_For_Type_Definitions is
procedure Handle_Interface (Interface_Tag : aliased Wayland_XML.Interface_Tag) is
Name : constant String
:= Xml_Parser_Utils.Adaify_Name (Wayland_XML.Name (Interface_Tag));
begin
Put_Line (File, "");
Put_Line (File, " type " & Name & " is tagged limited record");
Put_Line (File, " Proxy : Thin." & Name & "_Ptr;");
Put_Line (File, " end record;");
-- FIXME add Initialized : Boolean := Thin.Initialize; for Xdg_Wm_Base and Wp_Presentation
end Handle_Interface;
begin
Iterate_Over_Interfaces (Handle_Interface'Access);
end Generate_Manually_Edited_Code_For_Type_Definitions;
procedure Generate_Private_Code_For_The_Interface_Constants is
procedure Handle_Interface (Interface_Tag : aliased Wayland_XML.Interface_Tag) is
Name : constant String
:= Xml_Parser_Utils.Adaify_Name
(Wayland_XML.Name (Interface_Tag) & "_Interface");
begin
Put_Line (File, "");
Put_Line (File, " " & Name & " : constant Interface_Type :=");
Put_Line (File, " (My_Interface => Thin." & Name & "'Access);");
end Handle_Interface;
begin
Iterate_Over_Interfaces (Handle_Interface'Access);
end Generate_Private_Code_For_The_Interface_Constants;
begin
Create_File;
end Create_Wayland_Spec_File;
procedure Create_Wayland_Body_File is
File : Ada.Text_IO.File_Type;
procedure Create_Wl_Thin_Body_File;
procedure Generate_Manually_Edited_Code (Protocol_Name : String);
procedure Create_File is
Protocol_Name : constant String := Get_Protocol_Name (Name (Protocol_Tag.all));
Package_Name : constant String := Xml_Parser_Utils.Adaify_Name (Protocol_Name);
begin
Ada.Text_IO.Create
(File, Ada.Text_IO.Out_File,