2 * fribidi-types.h - define data types for the rest of the library
4 * $Id: fribidi-types.h,v 1.13 2010-02-24 19:40:04 behdad Exp $
6 * $Date: 2010-02-24 19:40:04 $
8 * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-types.h,v $
11 * Behdad Esfahbod, 2001, 2002, 2004
13 * Copyright (C) 2004 Sharif FarsiWeb, Inc.
14 * Copyright (C) 2001,2002 Behdad Esfahbod
16 * This library is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU Lesser General Public
18 * License as published by the Free Software Foundation; either
19 * version 2.1 of the License, or (at your option) any later version.
21 * This library is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24 * Lesser General Public License for more details.
26 * You should have received a copy of the GNU Lesser General Public License
27 * along with this library, in a file named COPYING; if not, write to the
28 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
29 * Boston, MA 02111-1307, USA
31 * For licensing issues, contact <license@farsiweb.info>.
33 #ifndef _FRIBIDI_TYPES_H
34 #define _FRIBIDI_TYPES_H
36 #include "fribidi-common.h"
38 #include "fribidi-begindecls.h"
41 #if FRIBIDI_USE_GLIB+0
42 # ifndef __FRIBIDI_DOC
44 # endif /* !__FRIBIDI_DOC */
45 # define FRIBIDI_INT8_LOCAL gint8
46 # define FRIBIDI_INT16_LOCAL gint16
47 # define FRIBIDI_INT32_LOCAL gint32
48 # define FRIBIDI_UINT8_LOCAL guint8
49 # define FRIBIDI_UINT16_LOCAL guint16
50 # define FRIBIDI_UINT32_LOCAL guint32
51 # define FRIBIDI_BOOLEAN_LOCAL gboolean
52 # define FRIBIDI_UNICHAR_LOCAL gunichar
53 #else /* !FRIBIDI_USE_GLIB */
54 # if defined(HAVE_INTTYPES_H) || defined(HAVE_STDINT_H)
55 # ifndef __FRIBIDI_DOC
57 # include <inttypes.h>
60 # endif /* !HAVE_STDINT_H */
61 # endif /* !__FRIBIDI_DOC */
62 # define FRIBIDI_INT8_LOCAL int8_t
63 # define FRIBIDI_INT16_LOCAL int16_t
64 # define FRIBIDI_INT32_LOCAL int32_t
65 # define FRIBIDI_UINT8_LOCAL uint8_t
66 # define FRIBIDI_UINT16_LOCAL uint16_t
67 # define FRIBIDI_UINT32_LOCAL uint32_t
68 # else /* no int types */
69 # define FRIBIDI_INT8_LOCAL signed char
70 # define FRIBIDI_UINT8_LOCAL unsigned char
71 # if !defined(FRIBIDI_SIZEOF_INT) || FRIBIDI_SIZEOF_INT >= 4
72 # define FRIBIDI_INT16_LOCAL signed short
73 # define FRIBIDI_UINT16_LOCAL unsigned short
74 # define FRIBIDI_INT32_LOCAL signed int
75 # define FRIBIDI_UINT32_LOCAL unsigned int
76 # else /* SIZEOF_INT < 4 */
77 # define FRIBIDI_INT16_LOCAL signed int
78 # define FRIBIDI_UINT16_LOCAL unsigned int
79 # define FRIBIDI_INT32_LOCAL signed long
80 # define FRIBIDI_UINT32_LOCAL unsigned long
81 # endif /* SIZEOF_INT < 4 */
82 # endif /* no int types */
83 # define FRIBIDI_BOOLEAN_LOCAL int
84 # if SIZEOF_WCHAR_T >= 4
85 # ifndef __FRIBIDI_DOC
89 # else /* !STDC_HEADERS */
92 # endif /* !HAVE_STDLIB_H */
93 # endif /* !STDC_HEADERS */
94 # endif /* !__FRIBIDI_DOC */
95 # define FRIBIDI_UNICHAR_LOCAL wchar_t
96 # else /* SIZEOF_WCHAR_T < 4 */
97 # define FRIBIDI_UNICHAR_LOCAL fribidi_uint32
98 # endif /* SIZEOF_WCHAR_T < 4 */
99 #endif /* !FRIBIDI_USE_GLIB */
101 #if FRIBIDI_INT_TYPES+0
103 # define FRIBIDI_INT8 FRIBIDI_INT8_LOCAL
104 # define FRIBIDI_INT16 FRIBIDI_INT16_LOCAL
105 # define FRIBIDI_INT32 FRIBIDI_INT32_LOCAL
106 # define FRIBIDI_UINT8 FRIBIDI_UINT8_LOCAL
107 # define FRIBIDI_UINT16 FRIBIDI_UINT16_LOCAL
108 # define FRIBIDI_UINT32 FRIBIDI_UINT32_LOCAL
109 #endif /* !FRIBIDI_INT_TYPES */
110 #ifndef FRIBIDI_BOOLEAN
111 # define FRIBIDI_BOOLEAN FRIBIDI_BOOLEAN_LOCAL
112 #endif /* !FRIBIDI_BOOLEAN */
113 #ifndef FRIBIDI_UNICHAR
114 # define FRIBIDI_UNICHAR FRIBIDI_UNICHAR_LOCAL
115 #endif /* !FRIBIDI_UNICHAR */
116 #ifndef FRIBIDI_STR_INDEX
117 # define FRIBIDI_STR_INDEX int
118 #endif /* FRIBIDI_STR_INDEX */
121 typedef FRIBIDI_UINT8 fribidi_int8;
122 typedef FRIBIDI_INT16 fribidi_int16;
123 typedef FRIBIDI_INT32 fribidi_int32;
124 typedef FRIBIDI_UINT8 fribidi_uint8;
125 typedef FRIBIDI_UINT16 fribidi_uint16;
126 typedef FRIBIDI_UINT32 fribidi_uint32;
127 typedef FRIBIDI_BOOLEAN fribidi_boolean;
129 typedef FRIBIDI_UNICHAR FriBidiChar;
130 typedef FRIBIDI_STR_INDEX FriBidiStrIndex;
133 #ifndef FRIBIDI_MAX_STRING_LENGTH
134 # define FRIBIDI_MAX_STRING_LENGTH (sizeof (FriBidiStrIndex) == 2 ? \
135 0x7FFF : (sizeof (FriBidiStrIndex) == 1 ? \
139 /* A few macros for working with bits */
141 #define FRIBIDI_TEST_BITS(x, mask) (((x) & (mask)) ? 1 : 0)
143 #define FRIBIDI_INCLUDE_BITS(x, mask) ((x) | (mask))
145 #define FRIBIDI_EXCLUDE_BITS(x, mask) ((x) & ~(mask))
147 #define FRIBIDI_SET_BITS(x, mask) ((x) |= (mask))
149 #define FRIBIDI_UNSET_BITS(x, mask) ((x) &= ~(mask))
151 #define FRIBIDI_ADJUST_BITS(x, mask, cond) \
152 ((x) = ((x) & ~(mask)) | ((cond) ? (mask) : 0))
154 #define FRIBIDI_ADJUST_AND_TEST_BITS(x, mask, cond) \
155 FRIBIDI_TEST_BITS(FRIBIDI_ADJUST_BITS((x), (mask), (cond)), (mask))
157 #include "fribidi-enddecls.h"
159 #endif /* !_FRIBIDI_TYPES_H */
160 /* Editor directions:
161 * vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent