Removed 3rd parameter to s_hierarchy_find_[next|prev]_page(): now
explicitly search for sibling page of page in 2nd parameter. Also
added description for functions.
---
 gschem/src/i_callbacks.c    |    4 ++--
 libgeda/include/prototype.h |    4 ++--
 libgeda/src/s_hierarchy.c   |   40 ++++++++++++++++++++++++++++++----------
 3 files changed, 34 insertions(+), 14 deletions(-)

diff --git a/gschem/src/i_callbacks.c b/gschem/src/i_callbacks.c
index bf68e1c..e6b0b0a 100644
--- a/gschem/src/i_callbacks.c
+++ b/gschem/src/i_callbacks.c
@@ -1680,7 +1680,7 @@ DEFINE_I_CALLBACK(page_next)
   }
 
   if (w_current->enforce_hierarchy) {
-    p_new = s_hierarchy_find_next_page(toplevel->pages, p_current, 
p_current->page_control);
+    p_new = s_hierarchy_find_next_page(toplevel->pages, p_current);
   } else {
     p_new = (PAGE *)iter->data;
   }
@@ -1716,7 +1716,7 @@ DEFINE_I_CALLBACK(page_prev)
   p_new = (PAGE *)iter->data;
 
   if (w_current->enforce_hierarchy) {
-    p_new = s_hierarchy_find_prev_page(toplevel->pages, p_current, 
p_current->page_control);
+    p_new = s_hierarchy_find_prev_page(toplevel->pages, p_current);
   } else {
     p_new = (PAGE *)iter->data;
   }
diff --git a/libgeda/include/prototype.h b/libgeda/include/prototype.h
index 66cb893..7628481 100644
--- a/libgeda/include/prototype.h
+++ b/libgeda/include/prototype.h
@@ -406,8 +406,8 @@ void s_hierarchy_down_symbol (TOPLEVEL *toplevel, const 
CLibSymbol *symbol, PAGE
 void s_hierarchy_up(TOPLEVEL *toplevel, int pid);
 GList* s_hierarchy_traversepages(TOPLEVEL *toplevel, gint flags);
 gint s_hierarchy_print_page(PAGE *p_current, void * data);
-PAGE *s_hierarchy_find_prev_page(GedaPageList *page_list, PAGE *current_page, 
int page_control);
-PAGE *s_hierarchy_find_next_page(GedaPageList *page_list, PAGE *current_page, 
int page_control);
+PAGE *s_hierarchy_find_prev_page(GedaPageList *page_list, PAGE *current_page);
+PAGE *s_hierarchy_find_next_page(GedaPageList *page_list, PAGE *current_page);
 
 /* s_log.c */
 void s_log_init (const gchar *filename);
diff --git a/libgeda/src/s_hierarchy.c b/libgeda/src/s_hierarchy.c
index 99528ec..102e08c 100644
--- a/libgeda/src/s_hierarchy.c
+++ b/libgeda/src/s_hierarchy.c
@@ -299,12 +299,22 @@ gint s_hierarchy_print_page(PAGE *p_current, void * data)
   return 0;
 }
 
-/*! \todo Finish function documentation!!!
- *  \brief
+/*! \brief Search for a page preceding a given page in hierarchy.
  *  \par Function Description
+ *  This function searches the previous sibling of page \a page in the
+ *  hierarchy. It checks all the pages preceding \a page in the list
+ *  \a page_list.
  *
- */
-PAGE *s_hierarchy_find_prev_page (GedaPageList *page_list, PAGE *current_page, 
int page_control)
+ *  It returns a pointer on the page if found, NULL otherwise.
+ *
+ *  \note
+ *  The page \a current_page must be in the list \a page_list.
+ *
+ *  \param [in] page_list    The list of pages in which to search.
+ *  \param [in] current_page The reference page for the search.
+ *  \returns A pointer on the page found or NULL if not found.
+  */
+PAGE *s_hierarchy_find_prev_page (GedaPageList *page_list, PAGE *current_page)
 {
   const GList *iter;
 
@@ -314,7 +324,7 @@ PAGE *s_hierarchy_find_prev_page (GedaPageList *page_list, 
PAGE *current_page, i
        iter = g_list_previous (iter)) {
 
     PAGE *page = (PAGE *)iter->data;
-    if (page->page_control == page_control) {
+    if (page->page_control == current_page->page_control) {
       return page;
     }
   }
@@ -322,12 +332,22 @@ PAGE *s_hierarchy_find_prev_page (GedaPageList 
*page_list, PAGE *current_page, i
   return NULL;
 }
 
-/*! \todo Finish function documentation!!!
- *  \brief
+/*! \brief Search for a page following a given page in hierarchy.
  *  \par Function Description
+ *  This function searches the next sibling of page \a page in the
+ *  hierarchy. It checks all the pages following \a page in the list
+ *  \a page_list.
  *
- */
-PAGE *s_hierarchy_find_next_page (GedaPageList *page_list, PAGE *current_page, 
int page_control)
+ *  It returns a pointer on the page if found, NULL otherwise.
+ *
+ *  \note
+ *  The page \a current_page must be in the list \a page_list.
+ *
+ *  \param [in] page_list    The list of pages in which to search.
+ *  \param [in] current_page The reference page for the search.
+ *  \returns A pointer on the page found or NULL if not found.
+  */
+PAGE *s_hierarchy_find_next_page (GedaPageList *page_list, PAGE *current_page)
 {
   const GList *iter;
 
@@ -337,7 +357,7 @@ PAGE *s_hierarchy_find_next_page (GedaPageList *page_list, 
PAGE *current_page, i
        iter = g_list_next (iter)) {
 
     PAGE *page = (PAGE *)iter->data;
-    if (page->page_control == page_control) {
+    if (page->page_control == current_page->page_control) {
       return page;
     }
   }
-- 
1.5.6




_______________________________________________
geda-dev mailing list
[email protected]
http://www.seul.org/cgi-bin/mailman/listinfo/geda-dev

Reply via email to