| 1 | 
  | 
/* | 
| 2 | 
  | 
  File autogenerated by gengetopt version 2.12.1 | 
| 3 | 
  | 
  generated with the following command: | 
| 4 | 
< | 
  gengetopt --file-name=visualizerCmd  | 
| 4 | 
> | 
  gengetopt --file-name=visualizerCmd --unamed-opts=SHAPEFILE [OUTPUTFILE]  | 
| 5 | 
  | 
 | 
| 6 | 
  | 
  The developers of gengetopt consider the fixed text that goes in all | 
| 7 | 
  | 
  gengetopt output files to be in the public domain: | 
| 37 | 
  | 
{ | 
| 38 | 
  | 
  args_info->help_given = 0 ; | 
| 39 | 
  | 
  args_info->version_given = 0 ; | 
| 40 | 
– | 
  args_info->shape_given = 0 ; | 
| 41 | 
– | 
  args_info->output_given = 0 ; | 
| 40 | 
  | 
  args_info->grid_given = 0 ; | 
| 41 | 
+ | 
  args_info->range_given = 0 ; | 
| 42 | 
  | 
} | 
| 43 | 
  | 
 | 
| 44 | 
  | 
static | 
| 45 | 
  | 
void clear_args (struct gengetopt_args_info *args_info) | 
| 46 | 
  | 
{ | 
| 48 | 
– | 
  args_info->shape_arg = NULL; | 
| 49 | 
– | 
  args_info->output_arg = NULL; | 
| 47 | 
  | 
  args_info->grid_arg = 101 ; | 
| 48 | 
+ | 
  args_info->range_arg = 10 ; | 
| 49 | 
  | 
} | 
| 50 | 
  | 
 | 
| 51 | 
  | 
void | 
| 59 | 
  | 
{ | 
| 60 | 
  | 
  cmdline_parser_print_version (); | 
| 61 | 
  | 
  printf("\n" | 
| 62 | 
< | 
  "Usage: %s [OPTIONS]...\n", CMDLINE_PARSER_PACKAGE); | 
| 62 | 
> | 
  "Usage: %s [OPTIONS]... [SHAPEFILE [OUTPUTFILE]]...\n", CMDLINE_PARSER_PACKAGE); | 
| 63 | 
  | 
  printf("\n"); | 
| 64 | 
< | 
  printf("%s\n","  -h, --help             Print help and exit"); | 
| 65 | 
< | 
  printf("%s\n","  -V, --version          Print version and exit"); | 
| 66 | 
< | 
  printf("%s\n","  -s, --shape=filename   shape file name"); | 
| 67 | 
< | 
  printf("%s\n","  -o, --output=filename  output file name"); | 
| 70 | 
< | 
  printf("%s\n","  -g, --grid=INT         number of grid points in each coordinate  (default=\n                           `101')"); | 
| 64 | 
> | 
  printf("%s\n","  -h, --help          Print help and exit"); | 
| 65 | 
> | 
  printf("%s\n","  -V, --version       Print version and exit"); | 
| 66 | 
> | 
  printf("%s\n","  -g, --grid=INT      number of grid points in each coordinate  (default=\n                        `101')"); | 
| 67 | 
> | 
  printf("%s\n","  -r, --range=DOUBLE  the sample range for the points in Angstroms (Ex: 10 = \n                        -10 to 10)  (default=`10')"); | 
| 68 | 
  | 
} | 
| 69 | 
  | 
 | 
| 70 | 
  | 
void | 
| 72 | 
  | 
{ | 
| 73 | 
  | 
  clear_given (args_info); | 
| 74 | 
  | 
  clear_args (args_info); | 
| 75 | 
+ | 
 | 
| 76 | 
+ | 
  args_info->inputs = NULL; | 
| 77 | 
+ | 
  args_info->inputs_num = 0; | 
| 78 | 
  | 
} | 
| 79 | 
  | 
 | 
| 80 | 
  | 
void | 
| 81 | 
  | 
cmdline_parser_free (struct gengetopt_args_info *args_info) | 
| 82 | 
  | 
{ | 
| 83 | 
  | 
   | 
| 84 | 
< | 
  if (args_info->shape_arg) | 
| 85 | 
< | 
    { | 
| 86 | 
< | 
      free (args_info->shape_arg); /* free previous argument */ | 
| 87 | 
< | 
      args_info->shape_arg = 0; | 
| 88 | 
< | 
    } | 
| 89 | 
< | 
  if (args_info->output_arg) | 
| 90 | 
< | 
    { | 
| 91 | 
< | 
      free (args_info->output_arg); /* free previous argument */ | 
| 92 | 
< | 
      args_info->output_arg = 0; | 
| 93 | 
< | 
    } | 
| 84 | 
> | 
  int i; | 
| 85 | 
  | 
   | 
| 86 | 
+ | 
  for (i = 0; i < args_info->inputs_num; ++i) | 
| 87 | 
+ | 
    free (args_info->inputs [i]); | 
| 88 | 
+ | 
   | 
| 89 | 
+ | 
  if (args_info->inputs_num) | 
| 90 | 
+ | 
    free (args_info->inputs); | 
| 91 | 
+ | 
   | 
| 92 | 
  | 
  clear_given (args_info); | 
| 93 | 
  | 
} | 
| 94 | 
  | 
 | 
| 156 | 
  | 
      static struct option long_options[] = { | 
| 157 | 
  | 
        { "help",       0, NULL, 'h' }, | 
| 158 | 
  | 
        { "version",    0, NULL, 'V' }, | 
| 162 | 
– | 
        { "shape",      1, NULL, 's' }, | 
| 163 | 
– | 
        { "output",     1, NULL, 'o' }, | 
| 159 | 
  | 
        { "grid",       1, NULL, 'g' }, | 
| 160 | 
+ | 
        { "range",      1, NULL, 'r' }, | 
| 161 | 
  | 
        { NULL, 0, NULL, 0 } | 
| 162 | 
  | 
      }; | 
| 163 | 
  | 
 | 
| 164 | 
  | 
      stop_char = 0; | 
| 165 | 
< | 
      c = getopt_long (argc, argv, "hVs:o:g:", long_options, &option_index); | 
| 165 | 
> | 
      c = getopt_long (argc, argv, "hVg:r:", long_options, &option_index); | 
| 166 | 
  | 
 | 
| 167 | 
  | 
      if (c == -1) break;       /* Exit from `while (1)' loop.  */ | 
| 168 | 
  | 
 | 
| 176 | 
  | 
          cmdline_parser_print_version (); | 
| 177 | 
  | 
          exit (EXIT_SUCCESS); | 
| 178 | 
  | 
 | 
| 183 | 
– | 
        case 's':       /* shape file name.  */ | 
| 184 | 
– | 
          if (local_args_info.shape_given) | 
| 185 | 
– | 
            { | 
| 186 | 
– | 
              fprintf (stderr, "%s: `--shape' (`-s') option given more than once%s\n", CMDLINE_PARSER_PACKAGE, (additional_error ? additional_error : "")); | 
| 187 | 
– | 
              goto failure; | 
| 188 | 
– | 
            } | 
| 189 | 
– | 
          if (args_info->shape_given && ! override) | 
| 190 | 
– | 
            continue; | 
| 191 | 
– | 
          local_args_info.shape_given = 1; | 
| 192 | 
– | 
          args_info->shape_given = 1; | 
| 193 | 
– | 
          if (args_info->shape_arg) | 
| 194 | 
– | 
            free (args_info->shape_arg); /* free previous string */ | 
| 195 | 
– | 
          args_info->shape_arg = gengetopt_strdup (optarg); | 
| 196 | 
– | 
          break; | 
| 197 | 
– | 
 | 
| 198 | 
– | 
        case 'o':       /* output file name.  */ | 
| 199 | 
– | 
          if (local_args_info.output_given) | 
| 200 | 
– | 
            { | 
| 201 | 
– | 
              fprintf (stderr, "%s: `--output' (`-o') option given more than once%s\n", CMDLINE_PARSER_PACKAGE, (additional_error ? additional_error : "")); | 
| 202 | 
– | 
              goto failure; | 
| 203 | 
– | 
            } | 
| 204 | 
– | 
          if (args_info->output_given && ! override) | 
| 205 | 
– | 
            continue; | 
| 206 | 
– | 
          local_args_info.output_given = 1; | 
| 207 | 
– | 
          args_info->output_given = 1; | 
| 208 | 
– | 
          if (args_info->output_arg) | 
| 209 | 
– | 
            free (args_info->output_arg); /* free previous string */ | 
| 210 | 
– | 
          args_info->output_arg = gengetopt_strdup (optarg); | 
| 211 | 
– | 
          break; | 
| 212 | 
– | 
 | 
| 179 | 
  | 
        case 'g':       /* number of grid points in each coordinate.  */ | 
| 180 | 
  | 
          if (local_args_info.grid_given) | 
| 181 | 
  | 
            { | 
| 189 | 
  | 
          args_info->grid_arg = strtol (optarg,&stop_char,0); | 
| 190 | 
  | 
          break; | 
| 191 | 
  | 
 | 
| 192 | 
+ | 
        case 'r':       /* the sample range for the points in Angstroms (Ex: 10 = -10 to 10).  */ | 
| 193 | 
+ | 
          if (local_args_info.range_given) | 
| 194 | 
+ | 
            { | 
| 195 | 
+ | 
              fprintf (stderr, "%s: `--range' (`-r') option given more than once%s\n", CMDLINE_PARSER_PACKAGE, (additional_error ? additional_error : "")); | 
| 196 | 
+ | 
              goto failure; | 
| 197 | 
+ | 
            } | 
| 198 | 
+ | 
          if (args_info->range_given && ! override) | 
| 199 | 
+ | 
            continue; | 
| 200 | 
+ | 
          local_args_info.range_given = 1; | 
| 201 | 
+ | 
          args_info->range_given = 1; | 
| 202 | 
+ | 
          args_info->range_arg = strtod (optarg, NULL); | 
| 203 | 
+ | 
          break; | 
| 204 | 
  | 
 | 
| 205 | 
+ | 
 | 
| 206 | 
  | 
        case 0: /* Long option with no short option */ | 
| 207 | 
  | 
 | 
| 208 | 
  | 
        case '?':       /* Invalid option.  */ | 
| 219 | 
  | 
 | 
| 220 | 
  | 
  if (check_required) | 
| 221 | 
  | 
    { | 
| 243 | 
– | 
      if (! args_info->shape_given) | 
| 244 | 
– | 
        { | 
| 245 | 
– | 
          fprintf (stderr, "%s: '--shape' ('-s') option required%s\n", CMDLINE_PARSER_PACKAGE, (additional_error ? additional_error : "")); | 
| 246 | 
– | 
          error = 1; | 
| 247 | 
– | 
        } | 
| 248 | 
– | 
      if (! args_info->output_given) | 
| 249 | 
– | 
        { | 
| 250 | 
– | 
          fprintf (stderr, "%s: '--output' ('-o') option required%s\n", CMDLINE_PARSER_PACKAGE, (additional_error ? additional_error : "")); | 
| 251 | 
– | 
          error = 1; | 
| 252 | 
– | 
        } | 
| 222 | 
  | 
    } | 
| 223 | 
  | 
 | 
| 224 | 
  | 
  if ( error ) | 
| 225 | 
  | 
    return (EXIT_FAILURE); | 
| 226 | 
  | 
 | 
| 227 | 
+ | 
  if (optind < argc) | 
| 228 | 
+ | 
    { | 
| 229 | 
+ | 
      int i = 0 ; | 
| 230 | 
+ | 
   | 
| 231 | 
+ | 
      args_info->inputs_num = argc - optind ; | 
| 232 | 
+ | 
      args_info->inputs =  | 
| 233 | 
+ | 
        (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ; | 
| 234 | 
+ | 
      while (optind < argc) | 
| 235 | 
+ | 
        args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind++]) ;  | 
| 236 | 
+ | 
    } | 
| 237 | 
+ | 
   | 
| 238 | 
  | 
  return 0; | 
| 239 | 
  | 
 | 
| 240 | 
  | 
failure: |