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 1795 by gezelter, Fri Sep 7 18:13:55 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 + #ifdef WIN32
25 + #include "utils/wingetopt.h"
26 + #else
27 + #include <getopt.h>
28 + #endif
29 +
30   #include "StaticPropsCmd.h"
31  
32   const char *gengetopt_args_info_purpose = "";
# Line 56 | Line 64 | const char *gengetopt_args_info_help[] = {
64    "      --bo                      bond order parameter (--rcut must be specified)",
65    "      --bor                     bond order parameter as a function of radius \n                                  (--rcut must be specified)",
66    "      --bad                     N(theta) bond angle density within (--rcut must \n                                  be specified)",
67 +  "      --count                   count of molecules matching selection criteria \n                                  (and associated statistics)",
68    "  -g, --gofr                    g(r)",
69    "      --gofz                    g(z)",
70    "      --r_theta                 g(r, cos(theta))",
# Line 64 | Line 73 | const char *gengetopt_args_info_help[] = {
73    "      --theta_omega             g(cos(theta), cos(omega))",
74    "      --gxyz                    g(x, y, z)",
75    "      --twodgofr                2D g(r) (Slab width --dz must be specified)",
76 <  "  -p, --p2                      p2 order parameter (--sele1 and --sele2 must be \n                                  specified)",
76 >  "  -p, --p2                      p2 order parameter (--sele1 must be specified, \n                                  --sele2 is optional)",
77    "      --rp2                     rp2 order parameter (--sele1 and --sele2 must \n                                  be specified)",
78    "  -s, --scd                     scd order parameter (either --sele1, --sele2, \n                                  --sele3 are specified or --molname, --begin, \n                                  --end are specified)",
79    "  -d, --density                 density plot",
# Line 72 | Line 81 | const char *gengetopt_args_info_help[] = {
81    "      --p_angle                 p(cos(theta))",
82    "      --hxy                     hxy",
83    "      --rho_r                   rho of R",
84 +  "      --angle_r                 angle of R",
85    "      --hullvol                 hull volume of nanoparticle",
86 +  "      --rodlength               length of nanorod",
87 +  "  -Q, --tet_param               tetrahedrality order parameter",
88 +  "      --tet_param_z             tetrahedrality order parameter by zbin(--sele1 \n                                  must be specified)",
89      0
90   };
91  
# Line 88 | Line 101 | static int
101   void clear_args (struct gengetopt_args_info *args_info);
102  
103   static int
104 < cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info,
104 > cmdline_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info,
105                          struct cmdline_parser_params *params, const char *additional_error);
106  
107   static int
# Line 127 | Line 140 | void clear_given (struct gengetopt_args_info *args_inf
140    args_info->bo_given = 0 ;
141    args_info->bor_given = 0 ;
142    args_info->bad_given = 0 ;
143 +  args_info->count_given = 0 ;
144    args_info->gofr_given = 0 ;
145    args_info->gofz_given = 0 ;
146    args_info->r_theta_given = 0 ;
# Line 143 | Line 157 | void clear_given (struct gengetopt_args_info *args_inf
157    args_info->p_angle_given = 0 ;
158    args_info->hxy_given = 0 ;
159    args_info->rho_r_given = 0 ;
160 +  args_info->angle_r_given = 0 ;
161    args_info->hullvol_given = 0 ;
162 +  args_info->rodlength_given = 0 ;
163 +  args_info->tet_param_given = 0 ;
164 +  args_info->tet_param_z_given = 0 ;
165    args_info->staticProps_group_counter = 0 ;
166   }
167  
168   static
169   void clear_args (struct gengetopt_args_info *args_info)
170   {
171 +  FIX_UNUSED (args_info);
172    args_info->input_arg = NULL;
173    args_info->input_orig = NULL;
174    args_info->output_arg = NULL;
# Line 222 | Line 241 | void init_args_info(struct gengetopt_args_info *args_i
241    args_info->bo_help = gengetopt_args_info_help[25] ;
242    args_info->bor_help = gengetopt_args_info_help[26] ;
243    args_info->bad_help = gengetopt_args_info_help[27] ;
244 <  args_info->gofr_help = gengetopt_args_info_help[28] ;
245 <  args_info->gofz_help = gengetopt_args_info_help[29] ;
246 <  args_info->r_theta_help = gengetopt_args_info_help[30] ;
247 <  args_info->r_omega_help = gengetopt_args_info_help[31] ;
248 <  args_info->r_z_help = gengetopt_args_info_help[32] ;
249 <  args_info->theta_omega_help = gengetopt_args_info_help[33] ;
250 <  args_info->gxyz_help = gengetopt_args_info_help[34] ;
251 <  args_info->twodgofr_help = gengetopt_args_info_help[35] ;
252 <  args_info->p2_help = gengetopt_args_info_help[36] ;
253 <  args_info->rp2_help = gengetopt_args_info_help[37] ;
254 <  args_info->scd_help = gengetopt_args_info_help[38] ;
255 <  args_info->density_help = gengetopt_args_info_help[39] ;
256 <  args_info->slab_density_help = gengetopt_args_info_help[40] ;
257 <  args_info->p_angle_help = gengetopt_args_info_help[41] ;
258 <  args_info->hxy_help = gengetopt_args_info_help[42] ;
259 <  args_info->rho_r_help = gengetopt_args_info_help[43] ;
260 <  args_info->hullvol_help = gengetopt_args_info_help[44] ;
244 >  args_info->count_help = gengetopt_args_info_help[28] ;
245 >  args_info->gofr_help = gengetopt_args_info_help[29] ;
246 >  args_info->gofz_help = gengetopt_args_info_help[30] ;
247 >  args_info->r_theta_help = gengetopt_args_info_help[31] ;
248 >  args_info->r_omega_help = gengetopt_args_info_help[32] ;
249 >  args_info->r_z_help = gengetopt_args_info_help[33] ;
250 >  args_info->theta_omega_help = gengetopt_args_info_help[34] ;
251 >  args_info->gxyz_help = gengetopt_args_info_help[35] ;
252 >  args_info->twodgofr_help = gengetopt_args_info_help[36] ;
253 >  args_info->p2_help = gengetopt_args_info_help[37] ;
254 >  args_info->rp2_help = gengetopt_args_info_help[38] ;
255 >  args_info->scd_help = gengetopt_args_info_help[39] ;
256 >  args_info->density_help = gengetopt_args_info_help[40] ;
257 >  args_info->slab_density_help = gengetopt_args_info_help[41] ;
258 >  args_info->p_angle_help = gengetopt_args_info_help[42] ;
259 >  args_info->hxy_help = gengetopt_args_info_help[43] ;
260 >  args_info->rho_r_help = gengetopt_args_info_help[44] ;
261 >  args_info->angle_r_help = gengetopt_args_info_help[45] ;
262 >  args_info->hullvol_help = gengetopt_args_info_help[46] ;
263 >  args_info->rodlength_help = gengetopt_args_info_help[47] ;
264 >  args_info->tet_param_help = gengetopt_args_info_help[48] ;
265 >  args_info->tet_param_z_help = gengetopt_args_info_help[49] ;
266    
267   }
268  
269   void
270   cmdline_parser_print_version (void)
271   {
272 <  printf ("%s %s\n", CMDLINE_PARSER_PACKAGE, CMDLINE_PARSER_VERSION);
272 >  printf ("%s %s\n",
273 >     (strlen(CMDLINE_PARSER_PACKAGE_NAME) ? CMDLINE_PARSER_PACKAGE_NAME : CMDLINE_PARSER_PACKAGE),
274 >     CMDLINE_PARSER_VERSION);
275   }
276  
277   static void print_help_common(void) {
# Line 260 | Line 286 | static void print_help_common(void) {
286    printf("\n");
287  
288    if (strlen(gengetopt_args_info_description) > 0)
289 <    printf("%s\n", gengetopt_args_info_description);
289 >    printf("%s\n\n", gengetopt_args_info_description);
290   }
291  
292   void
# Line 279 | Line 305 | cmdline_parser_init (struct gengetopt_args_info *args_
305    clear_args (args_info);
306    init_args_info (args_info);
307  
308 <  args_info->inputs = NULL;
308 >  args_info->inputs = 0;
309    args_info->inputs_num = 0;
310   }
311  
# Line 363 | Line 389 | static void
389  
390  
391   static void
392 < write_into_file(FILE *outfile, const char *opt, const char *arg, char *values[])
392 > write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[])
393   {
394 +  FIX_UNUSED (values);
395    if (arg) {
396      fprintf(outfile, "%s=\"%s\"\n", opt, arg);
397    } else {
# Line 438 | Line 465 | cmdline_parser_dump(FILE *outfile, struct gengetopt_ar
465      write_into_file(outfile, "bor", 0, 0 );
466    if (args_info->bad_given)
467      write_into_file(outfile, "bad", 0, 0 );
468 +  if (args_info->count_given)
469 +    write_into_file(outfile, "count", 0, 0 );
470    if (args_info->gofr_given)
471      write_into_file(outfile, "gofr", 0, 0 );
472    if (args_info->gofz_given)
# Line 470 | Line 499 | cmdline_parser_dump(FILE *outfile, struct gengetopt_ar
499      write_into_file(outfile, "hxy", 0, 0 );
500    if (args_info->rho_r_given)
501      write_into_file(outfile, "rho_r", 0, 0 );
502 +  if (args_info->angle_r_given)
503 +    write_into_file(outfile, "angle_r", 0, 0 );
504    if (args_info->hullvol_given)
505      write_into_file(outfile, "hullvol", 0, 0 );
506 +  if (args_info->rodlength_given)
507 +    write_into_file(outfile, "rodlength", 0, 0 );
508 +  if (args_info->tet_param_given)
509 +    write_into_file(outfile, "tet_param", 0, 0 );
510 +  if (args_info->tet_param_z_given)
511 +    write_into_file(outfile, "tet_param_z", 0, 0 );
512    
513  
514    i = EXIT_SUCCESS;
# Line 508 | Line 545 | gengetopt_strdup (const char *s)
545   char *
546   gengetopt_strdup (const char *s)
547   {
548 <  char *result = NULL;
548 >  char *result = 0;
549    if (!s)
550      return result;
551  
# Line 528 | Line 565 | reset_group_staticProps(struct gengetopt_args_info *ar
565    args_info->bo_given = 0 ;
566    args_info->bor_given = 0 ;
567    args_info->bad_given = 0 ;
568 +  args_info->count_given = 0 ;
569    args_info->gofr_given = 0 ;
570    args_info->gofz_given = 0 ;
571    args_info->r_theta_given = 0 ;
# Line 544 | Line 582 | reset_group_staticProps(struct gengetopt_args_info *ar
582    args_info->p_angle_given = 0 ;
583    args_info->hxy_given = 0 ;
584    args_info->rho_r_given = 0 ;
585 +  args_info->angle_r_given = 0 ;
586    args_info->hullvol_given = 0 ;
587 +  args_info->rodlength_given = 0 ;
588 +  args_info->tet_param_given = 0 ;
589 +  args_info->tet_param_z_given = 0 ;
590  
591    args_info->staticProps_group_counter = 0;
592   }
593  
594   int
595 < cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info)
595 > cmdline_parser (int argc, char **argv, struct gengetopt_args_info *args_info)
596   {
597    return cmdline_parser2 (argc, argv, args_info, 0, 1, 1);
598   }
599  
600   int
601 < cmdline_parser_ext (int argc, char * const *argv, struct gengetopt_args_info *args_info,
601 > cmdline_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info,
602                     struct cmdline_parser_params *params)
603   {
604    int result;
605 <  result = cmdline_parser_internal (argc, argv, args_info, params, NULL);
605 >  result = cmdline_parser_internal (argc, argv, args_info, params, 0);
606  
607    if (result == EXIT_FAILURE)
608      {
# Line 572 | Line 614 | int
614   }
615  
616   int
617 < cmdline_parser2 (int argc, char * const *argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required)
617 > cmdline_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required)
618   {
619    int result;
620    struct cmdline_parser_params params;
# Line 583 | Line 625 | cmdline_parser2 (int argc, char * const *argv, struct
625    params.check_ambiguity = 0;
626    params.print_errors = 1;
627  
628 <  result = cmdline_parser_internal (argc, argv, args_info, &params, NULL);
628 >  result = cmdline_parser_internal (argc, argv, args_info, &params, 0);
629  
630    if (result == EXIT_FAILURE)
631      {
# Line 599 | Line 641 | cmdline_parser_required (struct gengetopt_args_info *a
641   {
642    int result = EXIT_SUCCESS;
643  
644 <  if (cmdline_parser_required2(args_info, prog_name, NULL) > 0)
644 >  if (cmdline_parser_required2(args_info, prog_name, 0) > 0)
645      result = EXIT_FAILURE;
646  
647    if (result == EXIT_FAILURE)
# Line 615 | Line 657 | cmdline_parser_required2 (struct gengetopt_args_info *
657   cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error)
658   {
659    int error = 0;
660 +  FIX_UNUSED (additional_error);
661  
662    /* checks for required options */
663    if (! args_info->input_given)
# Line 625 | Line 668 | cmdline_parser_required2 (struct gengetopt_args_info *
668    
669    if (args_info->staticProps_group_counter == 0)
670      {
671 <      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 : ""));
671 >      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 : ""));
672        error = 1;
673      }
674    
# Line 659 | Line 702 | int update_arg(void *field, char **orig_field,
702   static
703   int update_arg(void *field, char **orig_field,
704                 unsigned int *field_given, unsigned int *prev_given,
705 <               char *value, char *possible_values[], const char *default_value,
705 >               char *value, const char *possible_values[],
706 >               const char *default_value,
707                 cmdline_parser_arg_type arg_type,
708                 int check_ambiguity, int override,
709                 int no_free, int multiple_option,
# Line 670 | Line 714 | int update_arg(void *field, char **orig_field,
714    const char *val = value;
715    int found;
716    char **string_field;
717 +  FIX_UNUSED (field);
718  
719    stop_char = 0;
720    found = 0;
# Line 687 | Line 732 | int update_arg(void *field, char **orig_field,
732        return 1; /* failure */
733      }
734  
735 +  FIX_UNUSED (default_value);
736      
737    if (field_given && *field_given && ! override)
738      return 0;
# Line 750 | Line 796 | int
796  
797  
798   int
799 < cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info,
799 > cmdline_parser_internal (
800 >  int argc, char **argv, struct gengetopt_args_info *args_info,
801                          struct cmdline_parser_params *params, const char *additional_error)
802   {
803    int c;        /* Character of the parsed option.  */
# Line 812 | Line 859 | cmdline_parser_internal (int argc, char * const *argv,
859          { "bo", 0, NULL, 0 },
860          { "bor",        0, NULL, 0 },
861          { "bad",        0, NULL, 0 },
862 +        { "count",      0, NULL, 0 },
863          { "gofr",       0, NULL, 'g' },
864          { "gofz",       0, NULL, 0 },
865          { "r_theta",    0, NULL, 0 },
# Line 828 | Line 876 | cmdline_parser_internal (int argc, char * const *argv,
876          { "p_angle",    0, NULL, 0 },
877          { "hxy",        0, NULL, 0 },
878          { "rho_r",      0, NULL, 0 },
879 +        { "angle_r",    0, NULL, 0 },
880          { "hullvol",    0, NULL, 0 },
881 <        { NULL, 0, NULL, 0 }
881 >        { "rodlength",  0, NULL, 0 },
882 >        { "tet_param",  0, NULL, 'Q' },
883 >        { "tet_param_z",        0, NULL, 0 },
884 >        { 0,  0, 0, 0 }
885        };
886  
887 <      c = getopt_long (argc, argv, "hVi:o:n:b:x:y:a:c:z:gpsd", long_options, &option_index);
887 >      c = getopt_long (argc, argv, "hVi:o:n:b:x:y:a:c:z:gpsdQ", long_options, &option_index);
888  
889        if (c == -1) break;       /* Exit from `while (1)' loop.  */
890  
# Line 971 | Line 1023 | cmdline_parser_internal (int argc, char * const *argv,
1023              goto failure;
1024          
1025            break;
1026 <        case 'p':       /* p2 order parameter (--sele1 and --sele2 must be specified).  */
1026 >        case 'p':       /* p2 order parameter (--sele1 must be specified, --sele2 is optional).  */
1027          
1028            if (args_info->staticProps_group_counter && override)
1029              reset_group_staticProps (args_info);
# Line 1012 | Line 1064 | cmdline_parser_internal (int argc, char * const *argv,
1064                &(local_args_info.density_given), optarg, 0, 0, ARG_NO,
1065                check_ambiguity, override, 0, 0,
1066                "density", 'd',
1067 +              additional_error))
1068 +            goto failure;
1069 +        
1070 +          break;
1071 +        case 'Q':       /* tetrahedrality order parameter.  */
1072 +        
1073 +          if (args_info->staticProps_group_counter && override)
1074 +            reset_group_staticProps (args_info);
1075 +          args_info->staticProps_group_counter += 1;
1076 +        
1077 +          if (update_arg( 0 ,
1078 +               0 , &(args_info->tet_param_given),
1079 +              &(local_args_info.tet_param_given), optarg, 0, 0, ARG_NO,
1080 +              check_ambiguity, override, 0, 0,
1081 +              "tet_param", 'Q',
1082                additional_error))
1083              goto failure;
1084          
# Line 1251 | Line 1318 | cmdline_parser_internal (int argc, char * const *argv,
1318                goto failure;
1319            
1320            }
1321 +          /* count of molecules matching selection criteria (and associated statistics).  */
1322 +          else if (strcmp (long_options[option_index].name, "count") == 0)
1323 +          {
1324 +          
1325 +            if (args_info->staticProps_group_counter && override)
1326 +              reset_group_staticProps (args_info);
1327 +            args_info->staticProps_group_counter += 1;
1328 +          
1329 +            if (update_arg( 0 ,
1330 +                 0 , &(args_info->count_given),
1331 +                &(local_args_info.count_given), optarg, 0, 0, ARG_NO,
1332 +                check_ambiguity, override, 0, 0,
1333 +                "count", '-',
1334 +                additional_error))
1335 +              goto failure;
1336 +          
1337 +          }
1338            /* g(z).  */
1339            else if (strcmp (long_options[option_index].name, "gofz") == 0)
1340            {
# Line 1455 | Line 1539 | cmdline_parser_internal (int argc, char * const *argv,
1539                goto failure;
1540            
1541            }
1542 +          /* angle of R.  */
1543 +          else if (strcmp (long_options[option_index].name, "angle_r") == 0)
1544 +          {
1545 +          
1546 +            if (args_info->staticProps_group_counter && override)
1547 +              reset_group_staticProps (args_info);
1548 +            args_info->staticProps_group_counter += 1;
1549 +          
1550 +            if (update_arg( 0 ,
1551 +                 0 , &(args_info->angle_r_given),
1552 +                &(local_args_info.angle_r_given), optarg, 0, 0, ARG_NO,
1553 +                check_ambiguity, override, 0, 0,
1554 +                "angle_r", '-',
1555 +                additional_error))
1556 +              goto failure;
1557 +          
1558 +          }
1559            /* hull volume of nanoparticle.  */
1560            else if (strcmp (long_options[option_index].name, "hullvol") == 0)
1561            {
# Line 1472 | Line 1573 | cmdline_parser_internal (int argc, char * const *argv,
1573                goto failure;
1574            
1575            }
1576 +          /* length of nanorod.  */
1577 +          else if (strcmp (long_options[option_index].name, "rodlength") == 0)
1578 +          {
1579            
1580 +            if (args_info->staticProps_group_counter && override)
1581 +              reset_group_staticProps (args_info);
1582 +            args_info->staticProps_group_counter += 1;
1583 +          
1584 +            if (update_arg( 0 ,
1585 +                 0 , &(args_info->rodlength_given),
1586 +                &(local_args_info.rodlength_given), optarg, 0, 0, ARG_NO,
1587 +                check_ambiguity, override, 0, 0,
1588 +                "rodlength", '-',
1589 +                additional_error))
1590 +              goto failure;
1591 +          
1592 +          }
1593 +          /* tetrahedrality order parameter by zbin(--sele1 must be specified).  */
1594 +          else if (strcmp (long_options[option_index].name, "tet_param_z") == 0)
1595 +          {
1596 +          
1597 +            if (args_info->staticProps_group_counter && override)
1598 +              reset_group_staticProps (args_info);
1599 +            args_info->staticProps_group_counter += 1;
1600 +          
1601 +            if (update_arg( 0 ,
1602 +                 0 , &(args_info->tet_param_z_given),
1603 +                &(local_args_info.tet_param_z_given), optarg, 0, 0, ARG_NO,
1604 +                check_ambiguity, override, 0, 0,
1605 +                "tet_param_z", '-',
1606 +                additional_error))
1607 +              goto failure;
1608 +          
1609 +          }
1610 +          
1611            break;
1612          case '?':       /* Invalid option.  */
1613            /* `getopt_long' already printed an error message.  */
# Line 1486 | Line 1621 | cmdline_parser_internal (int argc, char * const *argv,
1621  
1622    if (args_info->staticProps_group_counter > 1)
1623      {
1624 <      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 : ""));
1624 >      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 : ""));
1625        error = 1;
1626      }
1627    

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines