OLD | NEW |
1 /***************************************************************************/ | 1 /***************************************************************************/ |
2 /* */ | 2 /* */ |
3 /* ftobjs.h */ | 3 /* ftobjs.h */ |
4 /* */ | 4 /* */ |
5 /* The FreeType private base classes (specification). */ | 5 /* The FreeType private base classes (specification). */ |
6 /* */ | 6 /* */ |
7 /* Copyright 1996-2006, 2008, 2010, 2012 by */ | 7 /* Copyright 1996-2006, 2008, 2010, 2012-2013 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 |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 /* selector subtable which behaves like no other */ | 199 /* selector subtable which behaves like no other */ |
200 | 200 |
201 FT_CMap_CharVarIndexFunc char_var_index; | 201 FT_CMap_CharVarIndexFunc char_var_index; |
202 FT_CMap_CharVarIsDefaultFunc char_var_default; | 202 FT_CMap_CharVarIsDefaultFunc char_var_default; |
203 FT_CMap_VariantListFunc variant_list; | 203 FT_CMap_VariantListFunc variant_list; |
204 FT_CMap_CharVariantListFunc charvariant_list; | 204 FT_CMap_CharVariantListFunc charvariant_list; |
205 FT_CMap_VariantCharListFunc variantchar_list; | 205 FT_CMap_VariantCharListFunc variantchar_list; |
206 | 206 |
207 } FT_CMap_ClassRec; | 207 } FT_CMap_ClassRec; |
208 | 208 |
| 209 |
209 #ifndef FT_CONFIG_OPTION_PIC | 210 #ifndef FT_CONFIG_OPTION_PIC |
210 | 211 |
211 #define FT_DECLARE_CMAP_CLASS(class_) \ | 212 #define FT_DECLARE_CMAP_CLASS( class_ ) \ |
212 FT_CALLBACK_TABLE const FT_CMap_ClassRec class_; | 213 FT_CALLBACK_TABLE const FT_CMap_ClassRec class_; |
213 | 214 |
214 #define FT_DEFINE_CMAP_CLASS(class_, size_, init_, done_, char_index_, \ | 215 #define FT_DEFINE_CMAP_CLASS( \ |
215 char_next_, char_var_index_, char_var_default_, variant_list_, \ | 216 class_, \ |
216 charvariant_list_, variantchar_list_) \ | 217 size_, \ |
217 FT_CALLBACK_TABLE_DEF \ | 218 init_, \ |
218 const FT_CMap_ClassRec class_ = \ | 219 done_, \ |
219 { \ | 220 char_index_, \ |
220 size_, init_, done_, char_index_, char_next_, char_var_index_, \ | 221 char_next_, \ |
221 char_var_default_, variant_list_, charvariant_list_, variantchar_list_ \ | 222 char_var_index_, \ |
| 223 char_var_default_, \ |
| 224 variant_list_, \ |
| 225 charvariant_list_, \ |
| 226 variantchar_list_ ) \ |
| 227 FT_CALLBACK_TABLE_DEF \ |
| 228 const FT_CMap_ClassRec class_ = \ |
| 229 { \ |
| 230 size_, \ |
| 231 init_, \ |
| 232 done_, \ |
| 233 char_index_, \ |
| 234 char_next_, \ |
| 235 char_var_index_, \ |
| 236 char_var_default_, \ |
| 237 variant_list_, \ |
| 238 charvariant_list_, \ |
| 239 variantchar_list_ \ |
222 }; | 240 }; |
| 241 |
223 #else /* FT_CONFIG_OPTION_PIC */ | 242 #else /* FT_CONFIG_OPTION_PIC */ |
224 | 243 |
225 #define FT_DECLARE_CMAP_CLASS(class_) \ | 244 #define FT_DECLARE_CMAP_CLASS( class_ ) \ |
226 void FT_Init_Class_##class_( FT_Library library, FT_CMap_ClassRec* clazz); | 245 void \ |
| 246 FT_Init_Class_ ## class_( FT_Library library, \ |
| 247 FT_CMap_ClassRec* clazz ); |
227 | 248 |
228 #define FT_DEFINE_CMAP_CLASS(class_, size_, init_, done_, char_index_, \ | 249 #define FT_DEFINE_CMAP_CLASS( \ |
229 char_next_, char_var_index_, char_var_default_, variant_list_, \ | 250 class_, \ |
230 charvariant_list_, variantchar_list_) \ | 251 size_, \ |
231 void \ | 252 init_, \ |
232 FT_Init_Class_##class_( FT_Library library, \ | 253 done_, \ |
233 FT_CMap_ClassRec* clazz) \ | 254 char_index_, \ |
234 { \ | 255 char_next_, \ |
235 FT_UNUSED(library); \ | 256 char_var_index_, \ |
236 clazz->size = size_; \ | 257 char_var_default_, \ |
237 clazz->init = init_; \ | 258 variant_list_, \ |
238 clazz->done = done_; \ | 259 charvariant_list_, \ |
239 clazz->char_index = char_index_; \ | 260 variantchar_list_ ) \ |
240 clazz->char_next = char_next_; \ | 261 void \ |
241 clazz->char_var_index = char_var_index_; \ | 262 FT_Init_Class_ ## class_( FT_Library library, \ |
242 clazz->char_var_default = char_var_default_; \ | 263 FT_CMap_ClassRec* clazz ) \ |
243 clazz->variant_list = variant_list_; \ | 264 { \ |
244 clazz->charvariant_list = charvariant_list_; \ | 265 FT_UNUSED( library ); \ |
245 clazz->variantchar_list = variantchar_list_; \ | 266 \ |
| 267 clazz->size = size_; \ |
| 268 clazz->init = init_; \ |
| 269 clazz->done = done_; \ |
| 270 clazz->char_index = char_index_; \ |
| 271 clazz->char_next = char_next_; \ |
| 272 clazz->char_var_index = char_var_index_; \ |
| 273 clazz->char_var_default = char_var_default_; \ |
| 274 clazz->variant_list = variant_list_; \ |
| 275 clazz->charvariant_list = charvariant_list_; \ |
| 276 clazz->variantchar_list = variantchar_list_; \ |
246 } | 277 } |
| 278 |
247 #endif /* FT_CONFIG_OPTION_PIC */ | 279 #endif /* FT_CONFIG_OPTION_PIC */ |
248 | 280 |
| 281 |
249 /* create a new charmap and add it to charmap->face */ | 282 /* create a new charmap and add it to charmap->face */ |
250 FT_BASE( FT_Error ) | 283 FT_BASE( FT_Error ) |
251 FT_CMap_New( FT_CMap_Class clazz, | 284 FT_CMap_New( FT_CMap_Class clazz, |
252 FT_Pointer init_data, | 285 FT_Pointer init_data, |
253 FT_CharMap charmap, | 286 FT_CharMap charmap, |
254 FT_CMap *acmap ); | 287 FT_CMap *acmap ); |
255 | 288 |
256 /* destroy a charmap and remove it from face's list */ | 289 /* destroy a charmap and remove it from face's list */ |
257 FT_BASE( void ) | 290 FT_BASE( void ) |
258 FT_CMap_Done( FT_CMap cmap ); | 291 FT_CMap_Done( FT_CMap cmap ); |
259 | 292 |
260 | 293 |
261 /*************************************************************************/ | 294 /*************************************************************************/ |
262 /* */ | 295 /* */ |
263 /* <Struct> */ | 296 /* <Struct> */ |
264 /* FT_Face_InternalRec */ | 297 /* FT_Face_InternalRec */ |
265 /* */ | 298 /* */ |
266 /* <Description> */ | 299 /* <Description> */ |
267 /* This structure contains the internal fields of each FT_Face */ | 300 /* This structure contains the internal fields of each FT_Face */ |
268 /* object. These fields may change between different releases of */ | 301 /* object. These fields may change between different releases of */ |
269 /* FreeType. */ | 302 /* FreeType. */ |
270 /* */ | 303 /* */ |
271 /* <Fields> */ | 304 /* <Fields> */ |
272 /* max_points :: */ | 305 /* max_points :: */ |
273 /* The maximal number of points used to store the vectorial outline */ | 306 /* The maximum number of points used to store the vectorial outline */ |
274 /* of any glyph in this face. If this value cannot be known in */ | 307 /* of any glyph in this face. If this value cannot be known in */ |
275 /* advance, or if the face isn't scalable, this should be set to 0. */ | 308 /* advance, or if the face isn't scalable, this should be set to 0. */ |
276 /* Only relevant for scalable formats. */ | 309 /* Only relevant for scalable formats. */ |
277 /* */ | 310 /* */ |
278 /* max_contours :: */ | 311 /* max_contours :: */ |
279 /* The maximal number of contours used to store the vectorial */ | 312 /* The maximum number of contours used to store the vectorial */ |
280 /* outline of any glyph in this face. If this value cannot be */ | 313 /* outline of any glyph in this face. If this value cannot be */ |
281 /* known in advance, or if the face isn't scalable, this should be */ | 314 /* known in advance, or if the face isn't scalable, this should be */ |
282 /* set to 0. Only relevant for scalable formats. */ | 315 /* set to 0. Only relevant for scalable formats. */ |
283 /* */ | 316 /* */ |
284 /* transform_matrix :: */ | 317 /* transform_matrix :: */ |
285 /* A 2x2 matrix of 16.16 coefficients used to transform glyph */ | 318 /* A 2x2 matrix of 16.16 coefficients used to transform glyph */ |
286 /* outlines after they are loaded from the font. Only used by the */ | 319 /* outlines after they are loaded from the font. Only used by the */ |
287 /* convenience functions. */ | 320 /* convenience functions. */ |
288 /* */ | 321 /* */ |
289 /* transform_delta :: */ | 322 /* transform_delta :: */ |
(...skipping 22 matching lines...) Expand all Loading... |
312 /* library. */ | 345 /* library. */ |
313 /* */ | 346 /* */ |
314 /* refcount :: */ | 347 /* refcount :: */ |
315 /* A counter initialized to~1 at the time an @FT_Face structure is */ | 348 /* A counter initialized to~1 at the time an @FT_Face structure is */ |
316 /* created. @FT_Reference_Face increments this counter, and */ | 349 /* created. @FT_Reference_Face increments this counter, and */ |
317 /* @FT_Done_Face only destroys a face if the counter is~1, */ | 350 /* @FT_Done_Face only destroys a face if the counter is~1, */ |
318 /* otherwise it simply decrements it. */ | 351 /* otherwise it simply decrements it. */ |
319 /* */ | 352 /* */ |
320 typedef struct FT_Face_InternalRec_ | 353 typedef struct FT_Face_InternalRec_ |
321 { | 354 { |
322 #ifdef FT_CONFIG_OPTION_OLD_INTERNALS | |
323 FT_UShort reserved1; | |
324 FT_Short reserved2; | |
325 #endif | |
326 FT_Matrix transform_matrix; | 355 FT_Matrix transform_matrix; |
327 FT_Vector transform_delta; | 356 FT_Vector transform_delta; |
328 FT_Int transform_flags; | 357 FT_Int transform_flags; |
329 | 358 |
330 FT_ServiceCacheRec services; | 359 FT_ServiceCacheRec services; |
331 | 360 |
332 #ifdef FT_CONFIG_OPTION_INCREMENTAL | 361 #ifdef FT_CONFIG_OPTION_INCREMENTAL |
333 FT_Incremental_InterfaceRec* incremental_interface; | 362 FT_Incremental_InterfaceRec* incremental_interface; |
334 #endif | 363 #endif |
335 | 364 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 { | 433 { |
405 /* empty */ | 434 /* empty */ |
406 | 435 |
407 } FT_Size_InternalRec; | 436 } FT_Size_InternalRec; |
408 | 437 |
409 #endif | 438 #endif |
410 | 439 |
411 | 440 |
412 /*************************************************************************/ | 441 /*************************************************************************/ |
413 /*************************************************************************/ | 442 /*************************************************************************/ |
| 443 /*************************************************************************/ |
414 /**** ****/ | 444 /**** ****/ |
415 /**** ****/ | 445 /**** ****/ |
416 /**** M O D U L E S ****/ | 446 /**** M O D U L E S ****/ |
417 /**** ****/ | 447 /**** ****/ |
418 /**** ****/ | 448 /**** ****/ |
419 /*************************************************************************/ | 449 /*************************************************************************/ |
420 /*************************************************************************/ | 450 /*************************************************************************/ |
421 /*************************************************************************/ | 451 /*************************************************************************/ |
422 | 452 |
423 | 453 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 /* which module to look for, and what its interface is :-) */ | 526 /* which module to look for, and what its interface is :-) */ |
497 /* */ | 527 /* */ |
498 FT_BASE( const void* ) | 528 FT_BASE( const void* ) |
499 FT_Get_Module_Interface( FT_Library library, | 529 FT_Get_Module_Interface( FT_Library library, |
500 const char* mod_name ); | 530 const char* mod_name ); |
501 | 531 |
502 FT_BASE( FT_Pointer ) | 532 FT_BASE( FT_Pointer ) |
503 ft_module_get_service( FT_Module module, | 533 ft_module_get_service( FT_Module module, |
504 const char* service_id ); | 534 const char* service_id ); |
505 | 535 |
506 /* */ | 536 /* */ |
507 | 537 |
508 | 538 |
509 /*************************************************************************/ | 539 /*************************************************************************/ |
510 /*************************************************************************/ | 540 /*************************************************************************/ |
511 /*************************************************************************/ | 541 /*************************************************************************/ |
512 /**** ****/ | 542 /**** ****/ |
513 /**** ****/ | 543 /**** ****/ |
514 /**** FACE, SIZE & GLYPH SLOT OBJECTS ****/ | 544 /**** F A C E, S I Z E & G L Y P H S L O T O B J E C T S ****/ |
515 /**** ****/ | 545 /**** ****/ |
516 /**** ****/ | 546 /**** ****/ |
517 /*************************************************************************/ | 547 /*************************************************************************/ |
518 /*************************************************************************/ | 548 /*************************************************************************/ |
519 /*************************************************************************/ | 549 /*************************************************************************/ |
520 | 550 |
521 /* a few macros used to perform easy typecasts with minimal brain damage */ | 551 /* a few macros used to perform easy typecasts with minimal brain damage */ |
522 | 552 |
523 #define FT_FACE( x ) ((FT_Face)(x)) | 553 #define FT_FACE( x ) ((FT_Face)(x)) |
524 #define FT_SIZE( x ) ((FT_Size)(x)) | 554 #define FT_SIZE( x ) ((FT_Size)(x)) |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
919 /* Define default raster's interface. The default raster is located in */ | 949 /* Define default raster's interface. The default raster is located in */ |
920 /* `src/base/ftraster.c'. */ | 950 /* `src/base/ftraster.c'. */ |
921 /* */ | 951 /* */ |
922 /* Client applications can register new rasters through the */ | 952 /* Client applications can register new rasters through the */ |
923 /* FT_Set_Raster() API. */ | 953 /* FT_Set_Raster() API. */ |
924 | 954 |
925 #ifndef FT_NO_DEFAULT_RASTER | 955 #ifndef FT_NO_DEFAULT_RASTER |
926 FT_EXPORT_VAR( FT_Raster_Funcs ) ft_default_raster; | 956 FT_EXPORT_VAR( FT_Raster_Funcs ) ft_default_raster; |
927 #endif | 957 #endif |
928 | 958 |
| 959 |
929 /*************************************************************************/ | 960 /*************************************************************************/ |
930 /*************************************************************************/ | 961 /*************************************************************************/ |
931 /*************************************************************************/ | 962 /*************************************************************************/ |
932 /**** ****/ | 963 /**** ****/ |
933 /**** ****/ | 964 /**** ****/ |
934 /**** PIC-Support Macros for ftimage.h ****/ | 965 /**** P I C S U P P O R T ****/ |
935 /**** ****/ | 966 /**** ****/ |
936 /**** ****/ | 967 /**** ****/ |
937 /*************************************************************************/ | 968 /*************************************************************************/ |
938 /*************************************************************************/ | 969 /*************************************************************************/ |
939 /*************************************************************************/ | 970 /*************************************************************************/ |
940 | 971 |
941 | 972 |
| 973 /* PIC support macros for ftimage.h */ |
| 974 |
| 975 |
942 /*************************************************************************/ | 976 /*************************************************************************/ |
943 /* */ | 977 /* */ |
944 /* <Macro> */ | 978 /* <Macro> */ |
945 /* FT_DEFINE_OUTLINE_FUNCS */ | 979 /* FT_DEFINE_OUTLINE_FUNCS */ |
946 /* */ | 980 /* */ |
947 /* <Description> */ | 981 /* <Description> */ |
948 /* Used to initialize an instance of FT_Outline_Funcs struct. */ | 982 /* Used to initialize an instance of FT_Outline_Funcs struct. */ |
949 /* When FT_CONFIG_OPTION_PIC is defined an init funtion will need to */ | 983 /* When FT_CONFIG_OPTION_PIC is defined an init funtion will need to */ |
950 /* called with a pre-allocated stracture to be filled. */ | 984 /* be called with a pre-allocated structure to be filled. */ |
951 /* When FT_CONFIG_OPTION_PIC is not defined the struct will be */ | 985 /* When FT_CONFIG_OPTION_PIC is not defined the struct will be */ |
952 /* allocated in the global scope (or the scope where the macro */ | 986 /* allocated in the global scope (or the scope where the macro */ |
953 /* is used). */ | 987 /* is used). */ |
954 /* */ | 988 /* */ |
955 #ifndef FT_CONFIG_OPTION_PIC | 989 #ifndef FT_CONFIG_OPTION_PIC |
956 | 990 |
957 #define FT_DEFINE_OUTLINE_FUNCS(class_, move_to_, line_to_, conic_to_, \ | 991 #define FT_DEFINE_OUTLINE_FUNCS( \ |
958 cubic_to_, shift_, delta_) \ | 992 class_, \ |
959 static const FT_Outline_Funcs class_ = \ | 993 move_to_, \ |
960 { \ | 994 line_to_, \ |
961 move_to_, line_to_, conic_to_, cubic_to_, shift_, delta_ \ | 995 conic_to_, \ |
| 996 cubic_to_, \ |
| 997 shift_, \ |
| 998 delta_ ) \ |
| 999 static const FT_Outline_Funcs class_ = \ |
| 1000 { \ |
| 1001 move_to_, \ |
| 1002 line_to_, \ |
| 1003 conic_to_, \ |
| 1004 cubic_to_, \ |
| 1005 shift_, \ |
| 1006 delta_ \ |
962 }; | 1007 }; |
963 | 1008 |
964 #else /* FT_CONFIG_OPTION_PIC */ | 1009 #else /* FT_CONFIG_OPTION_PIC */ |
965 | 1010 |
966 #define FT_DEFINE_OUTLINE_FUNCS(class_, move_to_, line_to_, conic_to_, \ | 1011 #define FT_DEFINE_OUTLINE_FUNCS( \ |
967 cubic_to_, shift_, delta_) \ | 1012 class_, \ |
968 static FT_Error \ | 1013 move_to_, \ |
969 Init_Class_##class_( FT_Outline_Funcs* clazz ) \ | 1014 line_to_, \ |
970 { \ | 1015 conic_to_, \ |
971 clazz->move_to = move_to_; \ | 1016 cubic_to_, \ |
972 clazz->line_to = line_to_; \ | 1017 shift_, \ |
973 clazz->conic_to = conic_to_; \ | 1018 delta_ ) \ |
974 clazz->cubic_to = cubic_to_; \ | 1019 static FT_Error \ |
975 clazz->shift = shift_; \ | 1020 Init_Class_ ## class_( FT_Outline_Funcs* clazz ) \ |
976 clazz->delta = delta_; \ | 1021 { \ |
977 return FT_Err_Ok; \ | 1022 clazz->move_to = move_to_; \ |
| 1023 clazz->line_to = line_to_; \ |
| 1024 clazz->conic_to = conic_to_; \ |
| 1025 clazz->cubic_to = cubic_to_; \ |
| 1026 clazz->shift = shift_; \ |
| 1027 clazz->delta = delta_; \ |
| 1028 \ |
| 1029 return FT_Err_Ok; \ |
978 } | 1030 } |
979 | 1031 |
980 #endif /* FT_CONFIG_OPTION_PIC */ | 1032 #endif /* FT_CONFIG_OPTION_PIC */ |
981 | 1033 |
| 1034 |
982 /*************************************************************************/ | 1035 /*************************************************************************/ |
983 /* */ | 1036 /* */ |
984 /* <Macro> */ | 1037 /* <Macro> */ |
985 /* FT_DEFINE_RASTER_FUNCS */ | 1038 /* FT_DEFINE_RASTER_FUNCS */ |
986 /* */ | 1039 /* */ |
987 /* <Description> */ | 1040 /* <Description> */ |
988 /* Used to initialize an instance of FT_Raster_Funcs struct. */ | 1041 /* Used to initialize an instance of FT_Raster_Funcs struct. */ |
989 /* When FT_CONFIG_OPTION_PIC is defined an init funtion will need to */ | 1042 /* When FT_CONFIG_OPTION_PIC is defined an init funtion will need to */ |
990 /* called with a pre-allocated stracture to be filled. */ | 1043 /* be called with a pre-allocated structure to be filled. */ |
991 /* When FT_CONFIG_OPTION_PIC is not defined the struct will be */ | 1044 /* When FT_CONFIG_OPTION_PIC is not defined the struct will be */ |
992 /* allocated in the global scope (or the scope where the macro */ | 1045 /* allocated in the global scope (or the scope where the macro */ |
993 /* is used). */ | 1046 /* is used). */ |
994 /* */ | 1047 /* */ |
995 #ifndef FT_CONFIG_OPTION_PIC | 1048 #ifndef FT_CONFIG_OPTION_PIC |
996 | 1049 |
997 #define FT_DEFINE_RASTER_FUNCS(class_, glyph_format_, raster_new_, \ | 1050 #define FT_DEFINE_RASTER_FUNCS( \ |
998 raster_reset_, raster_set_mode_, \ | 1051 class_, \ |
999 raster_render_, raster_done_) \ | 1052 glyph_format_, \ |
1000 const FT_Raster_Funcs class_ = \ | 1053 raster_new_, \ |
1001 { \ | 1054 raster_reset_, \ |
1002 glyph_format_, raster_new_, raster_reset_, \ | 1055 raster_set_mode_, \ |
1003 raster_set_mode_, raster_render_, raster_done_ \ | 1056 raster_render_, \ |
| 1057 raster_done_ ) \ |
| 1058 const FT_Raster_Funcs class_ = \ |
| 1059 { \ |
| 1060 glyph_format_, \ |
| 1061 raster_new_, \ |
| 1062 raster_reset_, \ |
| 1063 raster_set_mode_, \ |
| 1064 raster_render_, \ |
| 1065 raster_done_ \ |
1004 }; | 1066 }; |
1005 | 1067 |
1006 #else /* FT_CONFIG_OPTION_PIC */ | 1068 #else /* FT_CONFIG_OPTION_PIC */ |
1007 | 1069 |
1008 #define FT_DEFINE_RASTER_FUNCS(class_, glyph_format_, raster_new_, \ | 1070 #define FT_DEFINE_RASTER_FUNCS( \ |
1009 raster_reset_, raster_set_mode_, raster_render_, raster_done_) \ | 1071 class_, \ |
1010 void \ | 1072 glyph_format_, \ |
1011 FT_Init_Class_##class_( FT_Raster_Funcs* clazz ) \ | 1073 raster_new_, \ |
1012 { \ | 1074 raster_reset_, \ |
1013 clazz->glyph_format = glyph_format_; \ | 1075 raster_set_mode_, \ |
1014 clazz->raster_new = raster_new_; \ | 1076 raster_render_, \ |
1015 clazz->raster_reset = raster_reset_; \ | 1077 raster_done_ ) \ |
1016 clazz->raster_set_mode = raster_set_mode_; \ | 1078 void \ |
1017 clazz->raster_render = raster_render_; \ | 1079 FT_Init_Class_ ## class_( FT_Raster_Funcs* clazz ) \ |
1018 clazz->raster_done = raster_done_; \ | 1080 { \ |
| 1081 clazz->glyph_format = glyph_format_; \ |
| 1082 clazz->raster_new = raster_new_; \ |
| 1083 clazz->raster_reset = raster_reset_; \ |
| 1084 clazz->raster_set_mode = raster_set_mode_; \ |
| 1085 clazz->raster_render = raster_render_; \ |
| 1086 clazz->raster_done = raster_done_; \ |
1019 } | 1087 } |
1020 | 1088 |
1021 #endif /* FT_CONFIG_OPTION_PIC */ | 1089 #endif /* FT_CONFIG_OPTION_PIC */ |
1022 | 1090 |
1023 /*************************************************************************/ | |
1024 /*************************************************************************/ | |
1025 /*************************************************************************/ | |
1026 /**** ****/ | |
1027 /**** ****/ | |
1028 /**** PIC-Support Macros for ftrender.h ****/ | |
1029 /**** ****/ | |
1030 /**** ****/ | |
1031 /*************************************************************************/ | |
1032 /*************************************************************************/ | |
1033 /*************************************************************************/ | |
1034 | 1091 |
| 1092 /* PIC support macros for ftrender.h */ |
1035 | 1093 |
1036 | 1094 |
1037 /*************************************************************************/ | 1095 /*************************************************************************/ |
1038 /* */ | 1096 /* */ |
1039 /* <Macro> */ | 1097 /* <Macro> */ |
1040 /* FT_DEFINE_GLYPH */ | 1098 /* FT_DEFINE_GLYPH */ |
1041 /* */ | 1099 /* */ |
1042 /* <Description> */ | 1100 /* <Description> */ |
1043 /* Used to initialize an instance of FT_Glyph_Class struct. */ | 1101 /* Used to initialize an instance of FT_Glyph_Class struct. */ |
1044 /* When FT_CONFIG_OPTION_PIC is defined an init funtion will need to */ | 1102 /* When FT_CONFIG_OPTION_PIC is defined an init funtion will need to */ |
1045 /* called with a pre-allocated stracture to be filled. */ | 1103 /* be called with a pre-allocated stcture to be filled. */ |
1046 /* When FT_CONFIG_OPTION_PIC is not defined the struct will be */ | 1104 /* When FT_CONFIG_OPTION_PIC is not defined the struct will be */ |
1047 /* allocated in the global scope (or the scope where the macro */ | 1105 /* allocated in the global scope (or the scope where the macro */ |
1048 /* is used). */ | 1106 /* is used). */ |
1049 /* */ | 1107 /* */ |
1050 #ifndef FT_CONFIG_OPTION_PIC | 1108 #ifndef FT_CONFIG_OPTION_PIC |
1051 | 1109 |
1052 #define FT_DEFINE_GLYPH(class_, size_, format_, init_, done_, copy_, \ | 1110 #define FT_DEFINE_GLYPH( \ |
1053 transform_, bbox_, prepare_) \ | 1111 class_, \ |
1054 FT_CALLBACK_TABLE_DEF \ | 1112 size_, \ |
1055 const FT_Glyph_Class class_ = \ | 1113 format_, \ |
1056 { \ | 1114 init_, \ |
1057 size_, format_, init_, done_, copy_, transform_, bbox_, prepare_ \ | 1115 done_, \ |
| 1116 copy_, \ |
| 1117 transform_, \ |
| 1118 bbox_, \ |
| 1119 prepare_ ) \ |
| 1120 FT_CALLBACK_TABLE_DEF \ |
| 1121 const FT_Glyph_Class class_ = \ |
| 1122 { \ |
| 1123 size_, \ |
| 1124 format_, \ |
| 1125 init_, \ |
| 1126 done_, \ |
| 1127 copy_, \ |
| 1128 transform_, \ |
| 1129 bbox_, \ |
| 1130 prepare_ \ |
1058 }; | 1131 }; |
1059 | 1132 |
1060 #else /* FT_CONFIG_OPTION_PIC */ | 1133 #else /* FT_CONFIG_OPTION_PIC */ |
1061 | 1134 |
1062 #define FT_DEFINE_GLYPH(class_, size_, format_, init_, done_, copy_, \ | 1135 #define FT_DEFINE_GLYPH( \ |
1063 transform_, bbox_, prepare_) \ | 1136 class_, \ |
1064 void \ | 1137 size_, \ |
1065 FT_Init_Class_##class_( FT_Glyph_Class* clazz ) \ | 1138 format_, \ |
1066 { \ | 1139 init_, \ |
1067 clazz->glyph_size = size_; \ | 1140 done_, \ |
1068 clazz->glyph_format = format_; \ | 1141 copy_, \ |
1069 clazz->glyph_init = init_; \ | 1142 transform_, \ |
1070 clazz->glyph_done = done_; \ | 1143 bbox_, \ |
1071 clazz->glyph_copy = copy_; \ | 1144 prepare_ ) \ |
1072 clazz->glyph_transform = transform_; \ | 1145 void \ |
1073 clazz->glyph_bbox = bbox_; \ | 1146 FT_Init_Class_ ## class_( FT_Glyph_Class* clazz ) \ |
1074 clazz->glyph_prepare = prepare_; \ | 1147 { \ |
| 1148 clazz->glyph_size = size_; \ |
| 1149 clazz->glyph_format = format_; \ |
| 1150 clazz->glyph_init = init_; \ |
| 1151 clazz->glyph_done = done_; \ |
| 1152 clazz->glyph_copy = copy_; \ |
| 1153 clazz->glyph_transform = transform_; \ |
| 1154 clazz->glyph_bbox = bbox_; \ |
| 1155 clazz->glyph_prepare = prepare_; \ |
1075 } | 1156 } |
1076 | 1157 |
1077 #endif /* FT_CONFIG_OPTION_PIC */ | 1158 #endif /* FT_CONFIG_OPTION_PIC */ |
1078 | 1159 |
| 1160 |
1079 /*************************************************************************/ | 1161 /*************************************************************************/ |
1080 /* */ | 1162 /* */ |
1081 /* <Macro> */ | 1163 /* <Macro> */ |
1082 /* FT_DECLARE_RENDERER */ | 1164 /* FT_DECLARE_RENDERER */ |
1083 /* */ | 1165 /* */ |
1084 /* <Description> */ | 1166 /* <Description> */ |
1085 /* Used to create a forward declaration of a */ | 1167 /* Used to create a forward declaration of a */ |
1086 /* FT_Renderer_Class stract instance. */ | 1168 /* FT_Renderer_Class struct instance. */ |
1087 /* */ | 1169 /* */ |
1088 /* <Macro> */ | 1170 /* <Macro> */ |
1089 /* FT_DEFINE_RENDERER */ | 1171 /* FT_DEFINE_RENDERER */ |
1090 /* */ | 1172 /* */ |
1091 /* <Description> */ | 1173 /* <Description> */ |
1092 /* Used to initialize an instance of FT_Renderer_Class struct. */ | 1174 /* Used to initialize an instance of FT_Renderer_Class struct. */ |
1093 /* */ | 1175 /* */ |
1094 /* When FT_CONFIG_OPTION_PIC is defined a Create funtion will need */ | 1176 /* When FT_CONFIG_OPTION_PIC is defined a `create' funtion will need */ |
1095 /* to called with a pointer where the allocated stracture is returned.*/ | 1177 /* to be called with a pointer where the allocated structure is */ |
1096 /* And when it is no longer needed a Destroy function needs */ | 1178 /* returned. And when it is no longer needed a `destroy' function */ |
1097 /* to be called to release that allocation. */ | 1179 /* needs to be called to release that allocation. */ |
1098 /* fcinit.c (ft_create_default_module_classes) already contains */ | 1180 /* `fcinit.c' (ft_create_default_module_classes) already contains */ |
1099 /* a mechanism to call these functions for the default modules */ | 1181 /* a mechanism to call these functions for the default modules */ |
1100 /* described in ftmodule.h */ | 1182 /* described in `ftmodule.h'. */ |
1101 /* */ | 1183 /* */ |
1102 /* Notice that the created Create and Destroy functions call */ | 1184 /* Notice that the created `create' and `destroy' functions call */ |
1103 /* pic_init and pic_free function to allow you to manually allocate */ | 1185 /* `pic_init' and `pic_free' to allow you to manually allocate and */ |
1104 /* and initialize any additional global data, like module specific */ | 1186 /* initialize any additional global data, like a module specific */ |
1105 /* interface, and put them in the global pic container defined in */ | 1187 /* interface, and put them in the global pic container defined in */ |
1106 /* ftpic.h. if you don't need them just implement the functions as */ | 1188 /* `ftpic.h'. If you don't need them just implement the functions as */ |
1107 /* empty to resolve the link error. Also the pic_init and pic_free */ | 1189 /* empty to resolve the link error. Also the `pic_init' and */ |
1108 /* functions should be declared in pic.h, to be referred by renderer */ | 1190 /* `pic_free' functions should be declared in `pic.h', to be referred */ |
1109 /* definition calling FT_DEFINE_RENDERER() in following. */ | 1191 /* by the renderer definition calling `FT_DEFINE_RENDERER' in the */ |
| 1192 /* following. */ |
1110 /* */ | 1193 /* */ |
1111 /* When FT_CONFIG_OPTION_PIC is not defined the struct will be */ | 1194 /* When FT_CONFIG_OPTION_PIC is not defined the struct will be */ |
1112 /* allocated in the global scope (or the scope where the macro */ | 1195 /* allocated in the global scope (or the scope where the macro */ |
1113 /* is used). */ | 1196 /* is used). */ |
1114 /* */ | 1197 /* */ |
1115 #ifndef FT_CONFIG_OPTION_PIC | 1198 #ifndef FT_CONFIG_OPTION_PIC |
1116 | 1199 |
1117 #define FT_DECLARE_RENDERER(class_) \ | 1200 #define FT_DECLARE_RENDERER( class_ ) \ |
1118 FT_EXPORT_VAR( const FT_Renderer_Class ) class_; | 1201 FT_EXPORT_VAR( const FT_Renderer_Class ) class_; |
1119 | 1202 |
1120 #define FT_DEFINE_RENDERER(class_, \ | 1203 #define FT_DEFINE_RENDERER( \ |
1121 flags_, size_, name_, version_, requires_, \ | 1204 class_, \ |
1122 interface_, init_, done_, get_interface_, \ | 1205 flags_, \ |
1123 glyph_format_, render_glyph_, transform_glyph_, \ | 1206 size_, \ |
1124 get_glyph_cbox_, set_mode_, raster_class_ ) \ | 1207 name_, \ |
1125 FT_CALLBACK_TABLE_DEF \ | 1208 version_, \ |
1126 const FT_Renderer_Class class_ = \ | 1209 requires_, \ |
1127 { \ | 1210 interface_, \ |
1128 FT_DEFINE_ROOT_MODULE(flags_,size_,name_,version_,requires_, \ | 1211 init_, \ |
1129 interface_,init_,done_,get_interface_) \ | 1212 done_, \ |
1130 glyph_format_, \ | 1213 get_interface_, \ |
1131 \ | 1214 glyph_format_, \ |
1132 render_glyph_, \ | 1215 render_glyph_, \ |
1133 transform_glyph_, \ | 1216 transform_glyph_, \ |
1134 get_glyph_cbox_, \ | 1217 get_glyph_cbox_, \ |
1135 set_mode_, \ | 1218 set_mode_, \ |
1136 \ | 1219 raster_class_ ) \ |
1137 raster_class_ \ | 1220 FT_CALLBACK_TABLE_DEF \ |
| 1221 const FT_Renderer_Class class_ = \ |
| 1222 { \ |
| 1223 FT_DEFINE_ROOT_MODULE( flags_, \ |
| 1224 size_, \ |
| 1225 name_, \ |
| 1226 version_, \ |
| 1227 requires_, \ |
| 1228 interface_, \ |
| 1229 init_, \ |
| 1230 done_, \ |
| 1231 get_interface_ ) \ |
| 1232 glyph_format_, \ |
| 1233 \ |
| 1234 render_glyph_, \ |
| 1235 transform_glyph_, \ |
| 1236 get_glyph_cbox_, \ |
| 1237 set_mode_, \ |
| 1238 \ |
| 1239 raster_class_ \ |
1138 }; | 1240 }; |
1139 | 1241 |
1140 #else /* FT_CONFIG_OPTION_PIC */ | 1242 #else /* FT_CONFIG_OPTION_PIC */ |
1141 | 1243 |
1142 #define FT_DECLARE_RENDERER(class_) FT_DECLARE_MODULE(class_) | 1244 #define FT_DECLARE_RENDERER( class_ ) FT_DECLARE_MODULE( class_ ) |
1143 | 1245 |
1144 #define FT_DEFINE_RENDERER(class_, \ | 1246 #define FT_DEFINE_RENDERER( \ |
1145 flags_, size_, name_, version_, requires_, \ | 1247 class_, \ |
1146 interface_, init_, done_, get_interface_, \ | 1248 flags_, \ |
1147 glyph_format_, render_glyph_, transform_glyph_, \ | 1249 size_, \ |
1148 get_glyph_cbox_, set_mode_, raster_class_ ) \ | 1250 name_, \ |
1149 \ | 1251 version_, \ |
1150 void \ | 1252 requires_, \ |
1151 FT_Destroy_Class_##class_( FT_Library library, \ | 1253 interface_, \ |
1152 FT_Module_Class* clazz ) \ | 1254 init_, \ |
1153 { \ | 1255 done_, \ |
1154 FT_Renderer_Class* rclazz = (FT_Renderer_Class*)clazz; \ | 1256 get_interface_, \ |
1155 FT_Memory memory = library->memory; \ | 1257 glyph_format_, \ |
1156 class_##_pic_free( library ); \ | 1258 render_glyph_, \ |
1157 if ( rclazz ) \ | 1259 transform_glyph_, \ |
1158 FT_FREE( rclazz ); \ | 1260 get_glyph_cbox_, \ |
1159 } \ | 1261 set_mode_, \ |
1160 \ | 1262 raster_class_ ) \ |
1161 FT_Error \ | 1263 void \ |
1162 FT_Create_Class_##class_( FT_Library library, \ | 1264 FT_Destroy_Class_ ## class_( FT_Library library, \ |
1163 FT_Module_Class** output_class ) \ | 1265 FT_Module_Class* clazz ) \ |
1164 { \ | 1266 { \ |
1165 FT_Renderer_Class* clazz; \ | 1267 FT_Renderer_Class* rclazz = (FT_Renderer_Class*)clazz; \ |
1166 FT_Error error; \ | 1268 FT_Memory memory = library->memory; \ |
1167 FT_Memory memory = library->memory; \ | 1269 \ |
1168 \ | 1270 \ |
1169 if ( FT_ALLOC( clazz, sizeof(*clazz) ) ) \ | 1271 class_ ## _pic_free( library ); \ |
1170 return error; \ | 1272 if ( rclazz ) \ |
1171 \ | 1273 FT_FREE( rclazz ); \ |
1172 error = class_##_pic_init( library ); \ | 1274 } \ |
1173 if(error) \ | 1275 \ |
1174 { \ | 1276 \ |
1175 FT_FREE( clazz ); \ | 1277 FT_Error \ |
1176 return error; \ | 1278 FT_Create_Class_ ## class_( FT_Library library, \ |
1177 } \ | 1279 FT_Module_Class** output_class ) \ |
1178 \ | 1280 { \ |
1179 FT_DEFINE_ROOT_MODULE(flags_,size_,name_,version_,requires_, \ | 1281 FT_Renderer_Class* clazz = NULL; \ |
1180 interface_,init_,done_,get_interface_) \ | 1282 FT_Error error; \ |
1181 \ | 1283 FT_Memory memory = library->memory; \ |
1182 clazz->glyph_format = glyph_format_; \ | 1284 \ |
1183 \ | 1285 \ |
1184 clazz->render_glyph = render_glyph_; \ | 1286 if ( FT_ALLOC( clazz, sizeof ( *clazz ) ) ) \ |
1185 clazz->transform_glyph = transform_glyph_; \ | 1287 return error; \ |
1186 clazz->get_glyph_cbox = get_glyph_cbox_; \ | 1288 \ |
1187 clazz->set_mode = set_mode_; \ | 1289 error = class_ ## _pic_init( library ); \ |
1188 \ | 1290 if ( error ) \ |
1189 clazz->raster_class = raster_class_; \ | 1291 { \ |
1190 \ | 1292 FT_FREE( clazz ); \ |
1191 *output_class = (FT_Module_Class*)clazz; \ | 1293 return error; \ |
1192 return FT_Err_Ok; \ | 1294 } \ |
| 1295 \ |
| 1296 FT_DEFINE_ROOT_MODULE( flags_, \ |
| 1297 size_, \ |
| 1298 name_, \ |
| 1299 version_, \ |
| 1300 requires_, \ |
| 1301 interface_, \ |
| 1302 init_, \ |
| 1303 done_, \ |
| 1304 get_interface_ ) \ |
| 1305 \ |
| 1306 clazz->glyph_format = glyph_format_; \ |
| 1307 \ |
| 1308 clazz->render_glyph = render_glyph_; \ |
| 1309 clazz->transform_glyph = transform_glyph_; \ |
| 1310 clazz->get_glyph_cbox = get_glyph_cbox_; \ |
| 1311 clazz->set_mode = set_mode_; \ |
| 1312 \ |
| 1313 clazz->raster_class = raster_class_; \ |
| 1314 \ |
| 1315 *output_class = (FT_Module_Class*)clazz; \ |
| 1316 \ |
| 1317 return FT_Err_Ok; \ |
1193 } | 1318 } |
1194 | 1319 |
1195 | |
1196 | |
1197 #endif /* FT_CONFIG_OPTION_PIC */ | 1320 #endif /* FT_CONFIG_OPTION_PIC */ |
1198 | 1321 |
1199 /*************************************************************************/ | 1322 |
1200 /*************************************************************************/ | 1323 /* PIC support macros for ftmodapi.h **/ |
1201 /*************************************************************************/ | |
1202 /**** ****/ | |
1203 /**** ****/ | |
1204 /**** PIC-Support Macros for ftmodapi.h ****/ | |
1205 /**** ****/ | |
1206 /**** ****/ | |
1207 /*************************************************************************/ | |
1208 /*************************************************************************/ | |
1209 /*************************************************************************/ | |
1210 | 1324 |
1211 | 1325 |
1212 #ifdef FT_CONFIG_OPTION_PIC | 1326 #ifdef FT_CONFIG_OPTION_PIC |
1213 | 1327 |
1214 /*************************************************************************/ | 1328 /*************************************************************************/ |
1215 /* */ | 1329 /* */ |
1216 /* <FuncType> */ | 1330 /* <FuncType> */ |
1217 /* FT_Module_Creator */ | 1331 /* FT_Module_Creator */ |
1218 /* */ | 1332 /* */ |
1219 /* <Description> */ | 1333 /* <Description> */ |
(...skipping 20 matching lines...) Expand all Loading... |
1240 /* <Input> */ | 1354 /* <Input> */ |
1241 /* memory :: A handle to the memory manager. */ | 1355 /* memory :: A handle to the memory manager. */ |
1242 /* clazz :: Module class to destroy. */ | 1356 /* clazz :: Module class to destroy. */ |
1243 /* */ | 1357 /* */ |
1244 typedef void | 1358 typedef void |
1245 (*FT_Module_Destroyer)( FT_Memory memory, | 1359 (*FT_Module_Destroyer)( FT_Memory memory, |
1246 FT_Module_Class* clazz ); | 1360 FT_Module_Class* clazz ); |
1247 | 1361 |
1248 #endif | 1362 #endif |
1249 | 1363 |
| 1364 |
1250 /*************************************************************************/ | 1365 /*************************************************************************/ |
1251 /* */ | 1366 /* */ |
1252 /* <Macro> */ | 1367 /* <Macro> */ |
1253 /* FT_DECLARE_MODULE */ | 1368 /* FT_DECLARE_MODULE */ |
1254 /* */ | 1369 /* */ |
1255 /* <Description> */ | 1370 /* <Description> */ |
1256 /* Used to create a forward declaration of a */ | 1371 /* Used to create a forward declaration of a */ |
1257 /* FT_Module_Class stract instance. */ | 1372 /* FT_Module_Class struct instance. */ |
1258 /* */ | 1373 /* */ |
1259 /* <Macro> */ | 1374 /* <Macro> */ |
1260 /* FT_DEFINE_MODULE */ | 1375 /* FT_DEFINE_MODULE */ |
1261 /* */ | 1376 /* */ |
1262 /* <Description> */ | 1377 /* <Description> */ |
1263 /* Used to initialize an instance of FT_Module_Class struct. */ | 1378 /* Used to initialize an instance of an FT_Module_Class struct. */ |
1264 /* */ | 1379 /* */ |
1265 /* When FT_CONFIG_OPTION_PIC is defined a Create funtion will need */ | 1380 /* When FT_CONFIG_OPTION_PIC is defined a `create' funtion needs to */ |
1266 /* to called with a pointer where the allocated stracture is returned.*/ | 1381 /* be called with a pointer where the allocated structure is */ |
1267 /* And when it is no longer needed a Destroy function needs */ | 1382 /* returned. And when it is no longer needed a `destroy' function */ |
1268 /* to be called to release that allocation. */ | 1383 /* needs to be called to release that allocation. */ |
1269 /* fcinit.c (ft_create_default_module_classes) already contains */ | 1384 /* `fcinit.c' (ft_create_default_module_classes) already contains */ |
1270 /* a mechanism to call these functions for the default modules */ | 1385 /* a mechanism to call these functions for the default modules */ |
1271 /* described in ftmodule.h */ | 1386 /* described in `ftmodule.h'. */ |
1272 /* */ | 1387 /* */ |
1273 /* Notice that the created Create and Destroy functions call */ | 1388 /* Notice that the created `create' and `destroy' functions call */ |
1274 /* pic_init and pic_free function to allow you to manually allocate */ | 1389 /* `pic_init' and `pic_free' to allow you to manually allocate and */ |
1275 /* and initialize any additional global data, like module specific */ | 1390 /* initialize any additional global data, like a module specific */ |
1276 /* interface, and put them in the global pic container defined in */ | 1391 /* interface, and put them in the global pic container defined in */ |
1277 /* ftpic.h. if you don't need them just implement the functions as */ | 1392 /* `ftpic.h'. If you don't need them just implement the functions as */ |
1278 /* empty to resolve the link error. Also the pic_init and pic_free */ | 1393 /* empty to resolve the link error. Also the `pic_init' and */ |
1279 /* functions should be declared in pic.h, to be referred by module */ | 1394 /* `pic_free' functions should be declared in `pic.h', to be referred */ |
1280 /* definition calling FT_DEFINE_MODULE() in following. */ | 1395 /* by the module definition calling `FT_DEFINE_MODULE' in the */ |
| 1396 /* following. */ |
1281 /* */ | 1397 /* */ |
1282 /* When FT_CONFIG_OPTION_PIC is not defined the struct will be */ | 1398 /* When FT_CONFIG_OPTION_PIC is not defined the struct will be */ |
1283 /* allocated in the global scope (or the scope where the macro */ | 1399 /* allocated in the global scope (or the scope where the macro */ |
1284 /* is used). */ | 1400 /* is used). */ |
1285 /* */ | 1401 /* */ |
1286 /* <Macro> */ | 1402 /* <Macro> */ |
1287 /* FT_DEFINE_ROOT_MODULE */ | 1403 /* FT_DEFINE_ROOT_MODULE */ |
1288 /* */ | 1404 /* */ |
1289 /* <Description> */ | 1405 /* <Description> */ |
1290 /* Used to initialize an instance of FT_Module_Class struct inside */ | 1406 /* Used to initialize an instance of an FT_Module_Class struct inside */ |
1291 /* another stract that contains it or in a function that initializes */ | 1407 /* another struct that contains it or in a function that initializes */ |
1292 /* that containing stract */ | 1408 /* that containing struct. */ |
1293 /* */ | 1409 /* */ |
1294 #ifndef FT_CONFIG_OPTION_PIC | 1410 #ifndef FT_CONFIG_OPTION_PIC |
1295 | 1411 |
1296 #define FT_DECLARE_MODULE(class_) \ | 1412 #define FT_DECLARE_MODULE( class_ ) \ |
1297 FT_CALLBACK_TABLE \ | 1413 FT_CALLBACK_TABLE \ |
1298 const FT_Module_Class class_; \ | 1414 const FT_Module_Class class_; |
1299 | 1415 |
1300 #define FT_DEFINE_ROOT_MODULE(flags_, size_, name_, version_, requires_, \ | 1416 #define FT_DEFINE_ROOT_MODULE( \ |
1301 interface_, init_, done_, get_interface_) \ | 1417 flags_, \ |
1302 { \ | 1418 size_, \ |
1303 flags_, \ | 1419 name_, \ |
1304 size_, \ | 1420 version_, \ |
1305 \ | 1421 requires_, \ |
1306 name_, \ | 1422 interface_, \ |
1307 version_, \ | 1423 init_, \ |
1308 requires_, \ | 1424 done_, \ |
1309 \ | 1425 get_interface_ ) \ |
1310 interface_, \ | 1426 { \ |
1311 \ | 1427 flags_, \ |
1312 init_, \ | 1428 size_, \ |
1313 done_, \ | 1429 \ |
1314 get_interface_, \ | 1430 name_, \ |
| 1431 version_, \ |
| 1432 requires_, \ |
| 1433 \ |
| 1434 interface_, \ |
| 1435 \ |
| 1436 init_, \ |
| 1437 done_, \ |
| 1438 get_interface_, \ |
1315 }, | 1439 }, |
1316 | 1440 |
1317 #define FT_DEFINE_MODULE(class_, flags_, size_, name_, version_, requires_, \ | 1441 #define FT_DEFINE_MODULE( \ |
1318 interface_, init_, done_, get_interface_) \ | 1442 class_, \ |
1319 FT_CALLBACK_TABLE_DEF \ | 1443 flags_, \ |
1320 const FT_Module_Class class_ = \ | 1444 size_, \ |
1321 { \ | 1445 name_, \ |
1322 flags_, \ | 1446 version_, \ |
1323 size_, \ | 1447 requires_, \ |
1324 \ | 1448 interface_, \ |
1325 name_, \ | 1449 init_, \ |
1326 version_, \ | 1450 done_, \ |
1327 requires_, \ | 1451 get_interface_ ) \ |
1328 \ | 1452 FT_CALLBACK_TABLE_DEF \ |
1329 interface_, \ | 1453 const FT_Module_Class class_ = \ |
1330 \ | 1454 { \ |
1331 init_, \ | 1455 flags_, \ |
1332 done_, \ | 1456 size_, \ |
1333 get_interface_, \ | 1457 \ |
| 1458 name_, \ |
| 1459 version_, \ |
| 1460 requires_, \ |
| 1461 \ |
| 1462 interface_, \ |
| 1463 \ |
| 1464 init_, \ |
| 1465 done_, \ |
| 1466 get_interface_, \ |
1334 }; | 1467 }; |
1335 | 1468 |
1336 | 1469 |
1337 #else /* FT_CONFIG_OPTION_PIC */ | 1470 #else /* FT_CONFIG_OPTION_PIC */ |
1338 | 1471 |
1339 #define FT_DECLARE_MODULE(class_) \ | 1472 #define FT_DECLARE_MODULE( class_ ) \ |
1340 FT_Error FT_Create_Class_##class_( FT_Library library, \ | 1473 FT_Error \ |
1341 FT_Module_Class** output_class ); \ | 1474 FT_Create_Class_ ## class_( FT_Library library, \ |
1342 void FT_Destroy_Class_##class_( FT_Library library, \ | 1475 FT_Module_Class** output_class ); \ |
1343 FT_Module_Class* clazz ); | 1476 void \ |
| 1477 FT_Destroy_Class_ ## class_( FT_Library library, \ |
| 1478 FT_Module_Class* clazz ); |
1344 | 1479 |
1345 #define FT_DEFINE_ROOT_MODULE(flags_, size_, name_, version_, requires_, \ | 1480 #define FT_DEFINE_ROOT_MODULE( \ |
1346 interface_, init_, done_, get_interface_) \ | 1481 flags_, \ |
1347 clazz->root.module_flags = flags_; \ | 1482 size_, \ |
1348 clazz->root.module_size = size_; \ | 1483 name_, \ |
1349 clazz->root.module_name = name_; \ | 1484 version_, \ |
1350 clazz->root.module_version = version_; \ | 1485 requires_, \ |
1351 clazz->root.module_requires = requires_; \ | 1486 interface_, \ |
1352 \ | 1487 init_, \ |
1353 clazz->root.module_interface = interface_; \ | 1488 done_, \ |
1354 \ | 1489 get_interface_ ) \ |
1355 clazz->root.module_init = init_; \ | 1490 clazz->root.module_flags = flags_; \ |
1356 clazz->root.module_done = done_; \ | 1491 clazz->root.module_size = size_; \ |
1357 clazz->root.get_interface = get_interface_; | 1492 clazz->root.module_name = name_; \ |
| 1493 clazz->root.module_version = version_; \ |
| 1494 clazz->root.module_requires = requires_; \ |
| 1495 \ |
| 1496 clazz->root.module_interface = interface_; \ |
| 1497 \ |
| 1498 clazz->root.module_init = init_; \ |
| 1499 clazz->root.module_done = done_; \ |
| 1500 clazz->root.get_interface = get_interface_; |
1358 | 1501 |
1359 #define FT_DEFINE_MODULE(class_, flags_, size_, name_, version_, requires_, \ | 1502 #define FT_DEFINE_MODULE( \ |
1360 interface_, init_, done_, get_interface_) \ | 1503 class_, \ |
1361 \ | 1504 flags_, \ |
1362 void \ | 1505 size_, \ |
1363 FT_Destroy_Class_##class_( FT_Library library, \ | 1506 name_, \ |
1364 FT_Module_Class* clazz ) \ | 1507 version_, \ |
1365 { \ | 1508 requires_, \ |
1366 FT_Memory memory = library->memory; \ | 1509 interface_, \ |
1367 class_##_pic_free( library ); \ | 1510 init_, \ |
1368 if ( clazz ) \ | 1511 done_, \ |
1369 FT_FREE( clazz ); \ | 1512 get_interface_ ) \ |
1370 } \ | 1513 void \ |
1371 \ | 1514 FT_Destroy_Class_ ## class_( FT_Library library, \ |
1372 FT_Error \ | 1515 FT_Module_Class* clazz ) \ |
1373 FT_Create_Class_##class_( FT_Library library, \ | 1516 { \ |
1374 FT_Module_Class** output_class ) \ | 1517 FT_Memory memory = library->memory; \ |
1375 { \ | 1518 \ |
1376 FT_Memory memory = library->memory; \ | 1519 \ |
1377 FT_Module_Class* clazz; \ | 1520 class_ ## _pic_free( library ); \ |
1378 FT_Error error; \ | 1521 if ( clazz ) \ |
1379 \ | 1522 FT_FREE( clazz ); \ |
1380 if ( FT_ALLOC( clazz, sizeof(*clazz) ) ) \ | 1523 } \ |
1381 return error; \ | 1524 \ |
1382 error = class_##_pic_init( library ); \ | 1525 \ |
1383 if(error) \ | 1526 FT_Error \ |
1384 { \ | 1527 FT_Create_Class_ ## class_( FT_Library library, \ |
1385 FT_FREE( clazz ); \ | 1528 FT_Module_Class** output_class ) \ |
1386 return error; \ | 1529 { \ |
1387 } \ | 1530 FT_Memory memory = library->memory; \ |
1388 \ | 1531 FT_Module_Class* clazz = NULL; \ |
1389 clazz->module_flags = flags_; \ | 1532 FT_Error error; \ |
1390 clazz->module_size = size_; \ | 1533 \ |
1391 clazz->module_name = name_; \ | 1534 \ |
1392 clazz->module_version = version_; \ | 1535 if ( FT_ALLOC( clazz, sizeof ( *clazz ) ) ) \ |
1393 clazz->module_requires = requires_; \ | 1536 return error; \ |
1394 \ | 1537 error = class_ ## _pic_init( library ); \ |
1395 clazz->module_interface = interface_; \ | 1538 if ( error ) \ |
1396 \ | 1539 { \ |
1397 clazz->module_init = init_; \ | 1540 FT_FREE( clazz ); \ |
1398 clazz->module_done = done_; \ | 1541 return error; \ |
1399 clazz->get_interface = get_interface_; \ | 1542 } \ |
1400 \ | 1543 \ |
1401 *output_class = clazz; \ | 1544 clazz->module_flags = flags_; \ |
1402 return FT_Err_Ok; \ | 1545 clazz->module_size = size_; \ |
| 1546 clazz->module_name = name_; \ |
| 1547 clazz->module_version = version_; \ |
| 1548 clazz->module_requires = requires_; \ |
| 1549 \ |
| 1550 clazz->module_interface = interface_; \ |
| 1551 \ |
| 1552 clazz->module_init = init_; \ |
| 1553 clazz->module_done = done_; \ |
| 1554 clazz->get_interface = get_interface_; \ |
| 1555 \ |
| 1556 *output_class = clazz; \ |
| 1557 \ |
| 1558 return FT_Err_Ok; \ |
1403 } | 1559 } |
1404 | 1560 |
1405 #endif /* FT_CONFIG_OPTION_PIC */ | 1561 #endif /* FT_CONFIG_OPTION_PIC */ |
1406 | 1562 |
1407 | 1563 |
1408 FT_END_HEADER | 1564 FT_END_HEADER |
1409 | 1565 |
1410 #endif /* __FTOBJS_H__ */ | 1566 #endif /* __FTOBJS_H__ */ |
1411 | 1567 |
1412 | 1568 |
1413 /* END */ | 1569 /* END */ |
OLD | NEW |