Skip Navigation Links | |
Exit Print View | |
man pages section 9: DDI and DKI Kernel Functions Oracle Solaris 11.1 Information Library |
csx_AccessConfigurationRegister(9F)
csx_Parse_CISTPL_BYTEORDER(9F)
csx_Parse_CISTPL_CFTABLE_ENTRY(9F)
csx_Parse_CISTPL_DEVICEGEO(9F)
csx_Parse_CISTPL_DEVICEGEO_A(9F)
csx_Parse_CISTPL_DEVICE_OA(9F)
csx_Parse_CISTPL_DEVICE_OC(9F)
csx_Parse_CISTPL_LINKTARGET(9F)
csx_Parse_CISTPL_LONGLINK_A(9F)
csx_Parse_CISTPL_LONGLINK_C(9F)
csx_Parse_CISTPL_LONGLINK_MFC(9F)
ddi_get_soft_iblock_cookie(9F)
ddi_intr_get_supported_types(9F)
ddi_prop_lookup_byte_array(9F)
ddi_prop_lookup_int64_array(9F)
ddi_prop_lookup_string_array(9F)
ddi_prop_update_byte_array(9F)
ddi_prop_update_int64_array(9F)
ddi_prop_update_string_array(9F)
ldi_prop_lookup_byte_array(9F)
ldi_prop_lookup_int64_array(9F)
ldi_prop_lookup_string_array(9F)
mac_prop_info_set_default_link_flowctrl(9F)
mac_prop_info_set_default_str(9F)
mac_prop_info_set_default_uint8(9F)
mac_prop_info_set_range_uint32(9F)
net_event_notify_unregister(9F)
net_instance_notify_register(9F)
net_instance_notify_unregister(9F)
net_instance_protocol_unregister(9F)
net_protocol_notify_register(9F)
nvlist_lookup_boolean_array(9F)
nvlist_lookup_boolean_value(9F)
nvlist_lookup_nvlist_array(9F)
nvlist_lookup_string_array(9F)
nvlist_lookup_uint16_array(9F)
nvlist_lookup_uint32_array(9F)
nvlist_lookup_uint64_array(9F)
nvpair_value_boolean_array(9F)
pci_plist_lookup_int16_array(9F)
pci_plist_lookup_int32_array(9F)
pci_plist_lookup_int64_array(9F)
pci_plist_lookup_int8_array(9F)
pci_plist_lookup_string_array(9F)
pci_plist_lookup_uint16_array(9F)
pci_plist_lookup_uint32_array(9F)
pci_plist_lookup_uint64_array(9F)
pci_plist_lookup_uint8_array(9F)
scsi_get_device_type_scsi_options(9F)
scsi_get_device_type_string(9F)
scsi_sense_cmdspecific_uint64(9F)
usb_get_current_frame_number(9F)
usb_get_max_pkts_per_isoc_request(9F)
usb_pipe_get_max_bulk_transfer_size(9F)
usb_pipe_stop_intr_polling(9F)
usb_pipe_stop_isoc_polling(9F)
- string-based UTF-8 text preparation function
#include <sys/types.h> #include <sys/errno.h> #include <sys/sunddi.h> size_t u8_textprep_str(char *inarray, size_t *inlen, char *outarray, size_t *outlen, int flag, size_t unicode_version, int *errno);
Solaris DDI specific (Solaris DDI)
A pointer to a byte array containing a sequence of UTF-8 character bytes to be prepared.
As input argument, the number of bytes to be prepared in inarray. As output argument, the number of bytes in inarray still not consumed.
A pointer to a byte array where prepared UTF-8 character bytes can be saved.
As input argument, the number of available bytes at outarray where prepared character bytes can be saved. As output argument, after the conversion, the number of bytes still available at outarray.
The possible preparation options constructed by a bitwise-inclusive-OR of the following values:
Normally u8_textprep_str() stops the preparation if it encounters null byte even if the current inlen is pointing to a value bigger than zero.
With this option, null byte does not stop the preparation and the preparation continues until inlen specified amount of inarray bytes are all consumed for preparation or an error happened.
Normally u8_textprep_str() stops the preparation if it encounters illegal or incomplete characters with corresponding errno values.
When this option is set, u8_textprep_str() does not stop the preparation and instead treats such characters as no need to do any preparation.
Map lowercase characters to uppercase characters if applicable.
Map uppercase characters to lowercase characters if applicable.
Apply Unicode Normalization Form D.
Apply Unicode Normalization Form C.
Apply Unicode Normalization Form KD.
Apply Unicode Normalization Form KC.
Only one case folding option is allowed. Only one Unicode Normalization option is allowed.
When a case folding option and a Unicode Normalization option are specified together, UTF-8 text preparation is done by doing case folding first and then Unicode Normalization.
If no option is specified, no processing occurs except the simple copying of bytes from input to output.
The version of Unicode data that should be used during UTF-8 text preparation. The following values are supported:
Use Unicode 3.2.0 data during comparison.
Use Unicode 5.0.0 data during comparison.
Use the latest Unicode version data available which is Unicode 5.0.0 currently.
The error value when preparation is not completed or fails. The following values are supported:
Text preparation stopped due to lack of space in the output array.
Specified option values are conflicting and cannot be supported.
Text preparation stopped due to an input byte that does not belong to UTF-8.
Text preparation stopped due to an incomplete UTF-8 character at the end of the input array.
The specified Unicode version value is not a supported version.
The u8_textprep_str() function prepares the sequence of UTF-8 characters in the array specified by inarray into a sequence of corresponding UTF-8 characters prepared in the array specified by outarray. The inarray argument points to a character byte array to the first character in the input array and inlen indicates the number of bytes to the end of the array to be converted. The outarray argument points to a character byte array to the first available byte in the output array and outlen indicates the number of the available bytes to the end of the array. Unless flag is U8_TEXTPREP_IGNORE_NULL, u8_textprep_str() normally stops when it encounters a null byte from the input array regardless of the current inlen value.
If flag is U8_TEXTPREP_IGNORE_INVALID and a sequence of input bytes does not form a valid UTF-8 character, preparation stops after the previous successfully prepared character. If flag is U8_TEXTPREP_IGNORE_INVALID and the input array ends with an incomplete UTF-8 character, preparation stops after the previous successfully prepared bytes. If the output array is not large enough to hold the entire prepared text, preparation stops just prior to the input bytes that would cause the output array to overflow. The value pointed to by inlen is decremented to reflect the number of bytes still not prepared in the input array. The value pointed to by outlen is decremented to reflect the number of bytes still available in the output array.
The u8_textprep_str() function updates the values pointed to by inlen and outlen arguments to reflect the extent of the preparation. When U8_TEXTPREP_IGNORE_INVALID is specified, u8_textprep_str() returns the number of illegal or incomplete characters found during the text preparation. When U8_TEXTPREP_IGNORE_INVALID is not specified and the text preparation is successful, the function returns 0. If the entire string in the input array is prepared, the value pointed to by inlen will be 0. If the text preparation is stopped due to any conditions mentioned above, the value pointed to by inlen will be non-zero and errno is set to indicate the error. If such and any other error occurs, u8_textprep_str() returns (size_t)-1 and sets errno to indicate the error.
The u8_textprep_str() function can be called from user or interrupt context.
Example 1 Simple UTF-8 text preparation
#include <sys/types.h> #include <sys/errno.h> #include <sys/sunddi.h> . . . size_t ret; char ib[MAXPATHLEN]; char ob[MAXPATHLEN]; size_t il, ol; int err; . . . /* * We got a UTF-8 pathname from somewhere. * * Calculate the length of input string including the terminating * NULL byte and prepare other arguments. */ (void) strlcpy(ib, pathname, MAXPATHLEN); il = strlen(ib) + 1; ol = MAXPATHLEN; /* * Do toupper case folding, apply Unicode Normalization Form D, * ignore NULL byte, and ignore any illegal/incomplete characters. */ ret = u8_textprep_str(ib, &il, ob, &ol, (U8_TEXTPREP_IGNORE_NULL|U8_TEXTPREP_IGNORE_INVALID| U8_TEXTPREP_TOUPPER|U8_TEXTPREP_NFD), U8_UNICODE_LATEST, &err); if (ret == (size_t)-1) { if (err == E2BIG) return (-1); if (err == EBADF) return (-2); if (err == ERANGE) return (-3); return (-4); }
See attributes(5) for descriptions of the following attributes:
|
u8_strcmp(3C), u8_textprep_str(3C), u8_validate(3C), attributes(5), u8_strcmp(9F), u8_validate(9F), uconv_u16tou32(9F)