From bfe2f98f1f352135da49f19dc0819607af27b8a0 Mon Sep 17 00:00:00 2001 From: David Turner Date: Fri, 12 May 2000 12:17:15 +0000 Subject: [PATCH] a new massive grunt work. Redefined the EXPORT_DEF, EXPORT_FUNC, BASE_DEF and BASE_FUNC macros to let them take an argument.. This is needed to compile the library as a DLL on some platforms that have different compiler conventions.. --- CHANGES | 38 +- demos/src/ftrast2.h | 7 +- include/freetype/config/ftconfig.h | 16 +- include/freetype/freetype.h | 225 ++++----- include/freetype/ftbbox.h | 5 +- include/freetype/ftglyph.h | 37 +- include/freetype/ftgrays.h | 6 +- include/freetype/ftraster.h | 7 +- include/freetype/internal/ftcalc.h | 20 +- include/freetype/internal/ftdebug.h | 9 +- include/freetype/internal/ftextend.h | 12 +- include/freetype/internal/ftlist.h | 41 +- include/freetype/internal/ftobjs.h | 106 ++-- include/freetype/internal/ftstream.h | 88 ++-- include/freetype/tttables.h | 5 +- src/base/ftcalc.c | 62 +-- src/base/ftdebug.c | 9 +- src/base/ftextend.c | 12 +- src/base/ftglyph.c | 37 +- src/base/ftinit.c | 6 +- src/base/ftlist.c | 41 +- src/base/ftobjs.c | 190 +++---- src/base/ftoutln.c | 264 ++-------- src/base/ftstream.c | 85 ++-- src/base/ftsystem.c | 11 +- src/psnames/psdriver.c | 2 - src/psnames/psdriver.h | 4 +- src/sfnt/sfdriver.c | 1 - src/sfnt/sfdriver.h | 3 +- src/sfnt/ttload.c | 4 +- src/sfnt/ttload.h | 2 +- src/sfnt/ttpost.c | 2 +- src/sfnt/ttpost.h | 2 +- src/truetype/ttdriver.c | 3 +- src/truetype/ttdriver.h | 3 +- src/truetype/ttinterp.c | 709 +-------------------------- src/truetype/ttinterp.h | 16 +- src/type1/t1driver.c | 4 +- src/type1/t1driver.h | 3 +- src/type1/t1gload.c | 8 +- src/type1/t1gload.h | 8 +- src/type1z/t1driver.c | 4 +- src/type1z/t1driver.h | 3 +- src/type1z/t1gload.c | 2 +- 44 files changed, 549 insertions(+), 1573 deletions(-) diff --git a/CHANGES b/CHANGES index 0aa3394ae..7a471a2fe 100644 --- a/CHANGES +++ b/CHANGES @@ -1,10 +1,46 @@ LATEST CHANGES - + - yet another massive grunt work. I've changed the definition of the + EXPORT_DEF, EXPORT_FUNC, BASE_DEF & BASE_FUNC macros. These now take + an argument, which is the function's return value type. + + This is necessary to compile FreeType as a DLL on Windows and OS/2. + Depending on the compiler used, a compiler-specific keyword like __export + or __system must be placed before (VisualC++) or after (BorlandC++) + the type.. + + Of course, this needed a lot of changes throughout the source code + to make it compile again... All cleaned up now, apparently.. + + Note also that there is a new EXPORT_VAR macro defined to allow the + _declaration_ of an exportable public (constant) variable. This is the + case of the raster interfaces (see ftraster.h and ftgrays.h), as well + as each module's interface (see sfdriver.h, psdriver.h, etc..) + + - new feature: it is now possible to pass extra parameters to font + drivers when creating a new face object. For now, this + capability is unused. It could however prove to be useful + in a near future.. + + the FT_Open_Args structure was changes, as well as the internal + driver interface (the specific "init_face" module function has now + a different signature). + + - updated the tutorial (not finished though). + + - added the declaration of FT_New_Memory_Face in , as + it was missing from the public header (the implementation was already + in "ftobjs.c"). + + - the file has been seriously updated in order to + allow the automatic generation of error message tables. See the comments + within it for more information. + - major directory hierarchy re-organisation. This was done for two things: * first, to ease the "manual" compilation of the library by requiring at lot less include paths :-) - + * second, to allow external programs to effectively access internal data fields. For example, this can be extremely useful if someone wants to write a font producer or a font manager on top of FreeType. diff --git a/demos/src/ftrast2.h b/demos/src/ftrast2.h index a0b26b683..54342d9a2 100644 --- a/demos/src/ftrast2.h +++ b/demos/src/ftrast2.h @@ -25,12 +25,11 @@ extern "C" { #endif -#ifndef EXPORT_DEF -#define EXPORT_DEF /* nothing */ +#ifndef EXPORT_VAR +#define EXPORT_VAR(x) extern x #endif - EXPORT_DEF - FT_Raster_Funcs ft_black2_raster; + EXPORT_VAR(FT_Raster_Funcs) ft_black2_raster; #ifdef __cplusplus } diff --git a/include/freetype/config/ftconfig.h b/include/freetype/config/ftconfig.h index 7db5818ae..55c2e9082 100644 --- a/include/freetype/config/ftconfig.h +++ b/include/freetype/config/ftconfig.h @@ -165,19 +165,23 @@ #endif #ifdef FT_MAKE_OPTION_SINGLE_LIBRARY_OBJECT -#define BASE_DEF LOCAL_DEF -#define BASE_FUNC LOCAL_FUNC +#define BASE_DEF(x) static x +#define BASE_FUNC(x) static x #else -#define BASE_DEF extern -#define BASE_FUNC /* nothing */ +#define BASE_DEF(x) extern x +#define BASE_FUNC(x) extern x /* nothing */ #endif #ifndef EXPORT_DEF -#define EXPORT_DEF extern +#define EXPORT_DEF(x) extern x #endif #ifndef EXPORT_FUNC -#define EXPORT_FUNC /* nothing */ +#define EXPORT_FUNC(x) extern x +#endif + +#ifndef EXPORT_VAR +#define EXPORT_VAR(x) extern x #endif #endif /* FTCONFIG_H */ diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h index 3ebff27c0..8b651ace7 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -49,7 +49,7 @@ /* necessary to compile the library as a DLL. */ /* */ #ifndef EXPORT_DEF -#define EXPORT_DEF extern +#define EXPORT_DEF(x) extern x #endif #include @@ -1352,8 +1352,7 @@ /* */ /* Error code. 0 means success. */ /* */ - EXPORT_DEF - FT_Error FT_Init_FreeType( FT_Library* library ); + EXPORT_DEF(FT_Error) FT_Init_FreeType( FT_Library* library ); /*************************************************************************/ @@ -1371,8 +1370,7 @@ /* */ /* Error code. 0 means success. */ /* */ - EXPORT_DEF - FT_Error FT_Done_FreeType( FT_Library library ); + EXPORT_DEF(FT_Error) FT_Done_FreeType( FT_Library library ); /*************************************************************************/ @@ -1519,11 +1517,10 @@ /* through the FT_New_GlyphSlot() API function. Slots are linked in */ /* a single list through their `next' field. */ /* */ - EXPORT_DEF - FT_Error FT_New_Face( FT_Library library, - const char* filepathname, - FT_Long face_index, - FT_Face* face ); + EXPORT_DEF(FT_Error) FT_New_Face( FT_Library library, + const char* filepathname, + FT_Long face_index, + FT_Face* face ); /*************************************************************************/ @@ -1564,12 +1561,11 @@ /* `*face'. Its return value should be 0 if the resource is */ /* recognized, or non-zero if not. */ /* */ - EXPORT_DEF - FT_Error FT_New_Memory_Face( FT_Library library, - void* file_base, - FT_Long file_size, - FT_Long face_index, - FT_Face* face ); + EXPORT_DEF(FT_Error) FT_New_Memory_Face( FT_Library library, + void* file_base, + FT_Long file_size, + FT_Long face_index, + FT_Face* face ); /*************************************************************************/ @@ -1607,11 +1603,10 @@ /* when the face is destroyed. This means calling the stream's */ /* "close" function. */ /* */ - EXPORT_DEF - FT_Error FT_Open_Face( FT_Library library, - FT_Open_Args* args, - FT_Long face_index, - FT_Face* face ); + EXPORT_DEF(FT_Error) FT_Open_Face( FT_Library library, + FT_Open_Args* args, + FT_Long face_index, + FT_Face* face ); /*************************************************************************/ @@ -1645,9 +1640,8 @@ /* when invoking this function. Most drivers simply do not implement */ /* file attachments.. */ /* */ - EXPORT_DEF - FT_Error FT_Attach_File( FT_Face face, - const char* filepathname ); + EXPORT_DEF(FT_Error) FT_Attach_File( FT_Face face, + const char* filepathname ); /*************************************************************************/ /* */ @@ -1674,9 +1668,8 @@ /* when invoking this function. Most drivers simply do not implement */ /* file attachments.. */ /* */ - EXPORT_DEF - FT_Error FT_Attach_Stream( FT_Face face, - FT_Open_Args* parameters ); + EXPORT_DEF(FT_Error) FT_Attach_Stream( FT_Face face, + FT_Open_Args* parameters ); /*************************************************************************/ @@ -1694,8 +1687,7 @@ /* */ /* Error code. 0 means success. */ /* */ - EXPORT_DEF - FT_Error FT_Done_Face( FT_Face face ); + EXPORT_DEF(FT_Error) FT_Done_Face( FT_Face face ); /*************************************************************************/ @@ -1719,12 +1711,11 @@ /* When dealing with fixed-size faces (i.e., non-scalable formats), */ /* use the function FT_Set_Pixel_Sizes(). */ /* */ - EXPORT_DEF - FT_Error FT_Set_Char_Size( FT_Face face, - FT_F26Dot6 char_width, - FT_F26Dot6 char_height, - FT_UInt horz_resolution, - FT_UInt vert_resolution ); + EXPORT_DEF(FT_Error) FT_Set_Char_Size( FT_Face face, + FT_F26Dot6 char_width, + FT_F26Dot6 char_height, + FT_UInt horz_resolution, + FT_UInt vert_resolution ); /*************************************************************************/ @@ -1744,10 +1735,9 @@ /* */ /* Error code. 0 means success. */ /* */ - EXPORT_DEF - FT_Error FT_Set_Pixel_Sizes( FT_Face face, - FT_UInt pixel_width, - FT_UInt pixel_height ); + EXPORT_DEF(FT_Error) FT_Set_Pixel_Sizes( FT_Face face, + FT_UInt pixel_width, + FT_UInt pixel_height ); /*************************************************************************/ @@ -1774,10 +1764,9 @@ /* */ /* FreeType error code. 0 means success. */ /* */ - EXPORT_DEF - FT_Error FT_Load_Glyph( FT_Face face, - FT_UInt glyph_index, - FT_Int load_flags ); + EXPORT_DEF(FT_Error) FT_Load_Glyph( FT_Face face, + FT_UInt glyph_index, + FT_Int load_flags ); /*************************************************************************/ @@ -1809,10 +1798,9 @@ /* is not defined in the charmap, this function will return an */ /* error.. */ /* */ - EXPORT_DEF - FT_Error FT_Load_Char( FT_Face face, - FT_ULong char_code, - FT_Int load_flags ); + EXPORT_DEF(FT_Error) FT_Load_Char( FT_Face face, + FT_ULong char_code, + FT_Int load_flags ); /*************************************************************************/ /* */ @@ -1988,24 +1976,21 @@ /* kernings, are out of the scope of this API function -- they can be */ /* implemented through format-specific interfaces. */ /* */ - EXPORT_DEF - FT_Error FT_Get_Kerning( FT_Face face, - FT_UInt left_glyph, - FT_UInt right_glyph, - FT_Vector* kerning ); + EXPORT_DEF(FT_Error) FT_Get_Kerning( FT_Face face, + FT_UInt left_glyph, + FT_UInt right_glyph, + FT_Vector* kerning ); /* XXX : Not implemented yet, but should come soon */ #if 0 - EXPORT_DEF - FT_Error FT_Select_Charmap( FT_Face face, - FT_Encoding encoding ); + EXPORT_DEF(FT_Error) FT_Select_Charmap( FT_Face face, + FT_Encoding encoding ); - EXPORT_DEF - FT_Error FT_Set_Charmap( FT_Face face, - FT_CharMap charmap ); + EXPORT_DEF(FT_Error) FT_Error FT_Set_Charmap( FT_Face face, + FT_CharMap charmap ); #endif /*************************************************************************/ @@ -2024,9 +2009,8 @@ /* */ /* The glyph index. 0 means `undefined character code'. */ /* */ - EXPORT_DEF - FT_UInt FT_Get_Char_Index( FT_Face face, - FT_ULong charcode ); + EXPORT_DEF(FT_UInt) FT_Get_Char_Index( FT_Face face, + FT_ULong charcode ); /*************************************************************************/ @@ -2052,10 +2036,9 @@ /* divide by zero, it simply returns `MaxInt' or `MinInt' depending */ /* on the signs of `a' and `b'. */ /* */ - EXPORT_DEF - FT_Long FT_MulDiv( FT_Long a, - FT_Long b, - FT_Long c ); + EXPORT_DEF(FT_Long) FT_MulDiv( FT_Long a, + FT_Long b, + FT_Long c ); /*************************************************************************/ @@ -2087,9 +2070,8 @@ /* _second_ argument of this function; this can make a great */ /* difference. */ /* */ - EXPORT_DEF - FT_Long FT_MulFix( FT_Long a, - FT_Long b ); + EXPORT_DEF(FT_Long) FT_MulFix( FT_Long a, + FT_Long b ); /*************************************************************************/ @@ -2115,9 +2097,8 @@ /* in 32 bits, then the division is computed directly. Otherwise, */ /* we use a specialised version of the old FT_MulDiv64 */ /* */ - EXPORT_DEF - FT_Long FT_DivFix( FT_Long a, - FT_Long b ); + EXPORT_DEF(FT_Long) FT_DivFix( FT_Long a, + FT_Long b ); /*************************************************************************/ @@ -2148,10 +2129,9 @@ /* */ /* It will use the raster correponding to the default glyph format. */ /* */ - EXPORT_DEF - FT_Error FT_Outline_Get_Bitmap( FT_Library library, - FT_Outline* outline, - FT_Bitmap* map ); + EXPORT_DEF(FT_Error) FT_Outline_Get_Bitmap( FT_Library library, + FT_Outline* outline, + FT_Bitmap* map ); /*************************************************************************/ /* */ @@ -2184,10 +2164,9 @@ /* scan converter is called, which means that the value you give it */ /* is actually ignored.. */ /* */ - EXPORT_DEF - FT_Error FT_Outline_Render( FT_Library library, - FT_Outline* outline, - FT_Raster_Params* params ); + EXPORT_DEF(FT_Error) FT_Outline_Render( FT_Library library, + FT_Outline* outline, + FT_Raster_Params* params ); /*************************************************************************/ /* */ @@ -2213,10 +2192,9 @@ /* */ /* Error code. 0 means sucess. */ /* */ - EXPORT_DEF - int FT_Outline_Decompose( FT_Outline* outline, - FT_Outline_Funcs* funcs, - void* user ); + EXPORT_DEF(int) FT_Outline_Decompose( FT_Outline* outline, + FT_Outline_Funcs* funcs, + void* user ); /*************************************************************************/ @@ -2253,11 +2231,10 @@ /* code of this function, replacing allocations with `malloc()' if */ /* you want to control where the objects go. */ /* */ - EXPORT_DEF - FT_Error FT_Outline_New( FT_Library library, - FT_UInt numPoints, - FT_Int numContours, - FT_Outline* outline ); + EXPORT_DEF(FT_Error) FT_Outline_New( FT_Library library, + FT_UInt numPoints, + FT_Int numContours, + FT_Outline* outline ); /*************************************************************************/ @@ -2289,9 +2266,8 @@ /* of this function, replacing allocations with `malloc()' in your */ /* application if you want something simpler. */ /* */ - EXPORT_DEF - FT_Error FT_Outline_Done( FT_Library library, - FT_Outline* outline ); + EXPORT_DEF(FT_Error) FT_Outline_Done( FT_Library library, + FT_Outline* outline ); /*************************************************************************/ /* */ @@ -2319,9 +2295,8 @@ /* */ /* Yes. */ /* */ - EXPORT_DEF - void FT_Outline_Get_CBox( FT_Outline* outline, - FT_BBox* cbox ); + EXPORT_DEF(void) FT_Outline_Get_CBox( FT_Outline* outline, + FT_BBox* cbox ); /*************************************************************************/ @@ -2340,10 +2315,9 @@ /* */ /* Yes. */ /* */ - EXPORT_DEF - void FT_Outline_Translate( FT_Outline* outline, - FT_Pos xOffset, - FT_Pos yOffset ); + EXPORT_DEF(void) FT_Outline_Translate( FT_Outline* outline, + FT_Pos xOffset, + FT_Pos yOffset ); /*************************************************************************/ @@ -2372,9 +2346,8 @@ /* */ /* - the new raster is registered for the glyph format */ /* */ - EXPORT_DEF - FT_Error FT_Set_Raster( FT_Library library, - FT_Raster_Funcs* raster_funcs ); + EXPORT_DEF(FT_Error) FT_Set_Raster( FT_Library library, + FT_Raster_Funcs* raster_funcs ); /*************************************************************************/ @@ -2397,9 +2370,8 @@ /* as FT_Set_Raster unregisters the previous raster for a given */ /* glyph format.. */ /* */ - EXPORT_DEF - FT_Error FT_Unset_Raster( FT_Library library, - FT_Raster_Funcs* raster_funcs ); + EXPORT_DEF(FT_Error) FT_Unset_Raster( FT_Library library, + FT_Raster_Funcs* raster_funcs ); /************************************************************************* @@ -2424,10 +2396,9 @@ * *************************************************************************/ - EXPORT_DEF - FT_Raster FT_Get_Raster( FT_Library library, - FT_Glyph_Format glyph_format, - FT_Raster_Funcs *raster_funcs ); + EXPORT_DEF(FT_Raster) FT_Get_Raster( FT_Library library, + FT_Glyph_Format glyph_format, + FT_Raster_Funcs *raster_funcs ); /*************************************************************************/ @@ -2446,11 +2417,10 @@ /* */ /* Error code. 0 means success. */ /* */ - EXPORT_DEF - FT_Error FT_Set_Raster_Mode( FT_Library library, - FT_Glyph_Format format, - unsigned long mode, - void* args ); + EXPORT_DEF(FT_Error) FT_Set_Raster_Mode( FT_Library library, + FT_Glyph_Format format, + unsigned long mode, + void* args ); /***************************************************************************/ @@ -2486,9 +2456,8 @@ /* */ /* FreeType error code. 0 means success. */ /* */ - EXPORT_DEF - FT_Error FT_Outline_Copy( FT_Outline* source, - FT_Outline* target ); + EXPORT_DEF(FT_Error) FT_Outline_Copy( FT_Outline* source, + FT_Outline* target ); @@ -2512,9 +2481,8 @@ /* You can use FT_Outline_Translate() if you need to translate the */ /* outline's points. */ /* */ - EXPORT_DEF - void FT_Outline_Transform( FT_Outline* outline, - FT_Matrix* matrix ); + EXPORT_DEF(void) FT_Outline_Transform( FT_Outline* outline, + FT_Matrix* matrix ); /*************************************************************************/ /* */ @@ -2535,8 +2503,7 @@ /* It shouldn't be used by a normal client application, unless it */ /* knows what it's doing.. */ /* */ - EXPORT_DEF - void FT_Outline_Reverse( FT_Outline* outline ); + EXPORT_DEF(void) FT_Outline_Reverse( FT_Outline* outline ); /*************************************************************************/ @@ -2556,9 +2523,8 @@ /* */ /* Yes. */ /* */ - EXPORT_DEF - void FT_Vector_Transform( FT_Vector* vector, - FT_Matrix* matrix ); + EXPORT_DEF(void) FT_Vector_Transform( FT_Vector* vector, + FT_Matrix* matrix ); /*************************************************************************/ @@ -2578,9 +2544,8 @@ /* */ /* Yes. */ /* */ - EXPORT_DEF - void FT_Matrix_Multiply( FT_Matrix* a, - FT_Matrix* b ); + EXPORT_DEF(void) FT_Matrix_Multiply( FT_Matrix* a, + FT_Matrix* b ); /*************************************************************************/ @@ -2601,8 +2566,7 @@ /* */ /* Yes. */ /* */ - EXPORT_DEF - FT_Error FT_Matrix_Invert( FT_Matrix* matrix ); + EXPORT_DEF(FT_Error) FT_Matrix_Invert( FT_Matrix* matrix ); /*************************************************************************/ /* */ @@ -2615,8 +2579,7 @@ /* */ /* library :: A handle to a new library object. */ /* */ - EXPORT_DEF - void FT_Default_Drivers( FT_Library library ); + EXPORT_DEF(void) FT_Default_Drivers( FT_Library library ); #ifdef __cplusplus } diff --git a/include/freetype/ftbbox.h b/include/freetype/ftbbox.h index 6b769465d..5af0463e6 100644 --- a/include/freetype/ftbbox.h +++ b/include/freetype/ftbbox.h @@ -58,9 +58,8 @@ /* */ /* Error code. 0 means success. */ /* */ - EXPORT_DEF - FT_Error FT_Raster_GetBBox( FT_Outline* outline, - FT_BBox* abbox ); + EXPORT_DEF(FT_Error) FT_Raster_GetBBox( FT_Outline* outline, + FT_BBox* abbox ); #ifdef __cplusplus diff --git a/include/freetype/ftglyph.h b/include/freetype/ftglyph.h index 6380efa40..a9eb278c0 100644 --- a/include/freetype/ftglyph.h +++ b/include/freetype/ftglyph.h @@ -200,13 +200,12 @@ * ***********************************************************************/ - EXPORT_DEF - FT_Error FT_Get_Glyph_Bitmap( FT_Face face, - FT_UInt glyph_index, - FT_UInt load_flags, - FT_Int grays, - FT_Vector* origin, - FT_BitmapGlyph *abitglyph ); + EXPORT_DEF(FT_Error) FT_Get_Glyph_Bitmap( FT_Face face, + FT_UInt glyph_index, + FT_UInt load_flags, + FT_Int grays, + FT_Vector* origin, + FT_BitmapGlyph *abitglyph ); /*********************************************************************** @@ -238,11 +237,10 @@ * ***********************************************************************/ - EXPORT_DEF - FT_Error FT_Get_Glyph_Outline( FT_Face face, - FT_UInt glyph_index, - FT_UInt load_flags, - FT_OutlineGlyph *vecglyph ); + EXPORT_DEF(FT_Error) FT_Get_Glyph_Outline( FT_Face face, + FT_UInt glyph_index, + FT_UInt load_flags, + FT_OutlineGlyph *vecglyph ); /*********************************************************************** @@ -266,10 +264,9 @@ * ***********************************************************************/ - EXPORT_DEF - void FT_Set_Transform( FT_Face face, - FT_Matrix* matrix, - FT_Vector* delta ); + EXPORT_DEF(void) FT_Set_Transform( FT_Face face, + FT_Matrix* matrix, + FT_Vector* delta ); /*********************************************************************** @@ -285,8 +282,7 @@ * ***********************************************************************/ - EXPORT_DEF - void FT_Done_Glyph( FT_Glyph glyph ); + EXPORT_DEF(void) FT_Done_Glyph( FT_Glyph glyph ); /*********************************************************************** @@ -313,8 +309,7 @@ * ***********************************************************************/ - EXPORT_DEF - void FT_Glyph_Get_Box( FT_Glyph glyph, - FT_BBox *box ); + EXPORT_DEF(void) FT_Glyph_Get_Box( FT_Glyph glyph, + FT_BBox *box ); #endif /* FTGLYPH_H */ diff --git a/include/freetype/ftgrays.h b/include/freetype/ftgrays.h index ca7da3750..3ab0c68a5 100644 --- a/include/freetype/ftgrays.h +++ b/include/freetype/ftgrays.h @@ -11,10 +11,10 @@ /* On some systems and compilers (Win32 mostly), an extra keyword is */ /* necessary to compile the library as a DLL. */ /* */ -#ifndef EXPORT_DEF -#define EXPORT_DEF extern +#ifndef EXPORT_VAR +#define EXPORT_VAR(x) extern x #endif - EXPORT_DEF FT_Raster_Funcs ft_grays_raster; + EXPORT_VAR(FT_Raster_Funcs) ft_grays_raster; #endif diff --git a/include/freetype/ftraster.h b/include/freetype/ftraster.h index f7ce0f835..c65d4ee19 100644 --- a/include/freetype/ftraster.h +++ b/include/freetype/ftraster.h @@ -33,12 +33,11 @@ #include -#ifndef EXPORT_DEF -#define EXPORT_DEF /* nothing */ +#ifndef EXPORT_VAR +#define EXPORT_VAR(x) x #endif - EXPORT_DEF - FT_Raster_Funcs ft_raster_funcs; + EXPORT_VAR(FT_Raster_Funcs) ft_raster_funcs; #ifdef __cplusplus } diff --git a/include/freetype/internal/ftcalc.h b/include/freetype/internal/ftcalc.h index aac93748b..5acbc6c2b 100644 --- a/include/freetype/internal/ftcalc.h +++ b/include/freetype/internal/ftcalc.h @@ -41,8 +41,7 @@ #define SQRT_64( z ) FT_Sqrt64( z ) - EXPORT_DEF - FT_Int32 FT_Sqrt64( FT_Int64 x ); + EXPORT_DEF(FT_Int32) FT_Sqrt64( FT_Int64 x ); #endif /* OLD_CALCS */ @@ -59,21 +58,17 @@ #define MUL_64( x, y, z ) FT_MulTo64( x, y, &z ) #define DIV_64( x, y ) FT_Div64by32( &x, y ) - EXPORT_DEF - void FT_Add64 ( FT_Int64* x, FT_Int64* y, FT_Int64* z ); + EXPORT_DEF(void) FT_Add64 ( FT_Int64* x, FT_Int64* y, FT_Int64* z ); - EXPORT_DEF - void FT_MulTo64 ( FT_Int32 x, FT_Int32 y, FT_Int64* z ); - - EXPORT_DEF - FT_Int32 FT_Div64by32( FT_Int64* x, FT_Int32 y ); + EXPORT_DEF(void) FT_MulTo64 ( FT_Int32 x, FT_Int32 y, FT_Int64* z ); + + EXPORT_DEF(FT_Int32) FT_Div64by32( FT_Int64* x, FT_Int32 y ); #ifdef FT_CONFIG_OPTION_OLD_CALCS #define SQRT_64( z ) FT_Sqrt64( &z ) - EXPORT_DEF - FT_Int32 FT_Sqrt64( FT_Int64* x ); + EXPORT_DEF(FT_Int32) FT_Sqrt64( FT_Int64* x ); #endif /* OLD_CALC */ @@ -84,8 +79,7 @@ #define SQRT_32( x ) FT_Sqrt32( x ) - BASE_DEF - FT_Int32 FT_Sqrt32( FT_Int32 l ); + BASE_DEF(FT_Int32) FT_Sqrt32( FT_Int32 l ); #endif /*************************************************************************/ diff --git a/include/freetype/internal/ftdebug.h b/include/freetype/internal/ftdebug.h index bf0e1648a..97bdfd671 100644 --- a/include/freetype/internal/ftdebug.h +++ b/include/freetype/internal/ftdebug.h @@ -124,9 +124,8 @@ } while ( 0 ) - EXPORT_DEF - void FT_SetTraceLevel( FT_Trace component, - char level ); + EXPORT_DEF(void) FT_SetTraceLevel( FT_Trace component, + char level ); #elif defined( FT_DEBUG_LEVEL_ERROR ) @@ -170,10 +169,10 @@ } while ( 0 ) /* print a message */ - extern void FT_Message( const char* fmt, ... ); + EXPORT_DEF(void) FT_Message( const char* fmt, ... ); /* print a message and exit */ - extern void FT_Panic ( const char* fmt, ... ); + EXPORT_DEF(void) FT_Panic ( const char* fmt, ... ); #define FT_ERROR( varformat ) FT_Message##varformat diff --git a/include/freetype/internal/ftextend.h b/include/freetype/internal/ftextend.h index 5c9232b28..7c5c52684 100644 --- a/include/freetype/internal/ftextend.h +++ b/include/freetype/internal/ftextend.h @@ -120,9 +120,8 @@ } FT_Extension_Class; - EXPORT_DEF - FT_Error FT_Register_Extension( FT_Driver driver, - FT_Extension_Class* clazz ); + EXPORT_DEF(FT_Error) FT_Register_Extension( FT_Driver driver, + FT_Extension_Class* clazz ); #ifdef FT_CONFIG_OPTION_EXTEND_ENGINE @@ -151,10 +150,9 @@ /* Returns an extension's data & interface according to its ID */ - EXPORT_DEF - void* FT_Get_Extension( FT_Face face, - const char* extension_id, - void* *extension_interface ); + EXPORT_DEF(void*) FT_Get_Extension( FT_Face face, + const char* extension_id, + void* *extension_interface ); #ifdef __cplusplus } diff --git a/include/freetype/internal/ftlist.h b/include/freetype/internal/ftlist.h index 97ef81629..436e36113 100644 --- a/include/freetype/internal/ftlist.h +++ b/include/freetype/internal/ftlist.h @@ -33,25 +33,20 @@ #endif - EXPORT_DEF - FT_ListNode FT_List_Find( FT_List list, - void* data ); + EXPORT_DEF(FT_ListNode) FT_List_Find( FT_List list, + void* data ); - EXPORT_DEF - void FT_List_Add( FT_List list, - FT_ListNode node ); + EXPORT_DEF(void) FT_List_Add( FT_List list, + FT_ListNode node ); - EXPORT_DEF - void FT_List_Insert( FT_List list, - FT_ListNode node ); + EXPORT_DEF(void) FT_List_Insert( FT_List list, + FT_ListNode node ); - EXPORT_DEF - void FT_List_Remove( FT_List list, - FT_ListNode node ); + EXPORT_DEF(void) FT_List_Remove( FT_List list, + FT_ListNode node ); - EXPORT_DEF - void FT_List_Up( FT_List list, - FT_ListNode node ); + EXPORT_DEF(void) FT_List_Up( FT_List list, + FT_ListNode node ); /*************************************************************************/ @@ -72,10 +67,9 @@ void* user ); - EXPORT_DEF - FT_Error FT_List_Iterate( FT_List list, - FT_List_Iterator iterator, - void* user ); + EXPORT_DEF(FT_Error) FT_List_Iterate( FT_List list, + FT_List_Iterator iterator, + void* user ); /*************************************************************************/ @@ -99,11 +93,10 @@ void* user ); - EXPORT_DEF - void FT_List_Finalize( FT_List list, - FT_List_Destructor destroy, - FT_Memory memory, - void* user ); + EXPORT_DEF(void) FT_List_Finalize( FT_List list, + FT_List_Destructor destroy, + FT_Memory memory, + void* user ); #ifdef __cplusplus diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h index f20b0b0ac..b0fb802d1 100644 --- a/include/freetype/internal/ftobjs.h +++ b/include/freetype/internal/ftobjs.h @@ -94,20 +94,17 @@ /*************************************************************************/ /*************************************************************************/ - BASE_DEF - FT_Error FT_Alloc( FT_Memory memory, - FT_Long size, - void** P ); + BASE_DEF(FT_Error) FT_Alloc( FT_Memory memory, + FT_Long size, + void** P ); - BASE_DEF - FT_Error FT_Realloc( FT_Memory memory, - FT_Long current, - FT_Long size, - void** P ); + BASE_DEF(FT_Error) FT_Realloc( FT_Memory memory, + FT_Long current, + FT_Long size, + void** P ); - BASE_DEF - void FT_Free( FT_Memory memory, - void** P ); + BASE_DEF(void) FT_Free( FT_Memory memory, + void** P ); @@ -165,29 +162,17 @@ #define FREE( _pointer_ ) FT_Free( memory, (void**)&(_pointer_) ) - /* various useful types and definitions */ - - extern void FP_Panic( const char* message ); - - extern FT_Memory FP_New_Memory( void ); + EXPORT_DEF(FT_Error) FT_New_Size( FT_Face face, + FT_Size* size ); + EXPORT_DEF(FT_Error) FT_Done_Size( FT_Size size ); + EXPORT_DEF(FT_Error) FT_New_GlyphSlot( FT_Face face, + FT_GlyphSlot* aslot ); - EXPORT_DEF - FT_Error FT_New_Size( FT_Face face, - FT_Size* size ); - - EXPORT_DEF - FT_Error FT_Done_Size( FT_Size size ); - - EXPORT_DEF - FT_Error FT_New_GlyphSlot( FT_Face face, - FT_GlyphSlot* aslot ); - - EXPORT_DEF - void FT_Done_GlyphSlot( FT_GlyphSlot slot ); + EXPORT_DEF(void) FT_Done_GlyphSlot( FT_GlyphSlot slot ); @@ -314,19 +299,16 @@ } FT_GlyphZone; - BASE_DEF - FT_Error FT_New_GlyphZone( FT_Memory memory, - FT_UShort maxPoints, - FT_Short maxContours, - FT_GlyphZone* zone ); + BASE_DEF(FT_Error) FT_New_GlyphZone( FT_Memory memory, + FT_UShort maxPoints, + FT_Short maxContours, + FT_GlyphZone* zone ); - BASE_DEF - void FT_Done_GlyphZone( FT_GlyphZone* zone ); + BASE_DEF(void) FT_Done_GlyphZone( FT_GlyphZone* zone ); - BASE_DEF - FT_Error FT_Update_GlyphZone( FT_GlyphZone* zone, - FT_UShort num_points, - FT_Short num_contours ); + BASE_DEF(FT_Error) FT_Update_GlyphZone( FT_GlyphZone* zone, + FT_UShort num_points, + FT_Short num_contours ); /*************************************************************************/ @@ -395,46 +377,37 @@ } FT_LibraryRec; - EXPORT_DEF - FT_Error FT_New_Library( FT_Memory memory, - FT_Library* library ); + EXPORT_DEF(FT_Error) FT_New_Library( FT_Memory memory, + FT_Library* library ); - EXPORT_DEF - FT_Error FT_Done_Library( FT_Library library ); + EXPORT_DEF(FT_Error) FT_Done_Library( FT_Library library ); - EXPORT_DEF - void FT_Set_Debug_Hook( FT_Library library, - FT_UInt hook_index, - FT_DebugHook_Func debug_hook ); + EXPORT_DEF(void) FT_Set_Debug_Hook( FT_Library library, + FT_UInt hook_index, + FT_DebugHook_Func debug_hook ); - EXPORT_DEF - FT_Error FT_Add_Driver( FT_Library library, - const FT_DriverInterface* driver_interface ); + EXPORT_DEF(FT_Error) FT_Add_Driver( FT_Library library, + const FT_DriverInterface* driver_interface ); - EXPORT_DEF - FT_Error FT_Remove_Driver( FT_Driver driver ); + EXPORT_DEF(FT_Error) FT_Remove_Driver( FT_Driver driver ); - EXPORT_DEF - FT_Driver FT_Get_Driver( FT_Library library, - char* driver_name ); + EXPORT_DEF(FT_Driver) FT_Get_Driver( FT_Library library, + char* driver_name ); #ifndef FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM - EXPORT_DEF - FT_Error FT_New_Stream( const char* filepathname, - FT_Stream astream ); + EXPORT_DEF(FT_Error) FT_New_Stream( const char* filepathname, + FT_Stream astream ); - EXPORT_DEF - void FT_Done_Stream( FT_Stream stream ); + EXPORT_DEF(void) FT_Done_Stream( FT_Stream stream ); - extern - FT_Memory FT_New_Memory( void ); + EXPORT_DEF(FT_Memory) FT_New_Memory( void ); #endif @@ -443,8 +416,7 @@ /* Client applications can register new rasters through the FT_Set_Raster API.. */ /* */ #ifndef FT_NO_DEFAULT_RASTER - extern - FT_Raster_Funcs ft_default_raster; + EXPORT_VAR(FT_Raster_Funcs) ft_default_raster; #endif diff --git a/include/freetype/internal/ftstream.h b/include/freetype/internal/ftstream.h index cc0b8decc..bfb2a5e9c 100644 --- a/include/freetype/internal/ftstream.h +++ b/include/freetype/internal/ftstream.h @@ -167,79 +167,61 @@ typedef struct FT_Frame_Field_ - BASE_DEF - void FT_New_Memory_Stream( FT_Library library, - void* base, - unsigned long size, - FT_Stream stream ); + BASE_DEF(void) FT_New_Memory_Stream( FT_Library library, + void* base, + unsigned long size, + FT_Stream stream ); - BASE_DEF - FT_Error FT_Seek_Stream( FT_Stream stream, - FT_ULong pos ); + BASE_DEF(FT_Error) FT_Seek_Stream( FT_Stream stream, + FT_ULong pos ); - BASE_DEF - FT_Error FT_Skip_Stream( FT_Stream stream, - FT_Long distance ); + BASE_DEF(FT_Error) FT_Skip_Stream( FT_Stream stream, + FT_Long distance ); - BASE_DEF - FT_Long FT_Stream_Pos( FT_Stream stream ); + BASE_DEF(FT_Long) FT_Stream_Pos( FT_Stream stream ); - BASE_DEF - FT_Error FT_Read_Stream( FT_Stream stream, - void* buffer, - FT_ULong count ); - - BASE_DEF - FT_Error FT_Read_Stream_At( FT_Stream stream, - FT_ULong pos, - void* buffer, - FT_ULong count ); + BASE_DEF(FT_Error) FT_Read_Stream( FT_Stream stream, + void* buffer, + FT_ULong count ); + + BASE_DEF(FT_Error) FT_Read_Stream_At( FT_Stream stream, + FT_ULong pos, + void* buffer, + FT_ULong count ); - BASE_DEF - FT_Error FT_Access_Frame( FT_Stream stream, - FT_ULong count ); + BASE_DEF(FT_Error) FT_Access_Frame( FT_Stream stream, + FT_ULong count ); - BASE_DEF - void FT_Forget_Frame( FT_Stream stream ); + BASE_DEF(void) FT_Forget_Frame( FT_Stream stream ); - BASE_DEF - FT_Char FT_Get_Char( FT_Stream stream ); + BASE_DEF(FT_Char) FT_Get_Char( FT_Stream stream ); - BASE_DEF - FT_Short FT_Get_Short( FT_Stream stream ); + BASE_DEF(FT_Short) FT_Get_Short( FT_Stream stream ); - BASE_DEF - FT_Long FT_Get_Offset( FT_Stream stream ); + BASE_DEF(FT_Long) FT_Get_Offset( FT_Stream stream ); - BASE_DEF - FT_Long FT_Get_Long( FT_Stream stream ); + BASE_DEF(FT_Long) FT_Get_Long( FT_Stream stream ); - BASE_DEF - FT_Char FT_Read_Char( FT_Stream stream, - FT_Error* error ); + BASE_DEF(FT_Char) FT_Read_Char( FT_Stream stream, + FT_Error* error ); - BASE_DEF - FT_Short FT_Read_Short( FT_Stream stream, - FT_Error* error ); + BASE_DEF(FT_Short) FT_Read_Short( FT_Stream stream, + FT_Error* error ); - BASE_DEF - FT_Long FT_Read_Offset( FT_Stream stream, - FT_Error* error ); + BASE_DEF(FT_Long) FT_Read_Offset( FT_Stream stream, + FT_Error* error ); - BASE_DEF - FT_Long FT_Read_Long( FT_Stream stream, - FT_Error* error ); - - BASE_DEF - FT_Error FT_Read_Fields( FT_Stream stream, - const FT_Frame_Field* fields, - void* structure ); + BASE_DEF(FT_Long) FT_Read_Long( FT_Stream stream, + FT_Error* error ); + BASE_DEF(FT_Error) FT_Read_Fields( FT_Stream stream, + const FT_Frame_Field* fields, + void* structure ); #define USE_Stream( resource, stream ) \ FT_SET_ERROR( FT_Open_Stream( resource, stream ) ) diff --git a/include/freetype/tttables.h b/include/freetype/tttables.h index edd678047..7f98c2057 100644 --- a/include/freetype/tttables.h +++ b/include/freetype/tttables.h @@ -525,9 +525,8 @@ * ***************************************************************************/ - EXPORT_DEF - void* FT_Get_Sfnt_Table( FT_Face face, - FT_Sfnt_Tag tag ); + EXPORT_DEF(void*) FT_Get_Sfnt_Table( FT_Face face, + FT_Sfnt_Tag tag ); #endif /* TTTABLES_H */ diff --git a/src/base/ftcalc.c b/src/base/ftcalc.c index 92ad70693..c08c40b8b 100644 --- a/src/base/ftcalc.c +++ b/src/base/ftcalc.c @@ -69,8 +69,7 @@ /* */ /* The result of `sqrt(x)'. */ /* */ - EXPORT_FUNC - FT_Int32 FT_Sqrt32( FT_Int32 x ) + EXPORT_FUNC(FT_Int32) FT_Sqrt32( FT_Int32 x ) { FT_ULong val, root, newroot, mask; @@ -123,10 +122,9 @@ /* divide by zero, it simply returns `MaxInt' or `MinInt' depending */ /* on the signs of `a' and `b'. */ /* */ - EXPORT_FUNC - FT_Long FT_MulDiv( FT_Long a, - FT_Long b, - FT_Long c ) + EXPORT_FUNC(FT_Long) FT_MulDiv( FT_Long a, + FT_Long b, + FT_Long c ) { FT_Int s; @@ -169,9 +167,8 @@ /* _second_ argument of this function; this can make a great */ /* difference. */ /* */ - EXPORT_FUNC - FT_Long FT_MulFix( FT_Long a, - FT_Long b ) + EXPORT_FUNC(FT_Long) FT_MulFix( FT_Long a, + FT_Long b ) { FT_Int s; @@ -207,9 +204,8 @@ /* 32 bits, then the division is computed directly. Otherwise, we */ /* use a specialized version of the old FT_MulDiv64(). */ /* */ - EXPORT_FUNC - FT_Int32 FT_DivFix( FT_Long a, - FT_Long b ) + EXPORT_FUNC(FT_Int32) FT_DivFix( FT_Long a, + FT_Long b ) { FT_Int32 s; FT_Word32 q; @@ -262,8 +258,7 @@ } - EXPORT_FUNC - FT_Int32 FT_Sqrt64( FT_Int64 l ) + EXPORT_FUNC(FT_Int32) FT_Sqrt64( FT_Int64 l ) { FT_Int64 r, s; @@ -327,10 +322,9 @@ /* */ /* and 2*0x157F0 = 176096. */ /* */ - EXPORT_FUNC - FT_Long FT_MulDiv( FT_Long a, - FT_Long b, - FT_Long c ) + EXPORT_FUNC(FT_Long) FT_MulDiv( FT_Long a, + FT_Long b, + FT_Long c ) { long s; @@ -393,9 +387,8 @@ /* idea is to use bounds like 2048 and 1048576 (=floor((2^31-1)/2048) */ /* for `a' and `b', respectively. */ /* */ - EXPORT_FUNC - FT_Long FT_MulFix( FT_Long a, - FT_Long b ) + EXPORT_FUNC(FT_Long) FT_MulFix( FT_Long a, + FT_Long b ) { FT_Long s; FT_ULong ua, ub; @@ -448,9 +441,8 @@ /* 32 bits, then the division is computed directly. Otherwise, we */ /* use a specialized version of the old FT_MulDiv64(). */ /* */ - EXPORT_FUNC - FT_Long FT_DivFix( FT_Long a, - FT_Long b ) + EXPORT_FUNC(FT_Long) FT_DivFix( FT_Long a, + FT_Long b ) { FT_Int32 s; FT_Word32 q; @@ -510,10 +502,9 @@ /* */ /* Will be wrapped by the ADD_64() macro. */ /* */ - EXPORT_FUNC - void FT_Add64( FT_Int64* x, - FT_Int64* y, - FT_Int64* z ) + EXPORT_FUNC(void) FT_Add64( FT_Int64* x, + FT_Int64* y, + FT_Int64* z ) { register FT_Word32 lo, hi; @@ -543,10 +534,9 @@ /* */ /* Will be wrapped by the MUL_64() macro. */ /* */ - EXPORT_FUNC - void FT_MulTo64( FT_Int32 x, - FT_Int32 y, - FT_Int64* z ) + EXPORT_FUNC(void) FT_MulTo64( FT_Int32 x, + FT_Int32 y, + FT_Int64* z ) { FT_Int32 s; @@ -609,9 +599,8 @@ /* */ /* Will be wrapped by the DIV_64() macro. */ /* */ - EXPORT_FUNC - FT_Int32 FT_Div64by32( FT_Int64* x, - FT_Int32 y ) + EXPORT_FUNC(FT_Int32) FT_Div64by32( FT_Int64* x, + FT_Int32 y ) { FT_Int32 s; FT_Word32 q, r, i, lo; @@ -712,8 +701,7 @@ return j-1; } - EXPORT_FUNC - FT_Int32 FT_Sqrt64( FT_Int64* l ) + EXPORT_FUNC(FT_Int32) FT_Sqrt64( FT_Int64* l ) { FT_Int64 l2; FT_Int32 r, s; diff --git a/src/base/ftdebug.c b/src/base/ftdebug.c index fa71216b8..de96036d7 100644 --- a/src/base/ftdebug.c +++ b/src/base/ftdebug.c @@ -31,7 +31,7 @@ #include - void FT_Message( const char* fmt, ... ) + EXPORT_FUNC(void) FT_Message( const char* fmt, ... ) { va_list ap; @@ -42,7 +42,7 @@ } - void FT_Panic( const char* fmt, ... ) + EXPORT_FUNC(void) FT_Panic( const char* fmt, ... ) { va_list ap; @@ -72,9 +72,8 @@ /* components will be traced. */ /* level :: The tracing level. */ /* */ - EXPORT_FUNC - void FT_SetTraceLevel( FT_Trace component, - char level ) + EXPORT_FUNC(void) FT_SetTraceLevel( FT_Trace component, + char level ) { if ( component >= trace_max ) return; diff --git a/src/base/ftextend.c b/src/base/ftextend.c index 5cddfcde1..ac0083841 100644 --- a/src/base/ftextend.c +++ b/src/base/ftextend.c @@ -114,9 +114,8 @@ /* */ /* FreeType error code. 0 means success. */ /* */ - EXPORT_FUNC - FT_Error FT_Register_Extension( FT_Driver driver, - FT_Extension_Class* class ) + EXPORT_FUNC(FT_Error) FT_Register_Extension( FT_Driver driver, + FT_Extension_Class* class ) { FT_Extension_Registry* registry; @@ -163,10 +162,9 @@ /* */ /* A pointer to the extension block. */ /* */ - EXPORT_FUNC - void* FT_Get_Extension( FT_Face face, - const char* extension_id, - void* *extension_interface ) + EXPORT_FUNC(void*) FT_Get_Extension( FT_Face face, + const char* extension_id, + void* *extension_interface ) { FT_Extension_Registry* registry; diff --git a/src/base/ftglyph.c b/src/base/ftglyph.c index 17e698e93..4bfb3ce79 100644 --- a/src/base/ftglyph.c +++ b/src/base/ftglyph.c @@ -95,13 +95,12 @@ * ***********************************************************************/ - EXPORT_FUNC - FT_Error FT_Get_Glyph_Bitmap( FT_Face face, - FT_UInt glyph_index, - FT_UInt load_flags, - FT_Int grays, - FT_Vector* origin, - FT_BitmapGlyph *abitglyph ) + EXPORT_FUNC(FT_Error) FT_Get_Glyph_Bitmap( FT_Face face, + FT_UInt glyph_index, + FT_UInt load_flags, + FT_Int grays, + FT_Vector* origin, + FT_BitmapGlyph *abitglyph ) { FT_Error error; FT_Memory memory; @@ -271,11 +270,10 @@ * ***********************************************************************/ - EXPORT_FUNC - FT_Error FT_Get_Glyph_Outline( FT_Face face, - FT_UInt glyph_index, - FT_UInt load_flags, - FT_OutlineGlyph *vecglyph ) + EXPORT_FUNC(FT_Error) FT_Get_Glyph_Outline( FT_Face face, + FT_UInt glyph_index, + FT_UInt load_flags, + FT_OutlineGlyph *vecglyph ) { FT_Error error; FT_Memory memory; @@ -360,10 +358,9 @@ * ***********************************************************************/ - EXPORT_FUNC - void FT_Set_Transform( FT_Face face, - FT_Matrix* matrix, - FT_Vector* delta ) + EXPORT_FUNC(void) FT_Set_Transform( FT_Face face, + FT_Matrix* matrix, + FT_Vector* delta ) { face->transform_flags = 0; @@ -411,8 +408,7 @@ * ***********************************************************************/ - EXPORT_FUNC - void FT_Done_Glyph( FT_Glyph glyph ) + EXPORT_FUNC(void) FT_Done_Glyph( FT_Glyph glyph ) { if (glyph) { @@ -463,9 +459,8 @@ * ***********************************************************************/ - EXPORT_DEF - void FT_Glyph_Get_Box( FT_Glyph glyph, - FT_BBox *box ) + EXPORT_FUNC(void) FT_Glyph_Get_Box( FT_Glyph glyph, + FT_BBox *box ) { box->xMin = box->xMax = 0; box->yMin = box->yMax = 0; diff --git a/src/base/ftinit.c b/src/base/ftinit.c index 0399dc486..04c173c4e 100644 --- a/src/base/ftinit.c +++ b/src/base/ftinit.c @@ -76,8 +76,7 @@ const FT_DriverInterface* ft_default_drivers[] = /* */ /* library :: A handle to a new library object. */ /* */ - EXPORT_FUNC - void FT_Default_Drivers( FT_Library library ) + EXPORT_FUNC(void) FT_Default_Drivers( FT_Library library ) { FT_Error error; const FT_DriverInterface* *cur; @@ -111,8 +110,7 @@ const FT_DriverInterface* ft_default_drivers[] = /* */ /* FreeTyoe error code. 0 means success. */ /* */ - EXPORT_FUNC - FT_Error FT_Init_FreeType( FT_Library* library ) + EXPORT_FUNC(FT_Error) FT_Init_FreeType( FT_Library* library ) { FT_Error error; FT_Memory memory; diff --git a/src/base/ftlist.c b/src/base/ftlist.c index ddcba9aa4..c4d0eb33e 100644 --- a/src/base/ftlist.c +++ b/src/base/ftlist.c @@ -43,9 +43,8 @@ /* */ /* List node. NULL if it wasn't found. */ /* */ - BASE_FUNC - FT_ListNode FT_List_Find( FT_List list, - void* data ) + BASE_FUNC(FT_ListNode) FT_List_Find( FT_List list, + void* data ) { FT_ListNode cur; @@ -75,9 +74,8 @@ /* list :: A pointer to the parent list. */ /* node :: The node to append. */ /* */ - BASE_FUNC - void FT_List_Add( FT_List list, - FT_ListNode node ) + BASE_FUNC(void) FT_List_Add( FT_List list, + FT_ListNode node ) { FT_ListNode before = list->tail; @@ -106,9 +104,8 @@ /* list :: A pointer to parent list. */ /* node :: The node to insert. */ /* */ - BASE_FUNC - void FT_List_Insert( FT_List list, - FT_ListNode node ) + BASE_FUNC(void) FT_List_Insert( FT_List list, + FT_ListNode node ) { FT_ListNode after = list->head; @@ -140,9 +137,8 @@ /* */ /* list :: A pointer to the parent list. */ /* */ - BASE_FUNC - void FT_List_Remove( FT_List list, - FT_ListNode node ) + BASE_FUNC(void) FT_List_Remove( FT_List list, + FT_ListNode node ) { FT_ListNode before, after; @@ -175,9 +171,8 @@ /* list :: A pointer to the parent list. */ /* node :: The node to move. */ /* */ - BASE_FUNC - void FT_List_Up( FT_List list, - FT_ListNode node ) + BASE_FUNC(void) FT_List_Up( FT_List list, + FT_ListNode node ) { FT_ListNode before, after; @@ -223,10 +218,9 @@ /* */ /* The result (an error code) of the last iterator call. */ /* */ - BASE_FUNC - FT_Error FT_List_Iterate( FT_List list, - FT_List_Iterator iterator, - void* user ) + BASE_FUNC(FT_Error) FT_List_Iterate( FT_List list, + FT_List_Iterator iterator, + void* user ) { FT_ListNode cur = list->head; FT_Error error = FT_Err_Ok; @@ -268,11 +262,10 @@ /* user :: A user-supplied field which is passed as the last */ /* argument to the destructor. */ /* */ - BASE_FUNC - void FT_List_Finalize( FT_List list, - FT_List_Destructor destroy, - FT_Memory memory, - void* user ) + BASE_FUNC(void) FT_List_Finalize( FT_List list, + FT_List_Destructor destroy, + FT_Memory memory, + void* user ) { FT_ListNode cur; diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index 6d662b4c3..401c39f0b 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -66,10 +66,9 @@ /* */ /* FreeType error code. 0 means success. */ /* */ - BASE_FUNC - FT_Error FT_Alloc( FT_Memory memory, - FT_Long size, - void** P ) + BASE_FUNC(FT_Error) FT_Alloc( FT_Memory memory, + FT_Long size, + void** P ) { FT_Assert( P != 0 ); @@ -131,11 +130,10 @@ /* */ /* (Some embedded systems do not have a working realloc function). */ /* */ - BASE_FUNC - FT_Error FT_Realloc( FT_Memory memory, - FT_Long current, - FT_Long size, - void** P ) + BASE_FUNC(FT_Error) FT_Realloc( FT_Memory memory, + FT_Long current, + FT_Long size, + void** P ) { void* Q; @@ -191,9 +189,8 @@ /* This is a strong convention within all of FreeType and its */ /* drivers. */ /* */ - BASE_FUNC - void FT_Free( FT_Memory memory, - void** P ) + BASE_FUNC(void) FT_Free( FT_Memory memory, + void** P ) { FT_TRACE2(( "FT_Free:" )); FT_TRACE2(( " Freeing block 0x%08lx, ref 0x%08lx\n", @@ -274,8 +271,7 @@ /* */ /* Closes and destroys a stream object. */ /* */ - EXPORT_FUNC - void FT_Done_Stream( FT_Stream stream ) + EXPORT_FUNC(void) FT_Done_Stream( FT_Stream stream ) { if ( stream->close ) stream->close( stream ); @@ -413,10 +409,9 @@ * *************************************************************************/ - EXPORT_FUNC - FT_Raster FT_Get_Raster( FT_Library library, - FT_Glyph_Format glyph_format, - FT_Raster_Funcs *raster_funcs ) + EXPORT_FUNC(FT_Raster) FT_Get_Raster( FT_Library library, + FT_Glyph_Format glyph_format, + FT_Raster_Funcs *raster_funcs ) { FT_Int n; @@ -459,9 +454,8 @@ /* */ /* - the new raster is registered for the glyph format */ /* */ - EXPORT_FUNC - FT_Error FT_Set_Raster( FT_Library library, - FT_Raster_Funcs* raster_funcs ) + EXPORT_FUNC(FT_Error) FT_Set_Raster( FT_Library library, + FT_Raster_Funcs* raster_funcs ) { FT_Glyph_Format glyph_format = raster_funcs->glyph_format; FT_Raster_Funcs* funcs; @@ -534,9 +528,8 @@ /* */ /* Error code. 0 means success. */ /* */ - EXPORT_DEF - FT_Error FT_Unset_Raster( FT_Library library, - FT_Raster_Funcs* raster_funcs ) + EXPORT_DEF(FT_Error) FT_Unset_Raster( FT_Library library, + FT_Raster_Funcs* raster_funcs ) { FT_Glyph_Format glyph_format = raster_funcs->glyph_format; FT_Error error; @@ -581,11 +574,10 @@ /* */ /* Error code. 0 means success. */ /* */ - EXPORT_FUNC - FT_Error FT_Set_Raster_Mode( FT_Library library, - FT_Glyph_Format format, - unsigned long mode, - void* args ) + EXPORT_FUNC(FT_Error) FT_Set_Raster_Mode( FT_Library library, + FT_Glyph_Format format, + unsigned long mode, + void* args ) { FT_Raster_Funcs funcs; FT_Raster raster; @@ -617,10 +609,9 @@ /* Currently, four debug hook slots are available, but only two (for */ /* the TrueType and the Type 1 interpreter) are defined. */ /* */ - EXPORT_FUNC - void FT_Set_Debug_Hook( FT_Library library, - FT_UInt hook_index, - FT_DebugHook_Func debug_hook ) + EXPORT_FUNC(void) FT_Set_Debug_Hook( FT_Library library, + FT_UInt hook_index, + FT_DebugHook_Func debug_hook ) { if ( hook_index < ( sizeof ( library->debug_hooks ) / sizeof ( void* ) ) ) library->debug_hooks[hook_index] = debug_hook; @@ -646,9 +637,8 @@ /* */ /* FreeType error code. 0 means success. */ /* */ - EXPORT_FUNC - FT_Error FT_New_Library( FT_Memory memory, - FT_Library* alibrary ) + EXPORT_FUNC(FT_Error) FT_New_Library( FT_Memory memory, + FT_Library* alibrary ) { FT_Library library = 0; FT_Error error; @@ -694,8 +684,7 @@ /* */ /* FreeType error code. 0 means success. */ /* */ - EXPORT_FUNC - FT_Error FT_Done_Library( FT_Library library ) + EXPORT_FUNC(FT_Error) FT_Done_Library( FT_Library library ) { FT_Memory memory; FT_Int n; @@ -772,9 +761,8 @@ /* This function doesn't check whether the driver is already */ /* installed! */ /* */ - EXPORT_FUNC - FT_Error FT_Add_Driver( FT_Library library, - const FT_DriverInterface* driver_interface ) + EXPORT_FUNC(FT_Error) FT_Add_Driver( FT_Library library, + const FT_DriverInterface* driver_interface ) { FT_Error error; FT_Driver driver; @@ -834,8 +822,7 @@ /* */ /* FreeType error code. 0 means success. */ /* */ - EXPORT_FUNC - FT_Error FT_Remove_Driver( FT_Driver driver ) + EXPORT_FUNC(FT_Error) FT_Remove_Driver( FT_Driver driver ) { FT_Library library; FT_Memory memory; @@ -898,9 +885,8 @@ /* */ /* A handle to the driver object, 0 otherwise. */ /* */ - EXPORT_FUNC - FT_Driver FT_Get_Driver( FT_Library library, - char* driver_name ) + EXPORT_FUNC(FT_Driver) FT_Get_Driver( FT_Library library, + char* driver_name ) { FT_Driver *cur, *limit; @@ -1008,11 +994,10 @@ /* `*face'. Its return value should be 0 if the resource is */ /* recognized, or non-zero if not. */ /* */ - EXPORT_FUNC - FT_Error FT_New_Face( FT_Library library, - const char* pathname, - FT_Long face_index, - FT_Face* aface ) + EXPORT_FUNC(FT_Error) FT_New_Face( FT_Library library, + const char* pathname, + FT_Long face_index, + FT_Face* aface ) { FT_Open_Args args; @@ -1060,12 +1045,11 @@ /* `*face'. Its return value should be 0 if the resource is */ /* recognized, or non-zero if not. */ /* */ - EXPORT_FUNC - FT_Error FT_New_Memory_Face( FT_Library library, - void* file_base, - FT_Long file_size, - FT_Long face_index, - FT_Face* face ) + EXPORT_FUNC(FT_Error) FT_New_Memory_Face( FT_Library library, + void* file_base, + FT_Long file_size, + FT_Long face_index, + FT_Face* face ) { FT_Open_Args args; @@ -1115,11 +1099,10 @@ /* `*face'. Its return value should be 0 if the resource is */ /* recognized, or non-zero if not. */ /* */ - EXPORT_FUNC - FT_Error FT_Open_Face( FT_Library library, - FT_Open_Args* args, - FT_Long face_index, - FT_Face* aface ) + EXPORT_FUNC(FT_Error) FT_Open_Face( FT_Library library, + FT_Open_Args* args, + FT_Long face_index, + FT_Face* aface ) { FT_Error error; FT_Driver driver; @@ -1290,9 +1273,8 @@ /* when invoking this function. Most drivers simply do not implement */ /* file attachments. */ /* */ - EXPORT_FUNC - FT_Error FT_Attach_File( FT_Face face, - const char* filepathname ) + EXPORT_FUNC(FT_Error) FT_Attach_File( FT_Face face, + const char* filepathname ) { FT_Open_Args open; @@ -1327,9 +1309,8 @@ /* when invoking this function. Most drivers simply do not implement */ /* file attachments.. */ /* */ - EXPORT_DEF - FT_Error FT_Attach_Stream( FT_Face face, - FT_Open_Args* parameters ) + EXPORT_FUNC(FT_Error) FT_Attach_Stream( FT_Face face, + FT_Open_Args* parameters ) { FT_Stream stream; FT_Error error; @@ -1382,8 +1363,7 @@ /* */ /* Error code. 0 means success. */ /* */ - EXPORT_FUNC - FT_Error FT_Done_Face( FT_Face face ) + EXPORT_FUNC(FT_Error) FT_Done_Face( FT_Face face ) { FT_Error error; FT_Driver driver; @@ -1435,9 +1415,8 @@ /* */ /* Error code. 0 means success. */ /* */ - EXPORT_FUNC - FT_Error FT_New_Size( FT_Face face, - FT_Size* asize ) + EXPORT_FUNC(FT_Error) FT_New_Size( FT_Face face, + FT_Size* asize ) { FT_Error error; FT_Memory memory; @@ -1501,8 +1480,7 @@ /* */ /* Error code. 0 means success. */ /* */ - EXPORT_FUNC - FT_Error FT_Done_Size( FT_Size size ) + EXPORT_FUNC(FT_Error) FT_Done_Size( FT_Size size ) { FT_Error error; FT_Driver driver; @@ -1565,12 +1543,11 @@ /* When dealing with fixed-size faces (i.e., non-scalable formats), */ /* use the function FT_Set_Pixel_Sizes(). */ /* */ - EXPORT_FUNC - FT_Error FT_Set_Char_Size( FT_Face face, - FT_F26Dot6 char_width, - FT_F26Dot6 char_height, - FT_UInt horz_resolution, - FT_UInt vert_resolution ) + EXPORT_FUNC(FT_Error) FT_Set_Char_Size( FT_Face face, + FT_F26Dot6 char_width, + FT_F26Dot6 char_height, + FT_UInt horz_resolution, + FT_UInt vert_resolution ) { FT_Error error; FT_Driver driver; @@ -1643,10 +1620,9 @@ /* */ /* Error code. 0 means success. */ /* */ - EXPORT_FUNC - FT_Error FT_Set_Pixel_Sizes( FT_Face face, - FT_UInt pixel_width, - FT_UInt pixel_height ) + EXPORT_FUNC(FT_Error) FT_Set_Pixel_Sizes( FT_Face face, + FT_UInt pixel_width, + FT_UInt pixel_height ) { FT_Error error; FT_Driver driver; @@ -1704,9 +1680,8 @@ /* */ /* Error code. 0 means success. */ /* */ - EXPORT_FUNC - FT_Error FT_New_GlyphSlot( FT_Face face, - FT_GlyphSlot* aslot ) + EXPORT_FUNC(FT_Error) FT_New_GlyphSlot( FT_Face face, + FT_GlyphSlot* aslot ) { FT_Error error; FT_Driver driver; @@ -1765,8 +1740,7 @@ /* */ /* slot :: A handle to a target glyph slot. */ /* */ - EXPORT_FUNC - void FT_Done_GlyphSlot( FT_GlyphSlot slot ) + EXPORT_FUNC(void) FT_Done_GlyphSlot( FT_GlyphSlot slot ) { if (slot) { @@ -1829,10 +1803,9 @@ /* */ /* FreeType error code. 0 means success. */ /* */ - EXPORT_FUNC - FT_Error FT_Load_Glyph( FT_Face face, - FT_UInt glyph_index, - FT_Int load_flags ) + EXPORT_FUNC(FT_Error) FT_Load_Glyph( FT_Face face, + FT_UInt glyph_index, + FT_Int load_flags ) { FT_Error error; FT_Driver driver; @@ -1855,10 +1828,9 @@ } - EXPORT_FUNC - FT_Error FT_Load_Char( FT_Face face, - FT_ULong char_code, - FT_Int load_flags ) + EXPORT_FUNC(FT_Error) FT_Load_Char( FT_Face face, + FT_ULong char_code, + FT_Int load_flags ) { FT_Error error; FT_Driver driver; @@ -1909,11 +1881,10 @@ /* kernings, are out of the scope of this API function -- they can be */ /* implemented through format-specific interfaces. */ /* */ - EXPORT_FUNC - FT_Error FT_Get_Kerning( FT_Face face, - FT_UInt left_glyph, - FT_UInt right_glyph, - FT_Vector* kerning ) + EXPORT_FUNC(FT_Error) FT_Get_Kerning( FT_Face face, + FT_UInt left_glyph, + FT_UInt right_glyph, + FT_Vector* kerning ) { FT_Error error; FT_Driver driver; @@ -1962,9 +1933,8 @@ /* */ /* The glyph index. 0 means `undefined character code'. */ /* */ - EXPORT_DEF - FT_UInt FT_Get_Char_Index( FT_Face face, - FT_ULong charcode ) + EXPORT_FUNC(FT_UInt) FT_Get_Char_Index( FT_Face face, + FT_ULong charcode ) { FT_UInt result; FT_Driver driver; @@ -2006,9 +1976,8 @@ ***************************************************************************/ - EXPORT_FUNC - void* FT_Get_Sfnt_Table( FT_Face face, - FT_Sfnt_Tag tag ) + EXPORT_FUNC(void*) FT_Get_Sfnt_Table( FT_Face face, + FT_Sfnt_Tag tag ) { void* table = 0; FT_Get_Sfnt_Table_Func func; @@ -2043,8 +2012,7 @@ /* */ /* Error code. 0 means success. */ /* */ - EXPORT_FUNC - FT_Error FT_Done_FreeType( FT_Library library ) + EXPORT_FUNC(FT_Error) FT_Done_FreeType( FT_Library library ) { /* Discard the library object */ FT_Done_Library( library ); diff --git a/src/base/ftoutln.c b/src/base/ftoutln.c index 40181689a..1db15b485 100644 --- a/src/base/ftoutln.c +++ b/src/base/ftoutln.c @@ -55,12 +55,9 @@ /* */ /* Error code. 0 means sucess. */ /* */ -#if 1 - - EXPORT_FUNC - int FT_Outline_Decompose( FT_Outline* outline, - FT_Outline_Funcs* interface, - void* user ) + EXPORT_FUNC(int) FT_Outline_Decompose( FT_Outline* outline, + FT_Outline_Funcs* interface, + void* user ) { #undef SCALED #define SCALED( x ) ( ((x) << shift) - delta ) @@ -243,176 +240,6 @@ Invalid_Outline: return -1; } -#else - EXPORT_FUNC - int FT_Outline_Decompose( FT_Outline* outline, - FT_Outline_Funcs* interface, - void* user ) - { - typedef enum _phases - { - phase_point, - phase_conic, - phase_cubic, - phase_cubic2 - - } TPhase; - - FT_Vector v_first; - FT_Vector v_last; - FT_Vector v_control; - FT_Vector v_start; - - FT_Vector* point; - FT_Vector* limit; - char* tags; - - int n; /* index of contour in outline */ - int first; /* index of first point in contour */ - int error; - char tag; /* current point's state */ - - - first = 0; - - for ( n = 0; n < outline->n_contours; n++ ) - { - int last; /* index of last point in contour */ - - last = outline->contours[n]; - limit = outline->points + last; - - v_first = outline->points[first]; - v_last = outline->points[last]; - - v_start = v_control = v_first; - - point = outline->points + first; - tags = outline->tags + first; - tag = FT_CURVE_TAG( tags[0] ); - - /* A contour cannot start with a cubic control point! */ - if ( tag == FT_Curve_Tag_Cubic ) - goto Invalid_Outline; - - /* check first point to determine origin */ - if ( tag == FT_Curve_Tag_Conic ) - { - /* first point is conic control. Yes, this happens. */ - if ( FT_CURVE_TAG( outline->tags[last] ) == FT_Curve_Tag_On ) - { - /* start at last point if it is on the curve */ - v_start = v_last; - limit--; - } - else - { - /* if both first and last points are conic, */ - /* start at their middle and record its position */ - /* for closure */ - v_start.x = ( v_start.x + v_last.x ) / 2; - v_start.y = ( v_start.y + v_last.y ) / 2; - - v_last = v_start; - } - point--; - tags--; - } - - error = interface->move_to( &v_start, user ); - if (error) goto Exit; - - while (point < limit) - { - point++; - tags++; - - tag = FT_CURVE_TAG( tags[0] ); - switch (tag) - { - case FT_Curve_Tag_On: /* emit a single line_to */ - { - error = interface->line_to( point, user ); - if (error) goto Exit; - continue; - } - - - case FT_Curve_Tag_Conic: /* consume conic arcs */ - { - v_control = point[0]; - - Do_Conic: - if (point < limit) - { - FT_Vector v_middle; - - point++; - tags++; - tag = FT_CURVE_TAG( tags[0] ); - - if (tag == FT_Curve_Tag_On) - { - error = interface->conic_to( &v_control, point, user ); - if (error) goto Exit; - continue; - } - - if (tag != FT_Curve_Tag_Conic) - goto Invalid_Outline; - - v_middle.x = (v_control.x + point->x)/2; - v_middle.y = (v_control.y + point->y)/2; - - error = interface->conic_to( &v_control, &v_middle, user ); - if (error) goto Exit; - - v_control = point[0]; - goto Do_Conic; - } - - error = interface->conic_to( &v_control, &v_start, user ); - goto Close; - } - - default: /* FT_Curve_Tag_Cubic */ - { - if ( point+1 > limit || - FT_CURVE_TAG( tags[1] ) != FT_Curve_Tag_Cubic ) - goto Invalid_Outline; - - point += 2; - tags += 2; - - if (point <= limit) - { - error = interface->cubic_to( point-2, point-1, point, user ); - if (error) goto Exit; - continue; - } - - error = interface->cubic_to( point-2, point-1, &v_start, user ); - goto Close; - } - } - } - - /* close the contour with a line segment */ - error = interface->line_to( &v_start, user ); - - Close: - if (error) goto Exit; - first = last+1; - } - - return 0; - Exit: - return error; - - Invalid_Outline: - return -1; - } -#endif /*************************************************************************/ /* */ @@ -448,11 +275,10 @@ /* code of this function, replacing allocations with `malloc()' if */ /* you want to control where the objects go. */ /* */ - BASE_FUNC - FT_Error FT_Outline_New( FT_Library library, - FT_UInt numPoints, - FT_Int numContours, - FT_Outline* outline ) + BASE_FUNC(FT_Error) FT_Outline_New( FT_Library library, + FT_UInt numPoints, + FT_Int numContours, + FT_Outline* outline ) { FT_Error error; FT_Memory memory; @@ -512,9 +338,8 @@ /* of this function, replacing allocations with `malloc()' in your */ /* application if you want something simpler. */ /* */ - BASE_FUNC - FT_Error FT_Outline_Done( FT_Library library, - FT_Outline* outline ) + BASE_FUNC(FT_Error) FT_Outline_Done( FT_Library library, + FT_Outline* outline ) { FT_Memory memory = library->memory; @@ -561,9 +386,8 @@ /* */ /* Yes. */ /* */ - BASE_FUNC - void FT_Outline_Get_CBox( FT_Outline* outline, - FT_BBox* cbox ) + BASE_FUNC(void) FT_Outline_Get_CBox( FT_Outline* outline, + FT_BBox* cbox ) { FT_Pos xMin, yMin, xMax, yMax; @@ -623,10 +447,9 @@ /* */ /* Yes. */ /* */ - BASE_FUNC - void FT_Outline_Translate( FT_Outline* outline, - FT_Pos xOffset, - FT_Pos yOffset ) + BASE_FUNC(void) FT_Outline_Translate( FT_Outline* outline, + FT_Pos xOffset, + FT_Pos yOffset ) { FT_UShort n; FT_Vector* vec = outline->points; @@ -655,8 +478,7 @@ /* This functions toggles the bit flag ft_outline_reverse_fill in */ /* the outline's "flags" field.. */ /* */ - BASE_FUNC - void FT_Outline_Reverse( FT_Outline* outline ) + BASE_FUNC(void) FT_Outline_Reverse( FT_Outline* outline ) { FT_UShort n; FT_Int first, last; @@ -714,8 +536,7 @@ /* */ /* zone :: pointer to the target glyph zone. */ /* */ - BASE_FUNC - void FT_Done_GlyphZone( FT_GlyphZone* zone ) + BASE_FUNC(void) FT_Done_GlyphZone( FT_GlyphZone* zone ) { FT_Memory memory = zone->memory; @@ -749,11 +570,10 @@ /* */ /* FreeType error code. 0 means success. */ /* */ - BASE_FUNC - FT_Error FT_New_GlyphZone( FT_Memory memory, - FT_UShort maxPoints, - FT_Short maxContours, - FT_GlyphZone* zone ) + BASE_FUNC(FT_Error) FT_New_GlyphZone( FT_Memory memory, + FT_UShort maxPoints, + FT_Short maxContours, + FT_GlyphZone* zone ) { FT_Error error; @@ -796,10 +616,9 @@ /* maxContours :: The address of the zone's current capacity for */ /* contours. */ /* */ - BASE_FUNC - FT_Error FT_Update_GlyphZone( FT_GlyphZone* zone, - FT_UShort newPoints, - FT_Short newContours ) + BASE_FUNC(FT_Error) FT_Update_GlyphZone( FT_GlyphZone* zone, + FT_UShort newPoints, + FT_Short newContours ) { FT_Error error = FT_Err_Ok; FT_Memory memory = zone->memory; @@ -856,10 +675,9 @@ /* */ /* It will use the raster correponding to the default glyph format. */ /* */ - EXPORT_FUNC - FT_Error FT_Outline_Get_Bitmap( FT_Library library, - FT_Outline* outline, - FT_Bitmap* map ) + EXPORT_FUNC(FT_Error) FT_Outline_Get_Bitmap( FT_Library library, + FT_Outline* outline, + FT_Bitmap* map ) { FT_Error error; FT_Raster raster; @@ -912,10 +730,9 @@ /* scan converter is called, which means that the value you give it */ /* is actually ignored.. */ /* */ - EXPORT_FUNC - FT_Error FT_Outline_Render( FT_Library library, - FT_Outline* outline, - FT_Raster_Params* params ) + EXPORT_FUNC(FT_Error) FT_Outline_Render( FT_Library library, + FT_Outline* outline, + FT_Raster_Params* params ) { FT_Error error; FT_Raster raster; @@ -968,9 +785,8 @@ /* */ /* FreeType error code. 0 means success. */ /* */ - BASE_FUNC - FT_Error FT_Outline_Copy( FT_Outline* source, - FT_Outline* target ) + BASE_FUNC(FT_Error) FT_Outline_Copy( FT_Outline* source, + FT_Outline* target ) { FT_Int is_owner; @@ -1018,9 +834,8 @@ /* You can use FT_Outline_Translate() if you need to translate the */ /* outline's points. */ /* */ - BASE_FUNC - void FT_Outline_Transform( FT_Outline* outline, - FT_Matrix* matrix ) + BASE_FUNC(void) FT_Outline_Transform( FT_Outline* outline, + FT_Matrix* matrix ) { FT_UShort n; FT_Vector* vec; @@ -1061,9 +876,8 @@ /* */ /* Yes. */ /* */ - EXPORT_DEF - void FT_Vector_Transform( FT_Vector* vector, - FT_Matrix* matrix ) + EXPORT_FUNC(void) FT_Vector_Transform( FT_Vector* vector, + FT_Matrix* matrix ) { FT_Pos xz, yz; @@ -1095,9 +909,8 @@ /* */ /* Yes. */ /* */ - BASE_FUNC - void FT_Matrix_Multiply( FT_Matrix* a, - FT_Matrix* b ) + BASE_FUNC(void) FT_Matrix_Multiply( FT_Matrix* a, + FT_Matrix* b ) { FT_Fixed xx, xy, yx, yy; @@ -1130,8 +943,7 @@ /* */ /* Yes. */ /* */ - BASE_FUNC - FT_Error FT_Matrix_Invert( FT_Matrix* matrix ) + BASE_FUNC(FT_Error) FT_Matrix_Invert( FT_Matrix* matrix ) { FT_Pos delta, xx, yy; diff --git a/src/base/ftstream.c b/src/base/ftstream.c index 03abfb5ca..d759a43b9 100644 --- a/src/base/ftstream.c +++ b/src/base/ftstream.c @@ -5,11 +5,10 @@ #define FT_COMPONENT trace_stream - BASE_FUNC - void FT_New_Memory_Stream( FT_Library library, - void* base, - unsigned long size, - FT_Stream stream ) + BASE_FUNC(void) FT_New_Memory_Stream( FT_Library library, + void* base, + unsigned long size, + FT_Stream stream ) { stream->memory = library->memory; stream->base = (char*)base; @@ -21,9 +20,8 @@ } - BASE_FUNC - FT_Error FT_Seek_Stream( FT_Stream stream, - FT_ULong pos ) + BASE_FUNC(FT_Error) FT_Seek_Stream( FT_Stream stream, + FT_ULong pos ) { FT_Error error; @@ -59,36 +57,32 @@ } - BASE_FUNC - FT_Error FT_Skip_Stream( FT_Stream stream, - FT_Long distance ) + BASE_FUNC(FT_Error) FT_Skip_Stream( FT_Stream stream, + FT_Long distance ) { return FT_Seek_Stream( stream, (FT_ULong)(stream->pos + distance) ); } - BASE_FUNC - FT_Long FT_Stream_Pos( FT_Stream stream ) + BASE_FUNC(FT_Long) FT_Stream_Pos( FT_Stream stream ) { return stream->pos; } - BASE_FUNC - FT_Error FT_Read_Stream( FT_Stream stream, - void* buffer, - FT_ULong count ) + BASE_FUNC(FT_Error) FT_Read_Stream( FT_Stream stream, + void* buffer, + FT_ULong count ) { return FT_Read_Stream_At( stream, stream->pos, buffer, count ); } - BASE_FUNC - FT_Error FT_Read_Stream_At( FT_Stream stream, - FT_ULong pos, - void* buffer, - FT_ULong count ) + BASE_FUNC(FT_Error) FT_Read_Stream_At( FT_Stream stream, + FT_ULong pos, + void* buffer, + FT_ULong count ) { FT_Error error = FT_Err_Ok; FT_ULong read_bytes; @@ -128,9 +122,8 @@ - BASE_FUNC - FT_Error FT_Access_Frame( FT_Stream stream, - FT_ULong count ) + BASE_FUNC(FT_Error) FT_Access_Frame( FT_Stream stream, + FT_ULong count ) { FT_Error error = FT_Err_Ok; FT_ULong read_bytes; @@ -185,8 +178,7 @@ } - BASE_FUNC - void FT_Forget_Frame( FT_Stream stream ) + BASE_FUNC(void) FT_Forget_Frame( FT_Stream stream ) { /* IMPORTANT: The assertion stream->cursor != 0 was removed, given */ /* that it is possible to access a frame of length 0 in */ @@ -210,8 +202,7 @@ } - BASE_FUNC - FT_Char FT_Get_Char( FT_Stream stream ) + BASE_FUNC(FT_Char) FT_Get_Char( FT_Stream stream ) { FT_Char result; @@ -225,8 +216,7 @@ } - BASE_FUNC - FT_Short FT_Get_Short( FT_Stream stream ) + BASE_FUNC(FT_Short) FT_Get_Short( FT_Stream stream ) { char* p; FT_Short result; @@ -242,8 +232,7 @@ } - BASE_FUNC - FT_Long FT_Get_Offset( FT_Stream stream ) + BASE_FUNC(FT_Long) FT_Get_Offset( FT_Stream stream ) { char* p; FT_Long result; @@ -259,8 +248,7 @@ } - BASE_FUNC - FT_Long FT_Get_Long( FT_Stream stream ) + BASE_FUNC(FT_Long) FT_Get_Long( FT_Stream stream ) { char* p; FT_Long result; @@ -276,9 +264,8 @@ } - BASE_FUNC - FT_Char FT_Read_Char( FT_Stream stream, - FT_Error* error ) + BASE_FUNC(FT_Char) FT_Read_Char( FT_Stream stream, + FT_Error* error ) { char result = 0; @@ -310,9 +297,8 @@ } - BASE_FUNC - FT_Short FT_Read_Short( FT_Stream stream, - FT_Error* error ) + BASE_FUNC(FT_Short) FT_Read_Short( FT_Stream stream, + FT_Error* error ) { char reads[2]; char* p = 0; @@ -353,9 +339,8 @@ } - BASE_FUNC - FT_Long FT_Read_Offset( FT_Stream stream, - FT_Error* error ) + BASE_FUNC(FT_Long) FT_Read_Offset( FT_Stream stream, + FT_Error* error ) { char reads[3]; char* p = 0; @@ -396,9 +381,8 @@ } - BASE_FUNC - FT_Long FT_Read_Long( FT_Stream stream, - FT_Error* error ) + BASE_FUNC(FT_Long) FT_Read_Long( FT_Stream stream, + FT_Error* error ) { char reads[4]; char* p = 0; @@ -438,10 +422,9 @@ return 0; } - BASE_FUNC - FT_Error FT_Read_Fields( FT_Stream stream, - const FT_Frame_Field* fields, - void* structure ) + BASE_FUNC(FT_Error) FT_Read_Fields( FT_Stream stream, + const FT_Frame_Field* fields, + void* structure ) { FT_Error error; FT_Bool frame_accessed = 0; diff --git a/src/base/ftsystem.c b/src/base/ftsystem.c index 9836e414b..faf13609c 100644 --- a/src/base/ftsystem.c +++ b/src/base/ftsystem.c @@ -19,7 +19,8 @@ * understand and accept it fully. * **************************************************************************/ - + +#include #include #include @@ -172,9 +173,8 @@ } - extern - int FT_New_Stream( const char* filepathname, - FT_Stream stream ) + EXPORT_FUNC(int) FT_New_Stream( const char* filepathname, + FT_Stream stream ) { FILE* file; @@ -196,8 +196,7 @@ } - extern - FT_Memory FT_New_Memory( void ) + EXPORT_FUNC(FT_Memory) FT_New_Memory( void ) { FT_Memory memory; diff --git a/src/psnames/psdriver.c b/src/psnames/psdriver.c index 23d59b8e8..d2dc154d8 100644 --- a/src/psnames/psdriver.c +++ b/src/psnames/psdriver.c @@ -222,7 +222,6 @@ }; - EXPORT_FUNC const FT_DriverInterface psnames_driver_interface = { sizeof(FT_DriverRec), @@ -239,7 +238,6 @@ #else - EXPORT_FUNC const FT_DriverInterface psnames_driver_interface = { 0, diff --git a/src/psnames/psdriver.h b/src/psnames/psdriver.h index 615eb9352..3d7abd36f 100644 --- a/src/psnames/psdriver.h +++ b/src/psnames/psdriver.h @@ -19,11 +19,9 @@ #ifndef PSDRIVER_H #define PSDRIVER_H -#include #include - EXPORT_DEF - const FT_DriverInterface psnames_driver_interface; + EXPORT_VAR(const FT_DriverInterface) psnames_driver_interface; #endif /* PSDRIVER_H */ diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c index 0273067d6..74d5fd240 100644 --- a/src/sfnt/sfdriver.c +++ b/src/sfnt/sfdriver.c @@ -55,7 +55,6 @@ }; - EXPORT_FUNC const FT_DriverInterface sfnt_driver_interface = { sizeof(FT_DriverRec), diff --git a/src/sfnt/sfdriver.h b/src/sfnt/sfdriver.h index 43640eb35..a29a81c8d 100644 --- a/src/sfnt/sfdriver.h +++ b/src/sfnt/sfdriver.h @@ -21,8 +21,7 @@ #include - EXPORT_DEF - const FT_DriverInterface sfnt_driver_interface; + EXPORT_VAR(const FT_DriverInterface) sfnt_driver_interface; #endif /* SFDRIVER_H */ diff --git a/src/sfnt/ttload.c b/src/sfnt/ttload.c index 0a7f0874e..a40486bff 100644 --- a/src/sfnt/ttload.c +++ b/src/sfnt/ttload.c @@ -50,7 +50,7 @@ /* */ /* pointer to table directory entry. 0 if not found.. */ /* */ - EXPORT_FUNC + LOCAL_FUNC TT_Table* TT_LookUp_Table( TT_Face face, TT_ULong tag ) { @@ -91,7 +91,7 @@ /* */ /* pointer to table directory entry. 0 if not found.. */ /* */ - EXPORT_FUNC + LOCAL_FUNC TT_Error TT_Goto_Table( TT_Face face, TT_ULong tag, FT_Stream stream, diff --git a/src/sfnt/ttload.h b/src/sfnt/ttload.h index 7a6d69af5..d8ff20b2c 100644 --- a/src/sfnt/ttload.h +++ b/src/sfnt/ttload.h @@ -32,7 +32,7 @@ #endif - EXPORT_DEF + LOCAL_DEF TT_Table* TT_LookUp_Table( TT_Face face, TT_ULong tag ); diff --git a/src/sfnt/ttpost.c b/src/sfnt/ttpost.c index 9055da50e..d6cc572bd 100644 --- a/src/sfnt/ttpost.c +++ b/src/sfnt/ttpost.c @@ -403,7 +403,7 @@ /* */ /* TrueType error code. 0 means success. */ /* */ - EXPORT_FUNC + LOCAL_FUNC TT_Error TT_Get_PS_Name( TT_Face face, TT_UInt index, TT_String** PSname ) diff --git a/src/sfnt/ttpost.h b/src/sfnt/ttpost.h index 944c00c65..421397c38 100644 --- a/src/sfnt/ttpost.h +++ b/src/sfnt/ttpost.h @@ -66,7 +66,7 @@ extern "C" { /* */ /* TrueType error code. 0 means success. */ /* */ - EXPORT_DEF + LOCAL_DEF TT_Error TT_Get_PS_Name( TT_Face face, TT_UInt index, TT_String** PSname ); diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c index 587defb0f..5e216385f 100644 --- a/src/truetype/ttdriver.c +++ b/src/truetype/ttdriver.c @@ -707,8 +707,7 @@ /* */ #ifdef FT_CONFIG_OPTION_DYNAMIC_DRIVERS - EXPORT_FUNC - FT_DriverInterface* getDriverInterface( void ) + EXPORT_FUNC(FT_DriverInterface*) getDriverInterface( void ) { return &tt_driver_interface; } diff --git a/src/truetype/ttdriver.h b/src/truetype/ttdriver.h index 5e31b751f..207e06e1b 100644 --- a/src/truetype/ttdriver.h +++ b/src/truetype/ttdriver.h @@ -25,8 +25,7 @@ #include - EXPORT_DEF - const FT_DriverInterface tt_driver_interface; + EXPORT_VAR(const FT_DriverInterface) tt_driver_interface; #endif /* TTDRIVER_H */ diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index d26293d5c..af3982ed9 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -254,7 +254,7 @@ /* */ /* TrueType error code. 0 means success. */ /* */ - EXPORT_FUNC + LOCAL_FUNC TT_Error TT_Goto_CodeRange( TT_ExecContext exec, TT_Int range, TT_Long IP ) @@ -302,7 +302,7 @@ /* */ /* TrueType error code. 0 means success. */ /* */ - EXPORT_FUNC + LOCAL_FUNC TT_Error TT_Set_CodeRange( TT_ExecContext exec, TT_Int range, void* base, @@ -337,7 +337,7 @@ /* */ /* Does not set the Error variable. */ /* */ - EXPORT_FUNC + LOCAL_FUNC TT_Error TT_Clear_CodeRange( TT_ExecContext exec, TT_Int range ) { @@ -540,7 +540,7 @@ /* */ /* Only the glyph loader and debugger should call this function. */ /* */ - EXPORT_FUNC + LOCAL_FUNC TT_Error TT_Load_Context( TT_ExecContext exec, TT_Face face, TT_Size size ) @@ -642,7 +642,7 @@ /* */ /* Only the glyph loader and debugger should call this function. */ /* */ - EXPORT_FUNC + LOCAL_FUNC TT_Error TT_Save_Context( TT_ExecContext exec, TT_Size size ) { @@ -686,7 +686,7 @@ /* */ /* Only the glyph loader and debugger should call this function. */ /* */ - EXPORT_FUNC + LOCAL_FUNC TT_Error TT_Run_Context( TT_ExecContext exec, TT_Bool debug ) { @@ -762,8 +762,7 @@ /* */ /* Only the glyph loader and debugger should call this function. */ /* */ - EXPORT_FUNC - TT_ExecContext TT_New_Context( TT_Face face ) + EXPORT_FUNC(TT_ExecContext) TT_New_Context( TT_Face face ) { TT_Driver driver = (TT_Driver)face->root.driver; TT_ExecContext exec; @@ -817,7 +816,7 @@ /* */ /* Only the glyph loader and debugger should call this function. */ /* */ - EXPORT_FUNC + LOCAL_FUNC TT_Error TT_Done_Context( TT_ExecContext exec ) { /* Nothing at all for now */ @@ -6668,18 +6667,13 @@ /*************************************************************************/ - EXPORT_FUNC -#ifndef DEBUG_INTERPRETER - TT_Error TT_RunIns( TT_ExecContext exc ) -#else - TT_Error TT_RunIns2( TT_ExecContext exc ) -#endif + EXPORT_FUNC(TT_Error) TT_RunIns( TT_ExecContext exc ) { TT_Long ins_counter = 0; /* executed instructions counter */ -#ifdef TT_CONFIG_OPTION_STATIC_RASTER + #ifdef TT_CONFIG_OPTION_STATIC_RASTER cur = *exc; -#endif + #endif /* set CVT functions */ CUR.tt_metrics.ratio = 0; @@ -7361,695 +7355,22 @@ } while ( !CUR.instruction_trap ); LNo_Error_: -#ifdef TT_CONFIG_OPTION_STATIC_RASTER + #ifdef TT_CONFIG_OPTION_STATIC_RASTER *exc = cur; -#endif + #endif return TT_Err_Ok; LErrorCodeOverflow_: CUR.error = TT_Err_Code_Overflow; LErrorLabel_: -#ifdef TT_CONFIG_OPTION_STATIC_RASTER + #ifdef TT_CONFIG_OPTION_STATIC_RASTER *exc = cur; -#endif + #endif return CUR.error; } -#if 0 - - /* This function must be declared by the debugger front end */ - /* in order to specify which code range to debug. */ - - int debug_coderange = tt_coderange_glyph; - - static char tempStr[128]; - - static const char* OpStr[256] = - { - "SVTCA y", /* Set vectors to coordinate axis y */ - "SVTCA x", /* Set vectors to coordinate axis x */ - "SPvTCA y", /* Set Proj. vec. to coord. axis y */ - "SPvTCA x", /* Set Proj. vec. to coord. axis x */ - "SFvTCA y", /* Set Free. vec. to coord. axis y */ - "SFvTCA x", /* Set Free. vec. to coord. axis x */ - "SPvTL //", /* Set Proj. vec. parallel to segment */ - "SPvTL +", /* Set Proj. vec. normal to segment */ - "SFvTL //", /* Set Free. vec. parallel to segment */ - "SFvTL +", /* Set Free. vec. normal to segment */ - "SPvFS", /* Set Proj. vec. from stack */ - "SFvFS", /* Set Free. vec. from stack */ - "GPV", /* Get projection vector */ - "GFV", /* Get freedom vector */ - "SFvTPv", /* Set free. vec. to proj. vec. */ - "ISECT", /* compute intersection */ - - "SRP0", /* Set reference point 0 */ - "SRP1", /* Set reference point 1 */ - "SRP2", /* Set reference point 2 */ - "SZP0", /* Set Zone Pointer 0 */ - "SZP1", /* Set Zone Pointer 1 */ - "SZP2", /* Set Zone Pointer 2 */ - "SZPS", /* Set all zone pointers */ - "SLOOP", /* Set loop counter */ - "RTG", /* Round to Grid */ - "RTHG", /* Round to Half-Grid */ - "SMD", /* Set Minimum Distance */ - "ELSE", /* Else */ - "JMPR", /* Jump Relative */ - "SCvTCi", /* Set CVT */ - "SSwCi", /* */ - "SSW", /* */ - - "DUP", - "POP", - "CLEAR", - "SWAP", - "DEPTH", - "CINDEX", - "MINDEX", - "AlignPTS", - "INS_$28", - "UTP", - "LOOPCALL", - "CALL", - "FDEF", - "ENDF", - "MDAP[-]", - "MDAP[r]", - - "IUP[y]", - "IUP[x]", - "SHP[0]", - "SHP[1]", - "SHC[0]", - "SHC[1]", - "SHZ[0]", - "SHZ[1]", - "SHPIX", - "IP", - "MSIRP[0]", - "MSIRP[1]", - "AlignRP", - "RTDG", - "MIAP[-]", - "MIAP[r]", - - "NPushB", - "NPushW", - "WS", - "RS", - "WCvtP", - "RCvt", - "GC[0]", - "GC[1]", - "SCFS", - "MD[0]", - "MD[1]", - "MPPEM", - "MPS", - "FlipON", - "FlipOFF", - "DEBUG", - - "LT", - "LTEQ", - "GT", - "GTEQ", - "EQ", - "NEQ", - "ODD", - "EVEN", - "IF", - "EIF", - "AND", - "OR", - "NOT", - "DeltaP1", - "SDB", - "SDS", - - "ADD", - "SUB", - "DIV", - "MUL", - "ABS", - "NEG", - "FLOOR", - "CEILING", - "ROUND[G]", - "ROUND[B]", - "ROUND[W]", - "ROUND[?]", - "NROUND[G]", - "NROUND[B]", - "NROUND[W]", - "NROUND[?]", - - "WCvtF", - "DeltaP2", - "DeltaP3", - "DeltaC1", - "DeltaC2", - "DeltaC3", - "SROUND", - "S45Round", - "JROT", - "JROF", - "ROFF", - "INS_$7B", - "RUTG", - "RDTG", - "SANGW", - "AA", - - "FlipPT", - "FlipRgON", - "FlipRgOFF", - "INS_$83", - "INS_$84", - "ScanCTRL", - "SDPVTL[0]", - "SDPVTL[1]", - "GetINFO", - "IDEF", - "ROLL", - "MAX", - "MIN", - "ScanTYPE", - "IntCTRL", - "INS_$8F", - - "INS_$90", - "INS_$91", - "INS_$92", - "INS_$93", - "INS_$94", - "INS_$95", - "INS_$96", - "INS_$97", - "INS_$98", - "INS_$99", - "INS_$9A", - "INS_$9B", - "INS_$9C", - "INS_$9D", - "INS_$9E", - "INS_$9F", - - "INS_$A0", - "INS_$A1", - "INS_$A2", - "INS_$A3", - "INS_$A4", - "INS_$A5", - "INS_$A6", - "INS_$A7", - "INS_$A8", - "INS_$A9", - "INS_$AA", - "INS_$AB", - "INS_$AC", - "INS_$AD", - "INS_$AE", - "INS_$AF", - - "PushB[0]", - "PushB[1]", - "PushB[2]", - "PushB[3]", - "PushB[4]", - "PushB[5]", - "PushB[6]", - "PushB[7]", - "PushW[0]", - "PushW[1]", - "PushW[2]", - "PushW[3]", - "PushW[4]", - "PushW[5]", - "PushW[6]", - "PushW[7]", - - "MDRP[G]", - "MDRP[B]", - "MDRP[W]", - "MDRP[?]", - "MDRP[rG]", - "MDRP[rB]", - "MDRP[rW]", - "MDRP[r?]", - "MDRP[mG]", - "MDRP[mB]", - "MDRP[mW]", - "MDRP[m?]", - "MDRP[mrG]", - "MDRP[mrB]", - "MDRP[mrW]", - "MDRP[mr?]", - "MDRP[pG]", - "MDRP[pB]", - - "MDRP[pW]", - "MDRP[p?]", - "MDRP[prG]", - "MDRP[prB]", - "MDRP[prW]", - "MDRP[pr?]", - "MDRP[pmG]", - "MDRP[pmB]", - "MDRP[pmW]", - "MDRP[pm?]", - "MDRP[pmrG]", - "MDRP[pmrB]", - "MDRP[pmrW]", - "MDRP[pmr?]", - - "MIRP[G]", - "MIRP[B]", - "MIRP[W]", - "MIRP[?]", - "MIRP[rG]", - "MIRP[rB]", - "MIRP[rW]", - "MIRP[r?]", - "MIRP[mG]", - "MIRP[mB]", - "MIRP[mW]", - "MIRP[m?]", - "MIRP[mrG]", - "MIRP[mrB]", - "MIRP[mrW]", - "MIRP[mr?]", - "MIRP[pG]", - "MIRP[pB]", - - "MIRP[pW]", - "MIRP[p?]", - "MIRP[prG]", - "MIRP[prB]", - "MIRP[prW]", - "MIRP[pr?]", - "MIRP[pmG]", - "MIRP[pmB]", - "MIRP[pmW]", - "MIRP[pm?]", - "MIRP[pmrG]", - "MIRP[pmrB]", - "MIRP[pmrW]", - "MIRP[pmr?]" - }; - - - const char* Cur_U_Line( TT_ExecContext exec ) - { - char s[32]; - - int op, i, n; - - op = exec->code[exec->IP]; - - sprintf( tempStr, "%s", OpStr[op] ); - - if ( op == 0x40 ) - { - n = exec->code[exec->IP + 1]; - sprintf( s, "(%d)", n ); - strncat( tempStr, s, 8 ); - - if ( n > 20 ) n = 20; /* limit output */ - - for ( i = 0; i < n; i++ ) - { - sprintf( s, " $%02hx", exec->code[exec->IP + i + 2] ); - strncat( tempStr, s, 8 ); - } - } - else if ( op == 0x41 ) - { - n = exec->code[exec->IP + 1]; - sprintf( s, "(%d)", n ); - strncat( tempStr, s, 8 ); - - if ( n > 20 ) n = 20; /* limit output */ - - for ( i = 0; i < n; i++ ) - { - sprintf( s, " $%02hx%02hx", exec->code[exec->IP + i*2 + 2], - exec->code[exec->IP + i*2 + 3] ); - strncat( tempStr, s, 8 ); - } - } - else if ( (op & 0xF8) == 0xB0 ) - { - n = op - 0xB0; - - for ( i = 0; i <= n; i++ ) - { - sprintf( s, " $%02hx", exec->code[exec->IP + i + 1] ); - strncat( tempStr, s, 8 ); - } - } - else if ( (op & 0xF8) == 0xB8 ) - { - n = op-0xB8; - - for ( i = 0; i <= n; i++ ) - { - sprintf( s, " $%02hx%02hx", exec->code[exec->IP + i*2 + 1], - exec->code[exec->IP + i*2 + 2] ); - strncat( tempStr, s, 8 ); - } - } - - return (char*)tempStr; - } - - - EXPORT_FUNC - TT_Error TT_RunIns( TT_ExecContext exc ) - { - TT_Int A, diff; - TT_ULong next_IP; - TT_Char ch, oldch; - char *temp; - int key; - FT_Memory memory; - - TT_Error error = 0; - - FT_GlyphZone save; - FT_GlyphZone pts; - -#define TT_Round_Off 5 -#define TT_Round_To_Half_Grid 0 -#define TT_Round_To_Grid 1 -#define TT_Round_To_Double_Grid 2 -#define TT_Round_Up_To_Grid 4 -#define TT_Round_Down_To_Grid 3 -#define TT_Round_Super 6 -#define TT_Round_Super_45 7 - - const char* round_str[8] = - { - "to half-grid", - "to grid", - "to double grid", - "down to grid", - "up to grid", - "off", - "super", - "super 45" - }; - - /* Check that we're running the code range that is effectively */ - /* asked by the debugger front end. */ - if ( exc->curRange != debug_coderange ) - return TT_RunIns2( exc ); - - pts = exc->pts; - - memory = exc->face->root.memory; - - save.n_points = pts.n_points; - save.n_contours = pts.n_contours; - - MEM_Alloc( save.org, sizeof ( TT_Vector ) * save.n_points ); - MEM_Alloc( save.cur, sizeof ( TT_Vector ) * save.n_points ); - MEM_Alloc( save.tags, sizeof ( TT_Byte ) * save.n_points ); - - exc->instruction_trap = 1; - - oldch = '\0'; - - do - { - if ( exc->IP < exc->codeSize ) - { -#ifdef TT_CONFIG_OPTION_STATIC_INTERPRETER - cur = *exc; -#endif - if ( ( CUR.length = opcode_length[CUR.opcode] ) < 0 ) - { - if ( CUR.IP + 1 > CUR.codeSize ) - goto LErrorCodeOverflow_; - - CUR.length = CUR.code[CUR.IP + 1] + 2; - } - - exc->args = exc->top - (Pop_Push_Count[exc->opcode] >> 4); - - /* `args' is the top of the stack once arguments have been popped. */ - /* One can also interpret it as the index of the last argument. */ - - /* Print the current line. We use a 80-columns console with the */ - /* following formatting: */ - /* */ - /* [loc]:[addr] [opcode] [disassemby] [a][b]|[c][d] */ - /* */ - - { - char temp[80]; - int n, col, pop; - int args = CUR.args; - - - sprintf( temp, "%78c\n", ' ' ); - - /* first letter of location */ - switch ( CUR.curRange ) - { - case tt_coderange_glyph: - temp[0] = 'g'; - break; - case tt_coderange_cvt: - temp[0] = 'c'; - break; - default: - temp[0] = 'f'; - } - - /* current IP */ - sprintf( temp+1, "%04lx: %02x %-36.36s", - CUR.IP, - CUR.opcode, - Cur_U_Line(&CUR) ); - - strncpy( temp+46, " (", 2 ); - - args = CUR.top - 1; - pop = Pop_Push_Count[CUR.opcode] >> 4; - col = 48; - for ( n = 6; n > 0; n-- ) - { - if ( pop == 0 ) - temp[col-1] = (temp[col-1] == '(' ? ' ' : ')' ); - - if ( args < CUR.top && args >= 0 ) - sprintf( temp+col, "%04lx", CUR.stack[args] ); - else - sprintf( temp+col, " " ); - - temp[col+4] = ' '; - col += 5; - pop--; - args--; - } - temp[78] = '\n'; - temp[79] = '\0'; - FT_TRACE0(( temp )); - } - - /* First, check for empty stack and overflow */ - if ( CUR.args < 0 ) - { - FT_TRACE0(( "ERROR : Too few arguments\n" )); - exc->error = TT_Err_Too_Few_Arguments; - goto LErrorLabel_; - } - - CUR.new_top = CUR.args + (Pop_Push_Count[CUR.opcode] & 15); - - /* new_top is the new top of the stack, after the instruction's */ - /* execution. top will be set to new_top after the 'case' */ - - if ( CUR.new_top > CUR.stackSize ) - { - FT_TRACE0(( "ERROR : Stack overflow\n" )); - exc->error = TT_Err_Stack_Overflow; - goto LErrorLabel_; - } - } - else - FT_TRACE0(( "End of program reached.\n" )); - - key = 0; - do - { - /* read keyboard */ - - ch = getch(); - - switch ( ch ) - { - /* Help - show keybindings */ - case '?': - FT_TRACE0(( "FDebug Help\n\n" )); - FT_TRACE0(( "? Show this page\n" )); - FT_TRACE0(( "q Quit debugger\n" )); - FT_TRACE0(( "n Skip to next instruction\n" )); - FT_TRACE0(( "s Step into\n" )); - FT_TRACE0(( "v Show vector info\n" )); - FT_TRACE0(( "g Show graphics state\n" )); - FT_TRACE0(( "p Show points zone\n\n" )); - break; - - /* Show vectors */ - case 'v': - FT_TRACE0(( "freedom (%04hx,%04hx)\n", exc->GS.freeVector.x, - exc->GS.freeVector.y )); - FT_TRACE0(( "projection (%04hx,%04hx)\n", exc->GS.projVector.x, - exc->GS.projVector.y )); - FT_TRACE0(( "dual (%04hx,%04hx)\n\n", exc->GS.dualVector.x, - exc->GS.dualVector.y )); - break; - - /* Show graphics state */ - case 'g': - FT_TRACE0(( "rounding %s\n", round_str[exc->GS.round_state] )); - FT_TRACE0(( "min dist %04lx\n", exc->GS.minimum_distance )); - FT_TRACE0(( "cvt_cutin %04lx\n", exc->GS.control_value_cutin )); - break; - - /* Show points table */ - case 'p': - for ( A = 0; A < exc->pts.n_points; A++ ) - { - FT_TRACE0(( "%02hx ", A )); - FT_TRACE0(( "%08lx,%08lx - ", pts.org[A].x, pts.org[A].y )); - FT_TRACE0(( "%08lx,%08lx\n", pts.cur[A].x, pts.cur[A].y )); - } - FT_TRACE0(( "\n" )); - break; - - default: - key = 1; - } - } while ( !key ); - - MEM_Copy( save.org, pts.org, pts.n_points * sizeof ( TT_Vector ) ); - MEM_Copy( save.cur, pts.cur, pts.n_points * sizeof ( TT_Vector ) ); - MEM_Copy( save.tags, pts.tags, pts.n_points ); - - /* a return indicate the last command */ - if (ch == '\r') - ch = oldch; - - switch ( ch ) - { - /* Quit debugger */ - case 'q': - goto LErrorLabel_; - - /* Step over */ - case 'n': - if ( exc->IP < exc->codeSize ) - { - /* `step over' is equivalent to `step into' except if */ - /* the current opcode is a CALL or LOOPCALL */ - if ( CUR.opcode != 0x2a && CUR.opcode != 0x2b ) - goto Step_into; - - /* otherwise, loop execution until we reach the next opcode */ - next_IP = CUR.IP + CUR.length; - while ( exc->IP != next_IP ) - { - if ( ( error = TT_RunIns2( exc ) ) ) - goto LErrorLabel_; - } - } - oldch = ch; - break; - - /* Step into */ - case 's': - if ( exc->IP < exc->codeSize ) - - Step_into: - if ( ( error = TT_RunIns2( exc ) ) ) - goto LErrorLabel_; - oldch = ch; - break; - - default: - FT_TRACE0(( "unknown command. Press ? for help\n" )); - oldch = '\0'; - } - - for ( A = 0; A < pts.n_points; A++ ) - { - diff = 0; - if ( save.org[A].x != pts.org[A].x ) diff |= 1; - if ( save.org[A].y != pts.org[A].y ) diff |= 2; - if ( save.cur[A].x != pts.cur[A].x ) diff |= 4; - if ( save.cur[A].y != pts.cur[A].y ) diff |= 8; - if ( save.tags[A] != pts.tags[A] ) diff |= 16; - - if ( diff ) - { - FT_TRACE0(( "%02hx ", A )); - - if ( diff & 16 ) temp = "(%01hx)"; else temp = " %01hx "; - FT_TRACE0(( temp, save.tags[A] & 7 )); - - if ( diff & 1 ) temp = "(%08lx)"; else temp = " %08lx "; - FT_TRACE0(( temp, save.org[A].x )); - - if ( diff & 2 ) temp = "(%08lx)"; else temp = " %08lx "; - FT_TRACE0(( temp, save.org[A].y )); - - if ( diff & 4 ) temp = "(%08lx)"; else temp = " %08lx "; - FT_TRACE0(( temp, save.cur[A].x )); - - if ( diff & 8 ) temp = "(%08lx)"; else temp = " %08lx "; - FT_TRACE0(( temp, save.cur[A].y )); - - FT_TRACE0(( "\n" )); - - FT_TRACE0(( "%02hx ", A )); - - if ( diff & 16 ) temp = "[%01hx]"; else temp = " %01hx "; - FT_TRACE0(( temp, pts.tags[A] & 7 )); - - if ( diff & 1 ) temp = "[%08lx]"; else temp = " %08lx "; - FT_TRACE0(( temp, pts.org[A].x )); - - if ( diff & 2 ) temp = "[%08lx]"; else temp = " %08lx "; - FT_TRACE0(( temp, pts.org[A].y )); - - if ( diff & 4 ) temp = "[%08lx]"; else temp = " %08lx "; - FT_TRACE0(( temp, pts.cur[A].x )); - - if ( diff & 8 ) temp = "[%08lx]"; else temp = " %08lx "; - FT_TRACE0(( temp, pts.cur[A].y )); - - FT_TRACE0(( "\n\n" )); - } - } - } while ( TRUE ); - - LErrorLabel_: - - return error; - - LErrorCodeOverflow_: - error = TT_Err_Code_Overflow; - return error; - } - -#endif /* DEBUG_INTERPRETER */ - #endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */ /* END */ diff --git a/src/truetype/ttinterp.h b/src/truetype/ttinterp.h index 1819d7fd7..239fa9380 100644 --- a/src/truetype/ttinterp.h +++ b/src/truetype/ttinterp.h @@ -314,8 +314,10 @@ /* */ /* Only the glyph loader and debugger should call this function. */ /* */ - EXPORT_DEF - TT_ExecContext TT_New_Context( TT_Face face ); + /* This function is publicly exported because it is directly */ + /* invoked by the TrueType debugger.. */ + /* */ + EXPORT_DEF(TT_ExecContext) TT_New_Context( TT_Face face ); /*************************************************************************/ @@ -335,7 +337,7 @@ /* */ /* Only the glyph loader and debugger should call this function. */ /* */ - EXPORT_DEF + LOCAL_DEF TT_Error TT_Done_Context( TT_ExecContext exec ); @@ -381,7 +383,7 @@ /* */ /* Only the glyph loader and debugger should call this function. */ /* */ - EXPORT_DEF + LOCAL_DEF TT_Error TT_Load_Context( TT_ExecContext exec, TT_Face face, TT_Size size ); @@ -456,8 +458,10 @@ /* */ /* Only object manager and debugger should call this function. */ /* */ - EXPORT_DEF - TT_Error TT_RunIns( TT_ExecContext exec ); + /* This function is publicly exported because it is directly */ + /* invoked by the TrueType debugger.. */ + /* */ + EXPORT_DEF(TT_Error) TT_RunIns( TT_ExecContext exec ); #ifdef __cplusplus diff --git a/src/type1/t1driver.c b/src/type1/t1driver.c index 78fe415bc..69984604e 100644 --- a/src/type1/t1driver.c +++ b/src/type1/t1driver.c @@ -360,7 +360,6 @@ /* return a loaded glyph's metrics. */ /* */ - EXPORT_FUNC const FT_DriverInterface t1_driver_interface = { sizeof( FT_DriverRec ), @@ -427,8 +426,7 @@ #ifdef FT_CONFIG_OPTION_DYNAMIC_DRIVERS - EXPORT_FUNC - FT_DriverInterface* getDriverInterface( void ) + EXPORT_FUNC(FT_DriverInterface*) getDriverInterface( void ) { return &t1_driver_interface; } diff --git a/src/type1/t1driver.h b/src/type1/t1driver.h index a442035c3..d1feadc63 100644 --- a/src/type1/t1driver.h +++ b/src/type1/t1driver.h @@ -21,8 +21,7 @@ #include #include - EXPORT_DEF - const FT_DriverInterface t1_driver_interface; + EXPORT_VAR(const FT_DriverInterface) t1_driver_interface; #endif /* T1DRIVER_H */ diff --git a/src/type1/t1gload.c b/src/type1/t1gload.c index e9cd8a3e5..f50505703 100644 --- a/src/type1/t1gload.c +++ b/src/type1/t1gload.c @@ -52,7 +52,7 @@ * *********************************************************************/ - EXPORT_FUNC + LOCAL_FUNC void T1_Init_Builder( T1_Builder* builder, T1_Face face, T1_Size size, @@ -113,7 +113,7 @@ * *********************************************************************/ - EXPORT_FUNC + LOCAL_FUNC void T1_Done_Builder( T1_Builder* builder ) { T1_GlyphSlot glyph = builder->glyph; @@ -142,7 +142,7 @@ * *********************************************************************/ - EXPORT_FUNC + LOCAL_FUNC void T1_Init_Decoder( T1_Decoder* decoder, const T1_Hinter_Funcs* funcs ) { @@ -438,7 +438,7 @@ * *********************************************************************/ - EXPORT_FUNC + LOCAL_FUNC T1_Error T1_Parse_CharStrings( T1_Decoder* decoder, T1_Byte* charstring_base, T1_Int charstring_len, diff --git a/src/type1/t1gload.h b/src/type1/t1gload.h index 6b42d7a8c..53d1d535d 100644 --- a/src/type1/t1gload.h +++ b/src/type1/t1gload.h @@ -299,7 +299,7 @@ * *********************************************************************/ - EXPORT_DEF + LOCAL_DEF void T1_Init_Builder( T1_Builder* builder, T1_Face face, T1_Size size, @@ -326,7 +326,7 @@ * *********************************************************************/ - EXPORT_DEF + LOCAL_DEF void T1_Done_Builder( T1_Builder* builder ); @@ -349,7 +349,7 @@ * *********************************************************************/ - EXPORT_DEF + LOCAL_DEF void T1_Init_Decoder( T1_Decoder* decoder, const T1_Hinter_Funcs* funcs ); @@ -362,7 +362,7 @@ /* This function is exported, because it is used by the T1Dump utility */ - EXPORT_DEF + LOCAL_DEF T1_Error T1_Parse_CharStrings( T1_Decoder* decoder, T1_Byte* charstring_base, T1_Int charstring_len, diff --git a/src/type1z/t1driver.c b/src/type1z/t1driver.c index 3cef9b5d0..7479fab57 100644 --- a/src/type1z/t1driver.c +++ b/src/type1z/t1driver.c @@ -359,7 +359,6 @@ /* return a loaded glyph's metrics. */ /* */ - EXPORT_FUNC const FT_DriverInterface t1z_driver_interface = { sizeof( FT_DriverRec ), @@ -426,8 +425,7 @@ #ifdef FT_CONFIG_OPTION_DYNAMIC_DRIVERS - EXPORT_FUNC - FT_DriverInterface* getDriverInterface( void ) + EXPORT_FUNC(FT_DriverInterface*) getDriverInterface( void ) { return &t1_driver_interface; } diff --git a/src/type1z/t1driver.h b/src/type1z/t1driver.h index 801fc5474..ec43946af 100644 --- a/src/type1z/t1driver.h +++ b/src/type1z/t1driver.h @@ -21,8 +21,7 @@ #include #include - EXPORT_DEF - const FT_DriverInterface t1z_driver_interface; + EXPORT_VAR(const FT_DriverInterface) t1z_driver_interface; #endif /* T1DRIVER_H */ diff --git a/src/type1z/t1gload.c b/src/type1z/t1gload.c index b75098ed6..5dd2ac1c5 100644 --- a/src/type1z/t1gload.c +++ b/src/type1z/t1gload.c @@ -198,7 +198,7 @@ * *********************************************************************/ - EXPORT_FUNC + LOCAL_FUNC void T1_Init_Decoder( T1_Decoder* decoder ) { decoder->top = 0;