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