sdk-world
v2026.11.05
PS2 SDK - world tier (copyleft-allowed, non-essential packages)
Toggle main menu visibility
Loading...
Searching...
No Matches
public-macros.h
Go to the documentation of this file.
1
/****************************************************************************
2
*
3
* config/public-macros.h
4
*
5
* Define a set of compiler macros used in public FreeType headers.
6
*
7
* Copyright (C) 2020-2025 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
* The definitions in this file are used by the public FreeType headers
20
* and thus should be considered part of the public API.
21
*
22
* Other compiler-specific macro definitions that are not exposed by the
23
* FreeType API should go into
24
* `include/freetype/internal/compiler-macros.h` instead.
25
*/
30
#ifndef FREETYPE_CONFIG_PUBLIC_MACROS_H_
31
#define FREETYPE_CONFIG_PUBLIC_MACROS_H_
32
33
/*
34
* `FT_BEGIN_HEADER` and `FT_END_HEADER` might have already been defined
35
* by `freetype/config/ftheader.h`, but we don't want to include this
36
* header here, so redefine the macros here only when needed. Their
37
* definition is very stable, so keeping them in sync with the ones in the
38
* header should not be a maintenance issue.
39
*/
40
#ifndef FT_BEGIN_HEADER
41
#ifdef __cplusplus
42
#define FT_BEGIN_HEADER extern "C" {
43
#else
44
#define FT_BEGIN_HEADER
/* empty */
45
#endif
46
#endif
/* FT_BEGIN_HEADER */
47
48
#ifndef FT_END_HEADER
49
#ifdef __cplusplus
50
#define FT_END_HEADER }
51
#else
52
#define FT_END_HEADER
/* empty */
53
#endif
54
#endif
/* FT_END_HEADER */
55
56
57
FT_BEGIN_HEADER
58
59
/*
60
* Mark a function declaration as public. This ensures it will be
61
* properly exported to client code. Place this before a function
62
* declaration.
63
*
64
* NOTE: This macro should be considered an internal implementation
65
* detail, and not part of the FreeType API. It is only defined here
66
* because it is needed by `FT_EXPORT`.
67
*/
68
69
/* Visual C, MinGW, Cygwin */
70
#if defined( _WIN32 ) || defined( __CYGWIN__ )
71
72
#if defined( FT2_BUILD_LIBRARY ) && defined( DLL_EXPORT )
73
#define FT_PUBLIC_FUNCTION_ATTRIBUTE __declspec( dllexport )
74
#elif defined( DLL_IMPORT )
75
#define FT_PUBLIC_FUNCTION_ATTRIBUTE __declspec( dllimport )
76
#endif
77
78
/* gcc, clang */
79
#elif ( defined( __GNUC__ ) && __GNUC__ >= 4 ) || defined( __clang__ )
80
#define FT_PUBLIC_FUNCTION_ATTRIBUTE \
81
__attribute__(( visibility( "default" ) ))
82
83
/* Sun */
84
#elif defined( __SUNPRO_C ) && __SUNPRO_C >= 0x550
85
#define FT_PUBLIC_FUNCTION_ATTRIBUTE __global
86
#endif
87
88
89
#ifndef FT_PUBLIC_FUNCTION_ATTRIBUTE
90
#define FT_PUBLIC_FUNCTION_ATTRIBUTE
/* empty */
91
#endif
92
93
94
/*
95
* Define a public FreeType API function. This ensures it is properly
96
* exported or imported at build time. The macro parameter is the
97
* function's return type as in:
98
*
99
* FT_EXPORT( FT_Bool )
100
* FT_Object_Method( FT_Object obj,
101
* ... );
102
*
103
* NOTE: This requires that all `FT_EXPORT` uses are inside
104
* `FT_BEGIN_HEADER ... FT_END_HEADER` blocks. This guarantees that the
105
* functions are exported with C linkage, even when the header is included
106
* by a C++ source file.
107
*/
108
#define FT_EXPORT( x ) FT_PUBLIC_FUNCTION_ATTRIBUTE extern x
109
110
111
/*
112
* `FT_UNUSED` indicates that a given parameter is not used -- this is
113
* only used to get rid of unpleasant compiler warnings.
114
*
115
* Technically, this was not meant to be part of the public API, but some
116
* third-party code depends on it.
117
*/
118
#ifndef FT_UNUSED
119
#define FT_UNUSED( arg ) ( (arg) = (arg) )
120
#endif
121
122
123
/*
124
* Support for casts in both C and C++.
125
*/
126
#ifdef __cplusplus
127
#define FT_STATIC_CAST( type, var ) static_cast<type>(var)
128
#define FT_REINTERPRET_CAST( type, var ) reinterpret_cast<type>(var)
129
130
#define FT_STATIC_BYTE_CAST( type, var ) \
131
static_cast<type>( static_cast<unsigned char>( var ) )
132
#else
133
#define FT_STATIC_CAST( type, var ) (type)(var)
134
#define FT_REINTERPRET_CAST( type, var ) (type)(var)
135
136
#define FT_STATIC_BYTE_CAST( type, var ) (type)(unsigned char)(var)
137
#endif
138
139
140
FT_END_HEADER
141
142
#endif
/* FREETYPE_CONFIG_PUBLIC_MACROS_H_ */
freetype
include
freetype
config
public-macros.h
Generated by
1.18.0