color-man.h \
compat.c \
compat.h \
+ debug.c \
+ debug.h \
dnd.c \
dnd.h \
dupe.c \
#include "bar_info.h"
#include "cache.h"
+#include "debug.h"
#include "filelist.h"
#include "info.h"
#include "secure_save.h"
#include "main.h"
#include "cache.h"
+#include "debug.h"
#include "md5-util.h"
#include "ui_fileops.h"
#include "cache_maint.h"
#include "cache.h"
+#include "debug.h"
#include "filelist.h"
#include "thumb.h"
#include "thumb_standard.h"
#include "collect-io.h"
#include "collect.h"
+#include "debug.h"
#include "filelist.h"
#include "layout_util.h"
#include "rcfile.h"
#include "cellrenderericon.h"
#include "collect-dlg.h"
#include "collect-io.h"
+#include "debug.h"
#include "dnd.h"
#include "dupe.h"
#include "editors.h"
#include "collect-dlg.h"
#include "collect-io.h"
#include "collect-table.h"
+#include "debug.h"
#include "editors.h"
#include "filelist.h"
#include "img-view.h"
#include "main.h"
#include "color-man.h"
+#include "debug.h"
#include "image.h"
#include "ui_fileops.h"
--- /dev/null
+/*
+ * Geeqie
+ * Copyright (C) 2008 The Geeqie Team
+ *
+ * Authors: Vladimir Nadvornik, Laurent Monin
+ *
+ * This software is released under the GNU General Public License (GNU GPL).
+ * Please read the included file COPYING for more information.
+ * This software comes with no warranty of any kind, use at your own risk!
+ */
+
+#include "main.h"
+#include "debug.h"
+
+#ifdef DEBUG
+
+static gint debug_level = DEBUG_LEVEL_MIN;
+
+
+gint get_debug_level(void)
+{
+ return debug_level;
+}
+
+void set_debug_level(gint new_level)
+{
+ debug_level = CLAMP(new_level, DEBUG_LEVEL_MIN, DEBUG_LEVEL_MAX);
+}
+
+void debug_level_add(gint delta)
+{
+ set_debug_level(debug_level + delta);
+}
+
+gint required_debug_level(gint level)
+{
+ return (debug_level >= level);
+}
+
+#endif
--- /dev/null
+/*
+ * Geeqie
+ * Copyright (C) 2008 The Geeqie Team
+ *
+ * Authors: Vladimir Nadvornik, Laurent Monin
+ *
+ * This software is released under the GNU General Public License (GNU GPL).
+ * Please read the included file COPYING for more information.
+ * This software comes with no warranty of any kind, use at your own risk!
+ */
+
+#ifndef DEBUG_H
+#define DEBUG_H
+
+#if 1 /* set to 0 to disable compilation of debugging code and related options */
+# ifndef DEBUG
+# define DEBUG 1
+# endif
+#endif
+
+#ifdef DEBUG
+
+#define DEBUG_LEVEL_MIN 0
+#define DEBUG_LEVEL_MAX 4
+
+gint get_debug_level(void);
+void set_debug_level(gint new_level);
+void debug_level_add(gint delta);
+gint required_debug_level(gint level);
+
+#define DEBUG_N(n, ...) do \
+ { \
+ gint debug_level = get_debug_level(); \
+ if (debug_level >= (n)) \
+ { \
+ if (debug_level != 1) printf("%s:%d: ", __FILE__, __LINE__); \
+ printf(__VA_ARGS__); \
+ putchar('\n'); \
+ } \
+ } while (0)
+#else
+
+#define get_debug_level() (0)
+#define set_debug_level(new_level) do { } while(0)
+#define debug_level_add(delta) do { } while(0)
+#define required_debug_level(level) (0)
+#define DEBUG_N(n, ...) do { } while(0)
+
+#endif
+
+#define DEBUG_0(...) DEBUG_N(0, __VA_ARGS__)
+#define DEBUG_1(...) DEBUG_N(1, __VA_ARGS__)
+#define DEBUG_2(...) DEBUG_N(2, __VA_ARGS__)
+#define DEBUG_3(...) DEBUG_N(3, __VA_ARGS__)
+#define DEBUG_4(...) DEBUG_N(4, __VA_ARGS__)
+
+
+#endif /* DEBUG_H */
#include "cache.h"
#include "collect.h"
#include "collect-table.h"
+#include "debug.h"
#include "dnd.h"
#include "editors.h"
#include "filelist.h"
list = dupe_match_rank_sort(dw->list);
- if (debug >= 2) dupe_match_print_list(list);
+ if (required_debug_level(2)) dupe_match_print_list(list);
DEBUG_1("Similar items: %d", g_list_length(list));
list = dupe_match_group_trim(list, dw);
dupe_match_sort_groups(list);
- if (debug) dupe_match_print_list(list);
+ if (required_debug_level(2)) dupe_match_print_list(list);
list = dupe_match_rank_sort(list);
#include "main.h"
#include "exif.h"
+#include "debug.h"
#include "filelist.h"
#include "format_raw.h"
#include "ui_fileops.h"
extern "C" {
#include <glib.h>
+
#include "main.h"
#include "exif.h"
+
+#include "debug.h"
#include "filelist.h"
#include "ui_fileops.h"
-
}
struct _ExifData
#include "filelist.h"
#include "cache.h"
+#include "debug.h"
#include "rcfile.h"
#include "secure_save.h"
#include "thumb_standard.h"
#include "main.h"
#include "format_raw.h"
+#include "debug.h"
#include "format_canon.h"
#include "format_fuji.h"
#include "format_nikon.h"
#include "format_olympus.h"
-#ifdef DEBUG
-/* so that debugging is honored */
-extern gint debug;
-#endif
typedef struct _FormatRawEntry FormatRawEntry;
struct _FormatRawEntry {
#include "main.h"
#include "fullscreen.h"
+#include "debug.h"
#include "image.h"
#include "ui_fileops.h"
#include "ui_menu.h"
#include "main.h"
-#ifdef DEBUG
-gint debug = FALSE;
-#endif
-
ConfOptions *init_options(ConfOptions *options)
{
#include "main.h"
#include "image-load.h"
-#include "filelist.h"
+#include "debug.h"
#include "exif.h"
+#include "filelist.h"
#include "ui_fileops.h"
#include <fcntl.h>
#include "image.h"
-#include "image-load.h"
#include "collect.h"
#include "color-man.h"
+#include "debug.h"
#include "exif.h"
#include "histogram.h"
+#include "image-load.h"
#include "image-overlay.h"
#include "layout.h"
#include "layout_image.h"
#include "main.h"
#include "layout.h"
-#include "image.h"
#include "color-man.h"
+#include "debug.h"
+#include "histogram.h"
+#include "image.h"
#include "image-overlay.h"
#include "layout_config.h"
#include "layout_image.h"
#include "ui_menu.h"
#include "ui_misc.h"
#include "ui_tabcomp.h"
-#include "histogram.h"
#define MAINWINDOW_DEF_WIDTH 700
#include "collect.h"
#include "dnd.h"
+#include "debug.h"
#include "editors.h"
#include "filelist.h"
#include "fullscreen.h"
#include "cache.h"
#include "collect.h"
#include "collect-io.h"
+#include "debug.h"
#include "dnd.h"
#include "editors.h"
#include "filelist.h"
}
if (blank || cmd_list || path) g_string_append(command, " --blank");
- if (debug) g_string_append(command, " --debug");
+ if (get_debug_level()) g_string_append(command, " --debug");
g_string_append(command, " &");
system(command->str);
/* we now increment the debug state for verbosity */
if (cmd_line_len == len)
- debug++;
+ debug_level_add(1);
else if (cmd_line[len] == '=' && g_ascii_isdigit(cmd_line[len+1]))
{
gint n = atoi(cmd_line + len + 1);
if (n < 0) n = 1;
- debug += n;
+ debug_level_add(n);
}
}
}
}
- DEBUG_1("debugging output enabled (level %d)", debug);
+ DEBUG_1("debugging output enabled (level %d)", get_debug_level());
#endif
}
"%fAperture%|%fShutterSpeed%|%fISOSpeedRating%|%fFocalLength%|%fExposureBias%\n" \
"%fCamera%|%fFlash%" \
-#if 1 /* set to 0 to disable debugging code and related options */
-# ifndef DEBUG
-# define DEBUG 1
-# endif
-#endif
-#ifndef DEBUG
-# define debug 0
-#endif
-
-#ifdef DEBUG
-#define DEBUG_N(n, ...) do \
- { \
- if (debug >= (n)) \
- { \
- if (debug != 1) printf("%s:%d: ", __FILE__, __LINE__); \
- printf(__VA_ARGS__); \
- putchar('\n'); \
- } \
- } while (0)
-#else
-#define DEBUG_N(n, ...) do { } while(0)
-#endif
-
-#define DEBUG_0(...) DEBUG_N(0, __VA_ARGS__)
-#define DEBUG_1(...) DEBUG_N(1, __VA_ARGS__)
-#define DEBUG_2(...) DEBUG_N(2, __VA_ARGS__)
-#define DEBUG_3(...) DEBUG_N(3, __VA_ARGS__)
-#define DEBUG_4(...) DEBUG_N(4, __VA_ARGS__)
#include "typedefs.h"
-#ifdef DEBUG
-extern gint debug;
-#endif
-
-
/*
*----------------------------------------------------------------------------
#include "main.h"
#include "pan-types.h"
+#include "debug.h"
+
#include <math.h>
#include "main.h"
#include "pan-view.h"
-#include "pan-types.h"
#include "bar_exif.h"
#include "dnd.h"
+#include "debug.h"
#include "editors.h"
#include "exif.h"
#include "fullscreen.h"
#include "img-view.h"
#include "info.h"
#include "menu.h"
+#include "pan-types.h"
#include "thumb.h"
#include "utilops.h"
#include "ui_bookmark.h"
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <math.h>
+
#include "pixbuf-renderer.h"
#include "intl.h"
*/
#define GQ_BUILD 1
-
#ifdef GQ_BUILD
- #include "pixbuf_util.h"
+#include "main.h"
+#include "pixbuf_util.h"
- /* for debug */
- #include "main.h"
+#include "debug.h"
#endif
#include "preferences.h"
#include "cache_maint.h"
+#include "debug.h"
#include "editors.h"
#include "filelist.h"
#include "fullscreen.h"
}
#ifdef DEBUG
- debug = debug_c;
+ set_debug_level(debug_c);
#endif
#ifdef HAVE_LCMS
group = pref_group_new(vbox, FALSE, _("Debugging"), GTK_ORIENTATION_VERTICAL);
pref_spin_new_int(group, _("Debug level:"), NULL,
- 0, 9, 1, debug, &debug_c);
+ DEBUG_LEVEL_MIN, DEBUG_LEVEL_MAX, 1, get_debug_level(), &debug_c);
#endif
}
#include "main.h"
#include "print.h"
+#include "debug.h"
#include "filelist.h"
#include "image.h"
#include "image-load.h"
#include "main.h"
#include "remote.h"
+#include "debug.h"
#include <sys/types.h>
#include <sys/socket.h>
#include "main.h"
#include "secure_save.h"
+#include "debug.h"
+
/* ABOUT SECURE SAVE */
/* This code was borrowed from the ELinks project (http://elinks.cz)
* It was originally written by me (Laurent Monin aka Zas) and heavily
#include "thumb.h"
#include "cache.h"
+#include "debug.h"
#include "image-load.h"
#include "filelist.h"
#include "pixbuf_util.h"
#include "thumb_standard.h"
#include "cache.h" /* for cache_ensure_dir_exists */
+#include "debug.h"
#include "image-load.h"
#include "md5-util.h"
#include "pixbuf_util.h"
#include "cache.h"
#include "cache_maint.h"
#include "collect.h"
+#include "debug.h"
#include "dupe.h"
#include "filelist.h"
#include "image.h"
#include "collect.h"
#include "collect-io.h"
#include "collect-table.h"
+#include "debug.h"
#include "dnd.h"
#include "editors.h"
#include "img-view.h"
#include "view_file_list.h"
#include "cache_maint.h"
+#include "debug.h"
#include "dnd.h"
#include "editors.h"
#include "img-view.h"