xref: /inferno-os/include/freetype/config/ftconfig.h (revision 37da2899f40661e3e9631e497da8dc59b971cbd0)
1 /***************************************************************************/
2 /*                                                                         */
3 /*  ftconfig.h                                                             */
4 /*                                                                         */
5 /*    ANSI-specific configuration file (specification only).               */
6 /*                                                                         */
7 /*  Copyright 1996-2001, 2002 by                                           */
8 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
9 /*                                                                         */
10 /*  This file is part of the FreeType project, and may only be used,       */
11 /*  modified, and distributed under the terms of the FreeType project      */
12 /*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
13 /*  this file you indicate that you have read the license and              */
14 /*  understand and accept it fully.                                        */
15 /*                                                                         */
16 /***************************************************************************/
17 
18 
19   /*************************************************************************/
20   /*                                                                       */
21   /* This header file contains a number of macro definitions that are used */
22   /* by the rest of the engine.  Most of the macros here are automatically */
23   /* determined at compile time, and you should not need to change it to   */
24   /* port FreeType, except to compile the library with a non-ANSI          */
25   /* compiler.                                                             */
26   /*                                                                       */
27   /* Note however that if some specific modifications are needed, we       */
28   /* advise you to place a modified copy in your build directory.          */
29   /*                                                                       */
30   /* The build directory is usually `freetype/builds/<system>', and        */
31   /* contains system-specific files that are always included first when    */
32   /* building the library.                                                 */
33   /*                                                                       */
34   /* This ANSI version should stay in `include/freetype/config'.           */
35   /*                                                                       */
36   /*************************************************************************/
37 
38 
39 #ifndef __FTCONFIG_H__
40 #define __FTCONFIG_H__
41 
42 #include <ft2build.h>
43 #include FT_CONFIG_OPTIONS_H
44 #include FT_CONFIG_STANDARD_LIBRARY_H
45 
46 FT_BEGIN_HEADER
47 
48 
49   /*************************************************************************/
50   /*                                                                       */
51   /*               PLATFORM-SPECIFIC CONFIGURATION MACROS                  */
52   /*                                                                       */
53   /* These macros can be toggled to suit a specific system.  The current   */
54   /* ones are defaults used to compile FreeType in an ANSI C environment   */
55   /* (16bit compilers are also supported).  Copy this file to your own     */
56   /* `freetype/builds/<system>' directory, and edit it to port the engine. */
57   /*                                                                       */
58   /*************************************************************************/
59 
60 
61   /* The number of bytes in an `int' type.  */
62 #if   FT_UINT_MAX == 0xFFFFFFFFUL
63 #define FT_SIZEOF_INT  4
64 #elif FT_UINT_MAX == 0xFFFFU
65 #define FT_SIZEOF_INT  2
66 #elif FT_UINT_MAX > 0xFFFFFFFFU && FT_UINT_MAX == 0xFFFFFFFFFFFFFFFFU
67 #define FT_SIZEOF_INT  8
68 #else
69 #error "Unsupported number of bytes in `int' type!"
70 #endif
71 
72   /* The number of bytes in a `long' type.  */
73 #if   FT_ULONG_MAX == 0xFFFFFFFFUL
74 #define FT_SIZEOF_LONG  4
75 #elif FT_ULONG_MAX > 0xFFFFFFFFU && FT_ULONG_MAX == 0xFFFFFFFFFFFFFFFFU
76 #define FT_SIZEOF_LONG  8
77 #else
78 #error "Unsupported number of bytes in `long' type!"
79 #endif
80 
81 
82   /* Preferred alignment of data */
83 #define FT_ALIGNMENT  8
84 
85 
86   /* FT_UNUSED is a macro used to indicate that a given parameter is not  */
87   /* used -- this is only used to get rid of unpleasant compiler warnings */
88 #ifndef FT_UNUSED
89 #define FT_UNUSED( arg )  ( (arg) = (arg) )
90 #endif
91 
92 
93   /*************************************************************************/
94   /*                                                                       */
95   /*                     AUTOMATIC CONFIGURATION MACROS                    */
96   /*                                                                       */
97   /* These macros are computed from the ones defined above.  Don't touch   */
98   /* their definition, unless you know precisely what you are doing.  No   */
99   /* porter should need to mess with them.                                 */
100   /*                                                                       */
101   /*************************************************************************/
102 
103 
104   /*************************************************************************/
105   /*                                                                       */
106   /* Mac support (not MacOS X)                                             */
107   /*                                                                       */
108   /*   This is the only necessary change, so it is defined here instead    */
109   /*   providing a new configuration file.                                 */
110   /*                                                                       */
111 #if (defined( __APPLE__ ) || ( defined( __MWERKS__ ) && defined( macintosh ) )) && !defined(__MACH__)
112 #define FT_MACINTOSH 1
113 #endif
114 
115 
116   /*************************************************************************/
117   /*                                                                       */
118   /* IntN types                                                            */
119   /*                                                                       */
120   /*   Used to guarantee the size of some specific integers.               */
121   /*                                                                       */
122   typedef signed short    FT_Int16;
123   typedef unsigned short  FT_UInt16;
124 
125 #if FT_SIZEOF_INT == 4
126 
127   typedef signed int      FT_Int32;
128   typedef unsigned int    FT_UInt32;
129 
130 #elif FT_SIZEOF_LONG == 4
131 
132   typedef signed long     FT_Int32;
133   typedef unsigned long   FT_UInt32;
134 
135 #else
136 #error "no 32bit type found -- please check your configuration files"
137 #endif
138 
139   /* now, lookup for an integer type that is at least 32 bits */
140 #if FT_SIZEOF_INT >= 4
141 
142   typedef int            FT_Fast;
143   typedef unsigned int   FT_UFast;
144 
145 #elif FT_SIZEOF_LONG >= 4
146 
147   typedef long           FT_Fast;
148   typedef unsigned long  FT_UFast;
149 
150 #endif
151 
152 
153   /* determine whether we have a 64-bit int type for platforms without */
154   /* Autoconf                                                          */
155 #if FT_SIZEOF_LONG == 8
156 
157   /* FT_LONG64 must be defined if a 64-bit type is available */
158 #define FT_LONG64
159 #define FT_INT64  long
160 
161 #elif defined( _MSC_VER ) && _MSC_VER >= 900  /* Visual C++ (and Intel C++) */
162 
163   /* this compiler provides the __int64 type */
164 #define FT_LONG64
165 #define FT_INT64  __int64
166 
167 #elif defined( __BORLANDC__ )  /* Borland C++ */
168 
169   /* XXXX: We should probably check the value of __BORLANDC__ in order */
170   /*       to test the compiler version.                               */
171 
172   /* this compiler provides the __int64 type */
173 #define FT_LONG64
174 #define FT_INT64  __int64
175 
176 #elif defined( __WATCOMC__ )   /* Watcom C++ */
177 
178   /* Watcom doesn't provide 64-bit data types */
179 
180 #elif defined( __MWKS__ )      /* Metrowerks CodeWarrior */
181 
182   /* I don't know if it provides 64-bit data types, any suggestion */
183   /* is welcome.                                                   */
184 
185 #elif defined( __GNUC__ )
186 
187   /* GCC provides the "long long" type */
188 #define FT_LONG64
189 #define FT_INT64  long long int
190 
191 #endif /* FT_SIZEOF_LONG == 8 */
192 
193 
194   /*************************************************************************/
195   /*                                                                       */
196   /* A 64-bit data type will create compilation problems if you compile    */
197   /* in strict ANSI mode.  To avoid them, we disable their use if          */
198   /* __STDC__ is defined.  You can however ignore this rule by             */
199   /* defining the FT_CONFIG_OPTION_FORCE_INT64 configuration macro.        */
200   /*                                                                       */
201 #if defined( FT_LONG64 ) && !defined( FT_CONFIG_OPTION_FORCE_INT64 )
202 
203 #ifdef __STDC__
204 
205   /* undefine the 64-bit macros in strict ANSI compilation mode */
206 #undef FT_LONG64
207 #undef FT_INT64
208 
209 #endif /* __STDC__ */
210 
211 #endif /* FT_LONG64 && !FT_CONFIG_OPTION_FORCE_INT64 */
212 
213 
214 #ifdef FT_MAKE_OPTION_SINGLE_OBJECT
215 
216 #define FT_LOCAL( x )      static  x
217 #define FT_LOCAL_DEF( x )  static  x
218 
219 #else
220 
221 #ifdef __cplusplus
222 #define FT_LOCAL( x )      extern "C"  x
223 #define FT_LOCAL_DEF( x )  extern "C"  x
224 #else
225 #define FT_LOCAL( x )      extern  x
226 #define FT_LOCAL_DEF( x )  x
227 #endif
228 
229 #endif /* FT_MAKE_OPTION_SINGLE_OBJECT */
230 
231 
232 #ifndef FT_BASE
233 
234 #ifdef __cplusplus
235 #define FT_BASE( x )  extern "C"  x
236 #else
237 #define FT_BASE( x )  extern  x
238 #endif
239 
240 #endif /* !FT_BASE */
241 
242 
243 #ifndef FT_BASE_DEF
244 
245 #ifdef __cplusplus
246 #define FT_BASE_DEF( x )  extern "C"  x
247 #else
248 #define FT_BASE_DEF( x )  extern  x
249 #endif
250 
251 #endif /* !FT_BASE_DEF */
252 
253 
254 #ifndef FT_EXPORT
255 
256 #ifdef __cplusplus
257 #define FT_EXPORT( x )  extern "C"  x
258 #else
259 #define FT_EXPORT( x )  extern  x
260 #endif
261 
262 #endif /* !FT_EXPORT */
263 
264 
265 #ifndef FT_EXPORT_DEF
266 
267 #ifdef __cplusplus
268 #define FT_EXPORT_DEF( x )  extern "C"  x
269 #else
270 #define FT_EXPORT_DEF( x )  extern  x
271 #endif
272 
273 #endif /* !FT_EXPORT_DEF */
274 
275 
276 #ifndef FT_EXPORT_VAR
277 
278 #ifdef __cplusplus
279 #define FT_EXPORT_VAR( x )  extern "C"  x
280 #else
281 #define FT_EXPORT_VAR( x )  extern  x
282 #endif
283 
284 #endif /* !FT_EXPORT_VAR */
285 
286   /* The following macros are needed to compile the library with a   */
287   /* C++ compiler and with 16bit compilers.                          */
288   /*                                                                 */
289 
290   /* This is special.  Within C++, you must specify `extern "C"' for */
291   /* functions which are used via function pointers, and you also    */
292   /* must do that for structures which contain function pointers to  */
293   /* assure C linkage -- it's not possible to have (local) anonymous */
294   /* functions which are accessed by (global) function pointers.     */
295   /*                                                                 */
296   /*                                                                 */
297   /* FT_CALLBACK_DEF is used to _define_ a callback function.        */
298   /*                                                                 */
299   /* FT_CALLBACK_TABLE is used to _declare_ a constant variable that */
300   /* contains pointers to callback functions.                        */
301   /*                                                                 */
302   /* FT_CALLBACK_TABLE_DEF is used to _define_ a constant variable   */
303   /* that contains pointers to callback functions.                   */
304   /*                                                                 */
305   /*                                                                 */
306   /* Some 16bit compilers have to redefine these macros to insert    */
307   /* the infamous `_cdecl' or `__fastcall' declarations.             */
308   /*                                                                 */
309 #ifndef FT_CALLBACK_DEF
310 #ifdef __cplusplus
311 #define FT_CALLBACK_DEF( x )  extern "C"  x
312 #else
313 #define FT_CALLBACK_DEF( x )  static  x
314 #endif
315 #endif /* FT_CALLBACK_DEF */
316 
317 #ifndef FT_CALLBACK_TABLE
318 #ifdef __cplusplus
319 #define FT_CALLBACK_TABLE      extern "C"
320 #define FT_CALLBACK_TABLE_DEF  extern "C"
321 #else
322 #define FT_CALLBACK_TABLE      extern
323 #define FT_CALLBACK_TABLE_DEF  /* nothing */
324 #endif
325 #endif /* FT_CALLBACK_TABLE */
326 
327 
328 FT_END_HEADER
329 
330 
331 #endif /* __FTCONFIG_H__ */
332 
333 
334 /* END */
335