1 /* GLIB - Library of useful routines for C programming
2 * Copyright (C) 2006-2019 Free Software Foundation, Inc.
3 *
4 * This file is not part of the GNU gettext program, but is used with
5 * GNU gettext.
6 *
7 * The original copyright notice is as follows:
8 */
9
10 /* GLIB - Library of useful routines for C programming
11 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
12 *
13 * This library is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU Lesser General Public
15 * License as published by the Free Software Foundation; either
16 * version 2 of the License, or (at your option) any later version.
17 *
18 * This library is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * Lesser General Public License for more details.
22 *
23 * You should have received a copy of the GNU Lesser General Public
24 * License along with this library; if not, write to the
25 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
26 * Boston, MA 02111-1307, USA.
27 */
28
29 /*
30 * Modified by the GLib Team and others 1997-2000. See the AUTHORS
31 * file for a list of people on the GLib Team. See the ChangeLog
32 * files for a list of changes. These files are distributed with
33 * GLib at ftp://ftp.gtk.org/pub/gtk/.
34 */
35
36 /*
37 * Modified by Bruno Haible for use as a gnulib module.
38 */
39
40 #ifndef __G_LIST_H__
41 #define __G_LIST_H__
42
43 #if 0
44 #include <glib/gmem.h>
45 #endif
46
47 G_BEGIN_DECLS
48
49 typedef struct _GList GList;
50
51 struct _GList
52 {
53 gpointer data;
54 GList *next;
55 GList *prev;
56 };
57
58 /* Doubly linked lists
59 */
60 #if 0
61 GList* g_list_alloc (void) G_GNUC_WARN_UNUSED_RESULT;
62 #endif
63 void g_list_free (GList *list);
64 #if 0
65 void g_list_free_1 (GList *list);
66 #define g_list_free1 g_list_free_1
67 #endif
68 GList* g_list_append (GList *list,
69 gpointer data) G_GNUC_WARN_UNUSED_RESULT;
70 GList* g_list_prepend (GList *list,
71 gpointer data) G_GNUC_WARN_UNUSED_RESULT;
72 #if 0
73 GList* g_list_insert (GList *list,
74 gpointer data,
75 gint position) G_GNUC_WARN_UNUSED_RESULT;
76 GList* g_list_insert_sorted (GList *list,
77 gpointer data,
78 GCompareFunc func) G_GNUC_WARN_UNUSED_RESULT;
79 GList* g_list_insert_sorted_with_data (GList *list,
80 gpointer data,
81 GCompareDataFunc func,
82 gpointer user_data) G_GNUC_WARN_UNUSED_RESULT;
83 GList* g_list_insert_before (GList *list,
84 GList *sibling,
85 gpointer data) G_GNUC_WARN_UNUSED_RESULT;
86 GList* g_list_concat (GList *list1,
87 GList *list2) G_GNUC_WARN_UNUSED_RESULT;
88 GList* g_list_remove (GList *list,
89 gconstpointer data) G_GNUC_WARN_UNUSED_RESULT;
90 GList* g_list_remove_all (GList *list,
91 gconstpointer data) G_GNUC_WARN_UNUSED_RESULT;
92 GList* g_list_remove_link (GList *list,
93 GList *llink) G_GNUC_WARN_UNUSED_RESULT;
94 #endif
95 GList* g_list_delete_link (GList *list,
96 GList *link_) G_GNUC_WARN_UNUSED_RESULT;
97 #if 0
98 GList* g_list_reverse (GList *list) G_GNUC_WARN_UNUSED_RESULT;
99 GList* g_list_copy (GList *list) G_GNUC_WARN_UNUSED_RESULT;
100 GList* g_list_nth (GList *list,
101 guint n);
102 GList* g_list_nth_prev (GList *list,
103 guint n);
104 GList* g_list_find (GList *list,
105 gconstpointer data);
106 GList* g_list_find_custom (GList *list,
107 gconstpointer data,
108 GCompareFunc func);
109 gint g_list_position (GList *list,
110 GList *llink);
111 gint g_list_index (GList *list,
112 gconstpointer data);
113 #endif
114 GList* g_list_last (GList *list);
115 #if 0
116 GList* g_list_first (GList *list);
117 guint g_list_length (GList *list);
118 void g_list_foreach (GList *list,
119 GFunc func,
120 gpointer user_data);
121 GList* g_list_sort (GList *list,
122 GCompareFunc compare_func) G_GNUC_WARN_UNUSED_RESULT;
123 GList* g_list_sort_with_data (GList *list,
124 GCompareDataFunc compare_func,
125 gpointer user_data) G_GNUC_WARN_UNUSED_RESULT;
126 gpointer g_list_nth_data (GList *list,
127 guint n);
128
129
130 #define g_list_previous(list) ((list) ? (((GList *)(list))->prev) : NULL)
131 #endif
132 #define g_list_next(list) ((list) ? (((GList *)(list))->next) : NULL)
133 #if 0
134
135 #ifndef G_DISABLE_DEPRECATED
136 void g_list_push_allocator (gpointer allocator);
137 void g_list_pop_allocator (void);
138 #endif
139
140 #endif
141
142 G_END_DECLS
143
144 #endif /* __G_LIST_H__ */
145