Merging upstream version 0.7.0 (Closes: #493243, #510888, #567617, #699414, #709777...
[debian/lxpanel.git] / src / dbg.h
CommitLineData
6cc5e1a6
DB
1/**
2 * Copyright (c) 2006 LxDE Developers, see the file AUTHORS for details.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18
19#include <stdio.h>
0f7f2ef3 20#include <cairo/cairo.h>
6cc5e1a6 21
00916e98
AG
22/*
23 * Macros ENTER, RET(), and DBG() are for low-level debug. Use them in
24 * combination with defining DEBUG to add some messages that normally
25 * would never be shown. Usually those messages will spam your console
26 * and are just for finding problem, not for production usage.
27 */
0f7f2ef3 28
6cc5e1a6
DB
29#ifdef DEBUG
30
31#define ENTER do { fprintf(stderr, "%s:%s:%-5d: ENTER\n", __FILE__,__FUNCTION__, __LINE__); } while(0)
32#define RET(args...) do { fprintf(stderr, "%s:%s:%-5d: RETURN\n", __FILE__, __FUNCTION__, __LINE__);\
33return args; } while(0)
34#define DBG(fmt, args...) fprintf(stderr, "%s:%s:%-5d: " fmt, __FILE__,__FUNCTION__, __LINE__, ## args)
6cc5e1a6
DB
35
36#else
37
6cc5e1a6
DB
38#define ENTER do { } while(0)
39#define RET(args...) return args
40#define DBG(fmt, args...) do { } while(0)
6cc5e1a6
DB
41
42#endif
43
0f7f2ef3
AL
44
45void _check_cairo_status(cairo_t* cr, char const* file, char const* func, int line);
46void _check_cairo_surface_status(cairo_surface_t** surf, char const* file, char const* func, int line);
47
48#define check_cairo_status(cr) _check_cairo_status(cr, __FILE__, __FUNCTION__, __LINE__)
49#define check_cairo_surface_status(surf) _check_cairo_surface_status(surf, __FILE__, __FUNCTION__, __LINE__)