1 | /***************************************************************************/ |
---|
2 | /* */ |
---|
3 | /* ftstdlib.h */ |
---|
4 | /* */ |
---|
5 | /* ANSI-specific library and header configuration file (specification */ |
---|
6 | /* only). */ |
---|
7 | /* */ |
---|
8 | /* Copyright 2002, 2003, 2004, 2005, 2006, 2007 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 */ |
---|
27 | /* it. */ |
---|
28 | /* */ |
---|
29 | /*************************************************************************/ |
---|
30 | |
---|
31 | |
---|
32 | #ifndef __FTSTDLIB_H__ |
---|
33 | #define __FTSTDLIB_H__ |
---|
34 | |
---|
35 | |
---|
36 | #include <stddef.h> |
---|
37 | |
---|
38 | #define ft_ptrdiff_t ptrdiff_t |
---|
39 | |
---|
40 | |
---|
41 | /**********************************************************************/ |
---|
42 | /* */ |
---|
43 | /* integer limits */ |
---|
44 | /* */ |
---|
45 | /* UINT_MAX and ULONG_MAX are used to automatically compute the size */ |
---|
46 | /* of `int' and `long' in bytes at compile-time. So far, this works */ |
---|
47 | /* for all platforms the library has been tested on. */ |
---|
48 | /* */ |
---|
49 | /* Note that on the extremely rare platforms that do not provide */ |
---|
50 | /* integer types that are _exactly_ 16 and 32 bits wide (e.g. some */ |
---|
51 | /* old Crays where `int' is 36 bits), we do not make any guarantee */ |
---|
52 | /* about the correct behaviour of FT2 with all fonts. */ |
---|
53 | /* */ |
---|
54 | /* In these case, `ftconfig.h' will refuse to compile anyway with a */ |
---|
55 | /* message like `couldn't find 32-bit type' or something similar. */ |
---|
56 | /* */ |
---|
57 | /* IMPORTANT NOTE: We do not define aliases for heap management and */ |
---|
58 | /* i/o routines (i.e. malloc/free/fopen/fread/...) */ |
---|
59 | /* since these functions should all be encapsulated */ |
---|
60 | /* by platform-specific implementations of */ |
---|
61 | /* `ftsystem.c'. */ |
---|
62 | /* */ |
---|
63 | /**********************************************************************/ |
---|
64 | |
---|
65 | |
---|
66 | #include <limits.h> |
---|
67 | |
---|
68 | #define FT_CHAR_BIT CHAR_BIT |
---|
69 | #define FT_INT_MAX INT_MAX |
---|
70 | #define FT_UINT_MAX UINT_MAX |
---|
71 | #define FT_ULONG_MAX ULONG_MAX |
---|
72 | |
---|
73 | |
---|
74 | /**********************************************************************/ |
---|
75 | /* */ |
---|
76 | /* character and string processing */ |
---|
77 | /* */ |
---|
78 | /**********************************************************************/ |
---|
79 | |
---|
80 | |
---|
81 | #include <string.h> |
---|
82 | |
---|
83 | #define ft_memchr memchr |
---|
84 | #define ft_memcmp memcmp |
---|
85 | #define ft_memcpy memcpy |
---|
86 | #define ft_memmove memmove |
---|
87 | #define ft_memset memset |
---|
88 | #define ft_strcat strcat |
---|
89 | #define ft_strcmp strcmp |
---|
90 | #define ft_strcpy strcpy |
---|
91 | #define ft_strlen strlen |
---|
92 | #define ft_strncmp strncmp |
---|
93 | #define ft_strncpy strncpy |
---|
94 | #define ft_strrchr strrchr |
---|
95 | #define ft_strstr strstr |
---|
96 | |
---|
97 | |
---|
98 | /**********************************************************************/ |
---|
99 | /* */ |
---|
100 | /* file handling */ |
---|
101 | /* */ |
---|
102 | /**********************************************************************/ |
---|
103 | |
---|
104 | |
---|
105 | #include <stdio.h> |
---|
106 | |
---|
107 | #define FT_FILE FILE |
---|
108 | #define ft_fclose fclose |
---|
109 | #define ft_fopen fopen |
---|
110 | #define ft_fread fread |
---|
111 | #define ft_fseek fseek |
---|
112 | #define ft_ftell ftell |
---|
113 | #define ft_sprintf sprintf |
---|
114 | |
---|
115 | |
---|
116 | /**********************************************************************/ |
---|
117 | /* */ |
---|
118 | /* sorting */ |
---|
119 | /* */ |
---|
120 | /**********************************************************************/ |
---|
121 | |
---|
122 | |
---|
123 | #include <stdlib.h> |
---|
124 | |
---|
125 | #define ft_qsort qsort |
---|
126 | |
---|
127 | #define ft_exit exit /* only used to exit from unhandled exceptions */ |
---|
128 | |
---|
129 | |
---|
130 | /**********************************************************************/ |
---|
131 | /* */ |
---|
132 | /* memory allocation */ |
---|
133 | /* */ |
---|
134 | /**********************************************************************/ |
---|
135 | |
---|
136 | |
---|
137 | #define ft_scalloc calloc |
---|
138 | #define ft_sfree free |
---|
139 | #define ft_smalloc malloc |
---|
140 | #define ft_srealloc realloc |
---|
141 | |
---|
142 | |
---|
143 | /**********************************************************************/ |
---|
144 | /* */ |
---|
145 | /* miscellaneous */ |
---|
146 | /* */ |
---|
147 | /**********************************************************************/ |
---|
148 | |
---|
149 | |
---|
150 | #define ft_atol atol |
---|
151 | #define ft_labs labs |
---|
152 | |
---|
153 | |
---|
154 | /**********************************************************************/ |
---|
155 | /* */ |
---|
156 | /* execution control */ |
---|
157 | /* */ |
---|
158 | /**********************************************************************/ |
---|
159 | |
---|
160 | |
---|
161 | #include <setjmp.h> |
---|
162 | |
---|
163 | #define ft_jmp_buf jmp_buf /* note: this cannot be a typedef since */ |
---|
164 | /* jmp_buf is defined as a macro */ |
---|
165 | /* on certain platforms */ |
---|
166 | |
---|
167 | #define ft_longjmp longjmp |
---|
168 | #define ft_setjmp( b ) setjmp( *(jmp_buf*) &(b) ) /* same thing here */ |
---|
169 | |
---|
170 | |
---|
171 | /* the following is only used for debugging purposes, i.e., if */ |
---|
172 | /* FT_DEBUG_LEVEL_ERROR or FT_DEBUG_LEVEL_TRACE are defined */ |
---|
173 | |
---|
174 | #include <stdarg.h> |
---|
175 | |
---|
176 | |
---|
177 | #endif /* __FTSTDLIB_H__ */ |
---|
178 | |
---|
179 | |
---|
180 | /* END */ |
---|