changes from H.G. Muller; version 4.3.14
[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 Free Software Foundation, Inc.
6  *
7  * ------------------------------------------------------------------------
8  * This program 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 of the License, or
11  * (at your option) any later version.
12  *
13  * This program 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.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
21  * ------------------------------------------------------------------------
22  *
23  * This file could well be a part of backend.c, but I prefer it this
24  * way.
25  */
26
27 #ifndef _LISTS_H
28 #define _LISTS_H
29
30
31 /* Type definition: Node of a double linked list.
32  */
33 typedef struct _ListNode {
34     struct _ListNode *succ;
35     struct _ListNode *pred;
36 } ListNode;
37
38
39 /* Type definition: Double linked list.
40  *
41  * The list structure consists of two ListNode's: The pred entry of
42  * the head being the succ entry of the tail. Thus a list is empty
43  * if and only if it consists of 2 nodes. :-)
44  */
45 typedef struct {
46     struct _ListNode *head;     /*  The list structure consists of two  */
47     struct _ListNode *tail;     /*  ListNode's: The pred entry of the   */
48     struct _ListNode *tailPred; /*  head being the succ entry of the    */
49 } List;                         /*  tail.                               */
50
51
52
53 /* Function prototypes
54  */
55 extern int ListEmpty P((List *));
56 void ListNew P((List *));
57 void ListRemove P((ListNode *));
58 void ListNodeFree P((ListNode *));
59 ListNode *ListNodeCreate P((size_t));
60 void ListInsert P((ListNode *, ListNode *));
61 void ListAddHead P((List *, ListNode *));
62 void ListAddTail P((List *, ListNode *));
63 ListNode *ListElem P((List *, int));
64
65
66 #endif