[beast/devel: 26/35] TOOLS: mathtool.cc: use Rapicorn::printout() for printing



commit ffcd852ea86e91d29f30e77fccb4c8f230060aa6
Author: Tim Janik <timj gnu org>
Date:   Tue May 14 01:17:08 2013 +0200

    TOOLS: mathtool.cc: use Rapicorn::printout() for printing

 tools/mathtool.cc |  289 +++++++++++++++++++++++++++--------------------------
 1 files changed, 145 insertions(+), 144 deletions(-)
---
diff --git a/tools/mathtool.cc b/tools/mathtool.cc
index 6edad3a..b0dea29 100644
--- a/tools/mathtool.cc
+++ b/tools/mathtool.cc
@@ -11,6 +11,7 @@
 
 #define PREC    "15"
 
+using Rapicorn::printout;
 
 static void    usage (void)    G_GNUC_NORETURN;
 
@@ -98,13 +99,13 @@ main (int   argc,
            {
              guint i;
 
-             g_print ("Loader \"%s\" found %u waves in \"%s\":\n", fi->loader->name, fi->n_waves, file);
+             printout ("Loader \"%s\" found %u waves in \"%s\":\n", fi->loader->name, fi->n_waves, file);
              for (i = 0; i < fi->n_waves; i++)
-               g_print ("%u) %s\n", i + 1, fi->waves[i].name);
+               printout ("%u) %s\n", i + 1, fi->waves[i].name);
              bse_wave_file_info_unref (fi);
            }
          else
-           g_print ("Failed to scan \"%s\": %s\n", file, bse_error_blurb (error));
+           printout ("Failed to scan \"%s\": %s\n", file, bse_error_blurb (error));
          file = pshift ();
          if (!file[0])
            break;
@@ -114,13 +115,13 @@ main (int   argc,
     {
       const gchar *file = pshift ();
 
-      g_print ("file test for \"%s\":\n", file);
-      g_print ("  is readable   : %s\n", bse_error_blurb (gsl_file_check (file, "r")));
-      g_print ("  is writable   : %s\n", bse_error_blurb (gsl_file_check (file, "w")));
-      g_print ("  is executable : %s\n", bse_error_blurb (gsl_file_check (file, "x")));
-      g_print ("  is file       : %s\n", bse_error_blurb (gsl_file_check (file, "f")));
-      g_print ("  is directory  : %s\n", bse_error_blurb (gsl_file_check (file, "d")));
-      g_print ("  is link       : %s\n", bse_error_blurb (gsl_file_check (file, "l")));
+      printout ("file test for \"%s\":\n", file);
+      printout ("  is readable   : %s\n", bse_error_blurb (gsl_file_check (file, "r")));
+      printout ("  is writable   : %s\n", bse_error_blurb (gsl_file_check (file, "w")));
+      printout ("  is executable : %s\n", bse_error_blurb (gsl_file_check (file, "x")));
+      printout ("  is file       : %s\n", bse_error_blurb (gsl_file_check (file, "f")));
+      printout ("  is directory  : %s\n", bse_error_blurb (gsl_file_check (file, "d")));
+      printout ("  is link       : %s\n", bse_error_blurb (gsl_file_check (file, "l")));
     }
   else if (strcmp (arg, "ring-test") == 0)
     {
@@ -134,7 +135,7 @@ main (int   argc,
       y = atof (pshift ());
       z = atof (pshift ());
 
-      g_print ("rf(%f, %f, %f) = %."PREC"f\n", x, y, z, gsl_ellip_rf (x, y, z));
+      printout ("rf(%f, %f, %f) = %."PREC"f\n", x, y, z, gsl_ellip_rf (x, y, z));
     }
   else if (strcmp (arg, "F") == 0)
     {
@@ -142,7 +143,7 @@ main (int   argc,
       phi = atof (pshift ());
       ak = atof (pshift ());
 
-      g_print ("F(%f, %f) = %."PREC"f\n", phi, ak, gsl_ellip_F (phi, ak));
+      printout ("F(%f, %f) = %."PREC"f\n", phi, ak, gsl_ellip_F (phi, ak));
     }
   else if (strcmp (arg, "sn") == 0)
     {
@@ -150,7 +151,7 @@ main (int   argc,
       u = atof (pshift ());
       emmc = atof (pshift ());
 
-      g_print ("sn(%f, %f) = %."PREC"f\n", u, emmc, gsl_ellip_sn (u, emmc));
+      printout ("sn(%f, %f) = %."PREC"f\n", u, emmc, gsl_ellip_sn (u, emmc));
     }
   else if (strcmp (arg, "snc") == 0)
     {
@@ -160,7 +161,7 @@ main (int   argc,
       emmc.re = atof (pshift ());
       emmc.im = atof (pshift ());
 
-      g_print ("snc(%s, %s) = %s\n",
+      printout ("snc(%s, %s) = %s\n",
               bse_complex_str (u),
               bse_complex_str (emmc),
               bse_complex_str (bse_complex_ellip_sn (u, emmc)));
@@ -173,10 +174,10 @@ main (int   argc,
       k2.re = atof (pshift ());
       k2.im = atof (pshift ());
 
-      g_print ("sci_snc(%s, %s) = %s\n",
-              bse_complex_str (u),
-              bse_complex_str (k2),
-              bse_complex_str (bse_complex_ellip_sn (u, bse_complex_sub (bse_complex (1.0, 0), k2))));
+      printout ("sci_snc(%s, %s) = %s\n",
+                bse_complex_str (u),
+                bse_complex_str (k2),
+                bse_complex_str (bse_complex_ellip_sn (u, bse_complex_sub (bse_complex (1.0, 0), k2))));
     }
   else if (strcmp (arg, "asn") == 0)
     {
@@ -184,7 +185,7 @@ main (int   argc,
       y = atof (pshift ());
       emmc = atof (pshift ());
 
-      g_print ("asn(%f, %f) = %."PREC"f\n", y, emmc, gsl_ellip_asn (y, emmc));
+      printout ("asn(%f, %f) = %."PREC"f\n", y, emmc, gsl_ellip_asn (y, emmc));
     }
   else if (strcmp (arg, "asnc") == 0)
     {
@@ -194,25 +195,25 @@ main (int   argc,
       emmc.re = atof (pshift ());
       emmc.im = atof (pshift ());
 
-      g_print ("asnc(%s, %s) = %s\n",
-              bse_complex_str (y), bse_complex_str (emmc),
-              bse_complex_str (bse_complex_ellip_asn (y, emmc)));
-      g_print ("asn(%f, %f = %."PREC"f\n",
-              y.re, emmc.re, gsl_ellip_asn (y.re, emmc.re));
+      printout ("asnc(%s, %s) = %s\n",
+                bse_complex_str (y), bse_complex_str (emmc),
+                bse_complex_str (bse_complex_ellip_asn (y, emmc)));
+      printout ("asn(%f, %f = %."PREC"f\n",
+                y.re, emmc.re, gsl_ellip_asn (y.re, emmc.re));
     }
   else if (strcmp (arg, "sci_sn") == 0)
     {
       double u, k2;
       u = atof (pshift ());
       k2 = atof (pshift ());
-      g_print ("sci_sn(%f, %f) = %."PREC"f\n", u, k2, gsl_ellip_sn (u, 1.0 - k2));
+      printout ("sci_sn(%f, %f) = %."PREC"f\n", u, k2, gsl_ellip_sn (u, 1.0 - k2));
     }
   else if (strcmp (arg, "sci_asn") == 0)
     {
       double y, k2;
       y = atof (pshift ());
       k2 = atof (pshift ());
-      g_print ("sci_asn(%f, %f) = %."PREC"f\n", y, k2, gsl_ellip_asn (y, 1.0 - k2));
+      printout ("sci_asn(%f, %f) = %."PREC"f\n", y, k2, gsl_ellip_asn (y, 1.0 - k2));
     }
   else if (strcmp (arg, "sci_asnc") == 0)
     {
@@ -221,11 +222,11 @@ main (int   argc,
       y.im = atof (pshift ());
       k2.re = atof (pshift ());
       k2.im = atof (pshift ());
-      g_print ("sci_asnc(%s, %s) = %s\n",
-              bse_complex_str (y), bse_complex_str (k2),
-              bse_complex_str (bse_complex_ellip_asn (y, bse_complex_sub (bse_complex (1.0, 0), k2))));
-      g_print ("asn(%f, %f = %."PREC"f\n",
-              y.re, k2.re, gsl_ellip_asn (y.re, 1.0 - k2.re));
+      printout ("sci_asnc(%s, %s) = %s\n",
+                bse_complex_str (y), bse_complex_str (k2),
+                bse_complex_str (bse_complex_ellip_asn (y, bse_complex_sub (bse_complex (1.0, 0), k2))));
+      printout ("asn(%f, %f = %."PREC"f\n",
+                y.re, k2.re, gsl_ellip_asn (y.re, 1.0 - k2.re));
     }
   else if (strncmp (arg, "poly", 4) == 0)
     {
@@ -234,12 +235,12 @@ main (int   argc,
       order = 2;
       {
        double a[100] = { 1, 2, 1 }, b[100] = { 1, -3./2., 0.5 };
-       g_print ("# Test order=%u  norm=%f:\n",
-                order,
-                bse_poly_eval (order, a, 1) / bse_poly_eval (order, b, 1));
-       g_print ("H%u(z)=%s/%s\n", order,
-                bse_poly_str (order, a, "z"),
-                bse_poly_str (order, b, "z"));
+       printout ("# Test order=%u  norm=%f:\n",
+                  order,
+                  bse_poly_eval (order, a, 1) / bse_poly_eval (order, b, 1));
+       printout ("H%u(z)=%s/%s\n", order,
+                  bse_poly_str (order, a, "z"),
+                  bse_poly_str (order, b, "z"));
        if (*arg)
          {
            BseComplex root, roots[100];
@@ -247,22 +248,22 @@ main (int   argc,
 
            if (*arg == 'r')
              {
-               g_print ("#roots:\n");
+               printout ("#roots:\n");
                bse_poly_complex_roots (order, a, roots);
                for (i = 0; i < order; i++)
                  {
                    root = bse_complex_div (bse_complex (1, 0), roots[i]);
-                   g_print ("%+.14f %+.14f # %.14f\n", root.re, root.im, bse_complex_abs (root));
+                   printout ("%+.14f %+.14f # %.14f\n", root.re, root.im, bse_complex_abs (root));
                  }
              }
            if (*arg == 'p')
              {
-               g_print ("#poles:\n");
+               printout ("#poles:\n");
                bse_poly_complex_roots (order, b, roots);
                for (i = 0; i < order; i++)
                  {
                    root = bse_complex_div (bse_complex (1, 0), roots[i]);
-                   g_print ("%+.14f %+.14f # %.14f\n", root.re, root.im, bse_complex_abs (root));
+                   printout ("%+.14f %+.14f # %.14f\n", root.re, root.im, bse_complex_abs (root));
                  }
              }
          }
@@ -274,63 +275,63 @@ main (int   argc,
       BseComplex phi;
       phi.re = atof (pshift ());
       phi.im = atof (pshift ());
-      g_print ("sin(%s) = %s\n",
-              bse_complex_str (phi),
-              bse_complex_str (bse_complex_sin (phi)));
+      printout ("sin(%s) = %s\n",
+                bse_complex_str (phi),
+                bse_complex_str (bse_complex_sin (phi)));
     }
   else if (strcmp (arg, "cos") == 0)
     {
       BseComplex phi;
       phi.re = atof (pshift ());
       phi.im = atof (pshift ());
-      g_print ("cos(%s) = %s\n",
-              bse_complex_str (phi),
-              bse_complex_str (bse_complex_cos (phi)));
+      printout ("cos(%s) = %s\n",
+                bse_complex_str (phi),
+                bse_complex_str (bse_complex_cos (phi)));
     }
   else if (strcmp (arg, "tan") == 0)
     {
       BseComplex phi;
       phi.re = atof (pshift ());
       phi.im = atof (pshift ());
-      g_print ("tan(%s) = %s\n",
-              bse_complex_str (phi),
-              bse_complex_str (bse_complex_tan (phi)));
+      printout ("tan(%s) = %s\n",
+                bse_complex_str (phi),
+                bse_complex_str (bse_complex_tan (phi)));
     }
   else if (strcmp (arg, "sinh") == 0)
     {
       BseComplex phi;
       phi.re = atof (pshift ());
       phi.im = atof (pshift ());
-      g_print ("sinh(%s) = %s\n",
-              bse_complex_str (phi),
-              bse_complex_str (bse_complex_sinh (phi)));
+      printout ("sinh(%s) = %s\n",
+                bse_complex_str (phi),
+                bse_complex_str (bse_complex_sinh (phi)));
     }
   else if (strcmp (arg, "cosh") == 0)
     {
       BseComplex phi;
       phi.re = atof (pshift ());
       phi.im = atof (pshift ());
-      g_print ("cosh(%s) = %s\n",
-              bse_complex_str (phi),
-              bse_complex_str (bse_complex_cosh (phi)));
+      printout ("cosh(%s) = %s\n",
+                bse_complex_str (phi),
+                bse_complex_str (bse_complex_cosh (phi)));
     }
   else if (strcmp (arg, "tanh") == 0)
     {
       BseComplex phi;
       phi.re = atof (pshift ());
       phi.im = atof (pshift ());
-      g_print ("tanh(%s) = %s\n",
-              bse_complex_str (phi),
-              bse_complex_str (bse_complex_tanh (phi)));
+      printout ("tanh(%s) = %s\n",
+                bse_complex_str (phi),
+                bse_complex_str (bse_complex_tanh (phi)));
     }
   else if (strcmp (arg, "midi2freq") == 0)
     {
       gint note;
       note = atol (pshift ());
       note = CLAMP (note, 0, 128);
-      g_print ("midi2freq(%u) = %f\n",
-              note,
-              bse_temp_freq (BSE_CONFIG (kammer_freq), note - BSE_CONFIG (midi_kammer_note)));
+      printout ("midi2freq(%u) = %f\n",
+                note,
+                bse_temp_freq (BSE_CONFIG (kammer_freq), note - BSE_CONFIG (midi_kammer_note)));
     }
   else if (strcmp (arg, "blp") == 0)
     {
@@ -342,9 +343,9 @@ main (int   argc,
       a = g_new (gdouble, order + 1);
       b = g_new (gdouble, order + 1);
       gsl_filter_butter_lp (order, f, e, a, b);
-      g_print ("# Lowpass Butterworth filter order=%u freq=%f epsilon(s^2)=%f norm0=%f:\n",
-              order, f, e,
-              bse_poly_eval (order, a, 1) / bse_poly_eval (order, b, 1));
+      printout ("# Lowpass Butterworth filter order=%u freq=%f epsilon(s^2)=%f norm0=%f:\n",
+                order, f, e,
+                bse_poly_eval (order, a, 1) / bse_poly_eval (order, b, 1));
       filter_label = "BL";
     }
   else if (strcmp (arg, "bhp") == 0)
@@ -358,9 +359,9 @@ main (int   argc,
       b = g_new (gdouble, order + 1);
 
       gsl_filter_butter_hp (order, f, e, a, b);
-      g_print ("# Highpass Butterworth filter order=%u freq=%f epsilon(s^2)=%f norm0=%f:\n",
-              order, f, e,
-              bse_poly_eval (order, a, 1) / bse_poly_eval (order, b, 1));
+      printout ("# Highpass Butterworth filter order=%u freq=%f epsilon(s^2)=%f norm0=%f:\n",
+                order, f, e,
+                bse_poly_eval (order, a, 1) / bse_poly_eval (order, b, 1));
       filter_label = "BH";
     }
   else if (strcmp (arg, "bbp") == 0)
@@ -376,9 +377,9 @@ main (int   argc,
       b = g_new (gdouble, order + 1);
 
       gsl_filter_butter_bp (order, f1, f2, e, a, b);
-      g_print ("# Bandpass Butterworth filter order=%u freq1=%f freq2=%f epsilon(s^2)=%f norm0=%f:\n",
-              order, f1, f2, e,
-              bse_poly_eval (order, a, 1) / bse_poly_eval (order, b, 1));
+      printout ("# Bandpass Butterworth filter order=%u freq1=%f freq2=%f epsilon(s^2)=%f norm0=%f:\n",
+                order, f1, f2, e,
+                bse_poly_eval (order, a, 1) / bse_poly_eval (order, b, 1));
       filter_label = "BP";
     }
   else if (strcmp (arg, "bbs") == 0)
@@ -394,9 +395,9 @@ main (int   argc,
       b = g_new (gdouble, order + 1);
 
       gsl_filter_butter_bs (order, f1, f2, e, a, b);
-      g_print ("# Bandstop Butterworth filter order=%u freq1=%f freq2=%f epsilon(s^2)=%f norm0=%f:\n",
-              order, f1, f2, e,
-              bse_poly_eval (order, a, 1) / bse_poly_eval (order, b, 1));
+      printout ("# Bandstop Butterworth filter order=%u freq1=%f freq2=%f epsilon(s^2)=%f norm0=%f:\n",
+                order, f1, f2, e,
+                bse_poly_eval (order, a, 1) / bse_poly_eval (order, b, 1));
       filter_label = "BS";
     }
   else if (strcmp (arg, "t1l") == 0)
@@ -410,9 +411,9 @@ main (int   argc,
       b = g_new (gdouble, order + 1);
 
       gsl_filter_tscheb1_lp (order, f, e, a, b);
-      g_print ("# Lowpass Tschebyscheff Type1 order=%u freq=%f epsilon(s^2)=%f norm0=%f:\n",
-              order, f, e,
-              bse_poly_eval (order, a, 1) / bse_poly_eval (order, b, 1));
+      printout ("# Lowpass Tschebyscheff Type1 order=%u freq=%f epsilon(s^2)=%f norm0=%f:\n",
+                order, f, e,
+                bse_poly_eval (order, a, 1) / bse_poly_eval (order, b, 1));
       filter_label = "T1L";
     }
   else if (strcmp (arg, "t1h") == 0)
@@ -427,9 +428,9 @@ main (int   argc,
       b = g_new (gdouble, order + 1);
 
       gsl_filter_tscheb1_hp (order, f, e, a, b);
-      g_print ("# Highpass Tschebyscheff Type1 order=%u freq=%f epsilon(s^2)=%f norm0=%f:\n",
-              order, f, e,
-              bse_poly_eval (order, a, 1) / bse_poly_eval (order, b, 1));
+      printout ("# Highpass Tschebyscheff Type1 order=%u freq=%f epsilon(s^2)=%f norm0=%f:\n",
+                order, f, e,
+                bse_poly_eval (order, a, 1) / bse_poly_eval (order, b, 1));
       filter_label = "T1H";
     }
   else if (strcmp (arg, "t1s") == 0)
@@ -446,9 +447,9 @@ main (int   argc,
       b = g_new (gdouble, order + 1);
 
       gsl_filter_tscheb1_bs (order, fc, fr, e, a, b);
-      g_print ("# Bandstop Tschebyscheff Type1 order=%u freq_c=%f freq_r=%f epsilon(s^2)=%f norm=%f:\n",
-              order, fc, fr, e,
-              bse_poly_eval (order, a, 1) / bse_poly_eval (order, b, 1));
+      printout ("# Bandstop Tschebyscheff Type1 order=%u freq_c=%f freq_r=%f epsilon(s^2)=%f norm=%f:\n",
+                order, fc, fr, e,
+                bse_poly_eval (order, a, 1) / bse_poly_eval (order, b, 1));
       filter_label = "T1S";
     }
   else if (strcmp (arg, "t1p") == 0)
@@ -465,9 +466,9 @@ main (int   argc,
       b = g_new (gdouble, order + 1);
 
       gsl_filter_tscheb1_bp (order, fc, fr, e, a, b);
-      g_print ("# Bandpass Tschebyscheff Type1 order=%u freq_c=%f freq_r=%f epsilon(s^2)=%f norm=%f:\n",
-              order, fc, fr, e,
-              bse_poly_eval (order, a, 1) / bse_poly_eval (order, b, 1));
+      printout ("# Bandpass Tschebyscheff Type1 order=%u freq_c=%f freq_r=%f epsilon(s^2)=%f norm=%f:\n",
+                order, fc, fr, e,
+                bse_poly_eval (order, a, 1) / bse_poly_eval (order, b, 1));
       filter_label = "T1P";
     }
   else if (strcmp (arg, "t2l") == 0)
@@ -483,9 +484,9 @@ main (int   argc,
       b = g_new (gdouble, order + 1);
 
       gsl_filter_tscheb2_lp (order, f, st, e, a, b);
-      g_print ("# Lowpass Tschebyscheff Type2 order=%u freq=%f steepness=%f (%f) epsilon(s^2)=%f norm=%f:\n",
-              order, f, st, f * (1.+st), e,
-              bse_poly_eval (order, a, 1) / bse_poly_eval (order, b, 1));
+      printout ("# Lowpass Tschebyscheff Type2 order=%u freq=%f steepness=%f (%f) epsilon(s^2)=%f 
norm=%f:\n",
+                order, f, st, f * (1.+st), e,
+                bse_poly_eval (order, a, 1) / bse_poly_eval (order, b, 1));
       filter_label = "T2L";
     }
   else if (strcmp (arg, "t2h") == 0)
@@ -501,9 +502,9 @@ main (int   argc,
       b = g_new (gdouble, order + 1);
 
       gsl_filter_tscheb2_hp (order, f, st, e, a, b);
-      g_print ("# Highpass Tschebyscheff Type2 order=%u freq=%f steepness=%f (%f, %f) epsilon(s^2)=%f 
norm=%f:\n",
-              order, f, st, PI - f, (PI - f) * (1.+st), e,
-              bse_poly_eval (order, a, 1) / bse_poly_eval (order, b, 1));
+      printout ("# Highpass Tschebyscheff Type2 order=%u freq=%f steepness=%f (%f, %f) epsilon(s^2)=%f 
norm=%f:\n",
+                order, f, st, PI - f, (PI - f) * (1.+st), e,
+                bse_poly_eval (order, a, 1) / bse_poly_eval (order, b, 1));
       filter_label = "T2H";
     }
   else if (strcmp (arg, "t2p") == 0)
@@ -521,9 +522,9 @@ main (int   argc,
       b = g_new (gdouble, order + 1);
 
       gsl_filter_tscheb2_bp (order, f1, f2, st, e, a, b);
-      g_print ("# Bandpass Tschebyscheff Type2 order=%u freq1=%f freq2=%f steepness=%f epsilon(s^2)=%f 
norm=%f:\n",
-              order, f1, f2, st, e,
-              bse_poly_eval (order, a, 1) / bse_poly_eval (order, b, 1));
+      printout ("# Bandpass Tschebyscheff Type2 order=%u freq1=%f freq2=%f steepness=%f epsilon(s^2)=%f 
norm=%f:\n",
+                order, f1, f2, st, e,
+                bse_poly_eval (order, a, 1) / bse_poly_eval (order, b, 1));
       filter_label = "T2P";
     }
   else if (strcmp (arg, "t2s") == 0)
@@ -541,9 +542,9 @@ main (int   argc,
       b = g_new (gdouble, order + 1);
 
       gsl_filter_tscheb2_bs (order, f1, f2, st, e, a, b);
-      g_print ("# Bandstop Tschebyscheff Type2 order=%u freq1=%f freq2=%f steepness=%f epsilon(s^2)=%f 
norm=%f:\n",
-              order, f1, f2, st, e,
-              bse_poly_eval (order, a, 1) / bse_poly_eval (order, b, 1));
+      printout ("# Bandstop Tschebyscheff Type2 order=%u freq1=%f freq2=%f steepness=%f epsilon(s^2)=%f 
norm=%f:\n",
+                order, f1, f2, st, e,
+                bse_poly_eval (order, a, 1) / bse_poly_eval (order, b, 1));
       filter_label = "T2S";
     }
   else if (strcmp (arg, "scan") == 0)
@@ -575,7 +576,7 @@ main (int   argc,
       while (f[0] && v[0]);
 
       gsl_filter_fir_approx (iorder, a, n_points, freq, value, FALSE);
-      g_print ("FIR%u(z)=%s\n", iorder, bse_poly_str (iorder, a, "z"));
+      printout ("FIR%u(z)=%s\n", iorder, bse_poly_str (iorder, a, "z"));
     }
   else
     usage ();
@@ -589,15 +590,15 @@ main (int   argc,
          freq = 0.001;
          while (freq < 3.14)
            {
-             g_print ("%f %.20f\n", freq, gsl_filter_sine_scan (order, a, b, freq, 2 * M_PI));
+             printout ("%f %.20f\n", freq, gsl_filter_sine_scan (order, a, b, freq, 2 * M_PI));
              freq = MIN (freq * 1.1, freq + 0.01);
            }
        }
       else if (filter_mode == FILTER_GNUPLOT)
        {
-         g_print ("%s%u(z)=%s/%s\n", filter_label, order,
-                  bse_poly_str (order, a, "z"),
-                  bse_poly_str (order, b, "z"));
+         printout ("%s%u(z)=%s/%s\n", filter_label, order,
+                    bse_poly_str (order, a, "z"),
+                    bse_poly_str (order, b, "z"));
        }
       else
        g_error ("unknown filter_mode");
@@ -615,40 +616,40 @@ main (int   argc,
 static void
 usage (void)
 {
-  g_print ("usage: mathtests {test} [args...]\n");
-  g_print ("tests:\n");
-  g_print ("  wave-scan <file>          scan a wave file for waves\n");
-  g_print ("  file-test <file>          test file properties\n");
-  g_print ("  ring-test                 test ring implementation\n");
-  g_print ("  rf <x> <y> <z>            Carlson's elliptic integral of the first kind\n");
-  g_print ("  F <phi> <ak>              Legendre elliptic integral of the 1st kind\n");
-  g_print ("  sn <u> <emmc>             Jacobian elliptic function sn()\n");
-  g_print ("  asn <y> <emmc>            elliptic integral, inverse sn()\n");
-  g_print ("  sin <phi.re> <phi.im>     complex sine\n");
-  g_print ("  cos <phi.re> <phi.im>     complex cosine\n");
-  g_print ("  tan <phi.re> <phi.im>     complex tangent\n");
-  g_print ("  sinh <phi.re> <phi.im>    complex hyperbolic sine\n");
-  g_print ("  cosh <phi.re> <phi.im>    complex hyperbolic cosine\n");
-  g_print ("  tanh <phi.re> <phi.im>    complex hyperbolic tangent\n");
-  g_print ("  midi2freq <midinote>      convert midinote into oscilaltor frequency\n");
-  g_print ("  snc <u.re> <u.im> <emmc.re> <emmc.im>     sn() for complex numbers\n");
-  g_print ("  asnc <y.re> <y.im> <emmc.re> <emmc.im>    asn() for complex numbers\n");
-  g_print ("  sci_sn <u> <k2>                           scilab version of sn()\n");
-  g_print ("  sci_asn <y> <k2>                          scilab version of asn()\n");
-  g_print ("  sci_snc <u.re> <u.im> <k2.re> <k2.im>     scilab version of snc()\n");
-  g_print ("  sci_asnc <y.re> <y.im> <k2.re> <k2.im>    scilab version of asnc()\n");
-  g_print ("  blp <order> <freq> <epsilon>              butterworth lowpass filter\n");
-  g_print ("  bhp <order> <freq> <epsilon>              butterworth higpass filter\n");
-  g_print ("  bbp <order> <freqc> <freqr> <epsilon>     butterworth bandpass filter\n");
-  g_print ("  t1l <order> <freq> <epsilon>              type1 tschebyscheff lowpass filter\n");
-  g_print ("  t1h <order> <freq> <epsilon>              type1 tschebyscheff highpass filter\n");
-  g_print ("  t1s <order> <freqc> <freqr> <epsilon>     type1 tschebyscheff bandstop filter\n");
-  g_print ("  t1p <order> <freqc> <freqr> <epsilon>     type1 tschebyscheff bandpass filter\n");
-  g_print ("  t2l <order> <freqc> <steepn> <epsilon>    type2 tschebyscheff lowpass filter\n");
-  g_print ("  t2h <order> <freqc> <steepn> <epsilon>    type2 tschebyscheff highpass filter\n");
-  g_print ("  fir <order> <freq1> <value1> ...          fir approximation\n");
-  g_print ("  scan blp <order> <freq> <epsilon>         scan butterworth lowpass filter\n");
-  g_print ("  poly | polyr | polyp                      polynom test (+roots or +poles)\n");
+  printout ("usage: mathtests {test} [args...]\n");
+  printout ("tests:\n");
+  printout ("  wave-scan <file>          scan a wave file for waves\n");
+  printout ("  file-test <file>          test file properties\n");
+  printout ("  ring-test                 test ring implementation\n");
+  printout ("  rf <x> <y> <z>            Carlson's elliptic integral of the first kind\n");
+  printout ("  F <phi> <ak>              Legendre elliptic integral of the 1st kind\n");
+  printout ("  sn <u> <emmc>             Jacobian elliptic function sn()\n");
+  printout ("  asn <y> <emmc>            elliptic integral, inverse sn()\n");
+  printout ("  sin <phi.re> <phi.im>     complex sine\n");
+  printout ("  cos <phi.re> <phi.im>     complex cosine\n");
+  printout ("  tan <phi.re> <phi.im>     complex tangent\n");
+  printout ("  sinh <phi.re> <phi.im>    complex hyperbolic sine\n");
+  printout ("  cosh <phi.re> <phi.im>    complex hyperbolic cosine\n");
+  printout ("  tanh <phi.re> <phi.im>    complex hyperbolic tangent\n");
+  printout ("  midi2freq <midinote>      convert midinote into oscilaltor frequency\n");
+  printout ("  snc <u.re> <u.im> <emmc.re> <emmc.im>     sn() for complex numbers\n");
+  printout ("  asnc <y.re> <y.im> <emmc.re> <emmc.im>    asn() for complex numbers\n");
+  printout ("  sci_sn <u> <k2>                           scilab version of sn()\n");
+  printout ("  sci_asn <y> <k2>                          scilab version of asn()\n");
+  printout ("  sci_snc <u.re> <u.im> <k2.re> <k2.im>     scilab version of snc()\n");
+  printout ("  sci_asnc <y.re> <y.im> <k2.re> <k2.im>    scilab version of asnc()\n");
+  printout ("  blp <order> <freq> <epsilon>              butterworth lowpass filter\n");
+  printout ("  bhp <order> <freq> <epsilon>              butterworth higpass filter\n");
+  printout ("  bbp <order> <freqc> <freqr> <epsilon>     butterworth bandpass filter\n");
+  printout ("  t1l <order> <freq> <epsilon>              type1 tschebyscheff lowpass filter\n");
+  printout ("  t1h <order> <freq> <epsilon>              type1 tschebyscheff highpass filter\n");
+  printout ("  t1s <order> <freqc> <freqr> <epsilon>     type1 tschebyscheff bandstop filter\n");
+  printout ("  t1p <order> <freqc> <freqr> <epsilon>     type1 tschebyscheff bandpass filter\n");
+  printout ("  t2l <order> <freqc> <steepn> <epsilon>    type2 tschebyscheff lowpass filter\n");
+  printout ("  t2h <order> <freqc> <steepn> <epsilon>    type2 tschebyscheff highpass filter\n");
+  printout ("  fir <order> <freq1> <value1> ...          fir approximation\n");
+  printout ("  scan blp <order> <freq> <epsilon>         scan butterworth lowpass filter\n");
+  printout ("  poly | polyr | polyp                      polynom test (+roots or +poles)\n");
   exit (1);
 }
 
@@ -656,10 +657,10 @@ static void
 print_int_ring (SfiRing *ring)
 {
   SfiRing *node;
-  g_print ("{");
+  printout ("{");
   for (node = ring; node; node = sfi_ring_walk (node, ring))
-    g_print ("%c", char (size_t (node->data)));
-  g_print ("}");
+    printout ("%c", char (size_t (node->data)));
+  printout ("}");
 }
 
 static gint
@@ -700,13 +701,13 @@ ring_test (void)
       uint l = data_array[n][0];
       SfiRing *ring = NULL;
       for (uint i = 1; i <= l; i++)
-       ring = sfi_ring_append (ring, (gpointer) (data_array[n][i]));
-      g_print ("source: ");
+       ring = sfi_ring_append (ring, (void*) size_t (data_array[n][i]));
+      printout ("source: ");
       print_int_ring (ring);
       ring = sfi_ring_sort (ring, ints_cmp, NULL);
-      g_print (" sorted: ");
+      printout (" sorted: ");
       print_int_ring (ring);
-      g_print ("\n");
+      printout ("\n");
       sfi_ring_free (ring);
     }
 }


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