Navit SVN

/work/compile/navit/src/navit/support/glib/glist.h

00001 /* GLIB - Library of useful routines for C programming
00002  * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Lesser General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2 of the License, or (at your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Lesser General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Lesser General Public
00015  * License along with this library; if not, write to the
00016  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00017  * Boston, MA 02111-1307, USA.
00018  */
00019 
00020 /*
00021  * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
00022  * file for a list of people on the GLib Team.  See the ChangeLog
00023  * files for a list of changes.  These files are distributed with
00024  * GLib at ftp://ftp.gtk.org/pub/gtk/.
00025  */
00026 
00027 #if defined(G_DISABLE_SINGLE_INCLUDES) && !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
00028 #error "Only <glib.h> can be included directly."
00029 #endif
00030 
00031 #ifndef __G_LIST_H__
00032 #define __G_LIST_H__
00033 
00034 #include <glib/gmem.h>
00035 
00036 G_BEGIN_DECLS
00037 
00038 typedef struct _GList GList;
00039 
00040 struct _GList
00041 {
00042   gpointer data;
00043   GList *next;
00044   GList *prev;
00045 };
00046 
00047 /* Doubly linked lists
00048  */
00049 GList*   g_list_alloc                   (void) G_GNUC_WARN_UNUSED_RESULT;
00050 void     g_list_free                    (GList            *list);
00051 void     g_list_free_1                  (GList            *list);
00052 #define  g_list_free1                   g_list_free_1
00053 GList*   g_list_append                  (GList            *list,
00054                                          gpointer          data) G_GNUC_WARN_UNUSED_RESULT;
00055 GList*   g_list_prepend                 (GList            *list,
00056                                          gpointer          data) G_GNUC_WARN_UNUSED_RESULT;
00057 GList*   g_list_insert                  (GList            *list,
00058                                          gpointer          data,
00059                                          gint              position) G_GNUC_WARN_UNUSED_RESULT;
00060 GList*   g_list_insert_sorted           (GList            *list,
00061                                          gpointer          data,
00062                                          GCompareFunc      func) G_GNUC_WARN_UNUSED_RESULT;
00063 GList*   g_list_insert_sorted_with_data (GList            *list,
00064                                          gpointer          data,
00065                                          GCompareDataFunc  func,
00066                                          gpointer          user_data) G_GNUC_WARN_UNUSED_RESULT;
00067 GList*   g_list_insert_before           (GList            *list,
00068                                          GList            *sibling,
00069                                          gpointer          data) G_GNUC_WARN_UNUSED_RESULT;
00070 GList*   g_list_concat                  (GList            *list1,
00071                                          GList            *list2) G_GNUC_WARN_UNUSED_RESULT;
00072 GList*   g_list_remove                  (GList            *list,
00073                                          gconstpointer     data) G_GNUC_WARN_UNUSED_RESULT;
00074 GList*   g_list_remove_all              (GList            *list,
00075                                          gconstpointer     data) G_GNUC_WARN_UNUSED_RESULT;
00076 GList*   g_list_remove_link             (GList            *list,
00077                                          GList            *llink) G_GNUC_WARN_UNUSED_RESULT;
00078 GList*   g_list_delete_link             (GList            *list,
00079                                          GList            *link_) G_GNUC_WARN_UNUSED_RESULT;
00080 GList*   g_list_reverse                 (GList            *list) G_GNUC_WARN_UNUSED_RESULT;
00081 GList*   g_list_copy                    (GList            *list) G_GNUC_WARN_UNUSED_RESULT;
00082 GList*   g_list_nth                     (GList            *list,
00083                                          guint             n);
00084 GList*   g_list_nth_prev                (GList            *list,
00085                                          guint             n);
00086 GList*   g_list_find                    (GList            *list,
00087                                          gconstpointer     data);
00088 GList*   g_list_find_custom             (GList            *list,
00089                                          gconstpointer     data,
00090                                          GCompareFunc      func);
00091 gint     g_list_position                (GList            *list,
00092                                          GList            *llink);
00093 gint     g_list_index                   (GList            *list,
00094                                          gconstpointer     data);
00095 GList*   g_list_last                    (GList            *list);
00096 GList*   g_list_first                   (GList            *list);
00097 guint    g_list_length                  (GList            *list);
00098 void     g_list_foreach                 (GList            *list,
00099                                          GFunc             func,
00100                                          gpointer          user_data);
00101 GList*   g_list_sort                    (GList            *list,
00102                                          GCompareFunc      compare_func) G_GNUC_WARN_UNUSED_RESULT;
00103 GList*   g_list_sort_with_data          (GList            *list,
00104                                          GCompareDataFunc  compare_func,
00105                                          gpointer          user_data)  G_GNUC_WARN_UNUSED_RESULT;
00106 gpointer g_list_nth_data                (GList            *list,
00107                                          guint             n);
00108 
00109 
00110 #define g_list_previous(list)           ((list) ? (((GList *)(list))->prev) : NULL)
00111 #define g_list_next(list)               ((list) ? (((GList *)(list))->next) : NULL)
00112 
00113 #ifndef G_DISABLE_DEPRECATED
00114 void     g_list_push_allocator          (gpointer          allocator);
00115 void     g_list_pop_allocator           (void);
00116 #endif
00117 
00118 G_END_DECLS
00119 
00120 #endif /* __G_LIST_H__ */