2008-06-30 11:16 UTC+0200 Viktor Szakats (harbour.01 syenar hu)

* include/hbapi.h
   * source/rtl/set.c
   * source/vm/fm.c
     ! Fixed _SET_HBOUTLOG, _SET_HBOUTLOGINFO handling in fm.c.
       hb_setget*() functions cannot be used here as the set 
       system is deinited at this point. So local buffers are 
       holding the values.
This commit is contained in:
Viktor Szakats
2008-06-30 09:28:58 +00:00
parent 2749fe224a
commit b1118f3481
4 changed files with 50 additions and 6 deletions

View File

@@ -8,6 +8,15 @@
2008-12-31 13:59 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2008-06-30 11:16 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
* include/hbapi.h
* source/rtl/set.c
* source/vm/fm.c
! Fixed _SET_HBOUTLOG, _SET_HBOUTLOGINFO handling in fm.c.
hb_setget*() functions cannot be used here as the set
system is deinited at this point. So local buffers are
holding the values.
2008-06-30 10:08 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
* contrib/gtwvg/Makefile
* contrib/hbapollo/Makefile

View File

@@ -470,6 +470,8 @@ extern HB_EXPORT void hb_xfree( void * pMem ); /* frees mem
extern HB_EXPORT void * hb_xrealloc( void * pMem, ULONG ulSize ); /* reallocates memory */
extern HB_EXPORT ULONG hb_xsize( void * pMem ); /* returns the size of an allocated memory block */
extern HB_EXPORT ULONG hb_xquery( USHORT uiMode ); /* Query different types of memory information */
extern HB_EXPORT void hb_xsetfilename( char * szValue );
extern HB_EXPORT void hb_xsetinfo( char * szValue );
extern HB_EXPORT HB_VMHANDLE hb_xvalloc( ULONG nSize, USHORT nFlags );
extern HB_EXPORT void hb_xvfree( HB_VMHANDLE h );

View File

@@ -876,12 +876,20 @@ HB_FUNC( SET )
case HB_SET_HBOUTLOG:
if( hb_set.HB_SET_HBOUTLOG ) hb_retc( hb_set.HB_SET_HBOUTLOG );
else hb_retc( NULL );
if( args > 1 ) hb_set.HB_SET_HBOUTLOG = set_string( pArg2, hb_set.HB_SET_HBOUTLOG );
if( args > 1 )
{
hb_set.HB_SET_HBOUTLOG = set_string( pArg2, hb_set.HB_SET_HBOUTLOG );
hb_xsetfilename( hb_set.HB_SET_HBOUTLOG );
}
break;
case HB_SET_HBOUTLOGINFO:
if( hb_set.HB_SET_HBOUTLOGINFO ) hb_retc( hb_set.HB_SET_HBOUTLOGINFO );
else hb_retc( NULL );
if( args > 1 ) hb_set.HB_SET_HBOUTLOGINFO = set_string( pArg2, hb_set.HB_SET_HBOUTLOGINFO );
if( args > 1 )
{
hb_set.HB_SET_HBOUTLOGINFO = set_string( pArg2, hb_set.HB_SET_HBOUTLOGINFO );
hb_xsetinfo( hb_set.HB_SET_HBOUTLOGINFO );
}
break;
case HB_SET_INVALID_:
@@ -1004,6 +1012,9 @@ void hb_setInitialize( void )
hb_set.HB_SET_HBOUTLOG = hb_strdup( "hb_out.log" );
hb_set.HB_SET_HBOUTLOGINFO = hb_strdup( "" );
hb_xsetfilename( hb_set.HB_SET_HBOUTLOG );
hb_xsetinfo( hb_set.HB_SET_HBOUTLOGINFO );
sp_sl_first = sp_sl_last = NULL;
s_next_listener = 1;

View File

@@ -156,6 +156,9 @@ static LONG s_lMemoryConsumed = 0; /* memory max size consumed */
static PHB_MEMINFO s_pFirstBlock = NULL;
static PHB_MEMINFO s_pLastBlock = NULL;
static char s_szFileName[ _POSIX_PATH_MAX + 1 ] = { '\0' };
static char s_szInfo[ 256 ] = { '\0' };
#else /* ! HB_FM_STATISTICS */
typedef void * PHB_MEMINFO;
@@ -169,6 +172,25 @@ typedef void * PHB_MEMINFO;
#define HB_MEM_PTR( p ) ( ( void * ) ( ( BYTE * ) ( p ) + HB_MEMINFO_SIZE ) )
HB_EXPORT void hb_xsetfilename( char * szValue )
{
#ifdef HB_FM_STATISTICS
hb_strncpy( s_szFileName, szValue, sizeof( s_szFileName ) - 1 );
#else
HB_SYMBOL_UNUSED( szValue );
#endif
}
HB_EXPORT void hb_xsetinfo( char * szValue )
{
#ifdef HB_FM_STATISTICS
hb_strncpy( s_szInfo, szValue, sizeof( s_szInfo ) - 1 );
#else
HB_SYMBOL_UNUSED( szValue );
#endif
}
HB_EXPORT void * hb_xalloc( ULONG ulSize ) /* allocates fixed memory, returns NULL on failure */
{
PHB_MEMINFO pMem;
@@ -583,8 +605,8 @@ HB_EXPORT void hb_xexit( void ) /* Deinitialize fixed memory subsystem */
char buffer[ 100 ];
FILE * hLog = NULL;
if( s_lMemoryBlocks )
hLog = hb_fopen( hb_setGetCPtr( HB_SET_HBOUTLOG ), "a+" );
if( s_lMemoryBlocks && s_szFileName[ 0 ] )
hLog = hb_fopen( s_szFileName, "a+" );
hb_conOutErr( hb_conNewLine(), 0 );
hb_conOutErr( "----------------------------------------", 0 );
@@ -604,8 +626,8 @@ HB_EXPORT void hb_xexit( void ) /* Deinitialize fixed memory subsystem */
fprintf( hLog, HB_I_("Application Memory Allocation Report - %s\n"), hb_cmdargARGV()[0] );
fprintf( hLog, HB_I_("Terminated at: %04d.%02d.%02d %s\n"), iYear, iMonth, iDay, szTime );
if( *hb_setGetCPtr( HB_SET_HBOUTLOGINFO ) )
fprintf( hLog, HB_I_("Info: %s\n"), hb_setGetCPtr( HB_SET_HBOUTLOGINFO ) );
if( s_szInfo[ 0 ] )
fprintf( hLog, HB_I_("Info: %s\n"), s_szInfo );
fprintf( hLog, "%s\n", buffer );
}