Support for g++-4.1.
[gf1.git] / linklist.h
blobc4029aafdb7d708055282989a88f7f53ea338e86
1 /*
2 **++
3 ** FACILITY: linklist.h
4 **
5 ** MODULE DESCRIPTION:
6 **
7 ** header file for the functions from linklist.c
8 **
9 ** AUTHORS:
11 ** Kurt Van den Branden
13 ** CREATION DATE: 22/01/97
15 **--
18 ** Copyright (C) 1998 Kurt Van den Branden
20 ** This program is free software; you can redistribute it and/or modify
21 ** it under the terms of the GNU General Public License as published by
22 ** the Free Software Foundation; either version 2 of the License, or
23 ** (at your option) any later version.
24 **
25 ** This program is distributed in the hope that it will be useful,
26 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
27 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 ** GNU General Public License for more details.
29 **
30 ** You should have received a copy of the GNU General Public License
31 ** along with this program; if not, write to the Free Software
32 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
35 #ifndef _LINKLIST_H_
36 #define _LINKLIST_H_ 1
39 ** use the following define to include some improvements for making
40 ** some functions faster (llitembynr en pushll)
42 #define FASTLLIST 1
44 typedef struct _listitem {
45 void * itemptr; /* pointer to user data structure */
46 struct _listitem * next;
47 } listitem;
50 ** header for a list, this is what the user will use to call
51 ** the functions
53 typedef struct {
54 listitem * firstitem;
55 #ifdef FASTLLIST
56 int curnr;
57 listitem * curptr;
58 listitem * lastptr;
59 #endif
60 } listheader;
62 #ifdef __cplusplus
63 extern "C" {
64 #endif
66 #ifdef FASTLLIST
67 int newlist (listheader * head);
68 #else
69 #define newlist(x) x->firstitem = NULL;
70 #endif
72 int insertll (listheader * head, void * newitem, int (* compfunction)());
73 void * searchll (listheader * head, void * item, int (* compfunction)());
74 int emptyll (listheader * head, void (* delfunction)(void *));
75 int doll (listheader * head, void (* dofunction)());
76 void * getnextll (listheader * head, void * item);
77 listheader * copyll (listheader * head, void * (* copyfunction)());
78 void * llitembynr (listheader * head, int nr);
79 void * llrembynr (listheader * head, int nr);
80 int pushll (listheader * head, void * newitem);
81 int unshiftll (listheader * head, void * newitem);
82 void * llremitem (listheader * head, void * newitem, int (* compfunction)());
83 int findlastll (listheader * head, int (* checkfunction)(void*));
84 int lllength (listheader * head);
86 #ifdef __cplusplus
88 #endif
90 #endif