1 /* Grapheme cluster breaks function.
2 Copyright (C) 2001-2003, 2006-2011 Free Software Foundation, Inc.
3 Written by Ben Pfaff <blp@cs.stanford.edu>, 2010,
4 based on code written by Bruno Haible <bruno@clisp.org>, 2009.
6 This program is free software: you can redistribute it and/or modify it
7 under the terms of the GNU Lesser General Public License as published
8 by the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
27 u8_grapheme_breaks (const uint8_t *s, size_t n, char *p)
33 for (; n > 0; s += mblen, p += mblen, n -= mblen)
38 mblen = u8_mbtouc (&next, s, n);
40 p[0] = uc_is_grapheme_break (prev, next);
41 for (i = 1; i < mblen; i++)