Guardian Native C Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)
Guardian Native C Library Calls (t - z) wcsxfrm(3)
NAME
wcsxfrm - Transforms wide character strings for collation in the current locale
LIBRARY
G-series native Guardian processes: $SYSTEM.SYSnn.ZCRTLSRL
G-series native OSS processes: /G/system/sysnn/zcrtlsrl
H-series and J-series native Guardian processes: $SYSTEM.ZDLLnnn.ZCRTLDLL
32-bit H-series and J-series OSS processes: /G/system/zdllnnn/zcrtldll
64-bit H-series and J-series OSS processes: /G/system/zdllnnn/ycrtldll
SYNOPSIS
#include <wchar.h>
size_t wcsxfrm(
wchar_t *ws1,
const wchar_t *ws2,
size_t n);
PARAMETERS
ws1 Contains a pointer to the destination wide-character string.
ws2 Contains a pointer to the source wide-character string.
n Specifies the maximum number of wide-character codes to place into the array
specified by ws1.
DESCRIPTION
The wcsxfrm() function is used to transform the wide-character string specified by the ws2
parameter into a string of wide-character codes based on the collation values of the wide charac-
ters in the current locale setting as specified by the LC_COLLATE category. No more than the
number of wide characters specified by the n parameter are copied into the array specified by the
ws1 parameter. This transformation is such that when two such transformed wide-character
strings are obtained and the transformed strings are compared using the wcscmp() function, the
result obtained would be same as would be obtained by a direct call to the wcscoll() function on
the two original wide-character strings.
When operating on overlapping strings, the behavior of this function is unreliable.
NOTES
If you are doing multiple comparisons based on the current locale’s collation values using the
same set of text strings, the wcsxfrm() transformation function in conjunction with the
wcscmp() function may be more efficient than using the wcscoll() collation function because the
string is transformed based on the locale tables only once. However, the transformation function
must convert all characters in the string for each level of a multi-level collation. In comparison,
the collation function stops comparing characters at the first inequality. These efficiency
tradeoffs make the most efficient method for a specific application dependent on the number of
repeated comparisons of strings within the set, the number of collation levels for the current
locale, and the values of the strings within the set.
RETURN VALUES
If the ws1 parameter is a wide-character null pointer, the wcsxfrm() function returns the number
of wide-character elements (not including the terminating null wide character) required to store
the transformed wide-character string. If the count specified by the n parameter is sufficient to
hold the transformed string in the ws1 parameter (including the terminating null wide character)
the return value is set to the actual number of wide-character elements placed in the ws1 parame-
ter, not including the terminating null wide character. If the return value is equal to or greater
than the value specified by the n parameter, the contents of the array pointed to by the ws1
parameter are indeterminate. This occurs whenever the value specified by the n parameter is too
527192-018 Hewlett-Packard Company 7−183