[beast: 5/9] BSE: move "bsequery cats" to "bsetool dump-categories"
- From: Tim Janik <timj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [beast: 5/9] BSE: move "bsequery cats" to "bsetool dump-categories"
- Date: Wed, 23 Sep 2015 09:06:53 +0000 (UTC)
commit fb54665f942a09dd46a1effe28aa1738d2b68325
Author: Tim Janik <timj gnu org>
Date: Thu Sep 17 20:01:45 2015 +0200
BSE: move "bsequery cats" to "bsetool dump-categories"
bse/bsequery.cc | 24 +-----------------------
bse/bsetool.cc | 27 ++++++++++++++++++++++++---
2 files changed, 25 insertions(+), 26 deletions(-)
---
diff --git a/bse/bsequery.cc b/bse/bsequery.cc
index 2f8aa35..fd78f21 100644
--- a/bse/bsequery.cc
+++ b/bse/bsequery.cc
@@ -106,20 +106,6 @@ show_nodes (GType type,
}
static void
-show_cats (void)
-{
- BseCategorySeq *cseq;
- guint i;
-
- cseq = bse_categories_match_typed ("*", 0);
- for (i = 0; i < cseq->n_cats; i++)
- fprintf (f_out, "%s\t(%s)\n",
- cseq->cats[i]->category,
- cseq->cats[i]->type);
- bse_category_seq_free (cseq);
-}
-
-static void
show_procdoc (void)
{
BseCategorySeq *cseq;
@@ -178,7 +164,6 @@ help (gchar *arg)
fprintf (stderr, "qualifiers:\n");
fprintf (stderr, " froots iterate over fundamental roots\n");
fprintf (stderr, " tree print BSE type tree\n");
- fprintf (stderr, " cats print categories\n");
fprintf (stderr, " procdoc print procedure documentation\n");
fprintf (stderr, " synth <x> dump standard synth <x> definition\n");
@@ -191,7 +176,6 @@ main (gint argc,
{
gboolean gen_froots = 0;
gboolean gen_tree = 0;
- gboolean gen_cats = 0;
gboolean gen_procdoc = 0;
gchar *show_synth = NULL;
gchar *root_name = NULL;
@@ -268,10 +252,6 @@ main (gint argc,
{
gen_tree = 1;
}
- else if (strcmp ("cats", argv[i]) == 0)
- {
- gen_cats = 1;
- }
else if (strcmp ("procdoc", argv[i]) == 0)
{
gen_procdoc = 1;
@@ -299,7 +279,7 @@ main (gint argc,
root = g_type_from_name (root_name);
else
root = BSE_TYPE_OBJECT;
- if (!gen_froots && !gen_tree && !gen_cats && !gen_procdoc && !show_synth)
+ if (!gen_froots && !gen_tree && !gen_procdoc && !show_synth)
return help (argv[i-1]);
if (!indent_inc)
{
@@ -322,8 +302,6 @@ main (gint argc,
show_nodes (i, 0, iindent);
}
}
- if (gen_cats)
- show_cats ();
if (gen_procdoc)
show_procdoc ();
if (show_synth)
diff --git a/bse/bsetool.cc b/bse/bsetool.cc
index 3e8837e..c5512a4 100644
--- a/bse/bsetool.cc
+++ b/bse/bsetool.cc
@@ -2,6 +2,7 @@
#include <bse/bsemain.hh>
#include <bse/bseserver.hh>
#include <bse/bsemathsignal.hh>
+#include <bse/bsecategories.hh>
#include <sys/resource.h>
#include <unordered_map>
#include <unistd.h>
@@ -124,12 +125,13 @@ static CommandRegistry *command_registry_chain = NULL;
class CommandRegistry {
ArgParser arg_parser_;
String (*cmd_) (const ArgParser&);
- String name_;
+ String name_, blurb_;
CommandRegistry *next_;
public:
template<size_t N>
- explicit CommandRegistry (ArgDescription (&adescs) [N], String (*cmd) (const ArgParser&), const String
&name) :
- arg_parser_ (adescs), cmd_ (cmd), name_ (name), next_ (command_registry_chain)
+ explicit CommandRegistry (ArgDescription (&adescs) [N], String (*cmd) (const ArgParser&),
+ const String &name, const String &blurb = "") :
+ arg_parser_ (adescs), cmd_ (cmd), name_ (name), blurb_ (blurb), next_ (command_registry_chain)
{
command_registry_chain = this;
}
@@ -244,6 +246,25 @@ dump_info (const ArgParser &ap)
static CommandRegistry dump_info_cmd (dump_info_options, dump_info, "dump-info");
+// == dump-categories ==
+static ArgDescription dump_categories_options[] = {
+ { "", "", "", "" }, // dummy, no options currently
+};
+
+static String
+dump_categories (const ArgParser &ap)
+{
+ BseCategorySeq *cseq = bse_categories_match_typed ("*", 0);
+ for (uint i = 0; i < cseq->n_cats; i++)
+ printout ("%s\t(%s)\n", cseq->cats[i]->category, cseq->cats[i]->type);
+ bse_category_seq_free (cseq);
+ return "";
+}
+
+static CommandRegistry dump_categories_cmd (dump_categories_options, dump_categories, "dump-categories",
+ "print categories");
+
+
// == render2wav ==
static ArgDescription render2wav_options[] = {
{ "-s, --seconds", "<seconds>", "Number of seconds to record", "0" },
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]