00001 #ifndef LISTSH
00002 #define LISTSH
00003
00004
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073 #ifdef LINKEDLISTS
00074 #define VoidList VoidLList
00075 #define VoidListPtr VoidLListPtr
00076 #define VoidListHandle VoidLListHandle
00077
00078 #define VLNew VLLNew
00079 #define VLAppend VLLAppend
00080 #define VLPush VLLPush
00081 #define VLLength VLLLength
00082 #define VLIndex VLLIndex
00083 #define VLSort VLLSort
00084 #define VLRemove VLLRemove
00085 #define VLInsert VLLInsert
00086 #define VLSet VLLSet
00087 #define VLFree VLLFree
00088
00089 #else
00090 #define VoidList VoidAList
00091 #define VoidListPtr VoidAListPtr
00092 #define VoidListHandle VoidAListHandle
00093
00094 #define VLNew VALNew
00095 #define VLAppend VALAppend
00096 #define VLPush VALPush
00097 #define VLLength VALLength
00098 #define VLIndex VALIndex
00099 #define VLSort VALSort
00100 #define VLRemove VALRemove
00101 #define VLInsert VALInsert
00102 #define VLSet VALSet
00103 #define VLFree VALFree
00104 #endif
00105
00106 typedef struct _VoidLList_ {
00107 void *element;
00108 struct _VoidLList_ *next;
00109 } VoidLList, *VoidLListPtr, **VoidLListHandle;
00110
00111 VoidLListPtr VLLNew(void);
00112
00113 void VLLAppend(VoidLListPtr list, void *element);
00114
00115 void VLLPush(VoidLListPtr list, void *element);
00116 int VLLLength(VoidLListPtr list);
00117
00118 void *VLLIndex(VoidLListPtr list, long index);
00119 void VLLSort(VoidLListPtr list, int (*cmp)(const void *, const void *));
00120 void *VLLRemove(VoidLListPtr list, long index);
00121 void VLLInsert(VoidLListPtr list, void *element, long index);
00122 void VLLSet(VoidLListPtr list, long index, void *newVal);
00123 void VLLFree(VoidLListPtr list);
00124
00132 typedef struct _VoidAList_ {
00133 int size;
00134 int allocatedSize;
00135 void **array;
00136 } VoidAList, *VoidAListPtr, **VoidAListHandle;
00137
00139 VoidAListPtr VALNew(void);
00141 void VALAppend(VoidAListPtr list, void *element);
00143 void VALPush(VoidAListPtr list, void *element);
00144
00146
00147 #define VALLength(list) \
00148 (((VoidAListPtr)(list))->size)
00149
00154
00155 #define VALIndex(list, index) \
00156 ( (index < ((VoidAListPtr)list)->size) ? (((VoidAListPtr)list)->array[index]) : (0) )
00157
00163 void VALSort(VoidAListPtr list, int (*cmp)(const void *, const void *));
00164
00169 void *VALRemove(VoidAListPtr list, long index);
00170
00177 void VALInsert(VoidAListPtr list, void *element, long index);
00178
00184 void VALSet(VoidAListPtr list, long index, void *newVal);
00185
00190 void VALFree(VoidAListPtr list);
00191
00198 typedef VoidAList IntList;
00199 typedef VoidAListPtr IntListPtr;
00200
00201 #define ILNew() VLNew()
00202 #define ILClone(l) VLClone(l)
00203 #define ILAppend(l, e) VLAppend(l, (void *)e)
00204 #define ILPush(l, e) VLPush(l, (void *) e)
00205 #define ILInsert(l, e, i) VLInsert(l, (void *) e, i)
00206 #define ILLength(l) VLLength(l)
00207 #define ILIndex(l, i) (void *)VLIndex(l, i)
00208 #define ILRemove(l, i) (void *)VLRemove(l, i)
00209 #define ILSet(l, i, e) VLSet(l, i, (void *)e)
00210 #define ILFree(l) VLFree(l)
00211 #define ILFind(l, e) VLFind(l, (void *)e)
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00239 typedef struct _FloatList_ {
00240 int size;
00241 int allocatedSize;
00242 float *array;
00243 } FloatList, *FloatListPtr, **FloatListHandle;
00244
00245 FloatListPtr FLNew(void);
00246 FloatListPtr FLClone(FloatListPtr orig);
00247
00248 void FLAppend(FloatListPtr list, float element);
00249
00250 void FLPush(FloatListPtr list, float element);
00251 void FLInsert(FloatListPtr list, float element, long index);
00252 int FLLength(FloatListPtr list);
00253
00254 float FLIndex(FloatListPtr list, long index);
00255 float FLRemove(FloatListPtr list, long index);
00256 void FLSet(FloatListPtr list, long index, float newVal);
00257 void FLFree(FloatListPtr list);
00258 int FLFind(FloatListPtr list, float element);
00259
00260 #endif