sdk-world v2026.11.05
PS2 SDK - world tier (copyleft-allowed, non-essential packages)
Loading...
Searching...
No Matches
ftstdlib.h
Go to the documentation of this file.
1/****************************************************************************
2 *
3 * ftstdlib.h
4 *
5 * ANSI-specific library and header configuration file (specification
6 * only).
7 *
8 * Copyright (C) 2002-2025 by
9 * David Turner, Robert Wilhelm, and Werner Lemberg.
10 *
11 * This file is part of the FreeType project, and may only be used,
12 * modified, and distributed under the terms of the FreeType project
13 * license, LICENSE.TXT. By continuing to use, modify, or distribute
14 * this file you indicate that you have read the license and
15 * understand and accept it fully.
16 *
17 */
18
19
20 /**************************************************************************
21 *
22 * This file is used to group all `#includes` to the ANSI~C library that
23 * FreeType normally requires. It also defines macros to rename the
24 * standard functions within the FreeType source code.
25 *
26 * Load a file which defines `FTSTDLIB_H_` before this one to override it.
27 *
28 */
29
30
35#ifndef FTSTDLIB_H_
36#define FTSTDLIB_H_
37
38
39#include <stddef.h>
40
41#define ft_ptrdiff_t ptrdiff_t
42
43
44 /**************************************************************************
45 *
46 * integer limits
47 *
48 * `UINT_MAX` and `ULONG_MAX` are used to automatically compute the size of
49 * `int` and `long` in bytes at compile-time. So far, this works for all
50 * platforms the library has been tested on. We also check `ULLONG_MAX`
51 * to see whether we can use 64-bit `long long` later on.
52 *
53 * Note that on the extremely rare platforms that do not provide integer
54 * types that are _exactly_ 16 and 32~bits wide (e.g., some old Crays where
55 * `int` is 36~bits), we do not make any guarantee about the correct
56 * behaviour of FreeType~2 with all fonts.
57 *
58 * In these cases, `ftconfig.h` will refuse to compile anyway with a
59 * message like 'couldn't find 32-bit type' or something similar.
60 *
61 */
62
63
64#include <limits.h>
65
66#define FT_CHAR_BIT CHAR_BIT
67#define FT_USHORT_MAX USHRT_MAX
68#define FT_INT_MAX INT_MAX
69#define FT_INT_MIN INT_MIN
70#define FT_UINT_MAX UINT_MAX
71#define FT_LONG_MIN LONG_MIN
72#define FT_LONG_MAX LONG_MAX
73#define FT_ULONG_MAX ULONG_MAX
74#ifdef LLONG_MAX
75#define FT_LLONG_MAX LLONG_MAX
76#endif
77#ifdef LLONG_MIN
78#define FT_LLONG_MIN LLONG_MIN
79#endif
80#ifdef ULLONG_MAX
81#define FT_ULLONG_MAX ULLONG_MAX
82#endif
83
84
85 /**************************************************************************
86 *
87 * character and string processing
88 *
89 */
90
91
92#include <string.h>
93
94#define ft_memchr memchr
95#define ft_memcmp memcmp
96#define ft_memcpy memcpy
97#define ft_memmove memmove
98#define ft_memset memset
99#define ft_strcat strcat
100#define ft_strcmp strcmp
101#define ft_strcpy strcpy
102#define ft_strlen strlen
103#define ft_strncmp strncmp
104#define ft_strncpy strncpy
105#define ft_strrchr strrchr
106#define ft_strstr strstr
107
108
109 /**************************************************************************
110 *
111 * file handling
112 *
113 */
114
115
116#include <stdio.h>
117
118#define FT_FILE FILE
119#define ft_fclose fclose
120#define ft_fopen fopen
121#define ft_fread fread
122#define ft_fseek fseek
123#define ft_ftell ftell
124#define ft_snprintf snprintf
125
126
127 /**************************************************************************
128 *
129 * sorting
130 *
131 */
132
133
134#include <stdlib.h>
135
136#define ft_qsort qsort
137
138
139 /**************************************************************************
140 *
141 * memory allocation
142 *
143 */
144
145
146#define ft_scalloc calloc
147#define ft_sfree free
148#define ft_smalloc malloc
149#define ft_srealloc realloc
150
151
152 /**************************************************************************
153 *
154 * miscellaneous
155 *
156 */
157
158
159#define ft_strtol strtol
160#define ft_getenv getenv
161
162
163 /**************************************************************************
164 *
165 * execution control
166 *
167 */
168
169
170#include <setjmp.h>
171
172#define ft_jmp_buf jmp_buf /* note: this cannot be a typedef since */
173 /* `jmp_buf` is defined as a macro */
174 /* on certain platforms */
175
176#define ft_longjmp longjmp
177#define ft_setjmp( b ) setjmp( *(ft_jmp_buf*) &(b) ) /* same thing here */
178
179
180 /* The following is only used for debugging purposes, i.e., if */
181 /* `FT_DEBUG_LEVEL_ERROR` or `FT_DEBUG_LEVEL_TRACE` are defined. */
182
183#include <stdarg.h>
184
185
186#endif /* FTSTDLIB_H_ */
187
188
189/* END */