comp.lang.ada
 help / color / mirror / Atom feed
* Instantiation of a generic Subprogram in a package HELP!!
@ 1993-06-03  0:48 agate!howland.reston.ans.net!math.ohio-state.edu!caen!saimiri.primate.wis
  0 siblings, 0 replies; only message in thread
From: agate!howland.reston.ans.net!math.ohio-state.edu!caen!saimiri.primate.wis @ 1993-06-03  0:48 UTC (permalink / raw)


	
	Hello, I am trying to write a generic package that WITHs
another package that has some strange generic procedure in it that I
dont know how to instantiate in my package. I am looking for some
help, and any that I might find would be GRETLY appreciated!

	Here is the part in the generic_binary_search_tree package
where I am confused:

generic
	with procedure process (the_object : object_type);
procedure traverse (the_tree: binary_tree; the_order: traverse_order);
--
-- Results: Procedure process is applied to the_object in each
--          node in the_tree. The order in which the node values are
--	    processed is specified by the_order as follows:
--
-- definitions for pre_order, in_order, and post_order traversals deleted
--
--

Ok, the process procedure is where I am confused. I have a subprogram
in MY package that gets the next node in the tree, and ONLY the next
node. I assume I instantiate a NEW process in my Get_Next procedure
that would return the next node. But traverse applies "process" to
every node in the tree, so how can I just get the first node, and then
next time I call Get_Next I will get the next node, etc. So, in other
words, how can I control traverse to give me the next node everytime I
call it, instead of coughing up each node all at once?

	I suppose one idea would be to put each node in the tree into
an array and then every time Get_Next is called the next component in
the array is spat out. Or even instead of putting each node into an
array, put a pointer (access type) to each node of the tree into the
array.


Any ideas? Please respond by email as I cannot read this group very
often.

Thanks!
Micah

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1993-06-03  0:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1993-06-03  0:48 Instantiation of a generic Subprogram in a package HELP!! agate!howland.reston.ans.net!math.ohio-state.edu!caen!saimiri.primate.wis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox