text
stringlengths
0
234
Temp : String (1 .. 8);
begin
for Char of Str loop
Value := Natural'Value ("16#" & Char & "#");
Ada.Integer_Text_IO.Put (Temp,
Value,
Base => 2);
File_Is_Empty := False;
declare
Trimmed : constant String := Trim (Temp, Ada.Strings.Both);
Formatted_Bin_Str : constant String :=
Tail (Trimmed (Trimmed'First + 2 .. Trimmed'Last - 1), 4, '0');
begin
for Elt of Formatted_Bin_Str loop
Packet.Enqueue (Elt);
end loop;
Function Definition: procedure Main is
Function Body: use Ada.Execution_Time,
Ada.Real_Time,
Ada.Strings.Fixed,
Ada.Strings.Unbounded,
Ada.Text_IO;
use Utils;
package Character_Queue_Interfaces is
new Ada.Containers.Synchronized_Queue_Interfaces (Element_Type => Character);
package Character_Queues is new Ada.Containers.Unbounded_Synchronized_Queues
(Queue_Interfaces => Character_Queue_Interfaces);
use Character_Queues;
function Pop (Q : in out Queue; N : Positive; Nb_Delete : in out Long_Long_Natural) return String;
function Pop (Q : in out Queue; N : Positive; Nb_Delete : in out Long_Long_Natural) return String is
Result : String (1 .. N);
begin
for Index in 1 .. N loop
Q.Dequeue (Result (Index));
end loop;
Nb_Delete := Nb_Delete + Long_Long_Natural (N);
return Result;
end Pop;
File : File_Type;
Start_Time, End_Time : CPU_Time;
Execution_Duration : Time_Span;
File_Is_Empty : Boolean := True;
Result : Long_Long_Natural := Long_Long_Natural'First;
Packet : Queue;
begin
Get_File (File);
-- Get all values
declare
begin
while not End_Of_File (File) loop
declare
Str : constant String := Get_Line (File);
Value : Natural;
Temp : String (1 .. 8);
begin
for Char of Str loop
Value := Natural'Value ("16#" & Char & "#");
Ada.Integer_Text_IO.Put (Temp,
Value,
Base => 2);
File_Is_Empty := False;
declare
Trimmed : constant String := Trim (Temp, Ada.Strings.Both);
Formatted_Bin_Str : constant String :=
Tail (Trimmed (Trimmed'First + 2 .. Trimmed'Last - 1), 4, '0');
begin
for Elt of Formatted_Bin_Str loop
Packet.Enqueue (Elt);
end loop;
Function Definition: procedure Main is
Function Body: use Ada.Text_IO;
use Utils;
package L9 renames Ada.Characters.Latin_9;
type Movements is (Forward, Down, Up);
File : File_Type;
Horizontal_Position : Natural := 0;
Depth : Natural := 0;
begin
Get_File (File);
-- Get all values
while not End_Of_File (File) loop
declare
Line : constant String := Get_Line (File);
begin
Split_Value : for Index in Line'Range loop
if Line (Index) = L9.Space then