[beast/devel: 10/15] BSE: compile bseparasite, bseplugin and bseprocedure as C++
- From: Tim Janik <timj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [beast/devel: 10/15] BSE: compile bseparasite, bseplugin and bseprocedure as C++
- Date: Mon, 17 Dec 2012 03:16:19 +0000 (UTC)
commit 5b7fedbdd5e219ba270ef8af95cc93041e1f370f
Author: Tim Janik <timj gnu org>
Date: Mon Dec 17 01:56:13 2012 +0100
BSE: compile bseparasite, bseplugin and bseprocedure as C++
bse/Makefile.am | 10 ++--
bse/bseexports.h | 4 +-
bse/{bseparasite.c => bseparasite.cc} | 116 ++++++++++++-------------------
bse/{bseplugin.c => bseplugin.cc} | 50 +++++--------
bse/{bseprocedure.c => bseprocedure.cc} | 51 +++++---------
bse/mkcproc.pl | 2 +-
6 files changed, 90 insertions(+), 143 deletions(-)
---
diff --git a/bse/Makefile.am b/bse/Makefile.am
index c23aff4..81e8d77 100644
--- a/bse/Makefile.am
+++ b/bse/Makefile.am
@@ -76,9 +76,9 @@ bse_sources = $(strip \
bsemidicontroller.cc bsemididevice.cc bsedevice.cc \
bsemididevice-null.cc bsemididevice-oss.cc bsemidievent.cc bsemidinotifier.c \
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.cc bseserver.cc \
+ bsepcminput.cc bsepcmoutput.cc bseparam.cc bseparasite.cc \
+ bsepcmdevice.cc bsepcmdevice-oss.cc bsepcmdevice-null.cc bseplugin.cc \
+ bseprocedure.cc 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 \
@@ -245,7 +245,7 @@ bsegentype_array.c: @PERLRULE@ bsegentypes.h
# bsebuiltin_externs.c
GENERATED_EXTRA_DIST += bsebuiltin_externs.c
#$(libbse_la_OBJECTS): bsebuiltin_externs.c # forces complete rebuild when *.proc changes
-bseplugin.c: bsebuiltin_externs.c
+bseplugin.cc: bsebuiltin_externs.c
bsebuiltin_externs.c: @PERLRULE@ $(bse_proc_gen_sources) mkcproc.pl
cd $(srcdir) \
&& $(PERL) mkcproc.pl --externs $(bse_proc_gen_sources) > xgen-$(@F) \
@@ -254,7 +254,7 @@ bsebuiltin_externs.c: @PERLRULE@ $(bse_proc_gen_sources) mkcproc.pl
# bsebuiltin_array.c
GENERATED_EXTRA_DIST += bsebuiltin_array.c
#$(libbse_la_OBJECTS): bsebuiltin_array.c # forces complete rebuild when *.proc changes
-bseplugin.c: bsebuiltin_array.c
+bseplugin.cc: bsebuiltin_array.c
bsebuiltin_array.c: @PERLRULE@ $(bse_proc_gen_sources) mkcproc.pl
cd $(srcdir) \
&& $(PERL) mkcproc.pl --functions $(bse_proc_gen_sources) > xgen-$(@F) \
diff --git a/bse/bseexports.h b/bse/bseexports.h
index 8c92e0f..7030ccf 100644
--- a/bse/bseexports.h
+++ b/bse/bseexports.h
@@ -146,9 +146,9 @@ typedef struct {
-BsePlugin* bse_exports__add_node (const BseExportIdentity *identity, // bseplugin.c
+BsePlugin* bse_exports__add_node (const BseExportIdentity *identity, // bseplugin.cc
BseExportNode *enode);
-void bse_exports__del_node (BsePlugin *plugin, // bseplugin.c
+void bse_exports__del_node (BsePlugin *plugin, // bseplugin.cc
BseExportNode *enode);
/* implementation prototype */
diff --git a/bse/bseparasite.c b/bse/bseparasite.cc
similarity index 86%
rename from bse/bseparasite.c
rename to bse/bseparasite.cc
index 7c92b58..03a6a84 100644
--- a/bse/bseparasite.c
+++ b/bse/bseparasite.cc
@@ -29,8 +29,8 @@ typedef struct {
GSList *paths; /* contains ref-counted const gchar* */
} CRef;
struct _BseParasite {
- gpointer nodes;
- gpointer crefs;
+ GBSearchArray *nodes;
+ GBSearchArray *crefs;
};
@@ -83,8 +83,8 @@ static gint
parasite_node_cmp (gconstpointer bsn1,
gconstpointer bsn2)
{
- const Node *n1 = bsn1;
- const Node *n2 = bsn2;
+ const Node *n1 = (const Node*) bsn1;
+ const Node *n2 = (const Node*) bsn2;
return strcmp (n1->path, n2->path);
}
@@ -101,8 +101,8 @@ static gint
parasite_cref_cmp (gconstpointer bsn1,
gconstpointer bsn2)
{
- const CRef *r1 = bsn1;
- const CRef *r2 = bsn2;
+ const CRef *r1 = (const CRef*) bsn1;
+ const CRef *r2 = (const CRef*) bsn2;
return G_BSEARCH_ARRAY_CMP (r1->link, r2->link);
}
@@ -110,15 +110,15 @@ static void
parasite_uncross_object (BseItem *item,
BseItem *link)
{
- CRef *cref, key = { 0, };
+ CRef key = { 0, };
key.link = link;
- cref = g_bsearch_array_lookup (item->parasite->crefs, &bconfig_crefs, &key);
+ CRef *cref = (CRef*) g_bsearch_array_lookup (item->parasite->crefs, &bconfig_crefs, &key);
g_return_if_fail (cref != NULL);
while (cref->paths)
{
- const gchar *path = cref->paths->data;
+ const char *path = (const char*) cref->paths->data;
bse_item_set_parasite (item, path, NULL);
- cref = g_bsearch_array_lookup (item->parasite->crefs, &bconfig_crefs, &key);
+ cref = (CRef*) g_bsearch_array_lookup (item->parasite->crefs, &bconfig_crefs, &key);
}
}
@@ -129,11 +129,11 @@ parasite_ref_object (BseItem *item,
{
CRef *cref, key = { 0, };
key.link = link;
- cref = g_bsearch_array_lookup (item->parasite->crefs, &bconfig_crefs, &key);
+ cref = (CRef*) g_bsearch_array_lookup (item->parasite->crefs, &bconfig_crefs, &key);
if (!cref)
{
item->parasite->crefs = g_bsearch_array_insert (item->parasite->crefs, &bconfig_crefs, &key);
- cref = g_bsearch_array_lookup (item->parasite->crefs, &bconfig_crefs, &key);
+ cref = (CRef*) g_bsearch_array_lookup (item->parasite->crefs, &bconfig_crefs, &key);
bse_item_cross_link (item, link, parasite_uncross_object);
}
cref->paths = g_slist_prepend (cref->paths, (gchar*) g_intern_string (path));
@@ -147,7 +147,7 @@ parasite_unref_object (BseItem *item,
CRef *cref, key = {0, };
GSList *plink;
key.link = link;
- cref = g_bsearch_array_lookup (item->parasite->crefs, &bconfig_crefs, &key);
+ cref = (CRef*) g_bsearch_array_lookup (item->parasite->crefs, &bconfig_crefs, &key);
g_return_if_fail (cref != NULL);
plink = g_slist_find (cref->paths, path);
g_return_if_fail (plink != NULL);
@@ -166,7 +166,7 @@ parasite_ref_value (BseItem *item,
{
if (G_VALUE_HOLDS_OBJECT (value))
{
- BseItem *link = g_value_get_object (value);
+ BseItem *link = (BseItem*) g_value_get_object (value);
if (link)
parasite_ref_object (item, path, link);
}
@@ -191,7 +191,7 @@ parasite_unref_value (BseItem *item,
{
if (G_VALUE_HOLDS_OBJECT (value))
{
- BseItem *link = g_value_get_object (value);
+ BseItem *link = (BseItem*) g_value_get_object (value);
if (link)
parasite_unref_object (item, path, link);
}
@@ -266,7 +266,7 @@ bse_item_set_parasite (BseItem *item,
parasite_init (item);
/* ensure node */
key.path = parasite_path;
- node = g_bsearch_array_lookup (item->parasite->nodes, &bconfig_nodes, &key);
+ node = (Node*) g_bsearch_array_lookup (item->parasite->nodes, &bconfig_nodes, &key);
if (!node)
{
/* catch no-op deletion */
@@ -274,7 +274,7 @@ bse_item_set_parasite (BseItem *item,
return;
key.path = g_intern_string (parasite_path);
item->parasite->nodes = g_bsearch_array_insert (item->parasite->nodes, &bconfig_nodes, &key);
- node = g_bsearch_array_lookup (item->parasite->nodes, &bconfig_nodes, &key);
+ node = (Node*) g_bsearch_array_lookup (item->parasite->nodes, &bconfig_nodes, &key);
notify_add = TRUE;
}
/* queue undo */
@@ -315,7 +315,7 @@ bse_item_get_parasite (BseItem *item,
{
Node *node, key = { 0, };
key.path = parasite_path;
- node = g_bsearch_array_lookup (item->parasite->nodes, &bconfig_nodes, &key);
+ node = (Node*) g_bsearch_array_lookup (item->parasite->nodes, &bconfig_nodes, &key);
if (node)
return node->rec;
}
@@ -326,16 +326,16 @@ static void
undo_set_parasite (BseUndoStep *ustep,
BseUndoStack *ustack)
{
- BseItem *item = bse_undo_pointer_unpack (ustep->data[0].v_pointer, ustack);
- const gchar *path = ustep->data[1].v_pointer;
- SfiRec *rec = ustep->data[2].v_pointer;
+ BseItem *item = (BseItem*) bse_undo_pointer_unpack ((const char*) ustep->data[0].v_pointer, ustack);
+ const gchar *path = (const char*) ustep->data[1].v_pointer;
+ SfiRec *rec = (SfiRec*) ustep->data[2].v_pointer;
bse_item_set_parasite (item, path, rec);
}
static void
unde_free_parasite (BseUndoStep *ustep)
{
- SfiRec *rec = ustep->data[2].v_pointer;
+ SfiRec *rec = (SfiRec*) ustep->data[2].v_pointer;
g_free (ustep->data[0].v_pointer);
if (rec)
sfi_rec_unref (rec);
@@ -366,8 +366,8 @@ bse_item_delete_parasites (BseItem *item)
{
while (g_bsearch_array_get_n_nodes (item->parasite->nodes))
{
- Node *node = g_bsearch_array_get_nth (item->parasite->nodes, &bconfig_nodes,
- g_bsearch_array_get_n_nodes (item->parasite->nodes) - 1);
+ Node *node = (Node*) g_bsearch_array_get_nth (item->parasite->nodes, &bconfig_nodes,
+ g_bsearch_array_get_n_nodes (item->parasite->nodes) - 1);
bse_item_set_parasite (item, node->path, NULL);
}
g_assert (g_bsearch_array_get_n_nodes (item->parasite->crefs) == 0);
@@ -390,7 +390,7 @@ bse_item_list_parasites (BseItem *item,
return NULL;
for (i = 0; i < g_bsearch_array_get_n_nodes (item->parasite->nodes); i++)
{
- Node *node = g_bsearch_array_get_nth (item->parasite->nodes, &bconfig_nodes, i);
+ Node *node = (Node*) g_bsearch_array_get_nth (item->parasite->nodes, &bconfig_nodes, i);
if (strncmp (parent_path, node->path, l) == 0)
{
const gchar *slash = strchr (node->path + l, '/');
@@ -475,21 +475,17 @@ void
bse_parasite_store (BseObject *object,
BseStorage *storage)
{
- ParasiteList *list;
- guint n;
-
- list = g_object_get_qdata (object, quark_parasite_list);
+ ParasiteList *list = (ParasiteList*) g_object_get_qdata ((GObject*) object, quark_parasite_list);
if (!list)
return;
-
- for (n = 0; n < list->n_parasites; n++)
+ for (uint n = 0; n < list->n_parasites; n++)
{
Parasite *parasite = list->parasites + n;
gchar *name;
-
+
if (!parasite->n_values)
continue;
-
+
bse_storage_break (storage);
name = g_strescape (g_quark_to_string (parasite->quark), NULL);
bse_storage_printf (storage, "(parasite %c \"%s\"",
@@ -497,14 +493,12 @@ bse_parasite_store (BseObject *object,
name);
switch (parasite->type)
{
- guint i;
-
+ uint i;
case PARASITE_FLOAT:
bse_storage_printf (storage, " %u", parasite->n_values);
for (i = 0; i < parasite->n_values; i++)
{
- gfloat *floats = parasite->data;
-
+ float *floats = (float*) parasite->data;
if ((i + 1) % 5 == 0)
bse_storage_break (storage);
bse_storage_putc (storage, ' ');
@@ -526,7 +520,7 @@ bse_parasite_store (BseObject *object,
static void
parasite_list_free (gpointer data)
{
- ParasiteList *list = data;
+ ParasiteList *list = (ParasiteList*) data;
guint i;
for (i = 0; i < list->n_parasites; i++)
@@ -541,23 +535,17 @@ fetch_parasite (BseObject *object,
gchar type,
gboolean create)
{
- ParasiteList *list;
- guint i;
-
- list = g_object_get_qdata (object, quark_parasite_list);
-
+ ParasiteList *list = (ParasiteList*) g_object_get_qdata ((GObject*) object, quark_parasite_list);
if (list)
- for (i = 0; i < list->n_parasites; i++)
+ for (uint i = 0; i < list->n_parasites; i++)
if (list->parasites[i].quark == quark &&
list->parasites[i].type == type)
return list->parasites + i;
-
if (create)
{
ParasiteList *olist = list;
-
- i = list ? list->n_parasites : 0;
- list = g_realloc (list, sizeof (ParasiteList) + i * sizeof (Parasite));
+ uint i = list ? list->n_parasites : 0;
+ list = (ParasiteList*) g_realloc (list, sizeof (ParasiteList) + i * sizeof (Parasite));
list->n_parasites = i + 1;
if (list != olist)
{
@@ -565,8 +553,8 @@ fetch_parasite (BseObject *object,
quark_parasite_list = g_quark_from_static_string ("BseParasiteList");
if (olist)
- g_object_steal_qdata (object, quark_parasite_list);
- g_object_set_qdata_full (object, quark_parasite_list, list, parasite_list_free);
+ g_object_steal_qdata ((GObject*) object, quark_parasite_list);
+ g_object_set_qdata_full ((GObject*) object, quark_parasite_list, list, parasite_list_free);
}
list->parasites[i].quark = quark;
@@ -585,28 +573,24 @@ delete_parasite (BseObject *object,
GQuark quark,
gchar type)
{
- ParasiteList *list;
Parasite *parasite = NULL;
- guint i;
-
- list = g_object_get_qdata (object, quark_parasite_list);
+ ParasiteList *list = (ParasiteList*) g_object_get_qdata ((GObject*) object, quark_parasite_list);
if (!list)
return;
-
+ uint i;
for (i = 0; i < list->n_parasites; i++)
if (list->parasites[i].quark == quark &&
list->parasites[i].type == type)
parasite = list->parasites + i;
if (!parasite)
return;
-
if (parasite->n_values)
g_free (parasite->data);
list->n_parasites -= 1;
if (i < list->n_parasites)
list->parasites[i] = list->parasites[list->n_parasites];
else if (list->n_parasites == 0)
- g_object_set_qdata (object, quark_parasite_list, NULL);
+ g_object_set_qdata ((GObject*) object, quark_parasite_list, NULL);
}
GTokenType
@@ -680,11 +664,9 @@ bse_parasite_restore (BseObject *object,
ttype,
g_quark_to_string (quark));
}
-
if (g_scanner_peek_next_token (scanner) == ')')
{
Parasite *parasite = fetch_parasite (object, quark, ttype, TRUE);
-
if (parasite->n_values)
g_free (parasite->data);
parasite->n_values = n_values;
@@ -692,9 +674,8 @@ bse_parasite_restore (BseObject *object,
}
else if (n_values)
g_free (data);
-
/* read closing brace */
- return g_scanner_get_next_token (scanner) == ')' ? G_TOKEN_NONE : ')';
+ return g_scanner_get_next_token (scanner) == ')' ? G_TOKEN_NONE : GTokenType (')');
}
void
@@ -733,18 +714,11 @@ SfiFBlock*
bse_parasite_get_floats (BseObject *object,
const gchar *name)
{
- Parasite *parasite;
- SfiFBlock *fblock;
-
g_return_val_if_fail (BSE_IS_OBJECT (object), 0);
g_return_val_if_fail (name != NULL, 0);
-
- parasite = fetch_parasite (object,
- g_quark_try_string (name),
- PARASITE_FLOAT,
- FALSE);
- fblock = sfi_fblock_new ();
+ Parasite *parasite = fetch_parasite (object, g_quark_try_string (name), PARASITE_FLOAT, FALSE);
+ SfiFBlock *fblock = sfi_fblock_new ();
if (parasite)
- sfi_fblock_append (fblock, parasite->n_values, parasite->data);
+ sfi_fblock_append (fblock, parasite->n_values, (const float*) parasite->data);
return fblock;
}
diff --git a/bse/bseplugin.c b/bse/bseplugin.cc
similarity index 96%
rename from bse/bseplugin.c
rename to bse/bseplugin.cc
index bd7779c..93705f9 100644
--- a/bse/bseplugin.c
+++ b/bse/bseplugin.cc
@@ -71,12 +71,8 @@ BSE_BUILTIN_TYPE (BsePlugin)
NULL, /* interface_finalize */
NULL, /* interface_data */
};
- GType plugin_type;
-
- plugin_type = g_type_register_static (G_TYPE_OBJECT, "BsePlugin", &plugin_info, 0);
-
+ GType plugin_type = g_type_register_static (G_TYPE_OBJECT, "BsePlugin", &plugin_info, GTypeFlags (0));
g_type_add_interface_static (plugin_type, G_TYPE_TYPE_PLUGIN, &iface_info);
-
return plugin_type;
}
@@ -137,20 +133,20 @@ bse_plugin_init (BsePlugin *plugin)
plugin->types = NULL;
}
+#include "bsebuiltin_externs.c" // include extern declarations of builtin init functions
+
void
bse_plugin_init_builtins (void)
{
if (!bse_plugins)
{
- /* include extern declarations of builtin init functions */
-#include "bsebuiltin_externs.c"
static BseExportNode* (* const builtin_inits[]) (void) = {
/* and list them in an array */
#include "bsebuiltin_array.c"
};
static const guint n_builtin_inits = G_N_ELEMENTS (builtin_inits);
guint i;
-
+
/* initialize builtin types via pseudo plugin handle */
for (i = 0; i < n_builtin_inits; i++)
{
@@ -158,7 +154,7 @@ bse_plugin_init_builtins (void)
if (chain)
{
/* create resident plugin struct */
- BsePlugin *plugin = g_object_new (BSE_TYPE_PLUGIN, NULL);
+ BsePlugin *plugin = (BsePlugin*) g_object_new (BSE_TYPE_PLUGIN, NULL);
g_object_ref (plugin);
plugin->use_count = 1;
plugin->fname = g_strdup ("BSE-BUILTIN");
@@ -171,7 +167,7 @@ bse_plugin_init_builtins (void)
if (bse_builtin_export_identity.export_chain)
{
/* create resident plugin struct */
- BsePlugin *plugin = g_object_new (BSE_TYPE_PLUGIN, NULL);
+ BsePlugin *plugin = (BsePlugin*) g_object_new (BSE_TYPE_PLUGIN, NULL);
g_object_ref (plugin);
plugin->use_count = 1;
plugin->fname = g_strdup ("BSE-CXX-BUILTIN");
@@ -230,14 +226,13 @@ bse_exports__add_node (const BseExportIdentity *identity,
}
static const char*
-plugin_check_identity (BsePlugin *plugin,
- GModule *gmodule)
+plugin_check_identity (BsePlugin *plugin, GModule *gmodule)
{
if (!plugin->chain)
{
/* handle legacy C plugins */
BseExportIdentity **symbol_p = NULL;
- if (g_module_symbol (gmodule, BSE_EXPORT_IDENTITY_STRING, (gpointer) &symbol_p) && *symbol_p)
+ if (g_module_symbol (gmodule, BSE_EXPORT_IDENTITY_STRING, (void**) &symbol_p) && *symbol_p)
{
BseExportIdentity *identity = *symbol_p;
if (identity->major != BSE_MAJOR_VERSION ||
@@ -262,21 +257,18 @@ static void
bse_plugin_use (GTypePlugin *gplugin)
{
BsePlugin *plugin = BSE_PLUGIN (gplugin);
-
g_return_if_fail (plugin != NULL);
-
g_object_ref (G_OBJECT (plugin));
if (!plugin->use_count)
{
DEBUG ("reloading-plugin: %s", plugin->fname);
-
plugin->use_count++;
startup_plugin = plugin;
- plugin->gmodule = g_module_open (plugin->fname, 0); /* reopen for use non-lazy */
+ plugin->gmodule = g_module_open (plugin->fname, GModuleFlags (0)); /* reopen for use non-lazy */
startup_plugin = NULL;
if (!plugin->gmodule)
g_error ("failed to reinitialize plugin \"%s\": %s", plugin->fname, g_module_error ());
- const char *cerror = plugin_check_identity (plugin, plugin->gmodule);
+ const char *cerror = plugin_check_identity (plugin, (GModule*) plugin->gmodule);
if (cerror)
g_error ("failed to reinitialize plugin \"%s\": %s", plugin->fname, cerror);
if (!plugin->chain)
@@ -315,15 +307,15 @@ bse_plugin_unload (BsePlugin *plugin)
{
g_return_if_fail (plugin->gmodule != NULL && plugin->fname != NULL);
g_return_if_fail (plugin->use_count == 0);
-
+
bse_plugin_uninit_types (plugin);
- g_module_close (plugin->gmodule);
+ g_module_close ((GModule*) plugin->gmodule);
plugin->gmodule = NULL;
-
+
/* reset plugin local pointers */
if (plugin->force_clean)
plugin->chain = NULL;
-
+
DEBUG ("unloaded-plugin: %s", plugin->fname);
}
@@ -421,7 +413,7 @@ static void
bse_plugin_reinit_types (BsePlugin *plugin)
{
guint n = plugin->n_types;
- GType *types = g_memdup (plugin->types, sizeof (plugin->types[0]) * n);
+ GType *types = (GType*) g_memdup (plugin->types, sizeof (plugin->types[0]) * n);
BseExportNode *node;
for (node = plugin->chain; node && node->ntype; node = node->next)
@@ -581,16 +573,12 @@ bse_plugin_init_types (BsePlugin *plugin)
static inline BsePlugin*
bse_plugin_find (GModule *gmodule)
{
- GSList *slist;
-
- for (slist = bse_plugins; slist; slist = slist->next)
+ for (GSList *slist = bse_plugins; slist; slist = slist->next)
{
- BsePlugin *plugin = slist->data;
-
+ BsePlugin *plugin = (BsePlugin*) slist->data;
if (plugin->gmodule == gmodule)
return plugin;
}
-
return NULL;
}
@@ -655,7 +643,7 @@ bse_plugin_check_load (const gchar *const_file_name)
DEBUG ("register: %s", file_name);
/* load module */
- BsePlugin *plugin = g_object_new (BSE_TYPE_PLUGIN, NULL);
+ BsePlugin *plugin = (BsePlugin*) g_object_new (BSE_TYPE_PLUGIN, NULL);
plugin->fname = g_strdup (file_name);
startup_plugin = plugin;
gmodule = g_module_open (file_name, G_MODULE_BIND_LAZY);
@@ -793,7 +781,7 @@ bse_plugin_path_list_files (gboolean include_drivers,
ring = NULL;
for (fname = files; fname; fname = sfi_ring_next (fname, files))
{
- char *name = fname->data;
+ char *name = (char*) fname->data;
bool match = plugin_extension_filter (name, G_N_ELEMENTS (exts), exts);
DEBUG ("PluginExtensionFilter: %s: %s", name, match ? "(match)" : "(ignored)");
if (match)
diff --git a/bse/bseprocedure.c b/bse/bseprocedure.cc
similarity index 95%
rename from bse/bseprocedure.c
rename to bse/bseprocedure.cc
index 25b3701..d18e3e4 100644
--- a/bse/bseprocedure.c
+++ b/bse/bseprocedure.cc
@@ -148,10 +148,10 @@ bse_procedure_init (BseProcedureClass *proc,
j = 0;
for (i = 0; i < proc->n_in_pspecs; i++)
if (G_TYPE_IS_CLASSED ((G_PARAM_SPEC_VALUE_TYPE (proc->in_pspecs[i]))))
- proc->class_refs[j++] = g_type_class_ref (G_PARAM_SPEC_VALUE_TYPE (proc->in_pspecs[i]));
+ proc->class_refs[j++] = (GTypeClass*) g_type_class_ref (G_PARAM_SPEC_VALUE_TYPE (proc->in_pspecs[i]));
for (i = 0; i < proc->n_out_pspecs; i++)
if (G_TYPE_IS_CLASSED ((G_PARAM_SPEC_VALUE_TYPE (proc->out_pspecs[i]))))
- proc->class_refs[j++] = g_type_class_ref (G_PARAM_SPEC_VALUE_TYPE (proc->out_pspecs[i]));
+ proc->class_refs[j++] = (GTypeClass*) g_type_class_ref (G_PARAM_SPEC_VALUE_TYPE (proc->out_pspecs[i]));
proc->class_refs[j++] = NULL;
/* hookup execute method */
@@ -173,26 +173,21 @@ bse_procedure_type_register (const gchar *name,
BsePlugin *plugin,
GType *ret_type)
{
- GType type, base_type = 0;
- gchar *p;
-
+ GType base_type = 0;
g_return_val_if_fail (ret_type != NULL, bse_error_blurb (BSE_ERROR_INTERNAL));
*ret_type = 0;
g_return_val_if_fail (name != NULL, bse_error_blurb (BSE_ERROR_INTERNAL));
g_return_val_if_fail (plugin != NULL, bse_error_blurb (BSE_ERROR_INTERNAL));
-
- type = g_type_from_name (name);
+ GType type = g_type_from_name (name);
if (type)
return "Procedure already registered";
-
- p = strchr (name, '+');
- if (p)
+ const char *pn = strchr (name, '+');
+ if (pn)
{
/* enforce <OBJECT>+<METHOD> syntax */
- if (!p[1])
+ if (!pn[1])
return "Procedure name invalid";
-
- p = g_strndup (name, p - name);
+ char *p = g_strndup (name, pn - name);
base_type = g_type_from_name (p);
g_free (p);
if (!g_type_is_a (base_type, BSE_TYPE_OBJECT))
@@ -298,19 +293,14 @@ bse_procedure_marshal (GType proc_type,
BseProcedureMarshal marshal,
gpointer marshal_data)
{
- BseProcedureClass *proc;
- GValue tmp_ivalues[BSE_PROCEDURE_MAX_IN_PARAMS];
- GValue tmp_ovalues[BSE_PROCEDURE_MAX_OUT_PARAMS];
- guint i, bail_out = FALSE;
+ GValue tmp_ivalues[BSE_PROCEDURE_MAX_IN_PARAMS], tmp_ovalues[BSE_PROCEDURE_MAX_OUT_PARAMS];
+ uint i, bail_out = FALSE;
BseErrorType error;
-
g_return_val_if_fail (BSE_TYPE_IS_PROCEDURE (proc_type), BSE_ERROR_INTERNAL);
-
- proc = g_type_class_ref (proc_type);
+ BseProcedureClass *proc = (BseProcedureClass*) g_type_class_ref (proc_type);
for (i = 0; i < proc->n_in_pspecs; i++)
{
GParamSpec *pspec = proc->in_pspecs[i];
-
tmp_ivalues[i].g_type = 0;
g_value_init (tmp_ivalues + i, G_PARAM_SPEC_VALUE_TYPE (pspec));
if (!sfi_value_transform (ivalues + i, tmp_ivalues + i))
@@ -487,16 +477,11 @@ bse_procedure_marshal_valist (GType proc_type,
gboolean skip_ovalues,
va_list var_args)
{
- GValue tmp_ivalues[BSE_PROCEDURE_MAX_IN_PARAMS];
- GValue tmp_ovalues[BSE_PROCEDURE_MAX_OUT_PARAMS];
- BseProcedureClass *proc;
- BseErrorType error;
-
g_return_val_if_fail (BSE_TYPE_IS_PROCEDURE (proc_type), BSE_ERROR_INTERNAL);
-
- proc = g_type_class_ref (proc_type);
- error = bse_procedure_call_collect (proc, first_value, marshal, marshal_data,
- FALSE, skip_ovalues, tmp_ivalues, tmp_ovalues, var_args);
+ GValue tmp_ivalues[BSE_PROCEDURE_MAX_IN_PARAMS], tmp_ovalues[BSE_PROCEDURE_MAX_OUT_PARAMS];
+ BseProcedureClass *proc = (BseProcedureClass*) g_type_class_ref (proc_type);
+ BseErrorType error = bse_procedure_call_collect (proc, first_value, marshal, marshal_data,
+ FALSE, skip_ovalues, tmp_ivalues, tmp_ovalues, var_args);
procedure_class_unref (proc);
return error;
}
@@ -526,7 +511,7 @@ bse_procedure_collect_input_args (BseProcedureClass *proc,
g_return_val_if_fail (BSE_IS_PROCEDURE_CLASS (proc), BSE_ERROR_INTERNAL);
/* add an extra reference count to the class */
- proc = g_type_class_ref (BSE_PROCEDURE_TYPE (proc));
+ proc = (BseProcedureClass*) g_type_class_ref (BSE_PROCEDURE_TYPE (proc));
error = bse_procedure_call_collect (proc, first_value, NULL, NULL,
TRUE, TRUE, ivalues, NULL, var_args);
/* so the class can enter the cache here */
@@ -669,7 +654,7 @@ proc_cache_dispatch (GSource *source,
proc = proc_cache;
while (proc)
{
- BseProcedureClass *next = proc->cache_next;
+ BseProcedureClass *next = (BseProcedureClass*) proc->cache_next;
if (proc->cache_stamp < 2) /* purging of old procs */
{
/* unlink */
@@ -692,7 +677,7 @@ proc_cache_dispatch (GSource *source,
while (ulist)
{
proc = ulist;
- ulist = proc->cache_next;
+ ulist = (BseProcedureClass*) proc->cache_next;
proc->cache_next = NULL;
// g_printerr ("release-procedure: %s\n", BSE_PROCEDURE_NAME (proc));
g_type_class_unref (proc);
diff --git a/bse/mkcproc.pl b/bse/mkcproc.pl
index e8ef88e..df02e62 100755
--- a/bse/mkcproc.pl
+++ b/bse/mkcproc.pl
@@ -34,7 +34,7 @@ sub func_name {
if ($gen_externs) {
for (@ARGV) {
- print "BseExportNode* ". func_name ($_) ." (void);\n";
+ print "extern \"C\" BseExportNode* ". func_name ($_) ." (void);\n";
}
exit 0;
} elsif ($gen_funcs) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]