1/***************************************************************************/
2/*                                                                         */
3/*  ftconfig.h                                                             */
4/*                                                                         */
5/*    VMS-specific configuration file (specification only).                */
6/*                                                                         */
7/*  Copyright 1996-2018 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 `builds/<system>', and contains        */
31  /* system-specific files that are always included first when building    */
32  /* the library.                                                          */
33  /*                                                                       */
34  /*************************************************************************/
35
36
37#ifndef FTCONFIG_H_
38#define FTCONFIG_H_
39
40#include <ft2build.h>
41#include FT_CONFIG_OPTIONS_H
42#include FT_CONFIG_STANDARD_LIBRARY_H
43
44
45FT_BEGIN_HEADER
46
47
48  /*************************************************************************/
49  /*                                                                       */
50  /*               PLATFORM-SPECIFIC CONFIGURATION MACROS                  */
51  /*                                                                       */
52  /* These macros can be toggled to suit a specific system.  The current   */
53  /* ones are defaults used to compile FreeType in an ANSI C environment   */
54  /* (16bit compilers are also supported).  Copy this file to your own     */
55  /* `builds/<system>' directory, and edit it to port the engine.          */
56  /*                                                                       */
57  /*************************************************************************/
58
59
60#define HAVE_UNISTD_H  1
61#define HAVE_FCNTL_H   1
62
63#define SIZEOF_INT   4
64#define SIZEOF_LONG  4
65
66#define FT_SIZEOF_INT   4
67#define FT_SIZEOF_LONG  4
68
69#define FT_CHAR_BIT  8
70
71
72  /* FT_UNUSED is a macro used to indicate that a given parameter is not  */
73  /* used -- this is only used to get rid of unpleasant compiler warnings */
74#ifndef FT_UNUSED
75#define FT_UNUSED( arg )  ( (arg) = (arg) )
76#endif
77
78
79  /*************************************************************************/
80  /*                                                                       */
81  /*                     AUTOMATIC CONFIGURATION MACROS                    */
82  /*                                                                       */
83  /* These macros are computed from the ones defined above.  Don't touch   */
84  /* their definition, unless you know precisely what you are doing.  No   */
85  /* porter should need to mess with them.                                 */
86  /*                                                                       */
87  /*************************************************************************/
88
89
90  /*************************************************************************/
91  /*                                                                       */
92  /* Mac support                                                           */
93  /*                                                                       */
94  /*   This is the only necessary change, so it is defined here instead    */
95  /*   providing a new configuration file.                                 */
96  /*                                                                       */
97#if defined( __APPLE__ ) || ( defined( __MWERKS__ ) && defined( macintosh ) )
98  /* no Carbon frameworks for 64bit 10.4.x */
99  /* AvailabilityMacros.h is available since Mac OS X 10.2,        */
100  /* so guess the system version by maximum errno before inclusion */
101#include <errno.h>
102#ifdef ECANCELED /* defined since 10.2 */
103#include "AvailabilityMacros.h"
104#endif
105#if defined( __LP64__ ) && \
106    ( MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 )
107#undef FT_MACINTOSH
108#endif
109
110#elif defined( __SC__ ) || defined( __MRC__ )
111  /* Classic MacOS compilers */
112#include "ConditionalMacros.h"
113#if TARGET_OS_MAC
114#define FT_MACINTOSH 1
115#endif
116
117#endif
118
119
120  /* Fix compiler warning with sgi compiler */
121#if defined( __sgi ) && !defined( __GNUC__ )
122#if defined( _COMPILER_VERSION ) && ( _COMPILER_VERSION >= 730 )
123#pragma set woff 3505
124#endif
125#endif
126
127
128  /*************************************************************************/
129  /*                                                                       */
130  /* <Section>                                                             */
131  /*    basic_types                                                        */
132  /*                                                                       */
133  /*************************************************************************/
134
135
136  /*************************************************************************/
137  /*                                                                       */
138  /* <Type>                                                                */
139  /*    FT_Int16                                                           */
140  /*                                                                       */
141  /* <Description>                                                         */
142  /*    A typedef for a 16bit signed integer type.                         */
143  /*                                                                       */
144  typedef signed short  FT_Int16;
145
146
147  /*************************************************************************/
148  /*                                                                       */
149  /* <Type>                                                                */
150  /*    FT_UInt16                                                          */
151  /*                                                                       */
152  /* <Description>                                                         */
153  /*    A typedef for a 16bit unsigned integer type.                       */
154  /*                                                                       */
155  typedef unsigned short  FT_UInt16;
156
157  /* */
158
159
160  /* this #if 0 ... #endif clause is for documentation purposes */
161#if 0
162
163  /*************************************************************************/
164  /*                                                                       */
165  /* <Type>                                                                */
166  /*    FT_Int32                                                           */
167  /*                                                                       */
168  /* <Description>                                                         */
169  /*    A typedef for a 32bit signed integer type.  The size depends on    */
170  /*    the configuration.                                                 */
171  /*                                                                       */
172  typedef signed XXX  FT_Int32;
173
174
175  /*************************************************************************/
176  /*                                                                       */
177  /* <Type>                                                                */
178  /*    FT_UInt32                                                          */
179  /*                                                                       */
180  /*    A typedef for a 32bit unsigned integer type.  The size depends on  */
181  /*    the configuration.                                                 */
182  /*                                                                       */
183  typedef unsigned XXX  FT_UInt32;
184
185
186  /*************************************************************************/
187  /*                                                                       */
188  /* <Type>                                                                */
189  /*    FT_Int64                                                           */
190  /*                                                                       */
191  /*    A typedef for a 64bit signed integer type.  The size depends on    */
192  /*    the configuration.  Only defined if there is real 64bit support;   */
193  /*    otherwise, it gets emulated with a structure (if necessary).       */
194  /*                                                                       */
195  typedef signed XXX  FT_Int64;
196
197
198  /*************************************************************************/
199  /*                                                                       */
200  /* <Type>                                                                */
201  /*    FT_UInt64                                                          */
202  /*                                                                       */
203  /*    A typedef for a 64bit unsigned integer type.  The size depends on  */
204  /*    the configuration.  Only defined if there is real 64bit support;   */
205  /*    otherwise, it gets emulated with a structure (if necessary).       */
206  /*                                                                       */
207  typedef unsigned XXX  FT_UInt64;
208
209  /* */
210
211#endif
212
213#if FT_SIZEOF_INT == 4
214
215  typedef signed int      FT_Int32;
216  typedef unsigned int    FT_UInt32;
217
218#elif FT_SIZEOF_LONG == 4
219
220  typedef signed long     FT_Int32;
221  typedef unsigned long   FT_UInt32;
222
223#else
224#error "no 32bit type found -- please check your configuration files"
225#endif
226
227
228  /* look up an integer type that is at least 32 bits */
229#if FT_SIZEOF_INT >= 4
230
231  typedef int            FT_Fast;
232  typedef unsigned int   FT_UFast;
233
234#elif FT_SIZEOF_LONG >= 4
235
236  typedef long           FT_Fast;
237  typedef unsigned long  FT_UFast;
238
239#endif
240
241
242  /* determine whether we have a 64-bit int type  */
243  /* (mostly for environments without `autoconf') */
244#if FT_SIZEOF_LONG == 8
245
246  /* FT_LONG64 must be defined if a 64-bit type is available */
247#define FT_LONG64
248#define FT_INT64   long
249#define FT_UINT64  unsigned long
250
251  /* we handle the LLP64 scheme separately for GCC and clang, */
252  /* suppressing the `long long' warning                      */
253#elif ( FT_SIZEOF_LONG == 4 )       && \
254      defined( HAVE_LONG_LONG_INT ) && \
255      defined( __GNUC__ )
256#pragma GCC diagnostic ignored "-Wlong-long"
257#define FT_LONG64
258#define FT_INT64   long long int
259#define FT_UINT64  unsigned long long int
260
261  /*************************************************************************/
262  /*                                                                       */
263  /* A 64-bit data type may create compilation problems if you compile     */
264  /* in strict ANSI mode.  To avoid them, we disable other 64-bit data     */
265  /* types if __STDC__ is defined.  You can however ignore this rule       */
266  /* by defining the FT_CONFIG_OPTION_FORCE_INT64 configuration macro.     */
267  /*                                                                       */
268#elif !defined( __STDC__ ) || defined( FT_CONFIG_OPTION_FORCE_INT64 )
269
270#if defined( __STDC_VERSION__ ) && __STDC_VERSION__ >= 199901L
271
272#define FT_LONG64
273#define FT_INT64   long long int
274#define FT_UINT64  unsigned long long int
275
276#elif defined( _MSC_VER ) && _MSC_VER >= 900  /* Visual C++ (and Intel C++) */
277
278  /* this compiler provides the __int64 type */
279#define FT_LONG64
280#define FT_INT64   __int64
281#define FT_UINT64  unsigned __int64
282
283#elif defined( __BORLANDC__ )  /* Borland C++ */
284
285  /* XXXX: We should probably check the value of __BORLANDC__ in order */
286  /*       to test the compiler version.                               */
287
288  /* this compiler provides the __int64 type */
289#define FT_LONG64
290#define FT_INT64   __int64
291#define FT_UINT64  unsigned __int64
292
293#elif defined( __WATCOMC__ )   /* Watcom C++ */
294
295  /* Watcom doesn't provide 64-bit data types */
296
297#elif defined( __MWERKS__ )    /* Metrowerks CodeWarrior */
298
299#define FT_LONG64
300#define FT_INT64   long long int
301#define FT_UINT64  unsigned long long int
302
303#elif defined( __GNUC__ )
304
305  /* GCC provides the `long long' type */
306#define FT_LONG64
307#define FT_INT64   long long int
308#define FT_UINT64  unsigned long long int
309
310#endif /* __STDC_VERSION__ >= 199901L */
311
312#endif /* FT_SIZEOF_LONG == 8 */
313
314#ifdef FT_LONG64
315  typedef FT_INT64   FT_Int64;
316  typedef FT_UINT64  FT_UInt64;
317#endif
318
319
320#ifdef _WIN64
321  /* only 64bit Windows uses the LLP64 data model, i.e., */
322  /* 32bit integers, 64bit pointers                      */
323#define FT_UINT_TO_POINTER( x ) (void*)(unsigned __int64)(x)
324#else
325#define FT_UINT_TO_POINTER( x ) (void*)(unsigned long)(x)
326#endif
327
328
329  /*************************************************************************/
330  /*                                                                       */
331  /* miscellaneous                                                         */
332  /*                                                                       */
333  /*************************************************************************/
334
335
336#define FT_BEGIN_STMNT  do {
337#define FT_END_STMNT    } while ( 0 )
338#define FT_DUMMY_STMNT  FT_BEGIN_STMNT FT_END_STMNT
339
340
341  /* typeof condition taken from gnulib's `intprops.h' header file */
342#if ( ( defined( __GNUC__ ) && __GNUC__ >= 2 )                       || \
343      ( defined( __IBMC__ ) && __IBMC__ >= 1210 &&                      \
344        defined( __IBM__TYPEOF__ ) )                                 || \
345      ( defined( __SUNPRO_C ) && __SUNPRO_C >= 0x5110 && !__STDC__ ) )
346#define FT_TYPEOF( type )  ( __typeof__ ( type ) )
347#else
348#define FT_TYPEOF( type )  /* empty */
349#endif
350
351
352  /* Use FT_LOCAL and FT_LOCAL_DEF to declare and define, respectively, */
353  /* a function that gets used only within the scope of a module.       */
354  /* Normally, both the header and source code files for such a         */
355  /* function are within a single module directory.                     */
356  /*                                                                    */
357  /* Intra-module arrays should be tagged with FT_LOCAL_ARRAY and       */
358  /* FT_LOCAL_ARRAY_DEF.                                                */
359  /*                                                                    */
360#ifdef FT_MAKE_OPTION_SINGLE_OBJECT
361
362#define FT_LOCAL( x )      static  x
363#define FT_LOCAL_DEF( x )  static  x
364
365#else
366
367#ifdef __cplusplus
368#define FT_LOCAL( x )      extern "C"  x
369#define FT_LOCAL_DEF( x )  extern "C"  x
370#else
371#define FT_LOCAL( x )      extern  x
372#define FT_LOCAL_DEF( x )  x
373#endif
374
375#endif /* FT_MAKE_OPTION_SINGLE_OBJECT */
376
377#define FT_LOCAL_ARRAY( x )      extern const  x
378#define FT_LOCAL_ARRAY_DEF( x )  const  x
379
380
381  /* Use FT_BASE and FT_BASE_DEF to declare and define, respectively, */
382  /* functions that are used in more than a single module.  In the    */
383  /* current setup this implies that the declaration is in a header   */
384  /* file in the `include/freetype/internal' directory, and the       */
385  /* function body is in a file in `src/base'.                        */
386  /*                                                                  */
387#ifndef FT_BASE
388
389#ifdef __cplusplus
390#define FT_BASE( x )  extern "C"  x
391#else
392#define FT_BASE( x )  extern  x
393#endif
394
395#endif /* !FT_BASE */
396
397
398#ifndef FT_BASE_DEF
399
400#ifdef __cplusplus
401#define FT_BASE_DEF( x )  x
402#else
403#define FT_BASE_DEF( x )  x
404#endif
405
406#endif /* !FT_BASE_DEF */
407
408
409  /*   When compiling FreeType as a DLL, some systems/compilers need a     */
410  /*   special attribute in front OR after the return type of function     */
411  /*   declarations.                                                       */
412  /*                                                                       */
413  /*   Two macros are used within the FreeType source code to define       */
414  /*   exported library functions: FT_EXPORT and FT_EXPORT_DEF.            */
415  /*                                                                       */
416  /*     FT_EXPORT( return_type )                                          */
417  /*                                                                       */
418  /*       is used in a function declaration, as in                        */
419  /*                                                                       */
420  /*         FT_EXPORT( FT_Error )                                         */
421  /*         FT_Init_FreeType( FT_Library*  alibrary );                    */
422  /*                                                                       */
423  /*                                                                       */
424  /*     FT_EXPORT_DEF( return_type )                                      */
425  /*                                                                       */
426  /*       is used in a function definition, as in                         */
427  /*                                                                       */
428  /*         FT_EXPORT_DEF( FT_Error )                                     */
429  /*         FT_Init_FreeType( FT_Library*  alibrary )                     */
430  /*         {                                                             */
431  /*           ... some code ...                                           */
432  /*           return FT_Err_Ok;                                           */
433  /*         }                                                             */
434  /*                                                                       */
435  /*   You can provide your own implementation of FT_EXPORT and            */
436  /*   FT_EXPORT_DEF here if you want.                                     */
437  /*                                                                       */
438  /*   To export a variable, use FT_EXPORT_VAR.                            */
439  /*                                                                       */
440#ifndef FT_EXPORT
441
442#ifdef __cplusplus
443#define FT_EXPORT( x )  extern "C"  x
444#else
445#define FT_EXPORT( x )  extern  x
446#endif
447
448#ifdef _WIN32
449#if defined( FT2_BUILD_LIBRARY ) && \
450    ( defined( _DLL ) || defined( DLL_EXPORT ) )
451#undef FT_EXPORT
452#define FT_EXPORT( x )  __declspec( dllexport )  x
453#elif defined( FT2_DLLIMPORT )
454#undef FT_EXPORT
455#define FT_EXPORT( x )  __declspec( dllimport )  x
456#endif
457#endif
458
459#endif /* !FT_EXPORT */
460
461
462#ifndef FT_EXPORT_DEF
463
464#ifdef __cplusplus
465#define FT_EXPORT_DEF( x )  extern "C"  x
466#else
467#define FT_EXPORT_DEF( x )  extern  x
468#endif
469
470#endif /* !FT_EXPORT_DEF */
471
472
473#ifndef FT_EXPORT_VAR
474
475#ifdef __cplusplus
476#define FT_EXPORT_VAR( x )  extern "C"  x
477#else
478#define FT_EXPORT_VAR( x )  extern  x
479#endif
480
481#endif /* !FT_EXPORT_VAR */
482
483  /* The following macros are needed to compile the library with a   */
484  /* C++ compiler and with 16bit compilers.                          */
485  /*                                                                 */
486
487  /* This is special.  Within C++, you must specify `extern "C"' for */
488  /* functions which are used via function pointers, and you also    */
489  /* must do that for structures which contain function pointers to  */
490  /* assure C linkage -- it's not possible to have (local) anonymous */
491  /* functions which are accessed by (global) function pointers.     */
492  /*                                                                 */
493  /*                                                                 */
494  /* FT_CALLBACK_DEF is used to _define_ a callback function,        */
495  /* located in the same source code file as the structure that uses */
496  /* it.                                                             */
497  /*                                                                 */
498  /* FT_BASE_CALLBACK and FT_BASE_CALLBACK_DEF are used to declare   */
499  /* and define a callback function, respectively, in a similar way  */
500  /* as FT_BASE and FT_BASE_DEF work.                                */
501  /*                                                                 */
502  /* FT_CALLBACK_TABLE is used to _declare_ a constant variable that */
503  /* contains pointers to callback functions.                        */
504  /*                                                                 */
505  /* FT_CALLBACK_TABLE_DEF is used to _define_ a constant variable   */
506  /* that contains pointers to callback functions.                   */
507  /*                                                                 */
508  /*                                                                 */
509  /* Some 16bit compilers have to redefine these macros to insert    */
510  /* the infamous `_cdecl' or `__fastcall' declarations.             */
511  /*                                                                 */
512#ifndef FT_CALLBACK_DEF
513#ifdef __cplusplus
514#define FT_CALLBACK_DEF( x )  extern "C"  x
515#else
516#define FT_CALLBACK_DEF( x )  static  x
517#endif
518#endif /* FT_CALLBACK_DEF */
519
520#ifndef FT_BASE_CALLBACK
521#ifdef __cplusplus
522#define FT_BASE_CALLBACK( x )      extern "C"  x
523#define FT_BASE_CALLBACK_DEF( x )  extern "C"  x
524#else
525#define FT_BASE_CALLBACK( x )      extern  x
526#define FT_BASE_CALLBACK_DEF( x )  x
527#endif
528#endif /* FT_BASE_CALLBACK */
529
530#ifndef FT_CALLBACK_TABLE
531#ifdef __cplusplus
532#define FT_CALLBACK_TABLE      extern "C"
533#define FT_CALLBACK_TABLE_DEF  extern "C"
534#else
535#define FT_CALLBACK_TABLE      extern
536#define FT_CALLBACK_TABLE_DEF  /* nothing */
537#endif
538#endif /* FT_CALLBACK_TABLE */
539
540
541FT_END_HEADER
542
543
544#endif /* FTCONFIG_H_ */
545
546
547/* END */
548