Imported Upstream version 1.0.8
[platform/upstream/fribidi.git] / lib / fribidi-common.h
1 /* FriBidi
2  * fribidi-common.h - common include for library headers
3  *
4  * Author:
5  *   Behdad Esfahbod, 2004
6  *
7  * Copyright (C) 2004 Sharif FarsiWeb, Inc.
8  * 
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  * 
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Lesser General Public License for more details.
18  * 
19  * You should have received a copy of the GNU Lesser General Public License
20  * along with this library, in a file named COPYING; if not, write to the
21  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22  * Boston, MA 02110-1301, USA
23  * 
24  * For licensing issues, contact <fribidi.license@gmail.com>.
25  */
26 #ifndef _FRIBIDI_COMMON_H
27 #define _FRIBIDI_COMMON_H
28
29 #ifdef DONT_HAVE_FRIBIDI_CONFIG_H
30 # define FRIBIDI "fribidi"
31 # define FRIBIDI_NAME "fribidi"
32 # define FRIBIDI_VERSION "unknown"
33 # define FRIBIDI_BUGREPORT "unknown"
34 # define FRIBIDI_INTERFACE_VERSION_STRING "unknown"
35 #else /* !DONT_HAVE_FRIBIDI_CONFIG_H */
36 # include "fribidi-config.h"
37 #endif /* !DONT_HAVE_FRIBIDI_CONFIG_H */
38
39 #ifdef HAVE_FRIBIDI_CUSTOM_H
40 # include <fribidi-custom.h>
41 #endif /* HAVE_FRIBIDI_CUSTOM_H */
42
43
44 /* FRIBIDI_ENTRY is a macro used to declare library entry points. */
45 #ifndef FRIBIDI_ENTRY
46 # if (defined(_MSC_VER) || defined(FRIBIDI_BUILT_WITH_MSVC)) && !defined(FRIBIDI_STATIC)
47 /* if we're building fribidi itself with MSVC, FRIBIDI_ENTRY will be defined,
48  * so if we're here then this is an external user including fribidi headers.
49  * The dllimport is needed here mostly for the fribidi_version_info variable,
50  * for functions it's not required. Probably needs more fine-tuning if
51  * someone starts building fribidi as static library with MSVC. We'll cross
52  * that bridge when we get there. */
53 #  define FRIBIDI_ENTRY __declspec(dllimport) extern
54 # else
55 #  define FRIBIDI_ENTRY extern
56 # endif
57 #endif /* !FRIBIDI_ENTRY */
58
59 #ifdef __ICC
60 #define FRIBIDI_BEGIN_IGNORE_DEPRECATIONS               \
61   _Pragma ("warning (push)")                            \
62   _Pragma ("warning (disable:1478)")
63 #define FRIBIDI_END_IGNORE_DEPRECATIONS                 \
64   _Pragma ("warning (pop)")
65 #elif    __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
66 #define FRIBIDI_BEGIN_IGNORE_DEPRECATIONS               \
67   _Pragma ("GCC diagnostic push")                       \
68   _Pragma ("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
69 #define FRIBIDI_END_IGNORE_DEPRECATIONS                 \
70   _Pragma ("GCC diagnostic pop")
71 #elif defined (_MSC_VER) && (_MSC_VER >= 1500)
72 #define FRIBIDI_BEGIN_IGNORE_DEPRECATIONS               \
73   __pragma (warning (push))                             \
74   __pragma (warning (disable : 4996))
75 #define FRIBIDI_END_IGNORE_DEPRECATIONS                 \
76   __pragma (warning (pop))
77 #elif defined (__clang__)
78 #define FRIBIDI_BEGIN_IGNORE_DEPRECATIONS               \
79   _Pragma("clang diagnostic push")                      \
80   _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"")
81 #define FRIBIDI_END_IGNORE_DEPRECATIONS \
82   _Pragma("clang diagnostic pop")
83 #else
84 #define FRIBIDI_BEGIN_IGNORE_DEPRECATIONS
85 #define FRIBIDI_END_IGNORE_DEPRECATIONS
86 #endif
87
88 #if defined(__GNUC__) && (__GNUC__ > 2)
89 # define FRIBIDI_GNUC_WARN_UNUSED __attribute__((__warn_unused_result__))
90 # define FRIBIDI_GNUC_MALLOC      __attribute__((__malloc__))
91 # define FRIBIDI_GNUC_HIDDEN      __attribute__((__visibility__ ("hidden")))
92 # define FRIBIDI_GNUC_CONST       __attribute__((__const__))
93 # define FRIBIDI_GNUC_DEPRECATED  __attribute__((__unused__))
94 #else /* __GNUC__ */
95 # define FRIBIDI_GNUC_WARN_UNUSED
96 # define FRIBIDI_GNUC_MALLOC
97 # define FRIBIDI_GNUC_HIDDEN
98 # define FRIBIDI_GNUC_CONST
99 # define FRIBIDI_GNUC_DEPRECATED
100 #endif  /* __GNUC__ */
101
102 /* FRIBIDI_BEGIN_DECLS should be used at the beginning of your declarations,
103  * so that C++ compilers don't mangle their names.  Use FRIBIDI_END_DECLS at
104  * the end of C declarations. */
105 #ifndef FRIBIDI_BEGIN_DECLS
106 # ifdef __cplusplus
107 #  define FRIBIDI_BEGIN_DECLS extern "C" {
108 #  define FRIBIDI_END_DECLS }
109 # else /* !__cplusplus */
110 #  define FRIBIDI_BEGIN_DECLS   /* empty */
111 #  define FRIBIDI_END_DECLS     /* empty */
112 # endif /* !__cplusplus */
113 #endif /* !FRIBIDI_BEGIN_DECLS */
114
115
116
117
118 /* fribidi_debug_status - get current debug state
119  *
120  */
121 FRIBIDI_ENTRY int fribidi_debug_status (
122   void
123 );
124
125 /* fribidi_set_debug - set debug state
126  *
127  */
128 FRIBIDI_ENTRY int
129 fribidi_set_debug (
130   int state             /* new state to set */
131 );
132
133
134
135
136
137
138
139
140
141
142
143 #endif /* !_FRIBIDI_COMMON_H */
144 /* Editor directions:
145  * vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
146  */