Changeset 450 for trunk/psLib/src/collections/psSort.c
- Timestamp:
- Apr 19, 2004, 10:10:46 AM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/collections/psSort.c (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/collections/psSort.c
r438 r450 1 /** @file psSort. h2 * 3 * @brief Sorts a n array of floats1 /** @file psSort.c 2 * 3 * @brief Sorts arrays 4 4 * 5 5 * The psSort functions use the qsort() stdlib function with a user-defined callback to sort an array of … … 14 14 * @author Ross Harman, MHPCC 15 15 * 16 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $17 * @date $Date: 2004-04-1 7 02:43:59$16 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 17 * @date $Date: 2004-04-19 20:10:46 $ 18 18 * 19 19 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 32 32 #include "psArray.h" 33 33 #include "psSort.h" 34 #include "psError.h" 34 35 35 36 /******************************************************************************/ … … 80 81 81 82 if(x == NULL || y == NULL) { 82 p rintf("Null input argument\n");83 psError(__func__, " : Line %d - Null input argument: x=%d y=%d\n", __LINE__, x, y); 83 84 } 84 85 … … 87 88 88 89 if(item1 == NULL || item2 == NULL) { 89 p rintf("Improper cast to float\n");90 psError(__func__, " : Line %d - Improper cast to float: item1=%d item2=%d\n", __LINE__, item1, item2); 90 91 } 91 92 … … 101 102 } 102 103 103 /** Sort an array of floats. 104 * 105 * Sorts an array of floats in ascendin order with the qsort() stdlib function. 106 * 107 * @return psFloatArray*: Pointer to sorted psFloatArray. 108 */ 109 104 /*****************************************************************************/ 105 /* FUNCTION IMPLEMENTATION - PUBLIC */ 106 /*****************************************************************************/ 107 110 108 psFloatArray *psSort( 111 109 psFloatArray *restrict outArray, /**< Sorted output array. */ … … 121 119 122 120 if(outArray == NULL) { 123 p rintf("NULL output array n");121 psError(__func__, " : Line %d - Null output array\n", __LINE__); 124 122 return outArray; 125 123 } 126 124 127 125 if(inArray == NULL) { 128 p rintf("NULL input array\n");126 psError(__func__, " : Line %d - Null input array\n", __LINE__); 129 127 return outArray; 130 128 } … … 138 136 139 137 if(inN != outN) { 140 printf("Input and output array sizes are not equal"); 138 psError(__func__, " : Line %d - Input and output array sizes are not equal: in=%d out=%d\n", __LINE__, 139 inN, outN); 141 140 return outArray; 142 141 } … … 152 151 return outArray; 153 152 } 154 155 /** Creates an array of indices based on sort odred of float array.156 *157 * Sorts an array of floats and creates an integer array holding indices of sorted float values based on158 * pre-sort index positions.159 *160 * @return psIntArray*: Pointer to psIntArray of sorted indices.161 */162 153 163 154 psIntArray *psSortIndex( … … 177 168 178 169 if(outArray == NULL) { 179 p rintf("NULL output array n");170 psError(__func__, " : Line %d - Null output array\n", __LINE__); 180 171 return outArray; 181 172 } 182 173 183 174 if(inArray == NULL) { 184 p rintf("NULL input array\n");175 psError(__func__, " : Line %d - Null input array\n", __LINE__); 185 176 return outArray; 186 177 } … … 193 184 194 185 if(inN != outN) { 195 printf("Input and output array sizes are not equal"); 186 psError(__func__, " : Line %d - Input and output array sizes are not equal: in=%d out=%d\n", __LINE__, 187 inN, outN); 196 188 return outArray; 197 189 }
Note:
See TracChangeset
for help on using the changeset viewer.
