6

Debugging

  1. #if !defined( _DEBUG_H )
  2. #define _DEBUG_H
  3.  
  4. #ifdef DEBUG
  5.  
  6. extern int debug;
  7.  
  8. #define ONDEBUG( expr ) do { if ( debug ) { expr; } } while ( 0 )
  9.  
  10. #define ONDEBUG0( expr )    do { if ( debug >= 0  ) { expr; } } while ( 0 )
  11. #define ONDEBUG1( expr )    do { if ( debug >= 1  ) { expr; } } while ( 0 )
  12. #define ONDEBUG2( expr )    do { if ( debug >= 2  ) { expr; } } while ( 0 )
  13. #define ONDEBUG3( expr )    do { if ( debug >= 3  ) { expr; } } while ( 0 )
  14. #define ONDEBUG4( expr )    do { if ( debug >= 4  ) { expr; } } while ( 0 )
  15. #define ONDEBUG5( expr )    do { if ( debug >= 5  ) { expr; } } while ( 0 )
  16. #define ONDEBUG6( expr )    do { if ( debug >= 6  ) { expr; } } while ( 0 )
  17. #define ONDEBUG7( expr )    do { if ( debug >= 7  ) { expr; } } while ( 0 )
  18. #define ONDEBUG8( expr )    do { if ( debug >= 8  ) { expr; } } while ( 0 )
  19. #define ONDEBUG9( expr )    do { if ( debug >= 9  ) { expr; } } while ( 0 )
  20.  
  21. #else
  22.  
  23. #define ONDEBUG( expr )
  24.  
  25. #define ONDEBUG0( expr )
  26. #define ONDEBUG1( expr )
  27. #define ONDEBUG2( expr )
  28. #define ONDEBUG3( expr )
  29. #define ONDEBUG4( expr )
  30. #define ONDEBUG5( expr )
  31. #define ONDEBUG6( expr )
  32. #define ONDEBUG7( expr )
  33. #define ONDEBUG8( expr )
  34. #define ONDEBUG9( expr )
  35.  
  36. #endif
  37.  
  38. #endif

Comments

Your comment:
[p] [b] [i] [u] [s] [quote] [pre] [br] [code] [url] [email] strip help 2000

Enter a maximum of 2000 characters.
Improve the presentation of your text with the following formatting tags:
[p]paragraph[/p], [b]bold[/b], [i]italics[/i], [u]underline[/u], [s]strike[/s], [quote]citation[/quote], [pre]as is[/pre], [br]line break,
[url]http://www.izend.org[/url], [url=http://www.izend.org]site[/url], [email]izend@izend.org[/email], [email=izend@izend.org]izend[/email],
[code]command[/code], [code=language]source code in c, java, php, html, javascript, xml, css, sql, bash, dos, make, etc.[/code].