1 | /***************************************************************************/ |
---|
2 | /* */ |
---|
3 | /* ftconfig.h */ |
---|
4 | /* */ |
---|
5 | /* ANSI-specific configuration file (specification only). */ |
---|
6 | /* */ |
---|
7 | /* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007 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 | /* There are systems (like the Texas Instruments 'C54x) where a `char' */ |
---|
62 | /* has 16 bits. ANSI C says that sizeof(char) is always 1. Since an */ |
---|
63 | /* `int' has 16 bits also for this system, sizeof(int) gives 1 which */ |
---|
64 | /* is probably unexpected. */ |
---|
65 | /* */ |
---|
66 | /* `CHAR_BIT' (defined in limits.h) gives the number of bits in a */ |
---|
67 | /* `char' type. */ |
---|
68 | |
---|
69 | #ifndef FT_CHAR_BIT |
---|
70 | #define FT_CHAR_BIT CHAR_BIT |
---|
71 | #endif |
---|
72 | |
---|
73 | |
---|
74 | /* The size of an `int' type. */ |
---|
75 | #if FT_UINT_MAX == 0xFFFFUL |
---|
76 | #define FT_SIZEOF_INT (16 / FT_CHAR_BIT) |
---|
77 | #elif FT_UINT_MAX == 0xFFFFFFFFUL |
---|
78 | #define FT_SIZEOF_INT (32 / FT_CHAR_BIT) |
---|
79 | #elif FT_UINT_MAX > 0xFFFFFFFFUL && FT_UINT_MAX == 0xFFFFFFFFFFFFFFFFUL |
---|
80 | #define FT_SIZEOF_INT (64 / FT_CHAR_BIT) |
---|
81 | #else |
---|
82 | #error "Unsupported size of `int' type!" |
---|
83 | #endif |
---|
84 | |
---|
85 | /* The size of a `long' type. A five-byte `long' (as used e.g. on the */ |
---|
86 | /* DM642) is recognized but avoided. */ |
---|
87 | #if FT_ULONG_MAX == 0xFFFFFFFFUL |
---|
88 | #define FT_SIZEOF_LONG (32 / FT_CHAR_BIT) |
---|
89 | #elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFUL |
---|
90 | #define FT_SIZEOF_LONG (32 / FT_CHAR_BIT) |
---|
91 | #elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFFFFFFFUL |
---|
92 | #define FT_SIZEOF_LONG (64 / FT_CHAR_BIT) |
---|
93 | #else |
---|
94 | #error "Unsupported size of `long' type!" |
---|
95 | #endif |
---|
96 | |
---|
97 | |
---|
98 | /* Preferred alignment of data */ |
---|
99 | #define FT_ALIGNMENT 8 |
---|
100 | |
---|
101 | |
---|
102 | /* FT_UNUSED is a macro used to indicate that a given parameter is not */ |
---|
103 | /* used -- this is only used to get rid of unpleasant compiler warnings */ |
---|
104 | #ifndef FT_UNUSED |
---|
105 | #define FT_UNUSED( arg ) ( (arg) = (arg) ) |
---|
106 | #endif |
---|
107 | |
---|
108 | |
---|
109 | /*************************************************************************/ |
---|
110 | /* */ |
---|
111 | /* AUTOMATIC CONFIGURATION MACROS */ |
---|
112 | /* */ |
---|
113 | /* These macros are computed from the ones defined above. Don't touch */ |
---|
114 | /* their definition, unless you know precisely what you are doing. No */ |
---|
115 | /* porter should need to mess with them. */ |
---|
116 | /* */ |
---|
117 | /*************************************************************************/ |
---|
118 | |
---|
119 | |
---|
120 | /*************************************************************************/ |
---|
121 | /* */ |
---|
122 | /* Mac support */ |
---|
123 | /* */ |
---|
124 | /* This is the only necessary change, so it is defined here instead */ |
---|
125 | /* providing a new configuration file. */ |
---|
126 | /* */ |
---|
127 | #if ( defined( __APPLE__ ) && !defined( DARWIN_NO_CARBON ) ) || \ |
---|
128 | ( defined( __MWERKS__ ) && defined( macintosh ) ) |
---|
129 | /* no Carbon frameworks for 64bit 10.4.x */ |
---|
130 | #include "AvailabilityMacros.h" |
---|
131 | #if defined( __LP64__ ) && \ |
---|
132 | ( MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 ) |
---|
133 | #define DARWIN_NO_CARBON 1 |
---|
134 | #else |
---|
135 | #define FT_MACINTOSH 1 |
---|
136 | #endif |
---|
137 | #endif |
---|
138 | |
---|
139 | |
---|
140 | /*************************************************************************/ |
---|
141 | /* */ |
---|
142 | /* <Section> */ |
---|
143 | /* basic_types */ |
---|
144 | /* */ |
---|
145 | /*************************************************************************/ |
---|
146 | |
---|
147 | |
---|
148 | /*************************************************************************/ |
---|
149 | /* */ |
---|
150 | /* <Type> */ |
---|
151 | /* FT_Int16 */ |
---|
152 | /* */ |
---|
153 | /* <Description> */ |
---|
154 | /* A typedef for a 16bit signed integer type. */ |
---|
155 | /* */ |
---|
156 | typedef signed short FT_Int16; |
---|
157 | |
---|
158 | |
---|
159 | /*************************************************************************/ |
---|
160 | /* */ |
---|
161 | /* <Type> */ |
---|
162 | /* FT_UInt16 */ |
---|
163 | /* */ |
---|
164 | /* <Description> */ |
---|
165 | /* A typedef for a 16bit unsigned integer type. */ |
---|
166 | /* */ |
---|
167 | typedef unsigned short FT_UInt16; |
---|
168 | |
---|
169 | /* */ |
---|
170 | |
---|
171 | |
---|
172 | /* this #if 0 ... #endif clause is for documentation purposes */ |
---|
173 | #if 0 |
---|
174 | |
---|
175 | /*************************************************************************/ |
---|
176 | /* */ |
---|
177 | /* <Type> */ |
---|
178 | /* FT_Int32 */ |
---|
179 | /* */ |
---|
180 | /* <Description> */ |
---|
181 | /* A typedef for a 32bit signed integer type. The size depends on */ |
---|
182 | /* the configuration. */ |
---|
183 | /* */ |
---|
184 | typedef signed XXX FT_Int32; |
---|
185 | |
---|
186 | |
---|
187 | /*************************************************************************/ |
---|
188 | /* */ |
---|
189 | /* <Type> */ |
---|
190 | /* FT_UInt32 */ |
---|
191 | /* */ |
---|
192 | /* A typedef for a 32bit unsigned integer type. The size depends on */ |
---|
193 | /* the configuration. */ |
---|
194 | /* */ |
---|
195 | typedef unsigned XXX FT_UInt32; |
---|
196 | |
---|
197 | /* */ |
---|
198 | |
---|
199 | #endif |
---|
200 | |
---|
201 | #if FT_SIZEOF_INT == (32 / FT_CHAR_BIT) |
---|
202 | |
---|
203 | typedef signed int FT_Int32; |
---|
204 | typedef unsigned int FT_UInt32; |
---|
205 | |
---|
206 | #elif FT_SIZEOF_LONG == (32 / FT_CHAR_BIT) |
---|
207 | |
---|
208 | typedef signed long FT_Int32; |
---|
209 | typedef unsigned long FT_UInt32; |
---|
210 | |
---|
211 | #else |
---|
212 | #error "no 32bit type found -- please check your configuration files" |
---|
213 | #endif |
---|
214 | |
---|
215 | /* look up an integer type that is at least 32 bits */ |
---|
216 | #if FT_SIZEOF_INT >= (32 / FT_CHAR_BIT) |
---|
217 | |
---|
218 | typedef int FT_Fast; |
---|
219 | typedef unsigned int FT_UFast; |
---|
220 | |
---|
221 | #elif FT_SIZEOF_LONG >= (32 / FT_CHAR_BIT) |
---|
222 | |
---|
223 | typedef long FT_Fast; |
---|
224 | typedef unsigned long FT_UFast; |
---|
225 | |
---|
226 | #endif |
---|
227 | |
---|
228 | |
---|
229 | /* determine whether we have a 64-bit int type for platforms without */ |
---|
230 | /* Autoconf */ |
---|
231 | #if FT_SIZEOF_LONG == (64 / FT_CHAR_BIT) |
---|
232 | |
---|
233 | /* FT_LONG64 must be defined if a 64-bit type is available */ |
---|
234 | #define FT_LONG64 |
---|
235 | #define FT_INT64 long |
---|
236 | |
---|
237 | #elif defined( _MSC_VER ) && _MSC_VER >= 900 /* Visual C++ (and Intel C++) */ |
---|
238 | |
---|
239 | /* this compiler provides the __int64 type */ |
---|
240 | #define FT_LONG64 |
---|
241 | #define FT_INT64 __int64 |
---|
242 | |
---|
243 | #elif defined( __BORLANDC__ ) /* Borland C++ */ |
---|
244 | |
---|
245 | /* XXXX: We should probably check the value of __BORLANDC__ in order */ |
---|
246 | /* to test the compiler version. */ |
---|
247 | |
---|
248 | /* this compiler provides the __int64 type */ |
---|
249 | #define FT_LONG64 |
---|
250 | #define FT_INT64 __int64 |
---|
251 | |
---|
252 | #elif defined( __WATCOMC__ ) /* Watcom C++ */ |
---|
253 | |
---|
254 | /* Watcom doesn't provide 64-bit data types */ |
---|
255 | #define FT_LONG64 |
---|
256 | #define FT_INT64 long long int |
---|
257 | |
---|
258 | #elif defined( __MWERKS__ ) /* Metrowerks CodeWarrior */ |
---|
259 | |
---|
260 | #define FT_LONG64 |
---|
261 | #define FT_INT64 long long int |
---|
262 | |
---|
263 | #elif defined( __GNUC__ ) |
---|
264 | |
---|
265 | /* GCC provides the `long long' type */ |
---|
266 | #define FT_LONG64 |
---|
267 | #define FT_INT64 long long int |
---|
268 | |
---|
269 | #endif /* FT_SIZEOF_LONG == (64 / FT_CHAR_BIT) */ |
---|
270 | |
---|
271 | |
---|
272 | #define FT_BEGIN_STMNT do { |
---|
273 | #define FT_END_STMNT } while ( 0 ) |
---|
274 | #define FT_DUMMY_STMNT FT_BEGIN_STMNT FT_END_STMNT |
---|
275 | |
---|
276 | |
---|
277 | /*************************************************************************/ |
---|
278 | /* */ |
---|
279 | /* A 64-bit data type will create compilation problems if you compile */ |
---|
280 | /* in strict ANSI mode. To avoid them, we disable their use if */ |
---|
281 | /* __STDC__ is defined. You can however ignore this rule by */ |
---|
282 | /* defining the FT_CONFIG_OPTION_FORCE_INT64 configuration macro. */ |
---|
283 | /* */ |
---|
284 | #if defined( FT_LONG64 ) && !defined( FT_CONFIG_OPTION_FORCE_INT64 ) |
---|
285 | |
---|
286 | #ifdef __STDC__ |
---|
287 | |
---|
288 | /* undefine the 64-bit macros in strict ANSI compilation mode */ |
---|
289 | #undef FT_LONG64 |
---|
290 | #undef FT_INT64 |
---|
291 | |
---|
292 | #endif /* __STDC__ */ |
---|
293 | |
---|
294 | #endif /* FT_LONG64 && !FT_CONFIG_OPTION_FORCE_INT64 */ |
---|
295 | |
---|
296 | |
---|
297 | #ifdef FT_MAKE_OPTION_SINGLE_OBJECT |
---|
298 | |
---|
299 | #define FT_LOCAL( x ) static x |
---|
300 | #define FT_LOCAL_DEF( x ) static x |
---|
301 | |
---|
302 | #else |
---|
303 | |
---|
304 | #ifdef __cplusplus |
---|
305 | #define FT_LOCAL( x ) extern "C" x |
---|
306 | #define FT_LOCAL_DEF( x ) extern "C" x |
---|
307 | #else |
---|
308 | #define FT_LOCAL( x ) extern x |
---|
309 | #define FT_LOCAL_DEF( x ) x |
---|
310 | #endif |
---|
311 | |
---|
312 | #endif /* FT_MAKE_OPTION_SINGLE_OBJECT */ |
---|
313 | |
---|
314 | |
---|
315 | #ifndef FT_BASE |
---|
316 | |
---|
317 | #ifdef __cplusplus |
---|
318 | #define FT_BASE( x ) extern "C" x |
---|
319 | #else |
---|
320 | #define FT_BASE( x ) extern x |
---|
321 | #endif |
---|
322 | |
---|
323 | #endif /* !FT_BASE */ |
---|
324 | |
---|
325 | |
---|
326 | #ifndef FT_BASE_DEF |
---|
327 | |
---|
328 | #ifdef __cplusplus |
---|
329 | #define FT_BASE_DEF( x ) x |
---|
330 | #else |
---|
331 | #define FT_BASE_DEF( x ) x |
---|
332 | #endif |
---|
333 | |
---|
334 | #endif /* !FT_BASE_DEF */ |
---|
335 | |
---|
336 | |
---|
337 | #ifndef FT_EXPORT |
---|
338 | |
---|
339 | #ifdef __cplusplus |
---|
340 | #define FT_EXPORT( x ) extern "C" x |
---|
341 | #else |
---|
342 | #define FT_EXPORT( x ) extern x |
---|
343 | #endif |
---|
344 | |
---|
345 | #endif /* !FT_EXPORT */ |
---|
346 | |
---|
347 | |
---|
348 | #ifndef FT_EXPORT_DEF |
---|
349 | |
---|
350 | #ifdef __cplusplus |
---|
351 | #define FT_EXPORT_DEF( x ) extern "C" x |
---|
352 | #else |
---|
353 | #define FT_EXPORT_DEF( x ) extern x |
---|
354 | #endif |
---|
355 | |
---|
356 | #endif /* !FT_EXPORT_DEF */ |
---|
357 | |
---|
358 | |
---|
359 | #ifndef FT_EXPORT_VAR |
---|
360 | |
---|
361 | #ifdef __cplusplus |
---|
362 | #define FT_EXPORT_VAR( x ) extern "C" x |
---|
363 | #else |
---|
364 | #define FT_EXPORT_VAR( x ) extern x |
---|
365 | #endif |
---|
366 | |
---|
367 | #endif /* !FT_EXPORT_VAR */ |
---|
368 | |
---|
369 | /* The following macros are needed to compile the library with a */ |
---|
370 | /* C++ compiler and with 16bit compilers. */ |
---|
371 | /* */ |
---|
372 | |
---|
373 | /* This is special. Within C++, you must specify `extern "C"' for */ |
---|
374 | /* functions which are used via function pointers, and you also */ |
---|
375 | /* must do that for structures which contain function pointers to */ |
---|
376 | /* assure C linkage -- it's not possible to have (local) anonymous */ |
---|
377 | /* functions which are accessed by (global) function pointers. */ |
---|
378 | /* */ |
---|
379 | /* */ |
---|
380 | /* FT_CALLBACK_DEF is used to _define_ a callback function. */ |
---|
381 | /* */ |
---|
382 | /* FT_CALLBACK_TABLE is used to _declare_ a constant variable that */ |
---|
383 | /* contains pointers to callback functions. */ |
---|
384 | /* */ |
---|
385 | /* FT_CALLBACK_TABLE_DEF is used to _define_ a constant variable */ |
---|
386 | /* that contains pointers to callback functions. */ |
---|
387 | /* */ |
---|
388 | /* */ |
---|
389 | /* Some 16bit compilers have to redefine these macros to insert */ |
---|
390 | /* the infamous `_cdecl' or `__fastcall' declarations. */ |
---|
391 | /* */ |
---|
392 | #ifndef FT_CALLBACK_DEF |
---|
393 | #ifdef __cplusplus |
---|
394 | #define FT_CALLBACK_DEF( x ) extern "C" x |
---|
395 | #else |
---|
396 | #define FT_CALLBACK_DEF( x ) static x |
---|
397 | #endif |
---|
398 | #endif /* FT_CALLBACK_DEF */ |
---|
399 | |
---|
400 | #ifndef FT_CALLBACK_TABLE |
---|
401 | #ifdef __cplusplus |
---|
402 | #define FT_CALLBACK_TABLE extern "C" |
---|
403 | #define FT_CALLBACK_TABLE_DEF extern "C" |
---|
404 | #else |
---|
405 | #define FT_CALLBACK_TABLE extern |
---|
406 | #define FT_CALLBACK_TABLE_DEF /* nothing */ |
---|
407 | #endif |
---|
408 | #endif /* FT_CALLBACK_TABLE */ |
---|
409 | |
---|
410 | |
---|
411 | FT_END_HEADER |
---|
412 | |
---|
413 | |
---|
414 | #endif /* __FTCONFIG_H__ */ |
---|
415 | |
---|
416 | |
---|
417 | /* END */ |
---|