diff --git a/caca/Makefile.am b/caca/Makefile.am index 7a0e4a5..5ae0911 100644 --- a/caca/Makefile.am +++ b/caca/Makefile.am @@ -19,6 +19,7 @@ libcaca_la_SOURCES = \ caca.h \ caca_types.h \ caca_internals.h \ + caca_debug.h \ caca_stubs.h \ caca_conio.c \ caca_conio.h \ diff --git a/caca/caca_debug.h b/caca/caca_debug.h new file mode 100644 index 0000000..4db3f48 --- /dev/null +++ b/caca/caca_debug.h @@ -0,0 +1,41 @@ +/* + * libcaca Colour ASCII-Art library + * Copyright (c) 2006-2009 Sam Hocevar + * All Rights Reserved + * + * $Id$ + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the Do What The Fuck You Want To + * Public License, Version 2, as published by Sam Hocevar. See + * http://sam.zoy.org/wtfpl/COPYING for more details. + */ + +/* + * This file contains debugging functions. + */ + +#ifndef __CACA_DEBUG_H__ +#define __CACA_DEBUG_H__ + +/* debug messages */ +#if defined DEBUG && !defined __KERNEL__ +# include +# include +static inline void debug(const char *format, ...) +{ + int saved_errno = geterrno(); + va_list args; + va_start(args, format); + fprintf(stderr, "** libcaca debug ** "); + vfprintf(stderr, format, args); + fprintf(stderr, "\n"); + va_end(args); + seterrno(saved_errno); +} +#else +# define debug(format, ...) do {} while(0) +#endif + +#endif /* __CACA_DEBUG_H__ */ + diff --git a/caca/caca_internals.h b/caca/caca_internals.h index c9875e3..0b8b02c 100644 --- a/caca/caca_internals.h +++ b/caca/caca_internals.h @@ -16,6 +16,7 @@ #define __CACA_INTERNALS_H__ #include "caca_stubs.h" +#include "caca_debug.h" typedef struct caca_timer caca_timer_t; typedef struct caca_privevent caca_privevent_t; diff --git a/caca/caca_stubs.h b/caca/caca_stubs.h index 07761a5..edda059 100644 --- a/caca/caca_stubs.h +++ b/caca/caca_stubs.h @@ -16,8 +16,8 @@ * function prototypes that are sometimes missing. */ -#ifndef __STUBS_H__ -#define __STUBS_H__ +#ifndef __CACA_STUBS_H__ +#define __CACA_STUBS_H__ /* errno handling */ #if defined HAVE_ERRNO_H && !defined __KERNEL__ @@ -29,25 +29,6 @@ static inline int geterrno(void) { return errno; } # define geterrno(x) 0 #endif -/* debug messages */ -#if defined DEBUG && !defined __KERNEL__ -# include -# include -static inline void debug(const char *format, ...) -{ - int saved_errno = geterrno(); - va_list args; - va_start(args, format); - fprintf(stderr, "** libcaca debug ** "); - vfprintf(stderr, format, args); - fprintf(stderr, "\n"); - va_end(args); - seterrno(saved_errno); -} -#else -# define debug(format, ...) do {} while(0) -#endif - /* hton16() and hton32() */ #if defined HAVE_HTONS && !defined __KERNEL__ # if defined HAVE_ARPA_INET_H @@ -93,5 +74,5 @@ static inline uint32_t hton32(uint32_t x) } #endif -#endif /* __STUBS_H__ */ +#endif /* __CACA_STUBS_H__ */ diff --git a/caca/libcaca.vcproj b/caca/libcaca.vcproj index 85e4c3d..b023da7 100644 --- a/caca/libcaca.vcproj +++ b/caca/libcaca.vcproj @@ -64,7 +64,7 @@ /> @@ -364,32 +364,32 @@ Name="codec" > + +