text
stringlengths
0
234
Suffix : constant String := (if Is_Last then ");" else ",");
begin
Put_Line (File, Prefix & Aligned_Name & Suffix);
Generate_Summary_For_Entry (Entry_Tag);
end Generate_Code_For_Entry;
begin
New_Line (File);
if Is_Bitfield then
Put_Line (File, " type " & Enum_Type_Name & " is record");
for Child of Wayland_XML.Entries (Enum_Tag) loop
Generate_Code_For_Entry_Component (Child.Entry_Tag.all);
end loop;
if Count_components < 32 then
declare
Aligned_Name : constant String :=
SF.Head (Unused_Padding_Name, Max_Length, ' ');
begin
Put_Line (File, " " & Aligned_Name & " : Unused_Type;");
Function Definition: procedure Generate_Private_Code_For_Enum_Constants is
Function Body: procedure Handle_Interface
(Interface_Tag : aliased Wayland_XML.Interface_Tag)
is
procedure Generate_Code (Enum_Tag : aliased Wayland_XML.Enum_Tag) is
Enum_Type_Name : constant String := Xml_Parser_Utils.Adaify_Name
(Name (Interface_Tag) & "_" & Name (Enum_Tag));
Is_Bitfield : constant Boolean :=
Exists_Bitfield (Enum_Tag) and then Bitfield (Enum_Tag);
Max_Length : constant Natural :=
Natural'Max (Get_Max_Child_Length (Enum_Tag), Unused_Padding_Name'Length);
Count_Components : Natural := 0;
procedure Generate_Code_For_Entry_Component
(Entry_Tag : Wayland_XML.Entry_Tag)
is
Aligned_Name : constant String :=
SF.Head (Get_Name (Entry_Tag), Max_Length, ' ');
type U32 is mod 2 ** 32
with Size => 32;
Value : constant U32 := U32'Value (Value_As_String (Entry_Tag));
begin
-- Ignore entry with value 0 because then all components of
-- the record are False
if Value = 0 then
return;
end if;
if (Value and (Value - 1)) /= 0 then
raise Constraint_Error with Value'Image & " is not a power of two";
end if;
Count_Components := Count_Components + 1;
declare
Bit : Natural := 0;
begin
while Value > 2 ** Bit loop
Bit := Bit + 1;
end loop;
Put_Line (File, " " & Aligned_Name &
" at 0 range " & Trim (Bit'Image) & " .. " & Trim (Bit'Image) & ";");
Function Definition: procedure Generate_Prefix_Spec_Events is
Function Body: begin
Put_Line (File, "");
Put_Line (File, " generic");
end Generate_Prefix_Spec_Events;
procedure Generate_Suffix_Spec_Events (Name : String) is
begin
Put_Line (File, " package " & Name & "_Events is");
Put_Line (File, "");
Put_Line (File, " procedure Subscribe");
Put_Line (File, " (Object : aliased in out " & Name & "'Class)");
Put_Line (File, " with Pre => Object.Has_Proxy;");
Put_Line (File, "");
Put_Line (File, " end " & Name & "_Events;");
end Generate_Suffix_Spec_Events;
procedure Handle_Interface_Subprograms_Client
(Interface_Tag : aliased Wayland_XML.Interface_Tag)
is
Name : constant String
:= Xml_Parser_Utils.Adaify_Name (Wayland_XML.Name (Interface_Tag));
begin
if Name in "Compositor" | "Seat" | "Shm" | "Output" | "Data_Device_Manager" then
Generate_Spec_Bind_Subprogram (Name);
end if;
if Name = "Display" then
Put_Line (File, "");
Put_Line (File, " function Is_Connected (Object : Display) return Boolean renames Has_Proxy;");
Put_Line (File, "");
Put_Line (File, " procedure Connect (Object : in out Display)");