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-2018 by */ |
7 * Copyright (C) 1996-2019 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 by |
22 /* by the rest of the engine. Most of the macros here are automatically */ |
22 * 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 port |
24 /* port FreeType, except to compile the library with a non-ANSI */ |
24 * FreeType, except to compile the library with a non-ANSI compiler. |
25 /* compiler. */ |
25 * |
26 /* */ |
26 * Note however that if some specific modifications are needed, we advise |
27 /* Note however that if some specific modifications are needed, we */ |
27 * you to place a modified copy in your build directory. |
28 /* advise you to place a modified copy in your build directory. */ |
28 * |
29 /* */ |
29 * The build directory is usually `builds/<system>`, and contains |
30 /* The build directory is usually `builds/<system>', and contains */ |
30 * system-specific files that are always included first when building the |
31 /* system-specific files that are always included first when building */ |
31 * library. |
32 /* the library. */ |
32 * |
33 /* */ |
33 * This ANSI version should stay in `include/config/`. |
34 /* This ANSI version should stay in `include/config/'. */ |
34 * |
35 /* */ |
35 */ |
36 /*************************************************************************/ |
|
37 |
36 |
38 #ifndef FTCONFIG_H_ |
37 #ifndef FTCONFIG_H_ |
39 #define FTCONFIG_H_ |
38 #define FTCONFIG_H_ |
40 |
39 |
41 #include <ft2build.h> |
40 #include <ft2build.h> |
44 |
43 |
45 |
44 |
46 FT_BEGIN_HEADER |
45 FT_BEGIN_HEADER |
47 |
46 |
48 |
47 |
49 /*************************************************************************/ |
48 /************************************************************************** |
50 /* */ |
49 * |
51 /* PLATFORM-SPECIFIC CONFIGURATION MACROS */ |
50 * PLATFORM-SPECIFIC CONFIGURATION MACROS |
52 /* */ |
51 * |
53 /* These macros can be toggled to suit a specific system. The current */ |
52 * These macros can be toggled to suit a specific system. The current ones |
54 /* ones are defaults used to compile FreeType in an ANSI C environment */ |
53 * are defaults used to compile FreeType in an ANSI C environment (16bit |
55 /* (16bit compilers are also supported). Copy this file to your own */ |
54 * compilers are also supported). Copy this file to your own |
56 /* `builds/<system>' directory, and edit it to port the engine. */ |
55 * `builds/<system>` directory, and edit it to port the engine. |
57 /* */ |
56 * |
58 /*************************************************************************/ |
57 */ |
59 |
58 |
60 |
59 |
61 /* There are systems (like the Texas Instruments 'C54x) where a `char' */ |
60 /* 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 */ |
61 /* 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 */ |
62 /* `int` has 16~bits also for this system, `sizeof(int)` gives~1 which */ |
64 /* is probably unexpected. */ |
63 /* is probably unexpected. */ |
65 /* */ |
64 /* */ |
66 /* `CHAR_BIT' (defined in limits.h) gives the number of bits in a */ |
65 /* `CHAR_BIT` (defined in `limits.h`) gives the number of bits in a */ |
67 /* `char' type. */ |
66 /* `char` type. */ |
68 |
67 |
69 #ifndef FT_CHAR_BIT |
68 #ifndef FT_CHAR_BIT |
70 #define FT_CHAR_BIT CHAR_BIT |
69 #define FT_CHAR_BIT CHAR_BIT |
71 #endif |
70 #endif |
72 |
71 |
73 |
72 |
74 /* The size of an `int' type. */ |
73 /* The size of an `int` type. */ |
75 #if FT_UINT_MAX == 0xFFFFUL |
74 #if FT_UINT_MAX == 0xFFFFUL |
76 #define FT_SIZEOF_INT ( 16 / FT_CHAR_BIT ) |
75 #define FT_SIZEOF_INT ( 16 / FT_CHAR_BIT ) |
77 #elif FT_UINT_MAX == 0xFFFFFFFFUL |
76 #elif FT_UINT_MAX == 0xFFFFFFFFUL |
78 #define FT_SIZEOF_INT ( 32 / FT_CHAR_BIT ) |
77 #define FT_SIZEOF_INT ( 32 / FT_CHAR_BIT ) |
79 #elif FT_UINT_MAX > 0xFFFFFFFFUL && FT_UINT_MAX == 0xFFFFFFFFFFFFFFFFUL |
78 #elif FT_UINT_MAX > 0xFFFFFFFFUL && FT_UINT_MAX == 0xFFFFFFFFFFFFFFFFUL |
80 #define FT_SIZEOF_INT ( 64 / FT_CHAR_BIT ) |
79 #define FT_SIZEOF_INT ( 64 / FT_CHAR_BIT ) |
81 #else |
80 #else |
82 #error "Unsupported size of `int' type!" |
81 #error "Unsupported size of `int' type!" |
83 #endif |
82 #endif |
84 |
83 |
85 /* The size of a `long' type. A five-byte `long' (as used e.g. on the */ |
84 /* The size of a `long` type. A five-byte `long` (as used e.g. on the */ |
86 /* DM642) is recognized but avoided. */ |
85 /* DM642) is recognized but avoided. */ |
87 #if FT_ULONG_MAX == 0xFFFFFFFFUL |
86 #if FT_ULONG_MAX == 0xFFFFFFFFUL |
88 #define FT_SIZEOF_LONG ( 32 / FT_CHAR_BIT ) |
87 #define FT_SIZEOF_LONG ( 32 / FT_CHAR_BIT ) |
89 #elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFUL |
88 #elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFUL |
90 #define FT_SIZEOF_LONG ( 32 / FT_CHAR_BIT ) |
89 #define FT_SIZEOF_LONG ( 32 / FT_CHAR_BIT ) |
93 #else |
92 #else |
94 #error "Unsupported size of `long' type!" |
93 #error "Unsupported size of `long' type!" |
95 #endif |
94 #endif |
96 |
95 |
97 |
96 |
98 /* FT_UNUSED is a macro used to indicate that a given parameter is not */ |
97 /* `FT_UNUSED` indicates that a given parameter is not used -- */ |
99 /* used -- this is only used to get rid of unpleasant compiler warnings */ |
98 /* this is only used to get rid of unpleasant compiler warnings. */ |
100 #ifndef FT_UNUSED |
99 #ifndef FT_UNUSED |
101 #define FT_UNUSED( arg ) ( (arg) = (arg) ) |
100 #define FT_UNUSED( arg ) ( (arg) = (arg) ) |
102 #endif |
101 #endif |
103 |
102 |
104 |
103 |
105 /*************************************************************************/ |
104 /************************************************************************** |
106 /* */ |
105 * |
107 /* AUTOMATIC CONFIGURATION MACROS */ |
106 * AUTOMATIC CONFIGURATION MACROS |
108 /* */ |
107 * |
109 /* These macros are computed from the ones defined above. Don't touch */ |
108 * These macros are computed from the ones defined above. Don't touch |
110 /* their definition, unless you know precisely what you are doing. No */ |
109 * their definition, unless you know precisely what you are doing. No |
111 /* porter should need to mess with them. */ |
110 * porter should need to mess with them. |
112 /* */ |
111 * |
113 /*************************************************************************/ |
112 */ |
114 |
113 |
115 |
114 |
116 /*************************************************************************/ |
115 /************************************************************************** |
117 /* */ |
116 * |
118 /* Mac support */ |
117 * Mac support |
119 /* */ |
118 * |
120 /* This is the only necessary change, so it is defined here instead */ |
119 * This is the only necessary change, so it is defined here instead |
121 /* providing a new configuration file. */ |
120 * providing a new configuration file. |
122 /* */ |
121 */ |
123 #if defined( __APPLE__ ) || ( defined( __MWERKS__ ) && defined( macintosh ) ) |
122 #if defined( __APPLE__ ) || ( defined( __MWERKS__ ) && defined( macintosh ) ) |
124 /* no Carbon frameworks for 64bit 10.4.x */ |
123 /* No Carbon frameworks for 64bit 10.4.x. */ |
125 /* AvailabilityMacros.h is available since Mac OS X 10.2, */ |
124 /* `AvailabilityMacros.h` is available since Mac OS X 10.2, */ |
126 /* so guess the system version by maximum errno before inclusion */ |
125 /* so guess the system version by maximum errno before inclusion. */ |
127 #include <errno.h> |
126 #include <errno.h> |
128 #ifdef ECANCELED /* defined since 10.2 */ |
127 #ifdef ECANCELED /* defined since 10.2 */ |
129 #include "AvailabilityMacros.h" |
128 #include "AvailabilityMacros.h" |
130 #endif |
129 #endif |
131 #if defined( __LP64__ ) && \ |
130 #if defined( __LP64__ ) && \ |
141 #endif |
140 #endif |
142 |
141 |
143 #endif |
142 #endif |
144 |
143 |
145 |
144 |
146 /* Fix compiler warning with sgi compiler */ |
145 /* Fix compiler warning with sgi compiler. */ |
147 #if defined( __sgi ) && !defined( __GNUC__ ) |
146 #if defined( __sgi ) && !defined( __GNUC__ ) |
148 #if defined( _COMPILER_VERSION ) && ( _COMPILER_VERSION >= 730 ) |
147 #if defined( _COMPILER_VERSION ) && ( _COMPILER_VERSION >= 730 ) |
149 #pragma set woff 3505 |
148 #pragma set woff 3505 |
150 #endif |
149 #endif |
151 #endif |
150 #endif |
152 |
151 |
153 |
152 |
154 /*************************************************************************/ |
153 /************************************************************************** |
155 /* */ |
154 * |
156 /* <Section> */ |
155 * @section: |
157 /* basic_types */ |
156 * basic_types |
158 /* */ |
157 * |
159 /*************************************************************************/ |
158 */ |
160 |
159 |
161 |
160 |
162 /*************************************************************************/ |
161 /************************************************************************** |
163 /* */ |
162 * |
164 /* <Type> */ |
163 * @type: |
165 /* FT_Int16 */ |
164 * FT_Int16 |
166 /* */ |
165 * |
167 /* <Description> */ |
166 * @description: |
168 /* A typedef for a 16bit signed integer type. */ |
167 * A typedef for a 16bit signed integer type. |
169 /* */ |
168 */ |
170 typedef signed short FT_Int16; |
169 typedef signed short FT_Int16; |
171 |
170 |
172 |
171 |
173 /*************************************************************************/ |
172 /************************************************************************** |
174 /* */ |
173 * |
175 /* <Type> */ |
174 * @type: |
176 /* FT_UInt16 */ |
175 * FT_UInt16 |
177 /* */ |
176 * |
178 /* <Description> */ |
177 * @description: |
179 /* A typedef for a 16bit unsigned integer type. */ |
178 * A typedef for a 16bit unsigned integer type. |
180 /* */ |
179 */ |
181 typedef unsigned short FT_UInt16; |
180 typedef unsigned short FT_UInt16; |
182 |
181 |
183 /* */ |
182 /* */ |
184 |
183 |
185 |
184 |
186 /* this #if 0 ... #endif clause is for documentation purposes */ |
185 /* this #if 0 ... #endif clause is for documentation purposes */ |
187 #if 0 |
186 #if 0 |
188 |
187 |
189 /*************************************************************************/ |
188 /************************************************************************** |
190 /* */ |
189 * |
191 /* <Type> */ |
190 * @type: |
192 /* FT_Int32 */ |
191 * FT_Int32 |
193 /* */ |
192 * |
194 /* <Description> */ |
193 * @description: |
195 /* A typedef for a 32bit signed integer type. The size depends on */ |
194 * A typedef for a 32bit signed integer type. The size depends on the |
196 /* the configuration. */ |
195 * configuration. |
197 /* */ |
196 */ |
198 typedef signed XXX FT_Int32; |
197 typedef signed XXX FT_Int32; |
199 |
198 |
200 |
199 |
201 /*************************************************************************/ |
200 /************************************************************************** |
202 /* */ |
201 * |
203 /* <Type> */ |
202 * @type: |
204 /* FT_UInt32 */ |
203 * FT_UInt32 |
205 /* */ |
204 * |
206 /* A typedef for a 32bit unsigned integer type. The size depends on */ |
205 * A typedef for a 32bit unsigned integer type. The size depends on the |
207 /* the configuration. */ |
206 * configuration. |
208 /* */ |
207 */ |
209 typedef unsigned XXX FT_UInt32; |
208 typedef unsigned XXX FT_UInt32; |
210 |
209 |
211 |
210 |
212 /*************************************************************************/ |
211 /************************************************************************** |
213 /* */ |
212 * |
214 /* <Type> */ |
213 * @type: |
215 /* FT_Int64 */ |
214 * FT_Int64 |
216 /* */ |
215 * |
217 /* A typedef for a 64bit signed integer type. The size depends on */ |
216 * A typedef for a 64bit signed integer type. The size depends on the |
218 /* the configuration. Only defined if there is real 64bit support; */ |
217 * configuration. Only defined if there is real 64bit support; |
219 /* otherwise, it gets emulated with a structure (if necessary). */ |
218 * otherwise, it gets emulated with a structure (if necessary). |
220 /* */ |
219 */ |
221 typedef signed XXX FT_Int64; |
220 typedef signed XXX FT_Int64; |
222 |
221 |
223 |
222 |
224 /*************************************************************************/ |
223 /************************************************************************** |
225 /* */ |
224 * |
226 /* <Type> */ |
225 * @type: |
227 /* FT_UInt64 */ |
226 * FT_UInt64 |
228 /* */ |
227 * |
229 /* A typedef for a 64bit unsigned integer type. The size depends on */ |
228 * A typedef for a 64bit unsigned integer type. The size depends on the |
230 /* the configuration. Only defined if there is real 64bit support; */ |
229 * configuration. Only defined if there is real 64bit support; |
231 /* otherwise, it gets emulated with a structure (if necessary). */ |
230 * otherwise, it gets emulated with a structure (if necessary). |
232 /* */ |
231 */ |
233 typedef unsigned XXX FT_UInt64; |
232 typedef unsigned XXX FT_UInt64; |
234 |
233 |
235 /* */ |
234 /* */ |
236 |
235 |
237 #endif |
236 #endif |
263 typedef unsigned long FT_UFast; |
262 typedef unsigned long FT_UFast; |
264 |
263 |
265 #endif |
264 #endif |
266 |
265 |
267 |
266 |
268 /* determine whether we have a 64-bit int type for platforms without */ |
267 /* determine whether we have a 64-bit `int` type for platforms without */ |
269 /* Autoconf */ |
268 /* Autoconf */ |
270 #if FT_SIZEOF_LONG == ( 64 / FT_CHAR_BIT ) |
269 #if FT_SIZEOF_LONG == ( 64 / FT_CHAR_BIT ) |
271 |
270 |
272 /* FT_LONG64 must be defined if a 64-bit type is available */ |
271 /* `FT_LONG64` must be defined if a 64-bit type is available */ |
273 #define FT_LONG64 |
272 #define FT_LONG64 |
274 #define FT_INT64 long |
273 #define FT_INT64 long |
275 #define FT_UINT64 unsigned long |
274 #define FT_UINT64 unsigned long |
276 |
275 |
277 /*************************************************************************/ |
276 /************************************************************************** |
278 /* */ |
277 * |
279 /* A 64-bit data type may create compilation problems if you compile */ |
278 * A 64-bit data type may create compilation problems if you compile in |
280 /* in strict ANSI mode. To avoid them, we disable other 64-bit data */ |
279 * strict ANSI mode. To avoid them, we disable other 64-bit data types if |
281 /* types if __STDC__ is defined. You can however ignore this rule */ |
280 * `__STDC__` is defined. You can however ignore this rule by defining the |
282 /* by defining the FT_CONFIG_OPTION_FORCE_INT64 configuration macro. */ |
281 * `FT_CONFIG_OPTION_FORCE_INT64` configuration macro. |
283 /* */ |
282 */ |
284 #elif !defined( __STDC__ ) || defined( FT_CONFIG_OPTION_FORCE_INT64 ) |
283 #elif !defined( __STDC__ ) || defined( FT_CONFIG_OPTION_FORCE_INT64 ) |
285 |
284 |
286 #if defined( __STDC_VERSION__ ) && __STDC_VERSION__ >= 199901L |
285 #if defined( __STDC_VERSION__ ) && __STDC_VERSION__ >= 199901L |
287 |
286 |
288 #define FT_LONG64 |
287 #define FT_LONG64 |
289 #define FT_INT64 long long int |
288 #define FT_INT64 long long int |
290 #define FT_UINT64 unsigned long long int |
289 #define FT_UINT64 unsigned long long int |
291 |
290 |
292 #elif defined( _MSC_VER ) && _MSC_VER >= 900 /* Visual C++ (and Intel C++) */ |
291 #elif defined( _MSC_VER ) && _MSC_VER >= 900 /* Visual C++ (and Intel C++) */ |
293 |
292 |
294 /* this compiler provides the __int64 type */ |
293 /* this compiler provides the `__int64` type */ |
295 #define FT_LONG64 |
294 #define FT_LONG64 |
296 #define FT_INT64 __int64 |
295 #define FT_INT64 __int64 |
297 #define FT_UINT64 unsigned __int64 |
296 #define FT_UINT64 unsigned __int64 |
298 |
297 |
299 #elif defined( __BORLANDC__ ) /* Borland C++ */ |
298 #elif defined( __BORLANDC__ ) /* Borland C++ */ |
300 |
299 |
301 /* XXXX: We should probably check the value of __BORLANDC__ in order */ |
300 /* XXXX: We should probably check the value of `__BORLANDC__` in order */ |
302 /* to test the compiler version. */ |
301 /* to test the compiler version. */ |
303 |
302 |
304 /* this compiler provides the __int64 type */ |
303 /* this compiler provides the `__int64` type */ |
305 #define FT_LONG64 |
304 #define FT_LONG64 |
306 #define FT_INT64 __int64 |
305 #define FT_INT64 __int64 |
307 #define FT_UINT64 unsigned __int64 |
306 #define FT_UINT64 unsigned __int64 |
308 |
307 |
309 #elif defined( __WATCOMC__ ) /* Watcom C++ */ |
308 #elif defined( __WATCOMC__ ) /* Watcom C++ */ |
340 #else |
339 #else |
341 #define FT_UINT_TO_POINTER( x ) (void*)(unsigned long)(x) |
340 #define FT_UINT_TO_POINTER( x ) (void*)(unsigned long)(x) |
342 #endif |
341 #endif |
343 |
342 |
344 |
343 |
345 /*************************************************************************/ |
344 /************************************************************************** |
346 /* */ |
345 * |
347 /* miscellaneous */ |
346 * miscellaneous |
348 /* */ |
347 * |
349 /*************************************************************************/ |
348 */ |
350 |
349 |
351 |
350 |
352 #define FT_BEGIN_STMNT do { |
351 #define FT_BEGIN_STMNT do { |
353 #define FT_END_STMNT } while ( 0 ) |
352 #define FT_END_STMNT } while ( 0 ) |
354 #define FT_DUMMY_STMNT FT_BEGIN_STMNT FT_END_STMNT |
353 #define FT_DUMMY_STMNT FT_BEGIN_STMNT FT_END_STMNT |
355 |
354 |
356 |
355 |
357 /* typeof condition taken from gnulib's `intprops.h' header file */ |
356 /* `typeof` condition taken from gnulib's `intprops.h` header file */ |
358 #if ( ( defined( __GNUC__ ) && __GNUC__ >= 2 ) || \ |
357 #if ( ( defined( __GNUC__ ) && __GNUC__ >= 2 ) || \ |
359 ( defined( __IBMC__ ) && __IBMC__ >= 1210 && \ |
358 ( defined( __IBMC__ ) && __IBMC__ >= 1210 && \ |
360 defined( __IBM__TYPEOF__ ) ) || \ |
359 defined( __IBM__TYPEOF__ ) ) || \ |
361 ( defined( __SUNPRO_C ) && __SUNPRO_C >= 0x5110 && !__STDC__ ) ) |
360 ( defined( __SUNPRO_C ) && __SUNPRO_C >= 0x5110 && !__STDC__ ) ) |
362 #define FT_TYPEOF( type ) ( __typeof__ ( type ) ) |
361 #define FT_TYPEOF( type ) ( __typeof__ ( type ) ) |
363 #else |
362 #else |
364 #define FT_TYPEOF( type ) /* empty */ |
363 #define FT_TYPEOF( type ) /* empty */ |
365 #endif |
364 #endif |
366 |
365 |
367 |
366 |
368 /* Use FT_LOCAL and FT_LOCAL_DEF to declare and define, respectively, */ |
367 /* Use `FT_LOCAL` and `FT_LOCAL_DEF` to declare and define, */ |
369 /* a function that gets used only within the scope of a module. */ |
368 /* respectively, a function that gets used only within the scope of a */ |
370 /* Normally, both the header and source code files for such a */ |
369 /* module. Normally, both the header and source code files for such a */ |
371 /* function are within a single module directory. */ |
370 /* function are within a single module directory. */ |
372 /* */ |
371 /* */ |
373 /* Intra-module arrays should be tagged with FT_LOCAL_ARRAY and */ |
372 /* Intra-module arrays should be tagged with `FT_LOCAL_ARRAY` and */ |
374 /* FT_LOCAL_ARRAY_DEF. */ |
373 /* `FT_LOCAL_ARRAY_DEF`. */ |
375 /* */ |
374 /* */ |
376 #ifdef FT_MAKE_OPTION_SINGLE_OBJECT |
375 #ifdef FT_MAKE_OPTION_SINGLE_OBJECT |
377 |
376 |
378 #define FT_LOCAL( x ) static x |
377 #define FT_LOCAL( x ) static x |
379 #define FT_LOCAL_DEF( x ) static x |
378 #define FT_LOCAL_DEF( x ) static x |
380 |
379 |
392 |
391 |
393 #define FT_LOCAL_ARRAY( x ) extern const x |
392 #define FT_LOCAL_ARRAY( x ) extern const x |
394 #define FT_LOCAL_ARRAY_DEF( x ) const x |
393 #define FT_LOCAL_ARRAY_DEF( x ) const x |
395 |
394 |
396 |
395 |
397 /* Use FT_BASE and FT_BASE_DEF to declare and define, respectively, */ |
396 /* Use `FT_BASE` and `FT_BASE_DEF` to declare and define, respectively, */ |
398 /* functions that are used in more than a single module. In the */ |
397 /* functions that are used in more than a single module. In the */ |
399 /* current setup this implies that the declaration is in a header */ |
398 /* current setup this implies that the declaration is in a header file */ |
400 /* file in the `include/freetype/internal' directory, and the */ |
399 /* in the `include/freetype/internal` directory, and the function body */ |
401 /* function body is in a file in `src/base'. */ |
400 /* is in a file in `src/base`. */ |
402 /* */ |
401 /* */ |
403 #ifndef FT_BASE |
402 #ifndef FT_BASE |
404 |
403 |
405 #ifdef __cplusplus |
404 #ifdef __cplusplus |
406 #define FT_BASE( x ) extern "C" x |
405 #define FT_BASE( x ) extern "C" x |
407 #else |
406 #else |
420 #endif |
419 #endif |
421 |
420 |
422 #endif /* !FT_BASE_DEF */ |
421 #endif /* !FT_BASE_DEF */ |
423 |
422 |
424 |
423 |
425 /* When compiling FreeType as a DLL or DSO with hidden visibility */ |
424 /* When compiling FreeType as a DLL or DSO with hidden visibility */ |
426 /* some systems/compilers need a special attribute in front OR after */ |
425 /* some systems/compilers need a special attribute in front OR after */ |
427 /* the return type of function declarations. */ |
426 /* the return type of function declarations. */ |
428 /* */ |
427 /* */ |
429 /* Two macros are used within the FreeType source code to define */ |
428 /* Two macros are used within the FreeType source code to define */ |
430 /* exported library functions: FT_EXPORT and FT_EXPORT_DEF. */ |
429 /* exported library functions: `FT_EXPORT` and `FT_EXPORT_DEF`. */ |
431 /* */ |
430 /* */ |
432 /* FT_EXPORT( return_type ) */ |
431 /* - `FT_EXPORT( return_type )` */ |
433 /* */ |
432 /* */ |
434 /* is used in a function declaration, as in */ |
433 /* is used in a function declaration, as in */ |
435 /* */ |
434 /* */ |
436 /* FT_EXPORT( FT_Error ) */ |
435 /* ``` */ |
437 /* FT_Init_FreeType( FT_Library* alibrary ); */ |
436 /* FT_EXPORT( FT_Error ) */ |
438 /* */ |
437 /* FT_Init_FreeType( FT_Library* alibrary ); */ |
439 /* */ |
438 /* ``` */ |
440 /* FT_EXPORT_DEF( return_type ) */ |
439 /* */ |
441 /* */ |
440 /* - `FT_EXPORT_DEF( return_type )` */ |
442 /* is used in a function definition, as in */ |
441 /* */ |
443 /* */ |
442 /* is used in a function definition, as in */ |
444 /* FT_EXPORT_DEF( FT_Error ) */ |
443 /* */ |
445 /* FT_Init_FreeType( FT_Library* alibrary ) */ |
444 /* ``` */ |
446 /* { */ |
445 /* FT_EXPORT_DEF( FT_Error ) */ |
447 /* ... some code ... */ |
446 /* FT_Init_FreeType( FT_Library* alibrary ) */ |
448 /* return FT_Err_Ok; */ |
447 /* { */ |
449 /* } */ |
448 /* ... some code ... */ |
450 /* */ |
449 /* return FT_Err_Ok; */ |
451 /* You can provide your own implementation of FT_EXPORT and */ |
450 /* } */ |
452 /* FT_EXPORT_DEF here if you want. */ |
451 /* ``` */ |
453 /* */ |
452 /* */ |
454 /* To export a variable, use FT_EXPORT_VAR. */ |
453 /* You can provide your own implementation of `FT_EXPORT` and */ |
455 /* */ |
454 /* `FT_EXPORT_DEF` here if you want. */ |
|
455 /* */ |
|
456 /* To export a variable, use `FT_EXPORT_VAR`. */ |
|
457 /* */ |
456 #ifndef FT_EXPORT |
458 #ifndef FT_EXPORT |
457 |
459 |
458 #ifdef FT2_BUILD_LIBRARY |
460 #ifdef FT2_BUILD_LIBRARY |
459 |
461 |
460 #if defined( _WIN32 ) && ( defined( _DLL ) || defined( DLL_EXPORT ) ) |
462 #if defined( _WIN32 ) && defined( DLL_EXPORT ) |
461 #define FT_EXPORT( x ) __declspec( dllexport ) x |
463 #define FT_EXPORT( x ) __declspec( dllexport ) x |
462 #elif defined( __GNUC__ ) && __GNUC__ >= 4 |
464 #elif defined( __GNUC__ ) && __GNUC__ >= 4 |
463 #define FT_EXPORT( x ) __attribute__(( visibility( "default" ) )) x |
465 #define FT_EXPORT( x ) __attribute__(( visibility( "default" ) )) x |
|
466 #elif defined( __SUNPRO_C ) && __SUNPRO_C >= 0x550 |
|
467 #define FT_EXPORT( x ) __global x |
464 #elif defined( __cplusplus ) |
468 #elif defined( __cplusplus ) |
465 #define FT_EXPORT( x ) extern "C" x |
469 #define FT_EXPORT( x ) extern "C" x |
466 #else |
470 #else |
467 #define FT_EXPORT( x ) extern x |
471 #define FT_EXPORT( x ) extern x |
468 #endif |
472 #endif |
469 |
473 |
470 #else |
474 #else |
471 |
475 |
472 #if defined( FT2_DLLIMPORT ) |
476 #if defined( _WIN32 ) && defined( DLL_IMPORT ) |
473 #define FT_EXPORT( x ) __declspec( dllimport ) x |
477 #define FT_EXPORT( x ) __declspec( dllimport ) x |
474 #elif defined( __cplusplus ) |
478 #elif defined( __cplusplus ) |
475 #define FT_EXPORT( x ) extern "C" x |
479 #define FT_EXPORT( x ) extern "C" x |
476 #else |
480 #else |
477 #define FT_EXPORT( x ) extern x |
481 #define FT_EXPORT( x ) extern x |
506 |
510 |
507 /* The following macros are needed to compile the library with a */ |
511 /* The following macros are needed to compile the library with a */ |
508 /* C++ compiler and with 16bit compilers. */ |
512 /* C++ compiler and with 16bit compilers. */ |
509 /* */ |
513 /* */ |
510 |
514 |
511 /* This is special. Within C++, you must specify `extern "C"' for */ |
515 /* This is special. Within C++, you must specify `extern "C"` for */ |
512 /* functions which are used via function pointers, and you also */ |
516 /* functions which are used via function pointers, and you also */ |
513 /* must do that for structures which contain function pointers to */ |
517 /* must do that for structures which contain function pointers to */ |
514 /* assure C linkage -- it's not possible to have (local) anonymous */ |
518 /* assure C linkage -- it's not possible to have (local) anonymous */ |
515 /* functions which are accessed by (global) function pointers. */ |
519 /* functions which are accessed by (global) function pointers. */ |
516 /* */ |
520 /* */ |