1 /*
2  * Copyright (C) 2006 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
3  *               2012 Henry Gebhardt <hsggebhardt@gmail.com>
4  *               2014 Andriy Grytsenko <andrej@rep.kiev.ua>
5  *
6  * This file is a part of LXPanel project.
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software Foundation,
20  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21  */
22 
23 #include <stdio.h>
24 #include <cairo/cairo.h>
25 
26 /*
27  * Macros ENTER, RET(), and DBG() are for low-level debug. Use them in
28  * combination with defining DEBUG to add some messages that normally
29  * would never be shown. Usually those messages will spam your console
30  * and are just for finding problem, not for production usage.
31  */
32 
33 #ifdef DEBUG
34 
35 #define ENTER          do { fprintf(stderr, "%s:%s:%-5d: ENTER\n",  __FILE__,__FUNCTION__, __LINE__); } while(0)
36 #define RET(args...)   do { fprintf(stderr, "%s:%s:%-5d: RETURN\n", __FILE__, __FUNCTION__, __LINE__);\
37 return args; } while(0)
38 #define DBG(fmt, args...) fprintf(stderr, "%s:%s:%-5d: " fmt,  __FILE__,__FUNCTION__, __LINE__, ## args)
39 
40 #else
41 
42 #define ENTER         do {  } while(0)
43 #define RET(args...)   return args
44 #define DBG(fmt, args...)   do {  } while(0)
45 
46 #endif
47 
48 
49 void _check_cairo_status(cairo_t* cr, char const* file, char const* func, int line);
50 void _check_cairo_surface_status(cairo_surface_t** surf, char const* file, char const* func, int line);
51 
52 #define check_cairo_status(cr) _check_cairo_status(cr, __FILE__, __FUNCTION__, __LINE__)
53 #define check_cairo_surface_status(surf) _check_cairo_surface_status(surf, __FILE__, __FUNCTION__, __LINE__)
54