VIA - Volumetric Image Analysis
VList.h
1 /*
2  * $Id: VList.h 726 2004-03-08 13:12:45Z lohmann $
3  *
4  * Definitions associated with VList.
5  */
6 
7 #ifndef V_VList_h
8 #define V_VList_h 1
9 
10 /*
11  * Copyright 1993, 1994 University of British Columbia
12  *
13  * Permission to use, copy, modify, distribute, and sell this software and its
14  * documentation for any purpose is hereby granted without fee, provided that
15  * the above copyright notice appears in all copies and that both that
16  * copyright notice and this permission notice appear in supporting
17  * documentation. UBC makes no representations about the suitability of this
18  * software for any purpose. It is provided "as is" without express or
19  * implied warranty.
20  *
21  * Author: Daniel Ko, UBC Laboratory for Computational Intelligence
22  */
23 
24 /* From the Vista library: */
25 #include "viaio/Vlib.h"
26 
27 /* From the standard C library: */
28 #include <stdio.h>
29 
30 /* For portability: */
31 #include <X11/Xfuncproto.h>
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 
38 /*
39  * Declarations of data structure.
40  */
41 
42 /* List element: */
43 typedef struct V_Node *VNodePtrType;
44 struct V_Node {
45  VPointer item; /* pointer to data item */
46  VNodePtrType prev; /* pointer to previous node */
47  VNodePtrType next; /* pointer to next node */
48 };
49 
50 /* List head: */
51 typedef struct V_List {
52  VNodePtrType current; /* pointer to current node */
53  VNodePtrType head; /* pointer to head node */
54  VNodePtrType tail; /* pointer to tail node */
55  int count; /* number of nodes in VList */
56 } *VList;
57 
58 
59 /*
60  * Definitions of macros.
61  */
62 
63 #define VListCount(vlist) ((vlist)->count)
64 #define VListCurr(vlist) ((vlist)->current->item)
65 #define VListGetCurr(vlist) ((vlist)->current)
66 #define VListSetCurr(vlist,curr) ((void) ((vlist)->current = (curr)))
67 
68 
69 /*
70  * Declarations of library routines.
71  */
72 
73 /* From List.c: */
74 
75 extern VList VListCreate (
76 #if NeedFunctionPrototypes
77  void
78 #endif
79 );
80 
81 extern VPointer VListFirst (
82 #if NeedFunctionPrototypes
83  VList /* vlist */
84 #endif
85 );
86 
87 extern VPointer VListLast (
88 #if NeedFunctionPrototypes
89  VList /* vlist */
90 #endif
91 );
92 
93 extern VPointer VListNext (
94 #if NeedFunctionPrototypes
95  VList /* vlist */
96 #endif
97 );
98 
99 extern VPointer VListPrev (
100 #if NeedFunctionPrototypes
101  VList /* vlist */
102 #endif
103 );
104 
105 extern void VListAdd (
106 #if NeedFunctionPrototypes
107  VList /* vlist */,
108  VPointer /* item */
109 #endif
110 );
111 
112 extern void VListInsert (
113 #if NeedFunctionPrototypes
114  VList /* vlist */,
115  VPointer /* item */
116 #endif
117 );
118 
119 extern void VListAppend (
120 #if NeedFunctionPrototypes
121  VList /* vlist */,
122  VPointer /* item */
123 #endif
124 );
125 
126 extern void VListPrepend (
127 #if NeedFunctionPrototypes
128  VList /* vlist */,
129  VPointer /* item */
130 #endif
131 );
132 
133 extern VPointer VListRemove (
134 #if NeedFunctionPrototypes
135  VList /* vlist */
136 #endif
137 );
138 
139 extern void VListConcat (
140 #if NeedFunctionPrototypes
141  VList /* vlist1 */,
142  VList /* vlist2 */
143 #endif
144 );
145 
146 extern void VListDestroy (
147 #if NeedFunctionPrototypes
148  VList /* vlist */,
149  void (*) (
150 #if NeedNestedPrototypes
151  VPointer /* opaque_object */
152 #endif
153  ) /* item_free */
154 #endif
155 );
156 
157 extern VPointer VListTrim (
158 #if NeedFunctionPrototypes
159  VList /* vlist */
160 #endif
161 );
162 
163 extern VPointer VListSearch (
164 #if NeedFunctionPrototypes
165  VList /* vlist */,
166  int (*) () /* comp */,
167  VPointer /* comp_arg */
168 #endif
169 );
170 
171 #ifdef __cplusplus
172 }
173 #endif
174 
175 #endif /* V_VList_h */