2010-09-27 19:53 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/include/hbtrace.h
  * harbour/src/common/hbtrace.c
    + added new C functions:
         int hb_traceflush( int new_flush );
         HB_BOOL hb_tracefile( const char * szFile );

  * harbour/src/rtl/trace.c
    + added new PRG functions:
         HB_TRACEFLUSH( [ <nFlush> | <lFlush> ] ) -> <lPrevFlush>
         HB_TRACEFILE( <cFileName> ) -> <lSetCorrectly>
    * modified PRG function HB_TRACESTATE() to accept logical value as
      parameter and return logical value as reult:
         HB_TRACESTATE( [ <nEnabled> | <lEnabled> ] ) -> <lPrevEnabled>
This commit is contained in:
Przemyslaw Czerpak
2010-09-27 17:54:05 +00:00
parent 22b6f601a5
commit 67d08334d6
4 changed files with 67 additions and 8 deletions

View File

@@ -16,6 +16,21 @@
The license applies to all entries newer than 2009-04-28.
*/
2010-09-27 19:53 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbtrace.h
* harbour/src/common/hbtrace.c
+ added new C functions:
int hb_traceflush( int new_flush );
HB_BOOL hb_tracefile( const char * szFile );
* harbour/src/rtl/trace.c
+ added new PRG functions:
HB_TRACEFLUSH( [ <nFlush> | <lFlush> ] ) -> <lPrevFlush>
HB_TRACEFILE( <cFileName> ) -> <lSetCorrectly>
* modified PRG function HB_TRACESTATE() to accept logical value as
parameter and return logical value as reult:
HB_TRACESTATE( [ <nEnabled> | <lEnabled> ] ) -> <lPrevEnabled>
2010-09-27 11:54 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/contrib/hbwin/hbwinole.h
* harbour/contrib/hbwin/olecore.c

View File

@@ -218,16 +218,19 @@ typedef struct
}
HB_TRACEINFO, * PHB_TRACEINFO;
extern HB_EXPORT int hb_tracestate( int new_state );
extern HB_EXPORT int hb_tracelevel( int new_level );
extern HB_EXPORT void hb_tracelog( int level, const char * file, int line, const char * proc, const char * fmt, ... ) HB_PRINTF_FORMAT( 5, 6 );
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 HB_BOOL hb_tracefile( const char * szFile );
extern HB_EXPORT void hb_traceset( int level, const char * file, int line, const char * proc );
extern HB_EXPORT void hb_tracelog( int level, const char * file, int line, const char * proc, const char * fmt, ... ) HB_PRINTF_FORMAT( 5, 6 );
extern HB_EXPORT void hb_traceset( int level, const char * file, int line, const char * proc );
extern HB_EXPORT PHB_TRACEINFO hb_traceinfo( void );
extern HB_EXPORT int hb_tr_level( void );
extern HB_EXPORT void hb_tr_trace( const char * fmt, ... ) HB_PRINTF_FORMAT( 1, 2 );
extern HB_EXPORT void hb_tr_stealth( const char * fmt, ... ) HB_PRINTF_FORMAT( 1, 2 );
extern HB_EXPORT int hb_tr_level( void );
extern HB_EXPORT void hb_tr_trace( const char * fmt, ... ) HB_PRINTF_FORMAT( 1, 2 );
extern HB_EXPORT void hb_tr_stealth( const char * fmt, ... ) HB_PRINTF_FORMAT( 1, 2 );
HB_EXTERN_END

View File

@@ -117,6 +117,35 @@ int hb_tracelevel( int new_level )
return old_level;
}
HB_BOOL hb_tracefile( const char * szFile )
{
if( szFile && *szFile )
{
FILE * fp = hb_fopen( szFile, "w" );
if( fp )
{
if( s_fp != NULL && s_fp != stderr )
fclose( s_fp );
s_fp = fp;
return HB_TRUE;
}
}
return HB_FALSE;
}
int hb_traceflush( int new_flush )
{
int old_flush = s_flush;
if( new_flush == 0 ||
new_flush == 1 )
s_flush = new_flush;
return old_flush;
}
int hb_tr_level( void )
{
if( s_level == -1 )

View File

@@ -87,7 +87,19 @@ static void hb_trace_message( char * buffer, HB_SIZE nSize, int iParam, int iCou
HB_FUNC( HB_TRACESTATE )
{
hb_retni( hb_tracestate( hb_parnidef( 1, -1 ) ) );
hb_retl( hb_tracestate( HB_ISLOG( 1 ) ? hb_parl( 1 ) :
hb_parnidef( 1, -1 ) ) );
}
HB_FUNC( HB_TRACEFLUSH )
{
hb_retl( hb_traceflush( HB_ISLOG( 1 ) ? hb_parl( 1 ) :
hb_parnidef( 1, -1 ) ) );
}
HB_FUNC( HB_TRACEFILE )
{
hb_retl( hb_tracefile( hb_parc( 1 ) ) );
}
HB_FUNC( HB_TRACELEVEL )