1 | /* FriBidi |
2 | * fribidi-types.h - define data types for the rest of the library |
3 | * |
4 | * Author: |
5 | * Behdad Esfahbod, 2001, 2002, 2004 |
6 | * |
7 | * Copyright (C) 2004 Sharif FarsiWeb, Inc. |
8 | * Copyright (C) 2001,2002 Behdad Esfahbod |
9 | * |
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. |
14 | * |
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. |
19 | * |
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 |
24 | * |
25 | * For licensing issues, contact <fribidi.license@gmail.com>. |
26 | */ |
27 | #ifndef _FRIBIDI_TYPES_H |
28 | #define _FRIBIDI_TYPES_H |
29 | |
30 | #include "fribidi-common.h" |
31 | |
32 | #include "fribidi-begindecls.h" |
33 | |
34 | |
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> |
39 | # elif defined (_AIX) |
40 | # include <sys/inttypes.h> |
41 | # else |
42 | # include <stdint.h> |
43 | # endif |
44 | |
45 | typedef int fribidi_boolean; |
46 | |
47 | typedef uint32_t FriBidiChar; |
48 | typedef int FriBidiStrIndex; |
49 | |
50 | /* The MSB is used to indicate an opening bracket */ |
51 | typedef FriBidiChar FriBidiBracketType; |
52 | |
53 | /* Use FRIBIDI_NO_BRACKET for assigning to a non-bracket */ |
54 | #define FRIBIDI_NO_BRACKET 0 |
55 | |
56 | /* A few macros for working with bits */ |
57 | |
58 | #define FRIBIDI_TEST_BITS(x, mask) (((x) & (mask)) ? 1 : 0) |
59 | |
60 | #define FRIBIDI_INCLUDE_BITS(x, mask) ((x) | (mask)) |
61 | |
62 | #define FRIBIDI_EXCLUDE_BITS(x, mask) ((x) & ~(mask)) |
63 | |
64 | #define FRIBIDI_SET_BITS(x, mask) ((x) |= (mask)) |
65 | |
66 | #define FRIBIDI_UNSET_BITS(x, mask) ((x) &= ~(mask)) |
67 | |
68 | #define FRIBIDI_ADJUST_BITS(x, mask, cond) \ |
69 | ((x) = ((x) & ~(mask)) | ((cond) ? (mask) : 0)) |
70 | |
71 | #define FRIBIDI_ADJUST_AND_TEST_BITS(x, mask, cond) \ |
72 | FRIBIDI_TEST_BITS(FRIBIDI_ADJUST_BITS((x), (mask), (cond)), (mask)) |
73 | |
74 | #include "fribidi-enddecls.h" |
75 | |
76 | #endif /* !_FRIBIDI_TYPES_H */ |
77 | /* Editor directions: |
78 | * vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent |
79 | */ |
80 | |