--- trunk/SHAPES/visualizerCmd.c 2004/06/24 19:06:47 1300 +++ trunk/SHAPES/visualizerCmd.c 2004/06/28 23:05:25 1315 @@ -40,6 +40,7 @@ void clear_given (struct gengetopt_args_info *args_inf args_info->shape_given = 0 ; args_info->output_given = 0 ; args_info->grid_given = 0 ; + args_info->range_given = 0 ; } static @@ -48,6 +49,7 @@ void clear_args (struct gengetopt_args_info *args_info args_info->shape_arg = NULL; args_info->output_arg = NULL; args_info->grid_arg = 101 ; + args_info->range_arg = 10 ; } void @@ -68,6 +70,7 @@ cmdline_parser_print_help (void) printf("%s\n"," -s, --shape=filename shape file name"); printf("%s\n"," -o, --output=filename output file name"); printf("%s\n"," -g, --grid=INT number of grid points in each coordinate (default=\n `101')"); + printf("%s\n"," -r, --range=DOUBLE the sample range for the points in Angstroms (Ex: 10 =\n -10 to 10) (default=`10')"); } void @@ -162,11 +165,12 @@ cmdline_parser_internal (int argc, char * const *argv, { "shape", 1, NULL, 's' }, { "output", 1, NULL, 'o' }, { "grid", 1, NULL, 'g' }, + { "range", 1, NULL, 'r' }, { NULL, 0, NULL, 0 } }; stop_char = 0; - c = getopt_long (argc, argv, "hVs:o:g:", long_options, &option_index); + c = getopt_long (argc, argv, "hVs:o:g:r:", long_options, &option_index); if (c == -1) break; /* Exit from `while (1)' loop. */ @@ -223,7 +227,20 @@ cmdline_parser_internal (int argc, char * const *argv, args_info->grid_arg = strtol (optarg,&stop_char,0); break; + case 'r': /* the sample range for the points in Angstroms (Ex: 10 = -10 to 10). */ + if (local_args_info.range_given) + { + fprintf (stderr, "%s: `--range' (`-r') option given more than once%s\n", CMDLINE_PARSER_PACKAGE, (additional_error ? additional_error : "")); + goto failure; + } + if (args_info->range_given && ! override) + continue; + local_args_info.range_given = 1; + args_info->range_given = 1; + args_info->range_arg = strtod (optarg, NULL); + break; + case 0: /* Long option with no short option */ case '?': /* Invalid option. */