Add missing libraries to examples' Makefiles
[dockapps.git] / yawmppp / src / list.h
blobbe101ef2c334a7800754fe2f6888e2b93e3ab3b1
1 /* Generic single linked list to keep various information
2 Copyright (C) 1993, 1994 Free Software Foundation, Inc.
4 Author: Kresten Krab Thorup
6 This file is part of GNU CC.
8 GNU CC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
13 GNU CC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GNU CC; see the file COPYING. If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */
23 /* As a special exception, if you link this library with files compiled with
24 GCC to produce an executable, this does not cause the resulting executable
25 to be covered by the GNU General Public License. This exception does not
26 however invalidate any other reasons why the executable file might be
27 covered by the GNU General Public License. */
29 #ifndef __LIST_H_
30 #define __LIST_H_
32 #if defined(__GNUC__) && !defined(__STRICT_ANSI__)
33 # define INLINE inline
34 #else
35 # define INLINE
36 #endif
38 typedef struct LinkedList {
39 void *head;
40 struct LinkedList *tail;
41 } LinkedList;
43 INLINE LinkedList* list_cons(void* head, LinkedList* tail);
45 INLINE int list_length(LinkedList* list);
47 INLINE void* list_nth(int index, LinkedList* list);
49 INLINE void list_remove_head(LinkedList** list);
51 INLINE LinkedList *list_remove_elem(LinkedList* list, void* elem);
53 INLINE void list_mapcar(LinkedList* list, void(*function)(void*));
55 INLINE LinkedList*list_find(LinkedList* list, void* elem);
57 INLINE void list_free(LinkedList* list);
59 #endif