|
|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 Tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: B T
Length: 1153 (0x481)
Types: TextFile
Names: »B«
└─⟦f64eaa120⟧ Bits:30000752 8mm tape, Rational 1000, !projects 93 02 16
└─⟦6f12a12be⟧ »DATA«
└─⟦this⟧
package body Bounded_Queue_Generic is
function Next_Index (Q : Queue; Index : Positive) return Positive is
begin
if Index = Q.Max_Elements then
return 1;
else
return Index + 1;
end if;
end Next_Index;
function Is_Empty (Q : Queue) return Boolean is
begin
return Q.Head = Q.Tail;
end Is_Empty;
procedure Make_Empty (Q : in out Queue) is
begin
Q.Head := Q.Tail;
end Make_Empty;
procedure Enqueue (Q : in out Queue; X : Element) is
begin
if Next_Index (Q, Q.Head) = Q.Tail then
raise Constraint_Error;
end if;
Q.Values (Q.Head) := X;
Q.Head := Next_Index (Q, Q.Head);
end Enqueue;
procedure Dequeue (Q : in out Queue) is
begin
if Is_Empty (Q) then
raise Constraint_Error;
end if;
Q.Tail := Next_Index (Q, Q.Tail);
end Dequeue;
function First (Q : Queue) return Element is
begin
if Q.Head = Q.Tail then
raise Constraint_Error;
end if;
return Q.Values (Q.Tail);
end First;
end Bounded_Queue_Generic;