X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2Findirect.git;a=blobdiff_plain;f=xsh%2Fdebug.h;fp=xsh%2Fdebug.h;h=707c76032eb04660aab844d27edba70a605364f8;hp=0000000000000000000000000000000000000000;hb=7b9a8ae944bb32360e3a8807ec6cb05376fd4183;hpb=dac575f9b1194a2f6fdec8b07b27bac62ecbe30c diff --git a/xsh/debug.h b/xsh/debug.h new file mode 100644 index 0000000..707c760 --- /dev/null +++ b/xsh/debug.h @@ -0,0 +1,27 @@ +#ifndef XSH_DEBUG_H +#define XSH_DEBUG_H 1 + +#include "util.h" /* XSH_PACKAGE, STMT_* */ + +#ifndef XSH_DEBUG +# define XSH_DEBUG 0 +#endif + +#if XSH_DEBUG +# define XSH_D(X) STMT_START X STMT_END +static void xsh_debug_log(const char *fmt, ...) { + va_list va; + SV *sv; + dTHX; + va_start(va, fmt); + sv = get_sv(XSH_PACKAGE "::DEBUG", 0); + if (sv && SvTRUE(sv)) + PerlIO_vprintf(Perl_debug_log, fmt, va); + va_end(va); + return; +} +#else +# define XSH_D(X) +#endif + +#endif /* XSH_DEBUG_H */