Re: [Harbour] Question about C macro HB_TRACE.

2010-01-01 Thread Xavi

I answer myself .-

#ifdef _MAKET_H_
#  ifdef _DEBUG
# define MK_ECHO_TRACE_HB_TR_DEBUG(x) do{ mk_ods x ; } while( 0 )
#  else
# define MK_ECHO_TRACE_HB_TR_DEBUG(x)
#  endif
#  undef  HB_TRACE
#  define HB_TRACE(l, x) MK_ECHO_TRACE_##l(x)
#endif

Welcome 2010 :)

--
Xavi

___
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


[Harbour] Question about C macro HB_TRACE.

2009-12-31 Thread Xavi

I have this definition .-

#ifndef _MAKET_H_
#  ifdef _DEBUG
# define mk_ods(fmt, ...) HB_TRACE(HB_TR_DEBUG, (fmt, ##__VA_ARGS__))
#  else
# define mk_ods(fmt, ...)
#  endif
#endif

mk_ods( Hello! );

How can I have the opposite?

#ifdef _MAKET_H_
#  undef HB_TRACE
#  ifndef _DEBUG
# define HB_TRACE(HB_TR_DEBUG, (fmt, ...)) mk_ods(fmt, ##__VA_ARGS__)
#  else
# define HB_TRACE(HB_TR_DEBUG, (fmt, ...))
#  endif
#endif

HB_TRACE(HB_TR_DEBUG, (Hello!));

Sorry, it might be a nonsense but don't go out the errors. :'(

Maket\wapi_winbase_mutex.c|91|error: ( may not appear in macro parameter list|
Maket\wapi_winbase_mutex.c|91|warning: __VA_ARGS__ can only appear in the 
expansion of a C99 variadic macro|
Maket\wapi_winbase_mutex.c||In function 'void wapi_SLE_Initialize(void*)':|
Maket\wapi_winbase_mutex.c|105|error: 'HB_TRACE' was not declared in this scope|
Maket\wapi_winbase_mutex.c|110|warning: left-hand operand of comma has no 
effect|
Maket\wapi_winbase_mutex.c|110|warning: right-hand operand of comma has no 
effect|
Maket\wapi_winbase_mutex.c|110|warning: right-hand operand of comma has no 
effect|
Maket\wapi_winbase_mutex.c|111|error: expected ';' before '}' token|
Maket\wapi_winbase_mutex.c|138|warning: 'static_int__hb_WAPI_Initialize_' 
defined but not used|
||=== Build finished: 3 errors, 5 warnings ===|

I don't see, Can it be done easily?

HB_TRACE is wonderful but in my case mk_ods control internal things of develop.

TIA,
--
Xavi

___
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour