Forgot gunibreak.c, mistake in ChangeLog
[platform/upstream/glib.git] / glib / gunibreak.c
1 /* gunibreak.c - line break properties
2  *
3  *  Copyright 2000 Red Hat, Inc.
4  *
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.
9  *
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.
14  *
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.
19  */
20
21 #include "glib.h"
22 #include "gunibreak.h"
23
24 #include <config.h>
25
26 #include <stdlib.h>
27
28
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]))
35
36 #define PROP(Char) (((Char) > (G_UNICODE_LAST_CHAR)) ? G_UNICODE_UNASSIGNED : TPROP ((Char) >> 8, (Char) & 0xff))
37
38 GUnicodeBreakType
39 g_unichar_break_type (gunichar c)
40 {
41   return PROP (c);
42 }