text
stringlengths
0
234
Result : Natural := Natural'First;
begin
Get_File (File);
-- Get all values
declare
Current_Line,
Current_Column : Positive := Positive'First;
begin
while not End_Of_File (File) loop
declare
Str : constant String := Get_Line (File);
Last : Positive;
begin
for Char of Str loop
Ada.Integer_Text_IO.Get (Char & "", Octopuses_Energy_Level (Current_Line, Current_Column), Last);
Current_Column := Current_Column + 1;
File_Is_Empty := False;
end loop;
Function Definition: procedure Parse_Register(parser : in out Parser_Type;
Function Body: result : out Memory_Pointer) is
mem : Memory_Pointer := null;
begin
while Get_Type(parser) = Open loop
Match(parser, Open);
declare
name : constant String := Get_Value(parser);
begin
Match(parser, Literal);
if name = "memory" then
if mem /= null then
Destroy(mem);
Raise_Error(parser,
"memory declared multiple times in register");
end if;
Parse_Memory(parser, mem);
else
Raise_Error(parser, "invalid register attribute: " & name);
end if;
Function Definition: procedure MemGen is
Function Body: mem : Memory_Pointer;
name : Unbounded_String := To_Unbounded_String("mem");
addr_width : Positive := 32 - 3;
mem_index : Integer := -1;
simplify : Boolean := True;
procedure Show_Usage is
begin
Put_Line("usage: " & Command_Name & " [options] <memory>");
Put_Line("options:");
Put_Line(" -width <int> Address width (default" &
Positive'Image(addr_width) & ")");
Put_Line(" -nosimplify Disable memory simplification");
end Show_Usage;
begin
-- Parse arguments.
declare
i : Positive := 1;
arg : Unbounded_String;
begin
while i <= Argument_Count loop
arg := To_Unbounded_String(Argument(i));
if arg = "-width" and i + 1 <= Argument_Count then
i := i + 1;
addr_width := Positive'Value(Argument(i));
elsif arg = "-name" and i + 1 <= Argument_Count then
i := i + 1;
name := To_Unbounded_String(Argument(i));
elsif arg = "-nosimplify" then
simplify := False;
elsif mem_index < 0 then
mem_index := i;
else
Show_Usage;
return;
end if;
i := i + 1;
end loop;
Function Definition: procedure Register_Benchmark(runner : in out Runner_Type;
Function Body: benchmark : in Benchmark_Pointer) is
begin
runner.benchmarks.Append(benchmark);
end Register_Benchmark;
procedure Run(runner : in out Runner_Type;
mem : in Memory_Pointer) is
first : constant Natural := runner.benchmarks.First_Index;
last : constant Natural := runner.benchmarks.Last_Index;
bp : Benchmark_Pointer;
begin
for i in first .. last loop
bp := runner.benchmarks.Element(i);