Author: abrander
Date: 2010-12-30 21:55:33 +0100 (Thu, 30 Dec 2010)
New Revision: 3762
Added:
trunk/librawstudio/rs-debug.c
trunk/librawstudio/rs-debug.h
Modified:
trunk/librawstudio/Makefile.am
trunk/librawstudio/rawstudio.h
trunk/src/application.c
Log:
Added RS_DEBUG macro.
Modified: trunk/librawstudio/Makefile.am
===================================================================
--- trunk/librawstudio/Makefile.am 2010-12-30 20:47:43 UTC (rev 3761)
+++ trunk/librawstudio/Makefile.am 2010-12-30 20:55:33 UTC (rev 3762)
@@ -12,6 +12,7 @@
library_includedir=$(includedir)/@pack...@-@VERSION@/
library_include_HEADERS = rawstudio.h rs-types.h rs-macros.h \
+ rs-debug.c rs-debug.h \
rs-io-job.h \
rs-io-job-checksum.h \
rs-io-job-metadata.h \
@@ -61,6 +62,7 @@
lib_LTLIBRARIES = librawstudio-1.1.la
librawstudio_1_1_la_SOURCES = \
+ rs-debug.c rs-debug.h \
rs-io-job.c rs-io-job.h \
rs-io-job-checksum.c rs-io-job-checksum.h \
rs-io-job-metadata.c rs-io-job-metadata.h \
Modified: trunk/librawstudio/rawstudio.h
===================================================================
--- trunk/librawstudio/rawstudio.h 2010-12-30 20:47:43 UTC (rev 3761)
+++ trunk/librawstudio/rawstudio.h 2010-12-30 20:55:33 UTC (rev 3762)
@@ -29,6 +29,7 @@
#include "rs-macros.h"
+#include "rs-debug.h"
#include "rs-io-job.h"
#include "rs-io-job-checksum.h"
#include "rs-io-job-metadata.h"
Added: trunk/librawstudio/rs-debug.c
===================================================================
--- trunk/librawstudio/rs-debug.c (rev 0)
+++ trunk/librawstudio/rs-debug.c 2010-12-30 20:55:33 UTC (rev 3762)
@@ -0,0 +1,38 @@
+/*
+ * * Copyright (C) 2006-2010 Anders Brander <[email protected]>,
+ * * Anders Kvist <[email protected]> and Klaus Post <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
USA.
+ */
+
+#include "rs-debug.h"
+#include "stdio.h"
+
+guint rs_debug_flags = 0;
+
+static const GDebugKey rs_debug_keys[] = {
+ { "all", RS_DEBUG_ALL },
+ { "plugins", RS_DEBUG_PLUGINS },
+ { "filters", RS_DEBUG_FILTERS },
+ { "performance", RS_DEBUG_PERFORMANCE },
+ { "processing", RS_DEBUG_PROCESSING }
+};
+
+void
+rs_debug_setup(const gchar *debug_string)
+{
+ rs_debug_flags = g_parse_debug_string(debug_string, rs_debug_keys,
G_N_ELEMENTS(rs_debug_keys));
+ printf("rs_debug_setup(%s): %x\n", debug_string, rs_debug_flags);
+}
Added: trunk/librawstudio/rs-debug.h
===================================================================
--- trunk/librawstudio/rs-debug.h (rev 0)
+++ trunk/librawstudio/rs-debug.h 2010-12-30 20:55:33 UTC (rev 3762)
@@ -0,0 +1,50 @@
+/*
+ * * Copyright (C) 2006-2010 Anders Brander <[email protected]>,
+ * * Anders Kvist <[email protected]> and Klaus Post <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
USA.
+ */
+
+#ifndef RS_DEBUG_H
+#define RS_DEBUG_H
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+typedef enum {
+ RS_DEBUG_ALL = 0xffffffff,
+ RS_DEBUG_PLUGINS = 1 << 0,
+ RS_DEBUG_FILTERS = 1 << 1,
+ RS_DEBUG_PERFORMANCE = 1 << 2,
+ RS_DEBUG_PROCESSING = 1 << 3
+} RSDebugFlag;
+
+#define RS_DEBUG(type,x,a...) \
+G_STMT_START { \
+ if (G_UNLIKELY (rs_debug_flags & RS_DEBUG_##type)) \
+ { \
+ printf("* Debug [" #type "] " G_STRLOC ": " x "\n", ##a); \
+ } \
+} G_STMT_END
+
+void
+rs_debug_setup(const gchar *debug_string);
+
+extern guint rs_debug_flags;
+
+G_END_DECLS
+
+#endif /* RS_DEBUG_H */
\ No newline at end of file
Modified: trunk/src/application.c
===================================================================
--- trunk/src/application.c 2010-12-30 20:47:43 UTC (rev 3761)
+++ trunk/src/application.c 2010-12-30 20:55:33 UTC (rev 3762)
@@ -717,7 +717,7 @@
GConfClient *client;
#endif
- while ((opt = getopt(argc, argv, "nt")) != -1) {
+ while ((opt = getopt(argc, argv, "ntd:")) != -1) {
switch (opt) {
case 'n':
optimized = 0;
@@ -725,6 +725,9 @@
case 't':
do_test = TRUE;
break;
+ case 'd':
+ rs_debug_setup(optarg);
+ break;
}
}
_______________________________________________
Rawstudio-commit mailing list
[email protected]
http://rawstudio.org/cgi-bin/mailman/listinfo/rawstudio-commit