Partly revert "gio: Add filename type annotations"
[glib.git] / glib / gunibreak.c
blob8fcd4de3649178fd4469b4343ad85f3a7a5b3b03
1 /* gunibreak.c - line break properties
3 * Copyright 2000 Red Hat, Inc.
5 * The Gnome Library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public License as
7 * published by the Free Software Foundation; either version 2 of the
8 * License, or (at your option) any later version.
10 * The Gnome Library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with the Gnome Library; see the file COPYING.LIB. If not,
17 * see <http://www.gnu.org/licenses/>.
20 #include "config.h"
22 #include <stdlib.h>
24 #include "gunibreak.h"
26 #define TPROP_PART1(Page, Char) \
27 ((break_property_table_part1[Page] >= G_UNICODE_MAX_TABLE_INDEX) \
28 ? (break_property_table_part1[Page] - G_UNICODE_MAX_TABLE_INDEX) \
29 : (break_property_data[break_property_table_part1[Page]][Char]))
31 #define TPROP_PART2(Page, Char) \
32 ((break_property_table_part2[Page] >= G_UNICODE_MAX_TABLE_INDEX) \
33 ? (break_property_table_part2[Page] - G_UNICODE_MAX_TABLE_INDEX) \
34 : (break_property_data[break_property_table_part2[Page]][Char]))
36 #define PROP(Char) \
37 (((Char) <= G_UNICODE_LAST_CHAR_PART1) \
38 ? TPROP_PART1 ((Char) >> 8, (Char) & 0xff) \
39 : (((Char) >= 0xe0000 && (Char) <= G_UNICODE_LAST_CHAR) \
40 ? TPROP_PART2 (((Char) - 0xe0000) >> 8, (Char) & 0xff) \
41 : G_UNICODE_BREAK_UNKNOWN))
43 /**
44 * g_unichar_break_type:
45 * @c: a Unicode character
47 * Determines the break type of @c. @c should be a Unicode character
48 * (to derive a character from UTF-8 encoded text, use
49 * g_utf8_get_char()). The break type is used to find word and line
50 * breaks ("text boundaries"), Pango implements the Unicode boundary
51 * resolution algorithms and normally you would use a function such
52 * as pango_break() instead of caring about break types yourself.
54 * Returns: the break type of @c
55 **/
56 GUnicodeBreakType
57 g_unichar_break_type (gunichar c)
59 return PROP (c);