ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/trunk/src/applications/staticProps/StaticPropsCmd.c
(Generate patch)

Comparing trunk/src/applications/staticProps/StaticPropsCmd.c (file contents):
Revision 1513 by gezelter, Tue Oct 19 18:40:54 2010 UTC vs.
Revision 1531 by kstocke1, Wed Dec 29 16:48:19 2010 UTC

# Line 1 | Line 1
1   /*
2 <  File autogenerated by gengetopt version 2.22
2 >  File autogenerated by gengetopt version 2.22.4
3    generated with the following command:
4    gengetopt -F StaticPropsCmd -u
5  
# Line 17 | Line 17
17   #include <stdlib.h>
18   #include <string.h>
19  
20 < #include "getopt.h"
20 > #ifndef FIX_UNUSED
21 > #define FIX_UNUSED(X) (void) (X) /* avoid warnings for unused params */
22 > #endif
23  
24 + #include <getopt.h>
25 +
26   #include "StaticPropsCmd.h"
27  
28   const char *gengetopt_args_info_purpose = "";
# Line 73 | Line 77 | const char *gengetopt_args_info_help[] = {
77    "      --p_angle                 p(cos(theta))",
78    "      --hxy                     hxy",
79    "      --rho_r                   rho of R",
80 +  "      --angle_r                 angle of R",
81    "      --hullvol                 hull volume of nanoparticle",
82 +  "  -Q, --tet_param               tetrahedrality order parameter",
83      0
84   };
85  
# Line 89 | Line 95 | static int
95   void clear_args (struct gengetopt_args_info *args_info);
96  
97   static int
98 < cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info,
98 > cmdline_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info,
99                          struct cmdline_parser_params *params, const char *additional_error);
100  
101   static int
# Line 145 | Line 151 | void clear_given (struct gengetopt_args_info *args_inf
151    args_info->p_angle_given = 0 ;
152    args_info->hxy_given = 0 ;
153    args_info->rho_r_given = 0 ;
154 +  args_info->angle_r_given = 0 ;
155    args_info->hullvol_given = 0 ;
156 +  args_info->tet_param_given = 0 ;
157    args_info->staticProps_group_counter = 0 ;
158   }
159  
160   static
161   void clear_args (struct gengetopt_args_info *args_info)
162   {
163 +  FIX_UNUSED (args_info);
164    args_info->input_arg = NULL;
165    args_info->input_orig = NULL;
166    args_info->output_arg = NULL;
# Line 241 | Line 250 | void init_args_info(struct gengetopt_args_info *args_i
250    args_info->p_angle_help = gengetopt_args_info_help[42] ;
251    args_info->hxy_help = gengetopt_args_info_help[43] ;
252    args_info->rho_r_help = gengetopt_args_info_help[44] ;
253 <  args_info->hullvol_help = gengetopt_args_info_help[45] ;
253 >  args_info->angle_r_help = gengetopt_args_info_help[45] ;
254 >  args_info->hullvol_help = gengetopt_args_info_help[46] ;
255 >  args_info->tet_param_help = gengetopt_args_info_help[47] ;
256    
257   }
258  
259   void
260   cmdline_parser_print_version (void)
261   {
262 <  printf ("%s %s\n", CMDLINE_PARSER_PACKAGE, CMDLINE_PARSER_VERSION);
262 >  printf ("%s %s\n",
263 >     (strlen(CMDLINE_PARSER_PACKAGE_NAME) ? CMDLINE_PARSER_PACKAGE_NAME : CMDLINE_PARSER_PACKAGE),
264 >     CMDLINE_PARSER_VERSION);
265   }
266  
267   static void print_help_common(void) {
# Line 263 | Line 276 | static void print_help_common(void) {
276    printf("\n");
277  
278    if (strlen(gengetopt_args_info_description) > 0)
279 <    printf("%s\n", gengetopt_args_info_description);
279 >    printf("%s\n\n", gengetopt_args_info_description);
280   }
281  
282   void
# Line 282 | Line 295 | cmdline_parser_init (struct gengetopt_args_info *args_
295    clear_args (args_info);
296    init_args_info (args_info);
297  
298 <  args_info->inputs = NULL;
298 >  args_info->inputs = 0;
299    args_info->inputs_num = 0;
300   }
301  
# Line 366 | Line 379 | static void
379  
380  
381   static void
382 < write_into_file(FILE *outfile, const char *opt, const char *arg, char *values[])
382 > write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[])
383   {
384 +  FIX_UNUSED (values);
385    if (arg) {
386      fprintf(outfile, "%s=\"%s\"\n", opt, arg);
387    } else {
# Line 475 | Line 489 | cmdline_parser_dump(FILE *outfile, struct gengetopt_ar
489      write_into_file(outfile, "hxy", 0, 0 );
490    if (args_info->rho_r_given)
491      write_into_file(outfile, "rho_r", 0, 0 );
492 +  if (args_info->angle_r_given)
493 +    write_into_file(outfile, "angle_r", 0, 0 );
494    if (args_info->hullvol_given)
495      write_into_file(outfile, "hullvol", 0, 0 );
496 +  if (args_info->tet_param_given)
497 +    write_into_file(outfile, "tet_param", 0, 0 );
498    
499  
500    i = EXIT_SUCCESS;
# Line 513 | Line 531 | gengetopt_strdup (const char *s)
531   char *
532   gengetopt_strdup (const char *s)
533   {
534 <  char *result = NULL;
534 >  char *result = 0;
535    if (!s)
536      return result;
537  
# Line 550 | Line 568 | reset_group_staticProps(struct gengetopt_args_info *ar
568    args_info->p_angle_given = 0 ;
569    args_info->hxy_given = 0 ;
570    args_info->rho_r_given = 0 ;
571 +  args_info->angle_r_given = 0 ;
572    args_info->hullvol_given = 0 ;
573 +  args_info->tet_param_given = 0 ;
574  
575    args_info->staticProps_group_counter = 0;
576   }
577  
578   int
579 < cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info)
579 > cmdline_parser (int argc, char **argv, struct gengetopt_args_info *args_info)
580   {
581    return cmdline_parser2 (argc, argv, args_info, 0, 1, 1);
582   }
583  
584   int
585 < cmdline_parser_ext (int argc, char * const *argv, struct gengetopt_args_info *args_info,
585 > cmdline_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info,
586                     struct cmdline_parser_params *params)
587   {
588    int result;
589 <  result = cmdline_parser_internal (argc, argv, args_info, params, NULL);
589 >  result = cmdline_parser_internal (argc, argv, args_info, params, 0);
590  
591    if (result == EXIT_FAILURE)
592      {
# Line 578 | Line 598 | int
598   }
599  
600   int
601 < cmdline_parser2 (int argc, char * const *argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required)
601 > cmdline_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required)
602   {
603    int result;
604    struct cmdline_parser_params params;
# Line 589 | Line 609 | cmdline_parser2 (int argc, char * const *argv, struct
609    params.check_ambiguity = 0;
610    params.print_errors = 1;
611  
612 <  result = cmdline_parser_internal (argc, argv, args_info, &params, NULL);
612 >  result = cmdline_parser_internal (argc, argv, args_info, &params, 0);
613  
614    if (result == EXIT_FAILURE)
615      {
# Line 605 | Line 625 | cmdline_parser_required (struct gengetopt_args_info *a
625   {
626    int result = EXIT_SUCCESS;
627  
628 <  if (cmdline_parser_required2(args_info, prog_name, NULL) > 0)
628 >  if (cmdline_parser_required2(args_info, prog_name, 0) > 0)
629      result = EXIT_FAILURE;
630  
631    if (result == EXIT_FAILURE)
# Line 621 | Line 641 | cmdline_parser_required2 (struct gengetopt_args_info *
641   cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error)
642   {
643    int error = 0;
644 +  FIX_UNUSED (additional_error);
645  
646    /* checks for required options */
647    if (! args_info->input_given)
# Line 631 | Line 652 | cmdline_parser_required2 (struct gengetopt_args_info *
652    
653    if (args_info->staticProps_group_counter == 0)
654      {
655 <      fprintf (stderr, "%s: %d options of group staticProps were given. One is required.%s\n", prog_name, args_info->staticProps_group_counter, (additional_error ? additional_error : ""));
655 >      fprintf (stderr, "%s: %d options of group staticProps were given. One is required%s.\n", prog_name, args_info->staticProps_group_counter, (additional_error ? additional_error : ""));
656        error = 1;
657      }
658    
# Line 665 | Line 686 | int update_arg(void *field, char **orig_field,
686   static
687   int update_arg(void *field, char **orig_field,
688                 unsigned int *field_given, unsigned int *prev_given,
689 <               char *value, char *possible_values[], const char *default_value,
689 >               char *value, const char *possible_values[],
690 >               const char *default_value,
691                 cmdline_parser_arg_type arg_type,
692                 int check_ambiguity, int override,
693                 int no_free, int multiple_option,
# Line 676 | Line 698 | int update_arg(void *field, char **orig_field,
698    const char *val = value;
699    int found;
700    char **string_field;
701 +  FIX_UNUSED (field);
702  
703    stop_char = 0;
704    found = 0;
# Line 693 | Line 716 | int update_arg(void *field, char **orig_field,
716        return 1; /* failure */
717      }
718  
719 +  FIX_UNUSED (default_value);
720      
721    if (field_given && *field_given && ! override)
722      return 0;
# Line 756 | Line 780 | int
780  
781  
782   int
783 < cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info,
783 > cmdline_parser_internal (
784 >  int argc, char **argv, struct gengetopt_args_info *args_info,
785                          struct cmdline_parser_params *params, const char *additional_error)
786   {
787    int c;        /* Character of the parsed option.  */
# Line 835 | Line 860 | cmdline_parser_internal (int argc, char * const *argv,
860          { "p_angle",    0, NULL, 0 },
861          { "hxy",        0, NULL, 0 },
862          { "rho_r",      0, NULL, 0 },
863 +        { "angle_r",    0, NULL, 0 },
864          { "hullvol",    0, NULL, 0 },
865 <        { NULL, 0, NULL, 0 }
865 >        { "tet_param",  0, NULL, 'Q' },
866 >        { 0,  0, 0, 0 }
867        };
868  
869 <      c = getopt_long (argc, argv, "hVi:o:n:b:x:y:a:c:z:gpsd", long_options, &option_index);
869 >      c = getopt_long (argc, argv, "hVi:o:n:b:x:y:a:c:z:gpsdQ", long_options, &option_index);
870  
871        if (c == -1) break;       /* Exit from `while (1)' loop.  */
872  
# Line 1019 | Line 1046 | cmdline_parser_internal (int argc, char * const *argv,
1046                &(local_args_info.density_given), optarg, 0, 0, ARG_NO,
1047                check_ambiguity, override, 0, 0,
1048                "density", 'd',
1049 +              additional_error))
1050 +            goto failure;
1051 +        
1052 +          break;
1053 +        case 'Q':       /* tetrahedrality order parameter.  */
1054 +        
1055 +          if (args_info->staticProps_group_counter && override)
1056 +            reset_group_staticProps (args_info);
1057 +          args_info->staticProps_group_counter += 1;
1058 +        
1059 +          if (update_arg( 0 ,
1060 +               0 , &(args_info->tet_param_given),
1061 +              &(local_args_info.tet_param_given), optarg, 0, 0, ARG_NO,
1062 +              check_ambiguity, override, 0, 0,
1063 +              "tet_param", 'Q',
1064                additional_error))
1065              goto failure;
1066          
# Line 1475 | Line 1517 | cmdline_parser_internal (int argc, char * const *argv,
1517                  &(local_args_info.rho_r_given), optarg, 0, 0, ARG_NO,
1518                  check_ambiguity, override, 0, 0,
1519                  "rho_r", '-',
1520 +                additional_error))
1521 +              goto failure;
1522 +          
1523 +          }
1524 +          /* angle of R.  */
1525 +          else if (strcmp (long_options[option_index].name, "angle_r") == 0)
1526 +          {
1527 +          
1528 +            if (args_info->staticProps_group_counter && override)
1529 +              reset_group_staticProps (args_info);
1530 +            args_info->staticProps_group_counter += 1;
1531 +          
1532 +            if (update_arg( 0 ,
1533 +                 0 , &(args_info->angle_r_given),
1534 +                &(local_args_info.angle_r_given), optarg, 0, 0, ARG_NO,
1535 +                check_ambiguity, override, 0, 0,
1536 +                "angle_r", '-',
1537                  additional_error))
1538                goto failure;
1539            
# Line 1510 | Line 1569 | cmdline_parser_internal (int argc, char * const *argv,
1569  
1570    if (args_info->staticProps_group_counter > 1)
1571      {
1572 <      fprintf (stderr, "%s: %d options of group staticProps were given. One is required.%s\n", argv[0], args_info->staticProps_group_counter, (additional_error ? additional_error : ""));
1572 >      fprintf (stderr, "%s: %d options of group staticProps were given. One is required%s.\n", argv[0], args_info->staticProps_group_counter, (additional_error ? additional_error : ""));
1573        error = 1;
1574      }
1575    

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines