35 lines
961 B
Text
35 lines
961 B
Text
short_circuit_evaluation:
|
|
procedure options (main);
|
|
declare (true initial ('1'b), false initial ('0'b) ) bit (1);
|
|
declare (i, j, x, y) bit (1);
|
|
|
|
a: procedure (bv) returns (bit(1));
|
|
declare bv bit(1);
|
|
put ('Procedure ' || procedurename() || ' called.');
|
|
return (bv);
|
|
end a;
|
|
b: procedure (bv) returns (bit(1));
|
|
declare bv bit(1);
|
|
put ('Procedure ' || procedurename() || ' called.');
|
|
return (bv);
|
|
end b;
|
|
|
|
do i = true, false;
|
|
do j = true, false;
|
|
put skip(2) list ('Evaluating x with <a> with ' || i || ' and <b> with ' || j);
|
|
put skip;
|
|
if a(i) then
|
|
x = b(j);
|
|
else
|
|
x = false;
|
|
put skip data (x);
|
|
put skip(2) list ('Evaluating y with <a> with ' || i || ' and <b> with ' || j);
|
|
put skip;
|
|
if a(i) then
|
|
y = true;
|
|
else
|
|
y = b(j);
|
|
put skip data (y);
|
|
end;
|
|
end;
|
|
end short_circuit_evaluation;
|