22 #ifndef _LDAP_PVT_UC_H
23 #define _LDAP_PVT_UC_H 1
29 #include "liblunicode/ucdata/ucdata.h"
31 #include "../libraries/liblunicode/ucdata/ucdata.h"
41 typedef ac_uint4 ldap_unicode_t;
44 LDAP_F(
int ) ldap_ucs_to_utf8s LDAP_P((
49 LDAP_F (ber_len_t) ldap_utf8_bytes( const
char * );
51 LDAP_F (ber_len_t) ldap_utf8_chars( const
char * );
53 LDAP_F (
int) ldap_utf8_offset( const
char * );
55 LDAP_F (
int) ldap_utf8_charlen( const
char * );
60 LDAP_F (
int) ldap_utf8_charlen2( const
char * );
63 LDAP_F (
int) ldap_utf8_copy(
char *, const
char *);
66 LDAP_F (
char*) ldap_utf8_next( const
char * );
68 LDAP_F (
char*) ldap_utf8_prev( const
char * );
71 LDAP_F (
int) ldap_utf8_isascii( const
char * );
72 LDAP_F (
int) ldap_utf8_isalpha( const
char * );
73 LDAP_F (
int) ldap_utf8_isalnum( const
char * );
74 LDAP_F (
int) ldap_utf8_isdigit( const
char * );
75 LDAP_F (
int) ldap_utf8_isxdigit( const
char * );
76 LDAP_F (
int) ldap_utf8_isspace( const
char * );
79 LDAP_F (ber_len_t) ldap_utf8_strcspn( const
char* str, const
char *set);
81 LDAP_F (ber_len_t) ldap_utf8_strspn( const
char* str, const
char *set);
83 LDAP_F (
char *) ldap_utf8_strchr( const
char* str, const
char *chr);
85 LDAP_F (
char *) ldap_utf8_strpbrk( const
char* str, const
char *set);
87 LDAP_F (
char*) ldap_utf8_strtok(
char* sp, const
char* sep,
char **last);
90 LDAP_V (const
char) ldap_utf8_lentab[128];
91 LDAP_V (const
char) ldap_utf8_mintab[32];
93 #define LDAP_UTF8_ISASCII(p) ( !(*(const unsigned char *)(p) & 0x80 ) )
94 #define LDAP_UTF8_CHARLEN(p) ( LDAP_UTF8_ISASCII(p) \
95 ? 1 : ldap_utf8_lentab[*(const unsigned char *)(p) ^ 0x80] )
101 #define LDAP_UTF8_CHARLEN2(p, l) ( ( ( l = LDAP_UTF8_CHARLEN( p )) < 3 || \
102 ( ldap_utf8_mintab[*(const unsigned char *)(p) & 0x1f] & (p)[1] ) ) ? \
105 #define LDAP_UTF8_OFFSET(p) ( LDAP_UTF8_ISASCII(p) \
106 ? 1 : ldap_utf8_offset((p)) )
108 #define LDAP_UTF8_COPY(d,s) ( LDAP_UTF8_ISASCII(s) \
109 ? (*(d) = *(s), 1) : ldap_utf8_copy((d),(s)) )
111 #define LDAP_UTF8_NEXT(p) ( LDAP_UTF8_ISASCII(p) \
112 ? (char *)(p)+1 : ldap_utf8_next((p)) )
114 #define LDAP_UTF8_INCR(p) ((p) = LDAP_UTF8_NEXT(p))
117 #define LDAP_UTF8_PREV(p) (ldap_utf8_prev((p)))
118 #define LDAP_UTF8_DECR(p) ((p)=LDAP_UTF8_PREV((p)))
122 LDAP_LUNICODE_F(
int) ucstrncmp(
123 const ldap_unicode_t *,
124 const ldap_unicode_t *,
127 LDAP_LUNICODE_F(
int) ucstrncasecmp(
128 const ldap_unicode_t *,
129 const ldap_unicode_t *,
132 LDAP_LUNICODE_F(ldap_unicode_t *) ucstrnchr(
133 const ldap_unicode_t *,
137 LDAP_LUNICODE_F(ldap_unicode_t *) ucstrncasechr(
138 const ldap_unicode_t *,
142 LDAP_LUNICODE_F(
void) ucstr2upper(
146 #define LDAP_UTF8_NOCASEFOLD 0x0U
147 #define LDAP_UTF8_CASEFOLD 0x1U
148 #define LDAP_UTF8_ARG1NFC 0x2U
149 #define LDAP_UTF8_ARG2NFC 0x4U
150 #define LDAP_UTF8_APPROX 0x8U
152 LDAP_LUNICODE_F(
struct berval *) UTF8bvnormalize(
158 LDAP_LUNICODE_F(
int) UTF8bvnormcmp(