Re: Proposal for new functions in glib



On Fri, Jul 31, 1998 at 01:53:03AM +0200, Tim Janik wrote:
> 
> hi all,
> 
> i've composed a sample API for an n-way tree implementation in
> glib. i urge everyone to comment on this suggestion, since i'd
> like to get a basic imlementation going ASAP, so pavlov can
> start out with it in balsa. (we will need to make another glib
> release once the implementation has settled, in order to have
> something out there to base the upcoming balsa release on).
> 
> typedef enum
> {
>   G_TRAVERSE_PRE_ORDER,
>   G_TRAVERSE_POST_ORDER,
>   G_TRAVERSE_IN_ORDER,
    ^^^^^^^^^^^^^^^^^^^ does this make sense with an n-way tree ?

>   G_TRAVERSE_LEVEL_ORDER
> } GTraverseType;
> 
> typedef enum
> {

    G_TRAVERSE_ALL ???

>   G_TRAVERSE_LEAFS_ONLY,
>   G_TRAVERSE_NON_LEAFS_ONLY
> } GTraverseFlags;
> 
> typedef void (*GNodeTraverseFunc) (Gnode   *node,
>                                    gpointer data);
> 
[...]
> /* traversal function, assumes that `node' is root
>  * (only traverses `node' and its subtree).
>  * this function is just a high level interface to
>  * eight low level traversal functions, optimized for
>  * speed.
>  * (should we specify a `guint max_depth' here? that
>  *  would cause sixteen internal functions...)
>  */

I think we'll need max_depth sooner or later, so it
would be better to specify it from the beginning.

> void  g_node_traverse (GNode             *node,
> 		       GTraverseType      order,
> 		       GTraverseFlags     flags,
>                        GNodeTraverseFunc  func,
>                        gpointer           data);


bye,
  Lars



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]