summaryrefslogtreecommitdiffstats
path: root/include/freetype/internal/ftobjs.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/freetype/internal/ftobjs.h')
-rw-r--r--include/freetype/internal/ftobjs.h810
1 files changed, 483 insertions, 327 deletions
diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h
index fc18275..8a309b8 100644
--- a/include/freetype/internal/ftobjs.h
+++ b/include/freetype/internal/ftobjs.h
@@ -4,7 +4,7 @@
/* */
/* The FreeType private base classes (specification). */
/* */
-/* Copyright 1996-2006, 2008, 2010, 2012 by */
+/* Copyright 1996-2006, 2008, 2010, 2012-2013 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -206,46 +206,79 @@ FT_BEGIN_HEADER
} FT_CMap_ClassRec;
+
#ifndef FT_CONFIG_OPTION_PIC
-#define FT_DECLARE_CMAP_CLASS(class_) \
- FT_CALLBACK_TABLE const FT_CMap_ClassRec class_;
-
-#define FT_DEFINE_CMAP_CLASS(class_, size_, init_, done_, char_index_, \
- char_next_, char_var_index_, char_var_default_, variant_list_, \
- charvariant_list_, variantchar_list_) \
- FT_CALLBACK_TABLE_DEF \
- const FT_CMap_ClassRec class_ = \
- { \
- size_, init_, done_, char_index_, char_next_, char_var_index_, \
- char_var_default_, variant_list_, charvariant_list_, variantchar_list_ \
+#define FT_DECLARE_CMAP_CLASS( class_ ) \
+ FT_CALLBACK_TABLE const FT_CMap_ClassRec class_;
+
+#define FT_DEFINE_CMAP_CLASS( \
+ class_, \
+ size_, \
+ init_, \
+ done_, \
+ char_index_, \
+ char_next_, \
+ char_var_index_, \
+ char_var_default_, \
+ variant_list_, \
+ charvariant_list_, \
+ variantchar_list_ ) \
+ FT_CALLBACK_TABLE_DEF \
+ const FT_CMap_ClassRec class_ = \
+ { \
+ size_, \
+ init_, \
+ done_, \
+ char_index_, \
+ char_next_, \
+ char_var_index_, \
+ char_var_default_, \
+ variant_list_, \
+ charvariant_list_, \
+ variantchar_list_ \
};
+
#else /* FT_CONFIG_OPTION_PIC */
-#define FT_DECLARE_CMAP_CLASS(class_) \
- void FT_Init_Class_##class_( FT_Library library, FT_CMap_ClassRec* clazz);
-
-#define FT_DEFINE_CMAP_CLASS(class_, size_, init_, done_, char_index_, \
- char_next_, char_var_index_, char_var_default_, variant_list_, \
- charvariant_list_, variantchar_list_) \
- void \
- FT_Init_Class_##class_( FT_Library library, \
- FT_CMap_ClassRec* clazz) \
- { \
- FT_UNUSED(library); \
- clazz->size = size_; \
- clazz->init = init_; \
- clazz->done = done_; \
- clazz->char_index = char_index_; \
- clazz->char_next = char_next_; \
- clazz->char_var_index = char_var_index_; \
- clazz->char_var_default = char_var_default_; \
- clazz->variant_list = variant_list_; \
- clazz->charvariant_list = charvariant_list_; \
- clazz->variantchar_list = variantchar_list_; \
+#define FT_DECLARE_CMAP_CLASS( class_ ) \
+ void \
+ FT_Init_Class_ ## class_( FT_Library library, \
+ FT_CMap_ClassRec* clazz );
+
+#define FT_DEFINE_CMAP_CLASS( \
+ class_, \
+ size_, \
+ init_, \
+ done_, \
+ char_index_, \
+ char_next_, \
+ char_var_index_, \
+ char_var_default_, \
+ variant_list_, \
+ charvariant_list_, \
+ variantchar_list_ ) \
+ void \
+ FT_Init_Class_ ## class_( FT_Library library, \
+ FT_CMap_ClassRec* clazz ) \
+ { \
+ FT_UNUSED( library ); \
+ \
+ clazz->size = size_; \
+ clazz->init = init_; \
+ clazz->done = done_; \
+ clazz->char_index = char_index_; \
+ clazz->char_next = char_next_; \
+ clazz->char_var_index = char_var_index_; \
+ clazz->char_var_default = char_var_default_; \
+ clazz->variant_list = variant_list_; \
+ clazz->charvariant_list = charvariant_list_; \
+ clazz->variantchar_list = variantchar_list_; \
}
+
#endif /* FT_CONFIG_OPTION_PIC */
+
/* create a new charmap and add it to charmap->face */
FT_BASE( FT_Error )
FT_CMap_New( FT_CMap_Class clazz,
@@ -270,13 +303,13 @@ FT_BEGIN_HEADER
/* */
/* <Fields> */
/* max_points :: */
- /* The maximal number of points used to store the vectorial outline */
+ /* The maximum number of points used to store the vectorial outline */
/* of any glyph in this face. If this value cannot be known in */
/* advance, or if the face isn't scalable, this should be set to 0. */
/* Only relevant for scalable formats. */
/* */
/* max_contours :: */
- /* The maximal number of contours used to store the vectorial */
+ /* The maximum number of contours used to store the vectorial */
/* outline of any glyph in this face. If this value cannot be */
/* known in advance, or if the face isn't scalable, this should be */
/* set to 0. Only relevant for scalable formats. */
@@ -319,10 +352,6 @@ FT_BEGIN_HEADER
/* */
typedef struct FT_Face_InternalRec_
{
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
- FT_UShort reserved1;
- FT_Short reserved2;
-#endif
FT_Matrix transform_matrix;
FT_Vector transform_delta;
FT_Int transform_flags;
@@ -411,6 +440,7 @@ FT_BEGIN_HEADER
/*************************************************************************/
/*************************************************************************/
+ /*************************************************************************/
/**** ****/
/**** ****/
/**** M O D U L E S ****/
@@ -503,7 +533,7 @@ FT_BEGIN_HEADER
ft_module_get_service( FT_Module module,
const char* service_id );
- /* */
+ /* */
/*************************************************************************/
@@ -511,7 +541,7 @@ FT_BEGIN_HEADER
/*************************************************************************/
/**** ****/
/**** ****/
- /**** FACE, SIZE & GLYPH SLOT OBJECTS ****/
+ /**** F A C E, S I Z E & G L Y P H S L O T O B J E C T S ****/
/**** ****/
/**** ****/
/*************************************************************************/
@@ -926,12 +956,13 @@ FT_BEGIN_HEADER
FT_EXPORT_VAR( FT_Raster_Funcs ) ft_default_raster;
#endif
+
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/**** ****/
/**** ****/
- /**** PIC-Support Macros for ftimage.h ****/
+ /**** P I C S U P P O R T ****/
/**** ****/
/**** ****/
/*************************************************************************/
@@ -939,6 +970,9 @@ FT_BEGIN_HEADER
/*************************************************************************/
+ /* PIC support macros for ftimage.h */
+
+
/*************************************************************************/
/* */
/* <Macro> */
@@ -947,38 +981,57 @@ FT_BEGIN_HEADER
/* <Description> */
/* Used to initialize an instance of FT_Outline_Funcs struct. */
/* When FT_CONFIG_OPTION_PIC is defined an init funtion will need to */
- /* called with a pre-allocated stracture to be filled. */
+ /* be called with a pre-allocated structure to be filled. */
/* When FT_CONFIG_OPTION_PIC is not defined the struct will be */
/* allocated in the global scope (or the scope where the macro */
/* is used). */
/* */
#ifndef FT_CONFIG_OPTION_PIC
-#define FT_DEFINE_OUTLINE_FUNCS(class_, move_to_, line_to_, conic_to_, \
- cubic_to_, shift_, delta_) \
- static const FT_Outline_Funcs class_ = \
- { \
- move_to_, line_to_, conic_to_, cubic_to_, shift_, delta_ \
+#define FT_DEFINE_OUTLINE_FUNCS( \
+ class_, \
+ move_to_, \
+ line_to_, \
+ conic_to_, \
+ cubic_to_, \
+ shift_, \
+ delta_ ) \
+ static const FT_Outline_Funcs class_ = \
+ { \
+ move_to_, \
+ line_to_, \
+ conic_to_, \
+ cubic_to_, \
+ shift_, \
+ delta_ \
};
#else /* FT_CONFIG_OPTION_PIC */
-#define FT_DEFINE_OUTLINE_FUNCS(class_, move_to_, line_to_, conic_to_, \
- cubic_to_, shift_, delta_) \
- static FT_Error \
- Init_Class_##class_( FT_Outline_Funcs* clazz ) \
- { \
- clazz->move_to = move_to_; \
- clazz->line_to = line_to_; \
- clazz->conic_to = conic_to_; \
- clazz->cubic_to = cubic_to_; \
- clazz->shift = shift_; \
- clazz->delta = delta_; \
- return FT_Err_Ok; \
+#define FT_DEFINE_OUTLINE_FUNCS( \
+ class_, \
+ move_to_, \
+ line_to_, \
+ conic_to_, \
+ cubic_to_, \
+ shift_, \
+ delta_ ) \
+ static FT_Error \
+ Init_Class_ ## class_( FT_Outline_Funcs* clazz ) \
+ { \
+ clazz->move_to = move_to_; \
+ clazz->line_to = line_to_; \
+ clazz->conic_to = conic_to_; \
+ clazz->cubic_to = cubic_to_; \
+ clazz->shift = shift_; \
+ clazz->delta = delta_; \
+ \
+ return FT_Err_Ok; \
}
#endif /* FT_CONFIG_OPTION_PIC */
+
/*************************************************************************/
/* */
/* <Macro> */
@@ -987,51 +1040,56 @@ FT_BEGIN_HEADER
/* <Description> */
/* Used to initialize an instance of FT_Raster_Funcs struct. */
/* When FT_CONFIG_OPTION_PIC is defined an init funtion will need to */
- /* called with a pre-allocated stracture to be filled. */
+ /* be called with a pre-allocated structure to be filled. */
/* When FT_CONFIG_OPTION_PIC is not defined the struct will be */
/* allocated in the global scope (or the scope where the macro */
/* is used). */
/* */
#ifndef FT_CONFIG_OPTION_PIC
-#define FT_DEFINE_RASTER_FUNCS(class_, glyph_format_, raster_new_, \
- raster_reset_, raster_set_mode_, \
- raster_render_, raster_done_) \
- const FT_Raster_Funcs class_ = \
- { \
- glyph_format_, raster_new_, raster_reset_, \
- raster_set_mode_, raster_render_, raster_done_ \
+#define FT_DEFINE_RASTER_FUNCS( \
+ class_, \
+ glyph_format_, \
+ raster_new_, \
+ raster_reset_, \
+ raster_set_mode_, \
+ raster_render_, \
+ raster_done_ ) \
+ const FT_Raster_Funcs class_ = \
+ { \
+ glyph_format_, \
+ raster_new_, \
+ raster_reset_, \
+ raster_set_mode_, \
+ raster_render_, \
+ raster_done_ \
};
#else /* FT_CONFIG_OPTION_PIC */
-#define FT_DEFINE_RASTER_FUNCS(class_, glyph_format_, raster_new_, \
- raster_reset_, raster_set_mode_, raster_render_, raster_done_) \
- void \
- FT_Init_Class_##class_( FT_Raster_Funcs* clazz ) \
- { \
- clazz->glyph_format = glyph_format_; \
- clazz->raster_new = raster_new_; \
- clazz->raster_reset = raster_reset_; \
- clazz->raster_set_mode = raster_set_mode_; \
- clazz->raster_render = raster_render_; \
- clazz->raster_done = raster_done_; \
+#define FT_DEFINE_RASTER_FUNCS( \
+ class_, \
+ glyph_format_, \
+ raster_new_, \
+ raster_reset_, \
+ raster_set_mode_, \
+ raster_render_, \
+ raster_done_ ) \
+ void \
+ FT_Init_Class_ ## class_( FT_Raster_Funcs* clazz ) \
+ { \
+ clazz->glyph_format = glyph_format_; \
+ clazz->raster_new = raster_new_; \
+ clazz->raster_reset = raster_reset_; \
+ clazz->raster_set_mode = raster_set_mode_; \
+ clazz->raster_render = raster_render_; \
+ clazz->raster_done = raster_done_; \
}
#endif /* FT_CONFIG_OPTION_PIC */
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /**** ****/
- /**** ****/
- /**** PIC-Support Macros for ftrender.h ****/
- /**** ****/
- /**** ****/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
+ /* PIC support macros for ftrender.h */
/*************************************************************************/
@@ -1042,40 +1100,64 @@ FT_BEGIN_HEADER
/* <Description> */
/* Used to initialize an instance of FT_Glyph_Class struct. */
/* When FT_CONFIG_OPTION_PIC is defined an init funtion will need to */
- /* called with a pre-allocated stracture to be filled. */
+ /* be called with a pre-allocated stcture to be filled. */
/* When FT_CONFIG_OPTION_PIC is not defined the struct will be */
/* allocated in the global scope (or the scope where the macro */
/* is used). */
/* */
#ifndef FT_CONFIG_OPTION_PIC
-#define FT_DEFINE_GLYPH(class_, size_, format_, init_, done_, copy_, \
- transform_, bbox_, prepare_) \
- FT_CALLBACK_TABLE_DEF \
- const FT_Glyph_Class class_ = \
- { \
- size_, format_, init_, done_, copy_, transform_, bbox_, prepare_ \
+#define FT_DEFINE_GLYPH( \
+ class_, \
+ size_, \
+ format_, \
+ init_, \
+ done_, \
+ copy_, \
+ transform_, \
+ bbox_, \
+ prepare_ ) \
+ FT_CALLBACK_TABLE_DEF \
+ const FT_Glyph_Class class_ = \
+ { \
+ size_, \
+ format_, \
+ init_, \
+ done_, \
+ copy_, \
+ transform_, \
+ bbox_, \
+ prepare_ \
};
#else /* FT_CONFIG_OPTION_PIC */
-#define FT_DEFINE_GLYPH(class_, size_, format_, init_, done_, copy_, \
- transform_, bbox_, prepare_) \
- void \
- FT_Init_Class_##class_( FT_Glyph_Class* clazz ) \
- { \
- clazz->glyph_size = size_; \
- clazz->glyph_format = format_; \
- clazz->glyph_init = init_; \
- clazz->glyph_done = done_; \
- clazz->glyph_copy = copy_; \
- clazz->glyph_transform = transform_; \
- clazz->glyph_bbox = bbox_; \
- clazz->glyph_prepare = prepare_; \
+#define FT_DEFINE_GLYPH( \
+ class_, \
+ size_, \
+ format_, \
+ init_, \
+ done_, \
+ copy_, \
+ transform_, \
+ bbox_, \
+ prepare_ ) \
+ void \
+ FT_Init_Class_ ## class_( FT_Glyph_Class* clazz ) \
+ { \
+ clazz->glyph_size = size_; \
+ clazz->glyph_format = format_; \
+ clazz->glyph_init = init_; \
+ clazz->glyph_done = done_; \
+ clazz->glyph_copy = copy_; \
+ clazz->glyph_transform = transform_; \
+ clazz->glyph_bbox = bbox_; \
+ clazz->glyph_prepare = prepare_; \
}
#endif /* FT_CONFIG_OPTION_PIC */
+
/*************************************************************************/
/* */
/* <Macro> */
@@ -1083,7 +1165,7 @@ FT_BEGIN_HEADER
/* */
/* <Description> */
/* Used to create a forward declaration of a */
- /* FT_Renderer_Class stract instance. */
+ /* FT_Renderer_Class struct instance. */
/* */
/* <Macro> */
/* FT_DEFINE_RENDERER */
@@ -1091,22 +1173,23 @@ FT_BEGIN_HEADER
/* <Description> */
/* Used to initialize an instance of FT_Renderer_Class struct. */
/* */
- /* When FT_CONFIG_OPTION_PIC is defined a Create funtion will need */
- /* to called with a pointer where the allocated stracture is returned.*/
- /* And when it is no longer needed a Destroy function needs */
- /* to be called to release that allocation. */
- /* fcinit.c (ft_create_default_module_classes) already contains */
+ /* When FT_CONFIG_OPTION_PIC is defined a `create' funtion will need */
+ /* to be called with a pointer where the allocated structure is */
+ /* returned. And when it is no longer needed a `destroy' function */
+ /* needs to be called to release that allocation. */
+ /* `fcinit.c' (ft_create_default_module_classes) already contains */
/* a mechanism to call these functions for the default modules */
- /* described in ftmodule.h */
+ /* described in `ftmodule.h'. */
/* */
- /* Notice that the created Create and Destroy functions call */
- /* pic_init and pic_free function to allow you to manually allocate */
- /* and initialize any additional global data, like module specific */
+ /* Notice that the created `create' and `destroy' functions call */
+ /* `pic_init' and `pic_free' to allow you to manually allocate and */
+ /* initialize any additional global data, like a module specific */
/* interface, and put them in the global pic container defined in */
- /* ftpic.h. if you don't need them just implement the functions as */
- /* empty to resolve the link error. Also the pic_init and pic_free */
- /* functions should be declared in pic.h, to be referred by renderer */
- /* definition calling FT_DEFINE_RENDERER() in following. */
+ /* `ftpic.h'. If you don't need them just implement the functions as */
+ /* empty to resolve the link error. Also the `pic_init' and */
+ /* `pic_free' functions should be declared in `pic.h', to be referred */
+ /* by the renderer definition calling `FT_DEFINE_RENDERER' in the */
+ /* following. */
/* */
/* When FT_CONFIG_OPTION_PIC is not defined the struct will be */
/* allocated in the global scope (or the scope where the macro */
@@ -1114,99 +1197,130 @@ FT_BEGIN_HEADER
/* */
#ifndef FT_CONFIG_OPTION_PIC
-#define FT_DECLARE_RENDERER(class_) \
- FT_EXPORT_VAR( const FT_Renderer_Class ) class_;
-
-#define FT_DEFINE_RENDERER(class_, \
- flags_, size_, name_, version_, requires_, \
- interface_, init_, done_, get_interface_, \
- glyph_format_, render_glyph_, transform_glyph_, \
- get_glyph_cbox_, set_mode_, raster_class_ ) \
- FT_CALLBACK_TABLE_DEF \
- const FT_Renderer_Class class_ = \
- { \
- FT_DEFINE_ROOT_MODULE(flags_,size_,name_,version_,requires_, \
- interface_,init_,done_,get_interface_) \
- glyph_format_, \
- \
- render_glyph_, \
- transform_glyph_, \
- get_glyph_cbox_, \
- set_mode_, \
- \
- raster_class_ \
+#define FT_DECLARE_RENDERER( class_ ) \
+ FT_EXPORT_VAR( const FT_Renderer_Class ) class_;
+
+#define FT_DEFINE_RENDERER( \
+ class_, \
+ flags_, \
+ size_, \
+ name_, \
+ version_, \
+ requires_, \
+ interface_, \
+ init_, \
+ done_, \
+ get_interface_, \
+ glyph_format_, \
+ render_glyph_, \
+ transform_glyph_, \
+ get_glyph_cbox_, \
+ set_mode_, \
+ raster_class_ ) \
+ FT_CALLBACK_TABLE_DEF \
+ const FT_Renderer_Class class_ = \
+ { \
+ FT_DEFINE_ROOT_MODULE( flags_, \
+ size_, \
+ name_, \
+ version_, \
+ requires_, \
+ interface_, \
+ init_, \
+ done_, \
+ get_interface_ ) \
+ glyph_format_, \
+ \
+ render_glyph_, \
+ transform_glyph_, \
+ get_glyph_cbox_, \
+ set_mode_, \
+ \
+ raster_class_ \
};
#else /* FT_CONFIG_OPTION_PIC */
-#define FT_DECLARE_RENDERER(class_) FT_DECLARE_MODULE(class_)
-
-#define FT_DEFINE_RENDERER(class_, \
- flags_, size_, name_, version_, requires_, \
- interface_, init_, done_, get_interface_, \
- glyph_format_, render_glyph_, transform_glyph_, \
- get_glyph_cbox_, set_mode_, raster_class_ ) \
- \
- void \
- FT_Destroy_Class_##class_( FT_Library library, \
- FT_Module_Class* clazz ) \
- { \
- FT_Renderer_Class* rclazz = (FT_Renderer_Class*)clazz; \
- FT_Memory memory = library->memory; \
- class_##_pic_free( library ); \
- if ( rclazz ) \
- FT_FREE( rclazz ); \
- } \
- \
- FT_Error \
- FT_Create_Class_##class_( FT_Library library, \
- FT_Module_Class** output_class ) \
- { \
- FT_Renderer_Class* clazz; \
- FT_Error error; \
- FT_Memory memory = library->memory; \
- \
- if ( FT_ALLOC( clazz, sizeof(*clazz) ) ) \
- return error; \
- \
- error = class_##_pic_init( library ); \
- if(error) \
- { \
- FT_FREE( clazz ); \
- return error; \
- } \
- \
- FT_DEFINE_ROOT_MODULE(flags_,size_,name_,version_,requires_, \
- interface_,init_,done_,get_interface_) \
- \
- clazz->glyph_format = glyph_format_; \
- \
- clazz->render_glyph = render_glyph_; \
- clazz->transform_glyph = transform_glyph_; \
- clazz->get_glyph_cbox = get_glyph_cbox_; \
- clazz->set_mode = set_mode_; \
- \
- clazz->raster_class = raster_class_; \
- \
- *output_class = (FT_Module_Class*)clazz; \
- return FT_Err_Ok; \
+#define FT_DECLARE_RENDERER( class_ ) FT_DECLARE_MODULE( class_ )
+
+#define FT_DEFINE_RENDERER( \
+ class_, \
+ flags_, \
+ size_, \
+ name_, \
+ version_, \
+ requires_, \
+ interface_, \
+ init_, \
+ done_, \
+ get_interface_, \
+ glyph_format_, \
+ render_glyph_, \
+ transform_glyph_, \
+ get_glyph_cbox_, \
+ set_mode_, \
+ raster_class_ ) \
+ void \
+ FT_Destroy_Class_ ## class_( FT_Library library, \
+ FT_Module_Class* clazz ) \
+ { \
+ FT_Renderer_Class* rclazz = (FT_Renderer_Class*)clazz; \
+ FT_Memory memory = library->memory; \
+ \
+ \
+ class_ ## _pic_free( library ); \
+ if ( rclazz ) \
+ FT_FREE( rclazz ); \
+ } \
+ \
+ \
+ FT_Error \
+ FT_Create_Class_ ## class_( FT_Library library, \
+ FT_Module_Class** output_class ) \
+ { \
+ FT_Renderer_Class* clazz = NULL; \
+ FT_Error error; \
+ FT_Memory memory = library->memory; \
+ \
+ \
+ if ( FT_ALLOC( clazz, sizeof ( *clazz ) ) ) \
+ return error; \
+ \
+ error = class_ ## _pic_init( library ); \
+ if ( error ) \
+ { \
+ FT_FREE( clazz ); \
+ return error; \
+ } \
+ \
+ FT_DEFINE_ROOT_MODULE( flags_, \
+ size_, \
+ name_, \
+ version_, \
+ requires_, \
+ interface_, \
+ init_, \
+ done_, \
+ get_interface_ ) \
+ \
+ clazz->glyph_format = glyph_format_; \
+ \
+ clazz->render_glyph = render_glyph_; \
+ clazz->transform_glyph = transform_glyph_; \
+ clazz->get_glyph_cbox = get_glyph_cbox_; \
+ clazz->set_mode = set_mode_; \
+ \
+ clazz->raster_class = raster_class_; \
+ \
+ *output_class = (FT_Module_Class*)clazz; \
+ \
+ return FT_Err_Ok; \
}
-
-
#endif /* FT_CONFIG_OPTION_PIC */
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /**** ****/
- /**** ****/
- /**** PIC-Support Macros for ftmodapi.h ****/
- /**** ****/
- /**** ****/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
+
+ /* PIC support macros for ftmodapi.h **/
#ifdef FT_CONFIG_OPTION_PIC
@@ -1247,6 +1361,7 @@ FT_BEGIN_HEADER
#endif
+
/*************************************************************************/
/* */
/* <Macro> */
@@ -1254,30 +1369,31 @@ FT_BEGIN_HEADER
/* */
/* <Description> */
/* Used to create a forward declaration of a */
- /* FT_Module_Class stract instance. */
+ /* FT_Module_Class struct instance. */
/* */
/* <Macro> */
/* FT_DEFINE_MODULE */
/* */
/* <Description> */
- /* Used to initialize an instance of FT_Module_Class struct. */
+ /* Used to initialize an instance of an FT_Module_Class struct. */
/* */
- /* When FT_CONFIG_OPTION_PIC is defined a Create funtion will need */
- /* to called with a pointer where the allocated stracture is returned.*/
- /* And when it is no longer needed a Destroy function needs */
- /* to be called to release that allocation. */
- /* fcinit.c (ft_create_default_module_classes) already contains */
+ /* When FT_CONFIG_OPTION_PIC is defined a `create' funtion needs to */
+ /* be called with a pointer where the allocated structure is */
+ /* returned. And when it is no longer needed a `destroy' function */
+ /* needs to be called to release that allocation. */
+ /* `fcinit.c' (ft_create_default_module_classes) already contains */
/* a mechanism to call these functions for the default modules */
- /* described in ftmodule.h */
+ /* described in `ftmodule.h'. */
/* */
- /* Notice that the created Create and Destroy functions call */
- /* pic_init and pic_free function to allow you to manually allocate */
- /* and initialize any additional global data, like module specific */
+ /* Notice that the created `create' and `destroy' functions call */
+ /* `pic_init' and `pic_free' to allow you to manually allocate and */
+ /* initialize any additional global data, like a module specific */
/* interface, and put them in the global pic container defined in */
- /* ftpic.h. if you don't need them just implement the functions as */
- /* empty to resolve the link error. Also the pic_init and pic_free */
- /* functions should be declared in pic.h, to be referred by module */
- /* definition calling FT_DEFINE_MODULE() in following. */
+ /* `ftpic.h'. If you don't need them just implement the functions as */
+ /* empty to resolve the link error. Also the `pic_init' and */
+ /* `pic_free' functions should be declared in `pic.h', to be referred */
+ /* by the module definition calling `FT_DEFINE_MODULE' in the */
+ /* following. */
/* */
/* When FT_CONFIG_OPTION_PIC is not defined the struct will be */
/* allocated in the global scope (or the scope where the macro */
@@ -1287,119 +1403,159 @@ FT_BEGIN_HEADER
/* FT_DEFINE_ROOT_MODULE */
/* */
/* <Description> */
- /* Used to initialize an instance of FT_Module_Class struct inside */
- /* another stract that contains it or in a function that initializes */
- /* that containing stract */
+ /* Used to initialize an instance of an FT_Module_Class struct inside */
+ /* another struct that contains it or in a function that initializes */
+ /* that containing struct. */
/* */
#ifndef FT_CONFIG_OPTION_PIC
-#define FT_DECLARE_MODULE(class_) \
- FT_CALLBACK_TABLE \
- const FT_Module_Class class_; \
-
-#define FT_DEFINE_ROOT_MODULE(flags_, size_, name_, version_, requires_, \
- interface_, init_, done_, get_interface_) \
- { \
- flags_, \
- size_, \
- \
- name_, \
- version_, \
- requires_, \
- \
- interface_, \
- \
- init_, \
- done_, \
- get_interface_, \
+#define FT_DECLARE_MODULE( class_ ) \
+ FT_CALLBACK_TABLE \
+ const FT_Module_Class class_;
+
+#define FT_DEFINE_ROOT_MODULE( \
+ flags_, \
+ size_, \
+ name_, \
+ version_, \
+ requires_, \
+ interface_, \
+ init_, \
+ done_, \
+ get_interface_ ) \
+ { \
+ flags_, \
+ size_, \
+ \
+ name_, \
+ version_, \
+ requires_, \
+ \
+ interface_, \
+ \
+ init_, \
+ done_, \
+ get_interface_, \
},
-#define FT_DEFINE_MODULE(class_, flags_, size_, name_, version_, requires_, \
- interface_, init_, done_, get_interface_) \
- FT_CALLBACK_TABLE_DEF \
- const FT_Module_Class class_ = \
- { \
- flags_, \
- size_, \
- \
- name_, \
- version_, \
- requires_, \
- \
- interface_, \
- \
- init_, \
- done_, \
- get_interface_, \
+#define FT_DEFINE_MODULE( \
+ class_, \
+ flags_, \
+ size_, \
+ name_, \
+ version_, \
+ requires_, \
+ interface_, \
+ init_, \
+ done_, \
+ get_interface_ ) \
+ FT_CALLBACK_TABLE_DEF \
+ const FT_Module_Class class_ = \
+ { \
+ flags_, \
+ size_, \
+ \
+ name_, \
+ version_, \
+ requires_, \
+ \
+ interface_, \
+ \
+ init_, \
+ done_, \
+ get_interface_, \
};
#else /* FT_CONFIG_OPTION_PIC */
-#define FT_DECLARE_MODULE(class_) \
- FT_Error FT_Create_Class_##class_( FT_Library library, \
- FT_Module_Class** output_class ); \
- void FT_Destroy_Class_##class_( FT_Library library, \
- FT_Module_Class* clazz );
-
-#define FT_DEFINE_ROOT_MODULE(flags_, size_, name_, version_, requires_, \
- interface_, init_, done_, get_interface_) \
- clazz->root.module_flags = flags_; \
- clazz->root.module_size = size_; \
- clazz->root.module_name = name_; \
- clazz->root.module_version = version_; \
- clazz->root.module_requires = requires_; \
- \
- clazz->root.module_interface = interface_; \
- \
- clazz->root.module_init = init_; \
- clazz->root.module_done = done_; \
- clazz->root.get_interface = get_interface_;
-
-#define FT_DEFINE_MODULE(class_, flags_, size_, name_, version_, requires_, \
- interface_, init_, done_, get_interface_) \
- \
- void \
- FT_Destroy_Class_##class_( FT_Library library, \
- FT_Module_Class* clazz ) \
- { \
- FT_Memory memory = library->memory; \
- class_##_pic_free( library ); \
- if ( clazz ) \
- FT_FREE( clazz ); \
- } \
- \
- FT_Error \
- FT_Create_Class_##class_( FT_Library library, \
- FT_Module_Class** output_class ) \
- { \
- FT_Memory memory = library->memory; \
- FT_Module_Class* clazz; \
- FT_Error error; \
- \
- if ( FT_ALLOC( clazz, sizeof(*clazz) ) ) \
- return error; \
- error = class_##_pic_init( library ); \
- if(error) \
- { \
- FT_FREE( clazz ); \
- return error; \
- } \
- \
- clazz->module_flags = flags_; \
- clazz->module_size = size_; \
- clazz->module_name = name_; \
- clazz->module_version = version_; \
- clazz->module_requires = requires_; \
- \
- clazz->module_interface = interface_; \
- \
- clazz->module_init = init_; \
- clazz->module_done = done_; \
- clazz->get_interface = get_interface_; \
- \
- *output_class = clazz; \
- return FT_Err_Ok; \
+#define FT_DECLARE_MODULE( class_ ) \
+ FT_Error \
+ FT_Create_Class_ ## class_( FT_Library library, \
+ FT_Module_Class** output_class ); \
+ void \
+ FT_Destroy_Class_ ## class_( FT_Library library, \
+ FT_Module_Class* clazz );
+
+#define FT_DEFINE_ROOT_MODULE( \
+ flags_, \
+ size_, \
+ name_, \
+ version_, \
+ requires_, \
+ interface_, \
+ init_, \
+ done_, \
+ get_interface_ ) \
+ clazz->root.module_flags = flags_; \
+ clazz->root.module_size = size_; \
+ clazz->root.module_name = name_; \
+ clazz->root.module_version = version_; \
+ clazz->root.module_requires = requires_; \
+ \
+ clazz->root.module_interface = interface_; \
+ \
+ clazz->root.module_init = init_; \
+ clazz->root.module_done = done_; \
+ clazz->root.get_interface = get_interface_;
+
+#define FT_DEFINE_MODULE( \
+ class_, \
+ flags_, \
+ size_, \
+ name_, \
+ version_, \
+ requires_, \
+ interface_, \
+ init_, \
+ done_, \
+ get_interface_ ) \
+ void \
+ FT_Destroy_Class_ ## class_( FT_Library library, \
+ FT_Module_Class* clazz ) \
+ { \
+ FT_Memory memory = library->memory; \
+ \
+ \
+ class_ ## _pic_free( library ); \
+ if ( clazz ) \
+ FT_FREE( clazz ); \
+ } \
+ \
+ \
+ FT_Error \
+ FT_Create_Class_ ## class_( FT_Library library, \
+ FT_Module_Class** output_class ) \
+ { \
+ FT_Memory memory = library->memory; \
+ FT_Module_Class* clazz = NULL; \
+ FT_Error error; \
+ \
+ \
+ if ( FT_ALLOC( clazz, sizeof ( *clazz ) ) ) \
+ return error; \
+ error = class_ ## _pic_init( library ); \
+ if ( error ) \
+ { \
+ FT_FREE( clazz ); \
+ return error; \
+ } \
+ \
+ clazz->module_flags = flags_; \
+ clazz->module_size = size_; \
+ clazz->module_name = name_; \
+ clazz->module_version = version_; \
+ clazz->module_requires = requires_; \
+ \
+ clazz->module_interface = interface_; \
+ \
+ clazz->module_init = init_; \
+ clazz->module_done = done_; \
+ clazz->get_interface = get_interface_; \
+ \
+ *output_class = clazz; \
+ \
+ return FT_Err_Ok; \
}
#endif /* FT_CONFIG_OPTION_PIC */