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
34 #include "fribidi-common.h"
36 #include "fribidi-begindecls.h"
39 # if defined (_SVR4) || defined (SVR4) || defined (__OpenBSD__) || \
40 defined (_sgi) || defined (__sun) || defined (sun) || \
41 defined (__digital__) || defined (__HP_cc)
42 # include <inttypes.h>
44 # include <sys/inttypes.h>
49 typedef int fribidi_boolean;
51 typedef uint32_t FriBidiChar;
52 typedef int FriBidiStrIndex;
54 /* The MSB is used to indicate an opening bracket */
55 typedef FriBidiChar FriBidiBracketType;
57 /* Use FRIBIDI_NO_BRACKET for assigning to a non-bracket */
58 #define FRIBIDI_NO_BRACKET 0
60 /* A few macros for working with bits */
62 #define FRIBIDI_TEST_BITS(x, mask) (((x) & (mask)) ? 1 : 0)
64 #define FRIBIDI_INCLUDE_BITS(x, mask) ((x) | (mask))
66 #define FRIBIDI_EXCLUDE_BITS(x, mask) ((x) & ~(mask))
68 #define FRIBIDI_SET_BITS(x, mask) ((x) |= (mask))
70 #define FRIBIDI_UNSET_BITS(x, mask) ((x) &= ~(mask))
72 #define FRIBIDI_ADJUST_BITS(x, mask, cond) \
73 ((x) = ((x) & ~(mask)) | ((cond) ? (mask) : 0))
75 #define FRIBIDI_ADJUST_AND_TEST_BITS(x, mask, cond) \
76 FRIBIDI_TEST_BITS(FRIBIDI_ADJUST_BITS((x), (mask), (cond)), (mask))
78 #include "fribidi-enddecls.h"
80 #endif /* !_FRIBIDI_TYPES_H */
82 * vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent