Introducing new macro LOCA_VAR to solve some problems with structures

containing function pointers.

FT will now compile again with C++.
This commit is contained in:
Werner Lemberg 2000-08-29 16:50:01 +00:00
parent 80b96f350c
commit 4e9dae68b7
12 changed files with 93 additions and 81 deletions

View File

@ -138,7 +138,6 @@
#else
/*************************************************************************/
/* */
/* Many compilers provide the non-ANSI `long long' 64-bit type. You can */
@ -176,6 +175,13 @@
#endif /* FT_MAKE_OPTION_SINGLE_OBJECT */
#ifdef __cplusplus
#define LOCAL_VAR extern "C"
#else
#define LOCAL_VAR extern
#endif
#ifndef BASE_DEF
#ifdef __cplusplus

28
src/cache/ftcimage.c vendored
View File

@ -22,6 +22,7 @@
#include <freetype/internal/ftlist.h>
#include <freetype/fterrors.h>
/**************************************************************************/
/**************************************************************************/
/***** *****/
@ -74,7 +75,7 @@
/*************************************************************************/
static
LOCAL_FUNC_X
void ftc_done_glyph_image( FTC_Image_Queue queue,
FTC_ImageNode node )
{
@ -84,7 +85,7 @@
}
static
LOCAL_FUNC_X
FT_ULong ftc_size_bitmap_image( FTC_Image_Queue queue,
FTC_ImageNode node )
{
@ -103,7 +104,7 @@
}
static
LOCAL_FUNC_X
FT_ULong ftc_size_outline_image( FTC_Image_Queue queue,
FTC_ImageNode node )
{
@ -123,7 +124,7 @@
}
static
LOCAL_FUNC_X
FT_Error ftc_init_glyph_image( FTC_Image_Queue queue,
FTC_ImageNode node )
{
@ -131,6 +132,7 @@
FT_Size size;
FT_Error error;
error = FTC_Manager_Lookup_Size( queue->manager,
&queue->descriptor.size,
&face, &size );
@ -187,19 +189,14 @@
}
static
const FTC_Image_Class ftc_bitmap_image_class =
FT_CPLUSPLUS( const FTC_Image_Class ) ftc_bitmap_image_class =
{
ftc_init_glyph_image,
ftc_done_glyph_image,
ftc_size_bitmap_image
};
static
const FTC_Image_Class ftc_outline_image_class =
FT_CPLUSPLUS( const FTC_Image_Class ) ftc_outline_image_class =
{
ftc_init_glyph_image,
ftc_done_glyph_image,
@ -381,7 +378,7 @@
( (FTC_Image_Queue)(node)->root.data )
static
LOCAL_FUNC_X
FT_Error ftc_image_cache_init_queue( FT_Lru lru,
FT_LruNode node )
{
@ -403,7 +400,7 @@
}
static
LOCAL_FUNC_X
void ftc_image_cache_done_queue( FT_Lru lru,
FT_LruNode node )
{
@ -416,7 +413,7 @@
}
static
LOCAL_FUNC_X
FT_Bool ftc_image_cache_compare_queue( FT_LruNode node,
FT_LruKey key )
{
@ -432,8 +429,7 @@
}
static
const FT_Lru_Class ftc_image_queue_lru_class =
FT_CPLUSPLUS( const FT_Lru_Class ) ftc_image_queue_lru_class =
{
sizeof( FT_LruRec ),
ftc_image_cache_init_queue,

29
src/cache/ftcmanag.c vendored
View File

@ -23,15 +23,16 @@
#define FTC_LRU_GET_MANAGER( lru ) (FTC_Manager)lru->user_data
/**************************************************************************/
/**************************************************************************/
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** FACE & SIZE LRU CALLBACKS *****/
/***** *****/
/**************************************************************************/
/**************************************************************************/
/*************************************************************************/
/*************************************************************************/
static
LOCAL_FUNC_X
FT_Error ftc_manager_init_face( FT_Lru lru,
FT_LruNode node )
{
@ -57,7 +58,7 @@
/* helper function for ftc_manager_done_face */
static
LOCAL_FUNC_X
FT_Bool ftc_manager_size_selector( FT_Lru lru,
FT_LruNode node,
FT_Pointer data )
@ -68,7 +69,7 @@
}
static
LOCAL_FUNC_X
void ftc_manager_done_face( FT_Lru lru,
FT_LruNode node )
{
@ -97,7 +98,7 @@
} FTC_SizeRequest;
static
LOCAL_FUNC_X
FT_Error ftc_manager_init_size( FT_Lru lru,
FT_LruNode node )
{
@ -126,7 +127,7 @@
}
static
LOCAL_FUNC_X
void ftc_manager_done_size( FT_Lru lru,
FT_LruNode node )
{
@ -136,7 +137,7 @@
}
static
LOCAL_FUNC_X
FT_Error ftc_manager_flush_size( FT_Lru lru,
FT_LruNode node,
FT_LruKey key )
@ -163,7 +164,7 @@
}
static
LOCAL_FUNC_X
FT_Bool ftc_manager_compare_size( FT_LruNode node,
FT_LruKey key )
{
@ -179,8 +180,7 @@
}
static
const FT_Lru_Class ftc_face_lru_class =
FT_CPLUSPLUS( const FT_Lru_Class ) ftc_face_lru_class =
{
sizeof ( FT_LruRec ),
ftc_manager_init_face,
@ -190,8 +190,7 @@
};
static
const FT_Lru_Class ftc_size_lru_class =
FT_CPLUSPLUS( const FT_Lru_Class ) ftc_size_lru_class =
{
sizeof ( FT_LruRec ),
ftc_manager_init_size,

View File

@ -44,7 +44,7 @@
#define FT_COMPONENT trace_cidgload
static
LOCAL_FUNC_X
FT_Error cid_load_glyph( T1_Decoder* decoder,
FT_UInt glyph_index )
{

View File

@ -283,7 +283,7 @@
T1_FIELD_CALLBACK( "FontBBox", parse_font_bbox )
T1_FIELD_CALLBACK( "FDArray", parse_fd_array )
T1_FIELD_CALLBACK( "FontMatrix", parse_font_matrix )
{ 0, 0, 0, 0, 0, 0, 0, 0 }
{ 0, t1_field_cid_info, t1_field_none, 0, 0, 0, 0, 0 }
};

View File

@ -21,8 +21,7 @@
#include <psaux/t1decode.h>
LOCAL_FUNC
const PS_Table_Funcs ps_table_funcs =
FT_CPLUSPLUS( const PS_Table_Funcs ) ps_table_funcs =
{
PS_Table_New,
PS_Table_Done,
@ -31,8 +30,7 @@
};
LOCAL_FUNC
const T1_Parser_Funcs t1_parser_funcs =
FT_CPLUSPLUS( const T1_Parser_Funcs ) t1_parser_funcs =
{
T1_Init_Parser,
T1_Done_Parser,
@ -49,8 +47,7 @@
};
LOCAL_FUNC
const T1_Builder_Funcs t1_builder_funcs =
FT_CPLUSPLUS( const T1_Builder_Funcs ) t1_builder_funcs =
{
T1_Builder_Init,
T1_Builder_Done,
@ -63,8 +60,7 @@
};
LOCAL_FUNC
const T1_Decoder_Funcs t1_decoder_funcs =
FT_CPLUSPLUS( const T1_Decoder_Funcs ) t1_decoder_funcs =
{
T1_Decoder_Init,
T1_Decoder_Done,

View File

@ -216,7 +216,8 @@
if ( !old_base )
return;
(void)REALLOC( table->block, table->capacity, table->cursor );
if ( REALLOC( table->block, table->capacity, table->cursor ) )
return;
table->capacity = table->cursor;
if ( old_base != table->block )

View File

@ -35,15 +35,17 @@
/*************************************************************************/
/*************************************************************************/
LOCAL_DEF
LOCAL_VAR
const PS_Table_Funcs ps_table_funcs;
LOCAL_DEF
LOCAL_VAR
const T1_Parser_Funcs t1_parser_funcs;
LOCAL_DEF
LOCAL_VAR
const T1_Builder_Funcs t1_builder_funcs;
LOCAL_DEF
FT_Error PS_Table_New( PS_Table* table,
FT_Int count,

View File

@ -21,6 +21,7 @@
#include <freetype/internal/ftdebug.h> /* for FT_ERROR() */
#include <freetype/internal/t1errors.h>
#include <freetype/ftoutln.h>
#include <freetype/internal/ftdebug.h>
/*************************************************************************/
@ -310,7 +311,7 @@
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
LOCAL_FUNC
LOCAL_FUNC_X
FT_Error T1_Decoder_Parse_Charstrings( T1_Decoder* decoder,
FT_Byte* charstring_base,
FT_UInt charstring_len )
@ -1011,7 +1012,7 @@
}
LOCAL_FUNC
LOCAL_FUNC_X
FT_Error T1_Decoder_Init( T1_Decoder* decoder,
FT_Face face,
FT_Size size,
@ -1051,7 +1052,7 @@
}
LOCAL_FUNC
LOCAL_FUNC_X
void T1_Decoder_Done( T1_Decoder* decoder )
{
T1_Builder_Done( &decoder->builder );

View File

@ -24,9 +24,15 @@
#include <freetype/internal/t1types.h>
LOCAL_DEF
#ifdef __cplusplus
extern "C" {
#endif
LOCAL_VAR
const T1_Decoder_Funcs t1_decoder_funcs;
LOCAL_DEF
FT_Error T1_Decoder_Parse_Glyph( T1_Decoder* decoder,
FT_UInt glyph_index );
@ -49,6 +55,11 @@
void T1_Decoder_Done( T1_Decoder* decoder );
#ifdef __cplusplus
}
#endif
#endif /* T1DECODE_H */

View File

@ -1299,7 +1299,7 @@
T1_FIELD_CALLBACK( "shareddict", parse_shared_dict )
#endif
{ 0,0,0,0, 0,0,0,0 }
{ 0, t1_field_cid_info, t1_field_none, 0, 0, 0, 0, 0 }
};