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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,910a48a538936849 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!79g2000cws.googlegroups.com!not-for-mail From: "markww" Newsgroups: comp.lang.ada Subject: Re: how to import a package Date: 6 Dec 2006 20:14:05 -0800 Organization: http://groups.google.com Message-ID: <1165464845.649851.312700@79g2000cws.googlegroups.com> References: <1165371252.358817.57840@80g2000cwy.googlegroups.com> <1165449396.112251.129200@l12g2000cwl.googlegroups.com> NNTP-Posting-Host: 66.65.64.109 Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Trace: posting.google.com 1165464851 7468 127.0.0.1 (7 Dec 2006 04:14:11 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 7 Dec 2006 04:14:11 +0000 (UTC) In-Reply-To: User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727),gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: 79g2000cws.googlegroups.com; posting-host=66.65.64.109; posting-account=cNKOMg0AAADT2ug8oGSYYXo8bsDvrHzw Xref: g2news2.google.com comp.lang.ada:7841 Date: 2006-12-06T20:14:05-08:00 List-Id: Ok so I moved the package into another file, compiled it separately, and it seems to import now. Looks like: package Node is new GenericNode(T => PERSON_REC); use Node; and now I can declare variables like: Start : Node.Node_Ptr; which is very excellent. Thanks for your help with that. I thought it would be smooth sailing now but I ran into one other minor problem related to this which I think is just a syntax problem. I've defined a function to count the # of nodes I have like: function GetRecordCount(Starting_Point : Node.Node_Ptr) return INTEGER is Temp : Node.Node_Ptr; nCount : INTEGER := 0; begin Temp := Starting_Point; if Temp = null then return 0; else loop nCount := nCount + 1; Temp := Temp.Next_Rec; // PROBLEM if Temp = null then return nCount; end if; end loop; end if; end GetRecordCount; but I get an error at line: Temp := Temp.Next_Rec; expected type "Node_Ptr" defined at genericnode.ads:9, instance at line 29 do I need to use some special syntax to do that assignment? Next_Rec is of type Node_Ptr so I don't see why it's causing an error. Thanks, Mark Brian May wrote: > >>>>> "markww" == markww writes: > > markww> I thought that the following line: > > markww> package Person_List in new P (T => PERSON_REC) > > markww> is just instantiating one instance of the package called > markww> Person_List. So the line: > > markww> Start : Person_List.Node_Ptr; > > In Ada, a package is not a type (unlike in, say Java where a class is > a type and a package). > > So the above defines Start to of type Node_Ptr as found in the > Person_List package. > > markww> doesn't make sense to me since it looks like 'Start' is > markww> being defined as pointing to Person_List.Node_Ptr, when I > markww> thought the right side of the colon must be a data type. > > Correct. > -- > Brian May