Add @G_THREAD_CFLAGS@ to Cflags.
[glib.git] / gunibreak.c
blob4f329599377df0917860add5503b27417fb02b8a
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 * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
21 #include "glib.h"
22 #include "gunibreak.h"
24 #include <config.h>
26 #include <stdlib.h>
29 /* We cheat a bit and cast type values to (char *). We detect these
30 using the &0xff trick. */
31 #define TPROP(Page, Char) \
32 (((GPOINTER_TO_INT(break_property_table[Page]) & 0xff) == GPOINTER_TO_INT(break_property_table[Page])) \
33 ? GPOINTER_TO_INT(break_property_table[Page]) \
34 : (break_property_table[Page][Char]))
36 #define PROP(Char) (((Char) > (G_UNICODE_LAST_CHAR)) ? G_UNICODE_UNASSIGNED : TPROP ((Char) >> 8, (Char) & 0xff))
38 /**
39 * g_unichar_break_type:
40 * @c: a Unicode character
42 * Determines the break type of @c. @c should be a Unicode character
43 * (to derive a character from UTF-8 encoded text, use
44 * g_utf8_get_char()). The break type is used to find word and line
45 * breaks ("text boundaries"), Pango implements the Unicode boundary
46 * resolution alogorithms and normally you would use a function such
47 * as pango_break() instead of caring about break types yourself.
49 * Return value: break type
50 **/
51 GUnicodeBreakType
52 g_unichar_break_type (gunichar c)
54 return PROP (c);