Evince
Evince is a document viewer capable of displaying multiple and single page document formats like PDF and Postscript.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ev-debug.h
Go to the documentation of this file.
1 /*
2  * ev-debug.h
3  * This file is part of Evince
4  *
5  * Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence
6  * Copyright (C) 2000, 2001 Chema Celorio, Paolo Maggi
7  * Copyright (C) 2002 - 2005 Paolo Maggi
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program 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
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor,
22  * Boston, MA 02110-1301, USA.
23  */
24 
25 /*
26  * Modified by the gedit Team, 1998-2005. See the AUTHORS file for a
27  * list of people on the gedit Team.
28  * See the ChangeLog files for a list of changes.
29  *
30  * $Id: gedit-debug.h 4809 2006-04-08 14:46:31Z pborelli $
31  */
32 
33 /* Modified by Evince Team */
34 
35 #if !defined (EVINCE_COMPILATION)
36 #error "This is a private header."
37 #endif
38 
39 #ifndef __EV_DEBUG_H__
40 #define __EV_DEBUG_H__
41 
42 #include <glib-object.h>
43 
44 #define EV_GET_TYPE_NAME(instance) g_type_name_from_instance ((gpointer)instance)
45 
46 #ifndef EV_ENABLE_DEBUG
47 
48 #define _ev_debug_init()
49 #define _ev_debug_shutdown()
50 #if defined(G_HAVE_GNUC_VARARGS)
51 #define ev_debug_message(section, format, args...) G_STMT_START { } G_STMT_END
52 #define ev_profiler_start(format, args...) G_STMT_START { } G_STMT_END
53 #define ev_profiler_stop(format, args...) G_STMT_START { } G_STMT_END
54 #elif defined(G_HAVE_ISO_VARARGS)
55 #define ev_debug_message(...) G_STMT_START { } G_STMT_END
56 #define ev_profiler_start(...) G_STMT_START { } G_STMT_END
57 #define ev_profiler_stop(...) G_STMT_START { } G_STMT_END
58 #else /* no varargs macros */
59 static void ev_debug_message(EvDebugSection section, const gchar *file, gint line, const gchar *function, const gchar *format, ...) {}
60 static void ev_profiler_start(EvProfileSection section, const gchar *format, ...) {}
61 static void ev_profiler_stop(EvProfileSection section, const gchar *format, ...) {}
62 #endif
63 
64 #else /* ENABLE_DEBUG */
65 
66 G_BEGIN_DECLS
67 
68 /*
69  * Set an environmental var of the same name to turn on
70  * debugging output. Setting EV_DEBUG will turn on all
71  * sections.
72  */
73 typedef enum {
74  EV_NO_DEBUG = 0,
75  EV_DEBUG_JOBS = 1 << 0,
76  EV_DEBUG_SHOW_BORDERS = 1 << 1
77 } EvDebugSection;
78 
79 typedef enum {
80  EV_DEBUG_BORDER_NONE = 0,
81  EV_DEBUG_BORDER_CHARS = 1 << 0,
82  EV_DEBUG_BORDER_LINKS = 1 << 1,
83  EV_DEBUG_BORDER_FORMS = 1 << 2,
84  EV_DEBUG_BORDER_ANNOTS = 1 << 3,
85  EV_DEBUG_BORDER_IMAGES = 1 << 4,
86  EV_DEBUG_BORDER_MEDIA = 1 << 5,
87  EV_DEBUG_BORDER_SELECTIONS = 1 << 6,
88  EV_DEBUG_BORDER_ALL = (1 << 7) - 1
89 } EvDebugBorders;
90 
91 #define DEBUG_JOBS EV_DEBUG_JOBS, __FILE__, __LINE__, G_STRFUNC
92 
93 /*
94  * Set an environmental var of the same name to turn on
95  * profiling. Setting EV_PROFILE will turn on all
96  * sections.
97  */
98 typedef enum {
99  EV_NO_PROFILE = 0,
100  EV_PROFILE_JOBS = 1 << 0
101 } EvProfileSection;
102 
103 void _ev_debug_init (void);
104 void _ev_debug_shutdown (void);
105 
106 void ev_debug_message (EvDebugSection section,
107  const gchar *file,
108  gint line,
109  const gchar *function,
110  const gchar *format, ...) G_GNUC_PRINTF(5, 6);
111 void ev_profiler_start (EvProfileSection section,
112  const gchar *format, ...) G_GNUC_PRINTF(2, 3);
113 void ev_profiler_stop (EvProfileSection section,
114  const gchar *format, ...) G_GNUC_PRINTF(2, 3);
115 
116 EvDebugBorders ev_debug_get_debug_borders (void);
117 
118 G_END_DECLS
119 
120 #endif /* EV_ENABLE_DEBUG */
121 #endif /* __EV_DEBUG_H__ */