sl@0: /* sl@0: ******************************************************************************* sl@0: * sl@0: * Copyright (C) 2003, International Business Machines sl@0: * Corporation and others. All Rights Reserved. sl@0: * sl@0: ******************************************************************************* sl@0: * file name: uarrsort.h sl@0: * encoding: US-ASCII sl@0: * tab size: 8 (not used) sl@0: * indentation:4 sl@0: * sl@0: * created on: 2003aug04 sl@0: * created by: Markus W. Scherer sl@0: * sl@0: * Internal function for sorting arrays. sl@0: */ sl@0: sl@0: #ifndef __UARRSORT_H__ sl@0: #define __UARRSORT_H__ sl@0: sl@0: #include "unicode/utypes.h" sl@0: sl@0: U_CDECL_BEGIN sl@0: /** sl@0: * Function type for comparing two items as part of sorting an array or similar. sl@0: * Callback function for uprv_sortArray(). sl@0: * sl@0: * @param context Application-specific pointer, passed through by uprv_sortArray(). sl@0: * @param left Pointer to the "left" item. sl@0: * @param right Pointer to the "right" item. sl@0: * @return 32-bit signed integer comparison result: sl@0: * <0 if left0 if left>right sl@0: * sl@0: * @internal sl@0: */ sl@0: typedef int32_t U_CALLCONV sl@0: UComparator(const void *context, const void *left, const void *right); sl@0: U_CDECL_END sl@0: sl@0: /** sl@0: * Array sorting function. sl@0: * Uses a UComparator for comparing array items to each other, and simple sl@0: * memory copying to move items. sl@0: * sl@0: * @param array The array to be sorted. sl@0: * @param length The number of items in the array. sl@0: * @param itemSize The size in bytes of each array item. sl@0: * @param cmp UComparator function used to compare two items each. sl@0: * @param context Application-specific pointer, passed through to the UComparator. sl@0: * @param sortStable If true, a stable sorting algorithm must be used. sl@0: * @param pErrorCode ICU in/out UErrorCode parameter. sl@0: * sl@0: * @internal sl@0: */ sl@0: U_CAPI void U_EXPORT2 sl@0: uprv_sortArray(void *array, int32_t length, int32_t itemSize, sl@0: UComparator *cmp, const void *context, sl@0: UBool sortStable, UErrorCode *pErrorCode); sl@0: sl@0: /** sl@0: * Convenience UComparator implementation for uint16_t arrays. sl@0: * @internal sl@0: */ sl@0: U_CAPI int32_t U_EXPORT2 sl@0: uprv_uint16Comparator(const void *context, const void *left, const void *right); sl@0: sl@0: /** sl@0: * Convenience UComparator implementation for int32_t arrays. sl@0: * @internal sl@0: */ sl@0: U_CAPI int32_t U_EXPORT2 sl@0: uprv_int32Comparator(const void *context, const void *left, const void *right); sl@0: sl@0: /** sl@0: * Convenience UComparator implementation for uint32_t arrays. sl@0: * @internal sl@0: */ sl@0: U_CAPI int32_t U_EXPORT2 sl@0: uprv_uint32Comparator(const void *context, const void *left, const void *right); sl@0: sl@0: #endif