#ifndef _DEBUG_H #define _DEBUG_H /////////////////////////////////////////////////// /// PRINTF: prints with filename and linenumber /// /////////////////////////////////////////////////// #ifdef DEBUG extern int verbose; #define PRINTF(x) \ PRINTF ## x #if DEBUG >= 1 #define PRINTF1 \ if (verbose >= 1 ) \ printf("%s:%d::", __FILE__, __LINE__) && printf #else #define PRINTF1 // #endif #if DEBUG >= 2 #define PRINTF2 \ if (verbose >= 2 ) \ printf("%s:%d::", __FILE__, __LINE__) && printf #else #define PRINTF2 // #endif #if DEBUG >= 3 #define PRINTF3 \ if (verbose >= 3 ) \ printf("%s:%d::", __FILE__, __LINE__) && printf #else #define PRINTF3 // #endif #if DEBUG >= 4 #define PRINTF4 \ if (verbose >= 4 ) \ printf("%s:%d::", __FILE__, __LINE__) && printf #else #define PRINTF4 // #endif #else #define PRINTF(x) // #endif #define PRINTF0 \ printf("%s:%d::", __FILE__, __LINE__) && printf /////////////////////////////////////////////////// /// PRINT: just prints output as is /// /////////////////////////////////////////////////// #ifdef DEBUG #define PRINT(x) \ PRINT ## x #if DEBUG >= 1 #define PRINT1 \ if (verbose >= 1 ) \ printf #else #define PRINT1 // #endif #if DEBUG >= 2 #define PRINT2 \ if (verbose >= 2 ) \ printf #else #define PRINT2 // #endif #if DEBUG >= 3 #define PRINT3 \ if (verbose >= 3 ) \ printf #else #define PRINT3 // #endif #if DEBUG >= 4 #define PRINT4 \ if (verbose >= 4 ) \ printf #else #define PRINT4 // #endif #else #define PRINT(x) // #endif #define PRINT0 \ printf /////////////////////////////////////////////////// /// COUT: simple cout print with verbose-check /// /////////////////////////////////////////////////// #ifdef DEBUG #define COUT(x) \ COUT ## x #if DEBUG >= 1 #define COUT1 \ if (verbose >= 1 ) \ cout #else #define COUT1 // #endif #if DEBUG >= 2 #define COUT2 \ if (verbose >= 2 ) \ cout #else #define COUT2 // #endif #if DEBUG >= 3 #define COUT3 \ if (verbose >= 3 ) \ cout #else #define COUT3 // #endif #if DEBUG >= 4 #define COUT4 \ if (verbose >= 4 ) \ cout #else #define COUT4 // #endif #else #define COUT(x) // #endif #define COUT0 \ cout #endif /* _DEBUG_H */