--- trunk/src/applications/dynamicProps/DynamicPropsCmd.c 2007/01/03 20:47:00 1112 +++ trunk/src/applications/dynamicProps/DynamicPropsCmd.c 2008/01/23 21:21:50 1213 @@ -1,7 +1,7 @@ /* - File autogenerated by gengetopt version 2.15 + File autogenerated by gengetopt version 2.19.1 generated with the following command: - gengetopt -u -i DynamicProps.ggo -F DynamicPropsCmd + gengetopt -F DynamicPropsCmd The developers of gengetopt consider the fixed text that goes in all gengetopt output files to be in the public domain: @@ -21,6 +21,31 @@ #include "DynamicPropsCmd.h" +const char *gengetopt_args_info_purpose = ""; + +const char *gengetopt_args_info_usage = "Usage: DynamicProps [OPTIONS]..."; + +const char *gengetopt_args_info_description = ""; + +const char *gengetopt_args_info_help[] = { + " -h, --help Print help and exit", + " -V, --version Print version and exit", + " -i, --input=filename input dump file", + " -o, --output=filename output file name", + " --sele1=selection script select first stuntdouble set", + " --sele2=selection script select second stuntdouble set (if sele2 is not \n set, use script from sele1)", + " --order=INT Lengendre Polynomial Order", + "\n Group: dynamicProps\n an option of this group is required", + " -r, --rcorr rmsd", + " -v, --vcorr velocity correlation function", + " -d, --dcorr dipole correlation function", + " -l, --lcorr Lengendre correlation function", + " --r_rcorr Radial rmsd", + " --thetacorr Angular rmsd", + " --drcorr Directional rmsd for particles with unit \n vectors", + 0 +}; + static void clear_given (struct gengetopt_args_info *args_info); static @@ -51,6 +76,7 @@ void clear_given (struct gengetopt_args_info *args_inf args_info->lcorr_given = 0 ; args_info->r_rcorr_given = 0 ; args_info->thetacorr_given = 0 ; + args_info->drcorr_given = 0 ; args_info->dynamicProps_group_counter = 0 ; } @@ -69,6 +95,26 @@ void clear_args (struct gengetopt_args_info *args_info } +static +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->input_help = gengetopt_args_info_help[2] ; + args_info->output_help = gengetopt_args_info_help[3] ; + args_info->sele1_help = gengetopt_args_info_help[4] ; + args_info->sele2_help = gengetopt_args_info_help[5] ; + args_info->order_help = gengetopt_args_info_help[6] ; + args_info->rcorr_help = gengetopt_args_info_help[7] ; + args_info->vcorr_help = gengetopt_args_info_help[8] ; + args_info->dcorr_help = gengetopt_args_info_help[9] ; + args_info->lcorr_help = gengetopt_args_info_help[10] ; + args_info->r_rcorr_help = gengetopt_args_info_help[11] ; + args_info->thetacorr_help = gengetopt_args_info_help[12] ; + args_info->drcorr_help = gengetopt_args_info_help[13] ; + +} + void cmdline_parser_print_version (void) { @@ -78,23 +124,19 @@ cmdline_parser_print_help (void) void cmdline_parser_print_help (void) { + int i = 0; cmdline_parser_print_version (); - printf("\nUsage: DynamicProps [OPTIONS]... [FILES]...\n\n"); - printf("%s\n"," -h, --help Print help and exit"); - printf("%s\n"," -V, --version Print version and exit"); - printf("%s\n"," -i, --input=filename input dump file"); - printf("%s\n"," -o, --output=filename output file name"); - printf("%s\n"," --sele1=selection script select first stuntdouble set"); - printf("%s\n"," --sele2=selection script select second stuntdouble set (if sele2 is not \n set, use script from sele1)"); - printf("%s\n"," --order=INT Lengendre Polynomial Order"); - printf("%s\n","\n Group: dynamicProps\n an option of this group is required"); - printf("%s\n"," -r, --rcorr rmsd"); - printf("%s\n"," -v, --vcorr velocity correlation function"); - printf("%s\n"," -d, --dcorr dipole correlation function"); - printf("%s\n"," -l, --lcorr Lengendre correlation function"); - printf("%s\n"," --r_rcorr Radial rmsd"); - printf("%s\n"," --thetacorr Angular rmsd"); - + + if (strlen(gengetopt_args_info_purpose) > 0) + printf("\n%s\n", gengetopt_args_info_purpose); + + printf("\n%s\n\n", gengetopt_args_info_usage); + + if (strlen(gengetopt_args_info_description) > 0) + printf("%s\n", gengetopt_args_info_description); + + while (gengetopt_args_info_help[i]) + printf("%s\n", gengetopt_args_info_help[i++]); } void @@ -102,16 +144,13 @@ cmdline_parser_init (struct gengetopt_args_info *args_ { clear_given (args_info); clear_args (args_info); - - args_info->inputs = NULL; - args_info->inputs_num = 0; + init_args_info (args_info); } static void cmdline_parser_release (struct gengetopt_args_info *args_info) { - unsigned int i; if (args_info->input_arg) { free (args_info->input_arg); /* free previous argument */ @@ -158,12 +197,6 @@ cmdline_parser_release (struct gengetopt_args_info *ar args_info->order_orig = 0; } - 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); } @@ -240,6 +273,9 @@ cmdline_parser_file_save(const char *filename, struct if (args_info->thetacorr_given) { fprintf(outfile, "%s\n", "thetacorr"); } + if (args_info->drcorr_given) { + fprintf(outfile, "%s\n", "drcorr"); + } fclose (outfile); @@ -285,6 +321,7 @@ reset_group_dynamicProps(struct gengetopt_args_info *a args_info->lcorr_given = 0 ; args_info->r_rcorr_given = 0 ; args_info->thetacorr_given = 0 ; + args_info->drcorr_given = 0 ; args_info->dynamicProps_group_counter = 0; } @@ -333,11 +370,13 @@ cmdline_parser_required2 (struct gengetopt_args_info * { int error = 0; + /* checks for required options */ if (! args_info->input_given) { fprintf (stderr, "%s: '--input' ('-i') option required%s\n", prog_name, (additional_error ? additional_error : "")); error = 1; } + if (args_info->dynamicProps_group_counter == 0) { fprintf (stderr, "%s: %d options of group dynamicProps were given. One is required.%s\n", prog_name, args_info->dynamicProps_group_counter, (additional_error ? additional_error : "")); @@ -345,6 +384,8 @@ cmdline_parser_required2 (struct gengetopt_args_info * } + /* checks for dependences among options */ + return error; } @@ -362,7 +403,7 @@ cmdline_parser_internal (int argc, char * const *argv, cmdline_parser_init (&local_args_info); optarg = 0; - optind = 1; + optind = 0; opterr = 1; optopt = '?'; @@ -385,6 +426,7 @@ cmdline_parser_internal (int argc, char * const *argv, { "lcorr", 0, NULL, 'l' }, { "r_rcorr", 0, NULL, 0 }, { "thetacorr", 0, NULL, 0 }, + { "drcorr", 0, NULL, 0 }, { NULL, 0, NULL, 0 } }; @@ -596,6 +638,23 @@ cmdline_parser_internal (int argc, char * const *argv, args_info->dynamicProps_group_counter += 1; break; } + /* Directional rmsd for particles with unit vectors. */ + else if (strcmp (long_options[option_index].name, "drcorr") == 0) + { + if (local_args_info.drcorr_given) + { + fprintf (stderr, "%s: `--drcorr' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); + goto failure; + } + if (args_info->drcorr_given && ! override) + continue; + local_args_info.drcorr_given = 1; + args_info->drcorr_given = 1; + if (args_info->dynamicProps_group_counter && override) + reset_group_dynamicProps (args_info); + args_info->dynamicProps_group_counter += 1; + break; + } break; case '?': /* Invalid option. */ @@ -626,17 +685,6 @@ cmdline_parser_internal (int argc, char * const *argv, if ( error ) return (EXIT_FAILURE); - if (optind < argc) - { - int i = 0 ; - - args_info->inputs_num = argc - optind ; - args_info->inputs = - (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ; - while (optind < argc) - args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind++]) ; - } - return 0; failure: