text stringlengths 0 234 |
|---|
Put_Line (File, " end Constructors;"); |
elsif Protocol_Name = "xdg_shell" then |
Put_Line (File, ""); |
Put_Line (File, " function Get_Proxy (Object : Xdg_Toplevel) return Secret_Proxy;"); |
end if; |
end Generate_Code_For_External_Proxies; |
procedure Generate_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, " " & Name & " : constant Interface_Type;"); |
end Handle_Interface; |
begin |
New_Line (File); |
Iterate_Over_Interfaces (Handle_Interface'Access); |
end Generate_Code_For_The_Interface_Constants; |
function Get_Name (Entry_Tag : Wayland_XML.Entry_Tag) return String is |
-- Just because some entries in wl_output.transform start with a digit :/ |
Entry_Name : constant String := Name (Entry_Tag); |
begin |
return |
(if Entry_Name in "90" | "180" | "270" then |
"Rotate_" & Entry_Name |
else |
Xml_Parser_Utils.Adaify_Name (Entry_Name)); |
end Get_Name; |
function Get_Max_Child_Length (Enum_Tag : aliased Wayland_XML.Enum_Tag) return Natural is |
Result : Natural := 0; |
begin |
for Child of Wayland_XML.Entries (Enum_Tag) loop |
Result := Natural'Max (Result, Get_Name (Child.Entry_Tag.all)'Length); |
end loop; |
return Result; |
end Get_Max_Child_Length; |
procedure Generate_Code_For_Enum_Constants is |
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); |
procedure Generate_Summary_For_Entry |
(Entry_Tag : Wayland_XML.Entry_Tag) |
is |
Summary_String : constant String := |
(if Enable_Comments and Exists_Summary (Entry_Tag) then |
Summary (Entry_Tag) |
else ""); |
begin |
if Summary_String'Length > 0 then |
Put_Line (File, " -- " & Summary_String); |
end if; |
end Generate_Summary_For_Entry; |
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, ' '); |
Value : constant Natural := Natural'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; |
Count_components := Count_components + 1; |
Put_Line (File, " " & Aligned_Name & " : Boolean := False;"); |
Generate_Summary_For_Entry (Entry_Tag); |
end Generate_Code_For_Entry_Component; |
procedure Generate_Code_For_Entry |
(Entry_Tag : Wayland_XML.Entry_Tag; |
Is_First : Boolean; |
Is_Last : Boolean) |
is |
Aligned_Name : constant String := Get_Name (Entry_Tag); |
Prefix : constant String := (if Is_First then "" else " "); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.