text
stringlengths
0
234
"wayland-protocols-" & Protocol_Name & ".adb");
-- TODO Do not import System.Address_To_Access_Conversions if
-- there are no generic *_Events packages
Put_Line (File, "with System.Address_To_Access_Conversions;");
New_Line (File);
if Protocol_Name = "client" then
Put_Line (File, "with Interfaces.C.Strings;");
New_Line (File);
Put_Line (File, "with Wayland.Posix;");
elsif Protocol_Name in "presentation_time" | "relative_pointer_unstable_v1" then
Put_Line (File, "with Ada.Unchecked_Conversion;");
Put_Line (File, "");
Put_Line (File, "with Wayland.Protocols.Thin_Client;");
elsif Protocol_Name = "xdg_decoration_unstable_v1" then
Put_Line (File, "with Wayland.Protocols.Thin_Xdg_Shell;");
else
Put_Line (File, "with Wayland.Protocols.Thin_Client;");
end if;
New_Line (File);
Put_Line (File, "package body Wayland.Protocols." & Package_Name & " is");
New_Line (File);
if Generate_Interfaces_For_Client or Protocol_Name /= "client" then
Put_Line (File, " procedure Initialize renames Thin.Initialize;");
Put_Line (File, "");
end if;
if Protocol_Name = "client" then
Put_Line (File, " package body Constructors is");
Put_Line (File, " function Set_Proxy (Proxy : Secret_Proxy) return Buffer is");
Put_Line (File, " (Proxy => Thin.Buffer_Ptr (Proxy));");
Put_Line (File, "");
Put_Line (File, " function Set_Proxy (Proxy : Secret_Proxy) return Output is");
Put_Line (File, " (Proxy => Thin.Output_Ptr (Proxy));");
Put_Line (File, "");
Put_Line (File, " function Set_Proxy (Proxy : Secret_Proxy) return Surface is");
Put_Line (File, " (Proxy => Thin.Surface_Ptr (Proxy));");
Put_Line (File, " end Constructors;");
Put_Line (File, "");
end if;
Generate_Manually_Edited_Code (Protocol_Name);
Put_Line (File, "end Wayland.Protocols." & Package_Name & ";");
Ada.Text_IO.Close (File);
-----------------------------------------------------------------------
Ada.Text_IO.Create
(File, Ada.Text_IO.Out_File,
"wayland-protocols-thin_" & Protocol_Name & ".adb");
Put_Line (File, "with Ada.Unchecked_Conversion;");
Put_Line (File, "");
Put_Line (File, "package body Wayland.Protocols.Thin_" & Package_Name & " is");
Put_Line (File, "");
if Generate_Interfaces_For_Client or Protocol_Name /= "client" then
Put_Line (File, " procedure Initialize is");
Put_Line (File, " begin");
Put_Line (File, " Interface_Pointers :=");
for Index in All_Types.First_Index .. All_Types.Last_Index loop
declare
Value : constant String := +All_Types (Index);
Prefix : constant String := (if Index = All_Types.First_Index then "(" else " ");
Suffix : constant String := (if Index = All_Types.Last_Index then ");" else ",");
begin
Put_Line (File, " " & Prefix & (if Value'Length > 0 then Xml_Parser_Utils.Adaify_Name (Value) & "_Interface'Access" else "null") & Suffix);
Function Definition: Put_Line (File, " function Display_Connect return Display_Ptr is");
Function Body: Put_Line (File, " begin");
Put_Line (File, " return Wayland.API.Display_Connect (Interfaces.C.Strings.Null_Ptr);");
Put_Line (File, " end Display_Connect;");
Put_Line (File, "");
Put_Line (File, " procedure Display_Disconnect (This : in out Display_Ptr) is");
Put_Line (File, " use type Wayland.API.Display_Ptr;");
Put_Line (File, " begin");
Put_Line (File, " if This /= null then");
Put_Line (File, " Wayland.API.Display_Disconnect (This);");
Put_Line (File, " This := null;");
Put_Line (File, " end if;");
Put_Line (File, " end Display_Disconnect;");
end if;
Create_Wl_Thin_Body_File;
Put_Line (File, "");
Put_Line (File, "end Wayland.Protocols.Thin_" & Package_Name & ";");
Ada.Text_IO.Close (File);
end Create_File;
procedure Create_Wl_Thin_Body_File is