summaryrefslogtreecommitdiffstats
path: root/src/progs
diff options
context:
space:
mode:
Diffstat (limited to 'src/progs')
-rw-r--r--src/progs/ingen/cmdline.c83
-rw-r--r--src/progs/ingen/cmdline.ggo2
-rw-r--r--src/progs/ingen/cmdline.h169
3 files changed, 196 insertions, 58 deletions
diff --git a/src/progs/ingen/cmdline.c b/src/progs/ingen/cmdline.c
index a293d127..f4ea58d4 100644
--- a/src/progs/ingen/cmdline.c
+++ b/src/progs/ingen/cmdline.c
@@ -1,7 +1,7 @@
/*
- File autogenerated by gengetopt
+ File autogenerated by gengetopt version 2.21
generated with the following command:
- gengetopt -g
+ gengetopt
The developers of gengetopt consider the fixed text that goes in all
gengetopt output files to be in the public domain:
@@ -33,7 +33,7 @@ const char *gengetopt_args_info_help[] = {
" -e, --engine Run (JACK) engine (default=off)",
" -E, --engine-port=INT Engine OSC port (default=`16180')",
" -c, --connect=STRING Connect to existing engine at OSC URI \n (default=`osc.udp://localhost:16180')",
- " -g, --gui Launch the GTK graphical interface (default=on)",
+ " -g, --gui Launch the GTK graphical interface (default=off)",
" -C, --client-port=INT Client OSC port",
" -l, --load=STRING Load patch",
" -L, --path=STRING Target path for loaded patch",
@@ -48,7 +48,8 @@ static
void clear_args (struct gengetopt_args_info *args_info);
static int
-cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required, const char *additional_error);
+cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info,
+ struct cmdline_parser_params *params, const char *additional_error);
static char *
@@ -78,7 +79,7 @@ void clear_args (struct gengetopt_args_info *args_info)
args_info->engine_port_orig = NULL;
args_info->connect_arg = gengetopt_strdup ("osc.udp://localhost:16180");
args_info->connect_orig = NULL;
- args_info->gui_flag = 1;
+ args_info->gui_flag = 0;
args_info->client_port_orig = NULL;
args_info->load_arg = NULL;
args_info->load_orig = NULL;
@@ -140,6 +141,23 @@ cmdline_parser_init (struct gengetopt_args_info *args_info)
init_args_info (args_info);
}
+struct cmdline_parser_params *
+cmdline_parser_params_init()
+{
+ struct cmdline_parser_params *params =
+ (struct cmdline_parser_params *)malloc(sizeof(struct cmdline_parser_params));
+
+ if (params)
+ {
+ params->override = 0;
+ params->initialize = 0;
+ params->check_required = 0;
+ params->check_ambiguity = 0;
+ }
+
+ return params;
+}
+
static void
cmdline_parser_release (struct gengetopt_args_info *args_info)
{
@@ -315,11 +333,33 @@ cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_i
}
int
+cmdline_parser_ext (int argc, char * const *argv, struct gengetopt_args_info *args_info,
+ struct cmdline_parser_params *params)
+{
+ int result;
+ result = cmdline_parser_internal (argc, argv, args_info, params, NULL);
+
+ if (result == EXIT_FAILURE)
+ {
+ cmdline_parser_free (args_info);
+ exit (EXIT_FAILURE);
+ }
+
+ return result;
+}
+
+int
cmdline_parser2 (int argc, char * const *argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required)
{
int result;
+ struct cmdline_parser_params params;
+
+ params.override = override;
+ params.initialize = initialize;
+ params.check_required = check_required;
+ params.check_ambiguity = 0;
- result = cmdline_parser_internal (argc, argv, args_info, override, initialize, check_required, NULL);
+ result = cmdline_parser_internal (argc, argv, args_info, &params, NULL);
if (result == EXIT_FAILURE)
{
@@ -337,12 +377,23 @@ cmdline_parser_required (struct gengetopt_args_info *args_info, const char *prog
}
int
-cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required, const char *additional_error)
+cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info,
+ struct cmdline_parser_params *params, const char *additional_error)
{
int c; /* Character of the parsed option. */
int error = 0;
struct gengetopt_args_info local_args_info;
+
+ int override;
+ int initialize;
+ int check_required;
+ int check_ambiguity;
+
+ override = params->override;
+ initialize = params->initialize;
+ check_required = params->check_required;
+ check_ambiguity = params->check_ambiguity;
if (initialize)
cmdline_parser_init (args_info);
@@ -392,7 +443,7 @@ cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_inf
exit (EXIT_SUCCESS);
case 'e': /* Run (JACK) engine. */
- if (local_args_info.engine_given)
+ if (local_args_info.engine_given || (check_ambiguity && args_info->engine_given))
{
fprintf (stderr, "%s: `--engine' (`-e') option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
goto failure;
@@ -405,7 +456,7 @@ cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_inf
break;
case 'E': /* Engine OSC port. */
- if (local_args_info.engine_port_given)
+ if (local_args_info.engine_port_given || (check_ambiguity && args_info->engine_port_given))
{
fprintf (stderr, "%s: `--engine-port' (`-E') option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
goto failure;
@@ -425,7 +476,7 @@ cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_inf
break;
case 'c': /* Connect to existing engine at OSC URI. */
- if (local_args_info.connect_given)
+ if (local_args_info.connect_given || (check_ambiguity && args_info->connect_given))
{
fprintf (stderr, "%s: `--connect' (`-c') option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
goto failure;
@@ -443,7 +494,7 @@ cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_inf
break;
case 'g': /* Launch the GTK graphical interface. */
- if (local_args_info.gui_given)
+ if (local_args_info.gui_given || (check_ambiguity && args_info->gui_given))
{
fprintf (stderr, "%s: `--gui' (`-g') option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
goto failure;
@@ -456,7 +507,7 @@ cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_inf
break;
case 'C': /* Client OSC port. */
- if (local_args_info.client_port_given)
+ if (local_args_info.client_port_given || (check_ambiguity && args_info->client_port_given))
{
fprintf (stderr, "%s: `--client-port' (`-C') option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
goto failure;
@@ -476,7 +527,7 @@ cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_inf
break;
case 'l': /* Load patch. */
- if (local_args_info.load_given)
+ if (local_args_info.load_given || (check_ambiguity && args_info->load_given))
{
fprintf (stderr, "%s: `--load' (`-l') option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
goto failure;
@@ -494,7 +545,7 @@ cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_inf
break;
case 'L': /* Target path for loaded patch. */
- if (local_args_info.path_given)
+ if (local_args_info.path_given || (check_ambiguity && args_info->path_given))
{
fprintf (stderr, "%s: `--path' (`-L') option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
goto failure;
@@ -512,7 +563,7 @@ cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_inf
break;
case 'r': /* Run script. */
- if (local_args_info.run_given)
+ if (local_args_info.run_given || (check_ambiguity && args_info->run_given))
{
fprintf (stderr, "%s: `--run' (`-r') option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
goto failure;
@@ -530,7 +581,7 @@ cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_inf
break;
case 'p': /* Number of concurrent process threads. */
- if (local_args_info.parallelism_given)
+ if (local_args_info.parallelism_given || (check_ambiguity && args_info->parallelism_given))
{
fprintf (stderr, "%s: `--parallelism' (`-p') option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
goto failure;
diff --git a/src/progs/ingen/cmdline.ggo b/src/progs/ingen/cmdline.ggo
index 480732e5..e809689e 100644
--- a/src/progs/ingen/cmdline.ggo
+++ b/src/progs/ingen/cmdline.ggo
@@ -12,7 +12,7 @@ and many GUIs (or other things) may connect to an engine via OSC.
option "engine" e "Run (JACK) engine" flag off
option "engine-port" E "Engine OSC port" int no default="16180"
option "connect" c "Connect to existing engine at OSC URI" string no default="osc.udp://localhost:16180"
-option "gui" g "Launch the GTK graphical interface" flag on
+option "gui" g "Launch the GTK graphical interface" flag off
option "client-port" C "Client OSC port" int no
option "load" l "Load patch" string no
option "path" L "Target path for loaded patch" string no
diff --git a/src/progs/ingen/cmdline.h b/src/progs/ingen/cmdline.h
index 1c0bf681..9caa9529 100644
--- a/src/progs/ingen/cmdline.h
+++ b/src/progs/ingen/cmdline.h
@@ -1,6 +1,9 @@
-/* cmdline.h */
-
-/* File autogenerated by gengetopt */
+/** @file cmdline.h
+ * @brief The header file for the command line option parser
+ * generated by GNU Gengetopt version 2.21
+ * http://www.gnu.org/software/gengetopt.
+ * DO NOT modify this file, since it can be overwritten
+ * @author GNU Gengetopt by Lorenzo Bettini */
#ifndef CMDLINE_H
#define CMDLINE_H
@@ -15,75 +18,159 @@ extern "C" {
#endif /* __cplusplus */
#ifndef CMDLINE_PARSER_PACKAGE
+/** @brief the program name */
#define CMDLINE_PARSER_PACKAGE "ingen"
#endif
#ifndef CMDLINE_PARSER_VERSION
+/** @brief the program version */
#define CMDLINE_PARSER_VERSION VERSION
#endif
+/** @brief Where the command line options are stored */
struct gengetopt_args_info
{
- const char *help_help; /* Print help and exit help description. */
- const char *version_help; /* Print version and exit help description. */
- int engine_flag; /* Run (JACK) engine (default=off). */
- const char *engine_help; /* Run (JACK) engine help description. */
- int engine_port_arg; /* Engine OSC port (default='16180'). */
- char * engine_port_orig; /* Engine OSC port original value given at command line. */
- const char *engine_port_help; /* Engine OSC port help description. */
- char * connect_arg; /* Connect to existing engine at OSC URI (default='osc.udp://localhost:16180'). */
- char * connect_orig; /* Connect to existing engine at OSC URI original value given at command line. */
- const char *connect_help; /* Connect to existing engine at OSC URI help description. */
- int gui_flag; /* Launch the GTK graphical interface (default=on). */
- const char *gui_help; /* Launch the GTK graphical interface help description. */
- int client_port_arg; /* Client OSC port. */
- char * client_port_orig; /* Client OSC port original value given at command line. */
- const char *client_port_help; /* Client OSC port help description. */
- char * load_arg; /* Load patch. */
- char * load_orig; /* Load patch original value given at command line. */
- const char *load_help; /* Load patch help description. */
- char * path_arg; /* Target path for loaded patch. */
- char * path_orig; /* Target path for loaded patch original value given at command line. */
- const char *path_help; /* Target path for loaded patch help description. */
- char * run_arg; /* Run script. */
- char * run_orig; /* Run script original value given at command line. */
- const char *run_help; /* Run script help description. */
- int parallelism_arg; /* Number of concurrent process threads (default='1'). */
- char * parallelism_orig; /* Number of concurrent process threads original value given at command line. */
- const char *parallelism_help; /* Number of concurrent process threads help description. */
+ const char *help_help; /**< @brief Print help and exit help description. */
+ const char *version_help; /**< @brief Print version and exit help description. */
+ int engine_flag; /**< @brief Run (JACK) engine (default=off). */
+ const char *engine_help; /**< @brief Run (JACK) engine help description. */
+ int engine_port_arg; /**< @brief Engine OSC port (default='16180'). */
+ char * engine_port_orig; /**< @brief Engine OSC port original value given at command line. */
+ const char *engine_port_help; /**< @brief Engine OSC port help description. */
+ char * connect_arg; /**< @brief Connect to existing engine at OSC URI (default='osc.udp://localhost:16180'). */
+ char * connect_orig; /**< @brief Connect to existing engine at OSC URI original value given at command line. */
+ const char *connect_help; /**< @brief Connect to existing engine at OSC URI help description. */
+ int gui_flag; /**< @brief Launch the GTK graphical interface (default=off). */
+ const char *gui_help; /**< @brief Launch the GTK graphical interface help description. */
+ int client_port_arg; /**< @brief Client OSC port. */
+ char * client_port_orig; /**< @brief Client OSC port original value given at command line. */
+ const char *client_port_help; /**< @brief Client OSC port help description. */
+ char * load_arg; /**< @brief Load patch. */
+ char * load_orig; /**< @brief Load patch original value given at command line. */
+ const char *load_help; /**< @brief Load patch help description. */
+ char * path_arg; /**< @brief Target path for loaded patch. */
+ char * path_orig; /**< @brief Target path for loaded patch original value given at command line. */
+ const char *path_help; /**< @brief Target path for loaded patch help description. */
+ char * run_arg; /**< @brief Run script. */
+ char * run_orig; /**< @brief Run script original value given at command line. */
+ const char *run_help; /**< @brief Run script help description. */
+ int parallelism_arg; /**< @brief Number of concurrent process threads (default='1'). */
+ char * parallelism_orig; /**< @brief Number of concurrent process threads original value given at command line. */
+ const char *parallelism_help; /**< @brief Number of concurrent process threads help description. */
- int help_given ; /* Whether help was given. */
- int version_given ; /* Whether version was given. */
- int engine_given ; /* Whether engine was given. */
- int engine_port_given ; /* Whether engine-port was given. */
- int connect_given ; /* Whether connect was given. */
- int gui_given ; /* Whether gui was given. */
- int client_port_given ; /* Whether client-port was given. */
- int load_given ; /* Whether load was given. */
- int path_given ; /* Whether path was given. */
- int run_given ; /* Whether run was given. */
- int parallelism_given ; /* Whether parallelism was given. */
+ int help_given ; /**< @brief Whether help was given. */
+ int version_given ; /**< @brief Whether version was given. */
+ int engine_given ; /**< @brief Whether engine was given. */
+ int engine_port_given ; /**< @brief Whether engine-port was given. */
+ int connect_given ; /**< @brief Whether connect was given. */
+ int gui_given ; /**< @brief Whether gui was given. */
+ int client_port_given ; /**< @brief Whether client-port was given. */
+ int load_given ; /**< @brief Whether load was given. */
+ int path_given ; /**< @brief Whether path was given. */
+ int run_given ; /**< @brief Whether run was given. */
+ int parallelism_given ; /**< @brief Whether parallelism was given. */
} ;
+/** @brief The additional parameters to pass to parser functions */
+struct cmdline_parser_params
+{
+ int override; /**< @brief whether to override possibly already present options (default 0) */
+ int initialize; /**< @brief whether to initialize the option structure gengetopt_args_info (default 0) */
+ int check_required; /**< @brief whether to check that all required options were provided (default 0) */
+ int check_ambiguity; /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */
+} ;
+
+/** @brief the purpose string of the program */
extern const char *gengetopt_args_info_purpose;
+/** @brief the usage string of the program */
extern const char *gengetopt_args_info_usage;
+/** @brief all the lines making the help output */
extern const char *gengetopt_args_info_help[];
+/**
+ * The command line parser
+ * @param argc the number of command line options
+ * @param argv the command line options
+ * @param args_info the structure where option information will be stored
+ * @return 0 if everything went fine, NON 0 if an error took place
+ */
int cmdline_parser (int argc, char * const *argv,
struct gengetopt_args_info *args_info);
+
+/**
+ * The command line parser (version with additional parameters - deprecated)
+ * @param argc the number of command line options
+ * @param argv the command line options
+ * @param args_info the structure where option information will be stored
+ * @param override whether to override possibly already present options
+ * @param initialize whether to initialize the option structure my_args_info
+ * @param check_required whether to check that all required options were provided
+ * @return 0 if everything went fine, NON 0 if an error took place
+ * @deprecated use cmdline_parser_ext() instead
+ */
int cmdline_parser2 (int argc, char * const *argv,
struct gengetopt_args_info *args_info,
int override, int initialize, int check_required);
+
+/**
+ * The command line parser (version with additional parameters)
+ * @param argc the number of command line options
+ * @param argv the command line options
+ * @param args_info the structure where option information will be stored
+ * @param params additional parameters for the parser
+ * @return 0 if everything went fine, NON 0 if an error took place
+ */
+int cmdline_parser_ext (int argc, char * const *argv,
+ struct gengetopt_args_info *args_info,
+ struct cmdline_parser_params *params);
+
+/**
+ * Save the contents of the option struct into a (text) file.
+ * This file can be read by the config file parser (if generated by gengetopt)
+ * @param filename the file where to save
+ * @param args_info the option struct to save
+ * @return 0 if everything went fine, NON 0 if an error took place
+ */
int cmdline_parser_file_save(const char *filename,
struct gengetopt_args_info *args_info);
+/**
+ * Print the help
+ */
void cmdline_parser_print_help(void);
+/**
+ * Print the version
+ */
void cmdline_parser_print_version(void);
+/**
+ * Allocates dynamically a cmdline_parser_params structure and initializes
+ * all its fields to 0
+ * @return the initialized cmdline_parser_params structure
+ */
+struct cmdline_parser_params *cmdline_parser_params_init();
+
+/**
+ * Initializes the passed gengetopt_args_info structure's fields
+ * (also set default values for options that have a default)
+ * @param args_info the structure to initialize
+ */
void cmdline_parser_init (struct gengetopt_args_info *args_info);
+/**
+ * Deallocates the string fields of the gengetopt_args_info structure
+ * (but does not deallocate the structure itself)
+ * @param args_info the structure to deallocate
+ */
void cmdline_parser_free (struct gengetopt_args_info *args_info);
+/**
+ * Checks that all the required options were specified
+ * @param args_info the structure to check
+ * @param prog_name the name of the program that will be used to print
+ * possible errors
+ * @return
+ */
int cmdline_parser_required (struct gengetopt_args_info *args_info,
const char *prog_name);