~ubuntu-branches/ubuntu/natty/tilda/natty

« back to all changes in this revision

Viewing changes to src/debug.h

  • Committer: Bazaar Package Importer
  • Author(s): Davide Truffa
  • Date: 2007-11-11 21:28:51 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20071111212851-r7en873eocdv85bj
Tags: 0.09.4+cvs20071012-1
* New upstream release from CVS snapshot 20071012 (Closes: #446745, #432111)
  - removed old patch
  - added 01_general-fixes.patch to debianize this CVS snapshot
  - new build depends on: automake, cvs, flex, libglade2-dev
  - updated copyright file
  - updated README.Debian
* Added Italian translation (02_italian-translation.dpatch)
* Updated menu structure

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* vim: set ts=4 sts=4 sw=4 expandtab textwidth=92: */
 
2
/*
 
3
 * This is free software; you can redistribute it and/or modify it under
 
4
 * the terms of the GNU Library General Public License as published by
 
5
 * the Free Software Foundation; either version 2 of the License, or
 
6
 * (at your option) any later version.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful, but
 
9
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
11
 * General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU Library General Public
 
14
 * License along with this program; if not, write to the Free Software
 
15
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
16
 */
 
17
 
 
18
#ifndef DEBUG_H
 
19
#define DEBUG_H
 
20
 
 
21
#include <tilda-config.h>
 
22
 
 
23
#include <glib.h>
 
24
#include <stdio.h>
 
25
 
 
26
/* Debug Macros
 
27
 *
 
28
 * Add -DDEBUG to your compile options to turn on assert()s.
 
29
 *
 
30
 * If you do not have the DEBUG symbol defined, then asserts will
 
31
 * be turned off and compiled into a noop.
 
32
 */
 
33
 
 
34
#if DEBUG
 
35
 
 
36
    /* Enable asserts */
 
37
    #undef NDEBUG
 
38
    #include <assert.h>
 
39
 
 
40
    #define DEBUG_ASSERT assert
 
41
 
 
42
    #define DEBUG_ERROR(ERRMSG) g_printerr("*** DEVELOPER ERROR *** at %s:%d" \
 
43
                                         " -> %s\n", __FILE__, __LINE__, (ERRMSG))
 
44
 
 
45
#else
 
46
 
 
47
    /* Disable asserts */
 
48
    #define NDEBUG
 
49
    #include <assert.h>
 
50
 
 
51
    #define DEBUG_ASSERT assert
 
52
 
 
53
    #define DEBUG_ERROR(ERRMSG) {}
 
54
 
 
55
#endif
 
56
 
 
57
/* Function tracing
 
58
 *
 
59
 * Add -DDEBUG_FUNCTIONS to your compile options to turn on function tracing.
 
60
 *
 
61
 * If you do not have the DEBUG_FUNCTIONS symbol defined, then function tracing will
 
62
 * be turned off and compiled into a noop.
 
63
 */
 
64
 
 
65
#if DEBUG_FUNCTIONS
 
66
 
 
67
    #define DEBUG_FUNCTION(NAME) g_printerr("FUNCTION ENTERED: %s\n", (NAME))
 
68
 
 
69
#else
 
70
 
 
71
    #define DEBUG_FUNCTION(NAME) {}
 
72
 
 
73
#endif
 
74
 
 
75
/* A macro that calls perror() with a consistent header string */
 
76
#define TILDA_PERROR() perror("tilda")
 
77
 
 
78
 
 
79
#endif /* DEBUG_H */
 
80