From: "markww" <markww@gmail.com>
Subject: Re: how to import a package
Date: 6 Dec 2006 20:14:05 -0800
Date: 2006-12-06T20:14:05-08:00 [thread overview]
Message-ID: <1165464845.649851.312700@79g2000cws.googlegroups.com> (raw)
In-Reply-To: <sa4ejrc7ay7.fsf@margay.local>
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 <markww@gmail.com> 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 <bam@snoopy.apana.org.au>
next prev parent reply other threads:[~2006-12-07 4:14 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-06 2:14 how to import a package markww
2006-12-06 3:06 ` Adam Beneschan
2006-12-06 3:34 ` markww
2006-12-06 9:18 ` Simon Wright
2006-12-06 19:47 ` Jeffrey R. Carter
2006-12-06 23:56 ` markww
2006-12-07 1:18 ` Björn Persson
2006-12-07 1:26 ` Brian May
2006-12-07 4:14 ` markww [this message]
2006-12-07 4:40 ` Brian May
2006-12-07 9:32 ` Stuart
2006-12-07 11:21 ` Jean-Pierre Rosen
2006-12-11 6:16 ` markww
2006-12-11 6:50 ` markww
2006-12-11 9:40 ` Georg Bauhaus
2006-12-11 14:19 ` markww
2006-12-11 15:03 ` Dmitry A. Kazakov
2006-12-11 16:22 ` Adam Beneschan
2006-12-11 20:28 ` Jeffrey R. Carter
2006-12-12 3:19 ` markww
2006-12-12 3:31 ` Jeffrey R. Carter
2006-12-12 9:03 ` Stuart
2006-12-12 10:56 ` Georg Bauhaus
2006-12-11 7:00 ` Simon Wright
2006-12-07 4:06 ` Jeffrey R. Carter
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox