Just as a note, I wonder if Bill Cox's database schema developed for gnetman is something we should leverage.

-Dan

Werner Hoch wrote:
Hi,

I'll use this mail information collection for hierarchy code.
Please put comments on the hierarchy code as follow ups to this message.


There are two possible ways: a: put the hierarchy into a g_node structure and traverse it using the glib function:
http://developer.gnome.org/doc/API/2.0/glib/glib-N-ary-Trees.html
void        g_node_traverse                 (GNode *root,
                                             GTraverseType order,
                                             GTraverseFlags flags,
                                             gint max_depth,
                                             GNodeTraverseFunc func,
                                             gpointer data);

b: write a traversing function that is similar to g_node_traverse
   this function could have additional options to set traversing oder
   and level.


I'll take the second choise:
The function prototype may be in libgeda -> s_hierarch.c and look like this: int s_hierarchy_traverse(PAGE * p_start, page_travers_order_type order,
                         page_travers_flag_type flags,
                         int max_depth,
                         page_traverse_func func,
                         void * data)

p_start --> page to start at: this may be p_current of w_current
order --> preorder, postorder, logical
          logical would be the way a person would travers ;-)
flags --> single page, multipage, hierarchical
max_depth --> limit the recursion depth
func --> user given function:
         int func(PAGE *p, void * data)
data --> the data passed to the user function

return value may be a schematic count and negative values for error codes.


I think the traverse function can only walk down and the hierarchy,
(accessing multipage sisters and brothers; accessing child schematics)

Problems:
If there's a reference to a single page of a multipage schematic:
* is only the single page refered or the whole multipage schematic?
  (see attachment: master_schematic refers one page of multipage
   schematic)
* if a schematic with two symbol refer different pages of a multipage
  schematic. Add one ore two complete multipage schematics to the
  hierarchy?
  (see attachment: schematic4 referes two subschematics of a multipage
   schematic)
* accessing two multipage schematics from different parrent schematics
  (not in the attachment)

Comments? Either here or IRC


Side notes:
previous schematic and next schematic doesn't work
jumping from multipage1_1.sch to multipage1_2.sch is not possible.

Regards Werner

Reply via email to