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-Thread: 103376,910a48a538936849 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit From: Brian May Newsgroups: comp.lang.ada Subject: Re: how to import a package References: <1165371252.358817.57840@80g2000cwy.googlegroups.com> <1165449396.112251.129200@l12g2000cwl.googlegroups.com> <1165464845.649851.312700@79g2000cws.googlegroups.com> Date: Thu, 07 Dec 2006 15:40:57 +1100 Message-ID: User-Agent: Gnus/5.110006 (No Gnus v0.6) XEmacs/21.4.19 (linux) Cancel-Lock: sha1:fSUBN9IE1ivNdCtKlO+8Gm2wFeU= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii NNTP-Posting-Host: snoopy.microcomaustralia.com.au X-Trace: quokka.wn.com.au 1165466454 202.173.153.89 (7 Dec 2006 13:40:54 +0800) X-Complaints-To: abuse@westnet.com.au Path: g2news2.google.com!news3.google.com!news.glorb.com!quokka.wn.com.au!not-for-mail Xref: g2news2.google.com comp.lang.ada:7842 Date: 2006-12-07T15:40:57+11:00 List-Id: >>>>> "markww" == markww writes: markww> Ok so I moved the package into another file, compiled it separately, markww> and it seems to import now. Looks like: markww> package Node is new GenericNode(T => PERSON_REC); markww> use Node; markww> and now I can declare variables like: markww> Start : Node.Node_Ptr; markww> which is very excellent. Thanks for your help with that. I thought it markww> would be smooth sailing now but I ran into one other minor problem markww> related to this which I think is just a syntax problem. I've defined a markww> function to count the # of nodes I have like: markww> function GetRecordCount(Starting_Point : Node.Node_Ptr) return markww> INTEGER is markww> Temp : Node.Node_Ptr; markww> nCount : INTEGER := 0; markww> begin markww> Temp := Starting_Point; markww> if Temp = null then markww> return 0; markww> else markww> loop markww> nCount := nCount + 1; markww> Temp := Temp.Next_Rec; // PROBLEM markww> if Temp = null then markww> return nCount; markww> end if; markww> end loop; markww> end if; markww> end GetRecordCount; markww> but I get an error at line: markww> Temp := Temp.Next_Rec; markww> expected type "Node_Ptr" defined at genericnode.ads:9, instance at markww> line 29 markww> do I need to use some special syntax to do that assignment? Next_Rec is markww> of type Node_Ptr so I don't see why it's causing an error. Going back in time, you said you defined Next_Rec as: type Node; type Node_Ptr is access Node; type Node is record Data : T; Prev_Rec : access Node; Next_Rec : access Node; end record; Note that "access Node" is not the same thing as "Node_Ptr". >From memory the first is an "anonymous access type", but my memory is a bit rusty on this topic right now (Ada 2005 feature when used in a record?). I think you want to replace "access Node" with "Node_Ptr". -- Brian May