2 * fribidi-types.h - define data types for the rest of the library
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>.
27 #ifndef _FRIBIDI_TYPES_H
28 #define _FRIBIDI_TYPES_H
30 #include "fribidi-common.h"
32 #include "fribidi-begindecls.h"
35 # if defined (_SVR4) || defined (SVR4) || defined (__OpenBSD__) || \
36 defined (_sgi) || defined (__sun) || defined (sun) || \
37 defined (__digital__) || defined (__HP_cc)
38 # include <inttypes.h>
40 # include <sys/inttypes.h>
45 typedef int fribidi_boolean;
47 typedef uint32_t FriBidiChar;
48 typedef int FriBidiStrIndex;
50 /* The MSB is used to indicate an opening bracket */
51 typedef FriBidiChar FriBidiBracketType;
53 /* Use FRIBIDI_NO_BRACKET for assigning to a non-bracket */
54 #define FRIBIDI_NO_BRACKET 0
56 /* A few macros for working with bits */
58 #define FRIBIDI_TEST_BITS(x, mask) (((x) & (mask)) ? 1 : 0)
60 #define FRIBIDI_INCLUDE_BITS(x, mask) ((x) | (mask))
62 #define FRIBIDI_EXCLUDE_BITS(x, mask) ((x) & ~(mask))
64 #define FRIBIDI_SET_BITS(x, mask) ((x) |= (mask))
66 #define FRIBIDI_UNSET_BITS(x, mask) ((x) &= ~(mask))
68 #define FRIBIDI_ADJUST_BITS(x, mask, cond) \
69 ((x) = ((x) & ~(mask)) | ((cond) ? (mask) : 0))
71 #define FRIBIDI_ADJUST_AND_TEST_BITS(x, mask, cond) \
72 FRIBIDI_TEST_BITS(FRIBIDI_ADJUST_BITS((x), (mask), (cond)), (mask))
74 #include "fribidi-enddecls.h"
76 #endif /* !_FRIBIDI_TYPES_H */
78 * vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent