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

Comparing:
trunk/src/applications/staticProps/StaticPropsCmd.c (file contents), Revision 1454 by gezelter, Wed Jun 23 19:25:02 2010 UTC vs.
trunk/src/applications/staticProps/StaticPropsCmd.cpp (file contents), Revision 1782 by gezelter, Wed Aug 22 02:28:28 2012 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
4 >  gengetopt -i StaticProps.ggo -c cpp -F StaticPropsCmd -u
5  
6    The developers of gengetopt consider the fixed text that goes in all
7    gengetopt output files to be in the public domain:
# 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 56 | Line 60 | const char *gengetopt_args_info_help[] = {
60    "      --bo                      bond order parameter (--rcut must be specified)",
61    "      --bor                     bond order parameter as a function of radius \n                                  (--rcut must be specified)",
62    "      --bad                     N(theta) bond angle density within (--rcut must \n                                  be specified)",
63 +  "      --count                   count of molecules matching selection criteria \n                                  (and associated statistics)",
64    "  -g, --gofr                    g(r)",
65    "      --gofz                    g(z)",
66    "      --r_theta                 g(r, cos(theta))",
# Line 64 | Line 69 | const char *gengetopt_args_info_help[] = {
69    "      --theta_omega             g(cos(theta), cos(omega))",
70    "      --gxyz                    g(x, y, z)",
71    "      --twodgofr                2D g(r) (Slab width --dz must be specified)",
72 <  "  -p, --p2                      p2 order parameter (--sele1 and --sele2 must be \n                                  specified)",
72 >  "  -p, --p2                      p2 order parameter (--sele1 must be specified, \n                                  --sele2 is optional)",
73    "      --rp2                     rp2 order parameter (--sele1 and --sele2 must \n                                  be specified)",
74    "  -s, --scd                     scd order parameter (either --sele1, --sele2, \n                                  --sele3 are specified or --molname, --begin, \n                                  --end are specified)",
75    "  -d, --density                 density plot",
# Line 72 | 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 +  "      --rodlength               length of nanorod",
83 +  "  -Q, --tet_param               tetrahedrality order parameter",
84 +  "      --tet_param_z             tetrahedrality order parameter by zbin(--sele1 \n                                  must be specified)",
85      0
86   };
87  
# Line 88 | Line 97 | static int
97   void clear_args (struct gengetopt_args_info *args_info);
98  
99   static int
100 < cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info,
100 > cmdline_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info,
101                          struct cmdline_parser_params *params, const char *additional_error);
102  
103   static int
# Line 127 | Line 136 | void clear_given (struct gengetopt_args_info *args_inf
136    args_info->bo_given = 0 ;
137    args_info->bor_given = 0 ;
138    args_info->bad_given = 0 ;
139 +  args_info->count_given = 0 ;
140    args_info->gofr_given = 0 ;
141    args_info->gofz_given = 0 ;
142    args_info->r_theta_given = 0 ;
# Line 143 | Line 153 | void clear_given (struct gengetopt_args_info *args_inf
153    args_info->p_angle_given = 0 ;
154    args_info->hxy_given = 0 ;
155    args_info->rho_r_given = 0 ;
156 +  args_info->angle_r_given = 0 ;
157    args_info->hullvol_given = 0 ;
158 +  args_info->rodlength_given = 0 ;
159 +  args_info->tet_param_given = 0 ;
160 +  args_info->tet_param_z_given = 0 ;
161    args_info->staticProps_group_counter = 0 ;
162   }
163  
164   static
165   void clear_args (struct gengetopt_args_info *args_info)
166   {
167 +  FIX_UNUSED (args_info);
168    args_info->input_arg = NULL;
169    args_info->input_orig = NULL;
170    args_info->output_arg = NULL;
# Line 222 | Line 237 | void init_args_info(struct gengetopt_args_info *args_i
237    args_info->bo_help = gengetopt_args_info_help[25] ;
238    args_info->bor_help = gengetopt_args_info_help[26] ;
239    args_info->bad_help = gengetopt_args_info_help[27] ;
240 <  args_info->gofr_help = gengetopt_args_info_help[28] ;
241 <  args_info->gofz_help = gengetopt_args_info_help[29] ;
242 <  args_info->r_theta_help = gengetopt_args_info_help[30] ;
243 <  args_info->r_omega_help = gengetopt_args_info_help[31] ;
244 <  args_info->r_z_help = gengetopt_args_info_help[32] ;
245 <  args_info->theta_omega_help = gengetopt_args_info_help[33] ;
246 <  args_info->gxyz_help = gengetopt_args_info_help[34] ;
247 <  args_info->twodgofr_help = gengetopt_args_info_help[35] ;
248 <  args_info->p2_help = gengetopt_args_info_help[36] ;
249 <  args_info->rp2_help = gengetopt_args_info_help[37] ;
250 <  args_info->scd_help = gengetopt_args_info_help[38] ;
251 <  args_info->density_help = gengetopt_args_info_help[39] ;
252 <  args_info->slab_density_help = gengetopt_args_info_help[40] ;
253 <  args_info->p_angle_help = gengetopt_args_info_help[41] ;
254 <  args_info->hxy_help = gengetopt_args_info_help[42] ;
255 <  args_info->rho_r_help = gengetopt_args_info_help[43] ;
256 <  args_info->hullvol_help = gengetopt_args_info_help[44] ;
240 >  args_info->count_help = gengetopt_args_info_help[28] ;
241 >  args_info->gofr_help = gengetopt_args_info_help[29] ;
242 >  args_info->gofz_help = gengetopt_args_info_help[30] ;
243 >  args_info->r_theta_help = gengetopt_args_info_help[31] ;
244 >  args_info->r_omega_help = gengetopt_args_info_help[32] ;
245 >  args_info->r_z_help = gengetopt_args_info_help[33] ;
246 >  args_info->theta_omega_help = gengetopt_args_info_help[34] ;
247 >  args_info->gxyz_help = gengetopt_args_info_help[35] ;
248 >  args_info->twodgofr_help = gengetopt_args_info_help[36] ;
249 >  args_info->p2_help = gengetopt_args_info_help[37] ;
250 >  args_info->rp2_help = gengetopt_args_info_help[38] ;
251 >  args_info->scd_help = gengetopt_args_info_help[39] ;
252 >  args_info->density_help = gengetopt_args_info_help[40] ;
253 >  args_info->slab_density_help = gengetopt_args_info_help[41] ;
254 >  args_info->p_angle_help = gengetopt_args_info_help[42] ;
255 >  args_info->hxy_help = gengetopt_args_info_help[43] ;
256 >  args_info->rho_r_help = gengetopt_args_info_help[44] ;
257 >  args_info->angle_r_help = gengetopt_args_info_help[45] ;
258 >  args_info->hullvol_help = gengetopt_args_info_help[46] ;
259 >  args_info->rodlength_help = gengetopt_args_info_help[47] ;
260 >  args_info->tet_param_help = gengetopt_args_info_help[48] ;
261 >  args_info->tet_param_z_help = gengetopt_args_info_help[49] ;
262    
263   }
264  
265   void
266   cmdline_parser_print_version (void)
267   {
268 <  printf ("%s %s\n", CMDLINE_PARSER_PACKAGE, CMDLINE_PARSER_VERSION);
268 >  printf ("%s %s\n",
269 >     (strlen(CMDLINE_PARSER_PACKAGE_NAME) ? CMDLINE_PARSER_PACKAGE_NAME : CMDLINE_PARSER_PACKAGE),
270 >     CMDLINE_PARSER_VERSION);
271   }
272  
273   static void print_help_common(void) {
# Line 260 | Line 282 | static void print_help_common(void) {
282    printf("\n");
283  
284    if (strlen(gengetopt_args_info_description) > 0)
285 <    printf("%s\n", gengetopt_args_info_description);
285 >    printf("%s\n\n", gengetopt_args_info_description);
286   }
287  
288   void
# Line 279 | Line 301 | cmdline_parser_init (struct gengetopt_args_info *args_
301    clear_args (args_info);
302    init_args_info (args_info);
303  
304 <  args_info->inputs = NULL;
304 >  args_info->inputs = 0;
305    args_info->inputs_num = 0;
306   }
307  
# Line 363 | Line 385 | static void
385  
386  
387   static void
388 < write_into_file(FILE *outfile, const char *opt, const char *arg, char *values[])
388 > write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[])
389   {
390 +  FIX_UNUSED (values);
391    if (arg) {
392      fprintf(outfile, "%s=\"%s\"\n", opt, arg);
393    } else {
# Line 438 | Line 461 | cmdline_parser_dump(FILE *outfile, struct gengetopt_ar
461      write_into_file(outfile, "bor", 0, 0 );
462    if (args_info->bad_given)
463      write_into_file(outfile, "bad", 0, 0 );
464 +  if (args_info->count_given)
465 +    write_into_file(outfile, "count", 0, 0 );
466    if (args_info->gofr_given)
467      write_into_file(outfile, "gofr", 0, 0 );
468    if (args_info->gofz_given)
# Line 470 | Line 495 | cmdline_parser_dump(FILE *outfile, struct gengetopt_ar
495      write_into_file(outfile, "hxy", 0, 0 );
496    if (args_info->rho_r_given)
497      write_into_file(outfile, "rho_r", 0, 0 );
498 +  if (args_info->angle_r_given)
499 +    write_into_file(outfile, "angle_r", 0, 0 );
500    if (args_info->hullvol_given)
501      write_into_file(outfile, "hullvol", 0, 0 );
502 +  if (args_info->rodlength_given)
503 +    write_into_file(outfile, "rodlength", 0, 0 );
504 +  if (args_info->tet_param_given)
505 +    write_into_file(outfile, "tet_param", 0, 0 );
506 +  if (args_info->tet_param_z_given)
507 +    write_into_file(outfile, "tet_param_z", 0, 0 );
508    
509  
510    i = EXIT_SUCCESS;
# Line 508 | Line 541 | gengetopt_strdup (const char *s)
541   char *
542   gengetopt_strdup (const char *s)
543   {
544 <  char *result = NULL;
544 >  char *result = 0;
545    if (!s)
546      return result;
547  
# Line 528 | Line 561 | reset_group_staticProps(struct gengetopt_args_info *ar
561    args_info->bo_given = 0 ;
562    args_info->bor_given = 0 ;
563    args_info->bad_given = 0 ;
564 +  args_info->count_given = 0 ;
565    args_info->gofr_given = 0 ;
566    args_info->gofz_given = 0 ;
567    args_info->r_theta_given = 0 ;
# Line 544 | Line 578 | reset_group_staticProps(struct gengetopt_args_info *ar
578    args_info->p_angle_given = 0 ;
579    args_info->hxy_given = 0 ;
580    args_info->rho_r_given = 0 ;
581 +  args_info->angle_r_given = 0 ;
582    args_info->hullvol_given = 0 ;
583 +  args_info->rodlength_given = 0 ;
584 +  args_info->tet_param_given = 0 ;
585 +  args_info->tet_param_z_given = 0 ;
586  
587    args_info->staticProps_group_counter = 0;
588   }
589  
590   int
591 < cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info)
591 > cmdline_parser (int argc, char **argv, struct gengetopt_args_info *args_info)
592   {
593    return cmdline_parser2 (argc, argv, args_info, 0, 1, 1);
594   }
595  
596   int
597 < cmdline_parser_ext (int argc, char * const *argv, struct gengetopt_args_info *args_info,
597 > cmdline_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info,
598                     struct cmdline_parser_params *params)
599   {
600    int result;
601 <  result = cmdline_parser_internal (argc, argv, args_info, params, NULL);
601 >  result = cmdline_parser_internal (argc, argv, args_info, params, 0);
602  
603    if (result == EXIT_FAILURE)
604      {
# Line 572 | Line 610 | int
610   }
611  
612   int
613 < cmdline_parser2 (int argc, char * const *argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required)
613 > cmdline_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required)
614   {
615    int result;
616    struct cmdline_parser_params params;
# Line 583 | Line 621 | cmdline_parser2 (int argc, char * const *argv, struct
621    params.check_ambiguity = 0;
622    params.print_errors = 1;
623  
624 <  result = cmdline_parser_internal (argc, argv, args_info, &params, NULL);
624 >  result = cmdline_parser_internal (argc, argv, args_info, &params, 0);
625  
626    if (result == EXIT_FAILURE)
627      {
# Line 599 | Line 637 | cmdline_parser_required (struct gengetopt_args_info *a
637   {
638    int result = EXIT_SUCCESS;
639  
640 <  if (cmdline_parser_required2(args_info, prog_name, NULL) > 0)
640 >  if (cmdline_parser_required2(args_info, prog_name, 0) > 0)
641      result = EXIT_FAILURE;
642  
643    if (result == EXIT_FAILURE)
# Line 615 | Line 653 | cmdline_parser_required2 (struct gengetopt_args_info *
653   cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error)
654   {
655    int error = 0;
656 +  FIX_UNUSED (additional_error);
657  
658    /* checks for required options */
659    if (! args_info->input_given)
# Line 625 | Line 664 | cmdline_parser_required2 (struct gengetopt_args_info *
664    
665    if (args_info->staticProps_group_counter == 0)
666      {
667 <      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 : ""));
667 >      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 : ""));
668        error = 1;
669      }
670    
# Line 659 | Line 698 | int update_arg(void *field, char **orig_field,
698   static
699   int update_arg(void *field, char **orig_field,
700                 unsigned int *field_given, unsigned int *prev_given,
701 <               char *value, char *possible_values[], const char *default_value,
701 >               char *value, const char *possible_values[],
702 >               const char *default_value,
703                 cmdline_parser_arg_type arg_type,
704                 int check_ambiguity, int override,
705                 int no_free, int multiple_option,
# Line 670 | Line 710 | int update_arg(void *field, char **orig_field,
710    const char *val = value;
711    int found;
712    char **string_field;
713 +  FIX_UNUSED (field);
714  
715    stop_char = 0;
716    found = 0;
# Line 687 | Line 728 | int update_arg(void *field, char **orig_field,
728        return 1; /* failure */
729      }
730  
731 +  FIX_UNUSED (default_value);
732      
733    if (field_given && *field_given && ! override)
734      return 0;
# Line 750 | Line 792 | int
792  
793  
794   int
795 < cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info,
795 > cmdline_parser_internal (
796 >  int argc, char **argv, struct gengetopt_args_info *args_info,
797                          struct cmdline_parser_params *params, const char *additional_error)
798   {
799    int c;        /* Character of the parsed option.  */
# Line 812 | Line 855 | cmdline_parser_internal (int argc, char * const *argv,
855          { "bo", 0, NULL, 0 },
856          { "bor",        0, NULL, 0 },
857          { "bad",        0, NULL, 0 },
858 +        { "count",      0, NULL, 0 },
859          { "gofr",       0, NULL, 'g' },
860          { "gofz",       0, NULL, 0 },
861          { "r_theta",    0, NULL, 0 },
# Line 828 | Line 872 | cmdline_parser_internal (int argc, char * const *argv,
872          { "p_angle",    0, NULL, 0 },
873          { "hxy",        0, NULL, 0 },
874          { "rho_r",      0, NULL, 0 },
875 +        { "angle_r",    0, NULL, 0 },
876          { "hullvol",    0, NULL, 0 },
877 <        { NULL, 0, NULL, 0 }
877 >        { "rodlength",  0, NULL, 0 },
878 >        { "tet_param",  0, NULL, 'Q' },
879 >        { "tet_param_z",        0, NULL, 0 },
880 >        { 0,  0, 0, 0 }
881        };
882  
883 <      c = getopt_long (argc, argv, "hVi:o:n:b:x:y:a:c:z:gpsd", long_options, &option_index);
883 >      c = getopt_long (argc, argv, "hVi:o:n:b:x:y:a:c:z:gpsdQ", long_options, &option_index);
884  
885        if (c == -1) break;       /* Exit from `while (1)' loop.  */
886  
# Line 971 | Line 1019 | cmdline_parser_internal (int argc, char * const *argv,
1019              goto failure;
1020          
1021            break;
1022 <        case 'p':       /* p2 order parameter (--sele1 and --sele2 must be specified).  */
1022 >        case 'p':       /* p2 order parameter (--sele1 must be specified, --sele2 is optional).  */
1023          
1024            if (args_info->staticProps_group_counter && override)
1025              reset_group_staticProps (args_info);
# Line 1012 | Line 1060 | cmdline_parser_internal (int argc, char * const *argv,
1060                &(local_args_info.density_given), optarg, 0, 0, ARG_NO,
1061                check_ambiguity, override, 0, 0,
1062                "density", 'd',
1063 +              additional_error))
1064 +            goto failure;
1065 +        
1066 +          break;
1067 +        case 'Q':       /* tetrahedrality order parameter.  */
1068 +        
1069 +          if (args_info->staticProps_group_counter && override)
1070 +            reset_group_staticProps (args_info);
1071 +          args_info->staticProps_group_counter += 1;
1072 +        
1073 +          if (update_arg( 0 ,
1074 +               0 , &(args_info->tet_param_given),
1075 +              &(local_args_info.tet_param_given), optarg, 0, 0, ARG_NO,
1076 +              check_ambiguity, override, 0, 0,
1077 +              "tet_param", 'Q',
1078                additional_error))
1079              goto failure;
1080          
# Line 1251 | Line 1314 | cmdline_parser_internal (int argc, char * const *argv,
1314                goto failure;
1315            
1316            }
1317 +          /* count of molecules matching selection criteria (and associated statistics).  */
1318 +          else if (strcmp (long_options[option_index].name, "count") == 0)
1319 +          {
1320 +          
1321 +            if (args_info->staticProps_group_counter && override)
1322 +              reset_group_staticProps (args_info);
1323 +            args_info->staticProps_group_counter += 1;
1324 +          
1325 +            if (update_arg( 0 ,
1326 +                 0 , &(args_info->count_given),
1327 +                &(local_args_info.count_given), optarg, 0, 0, ARG_NO,
1328 +                check_ambiguity, override, 0, 0,
1329 +                "count", '-',
1330 +                additional_error))
1331 +              goto failure;
1332 +          
1333 +          }
1334            /* g(z).  */
1335            else if (strcmp (long_options[option_index].name, "gofz") == 0)
1336            {
# Line 1455 | Line 1535 | cmdline_parser_internal (int argc, char * const *argv,
1535                goto failure;
1536            
1537            }
1538 +          /* angle of R.  */
1539 +          else if (strcmp (long_options[option_index].name, "angle_r") == 0)
1540 +          {
1541 +          
1542 +            if (args_info->staticProps_group_counter && override)
1543 +              reset_group_staticProps (args_info);
1544 +            args_info->staticProps_group_counter += 1;
1545 +          
1546 +            if (update_arg( 0 ,
1547 +                 0 , &(args_info->angle_r_given),
1548 +                &(local_args_info.angle_r_given), optarg, 0, 0, ARG_NO,
1549 +                check_ambiguity, override, 0, 0,
1550 +                "angle_r", '-',
1551 +                additional_error))
1552 +              goto failure;
1553 +          
1554 +          }
1555            /* hull volume of nanoparticle.  */
1556            else if (strcmp (long_options[option_index].name, "hullvol") == 0)
1557            {
# Line 1472 | Line 1569 | cmdline_parser_internal (int argc, char * const *argv,
1569                goto failure;
1570            
1571            }
1572 +          /* length of nanorod.  */
1573 +          else if (strcmp (long_options[option_index].name, "rodlength") == 0)
1574 +          {
1575            
1576 +            if (args_info->staticProps_group_counter && override)
1577 +              reset_group_staticProps (args_info);
1578 +            args_info->staticProps_group_counter += 1;
1579 +          
1580 +            if (update_arg( 0 ,
1581 +                 0 , &(args_info->rodlength_given),
1582 +                &(local_args_info.rodlength_given), optarg, 0, 0, ARG_NO,
1583 +                check_ambiguity, override, 0, 0,
1584 +                "rodlength", '-',
1585 +                additional_error))
1586 +              goto failure;
1587 +          
1588 +          }
1589 +          /* tetrahedrality order parameter by zbin(--sele1 must be specified).  */
1590 +          else if (strcmp (long_options[option_index].name, "tet_param_z") == 0)
1591 +          {
1592 +          
1593 +            if (args_info->staticProps_group_counter && override)
1594 +              reset_group_staticProps (args_info);
1595 +            args_info->staticProps_group_counter += 1;
1596 +          
1597 +            if (update_arg( 0 ,
1598 +                 0 , &(args_info->tet_param_z_given),
1599 +                &(local_args_info.tet_param_z_given), optarg, 0, 0, ARG_NO,
1600 +                check_ambiguity, override, 0, 0,
1601 +                "tet_param_z", '-',
1602 +                additional_error))
1603 +              goto failure;
1604 +          
1605 +          }
1606 +          
1607            break;
1608          case '?':       /* Invalid option.  */
1609            /* `getopt_long' already printed an error message.  */
# Line 1486 | Line 1617 | cmdline_parser_internal (int argc, char * const *argv,
1617  
1618    if (args_info->staticProps_group_counter > 1)
1619      {
1620 <      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 : ""));
1620 >      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 : ""));
1621        error = 1;
1622      }
1623    

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines