* include/freetype/config/ft2build.h (FT2_ROOT, FT2_CONFIG_ROOT):

Removed.  ANSI C doesn't (explicitly) allow macro expansion in
arguments using `##'.
(FT2_PUBLIC_FILE, FT2_CONFIG_FILE, FT2_INTERNAL_FILE): Use directory
names directly.  Make them configurable.  Use `##' to strip leading
and trailing spaces from arguments.

* builds/unix/ft2unix.h: Adapted.

* src/base/ftsystem.c (ft_alloc, ft_realloc, ft_free, ft_io_stream,
ft_close_stream): Use FT_CALLBACK_DEF.

* builds/unix/ftsystem.c: Use new header scheme.
(FT_Done_Memory): Use free() from FT_Memory structure.

* src/base/ftinit.c, src/base/ftmac.c: Header scheme fixes.

* include/freetype/config/ft2build.h (FT2_CONFIG_ROOT,
FT2_PUBLIC_FILE, FT2_CONFIG_FILE, FT2_INTERNAL_FILE,
FT_SOURCE_FILE): Use `##' operator to be really ANSI C compliant.
This commit is contained in:
Werner Lemberg 2000-12-12 22:28:12 +00:00
parent 282a4742cf
commit 0f4d90d294
81 changed files with 310 additions and 342 deletions

View File

@ -1,8 +1,27 @@
2000-12-12 Werner Lemberg <wl@gnu.org>
* include/freetype/config/ft2build.h (FT2_ROOT, FT2_CONFIG_ROOT):
Removed. ANSI C doesn't (explicitly) allow macro expansion in
arguments using `##'.
(FT2_PUBLIC_FILE, FT2_CONFIG_FILE, FT2_INTERNAL_FILE): Use directory
names directly. Make them configurable. Use `##' to strip leading
and trailing spaces from arguments.
* builds/unix/ft2unix.h: Adapted.
* src/base/ftsystem.c (ft_alloc, ft_realloc, ft_free, ft_io_stream,
ft_close_stream): Use FT_CALLBACK_DEF.
* builds/unix/ftsystem.c: Use new header scheme.
(FT_Done_Memory): Use free() from FT_Memory structure.
* src/base/ftinit.c, src/base/ftmac.c: Header scheme fixes.
2000-12-11 Werner Lemberg <wl@gnu.org>
* include/freetype/config/build.h (FT2_CONFIG_ROOT, FT2_PUBLIC_FILE,
FT2_CONFIG_FILE, FT2_INTERNAL_FILE, FT_SOURCE_FILE): Use `##'
operator to be really ANSI C compliant.
* include/freetype/config/ft2build.h (FT2_CONFIG_ROOT,
FT2_PUBLIC_FILE, FT2_CONFIG_FILE, FT2_INTERNAL_FILE,
FT_SOURCE_FILE): Use `##' operator to be really ANSI C compliant.
2000-12-09 Werner Lemberg <wl@gnu.org>

View File

@ -13,22 +13,30 @@
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/* */
/* This is a Unix-specific version of <ft2build.h> that should be */
/* used exclusively _once_ the library has been installed on the */
/* system. */
/* */
/* currently, the FreeType 2 root is at "freetype2/freetype", though */
/* it will change to a simple "freetype2" in the near future.. */
/* */
/***************************************************************************/
/*************************************************************************/
/* */
/* This is a Unix-specific version of <ft2build.h> that should be used */
/* exclusively *after* installation of the library. */
/* */
/* Currently, the FreeType 2 root is at "freetype2/freetype", though it */
/* will change to "freetype2" in the near future. */
/* */
/*************************************************************************/
#ifndef __FT2_BUILD_UNIX_H__
#define __FT2_BUILD_UNIX_H__
#define FT2_ROOT freetype2/freetype
#include <FT2_ROOT/config/ft2build.h>
#define FT2_PUBLIC_FILE( x ) <freetype2/freetype/ ## x ## >
#define FT2_CONFIG_FILE( x ) <freetype2/freetype/config/ ## x ## >
#define FT2_INTERNAL_FILE( x ) <freetype2/freetype/internal/ ## x ## >
#include FT2_CONFIG_FILE( ft2build.h )
#endif /* __FT2_BUILD_UNIX_H__ */
/* END */

View File

@ -16,17 +16,13 @@
/***************************************************************************/
#include <ftconfig.h>
#include <freetype/internal/ftdebug.h>
#include <freetype/ftsystem.h>
#include <freetype/fterrors.h>
#include <freetype/fttypes.h>
#include <freetype/internal/ftobjs.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ft2build.h>
#include FT_CONFIG_CONFIG_H
#include FT_INTERNAL_DEBUG_H
#include FT_SYSTEM_H
#include FT_ERRORS_H
#include FT_TYPES_h
#include FT_INTERNAL_FTOBJS_H
/* memory-mapping includes and definitions */
#ifdef HAVE_UNISTD_H
@ -87,10 +83,11 @@
/* */
/* <Input> */
/* memory :: A pointer to the memory object. */
/* */
/* size :: The requested size in bytes. */
/* */
/* <Return> */
/* block :: The address of newly allocated block. */
/* The address of newly allocated block. */
/* */
FT_CALLBACK_DEF
void* ft_alloc( FT_Memory memory,
@ -201,23 +198,8 @@
}
/*************************************************************************/
/* */
/* <Function> */
/* FT_New_Stream */
/* */
/* <Description> */
/* Creates a new stream object. */
/* */
/* <Input> */
/* filepathname :: The name of the stream (usually a file) to be */
/* opened. */
/* */
/* stream :: A pointer to the stream object. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
/* documentation is in ftobjs.h */
FT_EXPORT_DEF( FT_Error ) FT_New_Stream( const char* filepathname,
FT_Stream stream )
{
@ -285,17 +267,8 @@
}
/*************************************************************************/
/* */
/* <Function> */
/* FT_New_Memory */
/* */
/* <Description> */
/* Creates a new memory object. */
/* */
/* <Return> */
/* A pointer to the new memory object. 0 in case of error. */
/* */
/* documentation is in ftobjs.h */
FT_EXPORT_DEF( FT_Memory ) FT_New_Memory( void )
{
FT_Memory memory;
@ -314,20 +287,11 @@
}
/*************************************************************************/
/* */
/* <Function> */
/* FT_Done_Memory */
/* */
/* <Description> */
/* Discards memory manager. */
/* */
/* <Input> */
/* memory :: A handle to the memory manager. */
/* */
/* documentation is in ftobjs.h */
FT_EXPORT_DEF( void ) FT_Done_Memory( FT_Memory memory )
{
free( memory );
memory->free( memory, memory );
}

View File

@ -21,18 +21,24 @@
/* This file corresponds to the default "ft2build.h" file for */
/* FreeType 2. It uses the "freetype" include root. */
/* */
/* Note that specific platforms might use a different configurations. */
/* For example, on Unix, the "freetype2" include root is used, with a */
/* specific "ft2build.h" used to take care of this. The latter looks */
/* like the following: */
/* Note that specific platforms might use a different configuration. */
/* For example, on Unix, the "freetype2" include root could be used, */
/* with a specific "ft2build.h" to take care of this. The latter then */
/* looks like the following: */
/* */
/* #ifndef __FT_BUILD_UNIX_H__ */
/* #define __FT_BUILD_UNIX_H__ */
/* #ifndef __FT2_BUILD_UNIX_H__ */
/* #define __FT2_BUILD_UNIX_H__ */
/* */
/* #define FT2_ROOT freetype2 */
/* #include <FT2_ROOT/config/ft2build.h> */
/* #define FT2_PUBLIC_FILE( x ) <freetype2/ ## x ## > */
/* #define FT2_CONFIG_FILE( x ) <freetype2/config/ ## x ## > */
/* #define FT2_INTERNAL_FILE( x ) <freetype2/internal/ ## x ## > */
/* */
/* #endif // __FT_BUILD_UNIX_H__ */
/* #include FT2_CONFIG_FILE( ft2build.h ) */
/* */
/* #endif */
/* */
/* If necessary, the macro FT_SOURCE_FILE() can be redefined also if a */
/* different path separator is needed. */
/* */
/*************************************************************************/
@ -41,68 +47,41 @@
#define __FT2_BUILD_H__
/* We use `##' around some arguments to eliminate leading and trailing */
/* spaces. */
/*************************************************************************/
/* */
/* The macro FT2_ROOT is used to define the root of all public header */
/* files for FreeType 2. By default, it is set to "freetype", which */
/* means that all public files should be included with a line like: */
/* The macro FT2_PUBLIC_FILE is used to include a FreeType 2 public */
/* file. Its parameter is the file pathname, relative to the public */
/* root of a given header file. */
/* */
/* #include <freetype/...> */
/* */
/* Redefine it to something different if necessary, depending where the */
/* library is installed on the particular system. */
/* */
#ifndef FT2_ROOT
#define FT2_ROOT freetype
#ifndef FT2_PUBLIC_FILE
#define FT2_PUBLIC_FILE( x ) <freetype/ ## x ## >
#endif
/*************************************************************************/
/* */
/* The macro FT2_CONFIG_ROOT is used to define the root of all */
/* configuration header files for FreeType 2. By default, it is set to */
/* "freetype/config", which means that all config files should be */
/* include with a line like: */
/* The macro FT2_CONFIG_FILE is used to include a FreeType 2 config */
/* file. Its parameter is the file pathname, relative to the */
/* configuration root directory of a given header file. */
/* */
/* #include <freetype/config/...> */
/* */
/* Redefine it to something different, depending where the library is */
/* installed on the particular system. */
/* */
#ifndef FT2_CONFIG_ROOT
#define FT2_CONFIG_ROOT_( x ) x ## / ## config
#define FT2_CONFIG_ROOT FT2_CONFIG_ROOT_(FT2_ROOT)
#ifndef FT2_CONFIG_FILE
#define FT2_CONFIG_FILE( x ) <freetype/config/ ## x ## >
#endif
/*************************************************************************/
/* */
/* The macro FT2_PUBLIC_FILE is used to include a FreeType 2 public file.*/
/* Its parameter is the file pathname, relative to the public root of a */
/* given header file. */
/* */
#define FT2_PUBLIC_FILE_( x, y ) < ## x ## / ## y ## >
#define FT2_PUBLIC_FILE( x ) FT2_PUBLIC_FILE_(FT2_ROOT,x)
/*************************************************************************/
/* */
/* The macro FT2_CONFIG_FILE is used to include a FreeType 2 config file.*/
/* Its parameter is the file pathname, relative to the configuration */
/* root directory of a given header file. */
/* */
#define FT2_CONFIG_FILE_( x, y ) < ## x ## / ## y ## >
#define FT2_CONFIG_FILE( x ) FT2_CONFIG_FILE_(FT2_CONFIG_ROOT,x)
/*************************************************************************/
/* */
/* The macro FT2_INTERNAL_FILE is used to include a FreeType 2 internal */
/* file. Its parameter is the file pathname, relative to the */
/* configuration root directory of a given header file. */
/* */
#define FT2_INTERNAL_FILE_( x, y ) < ## x ## / ## internal ## / ## y ## >
#define FT2_INTERNAL_FILE( x ) FT2_INTERNAL_FILE_(FT2_ROOT,x)
#ifndef FT2_INTERNAL_FILE
#define FT2_INTERNAL_FILE( x ) <freetype/internal/ ## x ## >
#endif
/*************************************************************************/
@ -119,12 +98,16 @@
/* directory and compile them normally by defining the macro */
/* FT_FLAT_COMPILATION. */
/* */
#ifndef FT_SOURCE_FILE
#ifdef FT_FLAT_COMPILATION
#define FT_SOURCE_FILE( d, x ) #x
#else
#define FT_SOURCE_FILE( d, x ) < ## d ## / ## x ## >
#endif
#endif /* !FT_SOURCE_FILE */
/*************************************************************************/
/* */
@ -168,8 +151,6 @@
/* */
/*************************************************************************/
/* don't add spaces around arguments to FT2_CONFIG_FILE! */
/* configuration files */
#ifndef FT_CONFIG_CONFIG_H
#define FT_CONFIG_CONFIG_H FT2_CONFIG_FILE( ftconfig.h )

View File

@ -23,6 +23,7 @@
#include <ft2build.h>
#include FT_SYSTEM_H
#include FT_IMAGE_H
#include <stddef.h>

View File

@ -18,14 +18,12 @@
/*************************************************************************/
/* */
/* This file is automatically included by `ftbuild.h'. */
/* This file is automatically included by `ft2build.h'. */
/* Do not include it manually! */
/* */
/*************************************************************************/
/* don't add spaces around the argument of FT2_INTERNAL_FILE! */
#define FT_INTERNAL_OBJECTS_H FT2_INTERNAL_FILE( ftobjs.h )
#define FT_INTERNAL_STREAM_H FT2_INTERNAL_FILE( ftstream.h )
#define FT_INTERNAL_MEMORY_H FT2_INTERNAL_FILE( ftmemory.h )

View File

@ -14,24 +14,18 @@
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
/*************************************************************************/
/* */
/* This file corresponds to the default "ft2build.h" file for */
/* FreeType 2. It uses the "freetype" include root. */
/* */
/* Note that specific platforms might use a different configurations. */
/* For example, on Unix, the "freetype2" include root is used, with */
/* a specific "ft2build.h" used to take care of this. The latter */
/* looks like the following: */
/* Note that specific platforms might use a different configuration. */
/* See builds/unix/ft2unix.h for an example. */
/* */
/* #ifndef __FT_BUILD_UNIX_H__ */
/* #define __FT_BUILD_UNIX_H__ */
/* */
/* #define FT_ROOT freetype2 */
/* #include <FT_ROOT/config/ft2build.h> */
/* */
/* #endif // __FT_BUILD_UNIX_H__ */
/* */
/***************************************************************************/
/*************************************************************************/
#ifndef __FT2_BUILD_GENERIC_H__
@ -41,4 +35,5 @@
#endif /* __FT2_BUILD_GENERIC_H__ */
/* END */

View File

@ -60,7 +60,9 @@
#define FT_USE_MODULE( x ) extern const FT_Module_Class* x;
#endif
#include <freetype/config/ftmodule.h>
#include FT_CONFIG_MODULES_H
#undef FT_USE_MODULE
#define FT_USE_MODULE( x ) (const FT_Module_Class*)&x,
@ -68,7 +70,7 @@
static
const FT_Module_Class* const ft_default_modules[] =
{
#include <freetype/config/ftmodule.h>
#include FT_CONFIG_MODULES_H
0
};

View File

@ -60,8 +60,8 @@
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_INTERNAL_STREAM_H
#include FT_SOURCE_FILE(truetype/ttobjs.h)
#include FT_SOURCE_FILE(type1/t1objs.h)
#include FT_SOURCE_FILE( truetype, ttobjs.h )
#include FT_SOURCE_FILE( type1, t1objs.h )
#include <Resources.h>
#include <Fonts.h>

View File

@ -68,7 +68,7 @@
/* <Return> */
/* The address of newly allocated block. */
/* */
static
FT_CALLBACK_DEF
void* ft_alloc( FT_Memory memory,
long size )
{
@ -98,7 +98,7 @@
/* <Return> */
/* The address of the reallocated memory block. */
/* */
static
FT_CALLBACK_DEF
void* ft_realloc( FT_Memory memory,
long cur_size,
long new_size,
@ -124,7 +124,7 @@
/* */
/* block :: The address of block in memory to be freed. */
/* */
static
FT_CALLBACK_DEF
void ft_free( FT_Memory memory,
void* block )
{
@ -166,7 +166,7 @@
/* <Input> */
/* stream :: A pointer to the stream object. */
/* */
static
FT_CALLBACK_DEF
void ft_close_stream( FT_Stream stream )
{
fclose( STREAM_FILE( stream ) );
@ -197,7 +197,7 @@
/* <Return> */
/* The number of bytes actually read. */
/* */
static
FT_CALLBACK_DEF
unsigned long ft_io_stream( FT_Stream stream,
unsigned long offset,
unsigned char* buffer,