Changeset 11705
- Timestamp:
- Feb 7, 2007, 6:35:35 PM (19 years ago)
- Location:
- trunk/psLib/src/types
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/types/psList.c
r11668 r11705 5 5 * @author Robert Lupton, Princeton University 6 6 * @author Robert Daniel DeSonia, MHPCC 7 * @author Joshua Hoblitt, University of Hawaii 7 8 * 8 * @version $Revision: 1.6 0$ $Name: not supported by cvs2svn $9 * @date $Date: 2007-02-0 6 21:36:09$9 * @version $Revision: 1.61 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2007-02-08 04:35:35 $ 10 11 * 11 12 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 18 19 #include <stdlib.h> 19 20 #include <stdio.h> 21 20 22 #include "psError.h" 21 23 #include "psAbort.h" … … 121 123 } 122 124 123 psList* psListAlloc(psPtr data) 124 { 125 psList* list = psAlloc(sizeof(psList)); 125 psList* p_psListAlloc(const char *file, 126 unsigned int lineno, 127 const char *func, 128 psPtr data) 129 { 130 psList* list = p_psAlloc(file, lineno, func, sizeof(psList)); 126 131 127 132 psMemSetDeallocator(list, (psFreeFunc) listFree); … … 147 152 } 148 153 149 psListIterator* psListIteratorAlloc(psList* list, 154 psListIterator* p_psListIteratorAlloc(const char *file, 155 unsigned int lineno, 156 const char *func, 157 psList* list, 150 158 long location, 151 159 bool mutable) … … 156 164 return false; 157 165 } 158 psListIterator* iter = p sAlloc(sizeof(psListIterator));166 psListIterator* iter = p_psAlloc(file, lineno, func, sizeof(psListIterator)); 159 167 160 168 psMemSetDeallocator(iter, (psFreeFunc) listIteratorFree); -
trunk/psLib/src/types/psList.h
r11248 r11705 5 5 * @author Robert Daniel DeSonia, MHPCC 6 6 * 7 * @version $Revision: 1. 39$ $Name: not supported by cvs2svn $8 * @date $Date: 2007-0 1-23 22:47:23$7 * @version $Revision: 1.40 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2007-02-08 04:35:35 $ 9 9 * 10 10 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 22 22 /** Special values of index into list 23 23 * 24 * This list of possible list position values should be contiguous non-positive values ending with 25 * PS_LIST_UNKNOWN. Any value less-than-or-equal-to PS_LIST_UNKNOWN is considered a undefined position. 24 * This list of possible list position values should be contiguous 25 * non-positive values ending with PS_LIST_UNKNOWN. Any value 26 * less-than-or-equal-to PS_LIST_UNKNOWN is considered a undefined position. 26 27 * 27 28 */ … … 30 31 PS_LIST_TAIL = -1, ///< at tail 31 32 }; 33 32 34 33 35 /** Doubly-linked list element */ … … 39 41 } 40 42 psListElem; 43 41 44 42 45 /** The psList Linked list structure. User should not allocate this struct … … 58 61 psList; 59 62 63 60 64 /** The psList iterator structure. This should be allocated via 61 65 * psListIteratorAlloc and not directly. … … 79 83 /** Checks the type of a particular pointer. 80 84 * 81 * Uses the appropriate deallocation function in psMemBlock to check the ptr datatype. 85 * Uses the appropriate deallocation function in psMemBlock to check the ptr 86 * datatype. 82 87 * 83 88 * @return bool: True if the pointer matches a psList structure, false otherwise. … … 85 90 bool psMemCheckList( 86 91 psPtr ptr ///< the pointer whose type to check 87 ) 88 ; 92 ); 93 89 94 90 95 /** Creates a psList linked list object. … … 92 97 * @return psList* A new psList object. 93 98 */ 99 #ifdef DOXYGEN 94 100 psList* psListAlloc( 95 101 psPtr data ///< initial data item; may be NULL if an empty psList is desired 96 102 ); 103 #else // ifdef DOXYGEN 104 psList* p_psListAlloc( 105 const char *file, ///< File of caller 106 unsigned int lineno, ///< Line number of caller 107 const char *func, ///< Function name of caller 108 psPtr data ///< initial data item; may be NULL if an empty psList is desired 109 ); 110 #define psListAlloc(data) \ 111 p_psListAlloc(__FILE__, __LINE__, __func__, data) 112 #endif // ifdef DOXYGEN 113 97 114 98 115 /** Creates a psListIterator object and associates it with a psList. … … 100 117 * @return psListIterator* A new psListIterator object. 101 118 */ 119 #ifdef DOXYGEN 102 120 psListIterator* psListIteratorAlloc( 103 121 psList* list, ///< the psList to iterate with … … 106 124 bool mutable ///< Is it permissible to modify list? 107 125 ); 126 #else // ifdef DOXYGEN 127 psListIterator* p_psListIteratorAlloc( 128 const char *file, ///< File of caller 129 unsigned int lineno, ///< Line number of caller 130 const char *func, ///< Function name of caller 131 psList* list, ///< the psList to iterate with 132 long location, ///< the initial starting point. 133 ///< This can be a numeric index, PS_LIST_HEAD, or PS_LIST_TAIL. 134 bool mutable ///< Is it permissible to modify list? 135 ); 136 #define psListIteratorAlloc(list, location, mutable) \ 137 p_psListIteratorAlloc(__FILE__, __LINE__, __func__, list, location, mutable) 138 #endif // ifdef DOXYGEN 139 108 140 109 141 /** Set the iterator of the list to a given position. If location is invalid the … … 116 148 long location ///< index number, PS_LIST_HEAD, or PS_LIST_TAIL 117 149 ); 150 118 151 119 152 /** Adds an element to a psList at position given. … … 127 160 ); 128 161 162 129 163 /** Adds an data item to a psList at position just after the list position given 130 164 * … … 136 170 ); 137 171 172 138 173 /** Adds a data item to a psList at position just before the list position given 139 174 * … … 154 189 ); 155 190 191 156 192 /** Remove an item from a list. 157 193 * … … 162 198 psPtr data ///< data item to find and remove 163 199 ); 200 164 201 165 202 /** Retrieve an item from a list. … … 175 212 ); 176 213 214 177 215 /** Position the specified iterator to the next item in list. 178 216 * … … 184 222 ); 185 223 224 186 225 /** Position the specified iterator to the previous item in list. 187 226 * … … 193 232 ); 194 233 234 195 235 /** Convert a linked list to an array 196 236 * … … 202 242 ); 203 243 244 204 245 /** Convert array to a doubly-linked list 205 246 * … … 210 251 const psArray* array ///< vector to convert 211 252 ); 253 212 254 213 255 /** Sort a list via a comparison function. … … 227 269 ); 228 270 271 229 272 /** Get the number of elements in use from a specified psList. (list.n) 230 273 * … … 235 278 ); 236 279 280 237 281 /// @} End of DataContainer Functions 238 282 #endif // #ifndef PS_LIST_H
Note:
See TracChangeset
for help on using the changeset viewer.
