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=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,7cdfb25519d96a8a,start X-Google-Attributes: gid103376,public From: Nathan J Subject: Queue System -- record type has changed? Date: 1997/10/07 Message-ID: <343A0322.58B4@echidna.stu.cowan.edu.au>#1/1 X-Deja-AN: 278379953 X-Complaints-To: news@news.cowan.edu.au X-Trace: news.cowan.edu.au 876216950 7797 (None) 139.230.52.43 Organization: Edith Cowan University -- Student Reply-To: fytyxt@echidna.stu.cowan.edu.au Newsgroups: comp.lang.ada Date: 1997-10-07T00:00:00+00:00 List-Id: I am doing an assignment in Ada (my first) and need some help with data structues. (Before you ask, I don't need a code listing, I need some (simple) help telling me what could be wrong). Could you please help? If this helps any, I am using GNAT ADA 3.07 to code and compile it (as far as I can tell) Using a predefined Queue structure, I enqueue a few dummy records of type Record_Type (a few strings and integers), containing a couple of integers and floating point values. I then ask to call a procedure "Display" whose spec is: Generic with procedure put_object(object : object_type); procedure display(the_queue : queue); -- results : Displays the queue of objects. The body contains a few while and if statements but the bit I am concentrating on is: put_object(the_queue.objects(i)); Where the_queue.objects(i) is number (i) of a for loop, and the_queue.objects is an array of record_type, which was added to when I enqueued the dummy records. I added a spec for put_object: (Fnord, by the way, means nothing) procedure put_object(object : object_type); -- fnord And the body: procedure put_object(object : object_type) is package integer_io is new text_io.integer_io(integer); -- Instantiations package float_io is new text_io.float_io(float); -- For I/O use float_io; use integer_io; begin put (object.part_one); end put_object; Where part_one is the name of the first field in the Record_Type that I defined, of type integer. Because this came up with some error I couldn't understand (just like most of them), I commented out the "Generic" and "With procedure &c." lines from the display spec, and re-compiled it. It refuses to recognise object.part_one, because: 139. put (object.part_one); | >>> invalid prefix in selected component "temp_record" I can't understand this. As far as I can tell, the structure should be exactly the same as Record_type... Finally, if I delete the "Put (object.part_one);" line from the code and insert: Put ("Hi"); It compiles, links, and when I try to generate an EXE file, it kicks me into GDB (?) after creating the EXE, and if I run either the EXE file, or the COF through GDB, if prints "Hi" three times (because I enqueued 3 records), and then exits normally (Checked with a "Put ("Exited normally")" just before the end statement) Could someone please help me here? Thanks in advance, Nathan