Version 11, interface, binary age 0.
[glib.git] / glib / glist.h
blobe434d6951c16d9e03276a5bfdedb2bec668afe72
1 /* GLIB - Library of useful routines for C programming
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
21 * Modified by the GLib Team and others 1997-2000. See the AUTHORS
22 * file for a list of people on the GLib Team. See the ChangeLog
23 * files for a list of changes. These files are distributed with
24 * GLib at ftp://ftp.gtk.org/pub/gtk/.
27 #ifndef __G_LIST_H__
28 #define __G_LIST_H__
30 #include <glib/gmem.h>
32 G_BEGIN_DECLS
34 typedef struct _GList GList;
36 struct _GList
38 gpointer data;
39 GList *next;
40 GList *prev;
43 /* Doubly linked lists
45 void g_list_push_allocator (GAllocator *allocator);
46 void g_list_pop_allocator (void);
47 GList* g_list_alloc (void);
48 void g_list_free (GList *list);
49 void g_list_free_1 (GList *list);
50 GList* g_list_append (GList *list,
51 gpointer data);
52 GList* g_list_prepend (GList *list,
53 gpointer data);
54 GList* g_list_insert (GList *list,
55 gpointer data,
56 gint position);
57 GList* g_list_insert_sorted (GList *list,
58 gpointer data,
59 GCompareFunc func);
60 GList* g_list_insert_before (GList *list,
61 GList *sibling,
62 gpointer data);
63 GList* g_list_concat (GList *list1,
64 GList *list2);
65 GList* g_list_remove (GList *list,
66 gconstpointer data);
67 GList* g_list_remove_all (GList *list,
68 gconstpointer data);
69 GList* g_list_remove_link (GList *list,
70 GList *llink);
71 GList* g_list_delete_link (GList *list,
72 GList *link);
73 GList* g_list_reverse (GList *list);
74 GList* g_list_copy (GList *list);
75 GList* g_list_nth (GList *list,
76 guint n);
77 GList* g_list_nth_prev (GList *list,
78 guint n);
79 GList* g_list_find (GList *list,
80 gconstpointer data);
81 GList* g_list_find_custom (GList *list,
82 gconstpointer data,
83 GCompareFunc func);
84 gint g_list_position (GList *list,
85 GList *llink);
86 gint g_list_index (GList *list,
87 gconstpointer data);
88 GList* g_list_last (GList *list);
89 GList* g_list_first (GList *list);
90 guint g_list_length (GList *list);
91 void g_list_foreach (GList *list,
92 GFunc func,
93 gpointer user_data);
94 GList* g_list_sort (GList *list,
95 GCompareFunc compare_func);
96 GList* g_list_sort_with_data (GList *list,
97 GCompareDataFunc compare_func,
98 gpointer user_data);
99 gpointer g_list_nth_data (GList *list,
100 guint n);
102 #define g_list_previous(list) ((list) ? (((GList *)(list))->prev) : NULL)
103 #define g_list_next(list) ((list) ? (((GList *)(list))->next) : NULL)
105 G_END_DECLS
107 #endif /* __G_LIST_H__ */