Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenftconfig.h
Go to the documentation of this file.
00001 /***************************************************************************/ 00002 /* */ 00003 /* ftconfig.h */ 00004 /* */ 00005 /* ANSI-specific configuration file (specification only). */ 00006 /* */ 00007 /* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007, 2008, 2010 by */ 00008 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 00009 /* */ 00010 /* This file is part of the FreeType project, and may only be used, */ 00011 /* modified, and distributed under the terms of the FreeType project */ 00012 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 00013 /* this file you indicate that you have read the license and */ 00014 /* understand and accept it fully. */ 00015 /* */ 00016 /***************************************************************************/ 00017 00018 00019 /*************************************************************************/ 00020 /* */ 00021 /* This header file contains a number of macro definitions that are used */ 00022 /* by the rest of the engine. Most of the macros here are automatically */ 00023 /* determined at compile time, and you should not need to change it to */ 00024 /* port FreeType, except to compile the library with a non-ANSI */ 00025 /* compiler. */ 00026 /* */ 00027 /* Note however that if some specific modifications are needed, we */ 00028 /* advise you to place a modified copy in your build directory. */ 00029 /* */ 00030 /* The build directory is usually `freetype/builds/<system>', and */ 00031 /* contains system-specific files that are always included first when */ 00032 /* building the library. */ 00033 /* */ 00034 /* This ANSI version should stay in `include/freetype/config'. */ 00035 /* */ 00036 /*************************************************************************/ 00037 00038 #ifndef __FTCONFIG_H__ 00039 #define __FTCONFIG_H__ 00040 00041 #include <ft2build.h> 00042 #include FT_CONFIG_OPTIONS_H 00043 #include FT_CONFIG_STANDARD_LIBRARY_H 00044 00045 00046 FT_BEGIN_HEADER 00047 00048 00049 /*************************************************************************/ 00050 /* */ 00051 /* PLATFORM-SPECIFIC CONFIGURATION MACROS */ 00052 /* */ 00053 /* These macros can be toggled to suit a specific system. The current */ 00054 /* ones are defaults used to compile FreeType in an ANSI C environment */ 00055 /* (16bit compilers are also supported). Copy this file to your own */ 00056 /* `freetype/builds/<system>' directory, and edit it to port the engine. */ 00057 /* */ 00058 /*************************************************************************/ 00059 00060 00061 /* There are systems (like the Texas Instruments 'C54x) where a `char' */ 00062 /* has 16 bits. ANSI C says that sizeof(char) is always 1. Since an */ 00063 /* `int' has 16 bits also for this system, sizeof(int) gives 1 which */ 00064 /* is probably unexpected. */ 00065 /* */ 00066 /* `CHAR_BIT' (defined in limits.h) gives the number of bits in a */ 00067 /* `char' type. */ 00068 00069 #ifndef FT_CHAR_BIT 00070 #define FT_CHAR_BIT CHAR_BIT 00071 #endif 00072 00073 00074 /* The size of an `int' type. */ 00075 #if FT_UINT_MAX == 0xFFFFUL 00076 #define FT_SIZEOF_INT (16 / FT_CHAR_BIT) 00077 #elif FT_UINT_MAX == 0xFFFFFFFFUL 00078 #define FT_SIZEOF_INT (32 / FT_CHAR_BIT) 00079 #elif FT_UINT_MAX > 0xFFFFFFFFUL && FT_UINT_MAX == 0xFFFFFFFFFFFFFFFFUL 00080 #define FT_SIZEOF_INT (64 / FT_CHAR_BIT) 00081 #else 00082 #error "Unsupported size of `int' type!" 00083 #endif 00084 00085 /* The size of a `long' type. A five-byte `long' (as used e.g. on the */ 00086 /* DM642) is recognized but avoided. */ 00087 #if FT_ULONG_MAX == 0xFFFFFFFFUL 00088 #define FT_SIZEOF_LONG (32 / FT_CHAR_BIT) 00089 #elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFUL 00090 #define FT_SIZEOF_LONG (32 / FT_CHAR_BIT) 00091 #elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFFFFFFFUL 00092 #define FT_SIZEOF_LONG (64 / FT_CHAR_BIT) 00093 #else 00094 #error "Unsupported size of `long' type!" 00095 #endif 00096 00097 00098 /* Preferred alignment of data */ 00099 #define FT_ALIGNMENT 8 00100 00101 00102 /* FT_UNUSED is a macro used to indicate that a given parameter is not */ 00103 /* used -- this is only used to get rid of unpleasant compiler warnings */ 00104 #ifndef FT_UNUSED 00105 #define FT_UNUSED( arg ) ( (arg) = (arg) ) 00106 #endif 00107 00108 00109 /*************************************************************************/ 00110 /* */ 00111 /* AUTOMATIC CONFIGURATION MACROS */ 00112 /* */ 00113 /* These macros are computed from the ones defined above. Don't touch */ 00114 /* their definition, unless you know precisely what you are doing. No */ 00115 /* porter should need to mess with them. */ 00116 /* */ 00117 /*************************************************************************/ 00118 00119 00120 /*************************************************************************/ 00121 /* */ 00122 /* Mac support */ 00123 /* */ 00124 /* This is the only necessary change, so it is defined here instead */ 00125 /* providing a new configuration file. */ 00126 /* */ 00127 #if ( defined( __APPLE__ ) && !defined( DARWIN_NO_CARBON ) ) || \ 00128 ( defined( __MWERKS__ ) && defined( macintosh ) ) 00129 /* no Carbon frameworks for 64bit 10.4.x */ 00130 #include "AvailabilityMacros.h" 00131 #if defined( __LP64__ ) && \ 00132 ( MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 ) 00133 #define DARWIN_NO_CARBON 1 00134 #else 00135 #define FT_MACINTOSH 1 00136 #endif 00137 00138 #elif defined( __SC__ ) || defined( __MRC__ ) 00139 /* Classic MacOS compilers */ 00140 #include "ConditionalMacros.h" 00141 #if TARGET_OS_MAC 00142 #define FT_MACINTOSH 1 00143 #endif 00144 00145 #endif 00146 00147 00148 /*************************************************************************/ 00149 /* */ 00150 /* <Section> */ 00151 /* basic_types */ 00152 /* */ 00153 /*************************************************************************/ 00154 00155 00156 /*************************************************************************/ 00157 /* */ 00158 /* <Type> */ 00159 /* FT_Int16 */ 00160 /* */ 00161 /* <Description> */ 00162 /* A typedef for a 16bit signed integer type. */ 00163 /* */ 00164 typedef signed short FT_Int16; 00165 00166 00167 /*************************************************************************/ 00168 /* */ 00169 /* <Type> */ 00170 /* FT_UInt16 */ 00171 /* */ 00172 /* <Description> */ 00173 /* A typedef for a 16bit unsigned integer type. */ 00174 /* */ 00175 typedef unsigned short FT_UInt16; 00176 00177 /* */ 00178 00179 00180 /* this #if 0 ... #endif clause is for documentation purposes */ 00181 #if 0 00182 00183 /*************************************************************************/ 00184 /* */ 00185 /* <Type> */ 00186 /* FT_Int32 */ 00187 /* */ 00188 /* <Description> */ 00189 /* A typedef for a 32bit signed integer type. The size depends on */ 00190 /* the configuration. */ 00191 /* */ 00192 typedef signed XXX FT_Int32; 00193 00194 00195 /*************************************************************************/ 00196 /* */ 00197 /* <Type> */ 00198 /* FT_UInt32 */ 00199 /* */ 00200 /* A typedef for a 32bit unsigned integer type. The size depends on */ 00201 /* the configuration. */ 00202 /* */ 00203 typedef unsigned XXX FT_UInt32; 00204 00205 /* */ 00206 00207 #endif 00208 00209 #if FT_SIZEOF_INT == (32 / FT_CHAR_BIT) 00210 00211 typedef signed int FT_Int32; 00212 typedef unsigned int FT_UInt32; 00213 00214 #elif FT_SIZEOF_LONG == (32 / FT_CHAR_BIT) 00215 00216 typedef signed long FT_Int32; 00217 typedef unsigned long FT_UInt32; 00218 00219 #else 00220 #error "no 32bit type found -- please check your configuration files" 00221 #endif 00222 00223 00224 /* look up an integer type that is at least 32 bits */ 00225 #if FT_SIZEOF_INT >= (32 / FT_CHAR_BIT) 00226 00227 typedef int FT_Fast; 00228 typedef unsigned int FT_UFast; 00229 00230 #elif FT_SIZEOF_LONG >= (32 / FT_CHAR_BIT) 00231 00232 typedef long FT_Fast; 00233 typedef unsigned long FT_UFast; 00234 00235 #endif 00236 00237 00238 /* determine whether we have a 64-bit int type for platforms without */ 00239 /* Autoconf */ 00240 #if FT_SIZEOF_LONG == (64 / FT_CHAR_BIT) 00241 00242 /* FT_LONG64 must be defined if a 64-bit type is available */ 00243 #define FT_LONG64 00244 #define FT_INT64 long 00245 00246 #elif defined( _MSC_VER ) && _MSC_VER >= 900 /* Visual C++ (and Intel C++) */ 00247 00248 /* this compiler provides the __int64 type */ 00249 #define FT_LONG64 00250 #define FT_INT64 __int64 00251 00252 #elif defined( __BORLANDC__ ) /* Borland C++ */ 00253 00254 /* XXXX: We should probably check the value of __BORLANDC__ in order */ 00255 /* to test the compiler version. */ 00256 00257 /* this compiler provides the __int64 type */ 00258 #define FT_LONG64 00259 #define FT_INT64 __int64 00260 00261 #elif defined( __WATCOMC__ ) /* Watcom C++ */ 00262 00263 /* Watcom doesn't provide 64-bit data types */ 00264 00265 #elif defined( __MWERKS__ ) /* Metrowerks CodeWarrior */ 00266 00267 #define FT_LONG64 00268 #define FT_INT64 long long int 00269 00270 #elif defined( __GNUC__ ) 00271 00272 /* GCC provides the `long long' type */ 00273 #define FT_LONG64 00274 #define FT_INT64 long long int 00275 00276 #endif /* FT_SIZEOF_LONG == (64 / FT_CHAR_BIT) */ 00277 00278 00279 /*************************************************************************/ 00280 /* */ 00281 /* A 64-bit data type will create compilation problems if you compile */ 00282 /* in strict ANSI mode. To avoid them, we disable its use if __STDC__ */ 00283 /* is defined. You can however ignore this rule by defining the */ 00284 /* FT_CONFIG_OPTION_FORCE_INT64 configuration macro. */ 00285 /* */ 00286 #if defined( FT_LONG64 ) && !defined( FT_CONFIG_OPTION_FORCE_INT64 ) 00287 00288 #ifdef __STDC__ 00289 00290 /* undefine the 64-bit macros in strict ANSI compilation mode */ 00291 #undef FT_LONG64 00292 #undef FT_INT64 00293 00294 #endif /* __STDC__ */ 00295 00296 #endif /* FT_LONG64 && !FT_CONFIG_OPTION_FORCE_INT64 */ 00297 00298 00299 #define FT_BEGIN_STMNT do { 00300 #define FT_END_STMNT } while ( 0 ) 00301 #define FT_DUMMY_STMNT FT_BEGIN_STMNT FT_END_STMNT 00302 00303 00304 #ifndef FT_CONFIG_OPTION_NO_ASSEMBLER 00305 /* Provide assembler fragments for performance-critical functions. */ 00306 /* These must be defined `static __inline__' with GCC. */ 00307 00308 #if defined( __CC_ARM ) || defined( __ARMCC__ ) /* RVCT */ 00309 #define FT_MULFIX_ASSEMBLER FT_MulFix_arm 00310 00311 /* documentation is in freetype.h */ 00312 00313 static __inline FT_Int32 00314 FT_MulFix_arm( FT_Int32 a, 00315 FT_Int32 b ) 00316 { 00317 register FT_Int32 t, t2; 00318 00319 00320 __asm 00321 { 00322 smull t2, t, b, a /* (lo=t2,hi=t) = a*b */ 00323 mov a, t, asr #31 /* a = (hi >> 31) */ 00324 add a, a, #0x8000 /* a += 0x8000 */ 00325 adds t2, t2, a /* t2 += a */ 00326 adc t, t, #0 /* t += carry */ 00327 mov a, t2, lsr #16 /* a = t2 >> 16 */ 00328 orr a, a, t, lsl #16 /* a |= t << 16 */ 00329 } 00330 return a; 00331 } 00332 00333 #endif /* __CC_ARM || __ARMCC__ */ 00334 00335 00336 #ifdef __GNUC__ 00337 00338 #if defined( __arm__ ) && !defined( __thumb__ ) && \ 00339 !( defined( __CC_ARM ) || defined( __ARMCC__ ) ) 00340 #define FT_MULFIX_ASSEMBLER FT_MulFix_arm 00341 00342 /* documentation is in freetype.h */ 00343 00344 static __inline__ FT_Int32 00345 FT_MulFix_arm( FT_Int32 a, 00346 FT_Int32 b ) 00347 { 00348 register FT_Int32 t, t2; 00349 00350 00351 asm __volatile__ ( 00352 "smull %1, %2, %4, %3\n\t" /* (lo=%1,hi=%2) = a*b */ 00353 "mov %0, %2, asr #31\n\t" /* %0 = (hi >> 31) */ 00354 "add %0, %0, #0x8000\n\t" /* %0 += 0x8000 */ 00355 "adds %1, %1, %0\n\t" /* %1 += %0 */ 00356 "adc %2, %2, #0\n\t" /* %2 += carry */ 00357 "mov %0, %1, lsr #16\n\t" /* %0 = %1 >> 16 */ 00358 "orr %0, %2, lsl #16\n\t" /* %0 |= %2 << 16 */ 00359 : "=r"(a), "=&r"(t2), "=&r"(t) 00360 : "r"(a), "r"(b) ); 00361 return a; 00362 } 00363 00364 #endif /* __arm__ && !__thumb__ && !( __CC_ARM || __ARMCC__ ) */ 00365 00366 #if defined( __i386__ ) 00367 #define FT_MULFIX_ASSEMBLER FT_MulFix_i386 00368 00369 /* documentation is in freetype.h */ 00370 00371 static __inline__ FT_Int32 00372 FT_MulFix_i386( FT_Int32 a, 00373 FT_Int32 b ) 00374 { 00375 register FT_Int32 result; 00376 00377 00378 __asm__ __volatile__ ( 00379 "imul %%edx\n" 00380 "movl %%edx, %%ecx\n" 00381 "sarl $31, %%ecx\n" 00382 "addl $0x8000, %%ecx\n" 00383 "addl %%ecx, %%eax\n" 00384 "adcl $0, %%edx\n" 00385 "shrl $16, %%eax\n" 00386 "shll $16, %%edx\n" 00387 "addl %%edx, %%eax\n" 00388 : "=a"(result), "=d"(b) 00389 : "a"(a), "d"(b) 00390 : "%ecx", "cc" ); 00391 return result; 00392 } 00393 00394 #endif /* i386 */ 00395 00396 #endif /* __GNUC__ */ 00397 00398 #endif /* !FT_CONFIG_OPTION_NO_ASSEMBLER */ 00399 00400 00401 #ifdef FT_CONFIG_OPTION_INLINE_MULFIX 00402 #ifdef FT_MULFIX_ASSEMBLER 00403 #define FT_MULFIX_INLINED FT_MULFIX_ASSEMBLER 00404 #endif 00405 #endif 00406 00407 00408 #ifdef FT_MAKE_OPTION_SINGLE_OBJECT 00409 00410 #define FT_LOCAL( x ) static x 00411 #define FT_LOCAL_DEF( x ) static x 00412 00413 #else 00414 00415 #ifdef __cplusplus 00416 #define FT_LOCAL( x ) extern "C" x 00417 #define FT_LOCAL_DEF( x ) extern "C" x 00418 #else 00419 #define FT_LOCAL( x ) extern x 00420 #define FT_LOCAL_DEF( x ) x 00421 #endif 00422 00423 #endif /* FT_MAKE_OPTION_SINGLE_OBJECT */ 00424 00425 00426 #ifndef FT_BASE 00427 00428 #ifdef __cplusplus 00429 #define FT_BASE( x ) extern "C" x 00430 #else 00431 #define FT_BASE( x ) extern x 00432 #endif 00433 00434 #endif /* !FT_BASE */ 00435 00436 00437 #ifndef FT_BASE_DEF 00438 00439 #ifdef __cplusplus 00440 #define FT_BASE_DEF( x ) x 00441 #else 00442 #define FT_BASE_DEF( x ) x 00443 #endif 00444 00445 #endif /* !FT_BASE_DEF */ 00446 00447 00448 #ifndef FT_EXPORT 00449 00450 #ifdef __cplusplus 00451 #define FT_EXPORT( x ) extern "C" x 00452 #else 00453 #define FT_EXPORT( x ) extern x 00454 #endif 00455 00456 #endif /* !FT_EXPORT */ 00457 00458 00459 #ifndef FT_EXPORT_DEF 00460 00461 #ifdef __cplusplus 00462 #define FT_EXPORT_DEF( x ) extern "C" x 00463 #else 00464 #define FT_EXPORT_DEF( x ) extern x 00465 #endif 00466 00467 #endif /* !FT_EXPORT_DEF */ 00468 00469 00470 #ifndef FT_EXPORT_VAR 00471 00472 #ifdef __cplusplus 00473 #define FT_EXPORT_VAR( x ) extern "C" x 00474 #else 00475 #define FT_EXPORT_VAR( x ) extern x 00476 #endif 00477 00478 #endif /* !FT_EXPORT_VAR */ 00479 00480 /* The following macros are needed to compile the library with a */ 00481 /* C++ compiler and with 16bit compilers. */ 00482 /* */ 00483 00484 /* This is special. Within C++, you must specify `extern "C"' for */ 00485 /* functions which are used via function pointers, and you also */ 00486 /* must do that for structures which contain function pointers to */ 00487 /* assure C linkage -- it's not possible to have (local) anonymous */ 00488 /* functions which are accessed by (global) function pointers. */ 00489 /* */ 00490 /* */ 00491 /* FT_CALLBACK_DEF is used to _define_ a callback function. */ 00492 /* */ 00493 /* FT_CALLBACK_TABLE is used to _declare_ a constant variable that */ 00494 /* contains pointers to callback functions. */ 00495 /* */ 00496 /* FT_CALLBACK_TABLE_DEF is used to _define_ a constant variable */ 00497 /* that contains pointers to callback functions. */ 00498 /* */ 00499 /* */ 00500 /* Some 16bit compilers have to redefine these macros to insert */ 00501 /* the infamous `_cdecl' or `__fastcall' declarations. */ 00502 /* */ 00503 #ifndef FT_CALLBACK_DEF 00504 #ifdef __cplusplus 00505 #define FT_CALLBACK_DEF( x ) extern "C" x 00506 #else 00507 #define FT_CALLBACK_DEF( x ) static x 00508 #endif 00509 #endif /* FT_CALLBACK_DEF */ 00510 00511 #ifndef FT_CALLBACK_TABLE 00512 #ifdef __cplusplus 00513 #define FT_CALLBACK_TABLE extern "C" 00514 #define FT_CALLBACK_TABLE_DEF extern "C" 00515 #else 00516 #define FT_CALLBACK_TABLE extern 00517 #define FT_CALLBACK_TABLE_DEF /* nothing */ 00518 #endif 00519 #endif /* FT_CALLBACK_TABLE */ 00520 00521 00522 FT_END_HEADER 00523 00524 00525 #endif /* __FTCONFIG_H__ */ 00526 00527 00528 /* END */ Generated on Sun May 27 2012 04:33:30 for ReactOS by
1.7.6.1
|