[beast: 16/24] BSE: use Rapicorn's printout() and printerr()



commit 89dbb64562825dad05b5900d37ab2a3e269793a8
Author: Tim Janik <timj gnu org>
Date:   Wed Sep 23 11:01:55 2015 +0200

    BSE: use Rapicorn's printout() and printerr()

 bse/bsecxxclosure.cc  |   12 +++++-------
 bse/bsefilter-ellf.cc |   16 ++++++++--------
 bse/bsetool.cc        |    7 +------
 r+d-files/bse-ellf.c  |    6 +++---
 4 files changed, 17 insertions(+), 24 deletions(-)
---
diff --git a/bse/bsecxxclosure.cc b/bse/bsecxxclosure.cc
index 90008cb..fb85798 100644
--- a/bse/bsecxxclosure.cc
+++ b/bse/bsecxxclosure.cc
@@ -27,11 +27,9 @@ CxxClosure::gclosure()
 #include <stdio.h>
 using namespace std;
 inline string
-String (long long int i)
+as_string (long long int i)
 {
-  char buf[16];
-  sprintf (buf, "%lld", i);
-  return string (buf);
+  return string_format ("%d", i);
 }
 
 void
@@ -47,7 +45,7 @@ print_closure (bool withreturn,
     s += "typename R, ";
   s += "class T";
   for (int i = 1; i <= n_args; i++)
-    s += ", typename A" + String (i);
+    s += ", typename A" + as_string (i);
   const char *tmpldecl = strdup (s.c_str());
   /* template args: <R, T, A1, A2, ...> */
   s = "";
@@ -55,14 +53,14 @@ print_closure (bool withreturn,
     s += "R, ";
   s += "T";
   for (int i = 1; i <= n_args; i++)
-    s += ", A" + String (i);
+    s += ", A" + as_string (i);
   const char *tmplargs = strdup (s.c_str());
   /* argtypes: (A1, A2, A3) */
   s = "";
   if (n_args)
     s += "A1";
   for (int i = 2; i <= n_args; i++)
-    s += ", A" + String (i);
+    s += ", A" + as_string (i);
   const char *argtypes = strdup (s.c_str());
   /* introductionary comment */
   printf ("\n/* %s%uClosure */\n", rpref, n_args);
diff --git a/bse/bsefilter-ellf.cc b/bse/bsefilter-ellf.cc
index ddde05d..d844342 100644
--- a/bse/bsefilter-ellf.cc
+++ b/bse/bsefilter-ellf.cc
@@ -46,15 +46,15 @@ typedef struct {
 #define MAXNUM                  (BSE_DOUBLE_MAX_NORMAL)                 /* 2**1024*(1-MACHEP) */
 
 #if 0
-#define error_printf(...)       fprintf (stderr, __VA_ARGS__)
-#define ellf_debugf(...)        fprintf (stderr, __VA_ARGS__)
-#define ellf_outputf(...)       fprintf (stdout, __VA_ARGS__)
-#define ellf_inputf(...)        fprintf (stdout, __VA_ARGS__)
+#define error_printf(...)       printerr (__VA_ARGS__)
+#define ellf_debugf(...)        printerr (__VA_ARGS__)
+#define ellf_outputf(...)       printout (__VA_ARGS__)
+#define ellf_inputf(...)        printout (__VA_ARGS__)
 #else
-#define error_printf(...)       while (0) { printf (__VA_ARGS__); }
-#define ellf_debugf(...)        while (0) { printf (__VA_ARGS__); }
-#define ellf_outputf(...)       while (0) { printf (__VA_ARGS__); }
-#define ellf_inputf(...)        while (0) { printf (__VA_ARGS__); }
+#define error_printf(...)       while (0) { printerr (__VA_ARGS__); }
+#define ellf_debugf(...)        while (0) { printerr (__VA_ARGS__); }
+#define ellf_outputf(...)       while (0) { printout (__VA_ARGS__); }
+#define ellf_inputf(...)        while (0) { printout (__VA_ARGS__); }
 #endif
 
 static const char* ellf_filter_design (const BseIIRFilterRequest *ifr,
diff --git a/bse/bsetool.cc b/bse/bsetool.cc
index 6188f44..e17603d 100644
--- a/bse/bsetool.cc
+++ b/bse/bsetool.cc
@@ -404,13 +404,8 @@ show_nodes (GType root, GType type, GType sibling, const String &indent, const A
   if (feature_channels && g_type_is_a (type, BSE_TYPE_SOURCE))
     {
       BseSourceClass *klass = (BseSourceClass*) g_type_class_ref (type);
-      gchar buffer[1024];
 
-      sprintf (buffer,
-              "\t(ichannels %u) (ochannels %u)",
-              klass->channel_defs.n_ichannels,
-              klass->channel_defs.n_ochannels);
-      printout ("%s", buffer);
+      printout ("\t(ichannels %u) (ochannels %u)", klass->channel_defs.n_ichannels, 
klass->channel_defs.n_ochannels);
       g_type_class_unref (klass);
     }
 
diff --git a/r+d-files/bse-ellf.c b/r+d-files/bse-ellf.c
index b624a15..945c6fc 100644
--- a/r+d-files/bse-ellf.c
+++ b/r+d-files/bse-ellf.c
@@ -54,9 +54,9 @@ double sinh(), cosh(), atan(), exp();
 #include <math.h>
 #endif
 
-#define code_printf(...)     fprintf (stdout, __VA_ARGS__)
-#define ellf_printf(...)     fprintf (stderr, __VA_ARGS__)
-#define ellf_debugf(...)     fprintf (stderr, __VA_ARGS__)
+#define code_printf(...)        printout (__VA_ARGS__)
+#define ellf_printf(...)        printerr (__VA_ARGS__)
+#define ellf_debugf(...)        printerr (__VA_ARGS__)
 
 /* === ellf.doc - start === */
 /*                        ellf.c


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