| 1 | /** |
| 2 | * @file debug.h |
| 3 | * @brief Debugging Macros |
| 4 | * <p> |
| 5 | * Copyright (C) 2006 Nokia Corporation |
| 6 | * <p> |
| 7 | * Contact: Eduardo Bezerra Valentin <[email protected]> |
| 8 | * |
| 9 | * This library is free software; you can redistribute it and/or |
| 10 | * modify it under the terms of the GNU Library General Public |
| 11 | * License as published by the Free Software Foundation; either |
| 12 | * version 2 of the License, or (at your option) any later version. |
| 13 | * |
| 14 | * This library is distributed in the hope that it will be useful, |
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 17 | * Library General Public License for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU Library General Public License |
| 20 | * along with this program; if not, write to the Free Software |
| 21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 22 | * */ |
| 23 | #ifndef _DEBUG_H |
| 24 | #define _DEBUG_H |
| 25 | |
| 26 | //#define DEBUG |
| 27 | #undef DEBUG |
| 28 | #ifdef DEBUG |
| 29 | #define DEBUG_OUTPUT stderr |
| 30 | #define DPRINT(fmt,arg...) fprintf(DEBUG_OUTPUT, "%s(): " fmt,\ |
| 31 | __FUNCTION__, ##arg) |
| 32 | #define DENTER() fprintf(DEBUG_OUTPUT, "ENTER %s()\n", __FUNCTION__) |
| 33 | #define DLEAVE(a) fprintf(DEBUG_OUTPUT, "LEAVE %s() %d\n", __FUNCTION__, a) |
| 34 | #else |
| 35 | #define DPRINT(fmt,arg...) do { } while (0) |
| 36 | #define DENTER() do { } while (0) |
| 37 | #define DLEAVE(a) do { } while (0) |
| 38 | #endif |
| 39 | |
| 40 | /* Errors on/off */ |
| 41 | #define ERROR_DEBUG |
| 42 | /* #undef ERROR_DEBUG */ |
| 43 | #ifdef ERROR_DEBUG |
| 44 | #define DERROR(fmt,arg...) fprintf(stderr, "%s(): " fmt, \ |
| 45 | __FUNCTION__, ##arg) |
| 46 | #else |
| 47 | #define DERROR(fmt,arg...) \ |
| 48 | do { } while (0) |
| 49 | #endif |
| 50 | |
| 51 | #endif /* _DEBUG_H */ |