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.
This commit is contained in:
Werner Lemberg 2000-08-03 00:03:08 +00:00
parent 4174350526
commit 29a90e2610
18 changed files with 145 additions and 59 deletions

View File

@ -144,33 +144,98 @@
#ifdef FT_MAKE_OPTION_SINGLE_OBJECT #ifdef FT_MAKE_OPTION_SINGLE_OBJECT
#define LOCAL_DEF static
#define LOCAL_FUNC static #define LOCAL_DEF static
#define LOCAL_FUNC static
#else #else
#define LOCAL_DEF extern
#define LOCAL_FUNC /* nothing */
#endif
#ifdef FT_MAKE_OPTION_SINGLE_LIBRARY_OBJECT #ifdef __cplusplus
#define BASE_DEF( x ) static x #define LOCAL_DEF extern "C"
#define BASE_FUNC( x ) static x #define LOCAL_FUNC extern "C"
#else #else
#define BASE_DEF( x ) extern x #define LOCAL_DEF extern
#define BASE_FUNC( x ) extern x #define LOCAL_FUNC extern
#endif #endif
#ifndef FT_EXPORT_DEF #endif /* FT_MAKE_OPTION_SINGLE_OBJECT */
#define FT_EXPORT_DEF( x ) extern x
#ifndef BASE_DEF
#ifdef __cplusplus
#define BASE_DEF( x ) extern "C" x
#else
#define BASE_DEF( x ) extern x
#endif #endif
#ifndef FT_EXPORT_FUNC #endif /* !BASE_DEF */
#define FT_EXPORT_FUNC( x ) extern x
#ifndef BASE_FUNC
#ifdef __cplusplus
#define BASE_FUNC( x ) extern "C" x
#else
#define BASE_FUNC( x ) extern x
#endif #endif
#ifndef FT_EXPORT_VAR #endif /* !BASE_FUNC */
#define FT_EXPORT_VAR( x ) extern x
#ifndef FT_EXPORT_DEF
#ifdef __cplusplus
#define FT_EXPORT_DEF( x ) extern "C" x
#else
#define FT_EXPORT_DEF( x ) extern x
#endif #endif
#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 #ifdef __cplusplus
} }

View File

@ -92,7 +92,7 @@
/* <Return> */ /* <Return> */
/* block :: The address of newly allocated block. */ /* block :: The address of newly allocated block. */
/* */ /* */
static LOCAL_FUNC_X
void* ft_alloc( FT_Memory memory, void* ft_alloc( FT_Memory memory,
long size ) long size )
{ {
@ -122,7 +122,7 @@
/* <Return> */ /* <Return> */
/* The address of the reallocated memory block. */ /* The address of the reallocated memory block. */
/* */ /* */
static LOCAL_FUNC_X
void* ft_realloc( FT_Memory memory, void* ft_realloc( FT_Memory memory,
long cur_size, long cur_size,
long new_size, long new_size,
@ -148,7 +148,7 @@
/* */ /* */
/* block :: The address of block in memory to be freed. */ /* block :: The address of block in memory to be freed. */
/* */ /* */
static LOCAL_FUNC_X
void ft_free( FT_Memory memory, void ft_free( FT_Memory memory,
void* block ) void* block )
{ {
@ -190,7 +190,7 @@
/* <Input> */ /* <Input> */
/* stream :: A pointer to the stream object. */ /* stream :: A pointer to the stream object. */
/* */ /* */
static LOCAL_FUNC_X
void ft_close_stream( FT_Stream stream ) void ft_close_stream( FT_Stream stream )
{ {
munmap( (MUNMAP_ARG_CAST)stream->descriptor.pointer, stream->size ); munmap( (MUNMAP_ARG_CAST)stream->descriptor.pointer, stream->size );

View File

@ -231,6 +231,27 @@
#endif /* !FT_EXPORT_VAR */ #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 #ifdef __cplusplus
} }
#endif #endif

View File

@ -55,7 +55,7 @@
} }
static LOCAL_FUNC_X
FT_Error ft_autohinter_load( FT_AutoHinter module, FT_Error ft_autohinter_load( FT_AutoHinter module,
FT_GlyphSlot slot, FT_GlyphSlot slot,
FT_Size size, FT_Size size,
@ -67,7 +67,7 @@
} }
static LOCAL_FUNC_X
void ft_autohinter_reset( FT_AutoHinter module, void ft_autohinter_reset( FT_AutoHinter module,
FT_Face face ) FT_Face face )
{ {
@ -78,7 +78,7 @@
} }
static LOCAL_FUNC_X
void ft_autohinter_get_globals( FT_AutoHinter module, void ft_autohinter_get_globals( FT_AutoHinter module,
FT_Face face, FT_Face face,
void** global_hints, void** global_hints,
@ -89,7 +89,7 @@
} }
static LOCAL_FUNC_X
void ft_autohinter_done_globals( FT_AutoHinter module, void ft_autohinter_done_globals( FT_AutoHinter module,
void* global_hints ) 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, ft_module_hinter,
sizeof ( FT_AutoHinterRec ), sizeof ( FT_AutoHinterRec ),

View File

@ -302,7 +302,7 @@
/* The FT_DriverInterface structure is defined in ftdriver.h. */ /* 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 */ /* begin with the FT_Module_Class fields */
{ {

View File

@ -163,7 +163,7 @@
} }
static LOCAL_FUNC_X
FT_Error parse_font_bbox( CID_Face face, FT_Error parse_font_bbox( CID_Face face,
CID_Parser* parser ) CID_Parser* parser )
{ {
@ -182,7 +182,7 @@
} }
static LOCAL_FUNC_X
FT_Error parse_font_matrix( CID_Face face, FT_Error parse_font_matrix( CID_Face face,
CID_Parser* parser ) CID_Parser* parser )
{ {
@ -208,7 +208,7 @@
} }
static LOCAL_FUNC_X
FT_Error parse_fd_array( CID_Face face, FT_Error parse_fd_array( CID_Face face,
CID_Parser* parser ) CID_Parser* parser )
{ {

View File

@ -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 */ /* first of all, the FT_Module_Class fields */
{ {

View File

@ -139,7 +139,7 @@
/* qsort callback to sort the unicode map */ /* qsort callback to sort the unicode map */
static LOCAL_FUNC_X
int compare_uni_maps( const void* a, int compare_uni_maps( const void* a,
const void* b ) const void* b )
{ {
@ -296,7 +296,7 @@
#endif /* !FT_CONFIG_OPTION_NO_POSTSCRIPT_NAMES */ #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 */ 0, /* this is not a font driver, nor a renderer */
sizeof( FT_ModuleRec ), sizeof( FT_ModuleRec ),

View File

@ -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, ft_module_renderer,
@ -245,7 +245,7 @@
/* to register it by hand in your application. It should only be */ /* to register it by hand in your application. It should only be */
/* used for backwards-compatibility with FT 1.x anyway. */ /* 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, ft_module_renderer,

View File

@ -122,7 +122,7 @@
#endif /* TT_CONFIG_OPTION_POSTSCRIPT_NAMES */ #endif /* TT_CONFIG_OPTION_POSTSCRIPT_NAMES */
static LOCAL_FUNC_X
FT_Module_Interface SFNT_Get_Interface( FT_Module module, FT_Module_Interface SFNT_Get_Interface( FT_Module module,
const char* interface ) 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 */ 0, /* not a font driver or renderer */
sizeof( FT_ModuleRec ), sizeof( FT_ModuleRec ),

View File

@ -43,14 +43,14 @@
#define FT_COMPONENT trace_ttcmap #define FT_COMPONENT trace_ttcmap
static FT_UInt code_to_index0( TT_CMapTable* charmap, LOCAL_FUNC_X FT_UInt code_to_index0( TT_CMapTable* charmap,
FT_ULong char_code ); FT_ULong char_code );
static FT_UInt code_to_index2( TT_CMapTable* charmap, LOCAL_FUNC_X FT_UInt code_to_index2( TT_CMapTable* charmap,
FT_ULong char_code ); FT_ULong char_code );
static FT_UInt code_to_index4( TT_CMapTable* charmap, LOCAL_FUNC_X FT_UInt code_to_index4( TT_CMapTable* charmap,
FT_ULong char_code ); FT_ULong char_code );
static FT_UInt code_to_index6( TT_CMapTable* charmap, LOCAL_FUNC_X FT_UInt code_to_index6( TT_CMapTable* charmap,
FT_ULong char_code ); FT_ULong char_code );
/*************************************************************************/ /*************************************************************************/
@ -355,7 +355,7 @@
/* <Return> */ /* <Return> */
/* Glyph index into the glyphs array. 0 if the glyph does not exist. */ /* 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_UInt code_to_index0( TT_CMapTable* cmap,
FT_ULong charCode ) FT_ULong charCode )
{ {
@ -381,7 +381,7 @@
/* <Return> */ /* <Return> */
/* Glyph index into the glyphs array. 0 if the glyph does not exist. */ /* 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_UInt code_to_index2( TT_CMapTable* cmap,
FT_ULong charCode ) FT_ULong charCode )
{ {
@ -445,7 +445,7 @@
/* <Return> */ /* <Return> */
/* Glyph index into the glyphs array. 0 if the glyph does not exist. */ /* 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_UInt code_to_index4( TT_CMapTable* cmap,
FT_ULong charCode ) FT_ULong charCode )
{ {
@ -528,7 +528,7 @@
/* <Return> */ /* <Return> */
/* Glyph index into the glyphs array. 0 if the glyph does not exist. */ /* 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_UInt code_to_index6( TT_CMapTable* cmap,
FT_ULong charCode ) FT_ULong charCode )
{ {

View File

@ -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, ft_module_renderer,

View File

@ -430,7 +430,7 @@
/* The FT_DriverInterface structure is defined in ftdriver.h. */ /* 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 | ft_module_font_driver |

View File

@ -207,7 +207,7 @@
/* */ /* */
/*************************************************************************/ /*************************************************************************/
static LOCAL_FUNC_X
FT_Error TT_Access_Glyph_Frame( TT_Loader* loader, FT_Error TT_Access_Glyph_Frame( TT_Loader* loader,
FT_UInt glyph_index, FT_UInt glyph_index,
FT_ULong offset, FT_ULong offset,
@ -227,7 +227,7 @@
} }
static LOCAL_FUNC_X
void TT_Forget_Glyph_Frame( TT_Loader* loader ) void TT_Forget_Glyph_Frame( TT_Loader* loader )
{ {
FT_Stream stream = loader->stream; FT_Stream stream = loader->stream;
@ -237,7 +237,7 @@
} }
static LOCAL_FUNC_X
FT_Error TT_Load_Glyph_Header( TT_Loader* loader ) FT_Error TT_Load_Glyph_Header( TT_Loader* loader )
{ {
FT_Stream stream = loader->stream; FT_Stream stream = loader->stream;
@ -260,7 +260,7 @@
} }
static LOCAL_FUNC_X
FT_Error TT_Load_Simple_Glyph( TT_Loader* load ) FT_Error TT_Load_Simple_Glyph( TT_Loader* load )
{ {
FT_Error error; FT_Error error;
@ -419,7 +419,7 @@
} }
static LOCAL_FUNC_X
FT_Error TT_Load_Composite_Glyph( TT_Loader* loader ) FT_Error TT_Load_Composite_Glyph( TT_Loader* loader )
{ {
FT_Error error; FT_Error error;

View File

@ -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, ft_module_font_driver | ft_module_driver_scalable,

View File

@ -149,7 +149,7 @@
/* compare two kerning pairs */ /* compare two kerning pairs */
static LOCAL_FUNC_X
int compare_kern_pairs( const void* a, int compare_kern_pairs( const void* a,
const void* b ) const void* b )
{ {

View File

@ -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, ft_module_font_driver | ft_module_driver_scalable,

View File

@ -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, ft_module_font_driver,