Changeset 14 for trunk/include/helpers/linklist.h
- Timestamp:
- Dec 9, 2000, 8:19:42 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/helpers/linklist.h
r10 r14 13 13 14 14 /* Copyright (C) 1997-2000 Ulrich Mller. 15 * This file is part of the XWorkplacesource package.16 * XWorkplaceis free software; you can redistribute it and/or modify15 * This file is part of the "XWorkplace helpers" source package. 16 * This is free software; you can redistribute it and/or modify 17 17 * it under the terms of the GNU General Public License as published 18 18 * by the Free Software Foundation, in version 2 as it comes in the … … 31 31 #define LINKLIST_HEADER_INCLUDED 32 32 33 #ifndef XWPENTRY 34 #error You must define XWPENTRY to contain the standard linkage for the XWPHelpers. 35 #endif 36 33 37 // define some basic things to make this work even with standard C 34 38 #if (!defined OS2_INCLUDED) && (!defined _OS2_H) && (!defined __SIMPLES_DEFINED) // changed V0.9.0 (99-10-22) [umoeller] … … 92 96 93 97 /* ****************************************************************** 94 * *95 * List base functions *96 * *98 * 99 * List base functions 100 * 97 101 ********************************************************************/ 98 102 99 void lstInit(PLINKLIST pList, BOOL fItemsFreeable); 103 void* XWPENTRY lstMalloc(size_t size); 104 typedef void* XWPENTRY LSTMALLOC(size_t size); 105 typedef LSTMALLOC *PLSTMALLOC; 106 107 void* XWPENTRY lstStrDup(const char *pcsz); 108 typedef void* XWPENTRY LSTSTRDUP(const char *pcsz); 109 typedef LSTSTRDUP *PLSTSTRDUP; 110 111 void XWPENTRY lstInit(PLINKLIST pList, BOOL fItemsFreeable); 112 typedef void XWPENTRY LSTINIT(PLINKLIST pList, BOOL fItemsFreeable); 113 typedef LSTINIT *PLSTINIT; 100 114 101 115 #ifdef __XWPMEMDEBUG__ // setup.h, helpers\memdebug.c 102 PLINKLIST lstCreateDebug(BOOL fItemsFreeable, 103 const char *file, 104 unsigned long line, 105 const char *function); 116 PLINKLIST XWPENTRY lstCreateDebug(BOOL fItemsFreeable, 117 const char *file, 118 unsigned long line, 119 const char *function); 120 typedef PLINKLIST XWPENTRY LSTCREATEDEBUG(BOOL fItemsFreeable, 121 const char *file, 122 unsigned long line, 123 const char *function); 124 typedef LSTCREATEDEBUG *PLSTCREATEDEBUG; 106 125 107 126 #define lstCreate(b) lstCreateDebug((b), __FILE__, __LINE__, __FUNCTION__) 108 127 #else 109 PLINKLIST lstCreate(BOOL fItemsFreeable); 110 #endif 111 112 BOOL lstFree(PLINKLIST pList); 113 114 BOOL lstClear(PLINKLIST pList); 115 116 long lstCountItems(PLINKLIST pList); 117 118 PLISTNODE lstQueryFirstNode(PLINKLIST pList); 119 120 PLISTNODE lstNodeFromIndex(PLINKLIST pList, unsigned long ulIndex); 121 122 PLISTNODE lstNodeFromItem(PLINKLIST pList, void* pItemData); 123 124 void* lstItemFromIndex(PLINKLIST pList, unsigned long ulIndex); 128 PLINKLIST XWPENTRY lstCreate(BOOL fItemsFreeable); 129 typedef PLINKLIST XWPENTRY LSTCREATE(BOOL fItemsFreeable); 130 typedef LSTCREATE *PLSTCREATE; 131 #endif 132 133 BOOL XWPENTRY lstFree(PLINKLIST pList); 134 typedef BOOL XWPENTRY LSTFREE(PLINKLIST pList); 135 typedef LSTFREE *PLSTFREE; 136 137 BOOL XWPENTRY lstClear(PLINKLIST pList); 138 typedef BOOL XWPENTRY LSTCLEAR(PLINKLIST pList); 139 typedef LSTCLEAR *PLSTCLEAR; 140 141 long XWPENTRY lstCountItems(PLINKLIST pList); 142 typedef long XWPENTRY LSTCOUNTITEMS(PLINKLIST pList); 143 typedef LSTCOUNTITEMS *PLSTCOUNTITEMS; 144 145 PLISTNODE XWPENTRY lstQueryFirstNode(PLINKLIST pList); 146 typedef PLISTNODE XWPENTRY LSTQUERYFIRSTNODE(PLINKLIST pList); 147 typedef LSTQUERYFIRSTNODE *PLSTQUERYFIRSTNODE; 148 149 PLISTNODE XWPENTRY lstNodeFromIndex(PLINKLIST pList, unsigned long ulIndex); 150 typedef PLISTNODE XWPENTRY LSTNODEFROMINDEX(PLINKLIST pList, unsigned long ulIndex); 151 typedef LSTNODEFROMINDEX *PLSTNODEFROMINDEX; 152 153 PLISTNODE XWPENTRY lstNodeFromItem(PLINKLIST pList, void* pItemData); 154 typedef PLISTNODE XWPENTRY LSTNODEFROMITEM(PLINKLIST pList, void* pItemData); 155 typedef LSTNODEFROMITEM *PLSTNODEFROMITEM; 156 157 void* XWPENTRY lstItemFromIndex(PLINKLIST pList, unsigned long ulIndex); 158 typedef void* XWPENTRY LSTITEMFROMINDEX(PLINKLIST pList, unsigned long ulIndex); 159 typedef LSTITEMFROMINDEX *PLSTITEMFROMINDEX; 125 160 126 161 #ifdef __XWPMEMDEBUG__ // setup.h, helpers\memdebug.c 127 PLISTNODE lstAppendItemDebug(PLINKLIST pList,128 void* pNewItemData,129 const char *file,130 unsigned long line,131 const char *function);162 PLISTNODE XWPENTRY lstAppendItemDebug(PLINKLIST pList, 163 void* pNewItemData, 164 const char *file, 165 unsigned long line, 166 const char *function); 132 167 #define lstAppendItem(pl, pd) lstAppendItemDebug((pl), (pd), __FILE__, __LINE__, __FUNCTION__) 133 168 #else 134 PLISTNODE lstAppendItem(PLINKLIST pList, void* pNewItemData); 135 #endif 136 137 PLISTNODE lstInsertItemBefore(PLINKLIST pList, 138 void* pNewItemData, 139 unsigned long ulIndex); 140 141 BOOL lstRemoveNode(PLINKLIST pList, PLISTNODE pRemoveNode); 142 143 BOOL lstRemoveItem(PLINKLIST pList, void* pRemoveItem); 144 145 BOOL lstSwapNodes(PLISTNODE pNode1, 146 PLISTNODE pNode2); 169 PLISTNODE XWPENTRY lstAppendItem(PLINKLIST pList, void* pNewItemData); 170 typedef PLISTNODE XWPENTRY LSTAPPENDITEM(PLINKLIST pList, void* pNewItemData); 171 typedef LSTAPPENDITEM *PLSTAPPENDITEM; 172 #endif 173 174 PLISTNODE XWPENTRY lstInsertItemBefore(PLINKLIST pList, 175 void* pNewItemData, 176 unsigned long ulIndex); 177 typedef PLISTNODE XWPENTRY LSTINSERTITEMBEFORE(PLINKLIST pList, 178 void* pNewItemData, 179 unsigned long ulIndex); 180 typedef LSTINSERTITEMBEFORE *PLSTINSERTITEMBEFORE; 181 182 BOOL XWPENTRY lstRemoveNode(PLINKLIST pList, PLISTNODE pRemoveNode); 183 typedef BOOL XWPENTRY LSTREMOVENODE(PLINKLIST pList, PLISTNODE pRemoveNode); 184 typedef LSTREMOVENODE *PLSTREMOVENODE; 185 186 BOOL XWPENTRY lstRemoveItem(PLINKLIST pList, void* pRemoveItem); 187 typedef BOOL XWPENTRY LSTREMOVEITEM(PLINKLIST pList, void* pRemoveItem); 188 typedef LSTREMOVEITEM *PLSTREMOVEITEM; 189 190 BOOL XWPENTRY lstSwapNodes(PLISTNODE pNode1, PLISTNODE pNode2); 191 typedef BOOL XWPENTRY LSTSWAPNODES(PLISTNODE pNode1, PLISTNODE pNode2); 192 typedef LSTSWAPNODES *PLSTSWAPNODES; 147 193 148 194 /* ****************************************************************** 149 * *150 * List sorting *151 * *195 * 196 * List sorting 197 * 152 198 ********************************************************************/ 153 199 154 BOOL lstQuickSort(PLINKLIST pList,155 PFNSORTLIST pfnSort,156 void* pStorage);157 158 BOOL lstBubbleSort(PLINKLIST pList,159 PFNSORTLIST pfnSort,160 void* pStorage);200 BOOL XWPENTRY lstQuickSort(PLINKLIST pList, 201 PFNSORTLIST pfnSort, 202 void* pStorage); 203 204 BOOL XWPENTRY lstBubbleSort(PLINKLIST pList, 205 PFNSORTLIST pfnSort, 206 void* pStorage); 161 207 162 208 #endif
Note:
See TracChangeset
for help on using the changeset viewer.