142 * @param s1 string one |
142 * @param s1 string one |
143 * @param s2 string two |
143 * @param s2 string two |
144 * @param data omitted |
144 * @param data omitted |
145 * @return the result of strcmp(s1, s2) |
145 * @return the result of strcmp(s1, s2) |
146 */ |
146 */ |
147 int ucx_strcmp(const void *s1, const void *s2, void *data); |
147 int ucx_cmp_str(const void *s1, const void *s2, void *data); |
148 |
148 |
149 /** |
149 /** |
150 * Wraps the strncmp function. |
150 * Wraps the strncmp function. |
151 * @param s1 string one |
151 * @param s1 string one |
152 * @param s2 string two |
152 * @param s2 string two |
153 * @param n a pointer to the size_t containing the third strncmp parameter |
153 * @param n a pointer to the size_t containing the third strncmp parameter |
154 * @return the result of strncmp(s1, s2, *n) |
154 * @return the result of strncmp(s1, s2, *n) |
155 */ |
155 */ |
156 int ucx_strncmp(const void *s1, const void *s2, void *n); |
156 int ucx_cmp_strn(const void *s1, const void *s2, void *n); |
|
157 |
|
158 /** |
|
159 * Wraps the sstrcmp function. |
|
160 * @param s1 sstr one |
|
161 * @param s2 sstr two |
|
162 * @param data ignored |
|
163 * @return the result of sstrcmp(s1, s2) |
|
164 */ |
|
165 int ucx_cmp_sstr(const void *s1, const void *s2, void *data); |
157 |
166 |
158 /** |
167 /** |
159 * Compares two integers of type int. |
168 * Compares two integers of type int. |
160 * @param i1 pointer to integer one |
169 * @param i1 pointer to integer one |
161 * @param i2 pointer to integer two |
170 * @param i2 pointer to integer two |
162 * @param data omitted |
171 * @param data omitted |
163 * @return -1, if *i1 is less than *i2, 0 if both are equal, |
172 * @return -1, if *i1 is less than *i2, 0 if both are equal, |
164 * 1 if *i1 is greater than *i2 |
173 * 1 if *i1 is greater than *i2 |
165 */ |
174 */ |
166 int ucx_intcmp(const void *i1, const void *i2, void *data); |
175 int ucx_cmp_int(const void *i1, const void *i2, void *data); |
|
176 |
|
177 /** |
|
178 * Compares two integers of type long int. |
|
179 * @param i1 pointer to long integer one |
|
180 * @param i2 pointer to long integer two |
|
181 * @param data omitted |
|
182 * @return -1, if *i1 is less than *i2, 0 if both are equal, |
|
183 * 1 if *i1 is greater than *i2 |
|
184 */ |
|
185 int ucx_cmp_longint(const void *i1, const void *i2, void *data); |
|
186 |
|
187 |
|
188 /** |
|
189 * Distance function for integers of type int. |
|
190 * @param i1 pointer to integer one |
|
191 * @param i2 pointer to integer two |
|
192 * @param data omitted |
|
193 * @return i1 minus i2 |
|
194 */ |
|
195 intmax_t ucx_dist_int(const void *i1, const void *i2, void *data); |
|
196 |
|
197 /** |
|
198 * Distance function for integers of type long int. |
|
199 * @param i1 pointer to long integer one |
|
200 * @param i2 pointer to long integer two |
|
201 * @param data omitted |
|
202 * @return i1 minus i2 |
|
203 */ |
|
204 intmax_t ucx_dist_longint(const void *i1, const void *i2, void *data); |
167 |
205 |
168 /** |
206 /** |
169 * Compares two real numbers of type float. |
207 * Compares two real numbers of type float. |
170 * @param f1 pointer to float one |
208 * @param f1 pointer to float one |
171 * @param f2 pointer to float two |
209 * @param f2 pointer to float two |
172 * @param data if provided: a pointer to precision (default: 1e-6f) |
210 * @param data if provided: a pointer to precision (default: 1e-6f) |
173 * @return -1, if *f1 is less than *f2, 0 if both are equal, |
211 * @return -1, if *f1 is less than *f2, 0 if both are equal, |
174 * 1 if *f1 is greater than *f2 |
212 * 1 if *f1 is greater than *f2 |
175 */ |
213 */ |
176 |
214 |
177 int ucx_floatcmp(const void *f1, const void *f2, void *data); |
215 int ucx_cmp_float(const void *f1, const void *f2, void *data); |
178 |
216 |
179 /** |
217 /** |
180 * Compares two real numbers of type double. |
218 * Compares two real numbers of type double. |
181 * @param d1 pointer to double one |
219 * @param d1 pointer to double one |
182 * @param d2 pointer to double two |
220 * @param d2 pointer to double two |
183 * @param data if provided: a pointer to precision (default: 1e-14) |
221 * @param data if provided: a pointer to precision (default: 1e-14) |
184 * @return -1, if *d1 is less than *d2, 0 if both are equal, |
222 * @return -1, if *d1 is less than *d2, 0 if both are equal, |
185 * 1 if *d1 is greater than *d2 |
223 * 1 if *d1 is greater than *d2 |
186 */ |
224 */ |
187 int ucx_doublecmp(const void *d1, const void *d2, void *data); |
225 int ucx_cmp_double(const void *d1, const void *d2, void *data); |
188 |
226 |
189 /** |
227 /** |
190 * Compares two pointers. |
228 * Compares two pointers. |
191 * @param ptr1 pointer one |
229 * @param ptr1 pointer one |
192 * @param ptr2 pointer two |
230 * @param ptr2 pointer two |
193 * @param data omitted |
231 * @param data omitted |
194 * @return -1 if ptr1 is less than ptr2, 0 if both are equal, |
232 * @return -1 if ptr1 is less than ptr2, 0 if both are equal, |
195 * 1 if ptr1 is greater than ptr2 |
233 * 1 if ptr1 is greater than ptr2 |
196 */ |
234 */ |
197 int ucx_ptrcmp(const void *ptr1, const void *ptr2, void *data); |
235 int ucx_cmp_ptr(const void *ptr1, const void *ptr2, void *data); |
198 |
236 |
199 /** |
237 /** |
200 * Compares two memory areas. |
238 * Compares two memory areas. |
201 * @param ptr1 pointer one |
239 * @param ptr1 pointer one |
202 * @param ptr2 pointer two |
240 * @param ptr2 pointer two |
203 * @param n a pointer to the size_t containing the third parameter for memcmp |
241 * @param n a pointer to the size_t containing the third parameter for memcmp |
204 * @return the result of memcmp(ptr1, ptr2, *n) |
242 * @return the result of memcmp(ptr1, ptr2, *n) |
205 */ |
243 */ |
206 int ucx_memcmp(const void *ptr1, const void *ptr2, void *n); |
244 int ucx_cmp_mem(const void *ptr1, const void *ptr2, void *n); |
207 |
245 |
208 /** |
246 /** |
209 * A <code>printf()</code> like function which writes the output to a stream by |
247 * A <code>printf()</code> like function which writes the output to a stream by |
210 * using a write_func(). |
248 * using a write_func(). |
211 * @param stream the stream the data is written to |
249 * @param stream the stream the data is written to |