2 * fribidi-bidi-types.c - character bidi types
5 * Behdad Esfahbod, 2001, 2002, 2004
7 * Copyright (C) 2004 Sharif FarsiWeb, Inc.
8 * Copyright (C) 2001,2002 Behdad Esfahbod
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or (at your option) any later version.
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with this library, in a file named COPYING; if not, write to the
22 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23 * Boston, MA 02110-1301, USA
25 * For licensing issues, contact <fribidi.license@gmail.com>.
30 #include <fribidi-bidi-types.h>
32 #include "bidi-types.h"
34 enum FriBidiCharTypeLinearEnum
36 # define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) TYPE,
37 # include "fribidi-bidi-types-list.h"
38 # undef _FRIBIDI_ADD_TYPE
42 #include "bidi-type.tab.i"
44 /* Map FriBidiCharTypeLinearEnum to FriBidiCharType. */
45 static const FriBidiCharType linear_enum_to_char_type[] = {
46 # define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) FRIBIDI_TYPE_##TYPE,
47 # include "fribidi-bidi-types-list.h"
48 # undef _FRIBIDI_ADD_TYPE
51 FRIBIDI_ENTRY FriBidiCharType
52 fribidi_get_bidi_type (
57 return linear_enum_to_char_type[FRIBIDI_GET_BIDI_TYPE (ch)];
61 fribidi_get_bidi_types (
63 const FriBidiChar *str,
64 const FriBidiStrIndex len,
66 FriBidiCharType *btypes
69 register FriBidiStrIndex i = len;
72 *btypes++ = linear_enum_to_char_type[FRIBIDI_GET_BIDI_TYPE (*str)];
77 FRIBIDI_ENTRY const char *
78 fribidi_get_bidi_type_name (
85 # define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) case FRIBIDI_TYPE_##TYPE: return STRINGIZE(TYPE);
86 # define _FRIBIDI_ALL_TYPES
87 # include "fribidi-bidi-types-list.h"
88 # undef _FRIBIDI_ALL_TYPES
89 # undef _FRIBIDI_ADD_TYPE
98 fribidi_char_from_bidi_type (
105 # define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) case FRIBIDI_TYPE_##TYPE: return SYMBOL;
106 # define _FRIBIDI_ALL_TYPES
107 # include "fribidi-bidi-types-list.h"
108 # undef _FRIBIDI_ALL_TYPES
109 # undef _FRIBIDI_ADD_TYPE
117 /* Editor directions:
118 * vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent