ref: 29a90e2610ad5dc93ae4fc24e37a74bbe751f834
parent: 4174350526e14bdae31218706d232976d682ca58
author: Werner Lemberg <[email protected]>
date: Wed Aug 2 20:03:08 EDT 2000
Updating unix/ftconfig.in to recent config/ftconfig.h changes. More C++ fixes: Introducing LOCAL_FUNC_X for local functions used in function pointers (there are no local anonymous functions in C++) and FT_CPLUSPLUS (instead of FT_EXPORT_VAR) to define linkage of structures which contain function pointers.
--- a/builds/unix/ftconfig.in
+++ b/builds/unix/ftconfig.in
@@ -144,32 +144,97 @@
#ifdef FT_MAKE_OPTION_SINGLE_OBJECT
-#define LOCAL_DEF static
-#define LOCAL_FUNC static
+
+#define LOCAL_DEF static
+#define LOCAL_FUNC static
+
#else
-#define LOCAL_DEF extern
-#define LOCAL_FUNC /* nothing */
+
+#ifdef __cplusplus
+#define LOCAL_DEF extern "C"
+#define LOCAL_FUNC extern "C"
+#else
+#define LOCAL_DEF extern
+#define LOCAL_FUNC extern
#endif
-#ifdef FT_MAKE_OPTION_SINGLE_LIBRARY_OBJECT
-#define BASE_DEF( x ) static x
-#define BASE_FUNC( x ) static x
+#endif /* FT_MAKE_OPTION_SINGLE_OBJECT */
+
+
+#ifndef BASE_DEF
+
+#ifdef __cplusplus
+#define BASE_DEF( x ) extern "C" x
#else
-#define BASE_DEF( x ) extern x
-#define BASE_FUNC( x ) extern x
+#define BASE_DEF( x ) extern x
#endif
-#ifndef FT_EXPORT_DEF
-#define FT_EXPORT_DEF( x ) extern x
+#endif /* !BASE_DEF */
+
+
+#ifndef BASE_FUNC
+
+#ifdef __cplusplus
+#define BASE_FUNC( x ) extern "C" x
+#else
+#define BASE_FUNC( x ) extern x
#endif
-#ifndef FT_EXPORT_FUNC
-#define FT_EXPORT_FUNC( x ) extern x
+#endif /* !BASE_FUNC */
+
+
+#ifndef FT_EXPORT_DEF
+
+#ifdef __cplusplus
+#define FT_EXPORT_DEF( x ) extern "C" x
+#else
+#define FT_EXPORT_DEF( x ) extern x
#endif
-#ifndef FT_EXPORT_VAR
-#define FT_EXPORT_VAR( x ) extern x
+#endif /* !FT_EXPORT_DEF */
+
+
+#ifndef FT_EXPORT_FUNC
+
+#ifdef __cplusplus
+#define FT_EXPORT_FUNC( x ) extern "C" x
+#else
+#define FT_EXPORT_FUNC( x ) extern x
#endif
+
+#endif /* !FT_EXPORT_FUNC */
+
+
+#ifndef FT_EXPORT_VAR
+
+#ifdef __cplusplus
+#define FT_EXPORT_VAR( x ) extern "C" x
+#else
+#define FT_EXPORT_VAR( x ) extern x
+#endif
+
+#endif /* !FT_EXPORT_VAR */
+
+
+ /* This is special. Within C++, you must specify `extern "C"' for */
+ /* functions which are used via function pointers, and you also */
+ /* must do that for structures which contain function pointers to */
+ /* assure C linkage -- it's not possible to have (local) anonymous */
+ /* functions which are accessed by (global) function pointers. */
+ /* */
+#ifdef __cplusplus
+
+#define LOCAL_FUNC_X extern "C"
+
+#define FT_CPLUSPLUS( x ) extern "C" x
+
+#else
+
+#define LOCAL_FUNC_X static
+
+#define FT_CPLUSPLUS( x ) x
+
+#endif /* __cplusplus */
#ifdef __cplusplus
--- a/builds/unix/ftsystem.c
+++ b/builds/unix/ftsystem.c
@@ -92,7 +92,7 @@
/* <Return> */
/* block :: The address of newly allocated block. */
/* */
- static
+ LOCAL_FUNC_X
void* ft_alloc( FT_Memory memory,
long size )
{
@@ -122,7 +122,7 @@
/* <Return> */
/* The address of the reallocated memory block. */
/* */
- static
+ LOCAL_FUNC_X
void* ft_realloc( FT_Memory memory,
long cur_size,
long new_size,
@@ -148,7 +148,7 @@
/* */
/* block :: The address of block in memory to be freed. */
/* */
- static
+ LOCAL_FUNC_X
void ft_free( FT_Memory memory,
void* block )
{
@@ -190,7 +190,7 @@
/* <Input> */
/* stream :: A pointer to the stream object. */
/* */
- static
+ LOCAL_FUNC_X
void ft_close_stream( FT_Stream stream )
{
munmap( (MUNMAP_ARG_CAST)stream->descriptor.pointer, stream->size );
--- a/include/freetype/config/ftconfig.h
+++ b/include/freetype/config/ftconfig.h
@@ -231,6 +231,27 @@
#endif /* !FT_EXPORT_VAR */
+ /* This is special. Within C++, you must specify `extern "C"' for */
+ /* functions which are used via function pointers, and you also */
+ /* must do that for structures which contain function pointers to */
+ /* assure C linkage -- it's not possible to have (local) anonymous */
+ /* functions which are accessed by (global) function pointers. */
+ /* */
+#ifdef __cplusplus
+
+#define LOCAL_FUNC_X extern "C"
+
+#define FT_CPLUSPLUS( x ) extern "C" x
+
+#else
+
+#define LOCAL_FUNC_X static
+
+#define FT_CPLUSPLUS( x ) x
+
+#endif /* __cplusplus */
+
+
#ifdef __cplusplus
}
#endif
--- a/src/autohint/ahmodule.c
+++ b/src/autohint/ahmodule.c
@@ -55,7 +55,7 @@
}
- static
+ LOCAL_FUNC_X
FT_Error ft_autohinter_load( FT_AutoHinter module,
FT_GlyphSlot slot,
FT_Size size,
@@ -67,7 +67,7 @@
}
- static
+ LOCAL_FUNC_X
void ft_autohinter_reset( FT_AutoHinter module,
FT_Face face )
{
@@ -78,7 +78,7 @@
}
- static
+ LOCAL_FUNC_X
void ft_autohinter_get_globals( FT_AutoHinter module,
FT_Face face,
void** global_hints,
@@ -89,7 +89,7 @@
}
- static
+ LOCAL_FUNC_X
void ft_autohinter_done_globals( FT_AutoHinter module,
void* global_hints )
{
@@ -107,7 +107,7 @@
};
- FT_EXPORT_VAR( const FT_Module_Class ) autohint_module_class =
+ FT_CPLUSPLUS( const FT_Module_Class ) autohint_module_class =
{
ft_module_hinter,
sizeof ( FT_AutoHinterRec ),
--- a/src/cff/t2driver.c
+++ b/src/cff/t2driver.c
@@ -302,7 +302,7 @@
/* The FT_DriverInterface structure is defined in ftdriver.h. */
- FT_EXPORT_VAR( const FT_Driver_Class ) cff_driver_class =
+ FT_CPLUSPLUS( const FT_Driver_Class ) cff_driver_class =
{
/* begin with the FT_Module_Class fields */
{
--- a/src/cid/cidload.c
+++ b/src/cid/cidload.c
@@ -163,7 +163,7 @@
}
- static
+ LOCAL_FUNC_X
FT_Error parse_font_bbox( CID_Face face,
CID_Parser* parser )
{
@@ -182,7 +182,7 @@
}
- static
+ LOCAL_FUNC_X
FT_Error parse_font_matrix( CID_Face face,
CID_Parser* parser )
{
@@ -208,7 +208,7 @@
}
- static
+ LOCAL_FUNC_X
FT_Error parse_fd_array( CID_Face face,
CID_Parser* parser )
{
--- a/src/cid/cidriver.c
+++ b/src/cid/cidriver.c
@@ -182,7 +182,7 @@
}
- FT_EXPORT_VAR( const FT_Driver_Class ) t1cid_driver_class =
+ FT_CPLUSPLUS( const FT_Driver_Class ) t1cid_driver_class =
{
/* first of all, the FT_Module_Class fields */
{
--- a/src/psnames/psmodule.c
+++ b/src/psnames/psmodule.c
@@ -139,7 +139,7 @@
/* qsort callback to sort the unicode map */
- static
+ LOCAL_FUNC_X
int compare_uni_maps( const void* a,
const void* b )
{
@@ -296,7 +296,7 @@
#endif /* !FT_CONFIG_OPTION_NO_POSTSCRIPT_NAMES */
- FT_EXPORT_VAR( const FT_Module_Class ) psnames_module_class =
+ FT_CPLUSPLUS( const FT_Module_Class ) psnames_module_class =
{
0, /* this is not a font driver, nor a renderer */
sizeof( FT_ModuleRec ),
--- a/src/raster1/ftrend1.c
+++ b/src/raster1/ftrend1.c
@@ -213,7 +213,7 @@
}
- FT_EXPORT_VAR( const FT_Renderer_Class ) ft_raster1_renderer_class =
+ FT_CPLUSPLUS( const FT_Renderer_Class ) ft_raster1_renderer_class =
{
{
ft_module_renderer,
@@ -245,7 +245,7 @@
/* to register it by hand in your application. It should only be */
/* used for backwards-compatibility with FT 1.x anyway. */
/* */
- FT_EXPORT_VAR( const FT_Renderer_Class ) ft_raster5_renderer_class =
+ FT_CPLUSPLUS( const FT_Renderer_Class ) ft_raster5_renderer_class =
{
{
ft_module_renderer,
--- a/src/sfnt/sfdriver.c
+++ b/src/sfnt/sfdriver.c
@@ -122,7 +122,7 @@
#endif /* TT_CONFIG_OPTION_POSTSCRIPT_NAMES */
- static
+ LOCAL_FUNC_X
FT_Module_Interface SFNT_Get_Interface( FT_Module module,
const char* interface )
{
@@ -204,7 +204,7 @@
};
- FT_EXPORT_VAR( const FT_Module_Class ) sfnt_module_class =
+ FT_CPLUSPLUS( const FT_Module_Class ) sfnt_module_class =
{
0, /* not a font driver or renderer */
sizeof( FT_ModuleRec ),
--- a/src/sfnt/ttcmap.c
+++ b/src/sfnt/ttcmap.c
@@ -43,14 +43,14 @@
#define FT_COMPONENT trace_ttcmap
- static FT_UInt code_to_index0( TT_CMapTable* charmap,
- FT_ULong char_code );
- static FT_UInt code_to_index2( TT_CMapTable* charmap,
- FT_ULong char_code );
- static FT_UInt code_to_index4( TT_CMapTable* charmap,
- FT_ULong char_code );
- static FT_UInt code_to_index6( TT_CMapTable* charmap,
- FT_ULong char_code );
+ LOCAL_FUNC_X FT_UInt code_to_index0( TT_CMapTable* charmap,
+ FT_ULong char_code );
+ LOCAL_FUNC_X FT_UInt code_to_index2( TT_CMapTable* charmap,
+ FT_ULong char_code );
+ LOCAL_FUNC_X FT_UInt code_to_index4( TT_CMapTable* charmap,
+ FT_ULong char_code );
+ LOCAL_FUNC_X FT_UInt code_to_index6( TT_CMapTable* charmap,
+ FT_ULong char_code );
/*************************************************************************/
@@ -355,7 +355,7 @@
/* <Return> */
/* Glyph index into the glyphs array. 0 if the glyph does not exist. */
/* */
- static
+ LOCAL_FUNC_X
FT_UInt code_to_index0( TT_CMapTable* cmap,
FT_ULong charCode )
{
@@ -381,7 +381,7 @@
/* <Return> */
/* Glyph index into the glyphs array. 0 if the glyph does not exist. */
/* */
- static
+ LOCAL_FUNC_X
FT_UInt code_to_index2( TT_CMapTable* cmap,
FT_ULong charCode )
{
@@ -445,7 +445,7 @@
/* <Return> */
/* Glyph index into the glyphs array. 0 if the glyph does not exist. */
/* */
- static
+ LOCAL_FUNC_X
FT_UInt code_to_index4( TT_CMapTable* cmap,
FT_ULong charCode )
{
@@ -528,7 +528,7 @@
/* <Return> */
/* Glyph index into the glyphs array. 0 if the glyph does not exist. */
/* */
- static
+ LOCAL_FUNC_X
FT_UInt code_to_index6( TT_CMapTable* cmap,
FT_ULong charCode )
{
--- a/src/smooth/ftsmooth.c
+++ b/src/smooth/ftsmooth.c
@@ -189,7 +189,7 @@
}
- FT_EXPORT_VAR( const FT_Renderer_Class ) ft_smooth_renderer_class =
+ FT_CPLUSPLUS( const FT_Renderer_Class ) ft_smooth_renderer_class =
{
{
ft_module_renderer,
--- a/src/truetype/ttdriver.c
+++ b/src/truetype/ttdriver.c
@@ -430,7 +430,7 @@
/* The FT_DriverInterface structure is defined in ftdriver.h. */
- FT_EXPORT_VAR( const FT_Driver_Class ) tt_driver_class =
+ FT_CPLUSPLUS( const FT_Driver_Class ) tt_driver_class =
{
{
ft_module_font_driver |
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -207,7 +207,7 @@
/* */
/*************************************************************************/
- static
+ LOCAL_FUNC_X
FT_Error TT_Access_Glyph_Frame( TT_Loader* loader,
FT_UInt glyph_index,
FT_ULong offset,
@@ -227,7 +227,7 @@
}
- static
+ LOCAL_FUNC_X
void TT_Forget_Glyph_Frame( TT_Loader* loader )
{
FT_Stream stream = loader->stream;
@@ -237,7 +237,7 @@
}
- static
+ LOCAL_FUNC_X
FT_Error TT_Load_Glyph_Header( TT_Loader* loader )
{
FT_Stream stream = loader->stream;
@@ -260,7 +260,7 @@
}
- static
+ LOCAL_FUNC_X
FT_Error TT_Load_Simple_Glyph( TT_Loader* load )
{
FT_Error error;
@@ -419,7 +419,7 @@
}
- static
+ LOCAL_FUNC_X
FT_Error TT_Load_Composite_Glyph( TT_Loader* loader )
{
FT_Error error;
--- a/src/type1/t1driver.c
+++ b/src/type1/t1driver.c
@@ -324,7 +324,7 @@
- FT_EXPORT_VAR( const FT_Driver_Class ) t1_driver_class =
+ FT_CPLUSPLUS( const FT_Driver_Class ) t1_driver_class =
{
{
ft_module_font_driver | ft_module_driver_scalable,
--- a/src/type1z/z1afm.c
+++ b/src/type1z/z1afm.c
@@ -149,7 +149,7 @@
/* compare two kerning pairs */
- static
+ LOCAL_FUNC_X
int compare_kern_pairs( const void* a,
const void* b )
{
--- a/src/type1z/z1driver.c
+++ b/src/type1z/z1driver.c
@@ -283,7 +283,7 @@
}
- FT_EXPORT_VAR( const FT_Driver_Class ) t1_driver_class =
+ FT_CPLUSPLUS( const FT_Driver_Class ) t1_driver_class =
{
{
ft_module_font_driver | ft_module_driver_scalable,
--- a/src/winfonts/winfnt.c
+++ b/src/winfonts/winfnt.c
@@ -588,7 +588,7 @@
}
- FT_EXPORT_VAR( const FT_Driver_Class ) winfnt_driver_class =
+ FT_CPLUSPLUS( const FT_Driver_Class ) winfnt_driver_class =
{
{
ft_module_font_driver,