VIA - Volumetric Image Analysis
|
00001 /* 00002 * $Id: VList.h 726 2004-03-08 13:12:45Z lohmann $ 00003 * 00004 * Definitions associated with VList. 00005 */ 00006 00007 #ifndef V_VList_h 00008 #define V_VList_h 1 00009 00010 /* 00011 * Copyright 1993, 1994 University of British Columbia 00012 * 00013 * Permission to use, copy, modify, distribute, and sell this software and its 00014 * documentation for any purpose is hereby granted without fee, provided that 00015 * the above copyright notice appears in all copies and that both that 00016 * copyright notice and this permission notice appear in supporting 00017 * documentation. UBC makes no representations about the suitability of this 00018 * software for any purpose. It is provided "as is" without express or 00019 * implied warranty. 00020 * 00021 * Author: Daniel Ko, UBC Laboratory for Computational Intelligence 00022 */ 00023 00024 /* From the Vista library: */ 00025 #include "viaio/Vlib.h" 00026 00027 /* From the standard C library: */ 00028 #include <stdio.h> 00029 00030 /* For portability: */ 00031 #include <X11/Xfuncproto.h> 00032 00033 #ifdef __cplusplus 00034 extern "C" { 00035 #endif 00036 00037 00038 /* 00039 * Declarations of data structure. 00040 */ 00041 00042 /* List element: */ 00043 typedef struct V_Node *VNodePtrType; 00044 struct V_Node { 00045 VPointer item; /* pointer to data item */ 00046 VNodePtrType prev; /* pointer to previous node */ 00047 VNodePtrType next; /* pointer to next node */ 00048 }; 00049 00050 /* List head: */ 00051 typedef struct V_List { 00052 VNodePtrType current; /* pointer to current node */ 00053 VNodePtrType head; /* pointer to head node */ 00054 VNodePtrType tail; /* pointer to tail node */ 00055 int count; /* number of nodes in VList */ 00056 } *VList; 00057 00058 00059 /* 00060 * Definitions of macros. 00061 */ 00062 00063 #define VListCount(vlist) ((vlist)->count) 00064 #define VListCurr(vlist) ((vlist)->current->item) 00065 #define VListGetCurr(vlist) ((vlist)->current) 00066 #define VListSetCurr(vlist,curr) ((void) ((vlist)->current = (curr))) 00067 00068 00069 /* 00070 * Declarations of library routines. 00071 */ 00072 00073 /* From List.c: */ 00074 00075 extern VList VListCreate ( 00076 #if NeedFunctionPrototypes 00077 void 00078 #endif 00079 ); 00080 00081 extern VPointer VListFirst ( 00082 #if NeedFunctionPrototypes 00083 VList /* vlist */ 00084 #endif 00085 ); 00086 00087 extern VPointer VListLast ( 00088 #if NeedFunctionPrototypes 00089 VList /* vlist */ 00090 #endif 00091 ); 00092 00093 extern VPointer VListNext ( 00094 #if NeedFunctionPrototypes 00095 VList /* vlist */ 00096 #endif 00097 ); 00098 00099 extern VPointer VListPrev ( 00100 #if NeedFunctionPrototypes 00101 VList /* vlist */ 00102 #endif 00103 ); 00104 00105 extern void VListAdd ( 00106 #if NeedFunctionPrototypes 00107 VList /* vlist */, 00108 VPointer /* item */ 00109 #endif 00110 ); 00111 00112 extern void VListInsert ( 00113 #if NeedFunctionPrototypes 00114 VList /* vlist */, 00115 VPointer /* item */ 00116 #endif 00117 ); 00118 00119 extern void VListAppend ( 00120 #if NeedFunctionPrototypes 00121 VList /* vlist */, 00122 VPointer /* item */ 00123 #endif 00124 ); 00125 00126 extern void VListPrepend ( 00127 #if NeedFunctionPrototypes 00128 VList /* vlist */, 00129 VPointer /* item */ 00130 #endif 00131 ); 00132 00133 extern VPointer VListRemove ( 00134 #if NeedFunctionPrototypes 00135 VList /* vlist */ 00136 #endif 00137 ); 00138 00139 extern void VListConcat ( 00140 #if NeedFunctionPrototypes 00141 VList /* vlist1 */, 00142 VList /* vlist2 */ 00143 #endif 00144 ); 00145 00146 extern void VListDestroy ( 00147 #if NeedFunctionPrototypes 00148 VList /* vlist */, 00149 void (*) ( 00150 #if NeedNestedPrototypes 00151 VPointer /* opaque_object */ 00152 #endif 00153 ) /* item_free */ 00154 #endif 00155 ); 00156 00157 extern VPointer VListTrim ( 00158 #if NeedFunctionPrototypes 00159 VList /* vlist */ 00160 #endif 00161 ); 00162 00163 extern VPointer VListSearch ( 00164 #if NeedFunctionPrototypes 00165 VList /* vlist */, 00166 int (*) () /* comp */, 00167 VPointer /* comp_arg */ 00168 #endif 00169 ); 00170 00171 #ifdef __cplusplus 00172 } 00173 #endif 00174 00175 #endif /* V_VList_h */