1185029Spjd/* 2185029Spjd * CDDL HEADER START 3185029Spjd * 4185029Spjd * The contents of this file are subject to the terms of the 5185029Spjd * Common Development and Distribution License (the "License"). 6185029Spjd * You may not use this file except in compliance with the License. 7185029Spjd * 8185029Spjd * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9185029Spjd * or http://www.opensolaris.org/os/licensing. 10185029Spjd * See the License for the specific language governing permissions 11185029Spjd * and limitations under the License. 12185029Spjd * 13185029Spjd * When distributing Covered Code, include this CDDL HEADER in each 14185029Spjd * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15185029Spjd * If applicable, add the following below this CDDL HEADER, with the 16185029Spjd * fields enclosed by brackets "[]" replaced with your own identifying 17185029Spjd * information: Portions Copyright [yyyy] [name of copyright owner] 18185029Spjd * 19185029Spjd * CDDL HEADER END 20185029Spjd */ 21185029Spjd/* 22185029Spjd * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 23185029Spjd * Use is subject to license terms. 24185029Spjd */ 25185029Spjd 26185029Spjd#ifndef _SYS_U8_TEXTPREP_H 27185029Spjd#define _SYS_U8_TEXTPREP_H 28185029Spjd 29185029Spjd#pragma ident "%Z%%M% %I% %E% SMI" 30185029Spjd 31185029Spjd#include <sys/isa_defs.h> 32185029Spjd#include <sys/types.h> 33185029Spjd#include <sys/errno.h> 34185029Spjd 35185029Spjd#ifdef __cplusplus 36185029Spjdextern "C" { 37185029Spjd#endif 38185029Spjd 39219089Spjd#ifdef sun 40185029Spjd/* 41219089Spjd * Unicode encoding conversion functions and their macros. 42219089Spjd */ 43219089Spjd#define UCONV_IN_BIG_ENDIAN 0x0001 44219089Spjd#define UCONV_OUT_BIG_ENDIAN 0x0002 45219089Spjd#define UCONV_IN_SYSTEM_ENDIAN 0x0004 46219089Spjd#define UCONV_OUT_SYSTEM_ENDIAN 0x0008 47219089Spjd#define UCONV_IN_LITTLE_ENDIAN 0x0010 48219089Spjd#define UCONV_OUT_LITTLE_ENDIAN 0x0020 49219089Spjd#define UCONV_IGNORE_NULL 0x0040 50219089Spjd#define UCONV_IN_ACCEPT_BOM 0x0080 51219089Spjd#define UCONV_OUT_EMIT_BOM 0x0100 52219089Spjd 53219089Spjdextern int uconv_u16tou32(const uint16_t *, size_t *, uint32_t *, size_t *, 54219089Spjd int); 55219089Spjdextern int uconv_u16tou8(const uint16_t *, size_t *, uchar_t *, size_t *, int); 56219089Spjdextern int uconv_u32tou16(const uint32_t *, size_t *, uint16_t *, size_t *, 57219089Spjd int); 58219089Spjdextern int uconv_u32tou8(const uint32_t *, size_t *, uchar_t *, size_t *, int); 59219089Spjdextern int uconv_u8tou16(const uchar_t *, size_t *, uint16_t *, size_t *, int); 60219089Spjdextern int uconv_u8tou32(const uchar_t *, size_t *, uint32_t *, size_t *, int); 61219089Spjd#endif /* sun */ 62219089Spjd 63219089Spjd/* 64185029Spjd * UTF-8 text preparation functions and their macros. 65185029Spjd * 66185029Spjd * Among the macros defined, U8_CANON_DECOMP, U8_COMPAT_DECOMP, and 67185029Spjd * U8_CANON_COMP are not public interfaces and must not be used directly 68185029Spjd * at the flag input argument. 69185029Spjd */ 70185029Spjd#define U8_STRCMP_CS (0x00000001) 71185029Spjd#define U8_STRCMP_CI_UPPER (0x00000002) 72185029Spjd#define U8_STRCMP_CI_LOWER (0x00000004) 73185029Spjd 74185029Spjd#define U8_CANON_DECOMP (0x00000010) 75185029Spjd#define U8_COMPAT_DECOMP (0x00000020) 76185029Spjd#define U8_CANON_COMP (0x00000040) 77185029Spjd 78185029Spjd#define U8_STRCMP_NFD (U8_CANON_DECOMP) 79185029Spjd#define U8_STRCMP_NFC (U8_CANON_DECOMP | U8_CANON_COMP) 80185029Spjd#define U8_STRCMP_NFKD (U8_COMPAT_DECOMP) 81185029Spjd#define U8_STRCMP_NFKC (U8_COMPAT_DECOMP | U8_CANON_COMP) 82185029Spjd 83185029Spjd#define U8_TEXTPREP_TOUPPER (U8_STRCMP_CI_UPPER) 84185029Spjd#define U8_TEXTPREP_TOLOWER (U8_STRCMP_CI_LOWER) 85185029Spjd 86185029Spjd#define U8_TEXTPREP_NFD (U8_STRCMP_NFD) 87185029Spjd#define U8_TEXTPREP_NFC (U8_STRCMP_NFC) 88185029Spjd#define U8_TEXTPREP_NFKD (U8_STRCMP_NFKD) 89185029Spjd#define U8_TEXTPREP_NFKC (U8_STRCMP_NFKC) 90185029Spjd 91185029Spjd#define U8_TEXTPREP_IGNORE_NULL (0x00010000) 92185029Spjd#define U8_TEXTPREP_IGNORE_INVALID (0x00020000) 93185029Spjd#define U8_TEXTPREP_NOWAIT (0x00040000) 94185029Spjd 95185029Spjd#define U8_UNICODE_320 (0) 96185029Spjd#define U8_UNICODE_500 (1) 97185029Spjd#define U8_UNICODE_LATEST (U8_UNICODE_500) 98185029Spjd 99185029Spjd#define U8_VALIDATE_ENTIRE (0x00100000) 100185029Spjd#define U8_VALIDATE_CHECK_ADDITIONAL (0x00200000) 101185029Spjd#define U8_VALIDATE_UCS2_RANGE (0x00400000) 102185029Spjd 103185029Spjd#define U8_ILLEGAL_CHAR (-1) 104185029Spjd#define U8_OUT_OF_RANGE_CHAR (-2) 105185029Spjd 106185029Spjdextern int u8_validate(char *, size_t, char **, int, int *); 107185029Spjdextern int u8_strcmp(const char *, const char *, size_t, int, size_t, int *); 108185029Spjdextern size_t u8_textprep_str(char *, size_t *, char *, size_t *, int, size_t, 109185029Spjd int *); 110185029Spjd 111185029Spjd#ifdef __cplusplus 112185029Spjd} 113185029Spjd#endif 114185029Spjd 115185029Spjd#endif /* _SYS_U8_TEXTPREP_H */ 116