2011-09-24 11:10 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbtrace.h
* harbour/src/common/hbtrace.c
+ added new C function:
const char * hb_tracemode( const char * szNewMode );
it can be called with "a" or "w" parameter to set open
mode for newly created by hb_tracefile() log files.
* harbour/src/rtl/trace.c
+ added new PRG function:
HB_TRACEMODE( [<cNewMode>] ) -> <cPrevMode>
This commit is contained in:
@@ -16,6 +16,18 @@
|
||||
The license applies to all entries newer than 2009-04-28.
|
||||
*/
|
||||
|
||||
2011-09-24 11:10 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
|
||||
* harbour/include/hbtrace.h
|
||||
* harbour/src/common/hbtrace.c
|
||||
+ added new C function:
|
||||
const char * hb_tracemode( const char * szNewMode );
|
||||
it can be called with "a" or "w" parameter to set open
|
||||
mode for newly created by hb_tracefile() log files.
|
||||
|
||||
* harbour/src/rtl/trace.c
|
||||
+ added new PRG function:
|
||||
HB_TRACEMODE( [<cNewMode>] ) -> <cPrevMode>
|
||||
|
||||
2011-09-23 18:36 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
|
||||
* harbour/src/rtl/hbrandom.c
|
||||
! fixed HB_RANDOMINTMAX() to return correct value for new PRNG
|
||||
|
||||
@@ -222,6 +222,7 @@ extern HB_EXPORT int hb_tracestate( int new_state );
|
||||
extern HB_EXPORT int hb_tracelevel( int new_level );
|
||||
extern HB_EXPORT int hb_traceflush( int new_flush );
|
||||
extern HB_EXPORT int hb_tracesysout( int new_sysout );
|
||||
extern HB_EXPORT const char * hb_tracemode( const char * szNewMode );
|
||||
extern HB_EXPORT HB_BOOL hb_tracefile( const char * szFile );
|
||||
|
||||
extern HB_EXPORT void hb_tracelog( int level, const char * file, int line, const char * proc, const char * fmt, ... ) HB_PRINTF_FORMAT( 5, 6 );
|
||||
|
||||
@@ -82,6 +82,7 @@ static int s_enabled = 1;
|
||||
static int s_level = -1;
|
||||
static int s_flush = -1;
|
||||
static int s_sysout = -1;
|
||||
static const char * s_mode = "w";
|
||||
|
||||
static FILE * s_fp = NULL;
|
||||
|
||||
@@ -117,11 +118,28 @@ int hb_tracelevel( int new_level )
|
||||
return old_level;
|
||||
}
|
||||
|
||||
const char * hb_tracemode( const char * szNewMode )
|
||||
{
|
||||
const char * szPrevMode = s_mode;
|
||||
|
||||
if( szNewMode ) switch( *szNewMode )
|
||||
{
|
||||
case 'a':
|
||||
s_mode = "a";
|
||||
break;
|
||||
case 'w':
|
||||
s_mode = "w";
|
||||
break;
|
||||
}
|
||||
|
||||
return szPrevMode;
|
||||
}
|
||||
|
||||
HB_BOOL hb_tracefile( const char * szFile )
|
||||
{
|
||||
if( szFile && *szFile )
|
||||
{
|
||||
FILE * fp = hb_fopen( szFile, "w" );
|
||||
FILE * fp = hb_fopen( szFile, s_mode );
|
||||
|
||||
if( fp )
|
||||
{
|
||||
@@ -176,7 +194,7 @@ int hb_tr_level( void )
|
||||
if( hb_getenv_buffer( "HB_TR_OUTPUT", env, sizeof( env ) ) &&
|
||||
env[ 0 ] != '\0' )
|
||||
{
|
||||
s_fp = hb_fopen( env, "w" );
|
||||
s_fp = hb_fopen( env, s_mode );
|
||||
|
||||
if( s_fp == NULL )
|
||||
s_fp = stderr;
|
||||
|
||||
@@ -103,6 +103,11 @@ HB_FUNC( HB_TRACEFLUSH )
|
||||
hb_parnidef( 1, -1 ) ) );
|
||||
}
|
||||
|
||||
HB_FUNC( HB_TRACEMODE )
|
||||
{
|
||||
hb_retc( hb_tracemode( hb_parc( 1 ) ) );
|
||||
}
|
||||
|
||||
HB_FUNC( HB_TRACEFILE )
|
||||
{
|
||||
hb_retl( hb_tracefile( hb_parc( 1 ) ) );
|
||||
|
||||
Reference in New Issue
Block a user