[beast/devel: 46/77] TOOLS: remove Birnet/Sfi Msg uses



commit c2b563a34ce03aa648230fddc9ac24cc862ca48b
Author: Tim Janik <timj gnu org>
Date:   Thu Apr 11 02:05:06 2013 +0200

    TOOLS: remove Birnet/Sfi Msg uses

 tools/bsewavetool.cc |   71 ++++++++-----------------------------------------
 1 files changed, 12 insertions(+), 59 deletions(-)
---
diff --git a/tools/bsewavetool.cc b/tools/bsewavetool.cc
index e56c606..1534020 100644
--- a/tools/bsewavetool.cc
+++ b/tools/bsewavetool.cc
@@ -49,37 +49,8 @@ Command::blurb (bool bshort)
   if (bshort)
     return;
 }
+
 /* --- main program --- */
-static void
-wavetool_message_handler (const char              *domain,
-                          Msg::Type                mtype,
-                          const vector<Msg::Part> &parts)
-{
-  if (mtype == Msg::INFO)
-    {
-      if (!silent_infos)
-        {
-          String title, primary, secondary, details, checkmsg;
-          for (uint i = 0; i < parts.size(); i++)
-            switch (parts[i].ptype)
-              {
-              case '0': title     += (title.size()     ? "\n" : "") + parts[i].string; break;
-              case '1': primary   += (primary.size()   ? "\n" : "") + parts[i].string; break;
-              case '2': secondary += (secondary.size() ? "\n" : "") + parts[i].string; break;
-              case '3': details   += (details.size()   ? "\n" : "") + parts[i].string; break;
-              case 'c': checkmsg  += (checkmsg.size()  ? "\n" : "") + parts[i].string; break;
-              }
-          if (primary.size())
-            g_printerr ("%s\n", primary.c_str());
-          if (secondary.size())
-            g_printerr ("%s\n", secondary.c_str());
-          if (details.size())
-            g_printerr ("%s\n", details.c_str());
-        }
-    }
-  else
-    Msg::default_handler (domain, mtype, parts);
-}
 extern "C" int
 main (int   argc,
       char *argv[])
@@ -95,9 +66,6 @@ main (int   argc,
     { NULL }
   };
   bse_init_inprocess (&argc, &argv, "BseWaveTool", values);
-  Msg::allow_msgs ("main"); // FIXME
-  Msg::set_thread_handler (wavetool_message_handler);
-  Msg::configure (Msg::INFO, Msg::LOG_TO_HANDLER, "");
   /* pre-parse argument list to decide command */
   wavetool_parse_args (&argc, &argv);
   /* check args */
@@ -533,10 +501,11 @@ verify_chunk_selection (const vector<float> &freq_list,
     {
       if (!wave->lookup (*fi))
         {
-          Msg::display (skip_errors ? Msg::WARNING : Msg::ERROR,
-                        Msg::Primary ("failed to find wave chunk with oscillator frequency: %.2f", *fi));
-          if (!skip_errors)
-            exit (1);
+          String msg = string_printf ("failed to find wave chunk with oscillator frequency: %.2f", *fi);
+          if (skip_errors)
+            sfi_warning ("%s", msg.c_str());
+          else
+            sfi_error ("%s", msg.c_str());
         }
     }
 }
@@ -546,14 +515,7 @@ wavetool_parse_args (int    *argc_p,
 {
   guint argc = *argc_p;
   gchar **argv = *argv_p;
-  gchar *envar;
   guint i;
-  envar = getenv ("BSEWAVETOOL_DEBUG");
-  if (envar)
-    Msg::allow_msgs (envar);
-  envar = getenv ("BSEWAVETOOL_NO_DEBUG");
-  if (envar)
-    Msg::deny_msgs (envar);
   for (i = 1; i < argc; i++)
     {
       const gchar *str = NULL;
@@ -562,16 +524,6 @@ wavetool_parse_args (int    *argc_p,
           argv[i] = NULL;
           break;
         }
-      else if (parse_bool_option (argv, i, "--debug-list"))
-        {
-          g_print ("debug keys: all");
-          g_print ("\n");
-          exit (0);
-        }
-      else if (parse_str_option (argv, i, "--debug", &str, argc))
-        Msg::allow_msgs (str);
-      else if (parse_str_option (argv, i, "--no-debug", &str, argc))
-        Msg::deny_msgs (str);
       else if (parse_bool_option (argv, i, "-h") ||
                parse_bool_option (argv, i, "--help"))
         {
@@ -1174,11 +1126,12 @@ public:
             }
           if (error)
             {
-              Msg::display (skip_errors ? Msg::WARNING : Msg::ERROR,
-                            Msg::Primary (_("failed to add wave chunk from file \"%s\": %s"),
-                                          ochunk.sample_file, bse_error_blurb (error)));
-              if (!skip_errors)
-                exit (1);
+              String msg = string_printf (_("failed to add wave chunk from file \"%s\": %s"),
+                                          ochunk.sample_file, bse_error_blurb (error));
+              if (skip_errors)
+                sfi_warning ("%s", msg.c_str());
+              else
+                sfi_error ("%s", msg.c_str());
             }
           g_strfreev (xinfos);
         }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]