From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,e9744fb3474f9427,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-05-24 03:13:59 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: b99andla@student.his.se (Kladde) Newsgroups: comp.lang.ada Subject: Enormous problems in one of my programs! Date: 24 May 2002 03:13:58 -0700 Organization: http://groups.google.com/ Message-ID: NNTP-Posting-Host: 194.237.160.178 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1022235239 15328 127.0.0.1 (24 May 2002 10:13:59 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 24 May 2002 10:13:59 GMT Xref: archiver1.google.com comp.lang.ada:24635 Date: 2002-05-24T10:13:59+00:00 List-Id: Helllo! I have a home assignment in ADA, and sice Im not used to this language I need some help, I would be very greatful. Below I will insert a start, header and body file and any faults or problems you can find I will be very happy for. Under the code I will insert the compile failures I get when trying to compile. All help is greatly appreciated!! //*********************** START FILE (shouldnt contain any faults since it came with the package i got at the start of the course): //*************************** with Fibonacci; use Fibonacci; procedure Starter is begin Random_F.Reset(Gen =>Randomizer); -- initialize random generator Island.Breed; -- creates first two rabbits end; //******************************** DECLARATION FILE (.ads file, shouldnt contain any faults either since it too came with the package): //******************************** with Ada.Numerics.Discrete_Random; with Ada.Text_Io; package Fibonacci is task type Female is -- Server task specification entry Multiply; end Female; type Server_P is access Female; -- Type for Pointers to Server tasks task type Male; -- Client task specification type Client_P is access Male; -- Type for Pointers to Client tasks type Servers is array (1 .. 100) of Server_P; type Clients is array (1 .. 100) of Client_P; subtype F_Index is Integer range 1 .. 100; -- Support for randomness in selection of servers package Random_F is new Ada.Numerics.Discrete_Random(Result_Subtype => F_Index); -- Hint : Temp:=(Random_F.Random(Gen => Randomizer) mod 17)+1; assigns a Randomizer : Random_F.Generator; -- Generator of psudo-randomnes protected type Island_T is -- protected object definition private Pairs : Integer := 0; Females : Servers; Males : Clients; entry Get_Random_Female ( Female : out Server_P ); procedure Breed; end Island_T; Island : Island_T; -- a protected object for resource control end Fibonacci; //*************************** BODY FILE (this is the one that contains the faults since its the one that I made :-)) //*************************** with Ada.Numerics.Discrete_Random; with Ada.Text_Io; package body Fibonacci is --H�R �R KVINNAN task body Female is begin loop accept Multiply do Island.Breed; end Multiply; end loop; end Female; -- H�r �r mannen task body Male is temp : Female; begin delay 20.0; loop temp := Island.Get_Random_Female; loop select temp.Multiply; or delay 3.0; end select; end loop; delay 2.0; end loop; end Male; -- H�r �r �n protected body Island is begin accept Get_Random_Female(hona: out Server_P) do hona := honor(par); return; end Get_Random_Female; procedure Breed is begin if(par <= 100) then hanar(par) := new Male; honor(par) := new Female; par := par+1; end if; end Breed; end Island; end Fibonacci; //********************* Here are the errors that the program produces //************************ fibonacci.adb:51:03: missing "end Island;" fibonacci.adb:59:03: declarations must come before "begin" fibonacci.adb:68:01: "end Fibonnaci;" expected