/[cvs.andrew.net.au]/uni/COMP2310/lab1/queue_pack_simple.adb
ViewVC logotype

Contents of /uni/COMP2310/lab1/queue_pack_simple.adb

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations)
Mon Jul 25 06:58:15 2005 UTC (17 years, 6 months ago) by apollock
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +17 -0 lines
After some fiddling

1 with Ada.Text_IO, Ada.Integer_Text_IO;
2
3 package body Queue_Pack_Simple is
4
5 procedure Enqueue (Item: in Element; Queue: in out Queue_Type) is
6 begin
7 Ada.Text_IO.Put_Line("Queue.Free = " & Queue.Free'Img);
8 Queue.Elements (Queue.Free) := Item;
9 Queue.Free := Queue.Free - 1;
10 end Enqueue;
11
12 procedure Dequeue (Item: out Element; Queue: in out Queue_Type) is
13 begin
14 Ada.Text_IO.Put_Line("Queue.Top = " & Queue.Top'Img);
15 Ada.Text_IO.Put_Line("Item at Queue.Free (" & Queue.Free'Img & ") = " & Queue.Elements (Queue.Free+1)'Img);
16 Item := Queue.Elements (Queue.Top);
17 Queue.Top := Queue.Top - 1;
18 Ada.Text_IO.Put_Line("Queue.Top = " & Queue.Top'Img);
19 end Dequeue;
20 end Queue_Pack_Simple;
21
22 -- arrays, zero-based or 1-based?
23 -- types in specification, are they pre-existing or not?
24 -- does this marker thing wrap?

  ViewVC Help
Powered by ViewVC 1.1.22