1 /* Word breaks in Unicode strings. 2 Copyright (C) 2001-2003, 2005-2018 Free Software Foundation, Inc. 3 Written by Bruno Haible <bruno@clisp.org>, 2009. 4 5 This program is free software: you can redistribute it and/or 6 modify it under the terms of either: 7 8 * the GNU Lesser General Public License as published by the Free 9 Software Foundation; either version 3 of the License, or (at your 10 option) any later version. 11 12 or 13 14 * the GNU General Public License as published by the Free 15 Software Foundation; either version 2 of the License, or (at your 16 option) any later version. 17 18 or both in parallel, as here. 19 This program is distributed in the hope that it will be useful, 20 but WITHOUT ANY WARRANTY; without even the implied warranty of 21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 Lesser General Public License for more details. 23 24 You should have received a copy of the GNU Lesser General Public License 25 along with this program. If not, see <https://www.gnu.org/licenses/>. */ 26 27 #ifndef _UNIWBRK_H 28 #define _UNIWBRK_H 29 30 /* Get size_t. */ 31 #include <stddef.h> 32 33 #include "unitypes.h" 34 35 36 #ifdef __cplusplus 37 extern "C" { 38 #endif 39 40 /* ========================================================================= */ 41 42 /* Property defined in Unicode Standard Annex #29, section "Word Boundaries" 43 <http://www.unicode.org/reports/tr29/#Word_Boundaries> */ 44 45 /* Possible values of the Word_Break property. 46 This enumeration may be extended in the future. */ 47 enum 48 { 49 WBP_OTHER = 0, 50 WBP_CR = 11, 51 WBP_LF = 12, 52 WBP_NEWLINE = 10, 53 WBP_EXTEND = 8, 54 WBP_FORMAT = 9, 55 WBP_KATAKANA = 1, 56 WBP_ALETTER = 2, 57 WBP_MIDNUMLET = 3, 58 WBP_MIDLETTER = 4, 59 WBP_MIDNUM = 5, 60 WBP_NUMERIC = 6, 61 WBP_EXTENDNUMLET = 7, 62 WBP_RI = 13, 63 WBP_DQ = 14, 64 WBP_SQ = 15, 65 WBP_HL = 16, 66 WBP_ZWJ = 17, 67 WBP_EB = 18, 68 WBP_EM = 19, 69 WBP_GAZ = 20, 70 WBP_EBG = 21 71 }; 72 73 /* Return the Word_Break property of a Unicode character. */ 74 extern int 75 uc_wordbreak_property (ucs4_t uc) 76 _UC_ATTRIBUTE_CONST; 77 78 /* ========================================================================= */ 79 80 /* Word breaks. */ 81 82 /* Determine the word break points in S, and store the result at p[0..n-1]. 83 p[i] = 1 means that there is a word boundary between s[i-1] and s[i]. 84 p[i] = 0 means that s[i-1] and s[i] must not be separated. 85 */ 86 extern void 87 u8_wordbreaks (const uint8_t *s, size_t n, char *p); 88 extern void 89 u16_wordbreaks (const uint16_t *s, size_t n, char *p); 90 extern void 91 u32_wordbreaks (const uint32_t *s, size_t n, char *p); 92 extern void 93 ulc_wordbreaks (const char *s, size_t n, char *p); 94 95 /* ========================================================================= */ 96 97 #ifdef __cplusplus 98 } 99 #endif 100 101 102 #endif /* _UNIWBRK_H */ 103