1
/***************************************************************************/
5
/* ANSI-specific configuration file (specification only). */
7
/* Copyright 1996-2001, 2002, 2003, 2004 by */
8
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
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. */
16
/***************************************************************************/
19
/*************************************************************************/
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 */
27
/* Note however that if some specific modifications are needed, we */
28
/* advise you to place a modified copy in your build directory. */
30
/* The build directory is usually `freetype/builds/<system>', and */
31
/* contains system-specific files that are always included first when */
32
/* building the library. */
34
/* This ANSI version should stay in `include/freetype/config'. */
36
/*************************************************************************/
39
#ifndef __FTCONFIG_H__
40
#define __FTCONFIG_H__
43
#include FT_CONFIG_OPTIONS_H
44
#include FT_CONFIG_STANDARD_LIBRARY_H
49
/*************************************************************************/
51
/* PLATFORM-SPECIFIC CONFIGURATION MACROS */
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 */
55
/* (16bit compilers are also supported). Copy this file to your own */
56
/* `freetype/builds/<system>' directory, and edit it to port the engine. */
58
/*************************************************************************/
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 */
63
/* `int' has 16 bits also for this system, sizeof(int) gives 1 which */
64
/* is probably unexpected. */
66
/* `CHAR_BIT' (defined in limits.h) gives the number of bits in a */
70
#define FT_CHAR_BIT CHAR_BIT
74
/* The size of an `int' type. */
75
#if FT_UINT_MAX == 0xFFFFFFFFUL
76
#define FT_SIZEOF_INT (32 / FT_CHAR_BIT)
77
#elif FT_UINT_MAX == 0xFFFFU
78
#define FT_SIZEOF_INT (16 / FT_CHAR_BIT)
79
#elif FT_UINT_MAX > 0xFFFFFFFFU && FT_UINT_MAX == 0xFFFFFFFFFFFFFFFFU
80
#define FT_SIZEOF_INT (64 / FT_CHAR_BIT)
82
#error "Unsupported size of `int' type!"
85
/* The size of a `long' type. */
86
#if FT_ULONG_MAX == 0xFFFFFFFFUL
87
#define FT_SIZEOF_LONG (32 / FT_CHAR_BIT)
88
#elif FT_ULONG_MAX > 0xFFFFFFFFU && FT_ULONG_MAX == 0xFFFFFFFFFFFFFFFFU
89
#define FT_SIZEOF_LONG (64 / FT_CHAR_BIT)
91
#error "Unsupported size of `long' type!"
95
/* Preferred alignment of data */
96
#define FT_ALIGNMENT 8
99
/* FT_UNUSED is a macro used to indicate that a given parameter is not */
100
/* used -- this is only used to get rid of unpleasant compiler warnings */
102
#define FT_UNUSED( arg ) ( (arg) = (arg) )
106
/*************************************************************************/
108
/* AUTOMATIC CONFIGURATION MACROS */
110
/* These macros are computed from the ones defined above. Don't touch */
111
/* their definition, unless you know precisely what you are doing. No */
112
/* porter should need to mess with them. */
114
/*************************************************************************/
117
/*************************************************************************/
121
/* This is the only necessary change, so it is defined here instead */
122
/* providing a new configuration file. */
124
#if ( defined( __APPLE__ ) && !defined( DARWIN_NO_CARBON ) ) || \
125
( defined( __MWERKS__ ) && defined( macintosh ) )
126
#define FT_MACINTOSH 1
130
/*************************************************************************/
134
/* Used to guarantee the size of some specific integers. */
136
typedef signed short FT_Int16;
137
typedef unsigned short FT_UInt16;
139
#if FT_SIZEOF_INT == (32 / FT_CHAR_BIT)
141
typedef signed int FT_Int32;
142
typedef unsigned int FT_UInt32;
144
#elif FT_SIZEOF_LONG == (32 / FT_CHAR_BIT)
146
typedef signed long FT_Int32;
147
typedef unsigned long FT_UInt32;
150
#error "no 32bit type found -- please check your configuration files"
153
/* look up an integer type that is at least 32 bits */
154
#if FT_SIZEOF_INT >= (32 / FT_CHAR_BIT)
157
typedef unsigned int FT_UFast;
159
#elif FT_SIZEOF_LONG >= (32 / FT_CHAR_BIT)
161
typedef long FT_Fast;
162
typedef unsigned long FT_UFast;
167
/* determine whether we have a 64-bit int type for platforms without */
169
#if FT_SIZEOF_LONG == (64 / FT_CHAR_BIT)
171
/* FT_LONG64 must be defined if a 64-bit type is available */
173
#define FT_INT64 long
175
#elif defined( _MSC_VER ) && _MSC_VER >= 900 /* Visual C++ (and Intel C++) */
177
/* this compiler provides the __int64 type */
179
#define FT_INT64 __int64
181
#elif defined( __BORLANDC__ ) /* Borland C++ */
183
/* XXXX: We should probably check the value of __BORLANDC__ in order */
184
/* to test the compiler version. */
186
/* this compiler provides the __int64 type */
188
#define FT_INT64 __int64
190
#elif defined( __WATCOMC__ ) /* Watcom C++ */
192
/* Watcom doesn't provide 64-bit data types */
194
#elif defined( __MWERKS__ ) /* Metrowerks CodeWarrior */
197
#define FT_INT64 long long int
199
#elif defined( __GNUC__ )
201
/* GCC provides the "long long" type */
203
#define FT_INT64 long long int
205
#endif /* FT_SIZEOF_LONG == (64 / FT_CHAR_BIT) */
208
#define FT_BEGIN_STMNT do {
209
#define FT_END_STMNT } while ( 0 )
210
#define FT_DUMMY_STMNT FT_BEGIN_STMNT FT_END_STMNT
213
/*************************************************************************/
215
/* A 64-bit data type will create compilation problems if you compile */
216
/* in strict ANSI mode. To avoid them, we disable their use if */
217
/* __STDC__ is defined. You can however ignore this rule by */
218
/* defining the FT_CONFIG_OPTION_FORCE_INT64 configuration macro. */
220
#if defined( FT_LONG64 ) && !defined( FT_CONFIG_OPTION_FORCE_INT64 )
224
/* undefine the 64-bit macros in strict ANSI compilation mode */
228
#endif /* __STDC__ */
230
#endif /* FT_LONG64 && !FT_CONFIG_OPTION_FORCE_INT64 */
233
#ifdef FT_MAKE_OPTION_SINGLE_OBJECT
235
#define FT_LOCAL( x ) static x
236
#define FT_LOCAL_DEF( x ) static x
241
#define FT_LOCAL( x ) extern "C" x
242
#define FT_LOCAL_DEF( x ) extern "C" x
244
#define FT_LOCAL( x ) extern x
245
#define FT_LOCAL_DEF( x ) x
248
#endif /* FT_MAKE_OPTION_SINGLE_OBJECT */
254
#define FT_BASE( x ) extern "C" x
256
#define FT_BASE( x ) extern x
259
#endif /* !FT_BASE */
265
#define FT_BASE_DEF( x ) extern "C" x
267
#define FT_BASE_DEF( x ) extern x
270
#endif /* !FT_BASE_DEF */
276
#define FT_EXPORT( x ) extern "C" x
278
#define FT_EXPORT( x ) extern x
281
#endif /* !FT_EXPORT */
284
#ifndef FT_EXPORT_DEF
287
#define FT_EXPORT_DEF( x ) extern "C" x
289
#define FT_EXPORT_DEF( x ) extern x
292
#endif /* !FT_EXPORT_DEF */
295
#ifndef FT_EXPORT_VAR
298
#define FT_EXPORT_VAR( x ) extern "C" x
300
#define FT_EXPORT_VAR( x ) extern x
303
#endif /* !FT_EXPORT_VAR */
305
/* The following macros are needed to compile the library with a */
306
/* C++ compiler and with 16bit compilers. */
309
/* This is special. Within C++, you must specify `extern "C"' for */
310
/* functions which are used via function pointers, and you also */
311
/* must do that for structures which contain function pointers to */
312
/* assure C linkage -- it's not possible to have (local) anonymous */
313
/* functions which are accessed by (global) function pointers. */
316
/* FT_CALLBACK_DEF is used to _define_ a callback function. */
318
/* FT_CALLBACK_TABLE is used to _declare_ a constant variable that */
319
/* contains pointers to callback functions. */
321
/* FT_CALLBACK_TABLE_DEF is used to _define_ a constant variable */
322
/* that contains pointers to callback functions. */
325
/* Some 16bit compilers have to redefine these macros to insert */
326
/* the infamous `_cdecl' or `__fastcall' declarations. */
328
#ifndef FT_CALLBACK_DEF
330
#define FT_CALLBACK_DEF( x ) extern "C" x
332
#define FT_CALLBACK_DEF( x ) static x
334
#endif /* FT_CALLBACK_DEF */
336
#ifndef FT_CALLBACK_TABLE
338
#define FT_CALLBACK_TABLE extern "C"
339
#define FT_CALLBACK_TABLE_DEF extern "C"
341
#define FT_CALLBACK_TABLE extern
342
#define FT_CALLBACK_TABLE_DEF /* nothing */
344
#endif /* FT_CALLBACK_TABLE */
350
#endif /* __FTCONFIG_H__ */