forked from minhngoc25a/freetype2
Added functions to initialize and un-initialize logging
This commit is contained in:
parent
01ce8ff340
commit
421bb589e6
|
@ -12,4 +12,15 @@
|
||||||
|
|
||||||
* include/freetype/internal/ftdebug.h: Created an environment for dlg
|
* include/freetype/internal/ftdebug.h: Created an environment for dlg
|
||||||
support in FreeType.
|
support in FreeType.
|
||||||
|
|
||||||
|
* include/freetype/internal/ftdebug.h: Added functions `ft_logging_init()` and `ft_logging_deinit()` for
|
||||||
|
initializing and un-initalizing FILE*.
|
||||||
|
|
||||||
|
* src/base/ftdebug.c:
|
||||||
|
1. Added a FILE* to write logs to file
|
||||||
|
2. Added function definitions for functions
|
||||||
|
`ft_logging_init()` and `ft_logging_deinit()`.
|
||||||
|
|
||||||
|
* src/base/ftinit.c:
|
||||||
|
1. Added a function call to `ft_logging_init()` in `FT_Init_FreeType()` if FT_LOGGING macro is enabled.
|
||||||
|
2. Added a function call to `ft_logging_deinit()` in `FT_Done_FreeType()` if FT_LOGGING macro is enabled.
|
|
@ -307,6 +307,25 @@ FT_BEGIN_HEADER
|
||||||
FT_BASE( void )
|
FT_BASE( void )
|
||||||
ft_debug_init( void );
|
ft_debug_init( void );
|
||||||
|
|
||||||
|
#ifdef FT_LOGGING
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
*
|
||||||
|
* If FT_LOGGING macro is enabled, Freetype needs to initialize and
|
||||||
|
* un-initialize FILE* using following functions
|
||||||
|
* These functions are defined in ftdebug.c
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
FT_BASE( void )
|
||||||
|
ft_logging_init( void );
|
||||||
|
|
||||||
|
FT_BASE( void )
|
||||||
|
ft_logging_deinit( void );
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* FT_LOGGING */
|
||||||
|
|
||||||
FT_END_HEADER
|
FT_END_HEADER
|
||||||
|
|
||||||
#endif /* FTDEBUG_H_ */
|
#endif /* FTDEBUG_H_ */
|
||||||
|
|
|
@ -314,5 +314,37 @@
|
||||||
|
|
||||||
#endif /* !FT_DEBUG_LEVEL_TRACE */
|
#endif /* !FT_DEBUG_LEVEL_TRACE */
|
||||||
|
|
||||||
|
#ifdef FT_LOGGING
|
||||||
|
|
||||||
|
|
||||||
|
/******************************************************************
|
||||||
|
* If FT_LOGGING is enabled FreeType needs a FILE* to write logs
|
||||||
|
* to file.
|
||||||
|
*/
|
||||||
|
static FILE* fileptr = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************
|
||||||
|
*
|
||||||
|
* If FT_LOGGING is enabled, FreeType needs a FILE* to write logs
|
||||||
|
* therefore it uses `ft_logging_init()` function to initialize a
|
||||||
|
* FILE* and `ft_logging_deinit()` to un-initialize the FILE*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
FT_BASE_DEF( void )
|
||||||
|
ft_logging_init( void )
|
||||||
|
{
|
||||||
|
fileptr = fopen( "freetype2.logs", "w" );
|
||||||
|
}
|
||||||
|
|
||||||
|
FT_BASE_DEF( void )
|
||||||
|
ft_logging_deinit( void )
|
||||||
|
{
|
||||||
|
fclose( fileptr );
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* FT_LOGGING */
|
||||||
|
|
||||||
/* END */
|
/* END */
|
||||||
|
|
|
@ -202,6 +202,11 @@
|
||||||
FT_Memory memory;
|
FT_Memory memory;
|
||||||
|
|
||||||
|
|
||||||
|
/* If logging is enabled initialize the FILE* */
|
||||||
|
#ifdef FT_LOGGING
|
||||||
|
ft_logging_init();
|
||||||
|
#endif /* FT_LOGGING */
|
||||||
|
|
||||||
/* check of `alibrary' delayed to `FT_New_Library' */
|
/* check of `alibrary' delayed to `FT_New_Library' */
|
||||||
|
|
||||||
/* First of all, allocate a new system object -- this function is part */
|
/* First of all, allocate a new system object -- this function is part */
|
||||||
|
@ -248,6 +253,11 @@
|
||||||
/* discard memory manager */
|
/* discard memory manager */
|
||||||
FT_Done_Memory( memory );
|
FT_Done_Memory( memory );
|
||||||
|
|
||||||
|
/* If logging is enabled we need to close the FILE* */
|
||||||
|
#ifdef FT_LOGGING
|
||||||
|
ft_logging_deinit();
|
||||||
|
#endif /* FT_LOGGING */
|
||||||
|
|
||||||
return FT_Err_Ok;
|
return FT_Err_Ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue