1 /*************************************************************************** 2 $RCSfile$ 3 ------------------- 4 cvs : $Id$ 5 begin : Sat Nov 15 2003 6 copyright : (C) 2003 by Martin Preuss 7 email : martin@libchipcard.de 8 9 *************************************************************************** 10 * * 11 * This library is free software; you can redistribute it and/or * 12 * modify it under the terms of the GNU Lesser General Public * 13 * License as published by the Free Software Foundation; either * 14 * version 2.1 of the License, or (at your option) any later version. * 15 * * 16 * This library is distributed in the hope that it will be useful, * 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 19 * Lesser General Public License for more details. * 20 * * 21 * You should have received a copy of the GNU Lesser General Public * 22 * License along with this library; if not, write to the Free Software * 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * 24 * MA 02111-1307 USA * 25 * * 26 ***************************************************************************/ 27 28 29 #ifndef GWENHYWFAR_LIST_P_H 30 #define GWENHYWFAR_LIST_P_H 31 32 #include <gwenhywfar/list.h> 33 #include <gwenhywfar/inherit.h> 34 35 36 typedef struct GWEN_LIST_ENTRY GWEN_LIST_ENTRY; 37 typedef struct GWEN_CONSTLIST_ENTRY GWEN_CONSTLIST_ENTRY; 38 typedef struct GWEN__LISTPTR GWEN__LISTPTR; 39 40 struct GWEN_LIST_ENTRY { 41 GWEN_LIST_ENTRY *previous; 42 GWEN_LIST_ENTRY *next; 43 GWEN_REFPTR *dataPtr; 44 unsigned int usage; 45 unsigned int linkCount; 46 }; 47 48 49 static GWEN_LIST_ENTRY *GWEN_ListEntry_new(); 50 static void GWEN_ListEntry_free(GWEN_LIST_ENTRY *le); 51 52 53 54 struct GWEN_CONSTLIST_ENTRY { 55 GWEN_CONSTLIST_ENTRY *previous; 56 GWEN_CONSTLIST_ENTRY *next; 57 const void *data; 58 unsigned int usage; 59 }; 60 61 62 struct GWEN__LISTPTR { 63 uint32_t refCount; 64 GWEN_LIST_ENTRY *first; 65 GWEN_LIST_ENTRY *last; 66 unsigned int size; 67 GWEN_REFPTR_INFO *refPtrInfo; 68 }; 69 70 71 static GWEN__LISTPTR *GWEN__ListPtr_new(); 72 static void GWEN__ListPtr_free(GWEN__LISTPTR *lp); 73 static void GWEN__ListPtr_Attach(GWEN__LISTPTR *lp); 74 static void GWEN__ListPtr_Clear(GWEN__LISTPTR *lp); 75 static GWEN__LISTPTR *GWEN__ListPtr_dup(GWEN__LISTPTR *lp); 76 77 78 struct GWEN_LIST { 79 GWEN_INHERIT_ELEMENT(GWEN_LIST) 80 GWEN__LISTPTR *listPtr; 81 GWEN_REFPTR_INFO *refPtrInfo; 82 }; 83 84 85 struct GWEN_CONSTLIST { 86 GWEN_CONSTLIST_ENTRY *first; 87 GWEN_CONSTLIST_ENTRY *last; 88 unsigned int size; 89 }; 90 91 92 93 struct GWEN_LIST_ITERATOR { 94 const GWEN_LIST *list; 95 96 GWEN_LIST_ENTRY *current; 97 }; 98 99 100 struct GWEN_CONSTLIST_ITERATOR { 101 const GWEN_CONSTLIST *list; 102 103 GWEN_CONSTLIST_ENTRY *current; 104 }; 105 106 107 108 #endif 109 110 111 112