text stringlengths 0 234 |
|---|
Function Definition: procedure Process_Command_Arguments; |
Function Body: |
Function Definition: procedure Put_Im_Instance_Info is |
Function Body: new Put_Instance_Info(Image_WFC); |
procedure Put_Ch_Instance_Info is |
new Put_Instance_Info(Character_WFC); |
Input_Image, Output_Image : IL_Image; |
Input_File : File_Type; |
Output_File : File_Type; |
Im_Instance : Im_Instance_Access; |
Ch_Instance : Ch_Instance_Access; |
type Input_Kind is (None, Pictoral, Textual); |
-- The type of the last received input sample. |
-- We want to be able to process both actual images |
-- as well as simpler, textual files, for ease of use. |
Last_Input_Kind : Input_Kind := None; |
-- Remember whether we've had an input yet, and if so, |
-- what type it was. |
N, M : aliased Integer := 2; |
-- The width and height of the tiles |
-- to be used in the instantiation. |
Rot, Ref : aliased Boolean := False; |
-- Whether to include rotations, and reflections, |
-- respectively, in the instantiation tileset. |
Use_Stdout : aliased Boolean := False; |
-- Whether to output text-only instance results |
-- on stdout rather than using a separate file. |
Output_Scale : aliased Integer := 1; |
-- When in image mode, how much to scale up the output image. |
Out_Name : XString; |
-- The name of the file we will produce as output (sans extension, size info, id) |
Out_Ct : Natural := 0; |
-- How many outputs we've handled so far. |
procedure Parse_Output_Command (Spec : String; W, H : out Natural) is |
use Ada.Strings.Maps; |
use Ada.Strings.Fixed; |
Separator_Set : constant Character_Set := To_Set("xX,/:"); |
Separator_Ix : constant Natural := Index(Spec, Separator_Set); |
Last : Natural; |
begin |
if Separator_Ix = 0 then |
raise Argument_Error with "Cannot parse argument: (" & Spec & ")"; |
end if; |
declare |
Prefix : String renames Spec (Spec'First .. Separator_Ix - 1); |
Suffix : String renames Spec (Separator_Ix + 1 .. Spec'Last); |
begin |
Get(Prefix, Item => W, Last => Last); |
if Last /= Prefix'Last then |
raise Argument_Error with "Cannot parse integer: (" & Prefix & ")"; |
end if; |
Get(Suffix, Item => H, Last => Last); |
if Last /= Suffix'Last then |
raise Argument_Error with "Cannot parse integer: (" & Suffix & ")"; |
end if; |
Function Definition: procedure Process_Command_Arguments is |
Function Body: type Output_Handler_Type is |
access procedure (W, H : Natural); |
function Handle_Arg (Handler : not null Output_Handler_Type) return Boolean is |
Arg : constant String := Get_Argument; |
Out_W, Out_H : Natural; |
begin |
if Arg = "" then |
return False; |
end if; |
Parse_Output_Command(Arg, Out_W, Out_H); |
Handler(Out_W, Out_H); |
return True; |
Function Definition: function Rotate_Clockwise (Matrix : in Element_Matrix) return Element_Matrix |
Function Body: with Inline |
is |
Out_Matrix : Element_Matrix (Matrix'Range(2), Matrix'Range(1)); |
Out_X : Natural; |
begin |
for The_X in Matrix'Range(1) loop |
for The_Y in Matrix'Range(2) loop |
Out_X := Matrix'First(2) + Matrix'Last(2) - The_Y; |
Out_Matrix(Out_X, The_X) := Matrix(The_X, The_Y); |
end loop; |
end loop; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.