1 /*-------------------------------------------------------------------*/ 2 /* List Functionality */ 3 /*-------------------------------------------------------------------*/ 4 #ifndef _SHLIST_H_ 5 #define _SHLIST_H_ 6 7 typedef struct SHLIST_STRUC { 8 void *data; 9 struct SHLIST_STRUC *next; 10 struct SHLIST_STRUC *prev; 11 } SHLIST; 12 13 typedef int (*shListCmp)( void *valo, void *valn, void *etalon ); 14 typedef int (*shListPrint)( void *val ); 15 typedef void (*shListFree)( void *val ); 16 typedef int (*shListEqual)( void *val, void *idata ); 17 18 void shListInitList( SHLIST *listPtr ); 19 SHLIST *shListFindItem( SHLIST *head, void *val, shListEqual func ); 20 SHLIST *shListGetFirstItem( SHLIST *head ); 21 SHLIST *shListGetNItem( SHLIST *head, unsigned long num ); 22 SHLIST *shListGetLastItem( SHLIST *head ); 23 SHLIST *shListGetNextItem( SHLIST *head, SHLIST *item ); 24 SHLIST *shListGetPrevItem( SHLIST *head, SHLIST *item ); 25 void shListDelItem( SHLIST *head, SHLIST *item, shListFree func ); 26 void shListInsFirstItem( SHLIST *head, void *val ); 27 void shListInsBeforeItem( SHLIST *head, void *val, void *etalon, 28 shListCmp func ); 29 void shListInsLastItem( SHLIST *head, void *val ); 30 void shListDelAllItems( SHLIST *head, shListFree func ); 31 void shListPrintAllItems( SHLIST *head, shListPrint func ); 32 unsigned long shListGetCount( SHLIST *head ); 33 34 #endif 35