cleaned up old CVS left overs
[xboard.git] / lists.h
1 /*
2  * lists.c -- Includefile of lists.c
3  *
4  * Copyright 1995,2009 Free Software Foundation, Inc.
5  *
6  * ------------------------------------------------------------------------
7  *
8  * GNU XBoard 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 3 of the License, or (at
11  * your option) any later version.
12  *
13  * GNU XBoard is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see http://www.gnu.org/licenses/.  *
20  *
21  *------------------------------------------------------------------------
22  ** See the file ChangeLog for a revision history.  */
23
24 /*
25  * This file could well be a part of backend.c, but I prefer it this
26  * way.
27  */
28
29 #ifndef _LISTS_H
30 #define _LISTS_H
31
32
33 /* Type definition: Node of a double linked list.
34  */
35 typedef struct _ListNode {
36     struct _ListNode *succ;
37     struct _ListNode *pred;
38 } ListNode;
39
40
41 /* Type definition: Double linked list.
42  *
43  * The list structure consists of two ListNode's: The pred entry of
44  * the head being the succ entry of the tail. Thus a list is empty
45  * if and only if it consists of 2 nodes. :-)
46  */
47 typedef struct {
48     struct _ListNode *head;     /*  The list structure consists of two  */
49     struct _ListNode *tail;     /*  ListNode's: The pred entry of the   */
50     struct _ListNode *tailPred; /*  head being the succ entry of the    */
51 } List;                         /*  tail.                               */
52
53
54
55 /* Function prototypes
56  */
57 extern int ListEmpty P((List *));
58 void ListNew P((List *));
59 void ListRemove P((ListNode *));
60 void ListNodeFree P((ListNode *));
61 ListNode *ListNodeCreate P((size_t));
62 void ListInsert P((ListNode *, ListNode *));
63 void ListAddHead P((List *, ListNode *));
64 void ListAddTail P((List *, ListNode *));
65 ListNode *ListElem P((List *, int));
66
67
68 #endif