Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -1,36 +0,0 @@
|
|||
with Ada.Text_IO; use Ada.Text_IO;
|
||||
|
||||
procedure Man_Or_Boy is
|
||||
function Zero return Integer is begin return 0; end Zero;
|
||||
function One return Integer is begin return 1; end One;
|
||||
function Neg return Integer is begin return -1; end Neg;
|
||||
|
||||
function A
|
||||
( K : Integer;
|
||||
X1, X2, X3, X4, X5 : access function return Integer
|
||||
) return Integer is
|
||||
M : Integer := K; -- K is read-only in Ada. Here is a mutable copy of
|
||||
function B return Integer is
|
||||
begin
|
||||
M := M - 1;
|
||||
return A (M, B'Access, X1, X2, X3, X4);
|
||||
end B;
|
||||
begin
|
||||
if M <= 0 then
|
||||
return X4.all + X5.all;
|
||||
else
|
||||
return B;
|
||||
end if;
|
||||
end A;
|
||||
begin
|
||||
Put_Line
|
||||
( Integer'Image
|
||||
( A
|
||||
( 10,
|
||||
One'Access, -- Returns 1
|
||||
Neg'Access, -- Returns -1
|
||||
Neg'Access, -- Returns -1
|
||||
One'Access, -- Returns 1
|
||||
Zero'Access -- Returns 0
|
||||
) ) );
|
||||
end Man_Or_Boy;
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
with Ada.Text_IO; use Ada.Text_IO;
|
||||
|
||||
procedure Man_Or_Boy is
|
||||
function Zero return Integer is (0);
|
||||
function One return Integer is (1);
|
||||
function Neg return Integer is (-1);
|
||||
|
||||
function A
|
||||
(K : Integer;
|
||||
X1, X2, X3, X4, X5 : access function return Integer)
|
||||
return Integer is
|
||||
M : Integer := K; -- K is read-only in Ada. Here is a mutable copy of
|
||||
function B return Integer is
|
||||
begin
|
||||
M := M - 1;
|
||||
return A (M, B'Access, X1, X2, X3, X4);
|
||||
end B;
|
||||
begin
|
||||
return (if M <= 0 then X4.all + X5.all else B);
|
||||
end A;
|
||||
begin
|
||||
Put_Line
|
||||
(Integer'Image
|
||||
(A (K => 10,
|
||||
X1 => One'Access,
|
||||
X2 => Neg'Access,
|
||||
X3 => Neg'Access,
|
||||
X4 => One'Access,
|
||||
X5 => Zero'Access)));
|
||||
end Man_Or_Boy;
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
with Ada.Text_IO;
|
||||
use Ada.Text_IO;
|
||||
|
||||
procedure Man_Or_Boy is
|
||||
|
||||
function Zero return Integer is ( 0);
|
||||
function One return Integer is ( 1);
|
||||
function Neg return Integer is (-1);
|
||||
|
||||
function A (K: Integer;
|
||||
X1, X2, X3, X4, X5: access function return Integer) return Integer is
|
||||
M : Integer := K; -- K is read-only in Ada. Here is a mutable copy of K
|
||||
Res_A: Integer;
|
||||
function B return Integer is
|
||||
begin
|
||||
M := M - 1;
|
||||
Res_A := A (M, B'Access, X1, X2, X3, X4); -- set result of A
|
||||
return Res_A;
|
||||
end B;
|
||||
begin
|
||||
if M <= 0 then
|
||||
return X4.all + X5.all;
|
||||
else
|
||||
declare
|
||||
Dummy: constant Integer := B; -- throw away
|
||||
begin
|
||||
return Res_A;
|
||||
end;
|
||||
end if;
|
||||
end A;
|
||||
|
||||
begin
|
||||
|
||||
Put_Line (Integer'Image (A (K => 10,
|
||||
X1 => One 'Access,
|
||||
X2 => Neg 'Access,
|
||||
X3 => Neg 'Access,
|
||||
X4 => One 'Access,
|
||||
X5 => Zero'Access)));
|
||||
|
||||
end Man_Or_Boy;
|
||||
Loading…
Add table
Add a link
Reference in a new issue