Increase the timeout for some GLib tests
[glib.git] / glib / gunibreak.c
blob334acd3d420097651008765175f46b94c821b6a1
1 /* gunibreak.c - line break properties
3 * Copyright 2000 Red Hat, Inc.
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This 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 License
16 * along with this library; if not, see <http://www.gnu.org/licenses/>.
19 #include "config.h"
21 #include <stdlib.h>
23 #include "gunibreak.h"
25 #define TPROP_PART1(Page, Char) \
26 ((break_property_table_part1[Page] >= G_UNICODE_MAX_TABLE_INDEX) \
27 ? (break_property_table_part1[Page] - G_UNICODE_MAX_TABLE_INDEX) \
28 : (break_property_data[break_property_table_part1[Page]][Char]))
30 #define TPROP_PART2(Page, Char) \
31 ((break_property_table_part2[Page] >= G_UNICODE_MAX_TABLE_INDEX) \
32 ? (break_property_table_part2[Page] - G_UNICODE_MAX_TABLE_INDEX) \
33 : (break_property_data[break_property_table_part2[Page]][Char]))
35 #define PROP(Char) \
36 (((Char) <= G_UNICODE_LAST_CHAR_PART1) \
37 ? TPROP_PART1 ((Char) >> 8, (Char) & 0xff) \
38 : (((Char) >= 0xe0000 && (Char) <= G_UNICODE_LAST_CHAR) \
39 ? TPROP_PART2 (((Char) - 0xe0000) >> 8, (Char) & 0xff) \
40 : G_UNICODE_BREAK_UNKNOWN))
42 /**
43 * g_unichar_break_type:
44 * @c: a Unicode character
46 * Determines the break type of @c. @c should be a Unicode character
47 * (to derive a character from UTF-8 encoded text, use
48 * g_utf8_get_char()). The break type is used to find word and line
49 * breaks ("text boundaries"), Pango implements the Unicode boundary
50 * resolution algorithms and normally you would use a function such
51 * as pango_break() instead of caring about break types yourself.
53 * Returns: the break type of @c
54 **/
55 GUnicodeBreakType
56 g_unichar_break_type (gunichar c)
58 return PROP (c);