text stringlengths 0 234 |
|---|
case SF.Count (Result, ".") is |
when 0 => |
return Name (Interface_Tag) & "_" & Result; |
when 1 => |
Result (SF.Index (Result, ".")) := '_'; |
return Result; |
when others => |
raise XML_Exception; |
end case; |
end Get_Enum_Type_Name; |
Arg_Name : constant String |
:= Xml_Parser_Utils.Adaify_Variable_Name (Name (Arg_Tag)); |
Arg_Type : constant String := |
Xml_Parser_Utils.Arg_Type_As_String (Arg_Tag); |
Arg_Type_Name : constant String := |
(if Exists_Enum (Arg_Tag) then |
Xml_Parser_Utils.Adaify_Name (Get_Enum_Type_Name) |
else |
Arg_Type); |
Arg_Name_Aligned : constant String := SF.Head (Arg_Name, Max_Length, ' '); |
begin |
if Arg_Type_Name /= Arg_Type then |
Enum_Types.Include (Arg_Type_Name, Arg_Type); |
end if; |
if Is_Last then |
Put (File, " " & Arg_Name_Aligned & " : " & Arg_Type_Name & ")"); |
else |
Put_Line (File, " " & Arg_Name_Aligned & " : " & Arg_Type_Name & ";"); |
end if; |
end Generate_Code_For_Arg; |
type Parameter is record |
Name, Ada_Type : SU.Unbounded_String; |
end record; |
type Parameter_Array is array (Positive range <>) of Parameter; |
type Subprogram_Kind is (Declaration, Implementation); |
Max_Line_Length : constant := 99; |
Generate_Interfaces_For_Client : constant Boolean := True; |
Unused_Padding_Name : constant String := "Unused"; |
procedure Generate_Pretty_Code_For_Subprogram |
(File : Ada.Text_IO.File_Type; |
Kind : Subprogram_Kind; |
Interface_Tag : aliased Wayland_XML.Interface_Tag; |
Procedure_Name : String; |
Return_Type : String; |
Parameters : Parameter_Array := (1 .. 0 => <>)) |
is |
Name : constant String |
:= Xml_Parser_Utils.Adaify_Name |
(Wayland_XML.Name (Interface_Tag)); |
Ptr_Name : constant String |
:= Xml_Parser_Utils.Adaify_Name |
(Wayland_XML.Name (Interface_Tag) & "_Ptr"); |
Subprogram_Kind : constant String := (if Return_Type'Length > 0 then "function" else "procedure"); |
Return_String : constant String := (if Return_Type'Length > 0 then " return " & Return_Type else ""); |
Max_Name_Length : Natural := Name'Length; |
function Align (Value : String) return String is (SF.Head (Value, Max_Name_Length, ' ')); |
Last_Char : constant String := (if Kind = Declaration then ";" else " is"); |
One_Line : Boolean; |
begin |
for Parameter of Parameters loop |
Max_Name_Length := Natural'Max (Max_Name_Length, SU.Length (Parameter.Name)); |
end loop; |
declare |
Line_Length : Natural := Subprogram_Kind'Length + 8 + 2 * Name'Length + Procedure_Name'Length + Ptr_Name'Length + Return_String'Length + Last_Char'Length + 2 * Parameters'Length; |
begin |
for Parameter of Parameters loop |
Line_Length := Line_Length + SU.Length (Parameter.Name) + SU.Length (Parameter.Ada_Type) + 3; |
end loop; |
One_Line := Parameters'Length = 0 and Line_Length <= Max_Line_Length; |
Function Definition: procedure Identify_Protocol_Tag; |
Function Body: procedure Identify_Protocol_Children; |
procedure Allocate_Space_For_Wayland_XML_Contents |
(File_Name : String; |
File_Contents : out Aida.Deepend.String_Ptr) |
is |
package IO renames Ada.Streams.Stream_IO; |
Size : constant Natural := Natural (Ada.Directories.Size (File_Name)); |
File : IO.File_Type; |
subtype File_String is String (1 .. Size); |
begin |
IO.Open (File, IO.In_File, File_Name); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.