1/* GLIB - Library of useful routines for C programming 2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU 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. 8 * 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. 13 * 14 * You should have received a copy of the GNU 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. 18 */ 19 20/* 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/. 25 */ 26 27/* 28 * Modified by Bruno Haible for use as a gnulib module. 29 */ 30 31#ifndef __G_LIST_H__ 32#define __G_LIST_H__ 33 34#if 0 35#include <glib/gmem.h> 36#endif 37 38G_BEGIN_DECLS 39 40typedef struct _GList GList; 41 42struct _GList 43{ 44 gpointer data; 45 GList *next; 46 GList *prev; 47}; 48 49/* Doubly linked lists 50 */ 51#if 0 52GList* g_list_alloc (void) G_GNUC_WARN_UNUSED_RESULT; 53#endif 54void g_list_free (GList *list); 55#if 0 56void g_list_free_1 (GList *list); 57#define g_list_free1 g_list_free_1 58#endif 59GList* g_list_append (GList *list, 60 gpointer data) G_GNUC_WARN_UNUSED_RESULT; 61GList* g_list_prepend (GList *list, 62 gpointer data) G_GNUC_WARN_UNUSED_RESULT; 63#if 0 64GList* g_list_insert (GList *list, 65 gpointer data, 66 gint position) G_GNUC_WARN_UNUSED_RESULT; 67GList* g_list_insert_sorted (GList *list, 68 gpointer data, 69 GCompareFunc func) G_GNUC_WARN_UNUSED_RESULT; 70GList* g_list_insert_sorted_with_data (GList *list, 71 gpointer data, 72 GCompareDataFunc func, 73 gpointer user_data) G_GNUC_WARN_UNUSED_RESULT; 74GList* g_list_insert_before (GList *list, 75 GList *sibling, 76 gpointer data) G_GNUC_WARN_UNUSED_RESULT; 77GList* g_list_concat (GList *list1, 78 GList *list2) G_GNUC_WARN_UNUSED_RESULT; 79GList* g_list_remove (GList *list, 80 gconstpointer data) G_GNUC_WARN_UNUSED_RESULT; 81GList* g_list_remove_all (GList *list, 82 gconstpointer data) G_GNUC_WARN_UNUSED_RESULT; 83GList* g_list_remove_link (GList *list, 84 GList *llink) G_GNUC_WARN_UNUSED_RESULT; 85#endif 86GList* g_list_delete_link (GList *list, 87 GList *link_) G_GNUC_WARN_UNUSED_RESULT; 88#if 0 89GList* g_list_reverse (GList *list) G_GNUC_WARN_UNUSED_RESULT; 90GList* g_list_copy (GList *list) G_GNUC_WARN_UNUSED_RESULT; 91GList* g_list_nth (GList *list, 92 guint n); 93GList* g_list_nth_prev (GList *list, 94 guint n); 95GList* g_list_find (GList *list, 96 gconstpointer data); 97GList* g_list_find_custom (GList *list, 98 gconstpointer data, 99 GCompareFunc func); 100gint g_list_position (GList *list, 101 GList *llink); 102gint g_list_index (GList *list, 103 gconstpointer data); 104#endif 105GList* g_list_last (GList *list); 106#if 0 107GList* g_list_first (GList *list); 108guint g_list_length (GList *list); 109void g_list_foreach (GList *list, 110 GFunc func, 111 gpointer user_data); 112GList* g_list_sort (GList *list, 113 GCompareFunc compare_func) G_GNUC_WARN_UNUSED_RESULT; 114GList* g_list_sort_with_data (GList *list, 115 GCompareDataFunc compare_func, 116 gpointer user_data) G_GNUC_WARN_UNUSED_RESULT; 117gpointer g_list_nth_data (GList *list, 118 guint n); 119 120 121#define g_list_previous(list) ((list) ? (((GList *)(list))->prev) : NULL) 122#endif 123#define g_list_next(list) ((list) ? (((GList *)(list))->next) : NULL) 124#if 0 125 126#ifndef G_DISABLE_DEPRECATED 127void g_list_push_allocator (gpointer allocator); 128void g_list_pop_allocator (void); 129#endif 130 131#endif 132 133G_END_DECLS 134 135#endif /* __G_LIST_H__ */ 136 137