ChangeLogTag:Mon Nov 29 12:45:05 1999 Gonzalo A. Diethelm <Gonzalo.Diethelm@jda.cl>

This commit is contained in:
Gonzalo A. Diethelm
1999-11-29 16:00:06 +00:00
parent 151424e708
commit 73ceeb64be
5 changed files with 47 additions and 41 deletions

View File

@@ -1,3 +1,23 @@
Mon Nov 29 12:45:05 1999 Gonzalo A. Diethelm <Gonzalo.Diethelm@jda.cl>
* include/hbtrace.h:
* source/common/hbtrace.c:
* source/rtl/trace.c:
* doc/tracing.txt:
Modified the run-time trace interface functions, to simplify this
interface. Now there are just two C functions:
current_state = hb_tracestate(new_state);
current_level = hb_tracelevel(new_level);
and just two Clipper functions:
current_state := HB_TRACESTATE( [new_state] )
current_level := HB_TRACELEVEL( [new_level] )
Both check their argument, so passing a -1 to any of them will
return the appropriate current setting without modifying it.
19991128-22:24 GMT+1 Victor Szel <info@szelvesz.hu>
* source/rtl/asort.prg
source/rtl/browdb.prg

View File

@@ -141,13 +141,23 @@ TRACING AND RUNTIME
It is also possible to enable and disable tracing at run-time, and to
query and set the trace level. From C code:
* To turn tracing completely off:
* To query the current tracing state, and optionally change the
current state to a given value (which should be in the range [0,1],
otherwise the current state remains unchanged):
hb_traceoff();
hb_tracestate(state);
* To turn tracing back on:
Therefore, to just query the current state, you can safely call
hb_traceon();
current_state = hb_tracestate(-1);
To turn tracing completely off:
hb_tracestate(0);
To turn tracing back on:
hb_tracestate(1);
* To query the current tracing level, and optionally change the
current level to a given value (which should be in the range [0,5],
@@ -157,11 +167,10 @@ query and set the trace level. From C code:
Therefore, to just query the current level, you can safely call
hb_tracelevel(-1);
current_level = hb_tracelevel(-1);
There are wrapper functions callable from Clipper code:
TRACEOFF()
TRACEON()
TRACELEVEL(level)
current_state := HB_TRACESTATE( [new_state] )
current_level := HB_TRACELEVEL( [new_level] )

View File

@@ -122,11 +122,9 @@ extern char * hb_tr_file_;
extern int hb_tr_line_;
extern int hb_tr_level_;
extern int hb_traceenabled( void );
extern void hb_traceenable( int state );
extern void hb_traceon( void );
extern void hb_traceoff( void );
extern int hb_tracestate( int new_state );
extern int hb_tracelevel( int new_level );
extern int hb_tr_level( void );
extern void hb_tr_trace( char * fmt, ... );

View File

@@ -67,24 +67,16 @@ static char * s_slevel[ HB_TR_LAST ] =
"HB_TR_DEBUG"
};
int hb_traceenabled( void )
{
return s_enabled;
}
void hb_traceenable( int enabled )
int hb_tracestate( int new_state )
{
s_enabled = enabled;
}
int old_state = s_enabled;
void hb_traceon( void )
{
s_enabled = 1;
}
if( new_state == 0 ||
new_state == 1 )
s_enabled = new_state;
void hb_traceoff( void )
{
s_enabled = 0;
return old_state;
}
int hb_tracelevel( int new_level )

View File

@@ -47,22 +47,9 @@
#include "extend.h"
HARBOUR HB_HB_TRACEENABLE( void )
HARBOUR HB_HB_TRACESTATE( void )
{
hb_retl( hb_traceenabled() );
if( ISLOG( 1 ) )
hb_traceenable( hb_parl( 1 ) ? 1 : 0 );
}
HARBOUR HB_HB_TRACEON( void )
{
hb_traceon();
}
HARBOUR HB_HB_TRACEOFF( void )
{
hb_traceoff();
hb_retni( hb_tracestate( ISNUM( 1 ) ? hb_parni( 1 ) : -1 ) );
}
HARBOUR HB_HB_TRACELEVEL( void )