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