diff options
Diffstat (limited to 'src/ingen/cmdline.c')
-rw-r--r-- | src/ingen/cmdline.c | 202 |
1 files changed, 128 insertions, 74 deletions
diff --git a/src/ingen/cmdline.c b/src/ingen/cmdline.c index ea48135c..e8a6ab63 100644 --- a/src/ingen/cmdline.c +++ b/src/ingen/cmdline.c @@ -1,7 +1,7 @@ /* - File autogenerated by gengetopt + File autogenerated by gengetopt version 2.22.1 generated with the following command: - gengetopt -g + gengetopt -u The developers of gengetopt consider the fixed text that goes in all gengetopt output files to be in the public domain: @@ -23,22 +23,23 @@ const char *gengetopt_args_info_purpose = "A modular realtime audio processing system"; -const char *gengetopt_args_info_usage = "Usage: ingen [OPTIONS]..."; +const char *gengetopt_args_info_usage = "Usage: ingen [OPTIONS]... [FILES]..."; const char *gengetopt_args_info_description = "Ingen can be run in various configurations. The engine can\nrun as a stand-alone server controlled by OSC, or internal to\nanother process (e.g. the GUI). The GUI can communicate with the engine\nvia either method, and many GUIs (or other things) may connect to an\nengine via OSC.\n\nExamples:\n\n ingen -e - Run an engine, listen for OSC \n ingen -g - Run a GUI, connect via OSC \n ingen -eg - Run an engine and a GUI in one process\n\nThe -l (load) option can be used in all cases:\n \n ingen -el patch.ingen.ttl - Run an engine and load a patch\n ingen -gl patch.ingen.ttl - Run a GUI and load a patch\n ingen -egl patch.ingen.ttl - Run an engine and a GUI and load a patch\n\nOptions:\n"; const char *gengetopt_args_info_help[] = { - " -h, --help Print help and exit", - " -V, --version Print version and exit", - " -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=off)", - " -C, --client-port=INT Client OSC port", - " -l, --load=STRING Load patch", - " -L, --path=STRING Target path for loaded patch", - " -r, --run=STRING Run script", - " -p, --parallelism=INT Number of concurrent process threads (default=`1')", + " -h, --help Print help and exit", + " -V, --version Print version and exit", + " -C, --client-port=INT Client OSC port", + " -c, --connect=STRING Connect to existing engine at OSC URI \n (default=`osc.udp://localhost:16180')", + " -e, --engine Run (JACK) engine (default=off)", + " -E, --engine-port=INT Engine OSC port (default=`16180')", + " -g, --gui Launch the GTK graphical interface (default=off)", + " -n, --jack-name=STRING JACK client name (default=`ingen')", + " -l, --load=STRING Load patch", + " -p, --parallelism=INT Number of concurrent process threads (default=`1')", + " -L, --path=STRING Target path for loaded patch", + " -r, --run=STRING Run script", 0 }; @@ -66,35 +67,38 @@ void clear_given (struct gengetopt_args_info *args_info) { args_info->help_given = 0 ; args_info->version_given = 0 ; + args_info->client_port_given = 0 ; + args_info->connect_given = 0 ; args_info->engine_given = 0 ; args_info->engine_port_given = 0 ; - args_info->connect_given = 0 ; args_info->gui_given = 0 ; - args_info->client_port_given = 0 ; + args_info->jack_name_given = 0 ; args_info->load_given = 0 ; + args_info->parallelism_given = 0 ; args_info->path_given = 0 ; args_info->run_given = 0 ; - args_info->parallelism_given = 0 ; } static void clear_args (struct gengetopt_args_info *args_info) { + args_info->client_port_orig = NULL; + args_info->connect_arg = gengetopt_strdup ("osc.udp://localhost:16180"); + args_info->connect_orig = NULL; args_info->engine_flag = 0; args_info->engine_port_arg = 16180; 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 = 0; - args_info->client_port_orig = NULL; + args_info->jack_name_arg = gengetopt_strdup ("ingen"); + args_info->jack_name_orig = NULL; args_info->load_arg = NULL; args_info->load_orig = NULL; + args_info->parallelism_arg = 1; + args_info->parallelism_orig = NULL; args_info->path_arg = NULL; args_info->path_orig = NULL; args_info->run_arg = NULL; args_info->run_orig = NULL; - args_info->parallelism_arg = 1; - args_info->parallelism_orig = NULL; } @@ -105,15 +109,16 @@ void init_args_info(struct gengetopt_args_info *args_info) args_info->help_help = gengetopt_args_info_help[0] ; args_info->version_help = gengetopt_args_info_help[1] ; - args_info->engine_help = gengetopt_args_info_help[2] ; - args_info->engine_port_help = gengetopt_args_info_help[3] ; - args_info->connect_help = gengetopt_args_info_help[4] ; - args_info->gui_help = gengetopt_args_info_help[5] ; - args_info->client_port_help = gengetopt_args_info_help[6] ; - args_info->load_help = gengetopt_args_info_help[7] ; - args_info->path_help = gengetopt_args_info_help[8] ; - args_info->run_help = gengetopt_args_info_help[9] ; - args_info->parallelism_help = gengetopt_args_info_help[10] ; + args_info->client_port_help = gengetopt_args_info_help[2] ; + args_info->connect_help = gengetopt_args_info_help[3] ; + args_info->engine_help = gengetopt_args_info_help[4] ; + args_info->engine_port_help = gengetopt_args_info_help[5] ; + args_info->gui_help = gengetopt_args_info_help[6] ; + args_info->jack_name_help = gengetopt_args_info_help[7] ; + args_info->load_help = gengetopt_args_info_help[8] ; + args_info->parallelism_help = gengetopt_args_info_help[9] ; + args_info->path_help = gengetopt_args_info_help[10] ; + args_info->run_help = gengetopt_args_info_help[11] ; } @@ -153,6 +158,9 @@ cmdline_parser_init (struct gengetopt_args_info *args_info) clear_given (args_info); clear_args (args_info); init_args_info (args_info); + + args_info->inputs = NULL; + args_info->inputs_num = 0; } void @@ -191,20 +199,27 @@ free_string_field (char **s) static void cmdline_parser_release (struct gengetopt_args_info *args_info) { - - free_string_field (&(args_info->engine_port_orig)); + unsigned int i; + free_string_field (&(args_info->client_port_orig)); free_string_field (&(args_info->connect_arg)); free_string_field (&(args_info->connect_orig)); - free_string_field (&(args_info->client_port_orig)); + free_string_field (&(args_info->engine_port_orig)); + free_string_field (&(args_info->jack_name_arg)); + free_string_field (&(args_info->jack_name_orig)); free_string_field (&(args_info->load_arg)); free_string_field (&(args_info->load_orig)); + free_string_field (&(args_info->parallelism_orig)); free_string_field (&(args_info->path_arg)); free_string_field (&(args_info->path_orig)); free_string_field (&(args_info->run_arg)); free_string_field (&(args_info->run_orig)); - free_string_field (&(args_info->parallelism_orig)); + for (i = 0; i < args_info->inputs_num; ++i) + free (args_info->inputs [i]); + + if (args_info->inputs_num) + free (args_info->inputs); clear_given (args_info); } @@ -236,24 +251,26 @@ cmdline_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info) write_into_file(outfile, "help", 0, 0 ); if (args_info->version_given) write_into_file(outfile, "version", 0, 0 ); + if (args_info->client_port_given) + write_into_file(outfile, "client-port", args_info->client_port_orig, 0); + if (args_info->connect_given) + write_into_file(outfile, "connect", args_info->connect_orig, 0); if (args_info->engine_given) write_into_file(outfile, "engine", 0, 0 ); if (args_info->engine_port_given) write_into_file(outfile, "engine-port", args_info->engine_port_orig, 0); - if (args_info->connect_given) - write_into_file(outfile, "connect", args_info->connect_orig, 0); if (args_info->gui_given) write_into_file(outfile, "gui", 0, 0 ); - if (args_info->client_port_given) - write_into_file(outfile, "client-port", args_info->client_port_orig, 0); + if (args_info->jack_name_given) + write_into_file(outfile, "jack-name", args_info->jack_name_orig, 0); if (args_info->load_given) write_into_file(outfile, "load", args_info->load_orig, 0); + if (args_info->parallelism_given) + write_into_file(outfile, "parallelism", args_info->parallelism_orig, 0); if (args_info->path_given) write_into_file(outfile, "path", args_info->path_orig, 0); if (args_info->run_given) write_into_file(outfile, "run", args_info->run_orig, 0); - if (args_info->parallelism_given) - write_into_file(outfile, "parallelism", args_info->parallelism_orig, 0); i = EXIT_SUCCESS; @@ -504,19 +521,20 @@ cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_inf static struct option long_options[] = { { "help", 0, NULL, 'h' }, { "version", 0, NULL, 'V' }, + { "client-port", 1, NULL, 'C' }, + { "connect", 1, NULL, 'c' }, { "engine", 0, NULL, 'e' }, { "engine-port", 1, NULL, 'E' }, - { "connect", 1, NULL, 'c' }, { "gui", 0, NULL, 'g' }, - { "client-port", 1, NULL, 'C' }, + { "jack-name", 1, NULL, 'n' }, { "load", 1, NULL, 'l' }, + { "parallelism", 1, NULL, 'p' }, { "path", 1, NULL, 'L' }, { "run", 1, NULL, 'r' }, - { "parallelism", 1, NULL, 'p' }, { NULL, 0, NULL, 0 } }; - c = getopt_long (argc, argv, "hVeE:c:gC:l:L:r:p:", long_options, &option_index); + c = getopt_long (argc, argv, "hVC:c:eE:gn:l:p:L:r:", long_options, &option_index); if (c == -1) break; /* Exit from `while (1)' loop. */ @@ -532,6 +550,30 @@ cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_inf cmdline_parser_free (&local_args_info); exit (EXIT_SUCCESS); + case 'C': /* Client OSC port. */ + + + if (update_arg( (void *)&(args_info->client_port_arg), + &(args_info->client_port_orig), &(args_info->client_port_given), + &(local_args_info.client_port_given), optarg, 0, 0, ARG_INT, + check_ambiguity, override, 0, 0, + "client-port", 'C', + additional_error)) + goto failure; + + break; + case 'c': /* Connect to existing engine at OSC URI. */ + + + if (update_arg( (void *)&(args_info->connect_arg), + &(args_info->connect_orig), &(args_info->connect_given), + &(local_args_info.connect_given), optarg, 0, "osc.udp://localhost:16180", ARG_STRING, + check_ambiguity, override, 0, 0, + "connect", 'c', + additional_error)) + goto failure; + + break; case 'e': /* Run (JACK) engine. */ @@ -554,18 +596,6 @@ cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_inf goto failure; break; - case 'c': /* Connect to existing engine at OSC URI. */ - - - if (update_arg( (void *)&(args_info->connect_arg), - &(args_info->connect_orig), &(args_info->connect_given), - &(local_args_info.connect_given), optarg, 0, "osc.udp://localhost:16180", ARG_STRING, - check_ambiguity, override, 0, 0, - "connect", 'c', - additional_error)) - goto failure; - - break; case 'g': /* Launch the GTK graphical interface. */ @@ -576,14 +606,14 @@ cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_inf goto failure; break; - case 'C': /* Client OSC port. */ + case 'n': /* JACK client name. */ - if (update_arg( (void *)&(args_info->client_port_arg), - &(args_info->client_port_orig), &(args_info->client_port_given), - &(local_args_info.client_port_given), optarg, 0, 0, ARG_INT, + if (update_arg( (void *)&(args_info->jack_name_arg), + &(args_info->jack_name_orig), &(args_info->jack_name_given), + &(local_args_info.jack_name_given), optarg, 0, "ingen", ARG_STRING, check_ambiguity, override, 0, 0, - "client-port", 'C', + "jack-name", 'n', additional_error)) goto failure; @@ -600,6 +630,18 @@ cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_inf goto failure; break; + case 'p': /* Number of concurrent process threads. */ + + + if (update_arg( (void *)&(args_info->parallelism_arg), + &(args_info->parallelism_orig), &(args_info->parallelism_given), + &(local_args_info.parallelism_given), optarg, 0, "1", ARG_INT, + check_ambiguity, override, 0, 0, + "parallelism", 'p', + additional_error)) + goto failure; + + break; case 'L': /* Target path for loaded patch. */ @@ -624,18 +666,6 @@ cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_inf goto failure; break; - case 'p': /* Number of concurrent process threads. */ - - - if (update_arg( (void *)&(args_info->parallelism_arg), - &(args_info->parallelism_orig), &(args_info->parallelism_given), - &(local_args_info.parallelism_given), optarg, 0, "1", ARG_INT, - check_ambiguity, override, 0, 0, - "parallelism", 'p', - additional_error)) - goto failure; - - break; case 0: /* Long option with no short option */ case '?': /* Invalid option. */ @@ -656,6 +686,30 @@ cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_inf if ( error ) return (EXIT_FAILURE); + if (optind < argc) + { + int i = 0 ; + int found_prog_name = 0; + /* whether program name, i.e., argv[0], is in the remaining args + (this may happen with some implementations of getopt, + but surely not with the one included by gengetopt) */ + + i = optind; + while (i < argc) + if (argv[i++] == argv[0]) { + found_prog_name = 1; + break; + } + i = 0; + + args_info->inputs_num = argc - optind - found_prog_name; + args_info->inputs = + (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ; + while (optind < argc) + if (argv[optind++] != argv[0]) + args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind-1]) ; + } + return 0; failure: |