1 | /***************************************************************************/ |
---|
2 | /* */ |
---|
3 | /* ftconfig.h */ |
---|
4 | /* */ |
---|
5 | /* ANSI-specific configuration file (specification only). */ |
---|
6 | /* */ |
---|
7 | /* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007, 2008 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 | |
---|
47 | FT_BEGIN_HEADER |
---|
48 | |
---|
49 | |
---|
50 | /*************************************************************************/ |
---|
51 | /* */ |
---|
52 | /* PLATFORM-SPECIFIC CONFIGURATION MACROS */ |
---|
53 | /* */ |
---|
54 | /* These macros can be toggled to suit a specific system. The current */ |
---|
55 | /* ones are defaults used to compile FreeType in an ANSI C environment */ |
---|
56 | /* (16bit compilers are also supported). Copy this file to your own */ |
---|
57 | /* `freetype/builds/<system>' directory, and edit it to port the engine. */ |
---|
58 | /* */ |
---|
59 | /*************************************************************************/ |
---|
60 | |
---|
61 | |
---|
62 | /* There are systems (like the Texas Instruments 'C54x) where a `char' */ |
---|
63 | /* has 16 bits. ANSI C says that sizeof(char) is always 1. Since an */ |
---|
64 | /* `int' has 16 bits also for this system, sizeof(int) gives 1 which */ |
---|
65 | /* is probably unexpected. */ |
---|
66 | /* */ |
---|
67 | /* `CHAR_BIT' (defined in limits.h) gives the number of bits in a */ |
---|
68 | /* `char' type. */ |
---|
69 | |
---|
70 | #ifndef FT_CHAR_BIT |
---|
71 | #define FT_CHAR_BIT CHAR_BIT |
---|
72 | #endif |
---|
73 | |
---|
74 | |
---|
75 | /* The size of an `int' type. */ |
---|
76 | #if FT_UINT_MAX == 0xFFFFUL |
---|
77 | #define FT_SIZEOF_INT (16 / FT_CHAR_BIT) |
---|
78 | #elif FT_UINT_MAX == 0xFFFFFFFFUL |
---|
79 | #define FT_SIZEOF_INT (32 / FT_CHAR_BIT) |
---|
80 | #elif FT_UINT_MAX > 0xFFFFFFFFUL && FT_UINT_MAX == 0xFFFFFFFFFFFFFFFFUL |
---|
81 | #define FT_SIZEOF_INT (64 / FT_CHAR_BIT) |
---|
82 | #else |
---|
83 | #error "Unsupported size of `int' type!" |
---|
84 | #endif |
---|
85 | |
---|
86 | /* The size of a `long' type. A five-byte `long' (as used e.g. on the */ |
---|
87 | /* DM642) is recognized but avoided. */ |
---|
88 | #if FT_ULONG_MAX == 0xFFFFFFFFUL |
---|
89 | #define FT_SIZEOF_LONG (32 / FT_CHAR_BIT) |
---|
90 | #elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFUL |
---|
91 | #define FT_SIZEOF_LONG (32 / FT_CHAR_BIT) |
---|
92 | #elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFFFFFFFUL |
---|
93 | #define FT_SIZEOF_LONG (64 / FT_CHAR_BIT) |
---|
94 | #else |
---|
95 | #error "Unsupported size of `long' type!" |
---|
96 | #endif |
---|
97 | |
---|
98 | |
---|
99 | /* Preferred alignment of data */ |
---|
100 | #define FT_ALIGNMENT 8 |
---|
101 | |
---|
102 | |
---|
103 | /* FT_UNUSED is a macro used to indicate that a given parameter is not */ |
---|
104 | /* used -- this is only used to get rid of unpleasant compiler warnings */ |
---|
105 | #ifndef FT_UNUSED |
---|
106 | #define FT_UNUSED( arg ) ( (arg) = (arg) ) |
---|
107 | #endif |
---|
108 | |
---|
109 | |
---|
110 | /*************************************************************************/ |
---|
111 | /* */ |
---|
112 | /* AUTOMATIC CONFIGURATION MACROS */ |
---|
113 | /* */ |
---|
114 | /* These macros are computed from the ones defined above. Don't touch */ |
---|
115 | /* their definition, unless you know precisely what you are doing. No */ |
---|
116 | /* porter should need to mess with them. */ |
---|
117 | /* */ |
---|
118 | /*************************************************************************/ |
---|
119 | |
---|
120 | |
---|
121 | /*************************************************************************/ |
---|
122 | /* */ |
---|
123 | /* Mac support */ |
---|
124 | /* */ |
---|
125 | /* This is the only necessary change, so it is defined here instead */ |
---|
126 | /* providing a new configuration file. */ |
---|
127 | /* */ |
---|
128 | #if ( defined( __APPLE__ ) && !defined( DARWIN_NO_CARBON ) ) || \ |
---|
129 | ( defined( __MWERKS__ ) && defined( macintosh ) ) |
---|
130 | /* no Carbon frameworks for 64bit 10.4.x */ |
---|
131 | #include "AvailabilityMacros.h" |
---|
132 | #if defined( __LP64__ ) && \ |
---|
133 | ( MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 ) |
---|
134 | #define DARWIN_NO_CARBON 1 |
---|
135 | #else |
---|
136 | #define FT_MACINTOSH 1 |
---|
137 | #endif |
---|
138 | |
---|
139 | #elif defined( __SC__ ) || defined( __MRC__ ) |
---|
140 | /* Classic MacOS compilers */ |
---|
141 | #include "ConditionalMacros.h" |
---|
142 | #if TARGET_OS_MAC |
---|
143 | #define FT_MACINTOSH 1 |
---|
144 | #endif |
---|
145 | |
---|
146 | #endif |
---|
147 | |
---|
148 | |
---|
149 | /*************************************************************************/ |
---|
150 | /* */ |
---|
151 | /* <Section> */ |
---|
152 | /* basic_types */ |
---|
153 | /* */ |
---|
154 | /*************************************************************************/ |
---|
155 | |
---|
156 | |
---|
157 | /*************************************************************************/ |
---|
158 | /* */ |
---|
159 | /* <Type> */ |
---|
160 | /* FT_Int16 */ |
---|
161 | /* */ |
---|
162 | /* <Description> */ |
---|
163 | /* A typedef for a 16bit signed integer type. */ |
---|
164 | /* */ |
---|
165 | typedef signed short FT_Int16; |
---|
166 | |
---|
167 | |
---|
168 | /*************************************************************************/ |
---|
169 | /* */ |
---|
170 | /* <Type> */ |
---|
171 | /* FT_UInt16 */ |
---|
172 | /* */ |
---|
173 | /* <Description> */ |
---|
174 | /* A typedef for a 16bit unsigned integer type. */ |
---|
175 | /* */ |
---|
176 | typedef unsigned short FT_UInt16; |
---|
177 | |
---|
178 | /* */ |
---|
179 | |
---|
180 | |
---|
181 | /* this #if 0 ... #endif clause is for documentation purposes */ |
---|
182 | #if 0 |
---|
183 | |
---|
184 | /*************************************************************************/ |
---|
185 | /* */ |
---|
186 | /* <Type> */ |
---|
187 | /* FT_Int32 */ |
---|
188 | /* */ |
---|
189 | /* <Description> */ |
---|
190 | /* A typedef for a 32bit signed integer type. The size depends on */ |
---|
191 | /* the configuration. */ |
---|
192 | /* */ |
---|
193 | typedef signed XXX FT_Int32; |
---|
194 | |
---|
195 | |
---|
196 | /*************************************************************************/ |
---|
197 | /* */ |
---|
198 | /* <Type> */ |
---|
199 | /* FT_UInt32 */ |
---|
200 | /* */ |
---|
201 | /* A typedef for a 32bit unsigned integer type. The size depends on */ |
---|
202 | /* the configuration. */ |
---|
203 | /* */ |
---|
204 | typedef unsigned XXX FT_UInt32; |
---|
205 | |
---|
206 | /* */ |
---|
207 | |
---|
208 | #endif |
---|
209 | |
---|
210 | #if FT_SIZEOF_INT == (32 / FT_CHAR_BIT) |
---|
211 | |
---|
212 | typedef signed int FT_Int32; |
---|
213 | typedef unsigned int FT_UInt32; |
---|
214 | |
---|
215 | #elif FT_SIZEOF_LONG == (32 / FT_CHAR_BIT) |
---|
216 | |
---|
217 | typedef signed long FT_Int32; |
---|
218 | typedef unsigned long FT_UInt32; |
---|
219 | |
---|
220 | #else |
---|
221 | #error "no 32bit type found -- please check your configuration files" |
---|
222 | #endif |
---|
223 | |
---|
224 | |
---|
225 | /* look up an integer type that is at least 32 bits */ |
---|
226 | #if FT_SIZEOF_INT >= (32 / FT_CHAR_BIT) |
---|
227 | |
---|
228 | typedef int FT_Fast; |
---|
229 | typedef unsigned int FT_UFast; |
---|
230 | |
---|
231 | #elif FT_SIZEOF_LONG >= (32 / FT_CHAR_BIT) |
---|
232 | |
---|
233 | typedef long FT_Fast; |
---|
234 | typedef unsigned long FT_UFast; |
---|
235 | |
---|
236 | #endif |
---|
237 | |
---|
238 | |
---|
239 | /* determine whether we have a 64-bit int type for platforms without */ |
---|
240 | /* Autoconf */ |
---|
241 | #if FT_SIZEOF_LONG == (64 / FT_CHAR_BIT) |
---|
242 | |
---|
243 | /* FT_LONG64 must be defined if a 64-bit type is available */ |
---|
244 | #define FT_LONG64 |
---|
245 | #define FT_INT64 long |
---|
246 | |
---|
247 | #elif defined( _MSC_VER ) && _MSC_VER >= 900 /* Visual C++ (and Intel C++) */ |
---|
248 | |
---|
249 | /* this compiler provides the __int64 type */ |
---|
250 | #define FT_LONG64 |
---|
251 | #define FT_INT64 __int64 |
---|
252 | |
---|
253 | #elif defined( __BORLANDC__ ) /* Borland C++ */ |
---|
254 | |
---|
255 | /* XXXX: We should probably check the value of __BORLANDC__ in order */ |
---|
256 | /* to test the compiler version. */ |
---|
257 | |
---|
258 | /* this compiler provides the __int64 type */ |
---|
259 | #define FT_LONG64 |
---|
260 | #define FT_INT64 __int64 |
---|
261 | |
---|
262 | #elif defined( __WATCOMC__ ) /* Watcom C++ */ |
---|
263 | |
---|
264 | /* Watcom doesn't provide 64-bit data types */ |
---|
265 | #define FT_LONG64 |
---|
266 | #define FT_INT64 long long int |
---|
267 | |
---|
268 | #elif defined( __MWERKS__ ) /* Metrowerks CodeWarrior */ |
---|
269 | |
---|
270 | #define FT_LONG64 |
---|
271 | #define FT_INT64 long long int |
---|
272 | |
---|
273 | #elif defined( __GNUC__ ) |
---|
274 | |
---|
275 | /* GCC provides the `long long' type */ |
---|
276 | #define FT_LONG64 |
---|
277 | #define FT_INT64 long long int |
---|
278 | |
---|
279 | #endif /* FT_SIZEOF_LONG == (64 / FT_CHAR_BIT) */ |
---|
280 | |
---|
281 | |
---|
282 | /*************************************************************************/ |
---|
283 | /* */ |
---|
284 | /* A 64-bit data type will create compilation problems if you compile */ |
---|
285 | /* in strict ANSI mode. To avoid them, we disable its use if __STDC__ */ |
---|
286 | /* is defined. You can however ignore this rule by defining the */ |
---|
287 | /* FT_CONFIG_OPTION_FORCE_INT64 configuration macro. */ |
---|
288 | /* */ |
---|
289 | #if defined( FT_LONG64 ) && !defined( FT_CONFIG_OPTION_FORCE_INT64 ) |
---|
290 | |
---|
291 | #ifdef __STDC__ |
---|
292 | |
---|
293 | /* undefine the 64-bit macros in strict ANSI compilation mode */ |
---|
294 | #undef FT_LONG64 |
---|
295 | #undef FT_INT64 |
---|
296 | |
---|
297 | #endif /* __STDC__ */ |
---|
298 | |
---|
299 | #endif /* FT_LONG64 && !FT_CONFIG_OPTION_FORCE_INT64 */ |
---|
300 | |
---|
301 | |
---|
302 | #define FT_BEGIN_STMNT do { |
---|
303 | #define FT_END_STMNT } while ( 0 ) |
---|
304 | #define FT_DUMMY_STMNT FT_BEGIN_STMNT FT_END_STMNT |
---|
305 | |
---|
306 | |
---|
307 | #ifndef FT_CONFIG_OPTION_NO_ASSEMBLER |
---|
308 | /* Provide assembler fragments for performance-critical functions. */ |
---|
309 | /* These must be defined `static __inline__' with GCC. */ |
---|
310 | |
---|
311 | #ifdef __GNUC__ |
---|
312 | |
---|
313 | #if defined( __arm__ ) && !defined( __thumb__ ) |
---|
314 | #define FT_MULFIX_ASSEMBLER FT_MulFix_arm |
---|
315 | |
---|
316 | /* documentation is in freetype.h */ |
---|
317 | |
---|
318 | static __inline__ FT_Int32 |
---|
319 | FT_MulFix_arm( FT_Int32 a, |
---|
320 | FT_Int32 b ) |
---|
321 | { |
---|
322 | register FT_Int32 t, t2; |
---|
323 | |
---|
324 | |
---|
325 | asm __volatile__ ( |
---|
326 | "smull %1, %2, %4, %3\n\t" /* (lo=%1,hi=%2) = a*b */ |
---|
327 | "mov %0, %2, asr #31\n\t" /* %0 = (hi >> 31) */ |
---|
328 | "add %0, %0, #0x8000\n\t" /* %0 += 0x8000 */ |
---|
329 | "adds %1, %1, %0\n\t" /* %1 += %0 */ |
---|
330 | "adc %2, %2, #0\n\t" /* %2 += carry */ |
---|
331 | "mov %0, %1, lsr #16\n\t" /* %0 = %1 >> 16 */ |
---|
332 | "orr %0, %2, lsl #16\n\t" /* %0 |= %2 << 16 */ |
---|
333 | : "=r"(a), "=&r"(t2), "=&r"(t) |
---|
334 | : "r"(a), "r"(b) ); |
---|
335 | return a; |
---|
336 | } |
---|
337 | |
---|
338 | #endif /* __arm__ && !__thumb__ */ |
---|
339 | |
---|
340 | #if defined( i386 ) |
---|
341 | #define FT_MULFIX_ASSEMBLER FT_MulFix_i386 |
---|
342 | |
---|
343 | /* documentation is in freetype.h */ |
---|
344 | |
---|
345 | static __inline__ FT_Int32 |
---|
346 | FT_MulFix_i386( FT_Int32 a, |
---|
347 | FT_Int32 b ) |
---|
348 | { |
---|
349 | register FT_Int32 result; |
---|
350 | |
---|
351 | |
---|
352 | __asm__ __volatile__ ( |
---|
353 | "imul %%edx\n" |
---|
354 | "movl %%edx, %%ecx\n" |
---|
355 | "sarl $31, %%ecx\n" |
---|
356 | "addl $0x8000, %%ecx\n" |
---|
357 | "addl %%ecx, %%eax\n" |
---|
358 | "adcl $0, %%edx\n" |
---|
359 | "shrl $16, %%eax\n" |
---|
360 | "shll $16, %%edx\n" |
---|
361 | "addl %%edx, %%eax\n" |
---|
362 | : "=a"(result), "+d"(b) |
---|
363 | : "a"(a) |
---|
364 | : "%ecx" ); |
---|
365 | return result; |
---|
366 | } |
---|
367 | |
---|
368 | #endif /* i386 */ |
---|
369 | |
---|
370 | #endif /* __GNUC__ */ |
---|
371 | |
---|
372 | #endif /* !FT_CONFIG_OPTION_NO_ASSEMBLER */ |
---|
373 | |
---|
374 | |
---|
375 | #ifdef FT_CONFIG_OPTION_INLINE_MULFIX |
---|
376 | #ifdef FT_MULFIX_ASSEMBLER |
---|
377 | #define FT_MULFIX_INLINED FT_MULFIX_ASSEMBLER |
---|
378 | #endif |
---|
379 | #endif |
---|
380 | |
---|
381 | |
---|
382 | #ifdef FT_MAKE_OPTION_SINGLE_OBJECT |
---|
383 | |
---|
384 | #define FT_LOCAL( x ) static x |
---|
385 | #define FT_LOCAL_DEF( x ) static x |
---|
386 | |
---|
387 | #else |
---|
388 | |
---|
389 | #ifdef __cplusplus |
---|
390 | #define FT_LOCAL( x ) extern "C" x |
---|
391 | #define FT_LOCAL_DEF( x ) extern "C" x |
---|
392 | #else |
---|
393 | #define FT_LOCAL( x ) extern x |
---|
394 | #define FT_LOCAL_DEF( x ) x |
---|
395 | #endif |
---|
396 | |
---|
397 | #endif /* FT_MAKE_OPTION_SINGLE_OBJECT */ |
---|
398 | |
---|
399 | |
---|
400 | #ifndef FT_BASE |
---|
401 | |
---|
402 | #ifdef __cplusplus |
---|
403 | #define FT_BASE( x ) extern "C" x |
---|
404 | #else |
---|
405 | #define FT_BASE( x ) extern x |
---|
406 | #endif |
---|
407 | |
---|
408 | #endif /* !FT_BASE */ |
---|
409 | |
---|
410 | |
---|
411 | #ifndef FT_BASE_DEF |
---|
412 | |
---|
413 | #ifdef __cplusplus |
---|
414 | #define FT_BASE_DEF( x ) x |
---|
415 | #else |
---|
416 | #define FT_BASE_DEF( x ) x |
---|
417 | #endif |
---|
418 | |
---|
419 | #endif /* !FT_BASE_DEF */ |
---|
420 | |
---|
421 | |
---|
422 | #ifndef FT_EXPORT |
---|
423 | |
---|
424 | #ifdef __cplusplus |
---|
425 | #define FT_EXPORT( x ) extern "C" x |
---|
426 | #else |
---|
427 | #define FT_EXPORT( x ) extern x |
---|
428 | #endif |
---|
429 | |
---|
430 | #endif /* !FT_EXPORT */ |
---|
431 | |
---|
432 | |
---|
433 | #ifndef FT_EXPORT_DEF |
---|
434 | |
---|
435 | #ifdef __cplusplus |
---|
436 | #define FT_EXPORT_DEF( x ) extern "C" x |
---|
437 | #else |
---|
438 | #define FT_EXPORT_DEF( x ) extern x |
---|
439 | #endif |
---|
440 | |
---|
441 | #endif /* !FT_EXPORT_DEF */ |
---|
442 | |
---|
443 | |
---|
444 | #ifndef FT_EXPORT_VAR |
---|
445 | |
---|
446 | #ifdef __cplusplus |
---|
447 | #define FT_EXPORT_VAR( x ) extern "C" x |
---|
448 | #else |
---|
449 | #define FT_EXPORT_VAR( x ) extern x |
---|
450 | #endif |
---|
451 | |
---|
452 | #endif /* !FT_EXPORT_VAR */ |
---|
453 | |
---|
454 | /* The following macros are needed to compile the library with a */ |
---|
455 | /* C++ compiler and with 16bit compilers. */ |
---|
456 | /* */ |
---|
457 | |
---|
458 | /* This is special. Within C++, you must specify `extern "C"' for */ |
---|
459 | /* functions which are used via function pointers, and you also */ |
---|
460 | /* must do that for structures which contain function pointers to */ |
---|
461 | /* assure C linkage -- it's not possible to have (local) anonymous */ |
---|
462 | /* functions which are accessed by (global) function pointers. */ |
---|
463 | /* */ |
---|
464 | /* */ |
---|
465 | /* FT_CALLBACK_DEF is used to _define_ a callback function. */ |
---|
466 | /* */ |
---|
467 | /* FT_CALLBACK_TABLE is used to _declare_ a constant variable that */ |
---|
468 | /* contains pointers to callback functions. */ |
---|
469 | /* */ |
---|
470 | /* FT_CALLBACK_TABLE_DEF is used to _define_ a constant variable */ |
---|
471 | /* that contains pointers to callback functions. */ |
---|
472 | /* */ |
---|
473 | /* */ |
---|
474 | /* Some 16bit compilers have to redefine these macros to insert */ |
---|
475 | /* the infamous `_cdecl' or `__fastcall' declarations. */ |
---|
476 | /* */ |
---|
477 | #ifndef FT_CALLBACK_DEF |
---|
478 | #ifdef __cplusplus |
---|
479 | #define FT_CALLBACK_DEF( x ) extern "C" x |
---|
480 | #else |
---|
481 | #define FT_CALLBACK_DEF( x ) static x |
---|
482 | #endif |
---|
483 | #endif /* FT_CALLBACK_DEF */ |
---|
484 | |
---|
485 | #ifndef FT_CALLBACK_TABLE |
---|
486 | #ifdef __cplusplus |
---|
487 | #define FT_CALLBACK_TABLE extern "C" |
---|
488 | #define FT_CALLBACK_TABLE_DEF extern "C" |
---|
489 | #else |
---|
490 | #define FT_CALLBACK_TABLE extern |
---|
491 | #define FT_CALLBACK_TABLE_DEF /* nothing */ |
---|
492 | #endif |
---|
493 | #endif /* FT_CALLBACK_TABLE */ |
---|
494 | |
---|
495 | |
---|
496 | FT_END_HEADER |
---|
497 | |
---|
498 | |
---|
499 | #endif /* __FTCONFIG_H__ */ |
---|
500 | |
---|
501 | |
---|
502 | /* END */ |
---|