From 22395ab7d817dec53e2c2fff07de6d88db70492e Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 31 Jul 2007 23:17:02 +0000 Subject: Functional engine Python bindings (e.g. ingen -e -r patchomatic.py). Rename window nitpick fix from Andrew Greenwood. git-svn-id: http://svn.drobilla.net/lad/ingen@663 a436a847-0d15-0410-975c-d299462d15a1 --- src/progs/ingen/cmdline.c | 45 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) (limited to 'src/progs/ingen/cmdline.c') diff --git a/src/progs/ingen/cmdline.c b/src/progs/ingen/cmdline.c index 6c37d78e..462c6a3e 100644 --- a/src/progs/ingen/cmdline.c +++ b/src/progs/ingen/cmdline.c @@ -1,5 +1,5 @@ /* - File autogenerated by gengetopt version 2.19.1 + File autogenerated by gengetopt version 2.20 generated with the following command: gengetopt @@ -37,6 +37,7 @@ const char *gengetopt_args_info_help[] = { " -C, --client-port=INT Client OSC port", " -l, --load=STRING Load patch", " -p, --path=STRING Target path for loaded patch", + " -r, --run=STRING Run script", 0 }; @@ -64,6 +65,7 @@ void clear_given (struct gengetopt_args_info *args_info) args_info->client_port_given = 0 ; args_info->load_given = 0 ; args_info->path_given = 0 ; + args_info->run_given = 0 ; } static @@ -80,6 +82,8 @@ void clear_args (struct gengetopt_args_info *args_info) args_info->load_orig = NULL; args_info->path_arg = NULL; args_info->path_orig = NULL; + args_info->run_arg = NULL; + args_info->run_orig = NULL; } @@ -95,6 +99,7 @@ void init_args_info(struct gengetopt_args_info *args_info) 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] ; } @@ -174,6 +179,16 @@ cmdline_parser_release (struct gengetopt_args_info *args_info) free (args_info->path_orig); /* free previous argument */ args_info->path_orig = 0; } + if (args_info->run_arg) + { + free (args_info->run_arg); /* free previous argument */ + args_info->run_arg = 0; + } + if (args_info->run_orig) + { + free (args_info->run_orig); /* free previous argument */ + args_info->run_orig = 0; + } clear_given (args_info); } @@ -239,6 +254,13 @@ cmdline_parser_file_save(const char *filename, struct gengetopt_args_info *args_ fprintf(outfile, "%s\n", "path"); } } + if (args_info->run_given) { + if (args_info->run_orig) { + fprintf(outfile, "%s=\"%s\"\n", "run", args_info->run_orig); + } else { + fprintf(outfile, "%s\n", "run"); + } + } fclose (outfile); @@ -330,11 +352,12 @@ cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_inf { "client-port", 1, NULL, 'C' }, { "load", 1, NULL, 'l' }, { "path", 1, NULL, 'p' }, + { "run", 1, NULL, 'r' }, { NULL, 0, NULL, 0 } }; stop_char = 0; - c = getopt_long (argc, argv, "hVeE:c:gC:l:p:", long_options, &option_index); + c = getopt_long (argc, argv, "hVeE:c:gC:l:p:r:", long_options, &option_index); if (c == -1) break; /* Exit from `while (1)' loop. */ @@ -470,6 +493,24 @@ cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_inf args_info->path_orig = gengetopt_strdup (optarg); break; + case 'r': /* Run script. */ + if (local_args_info.run_given) + { + fprintf (stderr, "%s: `--run' (`-r') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); + goto failure; + } + if (args_info->run_given && ! override) + continue; + local_args_info.run_given = 1; + args_info->run_given = 1; + if (args_info->run_arg) + free (args_info->run_arg); /* free previous string */ + args_info->run_arg = gengetopt_strdup (optarg); + if (args_info->run_orig) + free (args_info->run_orig); /* free previous string */ + args_info->run_orig = gengetopt_strdup (optarg); + break; + case 0: /* Long option with no short option */ case '?': /* Invalid option. */ -- cgit v1.2.1