1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* 3 * Pan - A Newsreader for Gtk+ 4 * Copyright (C) 2002-2006 Charles Kerr <charles@rebelbase.com> 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; version 2 of the License. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, see <http://www.gnu.org/licenses/>. 17 * 18 */ 19 20 #ifndef __Messages_h__ 21 #define __Messages_h__ 22 23 #include <iostream> 24 25 #define pan_return_if_fail(expr) \ 26 do { \ 27 if (!(expr)) { \ 28 std::cerr << "(" << __FILE__ << ':' << __LINE__ << " " << __func__ << "): assertion \"" << #expr << "\" failed.\n"; \ 29 return; \ 30 } \ 31 } while (0) 32 33 #define pan_return_val_if_fail(expr, val) \ 34 do { \ 35 if (!(expr)) { \ 36 std::cerr << "(" << __FILE__ << ':' << __LINE__ << " " << __func__ << "): assertion \"" << #expr << "\" failed.\n"; \ 37 return val; \ 38 } \ 39 } while (0) 40 41 #endif 42