OLD | NEW |
1 /***************************************************************************/ | 1 /***************************************************************************/ |
2 /* */ | 2 /* */ |
3 /* ftinit.c */ | 3 /* ftinit.c */ |
4 /* */ | 4 /* */ |
5 /* FreeType initialization layer (body). */ | 5 /* FreeType initialization layer (body). */ |
6 /* */ | 6 /* */ |
7 /* Copyright 1996-2002, 2005, 2007, 2009, 2012-2014 by */ | 7 /* Copyright 1996-2015 by */ |
8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ | 8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
9 /* */ | 9 /* */ |
10 /* This file is part of the FreeType project, and may only be used, */ | 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 */ | 11 /* modified, and distributed under the terms of the FreeType project */ |
12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ | 12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ |
13 /* this file you indicate that you have read the license and */ | 13 /* this file you indicate that you have read the license and */ |
14 /* understand and accept it fully. */ | 14 /* understand and accept it fully. */ |
15 /* */ | 15 /* */ |
16 /***************************************************************************/ | 16 /***************************************************************************/ |
17 | 17 |
18 /*************************************************************************/ | 18 /*************************************************************************/ |
19 /* */ | 19 /* */ |
20 /* The purpose of this file is to implement the following two */ | 20 /* The purpose of this file is to implement the following two */ |
21 /* functions: */ | 21 /* functions: */ |
22 /* */ | 22 /* */ |
23 /* FT_Add_Default_Modules(): */ | 23 /* FT_Add_Default_Modules(): */ |
24 /* This function is used to add the set of default modules to a */ | 24 /* This function is used to add the set of default modules to a */ |
25 /* fresh new library object. The set is taken from the header file */ | 25 /* fresh new library object. The set is taken from the header file */ |
26 /* `config/ftmodule.h'. See the document `FreeType 2.0 Build */ | 26 /* `freetype/config/ftmodule.h'. See the document `FreeType 2.0 */ |
27 /* System' for more information. */ | 27 /* Build System' for more information. */ |
28 /* */ | 28 /* */ |
29 /* FT_Init_FreeType(): */ | 29 /* FT_Init_FreeType(): */ |
30 /* This function creates a system object for the current platform, */ | 30 /* This function creates a system object for the current platform, */ |
31 /* builds a library out of it, then calls FT_Default_Drivers(). */ | 31 /* builds a library out of it, then calls FT_Default_Drivers(). */ |
32 /* */ | 32 /* */ |
33 /* Note that even if FT_Init_FreeType() uses the implementation of the */ | 33 /* Note that even if FT_Init_FreeType() uses the implementation of the */ |
34 /* system object defined at build time, client applications are still */ | 34 /* system object defined at build time, client applications are still */ |
35 /* able to provide their own `ftsystem.c'. */ | 35 /* able to provide their own `ftsystem.c'. */ |
36 /* */ | 36 /* */ |
37 /*************************************************************************/ | 37 /*************************************************************************/ |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 if ( !pic_container->default_module_classes ) | 131 if ( !pic_container->default_module_classes ) |
132 return; | 132 return; |
133 | 133 |
134 memory = library->memory; | 134 memory = library->memory; |
135 classes = pic_container->default_module_classes; | 135 classes = pic_container->default_module_classes; |
136 i = 0; | 136 i = 0; |
137 | 137 |
138 #include FT_CONFIG_MODULES_H | 138 #include FT_CONFIG_MODULES_H |
139 | 139 |
140 FT_FREE( classes ); | 140 FT_FREE( classes ); |
141 pic_container->default_module_classes = 0; | 141 pic_container->default_module_classes = NULL; |
142 } | 142 } |
143 | 143 |
144 | 144 |
145 /* initialize all module classes and the pointer table */ | 145 /* initialize all module classes and the pointer table */ |
146 #undef FT_USE_MODULE | 146 #undef FT_USE_MODULE |
147 #define FT_USE_MODULE( type, x ) \ | 147 #define FT_USE_MODULE( type, x ) \ |
148 error = FT_Create_Class_ ## x( library, &clazz ); \ | 148 error = FT_Create_Class_ ## x( library, &clazz ); \ |
149 if ( error ) \ | 149 if ( error ) \ |
150 goto Exit; \ | 150 goto Exit; \ |
151 classes[i++] = clazz; | 151 classes[i++] = clazz; |
152 | 152 |
153 | 153 |
154 FT_BASE_DEF( FT_Error ) | 154 FT_BASE_DEF( FT_Error ) |
155 ft_create_default_module_classes( FT_Library library ) | 155 ft_create_default_module_classes( FT_Library library ) |
156 { | 156 { |
157 FT_Error error; | 157 FT_Error error; |
158 FT_Memory memory; | 158 FT_Memory memory; |
159 FT_Module_Class* *classes = NULL; | 159 FT_Module_Class* *classes = NULL; |
160 FT_Module_Class* clazz; | 160 FT_Module_Class* clazz; |
161 FT_UInt i; | 161 FT_UInt i; |
162 BasePIC* pic_container = (BasePIC*)library->pic_container.base; | 162 BasePIC* pic_container = (BasePIC*)library->pic_container.base; |
163 | 163 |
164 | 164 |
165 memory = library->memory; | 165 memory = library->memory; |
166 | 166 |
167 pic_container->default_module_classes = 0; | 167 pic_container->default_module_classes = NULL; |
168 | 168 |
169 if ( FT_ALLOC( classes, sizeof ( FT_Module_Class* ) * | 169 if ( FT_ALLOC( classes, sizeof ( FT_Module_Class* ) * |
170 ( FT_NUM_MODULE_CLASSES + 1 ) ) ) | 170 ( FT_NUM_MODULE_CLASSES + 1 ) ) ) |
171 return error; | 171 return error; |
172 | 172 |
173 /* initialize all pointers to 0, especially the last one */ | 173 /* initialize all pointers to 0, especially the last one */ |
174 for ( i = 0; i < FT_NUM_MODULE_CLASSES; i++ ) | 174 for ( i = 0; i < FT_NUM_MODULE_CLASSES; i++ ) |
175 classes[i] = 0; | 175 classes[i] = NULL; |
176 classes[FT_NUM_MODULE_CLASSES] = 0; | 176 classes[FT_NUM_MODULE_CLASSES] = NULL; |
177 | 177 |
178 i = 0; | 178 i = 0; |
179 | 179 |
180 #include FT_CONFIG_MODULES_H | 180 #include FT_CONFIG_MODULES_H |
181 | 181 |
182 Exit: | 182 Exit: |
183 if ( error ) | 183 if ( error ) |
184 ft_destroy_default_module_classes( library ); | 184 ft_destroy_default_module_classes( library ); |
185 else | 185 else |
186 pic_container->default_module_classes = classes; | 186 pic_container->default_module_classes = classes; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 FT_Done_Library( library ); | 277 FT_Done_Library( library ); |
278 | 278 |
279 /* discard memory manager */ | 279 /* discard memory manager */ |
280 FT_Done_Memory( memory ); | 280 FT_Done_Memory( memory ); |
281 | 281 |
282 return FT_Err_Ok; | 282 return FT_Err_Ok; |
283 } | 283 } |
284 | 284 |
285 | 285 |
286 /* END */ | 286 /* END */ |
OLD | NEW |