// debug.h - demo of a useful macro for debugging

#ifndef __DEBUG_H__ // avoid multiple inclusion
#define __DEBUG_H__

#define DEBUG_ON

#ifdef DEBUG_ON
static unsigned __active_debug_flags__ = 0;
#endif

// some example flags

#define DEBUG_COMMON      0x00000001
#define DEBUG_SPECIAL     0x00000002
#define DEBUG_NETWORK     0x00000004

#ifdef DEBUG_ON
#define DEBUG(flag,output) \
{if (flag & __active_debug_flags__) \
  printf("%s\n",output);}
#else
#define DEBUG(flag,output) ;
#endif // DEBUG_ON

#endif // __DEBUG_H__
