GList, GSList: move docs from tmpl to .c
authorRyan Lortie <desrt@desrt.ca>
Sun, 31 Jan 2010 18:07:16 +0000 (13:07 -0500)
committerRyan Lortie <desrt@desrt.ca>
Mon, 1 Feb 2010 17:39:24 +0000 (12:39 -0500)
docs/reference/glib/tmpl/.gitignore
docs/reference/glib/tmpl/linked_lists_double.sgml [deleted file]
docs/reference/glib/tmpl/linked_lists_single.sgml [deleted file]
glib/glist.c
glib/gslist.c

index 03e35ab..a642deb 100644 (file)
@@ -10,6 +10,8 @@ gurifuncs.sgml
 gvarianttype.sgml
 hash_tables.sgml
 iochannels.sgml
+linked_lists_double.sgml
+linked_lists_single.sgml
 memory_chunks.sgml
 option.sgml
 patterns.sgml
diff --git a/docs/reference/glib/tmpl/linked_lists_double.sgml b/docs/reference/glib/tmpl/linked_lists_double.sgml
deleted file mode 100644 (file)
index ce96528..0000000
+++ /dev/null
@@ -1,467 +0,0 @@
-<!-- ##### SECTION Title ##### -->
-Doubly-Linked Lists
-
-<!-- ##### SECTION Short_Description ##### -->
-linked lists containing integer values or pointers to data, with the ability
-to iterate over the list in both directions
-
-<!-- ##### SECTION Long_Description ##### -->
-<para>
-The #GList structure and its associated functions provide a standard
-doubly-linked list data structure.
-</para>
-<para>
-Each element in the list contains a piece of data, together with pointers
-which link to the previous and next elements in the list.
-Using these pointers it is possible to move through the list in both
-directions (unlike the
-<link linkend="glib-Singly-Linked-lists">Singly-Linked Lists</link>
-which only allows movement through the list in the forward direction).
-</para>
-<para>
-The data contained in each element can be either integer values, by using one
-of the
-<link linkend="glib-Type-Conversion-Macros">Type Conversion Macros</link>,
-or simply pointers to any type of data.
-</para>
-<para>
-List elements are allocated from the <link linkend="glib-Memory-Slices">slice
-allocator</link>, which is more efficient than allocating elements 
-individually.
-</para>
-<para>
-Note that most of the #GList functions expect to be passed a pointer to
-the first element in the list. The functions which insert elements return
-the new start of the list, which may have changed.
-</para>
-<para>
-There is no function to create a #GList. %NULL is considered to be the empty
-list so you simply set a #GList* to %NULL.
-</para>
-<para>
-To add elements, use g_list_append(), g_list_prepend(), g_list_insert()
-and g_list_insert_sorted().
-</para>
-<para>
-To remove elements, use g_list_remove().
-</para>
-<para>
-To find elements in the list use g_list_first(), g_list_last(), g_list_next(),
-g_list_previous(), g_list_nth(), g_list_nth_data(), g_list_find() and
-g_list_find_custom().
-</para>
-<para>
-To find the index of an element use g_list_position() and g_list_index().
-</para>
-<para>
-To call a function for each element in the list use g_list_foreach().
-</para>
-<para>
-To free the entire list, use g_list_free().
-</para>
-
-<!-- ##### SECTION See_Also ##### -->
-<para>
-
-</para>
-
-<!-- ##### SECTION Stability_Level ##### -->
-
-
-<!-- ##### STRUCT GList ##### -->
-<para>
-The #GList struct is used for each element in a doubly-linked list.
-</para>
-
-@data: holds the element's data, which can be a pointer to any kind of data, 
-  or any integer value using the
-  <link linkend="glib-Type-Conversion-Macros">Type Conversion Macros</link>.
-@next: contains the link to the next element in the list.
-@prev: contains the link to the previous element in the list.
-
-<!-- ##### FUNCTION g_list_append ##### -->
-<para>
-
-</para>
-
-@list: 
-@data: 
-@Returns: 
-
-
-<!-- ##### FUNCTION g_list_prepend ##### -->
-<para>
-
-</para>
-
-@list: 
-@data: 
-@Returns: 
-
-
-<!-- ##### FUNCTION g_list_insert ##### -->
-<para>
-
-</para>
-
-@list: 
-@data: 
-@position: 
-@Returns: 
-
-
-<!-- ##### FUNCTION g_list_insert_before ##### -->
-<para>
-
-</para>
-
-@list: 
-@sibling: 
-@data: 
-@Returns: 
-
-
-<!-- ##### FUNCTION g_list_insert_sorted ##### -->
-<para>
-
-</para>
-
-@list: 
-@data: 
-@func: 
-@Returns: 
-
-
-<!-- ##### FUNCTION g_list_remove ##### -->
-<para>
-
-</para>
-
-@list: 
-@data: 
-@Returns: 
-
-
-<!-- ##### FUNCTION g_list_remove_link ##### -->
-<para>
-
-</para>
-
-@list: 
-@llink: 
-@Returns: 
-
-
-<!-- ##### FUNCTION g_list_delete_link ##### -->
-<para>
-
-</para>
-
-@list: 
-@link_: 
-@Returns: 
-
-
-<!-- ##### FUNCTION g_list_remove_all ##### -->
-<para>
-
-</para>
-
-@list: 
-@data: 
-@Returns: 
-
-
-<!-- ##### FUNCTION g_list_free ##### -->
-<para>
-
-</para>
-
-@list: 
-
-
-<!-- ##### FUNCTION g_list_alloc ##### -->
-<para>
-Allocates space for one #GList element.
-It is called by g_list_append(), g_list_prepend(), g_list_insert() and
-g_list_insert_sorted() and so is rarely used on its own.
-</para>
-
-@Returns: a pointer to the newly-allocated #GList element.
-
-
-<!-- ##### FUNCTION g_list_free_1 ##### -->
-<para>
-
-</para>
-
-@list: 
-
-
-<!-- ##### MACRO g_list_free1 ##### -->
-<para>
-Another name for g_list_free_1().
-</para>
-
-
-
-<!-- ##### FUNCTION g_list_length ##### -->
-<para>
-
-</para>
-
-@list: 
-@Returns: 
-
-
-<!-- ##### FUNCTION g_list_copy ##### -->
-<para>
-
-</para>
-
-@list: 
-@Returns: 
-
-
-<!-- ##### FUNCTION g_list_reverse ##### -->
-<para>
-
-</para>
-
-@list: 
-@Returns: 
-
-
-<!-- ##### FUNCTION g_list_sort ##### -->
-<para>
-
-</para>
-
-@list: 
-@compare_func: 
-@Returns: 
-
-
-<!-- ##### USER_FUNCTION GCompareFunc ##### -->
-<para>
-Specifies the type of a comparison function used to compare two
-values.  The function should return a negative integer if the first
-value comes before the second, 0 if they are equal, or a positive
-integer if the first value comes after the second.
-</para>
-
-@a: a value.
-@b: a value to compare with.
-@Returns: negative value if @a &lt; @b; zero if @a = @b; positive value
-if @a > @b.
-
-
-<!-- ##### FUNCTION g_list_insert_sorted_with_data ##### -->
-<para>
-
-</para>
-
-@list: 
-@data: 
-@func: 
-@user_data: 
-@Returns: 
-
-
-<!-- ##### FUNCTION g_list_sort_with_data ##### -->
-<para>
-
-</para>
-
-@list: 
-@compare_func: 
-@user_data: 
-@Returns: 
-
-
-<!-- ##### USER_FUNCTION GCompareDataFunc ##### -->
-<para>
-Specifies the type of a comparison function used to compare two
-values.  The function should return a negative integer if the first
-value comes before the second, 0 if they are equal, or a positive
-integer if the first value comes after the second.
-</para>
-
-@a: a value.
-@b: a value to compare with.
-@user_data: user data to pass to comparison function.
-@Returns: negative value if @a &lt; @b; zero if @a = @b; positive value
-if @a > @b.
-
-
-<!-- ##### FUNCTION g_list_concat ##### -->
-<para>
-
-</para>
-
-@list1: 
-@list2: 
-@Returns: 
-
-
-<!-- ##### FUNCTION g_list_foreach ##### -->
-<para>
-
-</para>
-
-@list: 
-@func: 
-@user_data: 
-
-
-<!-- ##### USER_FUNCTION GFunc ##### -->
-<para>
-Specifies the type of functions passed to g_list_foreach() and
-g_slist_foreach().
-</para>
-
-@data: the element's data.
-@user_data: user data passed to g_list_foreach() or g_slist_foreach().
-
-
-<!-- ##### FUNCTION g_list_first ##### -->
-<para>
-
-</para>
-
-@list: 
-@Returns: 
-
-
-<!-- ##### FUNCTION g_list_last ##### -->
-<para>
-
-</para>
-
-@list: 
-@Returns: 
-
-
-<!-- ##### MACRO g_list_previous ##### -->
-<para>
-A convenience macro to get the previous element in a #GList.
-</para>
-
-@list: an element in a #GList.
-@Returns: the previous element, or %NULL if there are no previous elements.
-
-
-<!-- ##### MACRO g_list_next ##### -->
-<para>
-A convenience macro to get the next element in a #GList.
-</para>
-
-@list: an element in a #GList.
-@Returns: the next element, or %NULL if there are no more elements.
-
-
-<!-- ##### FUNCTION g_list_nth ##### -->
-<para>
-
-</para>
-
-@list: 
-@n: 
-@Returns: 
-
-
-<!-- ##### FUNCTION g_list_nth_data ##### -->
-<para>
-
-</para>
-
-@list: 
-@n: 
-@Returns: 
-
-
-<!-- ##### FUNCTION g_list_nth_prev ##### -->
-<para>
-
-</para>
-
-@list: 
-@n: 
-@Returns: 
-
-
-
-<para>
-
-</para>
-
-
-<!-- ##### FUNCTION g_list_find ##### -->
-<para>
-
-</para>
-
-@list: 
-@data: 
-@Returns: 
-
-
-<!-- ##### FUNCTION g_list_find_custom ##### -->
-<para>
-
-</para>
-
-@list: 
-@data: 
-@func: 
-@Returns: 
-
-
-<!-- ##### FUNCTION g_list_position ##### -->
-<para>
-
-</para>
-
-@list: 
-@llink: 
-@Returns: 
-
-
-<!-- ##### FUNCTION g_list_index ##### -->
-<para>
-
-</para>
-
-@list: 
-@data: 
-@Returns: 
-
-
-<!-- ##### FUNCTION g_list_push_allocator ##### -->
-<para>
-Sets the allocator to use to allocate #GList elements.
-Use g_list_pop_allocator() to restore the previous allocator.
-</para>
-<para>
-Note that this function is not available if GLib has been compiled
-with <option>--disable-mem-pools</option>
-</para>
-
-@allocator: the #GAllocator to use when allocating #GList elements.
-@Deprecated: 2.10: It does nothing, since #GList has been
-converted to the <link linkend="glib-Memory-Slices">slice allocator</link>
-
-
-<!-- ##### FUNCTION g_list_pop_allocator ##### -->
-<para>
-Restores the previous #GAllocator, used when allocating #GList elements.
-</para>
-<para>
-Note that this function is not available if GLib has been compiled
-with <option>--disable-mem-pools</option>
-</para>
-
-@Deprecated: 2.10: It does nothing, since #GList has been
-converted to the <link linkend="glib-Memory-Slices">slice allocator</link>
-
-
diff --git a/docs/reference/glib/tmpl/linked_lists_single.sgml b/docs/reference/glib/tmpl/linked_lists_single.sgml
deleted file mode 100644 (file)
index 5b59c46..0000000
+++ /dev/null
@@ -1,394 +0,0 @@
-<!-- ##### SECTION Title ##### -->
-Singly-Linked Lists
-
-<!-- ##### SECTION Short_Description ##### -->
-linked lists containing integer values or pointers to data, limited to
-iterating over the list in one direction
-
-<!-- ##### SECTION Long_Description ##### -->
-<para>
-The #GSList structure and its associated functions provide a standard
-singly-linked list data structure.
-</para>
-<para>
-Each element in the list contains a piece of data, together with a pointer
-which links to the next element in the list.
-Using this pointer it is possible to move through the list in one
-direction only (unlike the
-<link linkend="glib-Doubly-Linked-lists">Doubly-Linked Lists</link>
-which allow movement in both directions).
-</para>
-<para>
-The data contained in each element can be either integer values, by using one
-of the
-<link linkend="glib-Type-Conversion-Macros">Type Conversion Macros</link>,
-or simply pointers to any type of data.
-</para>
-<para>
-List elements are allocated from the <link linkend="glib-Memory-Slices">slice
-allocator</link>, which is more efficient than allocating elements 
-individually.
-</para>
-<para>
-Note that most of the #GSList functions expect to be passed a pointer to
-the first element in the list. The functions which insert elements return
-the new start of the list, which may have changed.
-</para>
-<para>
-There is no function to create a #GSList. %NULL is considered to be the empty
-list so you simply set a #GSList* to %NULL.
-</para>
-<para>
-To add elements, use g_slist_append(), g_slist_prepend(), g_slist_insert()
-and g_slist_insert_sorted().
-</para>
-<para>
-To remove elements, use g_slist_remove().
-</para>
-<para>
-To find elements in the list use g_slist_last(), g_slist_next(),
-g_slist_nth(), g_slist_nth_data(), g_slist_find() and
-g_slist_find_custom().
-</para>
-<para>
-To find the index of an element use g_slist_position() and g_slist_index().
-</para>
-<para>
-To call a function for each element in the list use g_slist_foreach().
-</para>
-<para>
-To free the entire list, use g_slist_free().
-</para>
-
-<!-- ##### SECTION See_Also ##### -->
-<para>
-
-</para>
-
-<!-- ##### SECTION Stability_Level ##### -->
-
-
-<!-- ##### STRUCT GSList ##### -->
-<para>
-The #GSList struct is used for each element in the singly-linked list.
-</para>
-
-@data: holds the element's data, which can be a pointer to any kind of data, 
-  or any integer value using the 
-  <link linkend="glib-Type-Conversion-Macros">Type Conversion Macros</link>.
-@next: contains the link to the next element in the list.
-
-<!-- ##### FUNCTION g_slist_alloc ##### -->
-<para>
-Allocates space for one #GSList element.
-It is called by the g_slist_append(), g_slist_prepend(), g_slist_insert() and
-g_slist_insert_sorted() functions and so is rarely used on its own.
-</para>
-
-@Returns: a pointer to the newly-allocated #GSList element.
-
-
-<!-- ##### FUNCTION g_slist_append ##### -->
-<para>
-
-</para>
-
-@list: 
-@data: 
-@Returns: 
-
-
-<!-- ##### FUNCTION g_slist_prepend ##### -->
-<para>
-
-</para>
-
-@list: 
-@data: 
-@Returns: 
-
-
-<!-- ##### FUNCTION g_slist_insert ##### -->
-<para>
-
-</para>
-
-@list: 
-@data: 
-@position: 
-@Returns: 
-
-
-<!-- ##### FUNCTION g_slist_insert_before ##### -->
-<para>
-
-</para>
-
-@slist: 
-@sibling: 
-@data: 
-@Returns: 
-
-
-<!-- ##### FUNCTION g_slist_insert_sorted ##### -->
-<para>
-
-</para>
-
-@list: 
-@data: 
-@func: 
-@Returns: 
-
-
-<!-- ##### FUNCTION g_slist_remove ##### -->
-<para>
-
-</para>
-
-@list: 
-@data: 
-@Returns: 
-
-
-<!-- ##### FUNCTION g_slist_remove_link ##### -->
-<para>
-
-</para>
-
-@list: 
-@link_: 
-@Returns: 
-
-
-<!-- ##### FUNCTION g_slist_delete_link ##### -->
-<para>
-
-</para>
-
-@list: 
-@link_: 
-@Returns: 
-
-
-<!-- ##### FUNCTION g_slist_remove_all ##### -->
-<para>
-
-</para>
-
-@list: 
-@data: 
-@Returns: 
-
-
-<!-- ##### FUNCTION g_slist_free ##### -->
-<para>
-
-</para>
-
-@list: 
-
-
-<!-- ##### FUNCTION g_slist_free_1 ##### -->
-<para>
-
-</para>
-
-@list: 
-
-
-<!-- ##### MACRO g_slist_free1 ##### -->
-<para>
-A macro which does the same as g_slist_free_1().
-</para>
-
-@Since: 2.10
-
-
-<!-- ##### FUNCTION g_slist_length ##### -->
-<para>
-
-</para>
-
-@list: 
-@Returns: 
-
-
-<!-- ##### FUNCTION g_slist_copy ##### -->
-<para>
-
-</para>
-
-@list: 
-@Returns: 
-
-
-<!-- ##### FUNCTION g_slist_reverse ##### -->
-<para>
-
-</para>
-
-@list: 
-@Returns: 
-
-
-<!-- ##### FUNCTION g_slist_insert_sorted_with_data ##### -->
-<para>
-
-</para>
-
-@list: 
-@data: 
-@func: 
-@user_data: 
-@Returns: 
-
-
-<!-- ##### FUNCTION g_slist_sort ##### -->
-<para>
-
-</para>
-
-@list: 
-@compare_func: 
-@Returns: 
-
-
-<!-- ##### FUNCTION g_slist_sort_with_data ##### -->
-<para>
-
-</para>
-
-@list: 
-@compare_func: 
-@user_data: 
-@Returns: 
-
-
-<!-- ##### FUNCTION g_slist_concat ##### -->
-<para>
-
-</para>
-
-@list1: 
-@list2: 
-@Returns: 
-
-
-<!-- ##### FUNCTION g_slist_foreach ##### -->
-<para>
-
-</para>
-
-@list: 
-@func: 
-@user_data: 
-
-
-<!-- ##### FUNCTION g_slist_last ##### -->
-<para>
-
-</para>
-
-@list: 
-@Returns: 
-
-
-<!-- ##### MACRO g_slist_next ##### -->
-<para>
-A convenience macro to get the next element in a #GSList.
-</para>
-
-@slist: an element in a #GSList.
-@Returns: the next element, or %NULL if there are no more elements.
-
-
-<!-- ##### FUNCTION g_slist_nth ##### -->
-<para>
-
-</para>
-
-@list: 
-@n: 
-@Returns: 
-
-
-<!-- ##### FUNCTION g_slist_nth_data ##### -->
-<para>
-
-</para>
-
-@list: 
-@n: 
-@Returns: 
-
-
-<!-- ##### FUNCTION g_slist_find ##### -->
-<para>
-
-</para>
-
-@list: 
-@data: 
-@Returns: 
-
-
-<!-- ##### FUNCTION g_slist_find_custom ##### -->
-<para>
-
-</para>
-
-@list: 
-@data: 
-@func: 
-@Returns: 
-
-
-<!-- ##### FUNCTION g_slist_position ##### -->
-<para>
-
-</para>
-
-@list: 
-@llink: 
-@Returns: 
-
-
-<!-- ##### FUNCTION g_slist_index ##### -->
-<para>
-
-</para>
-
-@list: 
-@data: 
-@Returns: 
-
-
-<!-- ##### FUNCTION g_slist_push_allocator ##### -->
-<para>
-Sets the allocator to use to allocate #GSList elements.
-Use g_slist_pop_allocator() to restore the previous allocator.
-</para>
-<para>
-Note that this function is not available if GLib has been compiled
-with <option>--disable-mem-pools</option>
-</para>
-
-@dummy: the #GAllocator to use when allocating #GSList elements.
-@Deprecated: 2.10: It does nothing, since #GSList has been
-converted to the <link linkend="glib-Memory-Slices">slice allocator</link>
-
-
-<!-- ##### FUNCTION g_slist_pop_allocator ##### -->
-<para>
-Restores the previous #GAllocator, used when allocating #GSList elements.
-</para>
-<para>
-Note that this function is not available if GLib has been compiled
-with <option>--disable-mem-pools</option>
-</para>
-
-@Deprecated: 2.10: It does nothing, since #GSList has been
-converted to the <link linkend="glib-Memory-Slices">slice allocator</link>
-
-
index b607abd..252330a 100644 (file)
 #include "glib.h"
 #include "galias.h"
 
+/**
+ * SECTION: linked_lists_double
+ * @title: Doubly-Linked Lists
+ * @short_description: linked lists containing integer values or
+ *                     pointers to data, with the ability to iterate
+ *                     over the list in both directions
+ *
+ * The #GList structure and its associated functions provide a standard
+ * doubly-linked list data structure.
+ *
+ * Each element in the list contains a piece of data, together with
+ * pointers which link to the previous and next elements in the list.
+ * Using these pointers it is possible to move through the list in both
+ * directions (unlike the <link
+ * linkend="glib-Singly-Linked-lists">Singly-Linked Lists</link> which
+ * only allows movement through the list in the forward direction).
+ *
+ * The data contained in each element can be either integer values, by
+ * using one of the <link linkend="glib-Type-Conversion-Macros">Type
+ * Conversion Macros</link>, or simply pointers to any type of data.
+ *
+ * List elements are allocated from the <link
+ * linkend="glib-Memory-Slices">slice allocator</link>, which is more
+ * efficient than allocating elements individually.
+ *
+ * Note that most of the #GList functions expect to be passed a pointer
+ * to the first element in the list. The functions which insert
+ * elements return the new start of the list, which may have changed.
+ *
+ * There is no function to create a #GList. %NULL is considered to be
+ * the empty list so you simply set a #GList* to %NULL.
+ *
+ * To add elements, use g_list_append(), g_list_prepend(),
+ * g_list_insert() and g_list_insert_sorted().
+ *
+ * To remove elements, use g_list_remove().
+ *
+ * To find elements in the list use g_list_first(), g_list_last(),
+ * g_list_next(), g_list_previous(), g_list_nth(), g_list_nth_data(),
+ * g_list_find() and g_list_find_custom().
+ *
+ * To find the index of an element use g_list_position() and
+ * g_list_index().
+ *
+ * To call a function for each element in the list use g_list_foreach().
+ *
+ * To free the entire list, use g_list_free().
+ **/
+
+/**
+ * GList:
+ * @data: holds the element's data, which can be a pointer to any kind
+ *        of data, or any integer value using the <link
+ *        linkend="glib-Type-Conversion-Macros">Type Conversion
+ *        Macros</link>.
+ * @next: contains the link to the next element in the list.
+ * @prev: contains the link to the previous element in the list.
+ *
+ * The #GList struct is used for each element in a doubly-linked list.
+ **/
 
+/**
+ * g_list_previous:
+ * @list: an element in a #GList.
+ * @Returns: the previous element, or %NULL if there are no previous
+ *           elements.
+ *
+ * A convenience macro to get the previous element in a #GList.
+ **/
+
+/**
+ * g_list_next:
+ * @list: an element in a #GList.
+ * @Returns: the next element, or %NULL if there are no more elements.
+ *
+ * A convenience macro to get the next element in a #GList.
+ **/
+
+
+
+/**
+ * g_list_push_allocator:
+ * @allocator: the #GAllocator to use when allocating #GList elements.
+ *
+ * Sets the allocator to use to allocate #GList elements. Use
+ * g_list_pop_allocator() to restore the previous allocator.
+ *
+ * Note that this function is not available if GLib has been compiled
+ * with <option>--disable-mem-pools</option>
+ *
+ * Deprecated:2.10: It does nothing, since #GList has been converted
+ *                  to the <link linkend="glib-Memory-Slices">slice
+ *                  allocator</link>
+ **/
 void g_list_push_allocator (gpointer dummy) { /* present for binary compat only */ }
+
+/**
+ * g_list_pop_allocator:
+ *
+ * Restores the previous #GAllocator, used when allocating #GList
+ * elements.
+ *
+ * Note that this function is not available if GLib has been compiled
+ * with <option>--disable-mem-pools</option>
+ *
+ * Deprecated:2.10: It does nothing, since #GList has been converted
+ *                  to the <link linkend="glib-Memory-Slices">slice
+ *                  allocator</link>
+ **/
 void g_list_pop_allocator  (void)           { /* present for binary compat only */ }
 
 #define _g_list_alloc()         g_slice_new (GList)
 #define _g_list_alloc0()        g_slice_new0 (GList)
 #define _g_list_free1(list)     g_slice_free (GList, list)
 
+/**
+ * g_list_alloc:
+ * @Returns: a pointer to the newly-allocated #GList element.
+ *
+ * Allocates space for one #GList element. It is called by
+ * g_list_append(), g_list_prepend(), g_list_insert() and
+ * g_list_insert_sorted() and so is rarely used on its own.
+ **/
 GList*
 g_list_alloc (void)
 {
@@ -72,6 +187,11 @@ g_list_free (GList *list)
  * Frees one #GList element.
  * It is usually used after g_list_remove_link().
  */
+/**
+ * g_list_free1:
+ *
+ * Another name for g_list_free_1().
+ **/
 void
 g_list_free_1 (GList *list)
 {
@@ -778,6 +898,15 @@ g_list_length (GList *list)
  *
  * Calls a function for each element of a #GList.
  */
+/**
+ * GFunc:
+ * @data: the element's data.
+ * @user_data: user data passed to g_list_foreach() or
+ *             g_slist_foreach().
+ *
+ * Specifies the type of functions passed to g_list_foreach() and
+ * g_slist_foreach().
+ **/
 void
 g_list_foreach (GList   *list,
                GFunc     func,
@@ -968,6 +1097,18 @@ g_list_sort_real (GList    *list,
  *
  * Returns: the start of the sorted #GList
  */
+/**
+ * GCompareFunc:
+ * @a: a value.
+ * @b: a value to compare with.
+ * @Returns: negative value if @a &lt; @b; zero if @a = @b; positive
+ *           value if @a > @b.
+ *
+ * Specifies the type of a comparison function used to compare two
+ * values.  The function should return a negative integer if the first
+ * value comes before the second, 0 if they are equal, or a positive
+ * integer if the first value comes after the second.
+ **/
 GList *
 g_list_sort (GList        *list,
             GCompareFunc  compare_func)
@@ -987,6 +1128,19 @@ g_list_sort (GList        *list,
  *
  * Returns: the new head of @list
  */
+/**
+ * GCompareDataFunc:
+ * @a: a value.
+ * @b: a value to compare with.
+ * @user_data: user data to pass to comparison function.
+ * @Returns: negative value if @a &lt; @b; zero if @a = @b; positive
+ *           value if @a > @b.
+ *
+ * Specifies the type of a comparison function used to compare two
+ * values.  The function should return a negative integer if the first
+ * value comes before the second, 0 if they are equal, or a positive
+ * integer if the first value comes after the second.
+ **/
 GList *
 g_list_sort_with_data (GList            *list,
                       GCompareDataFunc  compare_func,
index 47c5041..5dcbc7f 100644 (file)
 #include "glib.h"
 #include "galias.h"
 
+/**
+ * SECTION: linked_lists_single
+ * @title: Singly-Linked Lists
+ * @short_description: linked lists containing integer values or
+ *                     pointers to data, limited to iterating over the
+ *                     list in one direction
+ *
+ * The #GSList structure and its associated functions provide a
+ * standard singly-linked list data structure.
+ *
+ * Each element in the list contains a piece of data, together with a
+ * pointer which links to the next element in the list. Using this
+ * pointer it is possible to move through the list in one direction
+ * only (unlike the <link
+ * linkend="glib-Doubly-Linked-lists">Doubly-Linked Lists</link> which
+ * allow movement in both directions).
+ *
+ * The data contained in each element can be either integer values, by
+ * using one of the <link linkend="glib-Type-Conversion-Macros">Type
+ * Conversion Macros</link>, or simply pointers to any type of data.
+ *
+ * List elements are allocated from the <link
+ * linkend="glib-Memory-Slices">slice allocator</link>, which is more
+ * efficient than allocating elements individually.
+ *
+ * Note that most of the #GSList functions expect to be passed a
+ * pointer to the first element in the list. The functions which insert
+ * elements return the new start of the list, which may have changed.
+ *
+ * There is no function to create a #GSList. %NULL is considered to be
+ * the empty list so you simply set a #GSList* to %NULL.
+ *
+ * To add elements, use g_slist_append(), g_slist_prepend(),
+ * g_slist_insert() and g_slist_insert_sorted().
+ *
+ * To remove elements, use g_slist_remove().
+ *
+ * To find elements in the list use g_slist_last(), g_slist_next(),
+ * g_slist_nth(), g_slist_nth_data(), g_slist_find() and
+ * g_slist_find_custom().
+ *
+ * To find the index of an element use g_slist_position() and
+ * g_slist_index().
+ *
+ * To call a function for each element in the list use
+ * g_slist_foreach().
+ *
+ * To free the entire list, use g_slist_free().
+ **/
 
+/**
+ * GSList:
+ * @data: holds the element's data, which can be a pointer to any kind
+ *        of data, or any integer value using the <link
+ *        linkend="glib-Type-Conversion-Macros">Type Conversion
+ *        Macros</link>.
+ * @next: contains the link to the next element in the list.
+ *
+ * The #GSList struct is used for each element in the singly-linked
+ * list.
+ **/
+
+/**
+ * g_slist_next:
+ * @slist: an element in a #GSList.
+ * @Returns: the next element, or %NULL if there are no more elements.
+ *
+ * A convenience macro to get the next element in a #GSList.
+ **/
+
+
+/**
+ * g_slist_push_allocator:
+ * @dummy: the #GAllocator to use when allocating #GSList elements.
+ *
+ * Sets the allocator to use to allocate #GSList elements. Use
+ * g_slist_pop_allocator() to restore the previous allocator.
+ *
+ * Note that this function is not available if GLib has been compiled
+ * with <option>--disable-mem-pools</option>
+ *
+ * Deprecated: 2.10: It does nothing, since #GSList has been converted
+ *                   to the <link linkend="glib-Memory-Slices">slice
+ *                   allocator</link>
+ **/
 void g_slist_push_allocator (gpointer dummy) { /* present for binary compat only */ }
+
+/**
+ * g_slist_pop_allocator:
+ *
+ * Restores the previous #GAllocator, used when allocating #GSList
+ * elements.
+ *
+ * Note that this function is not available if GLib has been compiled
+ * with <option>--disable-mem-pools</option>
+ *
+ * Deprecated: 2.10: It does nothing, since #GSList has been converted
+ *                   to the <link linkend="glib-Memory-Slices">slice
+ *                   allocator</link>
+ **/
 void g_slist_pop_allocator  (void)           { /* present for binary compat only */ }
 
 #define _g_slist_alloc0()       g_slice_new0 (GSList)
 #define _g_slist_alloc()        g_slice_new (GSList)
 #define _g_slist_free1(slist)   g_slice_free (GSList, slist)
 
+/**
+ * g_slist_alloc:
+ * @Returns: a pointer to the newly-allocated #GSList element.
+ *
+ * Allocates space for one #GSList element. It is called by the
+ * g_slist_append(), g_slist_prepend(), g_slist_insert() and
+ * g_slist_insert_sorted() functions and so is rarely used on its own.
+ **/
 GSList*
 g_slist_alloc (void)
 {
@@ -67,6 +173,13 @@ g_slist_free (GSList *list)
  * Frees one #GSList element.
  * It is usually used after g_slist_remove_link().
  */
+/**
+ * g_slist_free1:
+ *
+ * A macro which does the same as g_slist_free_1().
+ *
+ * Since: 2.10
+ **/
 void
 g_slist_free_1 (GSList *list)
 {