utf8n.h (fbc59d65059ecfea8b746715e920c325cc16cede) | utf8n.h (6ca99ce756c27852d1ea1e555045de1c920f30ed) |
---|---|
1/* SPDX-License-Identifier: GPL-2.0-only */ 2/* 3 * Copyright (c) 2014 SGI. 4 * All rights reserved. 5 */ 6 7#ifndef UTF8NORM_H 8#define UTF8NORM_H --- 25 unchanged lines hidden (view full) --- 34extern const struct utf8data *utf8nfdicf(unsigned int maxage); 35 36/* 37 * Determine the length of the normalized from of the string, 38 * excluding any terminating NULL byte. 39 * Returns 0 if only ignorable code points are present. 40 * Returns -1 if the input is not valid UTF-8. 41 */ | 1/* SPDX-License-Identifier: GPL-2.0-only */ 2/* 3 * Copyright (c) 2014 SGI. 4 * All rights reserved. 5 */ 6 7#ifndef UTF8NORM_H 8#define UTF8NORM_H --- 25 unchanged lines hidden (view full) --- 34extern const struct utf8data *utf8nfdicf(unsigned int maxage); 35 36/* 37 * Determine the length of the normalized from of the string, 38 * excluding any terminating NULL byte. 39 * Returns 0 if only ignorable code points are present. 40 * Returns -1 if the input is not valid UTF-8. 41 */ |
42extern ssize_t utf8nlen(const struct utf8data *data, const char *s, size_t len); | 42ssize_t utf8nlen(const struct unicode_map *um, enum utf8_normalization n, 43 const char *s, size_t len); |
43 44/* Needed in struct utf8cursor below. */ 45#define UTF8HANGULLEAF (12) 46 47/* 48 * Cursor structure used by the normalizer. 49 */ 50struct utf8cursor { | 44 45/* Needed in struct utf8cursor below. */ 46#define UTF8HANGULLEAF (12) 47 48/* 49 * Cursor structure used by the normalizer. 50 */ 51struct utf8cursor { |
51 const struct utf8data *data; | 52 const struct unicode_map *um; 53 enum utf8_normalization n; |
52 const char *s; 53 const char *p; 54 const char *ss; 55 const char *sp; 56 unsigned int len; 57 unsigned int slen; 58 short int ccc; 59 short int nccc; 60 unsigned char hangul[UTF8HANGULLEAF]; 61}; 62 63/* 64 * Initialize a utf8cursor to normalize a string. 65 * Returns 0 on success. 66 * Returns -1 on failure. 67 */ | 54 const char *s; 55 const char *p; 56 const char *ss; 57 const char *sp; 58 unsigned int len; 59 unsigned int slen; 60 short int ccc; 61 short int nccc; 62 unsigned char hangul[UTF8HANGULLEAF]; 63}; 64 65/* 66 * Initialize a utf8cursor to normalize a string. 67 * Returns 0 on success. 68 * Returns -1 on failure. 69 */ |
68extern int utf8ncursor(struct utf8cursor *u8c, const struct utf8data *data, 69 const char *s, size_t len); | 70int utf8ncursor(struct utf8cursor *u8c, const struct unicode_map *um, 71 enum utf8_normalization n, const char *s, size_t len); |
70 71/* 72 * Get the next byte in the normalization. 73 * Returns a value > 0 && < 256 on success. 74 * Returns 0 when the end of the normalization is reached. 75 * Returns -1 if the string being normalized is not valid UTF-8. 76 */ 77extern int utf8byte(struct utf8cursor *u8c); 78 79#endif /* UTF8NORM_H */ | 72 73/* 74 * Get the next byte in the normalization. 75 * Returns a value > 0 && < 256 on success. 76 * Returns 0 when the end of the normalization is reached. 77 * Returns -1 if the string being normalized is not valid UTF-8. 78 */ 79extern int utf8byte(struct utf8cursor *u8c); 80 81#endif /* UTF8NORM_H */ |