1 /* 2 * Neotonic ClearSilver Templating System 3 * 4 * This code is made available under the terms of the 5 * Neotonic ClearSilver License. 6 * http://www.neotonic.com/clearsilver/license.hdf 7 * 8 * Copyright (C) 2001 by Brandon Long 9 */ 10 11 #ifndef __ULIST_H_ 12 #define __ULIST_H_ 1 13 14 #include "util/neo_err.h" 15 16 typedef struct _ulist 17 { 18 int flags; 19 void **items; 20 int num; 21 int max; 22 } ULIST; 23 24 #define ULIST_INTEGER (1<<0) 25 #define ULIST_FREE (1<<1) 26 #define ULIST_COPY (1<<2) 27 28 NEOERR * uListInit(ULIST **ul, int size, int flags); 29 NEOERR * uListvInit(ULIST **ul, ...); 30 int uListLength (ULIST *ul); 31 NEOERR * uListAppend (ULIST *ul, void *data); 32 NEOERR * uListPop (ULIST *ul, void **data); 33 NEOERR * uListInsert (ULIST *ul, int x, void *data); 34 NEOERR * uListDelete (ULIST *ul, int x, void **data); 35 NEOERR * uListGet (ULIST *ul, int x, void **data); 36 NEOERR * uListSet (ULIST *ul, int x, void *data); 37 NEOERR * uListReverse (ULIST *ul); 38 NEOERR * uListSort (ULIST *ul, int (*compareFunc)(const void*, const void*)); 39 void *uListSearch (ULIST *ul, const void *key, int (*compareFunc)(const void *, const void*)); 40 void *uListIn (ULIST *ul, const void *key, int (*compareFunc)(const void *, const void*)); 41 int uListIndex (ULIST *ul, const void *key, int (*compareFunc)(const void *, const void*)); 42 NEOERR * uListDestroy (ULIST **ul, int flags); 43 NEOERR * uListDestroyFunc (ULIST **ul, void (*destroyFunc)(void *)); 44 45 #endif /* __ULIST_H_ */ 46