[beast/devel: 56/77] BSE: fix library initialization functions, use StringVector for internal arguments
- From: Tim Janik <timj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [beast/devel: 56/77] BSE: fix library initialization functions, use StringVector for internal arguments
- Date: Wed, 1 May 2013 17:32:02 +0000 (UTC)
commit c81344f20b566492683aa1cc166477e82168715f
Author: Tim Janik <timj gnu org>
Date: Thu Apr 11 04:02:45 2013 +0200
BSE: fix library initialization functions, use StringVector for internal arguments
beast-gtk/bstmain.cc | 29 +++------
beast-gtk/testgui.cc | 2 +-
bse/bseautodoc.cc | 18 ++----
bse/bsecore.cc | 4 +-
bse/bsecore.hh | 2 +-
bse/bseinfo.cc | 2 +-
bse/bsemain.cc | 146 ++++++++++++++++++++++++------------------
bse/bsemain.hh | 53 +++++++---------
bse/bseprocidl.cc | 2 +-
bse/bsequery.cc | 13 +---
bse/bseserver.cc | 2 +-
bse/tests/blocktests.cc | 6 +--
bse/tests/filtertest.cc | 2 +-
bse/tests/firhandle.cc | 2 +-
bse/tests/loophandle.cc | 2 +-
bse/tests/misctests.cc | 2 +-
bse/tests/resamplehandle.cc | 6 +--
bse/tests/subnormals.cc | 2 +-
bse/tests/testcxx.cc | 2 +-
bse/tests/testfft.cc | 2 +-
shell/bsescm.cc | 19 +++---
tests/bse/cxxbinding.cc | 2 +-
tests/bse/filtertest.cc | 2 +-
tests/perftest.cc | 2 +-
tests/testresampler.cc | 6 +--
tests/testresamplerq.cc | 6 +--
tests/testwavechunk.cc | 10 +---
tools/bsefextract.cc | 11 +---
tools/bsewavetool.cc | 11 +---
tools/cutvorbis.cc | 11 +---
tools/magictest.cc | 6 +--
tools/mathtool.cc | 11 +---
32 files changed, 171 insertions(+), 225 deletions(-)
---
diff --git a/beast-gtk/bstmain.cc b/beast-gtk/bstmain.cc
index 8d65d9c..e47ade6 100644
--- a/beast-gtk/bstmain.cc
+++ b/beast-gtk/bstmain.cc
@@ -21,8 +21,7 @@
extern "C" void bse_object_debug_leaks (void); // FIXME
/* --- prototypes --- */
-static void bst_early_parse_args (gint *argc_p,
- gchar ***argv_p);
+static void bst_early_parse_args (int *argc_p, char **argv);
static void bst_print_blurb (void);
static void bst_exit_print_version (void);
static void bst_init_aida_idl ();
@@ -67,11 +66,6 @@ main (int argc,
GdkPixbufAnimation *anim;
gchar *string;
GSource *source;
- char debugbool[2] = "0";
- SfiInitValue config[] = {
- { "debug-extensions", debugbool },
- { NULL },
- };
guint i;
/* initialize i18n */
bindtextdomain (BST_GETTEXT_DOMAIN, BST_PATH_LOCALE);
@@ -93,9 +87,7 @@ main (int argc,
sfi_init (&argc, &argv, _("BEAST"), NULL); /* application name is user visible */
/* ensure SFI can wake us up */
/* initialize Gtk+ and go into threading mode */
- bst_early_parse_args (&argc, &argv);
- if (bst_debug_extensions)
- debugbool[0] = '1';
+ bst_early_parse_args (&argc, argv);
gtk_init (&argc, &argv);
GDK_THREADS_ENTER ();
/* initialize Gtk+ Extension Kit */
@@ -138,7 +130,8 @@ main (int argc,
}
/* start BSE core and connect */
bst_splash_update_item (beast_splash, _("BSE Core"));
- Bse::init_async (&argc, &argv, "BEAST", config);
+ Bse::String bseoptions = Bse::string_printf ("debug-extensions=%d", bst_debug_extensions);
+ Bse::init_async (&argc, argv, "BEAST", Bse::string_split (bseoptions, ":"));
sfi_glue_context_push (Bse::init_glue_context ("BEAST", bst_main_loop_wakeup));
source = g_source_simple (GDK_PRIORITY_EVENTS, // G_PRIORITY_HIGH - 100,
(GSourcePending) sfi_glue_context_pending,
@@ -448,13 +441,11 @@ bst_init_aida_idl()
}
static void
-bst_early_parse_args (int *argc_p,
- char ***argv_p)
+bst_early_parse_args (int *argc_p, char **argv)
{
- guint argc = *argc_p;
- gchar **argv = *argv_p;
- guint i, e;
- gboolean initialize_bse_and_exit = FALSE;
+ uint argc = *argc_p;
+ uint i, e;
+ bool initialize_bse_and_exit = false;
for (i = 1; i < argc; i++)
{
if (strcmp (argv[i], "--") == 0)
@@ -639,7 +630,7 @@ bst_early_parse_args (int *argc_p,
*argc_p = e;
if (initialize_bse_and_exit)
{
- Bse::init_async (argc_p, argv_p, "BEAST", NULL);
+ Bse::init_async (argc_p, argv, "BEAST");
exit (0);
}
}
@@ -650,7 +641,7 @@ bst_exit_print_version (void)
const gchar *c;
gchar *freeme = NULL;
/* hack: start BSE, so we can query it for paths, works since we immediately exit() afterwards */
- Bse::init_async (NULL, NULL, "BEAST", NULL);
+ Bse::init_async (NULL, NULL, "BEAST");
sfi_glue_context_push (Bse::init_glue_context ("BEAST", bst_main_loop_wakeup));
g_print ("BEAST version %s (%s)\n", BST_VERSION, BST_VERSION_HINT);
g_print ("Libraries: ");
diff --git a/beast-gtk/testgui.cc b/beast-gtk/testgui.cc
index 4ffda42..3268425 100644
--- a/beast-gtk/testgui.cc
+++ b/beast-gtk/testgui.cc
@@ -91,7 +91,7 @@ main (int argc,
_bst_gconfig_init ();
_bst_skin_config_init ();
/* start BSE core and connect */
- Bse::init_async (&argc, &argv, "TestGUI", NULL);
+ Bse::init_async (&argc, argv, "TestGUI");
sfi_glue_context_push (Bse::init_glue_context ("TestGUI", []() { g_main_context_wakeup
(g_main_context_default()); }));
GSource *source = g_source_simple (G_PRIORITY_HIGH - 100,
(GSourcePending) sfi_glue_context_pending,
diff --git a/bse/bseautodoc.cc b/bse/bseautodoc.cc
index cdd150d..8a316b2 100644
--- a/bse/bseautodoc.cc
+++ b/bse/bseautodoc.cc
@@ -493,23 +493,17 @@ main (gint argc,
gboolean gen_procs = FALSE;
gboolean gen_structs = FALSE;
gboolean gen_objects = FALSE;
- char pluginbool[2] = "0";
- char scriptbool[2] = "0";
- SfiInitValue config[] = {
- { "load-core-plugins", pluginbool },
- { "load-core-scripts", scriptbool },
- { NULL },
- };
+ const char *pluginbool = "load-core-plugins=0";
+ const char *scriptbool = "load-core-scripts=0";
g_thread_init (NULL);
sfi_init (&argc, &argv, "BseAutoDoc", NULL);
boxed_type_tag = g_quark_from_static_string ("bse-auto-doc-boxed-type-tag");
- guint i;
- for (i = 1; i < argc; i++)
+ for (int i = 1; i < argc; i++)
{
if (strcmp ("-p", argv[i]) == 0)
- pluginbool[0] = '1';
+ pluginbool = "load-core-plugins=1";
else if (strcmp ("-s", argv[i]) == 0)
- scriptbool[0] = '1';
+ scriptbool = "load-core-scripts=1";
else if (strcmp ("--bse-rcfile", argv[i]) == 0 && i + 1 < argc)
{
/* ignore, BSE handles this */
@@ -545,7 +539,7 @@ main (gint argc,
else
return help (argv[0], argv[i]);
}
- bse_init_inprocess (&argc, &argv, "BseAutoDoc", config);
+ bse_init_inprocess (&argc, argv, "BseAutoDoc", Bse::cstrings_to_vector (pluginbool, scriptbool, NULL));
tag_all_boxed_pspecs ();
if (gen_procs)
show_procdoc ();
diff --git a/bse/bsecore.cc b/bse/bsecore.cc
index eed2ce5..046fd55 100644
--- a/bse/bsecore.cc
+++ b/bse/bsecore.cc
@@ -21,9 +21,9 @@ init_glue_context (const gchar *client, const std::function<void()> &caller_wake
* from @a argc / @a argv.
*/
void
-init_async (int *argc, char ***argv, const char *app_name, SfiInitValue values[])
+init_async (int *argc, char **argv, const char *app_name, const StringVector &args)
{
- _bse_init_async (argc, argv, app_name, values);
+ _bse_init_async (argc, argv, app_name, args);
}
// == TaskRegistry ==
diff --git a/bse/bsecore.hh b/bse/bsecore.hh
index 2d09a5c..17bc171 100644
--- a/bse/bsecore.hh
+++ b/bse/bsecore.hh
@@ -23,7 +23,7 @@ public:
// == BSE Initialization ==
SfiGlueContext* init_glue_context (const gchar *client, const std::function<void()> &caller_wakeup);
-void init_async (int *argc, char ***argv, const char *app_name, SfiInitValue values[]);
+void init_async (int *argc, char **argv, const char *app_name, const StringVector &args =
StringVector());
/// A GSource implementation to attach an Aida::BaseConnection to a Glib main loop.
class AidaGlibSource : public GSource {
diff --git a/bse/bseinfo.cc b/bse/bseinfo.cc
index 6509ef4..1e33f71 100644
--- a/bse/bseinfo.cc
+++ b/bse/bseinfo.cc
@@ -36,7 +36,7 @@ main (int argc,
{
int j, k;
g_thread_init (NULL);
- bse_init_inprocess (&argc, &argv, "BseInfo", NULL);
+ bse_init_inprocess (&argc, argv, "BseInfo");
g_print ("Rate relevant limits:\n");
print_int ("BSE_MIN_OCTAVE ", BSE_MIN_OCTAVE);
print_int ("BSE_MAX_OCTAVE ", BSE_MAX_OCTAVE);
diff --git a/bse/bsemain.cc b/bse/bsemain.cc
index 6f4583d..17f9b91 100644
--- a/bse/bsemain.cc
+++ b/bse/bsemain.cc
@@ -23,10 +23,7 @@ using namespace Birnet;
/* --- prototypes --- */
static void bse_main_loop (Rapicorn::AsyncBlockingQueue<int> *init_queue);
-static void bse_async_parse_args (gint *argc_p,
- gchar ***argv_p,
- BseMainArgs *margs,
- SfiInitValue values[]);
+static void bse_async_parse_args (int *argc_p, char **argv_p, BseMainArgs *margs, const
Bse::StringVector &args);
namespace Bse {
static void init_aida_idl ();
} // Bse
@@ -43,7 +40,6 @@ GMainContext *bse_main_context = NULL;
static volatile gboolean bse_initialization_stage = 0;
static gboolean textdomain_setup = FALSE;
static BseMainArgs default_main_args = {
- { 0, }, // BirnetInitSettings
1, // n_processors
64, // wave_chunk_padding
256, // wave_chunk_big_pad
@@ -56,6 +52,7 @@ static BseMainArgs default_main_args = {
NULL, // override_plugin_globs
NULL, // override_script_path
NULL, // override_sample_path
+ false, // stand_alone
true, // allow_randomization
false, // force_fpu
};
@@ -80,7 +77,7 @@ bse_gettext (const gchar *text)
static std::thread async_bse_thread;
void
-_bse_init_async (int *argc, char ***argv, const char *app_name, SfiInitValue values[])
+_bse_init_async (int *argc, char **argv, const char *app_name, const Bse::StringVector &args)
{
assert (async_bse_thread.get_id() == std::thread::id()); // no async_bse_thread started
bse_init_textdomain_only();
@@ -93,15 +90,14 @@ _bse_init_async (int *argc, char ***argv, const char *app_name, SfiInitValue val
/* paranoid assertions */
g_assert (G_BYTE_ORDER == G_LITTLE_ENDIAN || G_BYTE_ORDER == G_BIG_ENDIAN);
/* initialize submodules */
- sfi_init (argc, argv, app_name, values);
+ sfi_init (argc, &argv, app_name, NULL);
bse_main_args = &default_main_args;
- bse_main_args->birnet = sfi_init_settings();
/* handle argument early*/
if (argc && argv)
{
if (*argc && !g_get_prgname ())
- g_set_prgname (**argv);
- bse_async_parse_args (argc, argv, bse_main_args, values);
+ g_set_prgname (*argv);
+ bse_async_parse_args (argc, argv, bse_main_args, args);
}
// start main BSE thread
auto *init_queue = new Rapicorn::AsyncBlockingQueue<int>();
@@ -244,11 +240,7 @@ server_registration (SfiProxy server,
}
}
static void
-bse_init_intern (gint *argc,
- gchar ***argv,
- const char *app_name,
- SfiInitValue values[],
- bool as_test)
+bse_init_intern (int *argc, char **argv, const char *app_name, const Bse::StringVector &args, bool as_test)
{
bse_init_textdomain_only();
if (bse_initialization_stage != 0)
@@ -260,17 +252,16 @@ bse_init_intern (gint *argc,
g_assert (G_BYTE_ORDER == G_LITTLE_ENDIAN || G_BYTE_ORDER == G_BIG_ENDIAN);
/* initialize submodules */
if (as_test)
- sfi_init_test (argc, argv, values);
+ sfi_init_test (argc, &argv, NULL);
else
- sfi_init (argc, argv, app_name, values);
+ sfi_init (argc, &argv, app_name, NULL);
bse_main_args = &default_main_args;
- bse_main_args->birnet = sfi_init_settings();
/* early argument handling */
if (argc && argv)
{
if (*argc && !g_get_prgname ())
- g_set_prgname (**argv);
- bse_async_parse_args (argc, argv, bse_main_args, values);
+ g_set_prgname (*argv);
+ bse_async_parse_args (argc, argv, bse_main_args, args);
}
bse_init_core ();
/* initialize core plugins & scripts */
@@ -309,20 +300,17 @@ bse_init_intern (gint *argc,
}
// sfi_glue_gc_run ();
}
+
void
-bse_init_inprocess (gint *argc,
- gchar ***argv,
- const char *app_name,
- SfiInitValue values[])
+bse_init_inprocess (int *argc, char **argv, const char *app_name, const Bse::StringVector &args)
{
- bse_init_intern (argc, argv, app_name, values, false);
+ bse_init_intern (argc, argv, app_name, args, false);
}
+
void
-bse_init_test (gint *argc,
- gchar ***argv,
- SfiInitValue values[])
+bse_init_test (int *argc, char **argv, const Bse::StringVector &args)
{
- bse_init_intern (argc, argv, NULL, values, true);
+ bse_init_intern (argc, argv, NULL, args, true);
}
static void
@@ -358,14 +346,48 @@ get_n_processors (void)
#endif
return 1;
}
+
+static bool
+parse_bool_option (const String &s, const char *arg, bool *boolp)
+{
+ const size_t length = strlen (arg);
+ if (s.size() > length && s[length] == '=' && strncmp (&s[0], arg, length) == 0)
+ {
+ *boolp = string_to_bool (s.substr (length + 1));
+ return true;
+ }
+ return false;
+}
+
+static bool
+parse_int_option (const String &s, const char *arg, int64 *ip)
+{
+ const size_t length = strlen (arg);
+ if (s.size() > length && s[length] == '=' && strncmp (&s[0], arg, length) == 0)
+ {
+ *ip = string_to_int (s.substr (length + 1));
+ return true;
+ }
+ return false;
+}
+
+static bool
+parse_float_option (const String &s, const char *arg, double *fp)
+{
+ const size_t length = strlen (arg);
+ if (s.size() > length && s[length] == '=' && strncmp (&s[0], arg, length) == 0)
+ {
+ *fp = string_to_float (s.substr (length + 1));
+ return true;
+ }
+ return false;
+}
+
static void
-bse_async_parse_args (gint *argc_p,
- gchar ***argv_p,
- BseMainArgs *margs,
- SfiInitValue values[])
+bse_async_parse_args (int *argc_p, char **argv_p, BseMainArgs *margs, const Bse::StringVector &args)
{
- guint argc = *argc_p;
- gchar **argv = *argv_p;
+ uint argc = *argc_p;
+ char **argv = argv_p;
/* this function is called before the main BSE thread is started,
* so we can't use any BSE functions yet.
*/
@@ -502,35 +524,33 @@ bse_async_parse_args (gint *argc_p,
argv[i] = NULL;
}
*argc_p = e;
- if (values)
+ for (auto arg : args)
{
- SfiInitValue *value = values;
- while (value->value_name)
- {
- if (strcmp (value->value_name, "debug-extensions") == 0)
- margs->debug_extensions |= sfi_init_value_bool (value);
- else if (strcmp (value->value_name, "force-fpu") == 0)
- margs->force_fpu |= sfi_init_value_bool (value);
- else if (strcmp (value->value_name, "allow-randomization") == 0)
- margs->allow_randomization |= sfi_init_value_bool (value);
- else if (strcmp (value->value_name, "load-core-plugins") == 0)
- margs->load_core_plugins |= sfi_init_value_bool (value);
- else if (strcmp (value->value_name, "load-core-scripts") == 0)
- margs->load_core_scripts |= sfi_init_value_bool (value);
- else if (strcmp ("wave-chunk-padding", value->value_name) == 0)
- margs->wave_chunk_padding = sfi_init_value_int (value);
- else if (strcmp ("wave-chunk-big-pad", value->value_name) == 0)
- margs->wave_chunk_big_pad = sfi_init_value_int (value);
- else if (strcmp ("dcache-cache-memory", value->value_name) == 0)
- margs->dcache_cache_memory = sfi_init_value_int (value);
- else if (strcmp ("dcache-block-size", value->value_name) == 0)
- margs->dcache_block_size = sfi_init_value_int (value);
- else if (strcmp ("midi-kammer-note", value->value_name) == 0)
- margs->midi_kammer_note = sfi_init_value_int (value);
- else if (strcmp ("kammer-freq", value->value_name) == 0)
- margs->kammer_freq = sfi_init_value_double (value);
- value++;
- }
+ bool b; double d; int64 i;
+ if (parse_bool_option (arg, "stand-alone", &b))
+ margs->stand_alone |= b;
+ else if (parse_bool_option (arg, "allow-randomization", &b))
+ margs->allow_randomization |= b;
+ else if (parse_bool_option (arg, "force-fpu", &b))
+ margs->force_fpu |= b;
+ else if (parse_bool_option (arg, "load-core-plugins", &b))
+ margs->load_core_plugins |= b;
+ else if (parse_bool_option (arg, "load-core-scripts", &b))
+ margs->load_core_scripts |= b;
+ else if (parse_bool_option (arg, "debug-extensions", &b))
+ margs->debug_extensions |= b;
+ else if (parse_int_option (arg, "wave-chunk-padding", &i))
+ margs->wave_chunk_padding = i;
+ else if (parse_int_option (arg, "wave-chunk-big-pad", &i))
+ margs->wave_chunk_big_pad = i;
+ else if (parse_int_option (arg, "dcache-cache-memory", &i))
+ margs->dcache_cache_memory = i;
+ else if (parse_int_option (arg, "dcache-block-size", &i))
+ margs->dcache_block_size = i;
+ else if (parse_int_option (arg, "midi-kammer-note", &i))
+ margs->midi_kammer_note = i;
+ else if (parse_float_option (arg, "kammer-freq", &d))
+ margs->kammer_freq = d;
}
/* constrain (user) config */
margs->wave_chunk_padding = MAX (1, margs->wave_chunk_padding);
diff --git a/bse/bsemain.hh b/bse/bsemain.hh
index ebe2be3..8d3c720 100644
--- a/bse/bsemain.hh
+++ b/bse/bsemain.hh
@@ -7,21 +7,16 @@ G_BEGIN_DECLS
// == BSE Initialization ==
void bse_init_textdomain_only (void);
-void _bse_init_async (int *argc, char ***argv, const char *app_name, SfiInitValue
values[]);
+void _bse_init_async (int *argc, char **argv, const char *app_name, const
Bse::StringVector &args);
SfiGlueContext* _bse_glue_context_create (const char *client, const std::function<void()> &caller_wakeup);
const char* bse_check_version (guint required_major,
guint required_minor,
guint required_micro); // prototyped in bse.hh
/* initialization for internal utilities */
-void bse_init_inprocess (gint *argc,
- gchar ***argv,
- const char *app_name,
- SfiInitValue values[]);
-void bse_init_test (gint *argc,
- gchar ***argv,
- SfiInitValue values[]);
-void bse_main_wakeup ();
+void bse_init_inprocess (int *argc, char **argv, const char *app_name, const Bse::StringVector &args
= Bse::StringVector());
+void bse_init_test (int *argc, char **argv, const Bse::StringVector &args = Bse::StringVector());
+void bse_main_wakeup ();
/* --- global macros --- */
#define BSE_THREADS_ENTER() // bse_main_global_lock ()
@@ -29,29 +24,29 @@ void bse_main_wakeup ();
#define BSE_DBG_EXT (bse_main_args->debug_extensions != FALSE)
#define BSE_CONFIG(field) (bse_main_args->field)
/* --- argc/argv overide settings --- */
-typedef struct {
- BirnetInitSettings birnet;
- guint n_processors;
+struct BseMainArgs {
+ uint n_processors;
/* # values to pad around wave chunk blocks per channel */
- guint wave_chunk_padding;
- guint wave_chunk_big_pad;
+ uint wave_chunk_padding;
+ uint wave_chunk_big_pad;
/* data (file) cache block size (aligned to power of 2) */
- guint dcache_block_size;
+ uint dcache_block_size;
/* amount of bytes to spare for memory cache */
- guint dcache_cache_memory;
- guint midi_kammer_note;
+ uint dcache_cache_memory;
+ uint midi_kammer_note;
/* kammer frequency, normally 440Hz, historically 435Hz */
- gfloat kammer_freq;
- const gchar *path_binaries;
- const gchar *bse_rcfile;
- const gchar *override_plugin_globs;
- const gchar *override_script_path;
- const gchar *override_sample_path;
- bool allow_randomization; /* init-value "allow-randomization" - enables
non-deterministic behavior */
- bool force_fpu; /* init-value "force-fpu" */
- bool load_core_plugins; /* init-value "load-core-plugins" */
- bool load_core_scripts; /* init-value "load-core-scripts" */
- bool debug_extensions; /* init-value "debug-extensions" */
+ double kammer_freq;
+ const char *path_binaries;
+ const char *bse_rcfile;
+ const char *override_plugin_globs;
+ const char *override_script_path;
+ const char *override_sample_path;
+ bool stand_alone; ///< Initialization argument "stand-alone" - no rcfiles,
boot scripts, etc.
+ bool allow_randomization; ///< Initialization argument "allow-randomization" - enables
non-deterministic behavior
+ bool force_fpu; ///< Initialization argument "force-fpu" - avoid vectorized
optimizations
+ bool load_core_plugins; ///< Initialization argument "load-core-plugins" - enable
core plugin bootup
+ bool load_core_scripts; ///< Initialization argument "load-core-scripts" - enable
core script bootup
+ bool debug_extensions; ///< Initialization argument "debug-extensions" - enable
debugging extensions
bool load_drivers_early;
bool dump_driver_list;
int latency;
@@ -59,7 +54,7 @@ typedef struct {
int control_freq;
SfiRing *pcm_drivers;
SfiRing *midi_drivers;
-} BseMainArgs;
+};
/* --- internal --- */
void _bse_init_c_wrappers ();
diff --git a/bse/bseprocidl.cc b/bse/bseprocidl.cc
index 8af2826..ca41cc4 100644
--- a/bse/bseprocidl.cc
+++ b/bse/bseprocidl.cc
@@ -365,7 +365,7 @@ main (int argc, char **argv)
}
}
g_thread_init (NULL);
- bse_init_inprocess (&argc, &argv, "BseProcIDL", NULL);
+ bse_init_inprocess (&argc, argv, "BseProcIDL");
sfi_glue_context_push (bse_glue_context_intern ("BseProcIdl"));
std::string s = sfi_glue_base_iface ();
/* small hackery to collect all enum types that need to be printed */
diff --git a/bse/bsequery.cc b/bse/bsequery.cc
index 2f8d8af..c85f327 100644
--- a/bse/bsequery.cc
+++ b/bse/bsequery.cc
@@ -170,13 +170,8 @@ main (gint argc,
gchar *show_synth = NULL;
gchar *root_name = NULL;
const char *iindent = "";
- char pluginbool[2] = "0";
- char scriptbool[2] = "0";
- SfiInitValue config[] = {
- { "load-core-plugins", pluginbool },
- { "load-core-scripts", scriptbool },
- { NULL },
- };
+ const char *pluginbool = "load-core-plugins=0";
+ const char *scriptbool = "load-core-scripts=0";
f_out = stdout;
g_thread_init (NULL);
sfi_init (&argc, &argv, "BseQuery", NULL);
@@ -258,7 +253,7 @@ main (gint argc,
gen_procdoc = 1;
}
else if (strcmp ("-p", argv[i]) == 0)
- pluginbool[1] = '1';
+ pluginbool = "load-core-plugins=1";
else if (strcmp ("-:f", argv[i]) == 0)
{
g_log_set_always_fatal (GLogLevelFlags (G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL |
@@ -275,7 +270,7 @@ main (gint argc,
else
return help (argv[i]);
}
- bse_init_inprocess (&argc, &argv, "BseQuery", config);
+ bse_init_inprocess (&argc, argv, "BseQuery", Bse::cstrings_to_vector (pluginbool, scriptbool, NULL));
if (root_name)
root = g_type_from_name (root_name);
else
diff --git a/bse/bseserver.cc b/bse/bseserver.cc
index ff1207e..aed2b74 100644
--- a/bse/bseserver.cc
+++ b/bse/bseserver.cc
@@ -172,7 +172,7 @@ bse_server_init (BseServer *self)
main_thread_source_setup (self);
/* read rc file */
int fd = -1;
- if (!bse_main_args->birnet.stand_alone &&
+ if (!bse_main_args->stand_alone &&
bse_main_args->bse_rcfile &&
bse_main_args->bse_rcfile[0])
fd = open (bse_main_args->bse_rcfile, O_RDONLY, 0);
diff --git a/bse/tests/blocktests.cc b/bse/tests/blocktests.cc
index 2cfb7a9..2db4d15 100644
--- a/bse/tests/blocktests.cc
+++ b/bse/tests/blocktests.cc
@@ -507,11 +507,7 @@ main (int argc,
TDONE();
run_tests(); /* run tests on FPU */
/* load plugins */
- SfiInitValue config[] = {
- { "load-core-plugins", "1" },
- { NULL },
- };
- bse_init_test (&argc, &argv, config);
+ bse_init_test (&argc, argv, Bse::cstrings_to_vector ("load-core-plugins=1", NULL));
/* check for possible specialization */
if (Bse::Block::default_singleton() == Bse::Block::current_singleton())
return 0; /* nothing changed */
diff --git a/bse/tests/filtertest.cc b/bse/tests/filtertest.cc
index 0a5957b..7ce8267 100644
--- a/bse/tests/filtertest.cc
+++ b/bse/tests/filtertest.cc
@@ -764,7 +764,7 @@ int
main (int argc,
char **argv)
{
- bse_init_test (&argc, &argv, NULL);
+ bse_init_test (&argc, argv);
butterwoth_tests ();
chebychev1_tests ();
test_problem_candidates ();
diff --git a/bse/tests/firhandle.cc b/bse/tests/firhandle.cc
index f5013f8..3f5f4cc 100644
--- a/bse/tests/firhandle.cc
+++ b/bse/tests/firhandle.cc
@@ -354,7 +354,7 @@ int
main (int argc,
char **argv)
{
- bse_init_test (&argc, &argv, NULL);
+ bse_init_test (&argc, argv);
test_with_sine_sweep (FIR_HIGHPASS);
test_multi_channel (FIR_HIGHPASS);
test_seek (FIR_HIGHPASS);
diff --git a/bse/tests/loophandle.cc b/bse/tests/loophandle.cc
index e1cac9c..333cc0b 100644
--- a/bse/tests/loophandle.cc
+++ b/bse/tests/loophandle.cc
@@ -168,7 +168,7 @@ main (int argc, char **argv)
for (i = 0; i < n_channels * n_values; i++)
values[i] = 1.0 - rand() / (0.5 * RAND_MAX);
/* init bse */
- bse_init_test (&argc, &argv, NULL);
+ bse_init_test (&argc, argv);
/* test loophandle against the reference implementation */
GslDataHandle *mem_handle = gsl_data_handle_new_mem (n_channels, 32, 44100, 440, n_values, values, NULL /*
don't free */);
check_loop (mem_handle, 0, n_values - 1);
diff --git a/bse/tests/misctests.cc b/bse/tests/misctests.cc
index 942d956..ec9e3e2 100644
--- a/bse/tests/misctests.cc
+++ b/bse/tests/misctests.cc
@@ -103,7 +103,7 @@ int
main (gint argc,
gchar *argv[])
{
- bse_init_test (&argc, &argv, NULL);
+ bse_init_test (&argc, argv);
check_cent_tune();
check_cent_tune_fast();
check_equal_tempered_tuning();
diff --git a/bse/tests/resamplehandle.cc b/bse/tests/resamplehandle.cc
index beb5a7e..6b753ce 100644
--- a/bse/tests/resamplehandle.cc
+++ b/bse/tests/resamplehandle.cc
@@ -436,11 +436,7 @@ main (int argc,
test_state_length ("FPU");
run_tests ("FPU");
/* load plugins */
- SfiInitValue config[] = {
- { "load-core-plugins", "1" },
- { NULL },
- };
- bse_init_test (&argc, &argv, config);
+ bse_init_test (&argc, argv, Bse::cstrings_to_vector ("load-core-plugins=1", NULL));
/* check for possible specialization */
if (Bse::Block::default_singleton() == Bse::Block::current_singleton())
return 0; /* nothing changed */
diff --git a/bse/tests/subnormals.cc b/bse/tests/subnormals.cc
index 2a8bb36..f106cf0 100644
--- a/bse/tests/subnormals.cc
+++ b/bse/tests/subnormals.cc
@@ -193,7 +193,7 @@ int
main (int argc,
char *argv[])
{
- bse_init_test (&argc, &argv, NULL);
+ bse_init_test (&argc, argv);
g_printerr ("Checking if your processor is in 'denormals are zero' (DAZ) mode... ");
bool daz_mode = check_denormals_are_zero();
g_printerr (daz_mode ? "yes - skipping subnormal elimination tests.\n" : "no.\n");
diff --git a/bse/tests/testcxx.cc b/bse/tests/testcxx.cc
index 1e1524e..a42f11b 100644
--- a/bse/tests/testcxx.cc
+++ b/bse/tests/testcxx.cc
@@ -22,7 +22,7 @@ main (int argc,
char *argv[])
{
g_thread_init (NULL);
- bse_init_test (&argc, &argv, NULL);
+ bse_init_test (&argc, argv);
std::set_terminate (__gnu_cxx::__verbose_terminate_handler);
// g_log_set_always_fatal ((GLogLevelFlags) (G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL | (int)
g_log_set_always_fatal ((GLogLevelFlags) G_LOG_FATAL_MASK)));
/* work around known C++ binding bugs (critical warnings from GClosure) */
diff --git a/bse/tests/testfft.cc b/bse/tests/testfft.cc
index ab2ec11..2aa77bd 100644
--- a/bse/tests/testfft.cc
+++ b/bse/tests/testfft.cc
@@ -44,7 +44,7 @@ main (int argc,
struct timeval tv;
guint i;
/* initialize */
- bse_init_test (&argc, &argv, NULL);
+ bse_init_test (&argc, argv);
/* initialize random numbers */
gettimeofday (&tv, NULL);
srand (tv.tv_sec ^ tv.tv_usec);
diff --git a/shell/bsescm.cc b/shell/bsescm.cc
index 722941c..d7c4900 100644
--- a/shell/bsescm.cc
+++ b/shell/bsescm.cc
@@ -16,8 +16,7 @@
/* --- prototypes --- */
static void gh_main (gint argc,
gchar *argv[]);
-static void shell_parse_args (gint *argc_p,
- gchar ***argv_p);
+static void shell_parse_args (int *argc_p, char **argv);
static void shell_print_usage (void);
/* --- variables --- */
static gint bse_scm_pipe[2] = { -1, -1 };
@@ -57,7 +56,7 @@ main (int argc,
g_message ("going into sleep mode due to debugging request (pid=%u)", getpid ());
g_usleep (2147483647);
}
- shell_parse_args (&argc, &argv);
+ shell_parse_args (&argc, argv);
if (env_str && (atoi (env_str) >= 2 ||
(atoi (env_str) >= 1 && !bse_scm_enable_register)))
{
@@ -78,7 +77,7 @@ main (int argc,
if (!bse_scm_context)
{
// start our own core thread
- Bse::init_async (&argc, &argv, "BSESCM", NULL);
+ Bse::init_async (&argc, argv, "BSESCM");
// allow g_main_context_wakeup to interrupt sleeps in bse_scm_context_iteration
bse_scm_context = Bse::init_glue_context (PRG_NAME, []() { g_main_context_wakeup
(g_main_context_default()); });
}
@@ -150,13 +149,11 @@ gh_main (int argc,
sfi_glue_context_destroy (bse_scm_context);
}
static void
-shell_parse_args (gint *argc_p,
- gchar ***argv_p)
+shell_parse_args (int *argc_p, char **argv)
{
- guint argc = *argc_p;
- gchar **argv = *argv_p;
- guint i, e;
- gboolean initialize_bse_and_exit = FALSE;
+ uint argc = *argc_p;
+ uint i, e;
+ bool initialize_bse_and_exit = false;
for (i = 1; i < argc; i++)
{
if (strcmp (argv[i], "--") == 0 ||
@@ -288,7 +285,7 @@ shell_parse_args (gint *argc_p,
*argc_p = e;
if (initialize_bse_and_exit)
{
- Bse::init_async (argc_p, argv_p, "BSESCM", NULL);
+ Bse::init_async (argc_p, argv, "BSESCM");
exit (0);
}
}
diff --git a/tests/bse/cxxbinding.cc b/tests/bse/cxxbinding.cc
index 42f2125..51fe8da 100644
--- a/tests/bse/cxxbinding.cc
+++ b/tests/bse/cxxbinding.cc
@@ -20,7 +20,7 @@ main (int argc,
char *argv[])
{
std::set_terminate (__gnu_cxx::__verbose_terminate_handler);
- Bse::init_async (&argc, &argv, "CxxBindingTest", NULL);
+ Bse::init_async (&argc, argv, "CxxBindingTest");
bse_context = Bse::init_glue_context (argv[0], []() { g_main_context_wakeup (g_main_context_default()); });
sfi_glue_context_push (bse_context);
g_print ("type_blurb(BseContainer)=%s\n", type_blurb("BseContainer").c_str());
diff --git a/tests/bse/filtertest.cc b/tests/bse/filtertest.cc
index 5f6a99c..06f707c 100644
--- a/tests/bse/filtertest.cc
+++ b/tests/bse/filtertest.cc
@@ -466,7 +466,7 @@ int
main (int argc,
char **argv)
{
- bse_init_test (&argc, &argv, NULL);
+ bse_init_test (&argc, argv);
options.parse (&argc, &argv);
if (argc > 1)
{
diff --git a/tests/perftest.cc b/tests/perftest.cc
index 19d4313..c24c27e 100644
--- a/tests/perftest.cc
+++ b/tests/perftest.cc
@@ -18,7 +18,7 @@ gettime ()
int main (int argc, char **argv)
{
std::set_terminate (__gnu_cxx::__verbose_terminate_handler);
- Bse::init_async (&argc, &argv, "Perftest", NULL);
+ Bse::init_async (&argc, argv, "Perftest");
bse_context = Bse::init_glue_context (argv[0], []() { g_main_context_wakeup (g_main_context_default()); });
sfi_glue_context_push (bse_context);
printf ("%s: testing remote glue layer calls via C++ interface:\n", argv[0]);
diff --git a/tests/testresampler.cc b/tests/testresampler.cc
index 58b2f37..facbf3e 100644
--- a/tests/testresampler.cc
+++ b/tests/testresampler.cc
@@ -594,11 +594,7 @@ main (int argc, char **argv)
if (strcmp (argv[i], "--fpu") == 0)
argv[i] = g_strdup ("--bse-force-fpu"); /* leak, but we don't care */
/* load plugins */
- SfiInitValue config[] = {
- { "load-core-plugins", "1" },
- { NULL },
- };
- bse_init_test (&argc, &argv, config);
+ bse_init_test (&argc, argv, Bse::cstrings_to_vector ("load-core-plugins=1", NULL));
options.parse (&argc, &argv);
if (argc == 2)
{
diff --git a/tests/testresamplerq.cc b/tests/testresamplerq.cc
index f6326dd..c9a4d65 100644
--- a/tests/testresamplerq.cc
+++ b/tests/testresamplerq.cc
@@ -209,11 +209,7 @@ main (int argc, char **argv)
options.test_size, options.rand_samples);
run_tests ("FPU");
/* load plugins */
- SfiInitValue config[] = {
- { "load-core-plugins", "1" },
- { NULL },
- };
- bse_init_test (&argc, &argv, config);
+ bse_init_test (&argc, argv, Bse::cstrings_to_vector ("load-core-plugins=1", NULL));
/* check for possible specialization */
if (Bse::Block::default_singleton() == Bse::Block::current_singleton())
return 0; /* nothing changed */
diff --git a/tests/testwavechunk.cc b/tests/testwavechunk.cc
index 7d101b4..757f7eb 100644
--- a/tests/testwavechunk.cc
+++ b/tests/testwavechunk.cc
@@ -360,14 +360,8 @@ main (gint argc,
gchar *argv[])
{
/* init */
- SfiInitValue ivalues[] = {
- { "stand-alone", "true" }, /* no rcfiles etc. */
- { "wave-chunk-padding", NULL, 1, },
- { "wave_chunk_big_pad", NULL, 2, },
- { "dcache_block_size", NULL, 16, },
- { NULL }
- };
- bse_init_test (&argc, &argv, ivalues);
+ bse_init_test (&argc, argv, Bse::cstrings_to_vector ("stand-alone=1", "wave-chunk-padding=1", NULL));
+ // "wave-chunk-big-pad=2", "dcache-block-size=16"
reversed_datahandle_test();
simple_loop_tests();
multi_channel_tests();
diff --git a/tools/bsefextract.cc b/tools/bsefextract.cc
index ad5d4e1..34940fa 100644
--- a/tools/bsefextract.cc
+++ b/tools/bsefextract.cc
@@ -1275,14 +1275,9 @@ main (int argc,
char **argv)
{
/* init */
- SfiInitValue values[] = {
- { "stand-alone", "true" }, /* no rcfiles etc. */
- { "wave-chunk-padding", NULL, 1, },
- { "dcache-block-size", NULL, 8192, },
- { "dcache-cache-memory", NULL, 5 * 1024 * 1024, },
- { NULL }
- };
- bse_init_inprocess (&argc, &argv, NULL, values);
+ bse_init_inprocess (&argc, argv, NULL,
+ Bse::cstrings_to_vector ("stand-alone=1", "wave-chunk-padding=1",
+ "dcache-block-size=8192", "dcache-cache-memory=5242880",
NULL));
/* supported features */
SpectrumFeature *spectrum_feature = new SpectrumFeature;
ComplexSignalFeature *complex_signal_feature = new ComplexSignalFeature;
diff --git a/tools/bsewavetool.cc b/tools/bsewavetool.cc
index 1534020..527eaeb 100644
--- a/tools/bsewavetool.cc
+++ b/tools/bsewavetool.cc
@@ -58,14 +58,9 @@ main (int argc,
std::set_terminate (__gnu_cxx::__verbose_terminate_handler);
/* initialization */
int orig_argc = argc;
- SfiInitValue values[] = {
- { "stand-alone", "true" }, /* no rcfiles etc. */
- { "wave-chunk-padding", NULL, 1, },
- { "dcache-block-size", NULL, 8192, },
- { "dcache-cache-memory", NULL, 5 * 1024 * 1024, },
- { NULL }
- };
- bse_init_inprocess (&argc, &argv, "BseWaveTool", values);
+ bse_init_inprocess (&argc, argv, "BseWaveTool",
+ Bse::cstrings_to_vector ("stand-alone=1", "wave-chunk-padding=1",
+ "dcache-block-size=8192", "dcache-cache-memory=5242880",
NULL));
/* pre-parse argument list to decide command */
wavetool_parse_args (&argc, &argv);
/* check args */
diff --git a/tools/cutvorbis.cc b/tools/cutvorbis.cc
index 85d8eaa..443685c 100644
--- a/tools/cutvorbis.cc
+++ b/tools/cutvorbis.cc
@@ -68,14 +68,9 @@ main (int argc,
GslVorbisCutter *cutter;
gint ifd, ofd;
/* initialization */
- SfiInitValue values[] = {
- { "stand-alone", "true" }, /* no rcfiles etc. */
- { "wave-chunk-padding", NULL, 1, },
- { "dcache-block-size", NULL, 8192, },
- { "dcache-cache-memory", NULL, 5 * 1024 * 1024, },
- { NULL }
- };
- bse_init_inprocess (&argc, &argv, "BseCutVorbis", values);
+ bse_init_inprocess (&argc, argv, "BseCutVorbis",
+ Bse::cstrings_to_vector ("stand-alone=1", "wave-chunk-padding=1",
+ "dcache-block-size=8192", "dcache-cache-memory=5242880",
NULL));
/* arguments */
parse_args (&argc, &argv);
if (argc != 3)
diff --git a/tools/magictest.cc b/tools/magictest.cc
index 593a5d2..e94928f 100644
--- a/tools/magictest.cc
+++ b/tools/magictest.cc
@@ -41,11 +41,7 @@ main (gint argc,
SfiRing *magic_list = NULL;
gboolean test_open = FALSE;
/* initialization */
- SfiInitValue values[] = {
- { "stand-alone", "true" }, /* no rcfiles etc. */
- { NULL }
- };
- bse_init_inprocess (&argc, &argv, "BseMagicTest", values);
+ bse_init_inprocess (&argc, argv, "BseMagicTest", Bse::cstrings_to_vector ("stand-alone=1", NULL));
for (i = 0; i < n_magic_presets; i++)
magic_list = sfi_ring_append (magic_list,
gsl_magic_create ((void*) magic_presets[i][0],
diff --git a/tools/mathtool.cc b/tools/mathtool.cc
index 879e5f3..11c667c 100644
--- a/tools/mathtool.cc
+++ b/tools/mathtool.cc
@@ -47,14 +47,9 @@ main (int argc,
shift_argc = argc;
shift_argv = (const gchar**) argv;
/* init */
- SfiInitValue values[] = {
- { "stand-alone", "true" }, /* no rcfiles etc. */
- { "wave-chunk-padding", NULL, 1, },
- { "dcache-block-size", NULL, 8192, },
- { "dcache-cache-memory", NULL, 5 * 1024 * 1024, },
- { NULL }
- };
- bse_init_inprocess (&argc, &argv, NULL, values);
+ bse_init_inprocess (&argc, argv, NULL,
+ Bse::cstrings_to_vector ("stand-alone=1", "wave-chunk-padding=1",
+ "dcache-block-size=8192", "dcache-cache-memory=5242880",
NULL));
arg = shift ();
if (!arg)
usage ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]