openat: don’t close (-1)
[gnulib.git] / lib / uniwbrk.in.h
blob3f95b7abf2a159a89d8ad0225efb8cf29ea77501
1 /* Word breaks in Unicode strings.
2 Copyright (C) 2001-2003, 2005-2024 Free Software Foundation, Inc.
3 Written by Bruno Haible <bruno@clisp.org>, 2009.
5 This file is free software.
6 It is dual-licensed under "the GNU LGPLv3+ or the GNU GPLv2+".
7 You can redistribute it and/or modify it under either
8 - the terms of the GNU Lesser General Public License as published
9 by the Free Software Foundation, either version 3, or (at your
10 option) any later version, or
11 - the terms of the GNU General Public License as published by the
12 Free Software Foundation; either version 2, or (at your option)
13 any later version, or
14 - the same dual license "the GNU LGPLv3+ or the GNU GPLv2+".
16 This file is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 Lesser General Public License and the GNU General Public License
20 for more details.
22 You should have received a copy of the GNU Lesser General Public
23 License and of the GNU General Public License along with this
24 program. If not, see <https://www.gnu.org/licenses/>. */
26 #ifndef _UNIWBRK_H
27 #define _UNIWBRK_H
29 /* Get size_t. */
30 #include <stddef.h>
32 #include "unitypes.h"
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
39 /* ========================================================================= */
41 /* Property defined in Unicode Standard Annex #29, section "Word Boundaries"
42 <https://www.unicode.org/reports/tr29/#Word_Boundaries> */
44 /* Possible values of the Word_Break property.
45 This enumeration may be extended in the future. */
46 enum
48 WBP_OTHER = 0,
49 WBP_CR = 11,
50 WBP_LF = 12,
51 WBP_NEWLINE = 10,
52 WBP_EXTEND = 8,
53 WBP_FORMAT = 9,
54 WBP_KATAKANA = 1,
55 WBP_ALETTER = 2,
56 WBP_MIDNUMLET = 3,
57 WBP_MIDLETTER = 4,
58 WBP_MIDNUM = 5,
59 WBP_NUMERIC = 6,
60 WBP_EXTENDNUMLET = 7,
61 WBP_RI = 13,
62 WBP_DQ = 14,
63 WBP_SQ = 15,
64 WBP_HL = 16,
65 WBP_ZWJ = 17,
66 WBP_EB = 18, /* obsolete */
67 WBP_EM = 19, /* obsolete */
68 WBP_GAZ = 20, /* obsolete */
69 WBP_EBG = 21, /* obsolete */
70 WBP_WSS = 22
73 /* Return the Word_Break property of a Unicode character. */
74 extern int
75 uc_wordbreak_property (ucs4_t uc)
76 _UC_ATTRIBUTE_CONST;
78 /* ========================================================================= */
80 /* Word breaks. */
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.
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 *_UC_RESTRICT p);
95 /* ========================================================================= */
97 #ifdef __cplusplus
99 #endif
102 #endif /* _UNIWBRK_H */