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