[beast/devel: 9/15] BSE: compile bsequery, bsescripthelper and bsesnooper as C++



commit 26954bde7b217f7a42228ea24bd420e21335fb42
Author: Tim Janik <timj gnu org>
Date:   Sun Dec 16 23:15:15 2012 +0100

    BSE: compile bsequery, bsescripthelper and bsesnooper as C++

 bse/Makefile.am                               |    6 ++--
 bse/{bsequery.c => bsequery.cc}               |   18 ++++++++--------
 bse/{bsescripthelper.c => bsescripthelper.cc} |   23 ++++++++++---------
 bse/{bsesnooper.c => bsesnooper.cc}           |   28 +++++++++++-------------
 po/POTSCAN                                    |    2 +-
 5 files changed, 38 insertions(+), 39 deletions(-)
---
diff --git a/bse/Makefile.am b/bse/Makefile.am
index 24394b9..c23aff4 100644
--- a/bse/Makefile.am
+++ b/bse/Makefile.am
@@ -78,8 +78,8 @@ bse_sources = $(strip \
 	bsemidireceiver.cc	bsemidisynth.c		bseobject.cc			bsepart.cc \
 	bsepcminput.cc		bsepcmoutput.cc		bseparam.cc			bseparasite.c \
 	bsepcmdevice.cc		bsepcmdevice-oss.cc	bsepcmdevice-null.cc		bseplugin.c \
-	bseprocedure.c		bseproject.cc		bsescripthelper.c		bseserver.cc \
-	bsesnet.cc		bsesnooper.c		bsesong.cc			bsesequencer.cc \
+	bseprocedure.c		bseproject.cc		bsescripthelper.cc		bseserver.cc \
+	bsesnet.cc		bsesnooper.cc		bsesong.cc			bsesequencer.cc \
 	bsesource.cc		bsestandardosc.cc	bsestandardsynths.cc		bsestorage.cc \
 	bseinstrumentoutput.cc	bsesubiport.cc		bseinstrumentinput.cc		bsesuboport.cc \
 	bsesubsynth.cc		bsesuper.cc		bsetrack.cc			bsetype.cc \
@@ -314,7 +314,7 @@ bseprocidl_SOURCES = bseprocidl.cc
 bseprocidl_LDADD   = $(progs_LDADD)
 
 noinst_PROGRAMS += bsequery
-bsequery_SOURCES = bsequery.c cxxdummy.cc
+bsequery_SOURCES = bsequery.cc cxxdummy.cc
 bsequery_LDADD   = $(progs_LDADD)
 
 noinst_PROGRAMS   += bseautodoc
diff --git a/bse/bsequery.c b/bse/bsequery.cc
similarity index 95%
rename from bse/bsequery.c
rename to bse/bsequery.cc
index 702050a..3682a23 100644
--- a/bse/bsequery.c
+++ b/bse/bsequery.cc
@@ -89,7 +89,7 @@ show_nodes (GType        type,
 
   if (feature_channels && g_type_is_a (type, BSE_TYPE_SOURCE))
     {
-      BseSourceClass *klass = g_type_class_ref (type);
+      BseSourceClass *klass = (BseSourceClass*) g_type_class_ref (type);
       gchar buffer[1024];
 
       sprintf (buffer,
@@ -146,7 +146,7 @@ show_procdoc (void)
   for (i = 0; i < cseq->n_cats; i++)
     {
       GType type = g_type_from_name (cseq->cats[i]->type);
-      BseProcedureClass *klass = g_type_class_ref (type);
+      BseProcedureClass *klass = (BseProcedureClass*) g_type_class_ref (type);
       gchar *pname = g_type_name_to_sname (cseq->cats[i]->type);
       const gchar *blurb = bse_type_get_blurb (type);
       guint j;
@@ -213,7 +213,7 @@ main (gint   argc,
   gboolean list_synths = 0;
   gchar *show_synth = NULL;
   gchar *root_name = NULL;
-  gchar *iindent = "";
+  const char *iindent = "";
   char pluginbool[2] = "0";
   char scriptbool[2] = "0";
   SfiInitValue config[] = {
@@ -227,8 +227,8 @@ main (gint   argc,
   g_thread_init (NULL);
 
   sfi_init (&argc, &argv, "BseQuery", NULL);
-  
-  guint i;
+
+  int i;
   for (i = 1; i < argc; i++)
     {
       if (strcmp ("-s", argv[i]) == 0)
@@ -244,7 +244,7 @@ main (gint   argc,
 	    {
 	      char *p;
 	      guint n;
-	      
+
 	      p = argv[i];
 	      while (*p)
 		p++;
@@ -310,7 +310,8 @@ main (gint   argc,
         pluginbool[1] = '1';
       else if (strcmp ("-:f", argv[i]) == 0)
 	{
-	  g_log_set_always_fatal (G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL | g_log_set_always_fatal (G_LOG_FATAL_MASK));
+	  g_log_set_always_fatal (GLogLevelFlags (G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL |
+                                                  g_log_set_always_fatal (GLogLevelFlags (G_LOG_FATAL_MASK))));
 	}
       else if (strcmp ("-h", argv[i]) == 0)
 	{
@@ -350,8 +351,7 @@ main (gint   argc,
       root = ~0;
       for (i = 0; i <= G_TYPE_FUNDAMENTAL_MAX; i += G_TYPE_MAKE_FUNDAMENTAL (1))
 	{
-	  gchar *name = g_type_name (i);
-	  
+	  const char *name = g_type_name (i);
 	  if (name)
 	    show_nodes (i, 0, iindent);
 	}
diff --git a/bse/bsescripthelper.c b/bse/bsescripthelper.cc
similarity index 94%
rename from bse/bsescripthelper.c
rename to bse/bsescripthelper.cc
index 480548f..1aff8bb 100644
--- a/bse/bsescripthelper.c
+++ b/bse/bsescripthelper.cc
@@ -61,7 +61,7 @@ bse_script_procedure_init (BseScriptProcedureClass *klass,
   for (ring = sdata->params; ring; ring = sfi_ring_walk (ring, sdata->params))
     {
       gchar *f1 = NULL, *f2 = NULL;
-      GParamSpec *pspec = bse_script_param_spec (ring->data, sdata->script_file, sdata->name, &f1, &f2);
+      GParamSpec *pspec = bse_script_param_spec ((char*) ring->data, sdata->script_file, sdata->name, &f1, &f2);
       g_free (f1);
       g_free (f2);
       if (pspec)
@@ -121,7 +121,7 @@ bse_script_proc_register (const gchar *script_file,
   script_info.class_data = sdata;
   
   tname = g_strconcat ("bse-script-", name, NULL);
-  type = g_type_register_static (BSE_TYPE_PROCEDURE, tname, &script_info, 0);
+  type = g_type_register_static (BSE_TYPE_PROCEDURE, tname, &script_info, GTypeFlags (0));
   g_free (tname);
   if (type)
     {
@@ -178,7 +178,7 @@ bse_script_procedure_exec (BseProcedureClass *proc,
 	}
       if (!quark_script_args)
 	quark_script_args = g_quark_from_static_string ("bse-script-helper-script-args");
-      g_object_set_qdata_full (janitor, quark_script_args, sfi_seq_copy_deep (seq), sfi_seq_unref);
+      g_object_set_qdata_full ((GObject*) janitor, quark_script_args, sfi_seq_copy_deep (seq), GDestroyNotify (sfi_seq_unref));
       sfi_seq_unref (seq);
     }
 
@@ -206,9 +206,9 @@ bse_script_check_client_msg (SfiGlueDecoder *decoder,
 	  SfiRing *params = NULL;
 	  GType type;
 	  guint i;
-	  
+
 	  for (i = vargs_pos; i < seq->n_elements; i++)
-	    params = sfi_ring_append (params, sfi_value_get_string (sfi_seq_get (seq, i)));
+	    params = sfi_ring_append (params, (void*) sfi_value_get_string (sfi_seq_get (seq, i)));
 	  type = bse_script_proc_register (janitor->script_name,
 					   sfi_value_get_string (sfi_seq_get (seq, 0)),
 					   sfi_value_get_string (sfi_seq_get (seq, 1)),
@@ -219,16 +219,17 @@ bse_script_check_client_msg (SfiGlueDecoder *decoder,
 					   sfi_value_get_string (sfi_seq_get (seq, 6)),
 					   sfi_value_get_string (sfi_seq_get (seq, 7)),
 					   params);
-	  sfi_ring_free (params);
+          (void) type;
+          sfi_ring_free (params);
 	  retval = sfi_value_bool (TRUE);	// success
 	}
       return retval;
     }
   else if (strcmp (message, "bse-client-msg-script-args") == 0)
     {
-      SfiSeq *seq = g_object_get_qdata (janitor, quark_script_args);
+      SfiSeq *seq = (SfiSeq*) g_object_get_qdata ((GObject*) janitor, quark_script_args);
       GValue *rvalue = sfi_value_seq (seq);
-      g_object_set_qdata (janitor, quark_script_args, NULL);
+      g_object_set_qdata ((GObject*) janitor, quark_script_args, NULL);
       return rvalue;
     }
   return NULL;
@@ -263,13 +264,13 @@ bse_script_file_register (const gchar *file_name,
 {
   BseServer *server = bse_server_get ();
   SfiRing *params = NULL;
-  gchar *shellpath, *proc_name = "registration hook";
+  const char *proc_name = "registration hook";
   BseErrorType error;
-  
+
   params = sfi_ring_append (params, g_strdup ("--bse-enable-register"));
   params = sfi_ring_append (params, g_strdup ("--bse-eval"));
   params = sfi_ring_append (params, g_strdup_printf ("(load \"%s\")", file_name));
-  shellpath = g_strdup_printf ("%s/%s-%s", bse_main_args->path_binaries, "bsescm", BIN_VERSION);
+  char *shellpath = g_strdup_printf ("%s/%s-%s", bse_main_args->path_binaries, "bsescm", BIN_VERSION);
   *janitor_p = NULL;
   error = bse_server_run_remote (server, shellpath,
 				 params, file_name, proc_name, janitor_p);
diff --git a/bse/bsesnooper.c b/bse/bsesnooper.cc
similarity index 93%
rename from bse/bsesnooper.c
rename to bse/bsesnooper.cc
index e74fdc2..d3e0dfc 100644
--- a/bse/bsesnooper.c
+++ b/bse/bsesnooper.cc
@@ -168,20 +168,18 @@ snooper_process (BseModule *module,
 		 guint      n_values)
 {
   const gfloat *wave_in = BSE_MODULE_IBUFFER (module, 0);
-  SnoopData *data = module->user_data;
-  
+  SnoopData *data = (SnoopData*) module->user_data;
+
   if (data->context_id == *data->active_context_id &&
       module->istreams[0].connected)
     {
       gfloat min = wave_in[0], max = wave_in[0];
       gfloat avg = wave_in[0], first = wave_in[0], last = wave_in[n_values - 1];
       gboolean seen_nan = FALSE, seen_pinf = FALSE, seen_ninf = FALSE, seen_subn = FALSE;
-      guint i;
-      
-      for (i = 1; i < n_values; i++)
+
+      for (uint i = 1; i < n_values; i++)
 	{
-	  gfloat v = wave_in[i];
-	  
+	  float v = wave_in[i];
 	  max = MAX (max, v);
 	  min = MIN (min, v);
 	  avg += v;
@@ -215,14 +213,14 @@ bse_snooper_context_create (BseSource *source,
 			    BseTrans  *trans)
 {
   static const BseModuleClass snooper_class = {
-    BSE_SNOOPER_N_ICHANNELS,	/* n_istreams */
-    0,                  	/* n_jstreams */
-    0,				/* n_ostreams */
-    snooper_process,		/* process */
-    NULL,                       /* process_defer */
-    NULL,                       /* reset */
-    (gpointer) g_free,		/* free */
-    BSE_COST_CHEAP,		/* flags */
+    BSE_SNOOPER_N_ICHANNELS,    // n_istreams
+    0,                          // n_jstreams
+    0,                          // n_ostreams
+    snooper_process,            // process
+    NULL,                       // process_defer
+    NULL,                       // reset
+    (BseModuleFreeFunc) g_free, // free
+    BSE_COST_CHEAP,             // mflags
   };
   BseSnooper *snooper = BSE_SNOOPER (source);
   SnoopData *data = g_new0 (SnoopData, 1);
diff --git a/po/POTSCAN b/po/POTSCAN
index f5d0fb5..5b020f0 100644
--- a/po/POTSCAN
+++ b/po/POTSCAN
@@ -90,7 +90,7 @@ bse/bsepcmdevice-oss.cc
 bse/bsepcminput.cc
 bse/bsepcmoutput.cc
 bse/bseserver.cc
-bse/bsesnooper.c
+bse/bsesnooper.cc
 bse/bsesong.cc
 bse/bsesong.proc
 bse/bsesource.proc



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