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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,f51594afc8ac17fd,start X-Google-Attributes: gid103376,public From: "Eric Sabo" Subject: Need help with code? Date: 1997/12/10 Message-ID: <66m904$naj$1@usenet48.supernews.com>#1/1 X-Deja-AN: 297992950 Sender: @147.72.72.144 X-MimeOLE: Produced By Microsoft MimeOLE V4.71.1712.3 Organization: All USENET -- http://www.Supernews.com Newsgroups: comp.lang.ada Date: 1997-12-10T00:00:00+00:00 List-Id: Can someone tell what am I doing wrong with this code? ----------------------- begin ---------------------------------------- generic type item_type is private; procedure push(x : in out item_type); procedure push(x : in out item_type) is type item_node; type item_ptr is access item_node; record item : item_type; next : item_ptr; end record; temp : item_type; first, last, p : item_ptr := null; begin put("Enter data (null to quit)"); get(temp); while temp /= null loop p := new item_node; p.item := temp; p.next := null; if first = null then first := p; last := p; else last.next := p; last := p; end if; put("Enter data (null to quit)"); get(temp); end loop; end push; generic type item_type is private; procedure print(x : in out item_type); procedure print(x : in out item_type) is type item_node; type item_ptr is access item_node; record item : item_type; next : item_ptr; end record; first, last, p : item_ptr; begin put_line("Here is the stack you requested"); p := first; while p /= null loop put(p.number); put(" "); p := p.next; end loop; end print; generic type item_type is private; procedure pop(x : in out item_type); procedure pop(x : in out item_type) is type item_node; type item_ptr is access item_node; record item : item_type; next : item_ptr; end record; first, last, p : item_ptr; begin put_line("Popping the first item of the linked list"); p := first.next; first := p; end pop; with push; with pop; with print; with gnat.io; use gnat.io; procedure maingeneric is -- integer type type item_integer; type int_ptr is access item_integer; record a : integer; next : int_ptr; end record; procedure int_push is new push(item_integer); procedure int_pop is new pop(item_integer); procedure int_print is new print(item_integer); -- float type type item_float; type flt_ptr is access item_float; record f : float; next : flt_ptr; end record; procedure flt_push is new push(item_float); procedure flt_pop is new pop(item_float); procedure flt_print is new print(item_float); -- record type type item_rec; type rec_ptr is access item_rec; record name : string (1..20); id : string(1..10); next : rec_ptr; end record; procedure rec_push is new push(item_rec); procedure rec_pop is new pop(item_rec); procedure rec_print is new print(item_rec); begin push(a); push(f); push(name); end maingeneric; ------------------- end -------------------------------- thanks, Eric Sabo sabo@hhs.net sab9074@cup.edu