OLD | NEW |
1 /***************************************************************************/ | 1 /***************************************************************************/ |
2 /* */ | 2 /* */ |
3 /* ftconfig.h */ | 3 /* ftconfig.h */ |
4 /* */ | 4 /* */ |
5 /* ANSI-specific configuration file (specification only). */ | 5 /* ANSI-specific configuration file (specification only). */ |
6 /* */ | 6 /* */ |
7 /* Copyright 1996-2004, 2006-2008, 2010-2011, 2013 by */ | 7 /* Copyright 1996-2004, 2006-2008, 2010-2011, 2013, 2014 by */ |
8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ | 8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
9 /* */ | 9 /* */ |
10 /* This file is part of the FreeType project, and may only be used, */ | 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 */ | 11 /* modified, and distributed under the terms of the FreeType project */ |
12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ | 12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ |
13 /* this file you indicate that you have read the license and */ | 13 /* this file you indicate that you have read the license and */ |
14 /* understand and accept it fully. */ | 14 /* understand and accept it fully. */ |
15 /* */ | 15 /* */ |
16 /***************************************************************************/ | 16 /***************************************************************************/ |
17 | 17 |
18 | 18 |
19 /*************************************************************************/ | 19 /*************************************************************************/ |
20 /* */ | 20 /* */ |
21 /* This header file contains a number of macro definitions that are used */ | 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 */ | 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 */ | 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 */ | 24 /* port FreeType, except to compile the library with a non-ANSI */ |
25 /* compiler. */ | 25 /* compiler. */ |
26 /* */ | 26 /* */ |
27 /* Note however that if some specific modifications are needed, we */ | 27 /* Note however that if some specific modifications are needed, we */ |
28 /* advise you to place a modified copy in your build directory. */ | 28 /* advise you to place a modified copy in your build directory. */ |
29 /* */ | 29 /* */ |
30 /* The build directory is usually `freetype/builds/<system>', and */ | 30 /* The build directory is usually `builds/<system>', and contains */ |
31 /* contains system-specific files that are always included first when */ | 31 /* system-specific files that are always included first when building */ |
32 /* building the library. */ | 32 /* the library. */ |
33 /* */ | 33 /* */ |
34 /* This ANSI version should stay in `include/freetype/config'. */ | 34 /* This ANSI version should stay in `include/config/'. */ |
35 /* */ | 35 /* */ |
36 /*************************************************************************/ | 36 /*************************************************************************/ |
37 | 37 |
38 #ifndef __FTCONFIG_H__ | 38 #ifndef __FTCONFIG_H__ |
39 #define __FTCONFIG_H__ | 39 #define __FTCONFIG_H__ |
40 | 40 |
41 #include "../../ft2build.h" | 41 #include <ft2build.h> |
42 #include "ftoption.h" | 42 #include FT_CONFIG_OPTIONS_H |
43 #include "ftstdlib.h" | 43 #include FT_CONFIG_STANDARD_LIBRARY_H |
44 | 44 |
45 | 45 |
46 FT_BEGIN_HEADER | 46 FT_BEGIN_HEADER |
47 | 47 |
48 | 48 |
49 /*************************************************************************/ | 49 /*************************************************************************/ |
50 /* */ | 50 /* */ |
51 /* PLATFORM-SPECIFIC CONFIGURATION MACROS */ | 51 /* PLATFORM-SPECIFIC CONFIGURATION MACROS */ |
52 /* */ | 52 /* */ |
53 /* These macros can be toggled to suit a specific system. The current */ | 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 */ | 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 */ | 55 /* (16bit compilers are also supported). Copy this file to your own */ |
56 /* `freetype/builds/<system>' directory, and edit it to port the engine. */ | 56 /* `builds/<system>' directory, and edit it to port the engine. */ |
57 /* */ | 57 /* */ |
58 /*************************************************************************/ | 58 /*************************************************************************/ |
59 | 59 |
60 | 60 |
61 /* There are systems (like the Texas Instruments 'C54x) where a `char' */ | 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 */ | 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 */ | 63 /* `int' has 16 bits also for this system, sizeof(int) gives 1 which */ |
64 /* is probably unexpected. */ | 64 /* is probably unexpected. */ |
65 /* */ | 65 /* */ |
66 /* `CHAR_BIT' (defined in limits.h) gives the number of bits in a */ | 66 /* `CHAR_BIT' (defined in limits.h) gives the number of bits in a */ |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 | 259 |
260 /* determine whether we have a 64-bit int type for platforms without */ | 260 /* determine whether we have a 64-bit int type for platforms without */ |
261 /* Autoconf */ | 261 /* Autoconf */ |
262 #if FT_SIZEOF_LONG == (64 / FT_CHAR_BIT) | 262 #if FT_SIZEOF_LONG == (64 / FT_CHAR_BIT) |
263 | 263 |
264 /* FT_LONG64 must be defined if a 64-bit type is available */ | 264 /* FT_LONG64 must be defined if a 64-bit type is available */ |
265 #define FT_LONG64 | 265 #define FT_LONG64 |
266 #define FT_INT64 long | 266 #define FT_INT64 long |
267 #define FT_UINT64 unsigned long | 267 #define FT_UINT64 unsigned long |
268 | 268 |
269 #elif defined( _MSC_VER ) && _MSC_VER >= 900 /* Visual C++ (and Intel C++) */ | 269 /*************************************************************************/ |
| 270 /* */ |
| 271 /* A 64-bit data type may create compilation problems if you compile */ |
| 272 /* in strict ANSI mode. To avoid them, we disable other 64-bit data */ |
| 273 /* types if __STDC__ is defined. You can however ignore this rule */ |
| 274 /* by defining the FT_CONFIG_OPTION_FORCE_INT64 configuration macro. */ |
| 275 /* */ |
| 276 #elif !defined( __STDC__ ) || defined( FT_CONFIG_OPTION_FORCE_INT64 ) |
| 277 |
| 278 #if defined( _MSC_VER ) && _MSC_VER >= 900 /* Visual C++ (and Intel C++) */ |
270 | 279 |
271 /* this compiler provides the __int64 type */ | 280 /* this compiler provides the __int64 type */ |
272 #define FT_LONG64 | 281 #define FT_LONG64 |
273 #define FT_INT64 __int64 | 282 #define FT_INT64 __int64 |
274 #define FT_UINT64 unsigned __int64 | 283 #define FT_UINT64 unsigned __int64 |
275 | 284 |
276 #elif defined( __BORLANDC__ ) /* Borland C++ */ | 285 #elif defined( __BORLANDC__ ) /* Borland C++ */ |
277 | 286 |
278 /* XXXX: We should probably check the value of __BORLANDC__ in order */ | 287 /* XXXX: We should probably check the value of __BORLANDC__ in order */ |
279 /* to test the compiler version. */ | 288 /* to test the compiler version. */ |
(...skipping 13 matching lines...) Expand all Loading... |
293 #define FT_INT64 long long int | 302 #define FT_INT64 long long int |
294 #define FT_UINT64 unsigned long long int | 303 #define FT_UINT64 unsigned long long int |
295 | 304 |
296 #elif defined( __GNUC__ ) | 305 #elif defined( __GNUC__ ) |
297 | 306 |
298 /* GCC provides the `long long' type */ | 307 /* GCC provides the `long long' type */ |
299 #define FT_LONG64 | 308 #define FT_LONG64 |
300 #define FT_INT64 long long int | 309 #define FT_INT64 long long int |
301 #define FT_UINT64 unsigned long long int | 310 #define FT_UINT64 unsigned long long int |
302 | 311 |
| 312 #endif /* _MSC_VER */ |
| 313 |
303 #endif /* FT_SIZEOF_LONG == (64 / FT_CHAR_BIT) */ | 314 #endif /* FT_SIZEOF_LONG == (64 / FT_CHAR_BIT) */ |
304 | 315 |
305 | |
306 /*************************************************************************/ | |
307 /* */ | |
308 /* A 64-bit data type will create compilation problems if you compile */ | |
309 /* in strict ANSI mode. To avoid them, we disable its use if __STDC__ */ | |
310 /* is defined. You can however ignore this rule by defining the */ | |
311 /* FT_CONFIG_OPTION_FORCE_INT64 configuration macro. */ | |
312 /* */ | |
313 #if defined( FT_LONG64 ) && !defined( FT_CONFIG_OPTION_FORCE_INT64 ) | |
314 | |
315 #ifdef __STDC__ | |
316 | |
317 /* undefine the 64-bit macros in strict ANSI compilation mode */ | |
318 #undef FT_LONG64 | |
319 #undef FT_INT64 | |
320 | |
321 #endif /* __STDC__ */ | |
322 | |
323 #endif /* FT_LONG64 && !FT_CONFIG_OPTION_FORCE_INT64 */ | |
324 | |
325 #ifdef FT_LONG64 | 316 #ifdef FT_LONG64 |
326 typedef FT_INT64 FT_Int64; | 317 typedef FT_INT64 FT_Int64; |
327 typedef FT_UINT64 FT_UInt64; | 318 typedef FT_UINT64 FT_UInt64; |
328 #endif | 319 #endif |
329 | 320 |
330 | 321 |
331 #define FT_BEGIN_STMNT do { | 322 #define FT_BEGIN_STMNT do { |
332 #define FT_END_STMNT } while ( 0 ) | 323 #define FT_END_STMNT } while ( 0 ) |
333 #define FT_DUMMY_STMNT FT_BEGIN_STMNT FT_END_STMNT | 324 #define FT_DUMMY_STMNT FT_BEGIN_STMNT FT_END_STMNT |
334 | 325 |
335 | 326 |
336 #ifndef FT_CONFIG_OPTION_NO_ASSEMBLER | |
337 /* Provide assembler fragments for performance-critical functions. */ | |
338 /* These must be defined `static __inline__' with GCC. */ | |
339 | |
340 /**Johnson add !defined( __thumb__ )*/ | |
341 #if (defined( __CC_ARM ) || defined( __ARMCC__ ))&& !defined( __thumb__ ) /* RV
CT */ | |
342 #define FT_MULFIX_ASSEMBLER FT_MulFix_arm | |
343 | |
344 /* documentation is in freetype.h */ | |
345 | |
346 static __inline FT_Int32 | |
347 FT_MulFix_arm( FT_Int32 a, | |
348 FT_Int32 b ) | |
349 { | |
350 register FT_Int32 t, t2; | |
351 | |
352 | |
353 __asm | |
354 { | |
355 smull t2, t, b, a /* (lo=t2,hi=t) = a*b */ | |
356 mov a, t, asr #31 /* a = (hi >> 31) */ | |
357 add a, a, #0x8000 /* a += 0x8000 */ | |
358 adds t2, t2, a /* t2 += a */ | |
359 adc t, t, #0 /* t += carry */ | |
360 mov a, t2, lsr #16 /* a = t2 >> 16 */ | |
361 orr a, a, t, lsl #16 /* a |= t << 16 */ | |
362 } | |
363 return a; | |
364 } | |
365 | |
366 #endif /* __CC_ARM || __ARMCC__ */ | |
367 | |
368 | |
369 #ifdef __GNUC__ | |
370 | |
371 #if defined( __arm__ ) && !defined( __thumb__ ) && \ | |
372 !( defined( __CC_ARM ) || defined( __ARMCC__ ) ) | |
373 #define FT_MULFIX_ASSEMBLER FT_MulFix_arm | |
374 | |
375 /* documentation is in freetype.h */ | |
376 | |
377 static __inline__ FT_Int32 | |
378 FT_MulFix_arm( FT_Int32 a, | |
379 FT_Int32 b ) | |
380 { | |
381 register FT_Int32 t, t2; | |
382 | |
383 | |
384 __asm__ __volatile__ ( | |
385 "smull %1, %2, %4, %3\n\t" /* (lo=%1,hi=%2) = a*b */ | |
386 "mov %0, %2, asr #31\n\t" /* %0 = (hi >> 31) */ | |
387 "add %0, %0, #0x8000\n\t" /* %0 += 0x8000 */ | |
388 "adds %1, %1, %0\n\t" /* %1 += %0 */ | |
389 "adc %2, %2, #0\n\t" /* %2 += carry */ | |
390 "mov %0, %1, lsr #16\n\t" /* %0 = %1 >> 16 */ | |
391 "orr %0, %0, %2, lsl #16\n\t" /* %0 |= %2 << 16 */ | |
392 : "=r"(a), "=&r"(t2), "=&r"(t) | |
393 : "r"(a), "r"(b) | |
394 : "cc" ); | |
395 return a; | |
396 } | |
397 | |
398 #endif /* __arm__ && !__thumb__ && !( __CC_ARM || __ARMCC__ ) */ | |
399 | |
400 #if defined( __i386__ ) | |
401 #define FT_MULFIX_ASSEMBLER FT_MulFix_i386 | |
402 | |
403 /* documentation is in freetype.h */ | |
404 | |
405 static __inline__ FT_Int32 | |
406 FT_MulFix_i386( FT_Int32 a, | |
407 FT_Int32 b ) | |
408 { | |
409 register FT_Int32 result; | |
410 | |
411 | |
412 __asm__ __volatile__ ( | |
413 "imul %%edx\n" | |
414 "movl %%edx, %%ecx\n" | |
415 "sarl $31, %%ecx\n" | |
416 "addl $0x8000, %%ecx\n" | |
417 "addl %%ecx, %%eax\n" | |
418 "adcl $0, %%edx\n" | |
419 "shrl $16, %%eax\n" | |
420 "shll $16, %%edx\n" | |
421 "addl %%edx, %%eax\n" | |
422 : "=a"(result), "=d"(b) | |
423 : "a"(a), "d"(b) | |
424 : "%ecx", "cc" ); | |
425 return result; | |
426 } | |
427 | |
428 #endif /* i386 */ | |
429 | |
430 #endif /* __GNUC__ */ | |
431 | |
432 | |
433 #ifdef _MSC_VER /* Visual C++ */ | |
434 | |
435 #ifdef _M_IX86 | |
436 | |
437 #define FT_MULFIX_ASSEMBLER FT_MulFix_i386 | |
438 | |
439 /* documentation is in freetype.h */ | |
440 | |
441 static __inline FT_Int32 | |
442 FT_MulFix_i386( FT_Int32 a, | |
443 FT_Int32 b ) | |
444 { | |
445 register FT_Int32 result; | |
446 | |
447 __asm | |
448 { | |
449 mov eax, a | |
450 mov edx, b | |
451 imul edx | |
452 mov ecx, edx | |
453 sar ecx, 31 | |
454 add ecx, 8000h | |
455 add eax, ecx | |
456 adc edx, 0 | |
457 shr eax, 16 | |
458 shl edx, 16 | |
459 add eax, edx | |
460 mov result, eax | |
461 } | |
462 return result; | |
463 } | |
464 | |
465 #endif /* _M_IX86 */ | |
466 | |
467 #endif /* _MSC_VER */ | |
468 | |
469 #endif /* !FT_CONFIG_OPTION_NO_ASSEMBLER */ | |
470 | |
471 | |
472 #ifdef FT_CONFIG_OPTION_INLINE_MULFIX | |
473 #ifdef FT_MULFIX_ASSEMBLER | |
474 #define FT_MULFIX_INLINED FT_MULFIX_ASSEMBLER | |
475 #endif | |
476 #endif | |
477 | |
478 | |
479 #ifdef FT_MAKE_OPTION_SINGLE_OBJECT | 327 #ifdef FT_MAKE_OPTION_SINGLE_OBJECT |
480 | 328 |
481 #define FT_LOCAL( x ) static x | 329 #define FT_LOCAL( x ) static x |
482 #define FT_LOCAL_DEF( x ) static x | 330 #define FT_LOCAL_DEF( x ) static x |
483 | 331 |
484 #else | 332 #else |
485 | 333 |
486 #ifdef __cplusplus | 334 #ifdef __cplusplus |
487 #define FT_LOCAL( x ) extern "C" x | 335 #define FT_LOCAL( x ) extern "C" x |
488 #define FT_LOCAL_DEF( x ) extern "C" x | 336 #define FT_LOCAL_DEF( x ) extern "C" x |
489 #else | 337 #else |
490 #define FT_LOCAL( x ) extern x | 338 #define FT_LOCAL( x ) extern x |
491 #define FT_LOCAL_DEF( x ) x | 339 #define FT_LOCAL_DEF( x ) x |
492 #endif | 340 #endif |
493 | 341 |
494 #endif /* FT_MAKE_OPTION_SINGLE_OBJECT */ | 342 #endif /* FT_MAKE_OPTION_SINGLE_OBJECT */ |
495 | 343 |
| 344 #define FT_LOCAL_ARRAY( x ) extern const x |
| 345 #define FT_LOCAL_ARRAY_DEF( x ) const x |
| 346 |
496 | 347 |
497 #ifndef FT_BASE | 348 #ifndef FT_BASE |
498 | 349 |
499 #ifdef __cplusplus | 350 #ifdef __cplusplus |
500 #define FT_BASE( x ) extern "C" x | 351 #define FT_BASE( x ) extern "C" x |
501 #else | 352 #else |
502 #define FT_BASE( x ) extern x | 353 #define FT_BASE( x ) extern x |
503 #endif | 354 #endif |
504 | 355 |
505 #endif /* !FT_BASE */ | 356 #endif /* !FT_BASE */ |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 #endif /* FT_CALLBACK_TABLE */ | 441 #endif /* FT_CALLBACK_TABLE */ |
591 | 442 |
592 | 443 |
593 FT_END_HEADER | 444 FT_END_HEADER |
594 | 445 |
595 | 446 |
596 #endif /* __FTCONFIG_H__ */ | 447 #endif /* __FTCONFIG_H__ */ |
597 | 448 |
598 | 449 |
599 /* END */ | 450 /* END */ |
OLD | NEW |