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