move some debug trace support code around to a more sane location
authorPaul Davis <paul@linuxaudiosystems.com>
Mon, 30 Nov 2009 13:38:38 +0000 (13:38 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Mon, 30 Nov 2009 13:38:38 +0000 (13:38 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@6214 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/opts.cc
libs/ardour/ardour/debug.h
libs/ardour/debug.cc [new file with mode: 0644]
libs/ardour/globals.cc
libs/ardour/wscript

index 0af659af08b73db79dc0aef990a32f476af02c32..b5075daa2f3622679e613a1ac50801de0ec5ea08 100644 (file)
@@ -74,74 +74,6 @@ print_help (const char *execname)
 
 }
 
-static void
-list_debug_options ()
-{
-       cerr << _("The following debug options are available. Separate multipe options with commas.\nNames are case-insensitive and can be abbreviated.") << "\n\n";
-       cerr << "\tMidiSourceIO\n";
-       cerr << "\tMidiPlaylistIO\n";
-       cerr << "\tMidiDiskstreamIO\n";
-       cerr << "\tSnapBBT\n";
-       cerr << "\tConfiguration\n";
-       cerr << "\tLatency\n";
-       cerr << "\tGraph\n";
-       cerr << "\tDestruction\n";
-}
-
-static int
-parse_debug_options (const char* str)
-{
-       char* p;
-       char* sp;
-       uint64_t bits = 0;
-       char* copy = strdup (str);
-
-       p = strtok_r (copy, ",", &sp);
-
-       while (p) {
-               if (strcasecmp (p, "list") == 0) {
-                       list_debug_options ();
-                       free (copy);
-                       return 1;
-               }
-
-               if (strcasecmp (p, "all") == 0) {
-                       ARDOUR::set_debug_bits (~0ULL);
-                       free (copy);
-                       return 0;
-               }
-
-               if (strncasecmp (p, "midisourceio", strlen (p)) == 0) {
-                       bits |= ARDOUR::DEBUG::MidiSourceIO;
-               } else if (strncasecmp (p, "midiplaylistio", strlen (p)) == 0) {
-                       bits |= ARDOUR::DEBUG::MidiPlaylistIO;
-               } else if (strncasecmp (p, "mididiskstreamio", strlen (p)) == 0) {
-                       bits |= ARDOUR::DEBUG::MidiDiskstreamIO;
-               } else if (strncasecmp (p, "snapbbt", strlen (p)) == 0) {
-                       bits |= ARDOUR::DEBUG::SnapBBT;
-               } else if (strncasecmp (p, "configuration", strlen (p)) == 0) {
-                       bits |= ARDOUR::DEBUG::Configuration;
-               } else if (strncasecmp (p, "latency", strlen (p)) == 0) {
-                       bits |= ARDOUR::DEBUG::Latency;
-               } else if (strncasecmp (p, "processors", strlen (p)) == 0) {
-                       bits |= ARDOUR::DEBUG::Processors;
-               } else if (strncasecmp (p, "graph", strlen (p)) == 0) {
-                       bits |= ARDOUR::DEBUG::Graph;
-               } else if (strncasecmp (p, "destruction", strlen (p)) == 0) {
-                       bits |= ARDOUR::DEBUG::Destruction;
-               } else if (strncasecmp (p, "mtc", strlen (p)) == 0) {
-                       bits |= ARDOUR::DEBUG::MTC;
-               }
-
-               p = strtok_r (0, ",", &sp);
-       }
-       
-       free (copy);
-       ARDOUR::set_debug_bits (bits);
-       return 0;
-}
-
-
 int
 ARDOUR_COMMAND_LINE::parse_opts (int argc, char *argv[])
 {
@@ -207,7 +139,7 @@ ARDOUR_COMMAND_LINE::parse_opts (int argc, char *argv[])
                        break;
 
                case 'D':
-                       if (parse_debug_options (optarg)) {
+                       if (ARDOUR::parse_debug_options (optarg)) {
                                exit (0);
                        }
                        break;
index 636d026f562fdef4846966a9084d0aa610c3acd1..d90c82fcbe4317a1104b8b5fec5be011a9b6ed4b 100644 (file)
@@ -29,6 +29,8 @@ namespace ARDOUR {
        extern uint64_t debug_bits;
        void debug_print (const char* prefix, std::string str);
        void set_debug_bits (uint64_t bits);
+       int parse_debug_options (const char* str);
+       void list_debug_options ();
 
        namespace DEBUG {
 
@@ -44,7 +46,8 @@ namespace ARDOUR {
                        Processors = 0x40,
                        Graph = 0x80,
                        Destruction = 0x100,
-                       MTC = 0x200
+                       MTC = 0x200,
+                       Transport = 0x400
                };
        }
 
diff --git a/libs/ardour/debug.cc b/libs/ardour/debug.cc
new file mode 100644 (file)
index 0000000..0e9b7d8
--- /dev/null
@@ -0,0 +1,112 @@
+/*
+    Copyright (C) 2009 Paul Davis
+
+    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., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <cstring>
+#include <cstdlib>
+#include <iostream>
+
+#include "ardour/debug.h"
+
+#include "i18n.h"
+
+using namespace std;
+
+void
+ARDOUR::debug_print (const char* prefix, string str)
+{
+       cerr << prefix << ": " << str;
+}
+
+void
+ARDOUR::set_debug_bits (uint64_t bits)
+{
+       debug_bits = bits;
+}
+
+int
+ARDOUR::parse_debug_options (const char* str)
+{
+       char* p;
+       char* sp;
+       uint64_t bits = 0;
+       char* copy = strdup (str);
+
+       p = strtok_r (copy, ",", &sp);
+
+       while (p) {
+               if (strcasecmp (p, "list") == 0) {
+                       list_debug_options ();
+                       free (copy);
+                       return 1;
+               }
+
+               if (strcasecmp (p, "all") == 0) {
+                       ARDOUR::set_debug_bits (~0ULL);
+                       free (copy);
+                       return 0;
+               }
+
+               if (strncasecmp (p, "midisourceio", strlen (p)) == 0) {
+                       bits |= ARDOUR::DEBUG::MidiSourceIO;
+               } else if (strncasecmp (p, "midiplaylistio", strlen (p)) == 0) {
+                       bits |= ARDOUR::DEBUG::MidiPlaylistIO;
+               } else if (strncasecmp (p, "mididiskstreamio", strlen (p)) == 0) {
+                       bits |= ARDOUR::DEBUG::MidiDiskstreamIO;
+               } else if (strncasecmp (p, "snapbbt", strlen (p)) == 0) {
+                       bits |= ARDOUR::DEBUG::SnapBBT;
+               } else if (strncasecmp (p, "configuration", strlen (p)) == 0) {
+                       bits |= ARDOUR::DEBUG::Configuration;
+               } else if (strncasecmp (p, "latency", strlen (p)) == 0) {
+                       bits |= ARDOUR::DEBUG::Latency;
+               } else if (strncasecmp (p, "processors", strlen (p)) == 0) {
+                       bits |= ARDOUR::DEBUG::Processors;
+               } else if (strncasecmp (p, "graph", strlen (p)) == 0) {
+                       bits |= ARDOUR::DEBUG::Graph;
+               } else if (strncasecmp (p, "destruction", strlen (p)) == 0) {
+                       bits |= ARDOUR::DEBUG::Destruction;
+               } else if (strncasecmp (p, "mtc", strlen (p)) == 0) {
+                       bits |= ARDOUR::DEBUG::MTC;
+               } else if (strncasecmp (p, "transport", strlen (p)) == 0) {
+                       bits |= ARDOUR::DEBUG::Transport;
+               }
+
+               p = strtok_r (0, ",", &sp);
+       }
+       
+       free (copy);
+       ARDOUR::set_debug_bits (bits);
+       return 0;
+}
+
+void
+ARDOUR::list_debug_options ()
+{
+       cerr << _("The following debug options are available. Separate multipe options with commas.\nNames are case-insensitive and can be abbreviated.") << endl << endl;
+       cerr << "\tAll" << endl;
+       cerr << "\tMidiSourceIO" << endl;
+       cerr << "\tMidiPlaylistIO" << endl;
+       cerr << "\tMidiDiskstreamIO" << endl;
+       cerr << "\tSnapBBT" << endl;
+       cerr << "\tConfiguration" << endl;
+       cerr << "\tLatency" << endl;
+       cerr << "\tGraph" << endl;
+       cerr << "\tDestruction" << endl;
+       cerr << "\tMTC" << endl;
+       cerr << "\tTransport" << endl;
+}
index ac7eb8605da7a7b5c7f13f9a4b60d71b52864283..6e6ae9bf802a07164f4707c6ffe2dcb9cfe311d1 100644 (file)
@@ -110,18 +110,6 @@ mix_buffers_no_gain_t   ARDOUR::mix_buffers_no_gain = 0;
 
 sigc::signal<void,std::string> ARDOUR::BootMessage;
 
-void
-ARDOUR::debug_print (const char* prefix, std::string str)
-{
-       cerr << prefix << ": " << str;
-}
-
-void
-ARDOUR::set_debug_bits (uint64_t bits)
-{
-       debug_bits = bits;
-}
-
 int
 ARDOUR::setup_midi ()
 {
index 67e138da38d55ba5d656c94693c6382a0c70b76c..48cd6ccb6f83384a2ebc81eb1f5c16e314de10c5 100644 (file)
@@ -69,6 +69,7 @@ libardour_sources = [
        'crossfade.cc',
        'cycle_timer.cc',
        'default_click.cc',
+       'debug.cc',
        'delivery.cc',
        'directory_names.cc',
        'diskstream.cc',